diff options
author | Francisco Jerez <[email protected]> | 2010-09-09 14:14:48 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2010-09-09 14:19:35 +0200 |
commit | 3bbad7f1084c3d6259dfa23fd60f654c949f7408 (patch) | |
tree | c196890f8d8fc7325697324739b085e8ea14b57d /src/mesa/drivers | |
parent | 699749cfeeea7d0a17ed5f94fd5fdbbe52f4ab2b (diff) |
dri/nv10-nv20: Add support for NV_texture_env_combine4.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv10_state_frag.c | 31 |
2 files changed, 19 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index b1d415257da..287f77d96c2 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -60,6 +60,7 @@ static const struct dri_extension nouveau_extensions[] = { { "GL_EXT_stencil_wrap", NULL }, { "GL_EXT_texture_lod_bias", NULL }, { "GL_NV_blend_square", NULL }, + { "GL_NV_texture_env_combine4", NULL }, { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c index 76b95fdd518..ab713f9dbf5 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c @@ -63,6 +63,7 @@ struct combiner_state { GLcontext *ctx; int unit; + GLboolean premodulate; /* GL state */ GLenum mode; @@ -82,6 +83,7 @@ struct combiner_state { ctx->Texture.Unit[i]._CurrentCombine; \ (rc)->ctx = ctx; \ (rc)->unit = i; \ + (rc)->premodulate = c->_NumArgs##chan == 4; \ (rc)->mode = c->Mode##chan; \ (rc)->source = c->Source##chan; \ (rc)->operand = c->Operand##chan; \ @@ -95,6 +97,9 @@ static uint32_t get_input_source(struct combiner_state *rc, int source) { switch (source) { + case GL_ZERO: + return RC_IN_SOURCE(ZERO); + case GL_TEXTURE: return RC_IN_SOURCE(TEXTURE0) + rc->unit; @@ -228,21 +233,21 @@ setup_combiner(struct combiner_state *rc) break; case GL_ADD: - INPUT_ARG(rc, A, 0, 0); - INPUT_ONE(rc, B, 0); - INPUT_ARG(rc, C, 1, 0); - INPUT_ONE(rc, D, 0); - - rc->out = RC_OUT_SUM; - break; - case GL_ADD_SIGNED: - INPUT_ARG(rc, A, 0, 0); - INPUT_ONE(rc, B, 0); - INPUT_ARG(rc, C, 1, 0); - INPUT_ONE(rc, D, 0); + if (rc->premodulate) { + INPUT_ARG(rc, A, 0, 0); + INPUT_ARG(rc, B, 1, 0); + INPUT_ARG(rc, C, 2, 0); + INPUT_ARG(rc, D, 3, 0); + } else { + INPUT_ARG(rc, A, 0, 0); + INPUT_ONE(rc, B, 0); + INPUT_ARG(rc, C, 1, 0); + INPUT_ONE(rc, D, 0); + } - rc->out = RC_OUT_SUM | RC_OUT_BIAS; + rc->out = RC_OUT_SUM | + (rc->mode == GL_ADD_SIGNED ? RC_OUT_BIAS : 0); break; case GL_INTERPOLATE: |