summaryrefslogtreecommitdiff
path: root/src/mesa/main/get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r--src/mesa/main/get.c115
1 files changed, 89 insertions, 26 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 5ae35b868e..7d1a5cf600 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -29,6 +29,7 @@
#include "extensions.h"
#include "get.h"
#include "macros.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "state.h"
#include "texcompress.h"
@@ -272,6 +273,7 @@ static const int extra_EXT_gpu_shader4[] = {
};
+EXTRA_EXT(ARB_ES2_compatibility);
EXTRA_EXT(ARB_multitexture);
EXTRA_EXT(ARB_texture_cube_map);
EXTRA_EXT(MESA_texture_array);
@@ -288,7 +290,6 @@ EXTRA_EXT(NV_fragment_program);
EXTRA_EXT(NV_texture_rectangle);
EXTRA_EXT(EXT_stencil_two_side);
EXTRA_EXT(NV_light_max_exponent);
-EXTRA_EXT(SGI_texture_color_table);
EXTRA_EXT(EXT_depth_bounds_test);
EXTRA_EXT(ARB_depth_clamp);
EXTRA_EXT(ATI_fragment_shader);
@@ -315,6 +316,7 @@ EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program);
EXTRA_EXT(ARB_vertex_buffer_object);
EXTRA_EXT(ARB_geometry_shader4);
EXTRA_EXT(ARB_copy_buffer);
+EXTRA_EXT(EXT_framebuffer_sRGB);
static const int
extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
@@ -370,7 +372,7 @@ static const struct value_desc values[] = {
API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGLES2_BIT, NO_EXTRA},
{ GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers },
{ GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA },
- { GL_BLEND_SRC, CONTEXT_ENUM(Color.BlendSrcRGB), NO_EXTRA },
+ { GL_BLEND_SRC, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
{ GL_BLUE_BITS, BUFFER_INT(Visual.blueBits), extra_new_buffers },
{ GL_COLOR_CLEAR_VALUE, CONTEXT_FIELD(Color.ClearColor[0], TYPE_FLOATN_4), NO_EXTRA },
{ GL_COLOR_WRITEMASK, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
@@ -433,15 +435,15 @@ static const struct value_desc values[] = {
extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */
/* XXX: OES_blend_subtract */
- { GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.BlendSrcRGB), NO_EXTRA },
- { GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.BlendDstRGB), NO_EXTRA },
- { GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.BlendSrcA), NO_EXTRA },
- { GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.BlendDstA), NO_EXTRA },
+ { GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
+ { GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA },
+ { GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].SrcA), NO_EXTRA },
+ { GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].DstA), NO_EXTRA },
/* GL_BLEND_EQUATION_RGB, which is what we're really after, is
* defined identically to GL_BLEND_EQUATION. */
- { GL_BLEND_EQUATION, CONTEXT_ENUM(Color.BlendEquationRGB), NO_EXTRA },
- { GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.BlendEquationA), NO_EXTRA },
+ { GL_BLEND_EQUATION, CONTEXT_ENUM(Color.Blend[0].EquationRGB), NO_EXTRA },
+ { GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].EquationA), NO_EXTRA },
/* GL_ARB_texture_compression */
{ GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
@@ -510,7 +512,7 @@ static const struct value_desc values[] = {
{ GL_ALPHA_TEST, CONTEXT_BOOL(Color.AlphaEnabled), NO_EXTRA },
{ GL_ALPHA_TEST_FUNC, CONTEXT_ENUM(Color.AlphaFunc), NO_EXTRA },
{ GL_ALPHA_TEST_REF, CONTEXT_FIELD(Color.AlphaRef, TYPE_FLOATN), NO_EXTRA },
- { GL_BLEND_DST, CONTEXT_ENUM(Color.BlendDstRGB), NO_EXTRA },
+ { GL_BLEND_DST, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA },
{ GL_CLIP_PLANE0, CONTEXT_BIT0(Transform.ClipPlanesEnabled), NO_EXTRA },
{ GL_CLIP_PLANE1, CONTEXT_BIT1(Transform.ClipPlanesEnabled), NO_EXTRA },
{ GL_CLIP_PLANE2, CONTEXT_BIT2(Transform.ClipPlanesEnabled), NO_EXTRA },
@@ -586,6 +588,15 @@ static const struct value_desc values[] = {
{ GL_TEXTURE_COORD_ARRAY_STRIDE,
LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Stride), NO_EXTRA },
+ /* GL_ARB_ES2_compatibility */
+ { GL_SHADER_COMPILER, CONST(1), extra_ARB_ES2_compatibility },
+ { GL_MAX_VARYING_VECTORS, CONTEXT_INT(Const.MaxVarying),
+ extra_ARB_ES2_compatibility },
+ { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0,
+ extra_ARB_ES2_compatibility },
+ { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0,
+ extra_ARB_ES2_compatibility },
+
/* GL_ARB_multitexture */
{ GL_MAX_TEXTURE_UNITS_ARB,
CONTEXT_INT(Const.MaxTextureUnits), extra_ARB_multitexture },
@@ -899,11 +910,6 @@ static const struct value_desc values[] = {
CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA },
{ GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA },
- /* GL_SGI_texture_color_table */
- { GL_TEXTURE_COLOR_TABLE_SGI, LOC_TEXUNIT, TYPE_BOOLEAN,
- offsetof(struct gl_texture_unit, ColorTableEnabled),
- extra_SGI_texture_color_table },
-
/* GL_EXT_secondary_color */
{ GL_COLOR_SUM_EXT, CONTEXT_BOOL(Fog.ColorSumEnabled),
extra_EXT_secondary_color_ARB_vertex_program },
@@ -1195,22 +1201,22 @@ static const struct value_desc values[] = {
/* GL_ARB_geometry_shader4 */
{ GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB,
- CONTEXT_INT(Const.GeometryProgram.MaxGeometryTextureImageUnits),
+ CONTEXT_INT(Const.MaxGeometryTextureImageUnits),
extra_ARB_geometry_shader4 },
{ GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB,
- CONTEXT_INT(Const.GeometryProgram.MaxGeometryOutputVertices),
+ CONTEXT_INT(Const.MaxGeometryOutputVertices),
extra_ARB_geometry_shader4 },
{ GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB,
- CONTEXT_INT(Const.GeometryProgram.MaxGeometryTotalOutputComponents),
+ CONTEXT_INT(Const.MaxGeometryTotalOutputComponents),
extra_ARB_geometry_shader4 },
{ GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB,
- CONTEXT_INT(Const.GeometryProgram.MaxGeometryUniformComponents),
+ CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents),
extra_ARB_geometry_shader4 },
{ GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB,
- CONTEXT_INT(Const.GeometryProgram.MaxGeometryVaryingComponents),
+ CONTEXT_INT(Const.MaxGeometryVaryingComponents),
extra_ARB_geometry_shader4 },
{ GL_MAX_VERTEX_VARYING_COMPONENTS_ARB,
- CONTEXT_INT(Const.GeometryProgram.MaxVertexVaryingComponents),
+ CONTEXT_INT(Const.MaxVertexVaryingComponents),
extra_ARB_geometry_shader4 },
/* GL_EXT_gpu_shader4 / GL 3.0 */
@@ -1227,6 +1233,10 @@ static const struct value_desc values[] = {
{ GL_MINOR_VERSION, CONTEXT_INT(VersionMinor), extra_version_30 },
{ GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 },
+ /* GL3.0 / GL_EXT_framebuffer_sRGB */
+ { GL_FRAMEBUFFER_SRGB_EXT, CONTEXT_BOOL(Color.sRGBEnabled), extra_EXT_framebuffer_sRGB },
+ { GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, BUFFER_INT(Visual.sRGBCapable), extra_EXT_framebuffer_sRGB },
+
/* GL 3.1 */
/* NOTE: different enum values for GL_PRIMITIVE_RESTART_NV
* vs. GL_PRIMITIVE_RESTART!
@@ -2260,6 +2270,53 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
v->value_int = (ctx->Color.BlendEnabled >> index) & 1;
return TYPE_INT;
+ case GL_BLEND_SRC:
+ /* fall-through */
+ case GL_BLEND_SRC_RGB:
+ if (index >= ctx->Const.MaxDrawBuffers)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_draw_buffers_blend)
+ goto invalid_enum;
+ v->value_int = ctx->Color.Blend[index].SrcRGB;
+ return TYPE_INT;
+ case GL_BLEND_SRC_ALPHA:
+ if (index >= ctx->Const.MaxDrawBuffers)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_draw_buffers_blend)
+ goto invalid_enum;
+ v->value_int = ctx->Color.Blend[index].SrcA;
+ return TYPE_INT;
+ case GL_BLEND_DST:
+ /* fall-through */
+ case GL_BLEND_DST_RGB:
+ if (index >= ctx->Const.MaxDrawBuffers)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_draw_buffers_blend)
+ goto invalid_enum;
+ v->value_int = ctx->Color.Blend[index].DstRGB;
+ return TYPE_INT;
+ case GL_BLEND_DST_ALPHA:
+ if (index >= ctx->Const.MaxDrawBuffers)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_draw_buffers_blend)
+ goto invalid_enum;
+ v->value_int = ctx->Color.Blend[index].DstA;
+ return TYPE_INT;
+ case GL_BLEND_EQUATION_RGB:
+ if (index >= ctx->Const.MaxDrawBuffers)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_draw_buffers_blend)
+ goto invalid_enum;
+ v->value_int = ctx->Color.Blend[index].EquationRGB;
+ return TYPE_INT;
+ case GL_BLEND_EQUATION_ALPHA:
+ if (index >= ctx->Const.MaxDrawBuffers)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_draw_buffers_blend)
+ goto invalid_enum;
+ v->value_int = ctx->Color.Blend[index].EquationA;
+ return TYPE_INT;
+
case GL_COLOR_WRITEMASK:
if (index >= ctx->Const.MaxDrawBuffers)
goto invalid_value;
@@ -2310,8 +2367,10 @@ void GLAPIENTRY
_mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
{
union value v;
+ enum value_type type =
+ find_value_indexed("glGetBooleanIndexedv", pname, index, &v);
- switch (find_value_indexed("glGetBooleanIndexedv", pname, index, &v)) {
+ switch (type) {
case TYPE_INT:
params[0] = INT_TO_BOOLEAN(v.value_int);
break;
@@ -2325,7 +2384,7 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
params[0] = INT64_TO_BOOLEAN(v.value_int);
break;
default:
- assert(0);
+ ; /* nothing - GL error was recorded */
}
}
@@ -2333,8 +2392,10 @@ void GLAPIENTRY
_mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
{
union value v;
+ enum value_type type =
+ find_value_indexed("glGetIntegerIndexedv", pname, index, &v);
- switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) {
+ switch (type) {
case TYPE_INT:
params[0] = v.value_int;
break;
@@ -2348,7 +2409,7 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
params[0] = INT64_TO_INT(v.value_int);
break;
default:
- assert(0);
+ ; /* nothing - GL error was recorded */
}
}
@@ -2357,8 +2418,10 @@ void GLAPIENTRY
_mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
{
union value v;
+ enum value_type type =
+ find_value_indexed("glGetIntegerIndexedv", pname, index, &v);
- switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) {
+ switch (type) {
case TYPE_INT:
params[0] = v.value_int;
break;
@@ -2372,7 +2435,7 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
params[0] = v.value_int;
break;
default:
- assert(0);
+ ; /* nothing - GL error was recorded */
}
}
#endif /* FEATURE_ARB_sync */