Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/adapter_gl.c | 2 +- dlls/wined3d/directx.c | 2 +- dlls/wined3d/utils.c | 22 ++++++++++++++++------ dlls/wined3d/wined3d_private.h | 3 ++- 4 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index e60383cce3b5..0198a97d6022 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -4279,7 +4279,7 @@ BOOL wined3d_adapter_opengl_init(struct wined3d_adapter *adapter, DWORD wined3d_ return FALSE; }
- if (!wined3d_adapter_init_format_info(adapter, &caps_gl_ctx)) + if (!wined3d_adapter_gl_init_format_info(adapter, &caps_gl_ctx)) { ERR("Failed to initialize GL format info.\n"); wined3d_caps_gl_ctx_destroy(&caps_gl_ctx); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 81c3b5d492d9..020b57d35916 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2491,7 +2491,7 @@ static BOOL wined3d_adapter_no3d_init(struct wined3d_adapter *adapter) adapter->vram_bytes_used = 0; TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->vram_bytes));
- if (!wined3d_adapter_init_format_info(adapter, NULL)) + if (!wined3d_adapter_init_format_info(adapter)) return FALSE;
adapter->vertex_pipe = &none_vertex_pipe; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index a7bcedffba8e..4f9fc131f911 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3947,17 +3947,27 @@ static void init_format_depth_bias_scale(struct wined3d_adapter *adapter, } }
-/* Context activation is done by the caller. */ -BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx) +BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter) { - struct wined3d_gl_info *gl_info = &adapter->gl_info; - if (!init_format_base_info(adapter)) return FALSE; if (!init_format_block_info(adapter)) goto fail; if (!init_format_decompress_info(adapter)) goto fail;
- if (!ctx) /* WINED3D_NO3D */ - return TRUE; + return TRUE; + +fail: + heap_free(adapter->formats); + adapter->formats = NULL; + return FALSE; +} + +/* Context activation is done by the caller. */ +BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx) +{ + struct wined3d_gl_info *gl_info = &adapter->gl_info; + + if (!wined3d_adapter_init_format_info(adapter)) + return FALSE;
if (!init_format_texture_info(adapter, gl_info)) goto fail; if (!init_format_vertex_info(adapter, gl_info)) goto fail; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 89cf44bcd4fe..1e215fe95c11 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2690,7 +2690,8 @@ struct wined3d_caps_gl_ctx GLuint test_program_id; };
-BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, +BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter) DECLSPEC_HIDDEN; +BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx) DECLSPEC_HIDDEN; UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) DECLSPEC_HIDDEN;