summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvc0
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-02-16 15:41:32 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-02-16 15:45:31 +0100
commit3903e25a2cd6c198581021242897b1952d2afea0 (patch)
treeabdf586db826ec98e1fbf920e0945029b18766d3 /src/gallium/drivers/nvc0
parent3f1361e060822c369f3b375bc695c9e65db59c29 (diff)
nvc0: fix blend factor mapping
Diffstat (limited to 'src/gallium/drivers/nvc0')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_state.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c
index ae5f335f9f..666e380297 100644
--- a/src/gallium/drivers/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nvc0/nvc0_state.c
@@ -51,40 +51,35 @@ nvc0_colormask(unsigned mask)
return ret;
}
+#define NVC0_BLEND_FACTOR_CASE(a, b) \
+ case PIPE_BLENDFACTOR_##a: return NV50_3D_BLEND_FACTOR_##b
+
static INLINE uint32_t
nvc0_blend_fac(unsigned factor)
{
- static const uint16_t bf[] = {
- NV50_3D_BLEND_FACTOR_ZERO, /* 0x00 */
- NV50_3D_BLEND_FACTOR_ONE,
- NV50_3D_BLEND_FACTOR_SRC_COLOR,
- NV50_3D_BLEND_FACTOR_SRC_ALPHA,
- NV50_3D_BLEND_FACTOR_DST_ALPHA,
- NV50_3D_BLEND_FACTOR_DST_COLOR,
- NV50_3D_BLEND_FACTOR_SRC_ALPHA_SATURATE,
- NV50_3D_BLEND_FACTOR_CONSTANT_COLOR,
- NV50_3D_BLEND_FACTOR_CONSTANT_ALPHA,
- NV50_3D_BLEND_FACTOR_SRC1_COLOR,
- NV50_3D_BLEND_FACTOR_SRC1_ALPHA,
- NV50_3D_BLEND_FACTOR_ZERO, /* 0x0b */
- NV50_3D_BLEND_FACTOR_ZERO, /* 0x0c */
- NV50_3D_BLEND_FACTOR_ZERO, /* 0x0d */
- NV50_3D_BLEND_FACTOR_ZERO, /* 0x0e */
- NV50_3D_BLEND_FACTOR_ZERO, /* 0x0f */
- NV50_3D_BLEND_FACTOR_ZERO, /* 0x10 */
- NV50_3D_BLEND_FACTOR_ZERO, /* 0x11 */
- NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC_COLOR,
- NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
- NV50_3D_BLEND_FACTOR_ONE_MINUS_DST_ALPHA,
- NV50_3D_BLEND_FACTOR_ONE_MINUS_DST_COLOR,
- NV50_3D_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
- NV50_3D_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA,
- NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
- NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
- };
-
- assert(factor < (sizeof(bf) / sizeof(bf[0])));
- return bf[factor];
+ switch (factor) {
+ NVC0_BLEND_FACTOR_CASE(ONE, ONE);
+ NVC0_BLEND_FACTOR_CASE(SRC_COLOR, SRC_COLOR);
+ NVC0_BLEND_FACTOR_CASE(SRC_ALPHA, SRC_ALPHA);
+ NVC0_BLEND_FACTOR_CASE(DST_ALPHA, DST_ALPHA);
+ NVC0_BLEND_FACTOR_CASE(DST_COLOR, DST_COLOR);
+ NVC0_BLEND_FACTOR_CASE(SRC_ALPHA_SATURATE, SRC_ALPHA_SATURATE);
+ NVC0_BLEND_FACTOR_CASE(CONST_COLOR, CONSTANT_COLOR);
+ NVC0_BLEND_FACTOR_CASE(CONST_ALPHA, CONSTANT_ALPHA);
+ NVC0_BLEND_FACTOR_CASE(SRC1_COLOR, SRC1_COLOR);
+ NVC0_BLEND_FACTOR_CASE(SRC1_ALPHA, SRC1_ALPHA);
+ NVC0_BLEND_FACTOR_CASE(ZERO, ZERO);
+ NVC0_BLEND_FACTOR_CASE(INV_SRC_COLOR, ONE_MINUS_SRC_COLOR);
+ NVC0_BLEND_FACTOR_CASE(INV_SRC_ALPHA, ONE_MINUS_SRC_ALPHA);
+ NVC0_BLEND_FACTOR_CASE(INV_DST_ALPHA, ONE_MINUS_DST_ALPHA);
+ NVC0_BLEND_FACTOR_CASE(INV_DST_COLOR, ONE_MINUS_DST_COLOR);
+ NVC0_BLEND_FACTOR_CASE(INV_CONST_COLOR, ONE_MINUS_CONSTANT_COLOR);
+ NVC0_BLEND_FACTOR_CASE(INV_CONST_ALPHA, ONE_MINUS_CONSTANT_ALPHA);
+ NVC0_BLEND_FACTOR_CASE(INV_SRC1_COLOR, ONE_MINUS_SRC1_COLOR);
+ NVC0_BLEND_FACTOR_CASE(INV_SRC1_ALPHA, ONE_MINUS_SRC1_ALPHA);
+ default:
+ return NV50_3D_BLEND_FACTOR_ZERO;
+ }
}
static void *