Module: wine Branch: master Commit: 6a38579d0ff7db6d4b5105e12283d488f7671065 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6a38579d0ff7db6d4b5105e12...
Author: Józef Kucia jkucia@codeweavers.com Date: Thu Sep 20 09:01:59 2018 +0200
wined3d: Introduce separate function for OpenGL formats initialisation.
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
---
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 0948741..9c074d3 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -4279,7 +4279,7 @@ BOOL wined3d_adapter_gl_init(struct wined3d_adapter *adapter, DWORD wined3d_crea 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 b6c6ecb..345e7b7 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2490,7 +2490,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 a7bcedf..4f9fc13 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 f01ad17..d8d5b04 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;