From 25d55c42095e967ea5683664dd454cc6f67415f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 24 Aug 2018 15:44:05 +0200 Subject: [PATCH] wined3d: Avoid accessing gl_info in vertexdeclaration_init(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/context.c | 2 +- dlls/wined3d/vertexdeclaration.c | 6 +++--- dlls/wined3d/wined3d_private.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index a4cfd66dfc4..83e35638bc6 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -3683,7 +3683,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st if (use_vs(state)) { - if (state->vertex_declaration->half_float_conv_needed) + if (state->vertex_declaration->have_half_floats && !gl_info->supported[ARB_HALF_FLOAT_VERTEX]) { TRACE("Using immediate mode draw with vertex shaders for FLOAT16 conversion.\n"); context->use_immediate_mode_draw = TRUE; diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index 9098b3225c8..c050a6dda9f 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -174,7 +174,6 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara void *parent, const struct wined3d_parent_ops *parent_ops) { const struct wined3d_adapter *adapter = device->adapter; - const struct wined3d_gl_info *gl_info = &adapter->gl_info; unsigned int i; if (TRACE_ON(d3d_decl)) @@ -218,7 +217,8 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara /* Find the streams used in the declaration. The vertex buffers have * to be loaded when drawing, but filter tesselation pseudo streams. */ - if (e->input_slot >= MAX_STREAMS) continue; + if (e->input_slot >= MAX_STREAMS) + continue; if (!e->format->gl_vtx_format) { @@ -254,7 +254,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara if (elements[i].format == WINED3DFMT_R16G16_FLOAT || elements[i].format == WINED3DFMT_R16G16B16A16_FLOAT) { - if (!gl_info->supported[ARB_HALF_FLOAT_VERTEX]) declaration->half_float_conv_needed = TRUE; + declaration->have_half_floats = TRUE; } } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8da12d7cf3f..da3cd461568 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3463,10 +3463,10 @@ struct wined3d_vertex_declaration struct wined3d_device *device; struct wined3d_vertex_declaration_element *elements; - UINT element_count; + unsigned int element_count; BOOL position_transformed; - BOOL half_float_conv_needed; + BOOL have_half_floats; }; struct wined3d_saved_states