[PATCH 2/2] wined3d: Add an explicit break in case of unhandled BUMPENVMAP

Stefan Dösinger stefan at codeweavers.com
Sun Dec 2 09:00:46 CST 2012


I've chosen this option over a drop-through for consistency. There's
nothing special about BUMPENVMAP other than its code happens to be next
to the default: error handler.
---
 dlls/wined3d/nvidia_texture_shader.c |   29 ++++++++++++++++-------------
 dlls/wined3d/state.c                 |    5 +++++
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c
index 9a77e1d..52f4341 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -446,23 +446,26 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
 
         case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
         case WINED3D_TOP_BUMPENVMAP:
-            if (gl_info->supported[NV_TEXTURE_SHADER])
+            if (!gl_info->supported[NV_TEXTURE_SHADER])
             {
-                /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
-                 * perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
-                 * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
-                 * (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the next stage
-                 */
-                GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
-                           tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
-                GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
-                           GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
-                /* Always pass through to CURRENT, ignore temp arg */
-                GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
-                           GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
+                WARN("BUMPENVMAP requires GL_NV_texture_shader in this codepath\n");
                 break;
             }
 
+            /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
+             * perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
+             * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
+             * (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the
+             * next stage */
+            GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
+                        tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
+            GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
+                        GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
+            /* Always pass through to CURRENT, ignore temp arg */
+            GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
+                        GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
+            break;
+
         default:
             FIXME("Unhandled texture op: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d.\n",
                   stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 9b5d875..fae7964 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -2628,6 +2628,8 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
             case WINED3D_TOP_BUMPENVMAP:
             case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
                 FIXME("Implement bump environment mapping in GL_NV_texture_env_combine4 path\n");
+                Handled = FALSE;
+                break;
 
             default:
                 Handled = FALSE;
@@ -3090,6 +3092,9 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
                  */
                 FIXME("Implement bump mapping with GL_NV_texture_shader in non register combiner path\n");
             }
+            Handled = FALSE;
+            break;
+
         default:
             Handled = FALSE;
     }
-- 
1.7.8.6




More information about the wine-patches mailing list