[PATCH 3/4] wined3d: Avoid accessing gl_info in vertexdeclaration_init().

Józef Kucia jkucia at codeweavers.com
Fri Aug 24 08:44:05 CDT 2018


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 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 a4cfd66dfc42..83e35638bc6e 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 9098b3225c85..c050a6dda9f1 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 8da12d7cf3f3..da3cd4615686 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
-- 
2.16.4




More information about the wine-devel mailing list