i965: Replace intel_state.c enums with those from brw_defines.h.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 29 Jun 2013 01:46:47 +0000 (18:46 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 3 Jul 2013 17:48:13 +0000 (10:48 -0700)
Both intel_context.h and brw_defines.h have #defines for comparison
functions, stencil ops, blending logic ops, and blending factors.
They're exactly the same values, so it makes sense to pick one.

brw_defines.h is the logical place for this kind of stuff, so this patch
converts intel_state.c to use the set defined there.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/gen6_blorp.cpp
src/mesa/drivers/dri/i965/intel_context.h
src/mesa/drivers/dri/i965/intel_state.c

index 3ccd90e8c88a38de4724f6606d8bc887f6588d3e..d900734d7404d552cfbd066e6bf6a780b94f03e8 100644 (file)
@@ -330,7 +330,7 @@ gen6_blorp_emit_depth_stencil_state(struct brw_context *brw,
    state->ds2.depth_write_enable = 1;
    if (params->hiz_op == GEN6_HIZ_OP_DEPTH_RESOLVE) {
       state->ds2.depth_test_enable = 1;
-      state->ds2.depth_test_func = COMPAREFUNC_NEVER;
+      state->ds2.depth_test_func = BRW_COMPAREFUNCTION_NEVER;
    }
 
    return depthstencil_offset;
index 781354845ce0fc631b79997dd5b8d2cfbd1ae919..38ccdba4aa32f53285240eb2db0e4962ca965ae1 100644 (file)
@@ -405,63 +405,6 @@ extern void intelInitDriverFunctions(struct dd_function_table *functions);
 
 void intel_init_syncobj_functions(struct dd_function_table *functions);
 
-
-/* ================================================================
- * intel_state.c:
- */
-
-#define COMPAREFUNC_ALWAYS             0
-#define COMPAREFUNC_NEVER              0x1
-#define COMPAREFUNC_LESS               0x2
-#define COMPAREFUNC_EQUAL              0x3
-#define COMPAREFUNC_LEQUAL             0x4
-#define COMPAREFUNC_GREATER            0x5
-#define COMPAREFUNC_NOTEQUAL           0x6
-#define COMPAREFUNC_GEQUAL             0x7
-
-#define STENCILOP_KEEP                 0
-#define STENCILOP_ZERO                 0x1
-#define STENCILOP_REPLACE              0x2
-#define STENCILOP_INCRSAT              0x3
-#define STENCILOP_DECRSAT              0x4
-#define STENCILOP_INCR                 0x5
-#define STENCILOP_DECR                 0x6
-#define STENCILOP_INVERT               0x7
-
-#define LOGICOP_CLEAR                  0
-#define LOGICOP_NOR                    0x1
-#define LOGICOP_AND_INV                0x2
-#define LOGICOP_COPY_INV               0x3
-#define LOGICOP_AND_RVRSE              0x4
-#define LOGICOP_INV                    0x5
-#define LOGICOP_XOR                    0x6
-#define LOGICOP_NAND                   0x7
-#define LOGICOP_AND                    0x8
-#define LOGICOP_EQUIV                  0x9
-#define LOGICOP_NOOP                   0xa
-#define LOGICOP_OR_INV                 0xb
-#define LOGICOP_COPY                   0xc
-#define LOGICOP_OR_RVRSE               0xd
-#define LOGICOP_OR                     0xe
-#define LOGICOP_SET                    0xf
-
-#define BLENDFACT_ZERO                 0x01
-#define BLENDFACT_ONE                  0x02
-#define BLENDFACT_SRC_COLR             0x03
-#define BLENDFACT_INV_SRC_COLR                 0x04
-#define BLENDFACT_SRC_ALPHA            0x05
-#define BLENDFACT_INV_SRC_ALPHA        0x06
-#define BLENDFACT_DST_ALPHA            0x07
-#define BLENDFACT_INV_DST_ALPHA        0x08
-#define BLENDFACT_DST_COLR             0x09
-#define BLENDFACT_INV_DST_COLR         0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE   0x0b
-#define BLENDFACT_CONST_COLOR          0x0c
-#define BLENDFACT_INV_CONST_COLOR      0x0d
-#define BLENDFACT_CONST_ALPHA          0x0e
-#define BLENDFACT_INV_CONST_ALPHA      0x0f
-#define BLENDFACT_MASK                 0x0f
-
 enum {
    DRI_CONF_BO_REUSE_DISABLED,
    DRI_CONF_BO_REUSE_ALL
index fccabdd06ebea6eee3cf0ea98672b49f4c48427d..e4a63e5c6ad08b36b8bc2761d06fd54cfdddfadf 100644 (file)
 
 #include "intel_screen.h"
 #include "intel_context.h"
+#include "brw_defines.h"
 
 int
 intel_translate_shadow_compare_func(GLenum func)
 {
    switch (func) {
    case GL_NEVER: 
-       return COMPAREFUNC_ALWAYS;
+       return BRW_COMPAREFUNCTION_ALWAYS;
    case GL_LESS: 
-       return COMPAREFUNC_LEQUAL;
+       return BRW_COMPAREFUNCTION_LEQUAL;
    case GL_LEQUAL: 
-       return COMPAREFUNC_LESS;
+       return BRW_COMPAREFUNCTION_LESS;
    case GL_GREATER: 
-       return COMPAREFUNC_GEQUAL;
+       return BRW_COMPAREFUNCTION_GEQUAL;
    case GL_GEQUAL: 
-      return COMPAREFUNC_GREATER;
+      return BRW_COMPAREFUNCTION_GREATER;
    case GL_NOTEQUAL: 
-      return COMPAREFUNC_EQUAL;
+      return BRW_COMPAREFUNCTION_EQUAL;
    case GL_EQUAL: 
-      return COMPAREFUNC_NOTEQUAL;
+      return BRW_COMPAREFUNCTION_NOTEQUAL;
    case GL_ALWAYS: 
-       return COMPAREFUNC_NEVER;
+       return BRW_COMPAREFUNCTION_NEVER;
    }
 
    fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
-   return COMPAREFUNC_NEVER;
+   return BRW_COMPAREFUNCTION_NEVER;
 }
 
 int
@@ -67,25 +68,25 @@ intel_translate_compare_func(GLenum func)
 {
    switch (func) {
    case GL_NEVER:
-      return COMPAREFUNC_NEVER;
+      return BRW_COMPAREFUNCTION_NEVER;
    case GL_LESS:
-      return COMPAREFUNC_LESS;
+      return BRW_COMPAREFUNCTION_LESS;
    case GL_LEQUAL:
-      return COMPAREFUNC_LEQUAL;
+      return BRW_COMPAREFUNCTION_LEQUAL;
    case GL_GREATER:
-      return COMPAREFUNC_GREATER;
+      return BRW_COMPAREFUNCTION_GREATER;
    case GL_GEQUAL:
-      return COMPAREFUNC_GEQUAL;
+      return BRW_COMPAREFUNCTION_GEQUAL;
    case GL_NOTEQUAL:
-      return COMPAREFUNC_NOTEQUAL;
+      return BRW_COMPAREFUNCTION_NOTEQUAL;
    case GL_EQUAL:
-      return COMPAREFUNC_EQUAL;
+      return BRW_COMPAREFUNCTION_EQUAL;
    case GL_ALWAYS:
-      return COMPAREFUNC_ALWAYS;
+      return BRW_COMPAREFUNCTION_ALWAYS;
    }
 
    fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
-   return COMPAREFUNC_ALWAYS;
+   return BRW_COMPAREFUNCTION_ALWAYS;
 }
 
 int
@@ -93,23 +94,23 @@ intel_translate_stencil_op(GLenum op)
 {
    switch (op) {
    case GL_KEEP:
-      return STENCILOP_KEEP;
+      return BRW_STENCILOP_KEEP;
    case GL_ZERO:
-      return STENCILOP_ZERO;
+      return BRW_STENCILOP_ZERO;
    case GL_REPLACE:
-      return STENCILOP_REPLACE;
+      return BRW_STENCILOP_REPLACE;
    case GL_INCR:
-      return STENCILOP_INCRSAT;
+      return BRW_STENCILOP_INCRSAT;
    case GL_DECR:
-      return STENCILOP_DECRSAT;
+      return BRW_STENCILOP_DECRSAT;
    case GL_INCR_WRAP:
-      return STENCILOP_INCR;
+      return BRW_STENCILOP_INCR;
    case GL_DECR_WRAP:
-      return STENCILOP_DECR;
+      return BRW_STENCILOP_DECR;
    case GL_INVERT:
-      return STENCILOP_INVERT;
+      return BRW_STENCILOP_INVERT;
    default:
-      return STENCILOP_ZERO;
+      return BRW_STENCILOP_ZERO;
    }
 }
 
@@ -118,38 +119,38 @@ intel_translate_logic_op(GLenum opcode)
 {
    switch (opcode) {
    case GL_CLEAR:
-      return LOGICOP_CLEAR;
+      return BRW_LOGICOPFUNCTION_CLEAR;
    case GL_AND:
-      return LOGICOP_AND;
+      return BRW_LOGICOPFUNCTION_AND;
    case GL_AND_REVERSE:
-      return LOGICOP_AND_RVRSE;
+      return BRW_LOGICOPFUNCTION_AND_REVERSE;
    case GL_COPY:
-      return LOGICOP_COPY;
+      return BRW_LOGICOPFUNCTION_COPY;
    case GL_COPY_INVERTED:
-      return LOGICOP_COPY_INV;
+      return BRW_LOGICOPFUNCTION_COPY_INVERTED;
    case GL_AND_INVERTED:
-      return LOGICOP_AND_INV;
+      return BRW_LOGICOPFUNCTION_AND_INVERTED;
    case GL_NOOP:
-      return LOGICOP_NOOP;
+      return BRW_LOGICOPFUNCTION_NOOP;
    case GL_XOR:
-      return LOGICOP_XOR;
+      return BRW_LOGICOPFUNCTION_XOR;
    case GL_OR:
-      return LOGICOP_OR;
+      return BRW_LOGICOPFUNCTION_OR;
    case GL_OR_INVERTED:
-      return LOGICOP_OR_INV;
+      return BRW_LOGICOPFUNCTION_OR_INVERTED;
    case GL_NOR:
-      return LOGICOP_NOR;
+      return BRW_LOGICOPFUNCTION_NOR;
    case GL_EQUIV:
-      return LOGICOP_EQUIV;
+      return BRW_LOGICOPFUNCTION_EQUIV;
    case GL_INVERT:
-      return LOGICOP_INV;
+      return BRW_LOGICOPFUNCTION_INVERT;
    case GL_OR_REVERSE:
-      return LOGICOP_OR_RVRSE;
+      return BRW_LOGICOPFUNCTION_OR_REVERSE;
    case GL_NAND:
-      return LOGICOP_NAND;
+      return BRW_LOGICOPFUNCTION_NAND;
    case GL_SET:
-      return LOGICOP_SET;
+      return BRW_LOGICOPFUNCTION_SET;
    default:
-      return LOGICOP_SET;
+      return BRW_LOGICOPFUNCTION_SET;
    }
 }