i965: Add support for the CMP opcode in the GLSL path.
authorEric Anholt <eric@anholt.net>
Wed, 10 Mar 2010 19:00:40 +0000 (11:00 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 16 Mar 2010 19:14:18 +0000 (12:14 -0700)
This would be triggered by use of sqrt() along with control flow.
Fixes piglit-fs-sqrt-branch and a bug in Yo Frankie!.
(cherry picked from commit 48dca99feb394febc3af44e14f23fb12a9cc9204)

src/mesa/drivers/dri/i965/brw_wm.h
src/mesa/drivers/dri/i965/brw_wm_emit.c
src/mesa/drivers/dri/i965/brw_wm_glsl.c

index 88d84ee82febb549e08064f3b7f53ad11bfbd874..47b764d24d1b67d4c4abff40673e8ecb757ca219 100644 (file)
@@ -328,6 +328,12 @@ void emit_cinterp(struct brw_compile *p,
                  const struct brw_reg *dst,
                  GLuint mask,
                  const struct brw_reg *arg0);
+void emit_cmp(struct brw_compile *p,
+             const struct brw_reg *dst,
+             GLuint mask,
+             const struct brw_reg *arg0,
+             const struct brw_reg *arg1,
+             const struct brw_reg *arg2);
 void emit_ddxy(struct brw_compile *p,
               const struct brw_reg *dst,
               GLuint mask,
index 9315bca3156ce9d8f95e7b7f20846a0a623ef497..c7d87b9d94cdf9c7af0c3cb73eadb2b69d637bed 100644 (file)
@@ -566,12 +566,12 @@ static void emit_sne( struct brw_compile *p,
    emit_sop(p, dst, mask, BRW_CONDITIONAL_NEQ, arg0, arg1);
 }
 
-static void emit_cmp( struct brw_compile *p, 
-                     const struct brw_reg *dst,
-                     GLuint mask,
-                     const struct brw_reg *arg0,
-                     const struct brw_reg *arg1,
-                     const struct brw_reg *arg2 )
+void emit_cmp(struct brw_compile *p,
+             const struct brw_reg *dst,
+             GLuint mask,
+             const struct brw_reg *arg0,
+             const struct brw_reg *arg1,
+             const struct brw_reg *arg2)
 {
    GLuint i;
 
index 562608e2ecdfb6d8833f36a1415109c48e47e968..a42e6bf7a58788532472949ccb79eb6c3ca1358e 100644 (file)
@@ -1960,6 +1960,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
            case OPCODE_LG2:
                emit_math1(c, BRW_MATH_FUNCTION_LOG, dst, dst_flags, args[0]);
                break;
+           case OPCODE_CMP:
+               emit_cmp(p, dst, dst_flags, args[0], args[1], args[2]);
+               break;
            case OPCODE_MIN:    
                unalias2(c, emit_min, dst, dst_flags, args[0], args[1]);
                break;