/*
* Mesa 3-D graphics library
- * Version: 7.5
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
/**
#include "main/glheader.h"
#include "main/context.h"
+#include "main/blend.h"
#include "main/enums.h"
#include "main/macros.h"
#include "main/mtypes.h"
break;
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_env_dot3 &&
pname == GL_COMBINE_RGB);
break;
case GL_MODULATE_ADD_ATI:
case GL_MODULATE_SIGNED_ADD_ATI:
case GL_MODULATE_SUBTRACT_ATI:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ATI_texture_env_combine3);
break;
case GL_BUMP_ENVMAP_ATI:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ATI_envmap_bumpmap &&
pname == GL_COMBINE_RGB);
break;
return;
}
- if ((term == 3) && (ctx->API != API_OPENGL
+ if ((term == 3) && (ctx->API != API_OPENGL_COMPAT
|| !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
param - GL_TEXTURE0 < ctx->Const.MaxTextureUnits);
break;
case GL_ZERO:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
(ctx->Extensions.ATI_texture_env_combine3 ||
ctx->Extensions.NV_texture_env_combine4));
break;
case GL_ONE:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ATI_texture_env_combine3);
break;
default:
return;
}
- if ((term == 3) && (ctx->API != API_OPENGL
+ if ((term == 3) && (ctx->API != API_OPENGL_COMPAT
|| !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
const GLint iparam0 = (GLint) param[0];
struct gl_texture_unit *texUnit;
GLuint maxUnit;
-
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
set_combiner_scale(ctx, texUnit, pname, param[0]);
break;
case GL_BUMP_TARGET_ATI:
- if (ctx->API != API_OPENGL || !ctx->Extensions.ATI_envmap_bumpmap) {
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
return;
}
}
}
else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target );
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(target=%s)",
+ _mesa_lookup_enum_by_nr(target));
return;
}
return texUnit->Combine.SourceRGB[rgb_idx];
}
case GL_SOURCE3_RGB_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.SourceRGB[3];
}
else {
return texUnit->Combine.SourceA[alpha_idx];
}
case GL_SOURCE3_ALPHA_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.SourceA[3];
}
else {
return texUnit->Combine.OperandRGB[op_rgb];
}
case GL_OPERAND3_RGB_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.OperandRGB[3];
}
else {
return texUnit->Combine.OperandA[op_alpha];
}
case GL_OPERAND3_ALPHA_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.OperandA[3];
}
else {
return 1 << texUnit->Combine.ScaleShiftA;
case GL_BUMP_TARGET_ATI:
/* spec doesn't say so, but I think this should be queryable */
- if (ctx->API == API_OPENGL && ctx->Extensions.ATI_envmap_bumpmap) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ATI_envmap_bumpmap) {
return texUnit->BumpTarget;
}
else {
GLuint maxUnit;
const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
if (pname == GL_TEXTURE_ENV_COLOR) {
if(ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
_mesa_update_state(ctx);
- if(ctx->Color._ClampFragmentColor)
+ if (_mesa_get_clamp_fragment_color(ctx))
COPY_4FV( params, texUnit->EnvColor );
else
COPY_4FV( params, texUnit->EnvColorUnclamped );
GLuint maxUnit;
const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
{
GLfloat p[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ATI_envmap_bumpmap) {
/* This isn't an "official" error case, but let's tell the user
{
struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterfvATI");
const struct gl_texture_unit *texUnit;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterivATI");
}
else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
GLint count = 0;
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
if (ctx->Const.SupportedBumpUnits & (1 << i)) {
count++;
}
*param = count;
}
else if (pname == GL_BUMP_TEX_UNITS_ATI) {
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
if (ctx->Const.SupportedBumpUnits & (1 << i)) {
*param++ = i + GL_TEXTURE0;
}
const struct gl_texture_unit *texUnit;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterfvATI");
}
else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
GLint count = 0;
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
if (ctx->Const.SupportedBumpUnits & (1 << i)) {
count++;
}
*param = (GLfloat) count;
}
else if (pname == GL_BUMP_TEX_UNITS_ATI) {
- for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+ for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) {
if (ctx->Const.SupportedBumpUnits & (1 << i)) {
*param++ = (GLfloat) (i + GL_TEXTURE0);
}