瀏覽代碼

nvc0: fix blend factor mapping

tags/android-x86-2.2-r2
Christoph Bumiller 14 年之前
父節點
當前提交
3903e25a2c
共有 1 個檔案被更改,包括 26 行新增31 行删除
  1. 26
    31
      src/gallium/drivers/nvc0/nvc0_state.c

+ 26
- 31
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 *

Loading…
取消
儲存