diff options
Diffstat (limited to 'src/mesa/main/texenv.c')
-rw-r--r-- | src/mesa/main/texenv.c | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index d94bd9f313..097923182a 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -206,6 +206,16 @@ set_combiner_source(GLcontext *ctx, src = 2; alpha = GL_FALSE; break; + case GL_SOURCE3_RGB_NV: + if (ctx->Extensions.NV_texture_env_combine4) { + src = 3; + alpha = GL_FALSE; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; case GL_SOURCE0_ALPHA: src = 0; alpha = GL_TRUE; @@ -218,11 +228,23 @@ set_combiner_source(GLcontext *ctx, src = 2; alpha = GL_TRUE; break; + case GL_SOURCE3_ALPHA_NV: + if (ctx->Extensions.NV_texture_env_combine4) { + src = 3; + alpha = GL_TRUE; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } + assert(src < 4); + /* * Error-check param (the source term) */ @@ -245,6 +267,9 @@ set_combiner_source(GLcontext *ctx, param - GL_TEXTURE0 < ctx->Const.MaxTextureUnits); break; case GL_ZERO: + legal = (ctx->Extensions.ATI_texture_env_combine3 || + ctx->Extensions.NV_texture_env_combine4); + break; case GL_ONE: legal = ctx->Extensions.ATI_texture_env_combine3; break; @@ -259,7 +284,6 @@ set_combiner_source(GLcontext *ctx, FLUSH_VERTICES(ctx, _NEW_TEXTURE); - assert(src < 4); if (alpha) texUnit->Combine.SourceA[src] = param; else @@ -301,6 +325,16 @@ set_combiner_operand(GLcontext *ctx, return; } break; + case GL_OPERAND3_RGB_NV: + if (ctx->Extensions.NV_texture_env_combine4) { + op = 3; + alpha = GL_FALSE; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; case GL_OPERAND0_ALPHA: op = 0; alpha = GL_TRUE; @@ -319,11 +353,23 @@ set_combiner_operand(GLcontext *ctx, return; } break; + case GL_OPERAND3_ALPHA_NV: + if (ctx->Extensions.NV_texture_env_combine4) { + op = 3; + alpha = GL_TRUE; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } + assert(op < 4); + /* * Error-check param (the source operand) */ @@ -397,7 +443,6 @@ set_combiner_scale(GLcontext *ctx, break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; } } @@ -435,17 +480,21 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_SOURCE0_RGB: case GL_SOURCE1_RGB: case GL_SOURCE2_RGB: + case GL_SOURCE3_RGB_NV: case GL_SOURCE0_ALPHA: case GL_SOURCE1_ALPHA: case GL_SOURCE2_ALPHA: + case GL_SOURCE3_ALPHA_NV: set_combiner_source(ctx, texUnit, pname, (GLenum) (GLint) param[0]); break; case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: case GL_OPERAND2_RGB: + case GL_OPERAND3_RGB_NV: case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: case GL_OPERAND2_ALPHA: + case GL_OPERAND3_ALPHA_NV: set_combiner_operand(ctx, texUnit, pname, (GLenum) (GLint) param[0]); break; case GL_RGB_SCALE: @@ -601,6 +650,14 @@ get_texenvi(GLcontext *ctx, const struct gl_texture_unit *texUnit, _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; + case GL_SOURCE3_RGB_NV: + if (ctx->Extensions.NV_texture_env_combine4) { + return texUnit->Combine.SourceRGB[3]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; case GL_SOURCE0_ALPHA: case GL_SOURCE1_ALPHA: case GL_SOURCE2_ALPHA: @@ -613,6 +670,14 @@ get_texenvi(GLcontext *ctx, const struct gl_texture_unit *texUnit, _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; + case GL_SOURCE3_ALPHA_NV: + if (ctx->Extensions.NV_texture_env_combine4) { + return texUnit->Combine.SourceA[3]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: case GL_OPERAND2_RGB: @@ -625,6 +690,14 @@ get_texenvi(GLcontext *ctx, const struct gl_texture_unit *texUnit, _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; + case GL_OPERAND3_RGB_NV: + if (ctx->Extensions.NV_texture_env_combine4) { + return texUnit->Combine.OperandRGB[3]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: case GL_OPERAND2_ALPHA: @@ -637,6 +710,14 @@ get_texenvi(GLcontext *ctx, const struct gl_texture_unit *texUnit, _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; + case GL_OPERAND3_ALPHA_NV: + if (ctx->Extensions.NV_texture_env_combine4) { + return texUnit->Combine.OperandA[3]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; case GL_RGB_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { |