wined3d: Allocate memory for formats in wined3d_adapter_init_format_info().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ff6d7de8ca
commit
6d543d237c
|
@ -1994,23 +1994,15 @@ static enum wined3d_channel_type map_channel_type(char t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL init_format_base_info(struct wined3d_adapter *adapter, size_t format_size)
|
static BOOL init_format_base_info(struct wined3d_adapter *adapter)
|
||||||
{
|
{
|
||||||
struct wined3d_format *format;
|
struct wined3d_format *format;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
adapter->format_size = format_size;
|
|
||||||
if (!(adapter->formats = heap_calloc(WINED3D_FORMAT_COUNT
|
|
||||||
+ ARRAY_SIZE(typeless_depth_stencil_formats), adapter->format_size)))
|
|
||||||
{
|
|
||||||
ERR("Failed to allocate memory.\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
||||||
{
|
{
|
||||||
if (!(format = get_format_internal(adapter, formats[i].id)))
|
if (!(format = get_format_internal(adapter, formats[i].id)))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
format->id = formats[i].id;
|
format->id = formats[i].id;
|
||||||
format->red_size = formats[i].red_size;
|
format->red_size = formats[i].red_size;
|
||||||
|
@ -2036,10 +2028,10 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter, size_t format
|
||||||
DWORD flags = 0;
|
DWORD flags = 0;
|
||||||
|
|
||||||
if (!(format = get_format_internal(adapter, typed_formats[i].id)))
|
if (!(format = get_format_internal(adapter, typed_formats[i].id)))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
if (!(typeless_format = get_format_internal(adapter, typed_formats[i].typeless_id)))
|
if (!(typeless_format = get_format_internal(adapter, typed_formats[i].typeless_id)))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
format->id = typed_formats[i].id;
|
format->id = typed_formats[i].id;
|
||||||
format->red_size = typeless_format->red_size;
|
format->red_size = typeless_format->red_size;
|
||||||
|
@ -2087,7 +2079,7 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter, size_t format
|
||||||
for (i = 0; i < ARRAY_SIZE(ddi_formats); ++i)
|
for (i = 0; i < ARRAY_SIZE(ddi_formats); ++i)
|
||||||
{
|
{
|
||||||
if (!(format = get_format_internal(adapter, ddi_formats[i].id)))
|
if (!(format = get_format_internal(adapter, ddi_formats[i].id)))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
format->ddi_format = ddi_formats[i].ddi_format;
|
format->ddi_format = ddi_formats[i].ddi_format;
|
||||||
}
|
}
|
||||||
|
@ -2095,16 +2087,12 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter, size_t format
|
||||||
for (i = 0; i < ARRAY_SIZE(format_base_flags); ++i)
|
for (i = 0; i < ARRAY_SIZE(format_base_flags); ++i)
|
||||||
{
|
{
|
||||||
if (!(format = get_format_internal(adapter, format_base_flags[i].id)))
|
if (!(format = get_format_internal(adapter, format_base_flags[i].id)))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
format_set_flag(format, format_base_flags[i].flags);
|
format_set_flag(format, format_base_flags[i].flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
|
||||||
heap_free(adapter->formats);
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL init_format_block_info(struct wined3d_adapter *adapter)
|
static BOOL init_format_block_info(struct wined3d_adapter *adapter)
|
||||||
|
@ -3951,9 +3939,21 @@ static void init_format_depth_bias_scale(struct wined3d_adapter *adapter,
|
||||||
|
|
||||||
BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, size_t format_size)
|
BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, size_t format_size)
|
||||||
{
|
{
|
||||||
if (!init_format_base_info(adapter, format_size)) return FALSE;
|
unsigned int count = WINED3D_FORMAT_COUNT + ARRAY_SIZE(typeless_depth_stencil_formats);
|
||||||
if (!init_format_block_info(adapter)) goto fail;
|
|
||||||
if (!init_format_decompress_info(adapter)) goto fail;
|
if (!(adapter->formats = heap_calloc(count, format_size)))
|
||||||
|
{
|
||||||
|
ERR("Failed to allocate memory.\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
adapter->format_size = format_size;
|
||||||
|
|
||||||
|
if (!init_format_base_info(adapter))
|
||||||
|
goto fail;
|
||||||
|
if (!init_format_block_info(adapter))
|
||||||
|
goto fail;
|
||||||
|
if (!init_format_decompress_info(adapter))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue