aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/api_loopback.c4
-rw-r--r--mesalib/src/mesa/main/api_validate.c4
-rw-r--r--mesalib/src/mesa/main/attrib.c2
-rw-r--r--mesalib/src/mesa/main/buffers.c2
-rw-r--r--mesalib/src/mesa/main/context.c2
-rw-r--r--mesalib/src/mesa/main/context.h2
-rw-r--r--mesalib/src/mesa/main/enable.c196
-rw-r--r--mesalib/src/mesa/main/extensions.c4
-rw-r--r--mesalib/src/mesa/main/fbobject.c181
-rw-r--r--mesalib/src/mesa/main/fog.c6
-rw-r--r--mesalib/src/mesa/main/get.c2
-rw-r--r--mesalib/src/mesa/main/getstring.c24
-rw-r--r--mesalib/src/mesa/main/glformats.c117
-rw-r--r--mesalib/src/mesa/main/glformats.h6
-rw-r--r--mesalib/src/mesa/main/hint.c8
-rw-r--r--mesalib/src/mesa/main/light.c8
-rw-r--r--mesalib/src/mesa/main/matrix.c2
-rw-r--r--mesalib/src/mesa/main/mtypes.h4
-rw-r--r--mesalib/src/mesa/main/points.c2
-rw-r--r--mesalib/src/mesa/main/queryobj.c2
-rw-r--r--mesalib/src/mesa/main/renderbuffer.c8
-rw-r--r--mesalib/src/mesa/main/renderbuffer.h2
-rw-r--r--mesalib/src/mesa/main/shaderapi.c6
-rw-r--r--mesalib/src/mesa/main/shared.c3
-rw-r--r--mesalib/src/mesa/main/texenv.c26
-rw-r--r--mesalib/src/mesa/main/texgen.c14
-rw-r--r--mesalib/src/mesa/main/texgetimage.c38
-rw-r--r--mesalib/src/mesa/main/teximage.c4
-rw-r--r--mesalib/src/mesa/main/texparam.c30
-rw-r--r--mesalib/src/mesa/main/version.c4
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c14
31 files changed, 378 insertions, 349 deletions
diff --git a/mesalib/src/mesa/main/api_loopback.c b/mesalib/src/mesa/main/api_loopback.c
index 6b66319a9..59d399b42 100644
--- a/mesalib/src/mesa/main/api_loopback.c
+++ b/mesalib/src/mesa/main/api_loopback.c
@@ -1507,7 +1507,7 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
SET_Color4ub(dest, _mesa_Color4ub);
SET_Materialf(dest, _mesa_Materialf);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_Color3b(dest, _mesa_Color3b);
SET_Color3d(dest, _mesa_Color3d);
SET_Color3i(dest, _mesa_Color3i);
@@ -1654,7 +1654,7 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
SET_FogCoorddv(dest, _mesa_FogCoorddv);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_VertexAttrib1sNV(dest, _mesa_VertexAttrib1sNV);
SET_VertexAttrib1dNV(dest, _mesa_VertexAttrib1dNV);
SET_VertexAttrib2sNV(dest, _mesa_VertexAttrib2sNV);
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 6f0250800..e47db23e0 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -124,7 +124,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
return GL_FALSE;
break;
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
{
const struct gl_shader_program *vsProg =
@@ -219,7 +219,7 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
case GL_QUADS:
case GL_QUAD_STRIP:
case GL_POLYGON:
- valid_enum = (ctx->API == API_OPENGL);
+ valid_enum = (ctx->API == API_OPENGL_COMPAT);
break;
case GL_LINES_ADJACENCY:
case GL_LINE_STRIP_ADJACENCY:
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index acb33885a..a19d61054 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -1150,7 +1150,7 @@ _mesa_PopAttrib(void)
_mesa_PointParameteri(GL_POINT_SPRITE_R_MODE_NV,
ctx->Point.SpriteRMode);
- if ((ctx->API == API_OPENGL && ctx->Version >= 20)
+ if ((ctx->API == API_OPENGL_COMPAT && ctx->Version >= 20)
|| ctx->API == API_OPENGL_CORE)
_mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN,
(GLfloat)ctx->Point.SpriteOrigin);
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index fd430aad0..76f0d4671 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -353,7 +353,7 @@ updated_drawbuffers(struct gl_context *ctx)
{
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
- if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) {
+ if (ctx->API == API_OPENGL_COMPAT && !ctx->Extensions.ARB_ES2_compatibility) {
struct gl_framebuffer *fb = ctx->DrawBuffer;
/* Flag the FBO as requiring validation. */
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 0508378b7..fa552e818 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -963,7 +963,7 @@ _mesa_initialize_context(struct gl_context *ctx,
sizeof(ctx->TextureFormatSupported));
switch (ctx->API) {
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
ctx->Save = _mesa_create_save_table(ctx);
if (!ctx->Save) {
_mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h
index a5f770a6e..063f2a381 100644
--- a/mesalib/src/mesa/main/context.h
+++ b/mesalib/src/mesa/main/context.h
@@ -296,7 +296,7 @@ do { \
static inline GLboolean
_mesa_is_desktop_gl(const struct gl_context *ctx)
{
- return ctx->API == API_OPENGL || ctx->API == API_OPENGL_CORE;
+ return ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGL_CORE;
}
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index c7114b73a..b48794f95 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -278,7 +278,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
switch (cap) {
case GL_ALPHA_TEST:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Color.AlphaEnabled == state)
return;
@@ -286,7 +286,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Color.AlphaEnabled = state;
break;
case GL_AUTO_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.AutoNormal == state)
return;
@@ -333,7 +333,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
}
break;
case GL_COLOR_MATERIAL:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Light.ColorMaterialEnabled == state)
return;
@@ -369,7 +369,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Color.DitherFlag = state;
break;
case GL_FOG:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Fog.Enabled == state)
return;
@@ -384,7 +384,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_LIGHT5:
case GL_LIGHT6:
case GL_LIGHT7:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
return;
@@ -399,7 +399,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
}
break;
case GL_LIGHTING:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Light.Enabled == state)
return;
@@ -420,7 +420,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
break;
case GL_LINE_STIPPLE:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Line.StippleFlag == state)
return;
@@ -429,7 +429,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
break;
case GL_INDEX_LOGIC_OP:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Color.IndexLogicOpEnabled == state)
return;
@@ -445,7 +445,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Color.ColorLogicOpEnabled = state;
break;
case GL_MAP1_COLOR_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Color4 == state)
return;
@@ -453,7 +453,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Color4 = state;
break;
case GL_MAP1_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Index == state)
return;
@@ -461,7 +461,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Index = state;
break;
case GL_MAP1_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Normal == state)
return;
@@ -469,7 +469,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Normal = state;
break;
case GL_MAP1_TEXTURE_COORD_1:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord1 == state)
return;
@@ -477,7 +477,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1TextureCoord1 = state;
break;
case GL_MAP1_TEXTURE_COORD_2:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord2 == state)
return;
@@ -485,7 +485,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1TextureCoord2 = state;
break;
case GL_MAP1_TEXTURE_COORD_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord3 == state)
return;
@@ -493,7 +493,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1TextureCoord3 = state;
break;
case GL_MAP1_TEXTURE_COORD_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord4 == state)
return;
@@ -501,7 +501,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1TextureCoord4 = state;
break;
case GL_MAP1_VERTEX_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Vertex3 == state)
return;
@@ -509,7 +509,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Vertex3 = state;
break;
case GL_MAP1_VERTEX_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Vertex4 == state)
return;
@@ -517,7 +517,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Vertex4 = state;
break;
case GL_MAP2_COLOR_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Color4 == state)
return;
@@ -525,7 +525,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Color4 = state;
break;
case GL_MAP2_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Index == state)
return;
@@ -533,7 +533,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Index = state;
break;
case GL_MAP2_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Normal == state)
return;
@@ -541,7 +541,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Normal = state;
break;
case GL_MAP2_TEXTURE_COORD_1:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord1 == state)
return;
@@ -549,7 +549,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2TextureCoord1 = state;
break;
case GL_MAP2_TEXTURE_COORD_2:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord2 == state)
return;
@@ -557,7 +557,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2TextureCoord2 = state;
break;
case GL_MAP2_TEXTURE_COORD_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord3 == state)
return;
@@ -565,7 +565,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2TextureCoord3 = state;
break;
case GL_MAP2_TEXTURE_COORD_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord4 == state)
return;
@@ -573,7 +573,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2TextureCoord4 = state;
break;
case GL_MAP2_VERTEX_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Vertex3 == state)
return;
@@ -581,7 +581,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Vertex3 = state;
break;
case GL_MAP2_VERTEX_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Vertex4 == state)
return;
@@ -589,7 +589,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Vertex4 = state;
break;
case GL_NORMALIZE:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Transform.Normalize == state)
return;
@@ -597,7 +597,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Transform.Normalize = state;
break;
case GL_POINT_SMOOTH:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Point.SmoothFlag == state)
return;
@@ -615,7 +615,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
break;
case GL_POLYGON_STIPPLE:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Polygon.StippleFlag == state)
return;
@@ -646,7 +646,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Polygon.OffsetFill = state;
break;
case GL_RESCALE_NORMAL_EXT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Transform.RescaleNormals == state)
return;
@@ -666,21 +666,21 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Stencil.Enabled = state;
break;
case GL_TEXTURE_1D:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (!enable_texture(ctx, state, TEXTURE_1D_BIT)) {
return;
}
break;
case GL_TEXTURE_2D:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (!enable_texture(ctx, state, TEXTURE_2D_BIT)) {
return;
}
break;
case GL_TEXTURE_3D:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) {
return;
@@ -693,7 +693,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
{
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (texUnit) {
@@ -745,7 +745,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_ARB_texture_cube_map */
case GL_TEXTURE_CUBE_MAP_ARB:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_texture_cube_map, cap);
if (!enable_texture(ctx, state, TEXTURE_CUBE_BIT)) {
@@ -755,7 +755,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program, cap);
if (ctx->Fog.ColorSumEnabled == state)
@@ -801,7 +801,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_IBM_rasterpos_clip */
case GL_RASTER_POSITION_UNCLIPPED_IBM:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Transform.RasterPositionUnclipped == state)
return;
@@ -811,7 +811,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite, cap);
if (ctx->Point.PointSprite == state)
@@ -821,7 +821,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_VERTEX_PROGRAM_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_vertex_program, cap);
if (ctx->VertexProgram.Enabled == state)
@@ -842,7 +842,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->VertexProgram.PointSizeEnabled = state;
break;
case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_vertex_program, cap);
if (ctx->VertexProgram.TwoSideEnabled == state)
@@ -853,7 +853,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(NV_texture_rectangle, cap);
if (!enable_texture(ctx, state, TEXTURE_RECT_BIT)) {
@@ -863,7 +863,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_EXT_stencil_two_side */
case GL_STENCIL_TEST_TWO_SIDE_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(EXT_stencil_two_side, cap);
if (ctx->Stencil.TestTwoSide == state)
@@ -878,7 +878,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_FRAGMENT_PROGRAM_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_fragment_program, cap);
if (ctx->FragmentProgram.Enabled == state)
@@ -909,7 +909,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_FRAGMENT_SHADER_ATI:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ATI_fragment_shader, cap);
if (ctx->ATIFragmentShader.Enabled == state)
@@ -920,7 +920,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_MESA_texture_array */
case GL_TEXTURE_1D_ARRAY_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(MESA_texture_array, cap);
if (!enable_texture(ctx, state, TEXTURE_1D_ARRAY_BIT)) {
@@ -929,7 +929,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_TEXTURE_2D_ARRAY_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(MESA_texture_array, cap);
if (!enable_texture(ctx, state, TEXTURE_2D_ARRAY_BIT)) {
@@ -1154,11 +1154,11 @@ _mesa_IsEnabled( GLenum cap )
switch (cap) {
case GL_ALPHA_TEST:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Color.AlphaEnabled;
case GL_AUTO_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.AutoNormal;
case GL_BLEND:
@@ -1179,7 +1179,7 @@ _mesa_IsEnabled( GLenum cap )
return (ctx->Transform.ClipPlanesEnabled >> p) & 1;
}
case GL_COLOR_MATERIAL:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Light.ColorMaterialEnabled;
case GL_CULL_FACE:
@@ -1193,11 +1193,11 @@ _mesa_IsEnabled( GLenum cap )
case GL_DITHER:
return ctx->Color.DitherFlag;
case GL_FOG:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Fog.Enabled;
case GL_LIGHTING:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Light.Enabled;
case GL_LIGHT0:
@@ -1208,7 +1208,7 @@ _mesa_IsEnabled( GLenum cap )
case GL_LIGHT5:
case GL_LIGHT6:
case GL_LIGHT7:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
case GL_LINE_SMOOTH:
@@ -1216,11 +1216,11 @@ _mesa_IsEnabled( GLenum cap )
goto invalid_enum_error;
return ctx->Line.SmoothFlag;
case GL_LINE_STIPPLE:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Line.StippleFlag;
case GL_INDEX_LOGIC_OP:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Color.IndexLogicOpEnabled;
case GL_COLOR_LOGIC_OP:
@@ -1228,83 +1228,83 @@ _mesa_IsEnabled( GLenum cap )
goto invalid_enum_error;
return ctx->Color.ColorLogicOpEnabled;
case GL_MAP1_COLOR_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Color4;
case GL_MAP1_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Index;
case GL_MAP1_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Normal;
case GL_MAP1_TEXTURE_COORD_1:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord1;
case GL_MAP1_TEXTURE_COORD_2:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord2;
case GL_MAP1_TEXTURE_COORD_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord3;
case GL_MAP1_TEXTURE_COORD_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord4;
case GL_MAP1_VERTEX_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Vertex3;
case GL_MAP1_VERTEX_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Vertex4;
case GL_MAP2_COLOR_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Color4;
case GL_MAP2_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Index;
case GL_MAP2_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Normal;
case GL_MAP2_TEXTURE_COORD_1:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord1;
case GL_MAP2_TEXTURE_COORD_2:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord2;
case GL_MAP2_TEXTURE_COORD_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord3;
case GL_MAP2_TEXTURE_COORD_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord4;
case GL_MAP2_VERTEX_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Vertex3;
case GL_MAP2_VERTEX_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Vertex4;
case GL_NORMALIZE:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Transform.Normalize;
case GL_POINT_SMOOTH:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Point.SmoothFlag;
case GL_POLYGON_SMOOTH:
@@ -1312,7 +1312,7 @@ _mesa_IsEnabled( GLenum cap )
goto invalid_enum_error;
return ctx->Polygon.SmoothFlag;
case GL_POLYGON_STIPPLE:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Polygon.StippleFlag;
case GL_POLYGON_OFFSET_POINT:
@@ -1326,7 +1326,7 @@ _mesa_IsEnabled( GLenum cap )
case GL_POLYGON_OFFSET_FILL:
return ctx->Polygon.OffsetFill;
case GL_RESCALE_NORMAL_EXT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Transform.RescaleNormals;
case GL_SCISSOR_TEST:
@@ -1334,15 +1334,15 @@ _mesa_IsEnabled( GLenum cap )
case GL_STENCIL_TEST:
return ctx->Stencil.Enabled;
case GL_TEXTURE_1D:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return is_texture_enabled(ctx, TEXTURE_1D_BIT);
case GL_TEXTURE_2D:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return is_texture_enabled(ctx, TEXTURE_2D_BIT);
case GL_TEXTURE_3D:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return is_texture_enabled(ctx, TEXTURE_3D_BIT);
case GL_TEXTURE_GEN_S:
@@ -1352,7 +1352,7 @@ _mesa_IsEnabled( GLenum cap )
{
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (texUnit) {
@@ -1376,37 +1376,37 @@ _mesa_IsEnabled( GLenum cap )
/* client-side state */
case GL_VERTEX_ARRAY:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled != 0);
case GL_NORMAL_ARRAY:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled != 0);
case GL_COLOR_ARRAY:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled != 0);
case GL_INDEX_ARRAY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0);
case GL_TEXTURE_COORD_ARRAY:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]
.Enabled != 0);
case GL_EDGE_FLAG_ARRAY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0);
case GL_FOG_COORDINATE_ARRAY_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(EXT_fog_coord);
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled != 0);
case GL_SECONDARY_COLOR_ARRAY_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(EXT_secondary_color);
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0);
@@ -1422,7 +1422,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program);
return ctx->Fog.ColorSumEnabled;
@@ -1447,19 +1447,19 @@ _mesa_IsEnabled( GLenum cap )
/* GL_IBM_rasterpos_clip */
case GL_RASTER_POSITION_UNCLIPPED_IBM:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Transform.RasterPositionUnclipped;
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite)
return ctx->Point.PointSprite;
case GL_VERTEX_PROGRAM_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.Enabled;
@@ -1472,27 +1472,27 @@ _mesa_IsEnabled( GLenum cap )
CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.PointSizeEnabled;
case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.TwoSideEnabled;
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(NV_texture_rectangle);
return is_texture_enabled(ctx, TEXTURE_RECT_BIT);
/* GL_EXT_stencil_two_side */
case GL_STENCIL_TEST_TWO_SIDE_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(EXT_stencil_two_side);
return ctx->Stencil.TestTwoSide;
case GL_FRAGMENT_PROGRAM_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->FragmentProgram.Enabled;
@@ -1511,7 +1511,7 @@ _mesa_IsEnabled( GLenum cap )
return ctx->Transform.DepthClamp;
case GL_FRAGMENT_SHADER_ATI:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ATI_fragment_shader);
return ctx->ATIFragmentShader.Enabled;
@@ -1530,7 +1530,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL_NV_primitive_restart */
case GL_PRIMITIVE_RESTART_NV:
- if (ctx->API != API_OPENGL || !ctx->Extensions.NV_primitive_restart) {
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.NV_primitive_restart) {
goto invalid_enum_error;
}
return ctx->Array.PrimitiveRestart;
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index d5a7886c9..9e23a66d7 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -41,9 +41,9 @@
enum {
DISABLE = 0,
- GLL = 1 << API_OPENGL, /* GL Legacy / Compatibility */
+ GLL = 1 << API_OPENGL_COMPAT, /* GL Legacy / Compatibility */
GLC = 1 << API_OPENGL_CORE, /* GL Core */
- GL = (1 << API_OPENGL) | (1 << API_OPENGL_CORE),
+ GL = (1 << API_OPENGL_COMPAT) | (1 << API_OPENGL_CORE),
ES1 = 1 << API_OPENGLES,
ES2 = 1 << API_OPENGLES2,
};
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 891ec5dce..9eec61de6 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -78,7 +78,7 @@ static struct gl_framebuffer IncompleteFramebuffer;
static void
-delete_dummy_renderbuffer(struct gl_renderbuffer *rb)
+delete_dummy_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
/* no op */
}
@@ -1072,14 +1072,14 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
- return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object
? GL_ALPHA : 0;
case GL_LUMINANCE:
case GL_LUMINANCE4:
case GL_LUMINANCE8:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
- return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object
? GL_LUMINANCE : 0;
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
@@ -1088,14 +1088,14 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object
? GL_LUMINANCE_ALPHA : 0;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
- return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object
? GL_INTENSITY : 0;
case GL_RGB8:
return GL_RGB;
@@ -1146,11 +1146,11 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_DEPTH_STENCIL_EXT : 0;
case GL_DEPTH_COMPONENT32F:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_buffer_float)
? GL_DEPTH_COMPONENT : 0;
case GL_DEPTH32F_STENCIL8:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_buffer_float)
? GL_DEPTH_STENCIL : 0;
case GL_RED:
case GL_R16:
@@ -1169,7 +1169,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
/* signed normalized texture formats */
case GL_R8_SNORM:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
? GL_RED : 0;
case GL_RED_SNORM:
case GL_R16_SNORM:
@@ -1177,7 +1177,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RED : 0;
case GL_RG8_SNORM:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
? GL_RG : 0;
case GL_RG_SNORM:
case GL_RG16_SNORM:
@@ -1185,7 +1185,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RG : 0;
case GL_RGB8_SNORM:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
? GL_RGB : 0;
case GL_RGB_SNORM:
case GL_RGB16_SNORM:
@@ -1193,7 +1193,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RGB : 0;
case GL_RGBA8_SNORM:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
? GL_RGBA : 0;
case GL_RGBA_SNORM:
case GL_RGBA16_SNORM:
@@ -1202,37 +1202,37 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_ALPHA_SNORM:
case GL_ALPHA8_SNORM:
case GL_ALPHA16_SNORM:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
case GL_LUMINANCE_SNORM:
case GL_LUMINANCE8_SNORM:
case GL_LUMINANCE16_SNORM:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
case GL_LUMINANCE_ALPHA_SNORM:
case GL_LUMINANCE8_ALPHA8_SNORM:
case GL_LUMINANCE16_ALPHA16_SNORM:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
case GL_INTENSITY_SNORM:
case GL_INTENSITY8_SNORM:
case GL_INTENSITY16_SNORM:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_R16F:
case GL_R32F:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL &&
+ || (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
case GL_RG16F:
case GL_RG32F:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL &&
+ || (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
case GL_RGB16F:
@@ -1247,22 +1247,22 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RGBA : 0;
case GL_ALPHA16F_ARB:
case GL_ALPHA32F_ARB:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
case GL_LUMINANCE16F_ARB:
case GL_LUMINANCE32F_ARB:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
case GL_LUMINANCE_ALPHA16F_ARB:
case GL_LUMINANCE_ALPHA32F_ARB:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
case GL_INTENSITY16F_ARB:
case GL_INTENSITY32F_ARB:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_RGB9_E5:
@@ -1321,7 +1321,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_INTENSITY16UI_EXT:
case GL_INTENSITY32I_EXT:
case GL_INTENSITY32UI_EXT:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
@@ -1331,7 +1331,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE16UI_EXT:
case GL_LUMINANCE32I_EXT:
case GL_LUMINANCE32UI_EXT:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
@@ -1341,7 +1341,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE_ALPHA16UI_EXT:
case GL_LUMINANCE_ALPHA32I_EXT:
case GL_LUMINANCE_ALPHA32UI_EXT:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
@@ -1351,7 +1351,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_ALPHA16UI_EXT:
case GL_ALPHA32I_EXT:
case GL_ALPHA32UI_EXT:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
@@ -2498,7 +2498,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
- if ((ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object)
+ if ((ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_framebuffer_object)
&& ctx->API != API_OPENGL_CORE
&& !_mesa_is_gles3(ctx)) {
goto invalid_pname_enum;
@@ -2716,127 +2716,16 @@ compatible_color_datatypes(gl_format srcFormat, gl_format dstFormat)
}
-/**
- * Return the equivalent non-generic internal format.
- * This is useful for comparing whether two internal formats are semantically
- * equivalent.
- */
-static GLenum
-get_nongeneric_internalformat(GLenum format)
-{
- switch (format) {
- /* GL 1.1 formats. */
- case 4:
- case GL_RGBA:
- return GL_RGBA8;
-
- case 3:
- case GL_RGB:
- return GL_RGB8;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- return GL_LUMINANCE8_ALPHA8;
-
- case 1:
- case GL_LUMINANCE:
- return GL_LUMINANCE8;
-
- case GL_ALPHA:
- return GL_ALPHA8;
-
- case GL_INTENSITY:
- return GL_INTENSITY8;
-
- /* GL_ARB_texture_rg */
- case GL_RED:
- return GL_R8;
-
- case GL_RG:
- return GL_RG8;
-
- /* GL_EXT_texture_sRGB */
- case GL_SRGB:
- return GL_SRGB8;
-
- case GL_SRGB_ALPHA:
- return GL_SRGB8_ALPHA8;
-
- case GL_SLUMINANCE:
- return GL_SLUMINANCE8;
-
- case GL_SLUMINANCE_ALPHA:
- return GL_SLUMINANCE8_ALPHA8;
-
- /* GL_EXT_texture_snorm */
- case GL_RGBA_SNORM:
- return GL_RGBA8_SNORM;
-
- case GL_RGB_SNORM:
- return GL_RGB8_SNORM;
-
- case GL_RG_SNORM:
- return GL_RG8_SNORM;
-
- case GL_RED_SNORM:
- return GL_R8_SNORM;
-
- case GL_LUMINANCE_ALPHA_SNORM:
- return GL_LUMINANCE8_ALPHA8_SNORM;
-
- case GL_LUMINANCE_SNORM:
- return GL_LUMINANCE8_SNORM;
-
- case GL_ALPHA_SNORM:
- return GL_ALPHA8_SNORM;
-
- case GL_INTENSITY_SNORM:
- return GL_INTENSITY8_SNORM;
-
- default:
- return format;
- }
-}
-
-
-static GLenum
-get_linear_internalformat(GLenum format)
-{
- switch (format) {
- case GL_SRGB:
- return GL_RGB;
-
- case GL_SRGB_ALPHA:
- return GL_RGBA;
-
- case GL_SRGB8:
- return GL_RGB8;
-
- case GL_SRGB8_ALPHA8:
- return GL_RGBA8;
-
- case GL_SLUMINANCE:
- return GL_LUMINANCE8;
-
- case GL_SLUMINANCE_ALPHA:
- return GL_LUMINANCE8_ALPHA8;
-
- default:
- return format;
- }
-}
-
-
static GLboolean
-compatible_resolve_formats(const struct gl_renderbuffer *colorReadRb,
- const struct gl_renderbuffer *colorDrawRb)
+compatible_resolve_formats(const struct gl_renderbuffer *readRb,
+ const struct gl_renderbuffer *drawRb)
{
GLenum readFormat, drawFormat;
/* The simple case where we know the backing Mesa formats are the same.
*/
- if (_mesa_get_srgb_format_linear(colorReadRb->Format) ==
- _mesa_get_srgb_format_linear(colorDrawRb->Format)) {
+ if (_mesa_get_srgb_format_linear(readRb->Format) ==
+ _mesa_get_srgb_format_linear(drawRb->Format)) {
return GL_TRUE;
}
@@ -2850,10 +2739,10 @@ compatible_resolve_formats(const struct gl_renderbuffer *colorReadRb,
*
* Blits between linear and sRGB formats are also allowed.
*/
- readFormat = get_nongeneric_internalformat(colorReadRb->InternalFormat);
- drawFormat = get_nongeneric_internalformat(colorDrawRb->InternalFormat);
- readFormat = get_linear_internalformat(readFormat);
- drawFormat = get_linear_internalformat(drawFormat);
+ readFormat = _mesa_get_nongeneric_internalformat(readRb->InternalFormat);
+ drawFormat = _mesa_get_nongeneric_internalformat(drawRb->InternalFormat);
+ readFormat = _mesa_get_linear_internalformat(readFormat);
+ drawFormat = _mesa_get_linear_internalformat(drawFormat);
if (readFormat == drawFormat) {
return GL_TRUE;
@@ -3153,7 +3042,7 @@ invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments,
/* Accumulation buffers and auxilary buffers were removed in
* OpenGL 3.1, and they never existed in OpenGL ES.
*/
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum;
break;
case GL_COLOR:
diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c
index 07405fb4b..b37e95f08 100644
--- a/mesalib/src/mesa/main/fog.c
+++ b/mesalib/src/mesa/main/fog.c
@@ -141,7 +141,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
update_fog_scale(ctx);
break;
case GL_FOG_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
if (ctx->Fog.Index == *params)
return;
@@ -163,7 +163,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
break;
case GL_FOG_COORDINATE_SOURCE_EXT: {
GLenum p = (GLenum) (GLint) *params;
- if (ctx->API != API_OPENGL || !ctx->Extensions.EXT_fog_coord ||
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.EXT_fog_coord ||
(p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFog");
return;
@@ -176,7 +176,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
}
case GL_FOG_DISTANCE_MODE_NV: {
GLenum p = (GLenum) (GLint) *params;
- if (ctx->API != API_OPENGL || !ctx->Extensions.NV_fog_distance ||
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.NV_fog_distance ||
(p != GL_EYE_RADIAL_NV && p != GL_EYE_PLANE && p != GL_EYE_PLANE_ABSOLUTE_NV)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFog");
return;
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index e1ebd1856..97dccd0ed 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -395,7 +395,7 @@ print_table_stats(int api)
int i, j, collisions[11], count, hash, mask;
const struct value_desc *d;
const char *api_names[] = {
- [API_OPENGL] = "GL",
+ [API_OPENGL_COMPAT] = "GL",
[API_OPENGL_CORE] = "GL_CORE",
[API_OPENGLES] = "GLES",
[API_OPENGLES2] = "GLES2",
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index a04db0dc7..20e7a014d 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -40,7 +40,7 @@ static const GLubyte *
shading_language_version(struct gl_context *ctx)
{
switch (ctx->API) {
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
if (!ctx->Extensions.ARB_shader_objects) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
@@ -136,7 +136,7 @@ _mesa_GetString( GLenum name )
break;
return shading_language_version(ctx);
case GL_PROGRAM_ERROR_STRING_NV:
- if (ctx->API == API_OPENGL &&
+ if (ctx->API == API_OPENGL_COMPAT &&
(ctx->Extensions.ARB_fragment_program ||
ctx->Extensions.ARB_vertex_program)) {
return (const GLubyte *) ctx->Program.ErrorString;
@@ -205,52 +205,52 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
switch (pname) {
case GL_VERTEX_ARRAY_POINTER:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Ptr;
break;
case GL_NORMAL_ARRAY_POINTER:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr;
break;
case GL_COLOR_ARRAY_POINTER:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr;
break;
case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr;
break;
case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Ptr;
break;
case GL_INDEX_ARRAY_POINTER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr;
break;
case GL_TEXTURE_COORD_ARRAY_POINTER:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(clientUnit)].Ptr;
break;
case GL_EDGE_FLAG_ARRAY_POINTER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr;
break;
case GL_FEEDBACK_BUFFER_POINTER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = ctx->Feedback.Buffer;
break;
case GL_SELECTION_BUFFER_POINTER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = ctx->Select.Buffer;
break;
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index ba79f193b..69caef70b 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -821,10 +821,10 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- return ctx->API == API_OPENGL
+ return ctx->API == API_OPENGL_COMPAT
&& ctx->Extensions.EXT_texture_compression_latc;
case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- return ctx->API == API_OPENGL
+ return ctx->API == API_OPENGL_COMPAT
&& ctx->Extensions.ATI_texture_compression_3dc;
case GL_ETC1_RGB8_OES:
return _mesa_is_gles(ctx)
@@ -1008,6 +1008,119 @@ _mesa_generic_compressed_format_to_uncompressed_format(GLenum format)
/**
+ * Return the equivalent non-generic internal format.
+ * This is useful for comparing whether two internal formats are equivalent.
+ */
+GLenum
+_mesa_get_nongeneric_internalformat(GLenum format)
+{
+ switch (format) {
+ /* GL 1.1 formats. */
+ case 4:
+ case GL_RGBA:
+ return GL_RGBA8;
+
+ case 3:
+ case GL_RGB:
+ return GL_RGB8;
+
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ return GL_LUMINANCE8_ALPHA8;
+
+ case 1:
+ case GL_LUMINANCE:
+ return GL_LUMINANCE8;
+
+ case GL_ALPHA:
+ return GL_ALPHA8;
+
+ case GL_INTENSITY:
+ return GL_INTENSITY8;
+
+ /* GL_ARB_texture_rg */
+ case GL_RED:
+ return GL_R8;
+
+ case GL_RG:
+ return GL_RG8;
+
+ /* GL_EXT_texture_sRGB */
+ case GL_SRGB:
+ return GL_SRGB8;
+
+ case GL_SRGB_ALPHA:
+ return GL_SRGB8_ALPHA8;
+
+ case GL_SLUMINANCE:
+ return GL_SLUMINANCE8;
+
+ case GL_SLUMINANCE_ALPHA:
+ return GL_SLUMINANCE8_ALPHA8;
+
+ /* GL_EXT_texture_snorm */
+ case GL_RGBA_SNORM:
+ return GL_RGBA8_SNORM;
+
+ case GL_RGB_SNORM:
+ return GL_RGB8_SNORM;
+
+ case GL_RG_SNORM:
+ return GL_RG8_SNORM;
+
+ case GL_RED_SNORM:
+ return GL_R8_SNORM;
+
+ case GL_LUMINANCE_ALPHA_SNORM:
+ return GL_LUMINANCE8_ALPHA8_SNORM;
+
+ case GL_LUMINANCE_SNORM:
+ return GL_LUMINANCE8_SNORM;
+
+ case GL_ALPHA_SNORM:
+ return GL_ALPHA8_SNORM;
+
+ case GL_INTENSITY_SNORM:
+ return GL_INTENSITY8_SNORM;
+
+ default:
+ return format;
+ }
+}
+
+
+/**
+ * Convert an sRGB internal format to linear.
+ */
+GLenum
+_mesa_get_linear_internalformat(GLenum format)
+{
+ switch (format) {
+ case GL_SRGB:
+ return GL_RGB;
+
+ case GL_SRGB_ALPHA:
+ return GL_RGBA;
+
+ case GL_SRGB8:
+ return GL_RGB8;
+
+ case GL_SRGB8_ALPHA8:
+ return GL_RGBA8;
+
+ case GL_SLUMINANCE:
+ return GL_LUMINANCE8;
+
+ case GL_SLUMINANCE_ALPHA:
+ return GL_LUMINANCE8_ALPHA8;
+
+ default:
+ return format;
+ }
+}
+
+
+/**
* Do error checking of format/type combinations for glReadPixels,
* glDrawPixels and glTex[Sub]Image. Note that depending on the format
* and type values, we may either generate GL_INVALID_OPERATION or
diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h
index e5b63a963..5d0995140 100644
--- a/mesalib/src/mesa/main/glformats.h
+++ b/mesalib/src/mesa/main/glformats.h
@@ -95,6 +95,12 @@ extern GLenum
_mesa_generic_compressed_format_to_uncompressed_format(GLenum format);
extern GLenum
+_mesa_get_nongeneric_internalformat(GLenum format);
+
+extern GLenum
+_mesa_get_linear_internalformat(GLenum format);
+
+extern GLenum
_mesa_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type);
diff --git a/mesalib/src/mesa/main/hint.c b/mesalib/src/mesa/main/hint.c
index 90130e3db..83d7966cd 100644
--- a/mesalib/src/mesa/main/hint.c
+++ b/mesalib/src/mesa/main/hint.c
@@ -51,7 +51,7 @@ _mesa_Hint( GLenum target, GLenum mode )
switch (target) {
case GL_FOG_HINT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_target;
if (ctx->Hint.Fog == mode)
return;
@@ -67,7 +67,7 @@ _mesa_Hint( GLenum target, GLenum mode )
ctx->Hint.LineSmooth = mode;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_target;
if (ctx->Hint.PerspectiveCorrection == mode)
return;
@@ -75,7 +75,7 @@ _mesa_Hint( GLenum target, GLenum mode )
ctx->Hint.PerspectiveCorrection = mode;
break;
case GL_POINT_SMOOTH_HINT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_target;
if (ctx->Hint.PointSmooth == mode)
return;
@@ -93,7 +93,7 @@ _mesa_Hint( GLenum target, GLenum mode )
/* GL_EXT_clip_volume_hint */
case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_target;
if (ctx->Hint.ClipVolumeClipping == mode)
return;
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index b0a10e9ed..aae5d0ae9 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -466,7 +466,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
COPY_4V( ctx->Light.Model.Ambient, params );
break;
case GL_LIGHT_MODEL_LOCAL_VIEWER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
newbool = (params[0]!=0.0);
if (ctx->Light.Model.LocalViewer == newbool)
@@ -486,7 +486,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
newenum = GL_SINGLE_COLOR;
@@ -798,7 +798,7 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
*params = mat[MAT_ATTRIB_SHININESS(f)][0];
break;
case GL_COLOR_INDEXES:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" );
return;
}
@@ -820,7 +820,7 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
- ASSERT(ctx->API == API_OPENGL);
+ ASSERT(ctx->API == API_OPENGL_COMPAT);
FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */
diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c
index 00b8e00b7..a4e576237 100644
--- a/mesalib/src/mesa/main/matrix.c
+++ b/mesalib/src/mesa/main/matrix.c
@@ -187,7 +187,7 @@ _mesa_MatrixMode( GLenum mode )
case GL_MATRIX5_ARB:
case GL_MATRIX6_ARB:
case GL_MATRIX7_ARB:
- if (ctx->API == API_OPENGL
+ if (ctx->API == API_OPENGL_COMPAT
&& (ctx->Extensions.ARB_vertex_program ||
ctx->Extensions.ARB_fragment_program)) {
const GLuint m = mode - GL_MATRIX0_ARB;
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index da72da9d1..5bfae69c8 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2605,7 +2605,7 @@ struct gl_renderbuffer
gl_format Format; /**< The actual renderbuffer memory format */
/** Delete this renderbuffer */
- void (*Delete)(struct gl_renderbuffer *rb);
+ void (*Delete)(struct gl_context *ctx, struct gl_renderbuffer *rb);
/** Allocate new storage for this renderbuffer */
GLboolean (*AllocStorage)(struct gl_context *ctx,
@@ -3315,7 +3315,7 @@ struct gl_debug_state
*/
typedef enum
{
- API_OPENGL, /* legacy / compatibility contexts */
+ API_OPENGL_COMPAT, /* legacy / compatibility contexts */
API_OPENGLES,
API_OPENGLES2,
API_OPENGL_CORE,
diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c
index 7d6e5a5e1..b5fc5d5bb 100644
--- a/mesalib/src/mesa/main/points.c
+++ b/mesalib/src/mesa/main/points.c
@@ -190,7 +190,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
/* GL_POINT_SPRITE_COORD_ORIGIN was added to point sprites when the
* extension was merged into OpenGL 2.0.
*/
- if ((ctx->API == API_OPENGL && ctx->Version >= 20)
+ if ((ctx->API == API_OPENGL_COMPAT && ctx->Version >= 20)
|| ctx->API == API_OPENGL_CORE) {
GLenum value = (GLenum) params[0];
if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index 20799e843..cfb20cd4c 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -321,7 +321,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
q = _mesa_lookup_query_object(ctx, id);
if (!q) {
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBeginQuery{Indexed}(non-gen name)");
return;
diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c
index 26f53d100..2f2844329 100644
--- a/mesalib/src/mesa/main/renderbuffer.c
+++ b/mesalib/src/mesa/main/renderbuffer.c
@@ -80,7 +80,7 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
* free the object in the end.
*/
void
-_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
+_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
_glthread_DESTROY_MUTEX(rb->Mutex);
free(rb);
@@ -159,7 +159,11 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
_glthread_UNLOCK_MUTEX(oldRb->Mutex);
if (deleteFlag) {
- oldRb->Delete(oldRb);
+ GET_CURRENT_CONTEXT(ctx);
+ if (ctx)
+ oldRb->Delete(ctx, oldRb);
+ else
+ _mesa_problem(NULL, "Unable to delete renderbuffer, no context");
}
*ptr = NULL;
diff --git a/mesalib/src/mesa/main/renderbuffer.h b/mesalib/src/mesa/main/renderbuffer.h
index 0934d85df..5495ae150 100644
--- a/mesalib/src/mesa/main/renderbuffer.h
+++ b/mesalib/src/mesa/main/renderbuffer.h
@@ -40,7 +40,7 @@ extern struct gl_renderbuffer *
_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name);
extern void
-_mesa_delete_renderbuffer(struct gl_renderbuffer *rb);
+_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb);
extern void
_mesa_add_renderbuffer(struct gl_framebuffer *fb,
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 5c0a923e4..53e9d0486 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -452,7 +452,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
/* Is transform feedback available in this context?
*/
const bool has_xfb =
- (ctx->API == API_OPENGL && ctx->Extensions.EXT_transform_feedback)
+ (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_transform_feedback)
|| ctx->API == API_OPENGL_CORE
|| _mesa_is_gles3(ctx);
@@ -464,7 +464,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
/* Are uniform buffer objects available in this context?
*/
const bool has_ubo =
- (ctx->API == API_OPENGL && ctx->Extensions.ARB_uniform_buffer_object)
+ (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_uniform_buffer_object)
|| ctx->API == API_OPENGL_CORE
|| _mesa_is_gles3(ctx);
@@ -1728,7 +1728,7 @@ _mesa_init_shader_dispatch(const struct gl_context *ctx,
SET_GetAttribLocation(exec, _mesa_GetAttribLocation);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT);
SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT);
SET_CreateShaderProgramEXT(exec, _mesa_CreateShaderProgramEXT);
diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c
index ba82628f3..eaf9f8de1 100644
--- a/mesalib/src/mesa/main/shared.c
+++ b/mesalib/src/mesa/main/shared.c
@@ -253,10 +253,11 @@ delete_framebuffer_cb(GLuint id, void *data, void *userData)
static void
delete_renderbuffer_cb(GLuint id, void *data, void *userData)
{
+ struct gl_context *ctx = (struct gl_context *) userData;
struct gl_renderbuffer *rb = (struct gl_renderbuffer *) data;
rb->RefCount = 0; /* see comment for FBOs above */
if (rb->Delete)
- rb->Delete(rb);
+ rb->Delete(ctx, rb);
}
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index f1064c5e3..e8f3af082 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -122,7 +122,7 @@ set_combiner_mode(struct gl_context *ctx,
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;
@@ -134,11 +134,11 @@ set_combiner_mode(struct gl_context *ctx,
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;
@@ -206,7 +206,7 @@ set_combiner_source(struct gl_context *ctx,
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;
@@ -236,12 +236,12 @@ set_combiner_source(struct gl_context *ctx,
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:
@@ -293,7 +293,7 @@ set_combiner_operand(struct gl_context *ctx,
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;
@@ -442,7 +442,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
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;
}
@@ -588,7 +588,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
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 {
@@ -602,7 +602,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
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 {
@@ -616,7 +616,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
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 {
@@ -630,7 +630,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
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 {
@@ -643,7 +643,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
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 {
diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c
index 7c9c2a760..fe5fc852d 100644
--- a/mesalib/src/mesa/main/texgen.c
+++ b/mesalib/src/mesa/main/texgen.c
@@ -129,7 +129,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
- if (ctx->API != API_OPENGL
+ if (ctx->API != API_OPENGL_COMPAT
&& (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
@@ -143,7 +143,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_OBJECT_PLANE:
{
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
@@ -158,7 +158,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
{
GLfloat tmp[4];
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
@@ -352,14 +352,14 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
params[0] = ENUM_TO_FLOAT(texgen->Mode);
break;
case GL_OBJECT_PLANE:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
return;
}
COPY_4V(params, texgen->ObjectPlane);
break;
case GL_EYE_PLANE:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
return;
}
@@ -398,7 +398,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
params[0] = texgen->Mode;
break;
case GL_OBJECT_PLANE:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
return;
}
@@ -408,7 +408,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
params[3] = (GLint) texgen->ObjectPlane[3];
break;
case GL_EYE_PLANE:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
return;
}
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 2ccdcebd9..69067df9f 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -229,6 +229,8 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
const gl_format texFormat =
_mesa_get_srgb_format_linear(texImage->TexFormat);
const GLenum baseFormat = _mesa_get_format_base_format(texFormat);
+ const GLenum destBaseFormat = _mesa_base_tex_format(ctx, format);
+ GLenum rebaseFormat = GL_NONE;
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
const GLuint depth = texImage->Depth;
@@ -266,9 +268,31 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
}
if (baseFormat == GL_LUMINANCE ||
+ baseFormat == GL_INTENSITY ||
baseFormat == GL_LUMINANCE_ALPHA) {
+ /* If a luminance (or intensity) texture is read back as RGB(A), the
+ * returned value should be (L,0,0,1), not (L,L,L,1). Set rebaseFormat
+ * here to get G=B=0.
+ */
+ rebaseFormat = texImage->_BaseFormat;
+ }
+ else if ((baseFormat == GL_RGBA ||
+ baseFormat == GL_RGB ||
+ baseFormat == GL_RG) &&
+ (destBaseFormat == GL_LUMINANCE ||
+ destBaseFormat == GL_LUMINANCE_ALPHA ||
+ destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
+ destBaseFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT)) {
+ /* If we're reading back an RGB(A) texture as luminance then we need
+ * to return L=tex(R). Note, that's different from glReadPixels which
+ * returns L=R+G+B.
+ */
+ rebaseFormat = GL_LUMINANCE_ALPHA; /* this covers GL_LUMINANCE too */
+ }
+
+ if (rebaseFormat) {
_mesa_rebase_rgba_float(width * height, (GLfloat (*)[4]) tempImage,
- baseFormat);
+ rebaseFormat);
}
srcRow = tempImage;
@@ -332,7 +356,8 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
rebaseFormat = texImage->_BaseFormat;
}
else if ((texImage->_BaseFormat == GL_RGBA ||
- texImage->_BaseFormat == GL_RGB) &&
+ texImage->_BaseFormat == GL_RGB ||
+ texImage->_BaseFormat == GL_RG) &&
(destBaseFormat == GL_LUMINANCE ||
destBaseFormat == GL_LUMINANCE_ALPHA ||
destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
@@ -419,15 +444,6 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
transferOps |= IMAGE_CLAMP_BIT;
}
}
- /* This applies to RGB, RGBA textures. if the format is either LUMINANCE
- * or LUMINANCE ALPHA, luminance (L) is computed as L=R+G+B .we need to
- * clamp the sum to [0,1].
- */
- else if ((format == GL_LUMINANCE ||
- format == GL_LUMINANCE_ALPHA) &&
- dataType == GL_UNSIGNED_NORMALIZED) {
- transferOps |= IMAGE_CLAMP_BIT;
- }
if (_mesa_is_format_compressed(texImage->TexFormat)) {
get_tex_rgba_compressed(ctx, dimensions, format, type,
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 7d5a574e4..a720c38b8 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1853,7 +1853,7 @@ texture_error_check( struct gl_context *ctx,
/* Check border */
if (border < 0 || border > 1 ||
- ((ctx->API != API_OPENGL ||
+ ((ctx->API != API_OPENGL_COMPAT ||
target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -2353,7 +2353,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
/* Check border */
if (border < 0 || border > 1 ||
- ((ctx->API != API_OPENGL ||
+ ((ctx->API != API_OPENGL_COMPAT ||
target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
_mesa_error(ctx, GL_INVALID_VALUE,
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 92c89102f..c2d161f9a 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -64,7 +64,7 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
/* GL_CLAMP was removed in the core profile, and it has never existed in
* OpenGL ES.
*/
- supported = (ctx->API == API_OPENGL)
+ supported = (ctx->API == API_OPENGL_COMPAT)
&& (target != GL_TEXTURE_EXTERNAL_OES);
break;
@@ -358,7 +358,7 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_TRUE;
case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
@@ -418,7 +418,7 @@ set_tex_parameteri(struct gl_context *ctx,
/* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has never
* existed in OpenGL ES.
*/
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_texture) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_texture) {
if (texObj->DepthMode == params[0])
return GL_FALSE;
if (params[0] == GL_LUMINANCE ||
@@ -562,7 +562,7 @@ set_tex_parameterf(struct gl_context *ctx,
return GL_TRUE;
case GL_TEXTURE_PRIORITY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
flush(ctx);
@@ -595,7 +595,7 @@ set_tex_parameterf(struct gl_context *ctx,
* It was removed in core-profile, and it has never existed in OpenGL
* ES.
*/
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
if (texObj->Sampler.LodBias != params[0]) {
@@ -1328,13 +1328,13 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
}
break;
case GL_TEXTURE_RESIDENT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = 1.0F;
break;
case GL_TEXTURE_PRIORITY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = obj->Priority;
@@ -1366,7 +1366,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
*params = obj->Sampler.MaxAnisotropy;
break;
case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLfloat) obj->GenerateMipmap;
@@ -1387,12 +1387,12 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
/* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has
* never existed in OpenGL ES.
*/
- if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_depth_texture)
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = (GLfloat) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = obj->Sampler.LodBias;
@@ -1510,13 +1510,13 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
}
break;
case GL_TEXTURE_RESIDENT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = 1;
break;
case GL_TEXTURE_PRIORITY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = FLOAT_TO_INT(obj->Priority);
@@ -1548,7 +1548,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->Sampler.MaxAnisotropy;
break;
case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLint) obj->GenerateMipmap;
@@ -1566,12 +1566,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->Sampler.CompareFunc;
break;
case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_depth_texture)
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = (GLint) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLint) obj->Sampler.LodBias;
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 334e6e80b..cfaf4bbda 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -114,7 +114,7 @@ _mesa_override_gl_version(struct gl_context *ctx)
} else if (ctx->Version >= 31) {
ctx->API = API_OPENGL_CORE;
} else {
- ctx->API = API_OPENGL;
+ ctx->API = API_OPENGL_COMPAT;
}
create_version_string(ctx, "");
}
@@ -344,7 +344,7 @@ _mesa_compute_version(struct gl_context *ctx)
return;
switch (ctx->API) {
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
compute_version(ctx);
break;
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index 5891a5231..674edb5e1 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -50,7 +50,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Color4f(tab, vfmt->Color4f);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_install_arrayelt_vtxfmt(tab, vfmt);
SET_Color3f(tab, vfmt->Color3f);
SET_Color3fv(tab, vfmt->Color3fv);
@@ -58,7 +58,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_EdgeFlag(tab, vfmt->EdgeFlag);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_install_eval_vtxfmt(tab, vfmt);
}
@@ -68,7 +68,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Normal3f(tab, vfmt->Normal3f);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
SET_Indexf(tab, vfmt->Indexf);
@@ -83,7 +83,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Normal3fv(tab, vfmt->Normal3fv);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT);
SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT);
SET_TexCoord1f(tab, vfmt->TexCoord1f);
@@ -102,7 +102,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Vertex4fv(tab, vfmt->Vertex4fv);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */
SET_Begin(tab, vfmt->Begin);
@@ -145,7 +145,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
}
/* Originally for GL_NV_vertex_program, this is also used by dlist.c */
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
@@ -189,7 +189,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
/* GL_ARB_vertex_type_10_10_10_2_rev / GL 3.3 */
SET_VertexP2ui(tab, vfmt->VertexP2ui);
SET_VertexP2uiv(tab, vfmt->VertexP2uiv);