wined3d: Fix GLSL cnd instruction

Fabian Bieler der.fabe at gmx.net
Thu Apr 5 04:05:23 CDT 2007


On Thursday 05 April 2007 08:55, H. Verbeet wrote:
> On 05/04/07, Fabian Bieler <der.fabe at gmx.net> wrote:
> > According to MSDN the cnd instruction should translate:
> > dst = src0 > 0.5 ? src1 : src2;
> >
> > This matches the ARB implementation in wined3d and fixes the borders in
> > civ4.
> >
> > Note: On nvidia hardware this patch breaks the outro of Half-Life 2 with
> > dxlevel 80 and GLSL due to a driver bug.
>
> You should update the comment above the instruction as well then.
-------------- next part --------------
From 237558c3f32bbdfdf7ece686661e723fddf074c7 Mon Sep 17 00:00:00 2001
From: Fabian Bieler <der.fabe at gmx.net>
Date: Thu, 5 Apr 2007 10:07:00 +0200
Subject: [PATCH] wined3d: Fix GLSL cnd instruction

---
 dlls/wined3d/glsl_shader.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 3ceb935..5700902 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1148,7 +1148,7 @@ void shader_glsl_cmp(SHADER_OPCODE_ARG* arg) {
     }
 }
 
-/** Process the CND opcode in GLSL (dst = (src0 < 0.5) ? src1 : src2) */
+/** Process the CND opcode in GLSL (dst = (src0 > 0.5) ? src1 : src2) */
 /* For ps 1.1-1.3, only a single component of src0 is used. For ps 1.4
  * the compare is done per component of src0. */
 void shader_glsl_cnd(SHADER_OPCODE_ARG* arg) {
@@ -1164,7 +1164,7 @@ void shader_glsl_cnd(SHADER_OPCODE_ARG* arg) {
         shader_glsl_add_src_param(arg, arg->src[0], arg->src_addr[0], WINED3DSP_WRITEMASK_0, &src0_param);
         shader_glsl_add_src_param(arg, arg->src[1], arg->src_addr[1], write_mask, &src1_param);
         shader_glsl_add_src_param(arg, arg->src[2], arg->src_addr[2], write_mask, &src2_param);
-        shader_addline(arg->buffer, "%s < 0.5 ? %s : %s);\n",
+        shader_addline(arg->buffer, "%s > 0.5 ? %s : %s);\n",
                 src0_param.param_str, src1_param.param_str, src2_param.param_str);
         return;
     }
@@ -1185,7 +1185,7 @@ void shader_glsl_cnd(SHADER_OPCODE_ARG* arg) {
         shader_glsl_add_src_param(arg, arg->src[1], arg->src_addr[1], write_mask, &src1_param);
         shader_glsl_add_src_param(arg, arg->src[2], arg->src_addr[2], write_mask, &src2_param);
 
-        shader_addline(arg->buffer, "%s < 0.5 ? %s : %s);\n",
+        shader_addline(arg->buffer, "%s > 0.5 ? %s : %s);\n",
                 src0_param.param_str, src1_param.param_str, src2_param.param_str);
     }
 }
-- 
1.4.4.1



More information about the wine-patches mailing list