aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/Android.gen.mk8
-rw-r--r--mesalib/src/mesa/Makefile.am15
-rw-r--r--mesalib/src/mesa/SConscript19
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c423
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c10
-rw-r--r--mesalib/src/mesa/main/.gitignore3
-rw-r--r--mesalib/src/mesa/main/APIspec.xml903
-rw-r--r--mesalib/src/mesa/main/api_exec.c300
-rw-r--r--mesalib/src/mesa/main/api_validate.c35
-rw-r--r--mesalib/src/mesa/main/arrayobj.c2
-rw-r--r--mesalib/src/mesa/main/attrib.c3
-rw-r--r--mesalib/src/mesa/main/blend.c15
-rw-r--r--mesalib/src/mesa/main/bufferobj.c4
-rw-r--r--mesalib/src/mesa/main/clear.c11
-rw-r--r--mesalib/src/mesa/main/compiler.h3
-rw-r--r--mesalib/src/mesa/main/context.c12
-rw-r--r--mesalib/src/mesa/main/enable.c303
-rw-r--r--mesalib/src/mesa/main/es1_conversion.c430
-rw-r--r--mesalib/src/mesa/main/extensions.c7
-rw-r--r--mesalib/src/mesa/main/fbobject.c276
-rw-r--r--mesalib/src/mesa/main/fog.c15
-rw-r--r--mesalib/src/mesa/main/get.c44
-rw-r--r--mesalib/src/mesa/main/getstring.c58
-rw-r--r--mesalib/src/mesa/main/hint.c31
-rw-r--r--mesalib/src/mesa/main/light.c19
-rw-r--r--mesalib/src/mesa/main/lines.c17
-rw-r--r--mesalib/src/mesa/main/macros.h194
-rw-r--r--mesalib/src/mesa/main/matrix.c7
-rw-r--r--mesalib/src/mesa/main/mtypes.h2
-rw-r--r--mesalib/src/mesa/main/pixelstore.c39
-rw-r--r--mesalib/src/mesa/main/points.c131
-rw-r--r--mesalib/src/mesa/main/polygon.c8
-rw-r--r--mesalib/src/mesa/main/readpix.c33
-rw-r--r--mesalib/src/mesa/main/texenv.c41
-rw-r--r--mesalib/src/mesa/main/texgen.c63
-rw-r--r--mesalib/src/mesa/main/texgen.h3
-rw-r--r--mesalib/src/mesa/main/teximage.c53
-rw-r--r--mesalib/src/mesa/main/texobj.c5
-rw-r--r--mesalib/src/mesa/main/varray.c49
-rw-r--r--mesalib/src/mesa/main/version.c1
-rw-r--r--mesalib/src/mesa/main/version.h6
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c14
-rw-r--r--mesalib/src/mesa/sources.mak1
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c3
-rw-r--r--mesalib/src/mesa/swrast/s_lines.c4
-rw-r--r--mesalib/src/mesa/tnl/t_vertex_generic.c5
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c36
47 files changed, 1703 insertions, 1961 deletions
diff --git a/mesalib/src/mesa/Android.gen.mk b/mesalib/src/mesa/Android.gen.mk
index 5443bb99f..f5e63234a 100644
--- a/mesalib/src/mesa/Android.gen.mk
+++ b/mesalib/src/mesa/Android.gen.mk
@@ -35,13 +35,10 @@ sources := \
main/api_exec_es1.c \
main/api_exec_es1_dispatch.h \
main/api_exec_es1_remap_helper.h \
- main/api_exec_es2.c \
- main/api_exec_es2_dispatch.h \
program/program_parse.tab.c \
program/lex.yy.c \
main/dispatch.h \
- main/remap_helper.h \
- main/api_exec_es2_remap_helper.h
+ main/remap_helper.h
LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
@@ -100,9 +97,6 @@ $(intermediates)/main/api_exec_%_remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_a
$(intermediates)/main/api_exec_es1.c: $(es_src_deps)
$(call es-gen, -V GLES1.1)
-$(intermediates)/main/api_exec_es2.c: $(es_src_deps)
- $(call es-gen, -V GLES2.0)
-
$(intermediates)/main/api_exec_%_dispatch.h: $(es_hdr_deps)
$(call es-gen, -c $* -m remap_table)
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am
index 6964c8a68..57325afab 100644
--- a/mesalib/src/mesa/Makefile.am
+++ b/mesalib/src/mesa/Makefile.am
@@ -51,10 +51,7 @@ BUILT_SOURCES = \
main/git_sha1.h \
main/api_exec_es1_dispatch.h \
main/api_exec_es1_remap_helper.h \
- main/api_exec_es2_dispatch.h \
- main/api_exec_es2_remap_helper.h \
main/api_exec_es1.c \
- main/api_exec_es2.c \
program/program_parse.tab.c \
program/program_parse.tab.h \
program/lex.yy.c
@@ -70,22 +67,10 @@ main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_d
main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
-main/api_exec_es2_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
- $(call glapi_gen_dispatch,$<,es2)
-
-main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
- $(call glapi_gen_remap,$<,es2)
-
-main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h
-
main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
-S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@
-main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
- $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
- -S $(srcdir)/main/APIspec.xml -V GLES2.0 > $@
-
program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
$(MKDIR_P) program
$(AM_V_GEN) $(YACC) -v -d --output=program/program_parse.tab.c $<
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index e2064ce73..920b545a8 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -31,6 +31,7 @@ if env['platform'] == 'windows':
else:
env.Append(CPPDEFINES = [
'IN_DRI_DRIVER', # enable the remap table (for DRI drivers)
+ ('HAVE_DLOPEN', '1'),
])
#
@@ -344,12 +345,6 @@ if env['gles']:
source = 'main/APIspec.xml',
command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES1.1 > $TARGET'
)
- gles_sources += env.CodeGenerate(
- target = 'main/api_exec_es2.c',
- script = 'main/es_generator.py',
- source = 'main/APIspec.xml',
- command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES2.0 > $TARGET'
- )
# generate GLES headers
gles_headers = []
@@ -365,18 +360,6 @@ if env['gles']:
source = GLAPI + 'gen/gl_and_es_API.xml',
command = python_cmd + ' $SCRIPT -c es1 -f $SOURCE > $TARGET',
)
- gles_headers += env.CodeGenerate(
- target = 'main/api_exec_es2_dispatch.h',
- script = GLAPI + 'gen/gl_table.py',
- source = GLAPI + 'gen/gl_and_es_API.xml',
- command = python_cmd + ' $SCRIPT -c es2 -m remap_table -f $SOURCE > $TARGET',
- )
- gles_headers += env.CodeGenerate(
- target = 'main/api_exec_es2_remap_helper.h',
- script = GLAPI + 'gen/remap_helper.py',
- source = GLAPI + 'gen/gl_and_es_API.xml',
- command = python_cmd + ' $SCRIPT -c es2 -f $SOURCE > $TARGET',
- )
env.Depends(gles_sources, gles_headers)
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 7d7113c56..4b448fed5 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -282,6 +282,8 @@ struct gen_mipmap_state
GLuint VBO;
GLuint FBO;
GLuint Sampler;
+ GLuint ShaderProg;
+ GLuint IntegerShaderProg;
};
@@ -330,6 +332,8 @@ struct gl_meta_state
static void meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit);
static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex);
static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear);
+static void meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
+ struct gen_mipmap_state *mipmap);
static GLuint
compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source)
@@ -422,6 +426,7 @@ _mesa_meta_free(struct gl_context *ctx)
_mesa_make_current(ctx, NULL, NULL);
meta_glsl_blit_cleanup(ctx, &ctx->Meta->Blit);
meta_glsl_clear_cleanup(ctx, &ctx->Meta->Clear);
+ meta_glsl_generate_mipmap_cleanup(ctx, &ctx->Meta->Mipmap);
cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
if (old_context)
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
@@ -433,6 +438,35 @@ _mesa_meta_free(struct gl_context *ctx)
/**
+ * This is an alternative to _mesa_set_enable() to handle some special cases.
+ * See comments inside.
+ */
+static void
+meta_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
+{
+ switch (cap) {
+ case GL_MULTISAMPLE:
+ /* We need to enable/disable multisample when using GLES but this enum
+ * is not supported there.
+ */
+ if (ctx->Multisample.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.Enabled = state;
+ break;
+ default:
+ _mesa_problem(ctx, "Unexpected cap in _meta_set_enable()");
+ return;
+ }
+
+ if (ctx->Driver.Enable) {
+ ctx->Driver.Enable(ctx, cap, state);
+ }
+}
+
+
+
+/**
* Enter meta state. This is like a light-weight version of glPushAttrib
* but it also resets most GL state back to default values.
*
@@ -549,8 +583,10 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
save->PolygonCull = ctx->Polygon.CullFlag;
_mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, GL_FALSE);
- _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, GL_FALSE);
- _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, GL_FALSE);
+ if (ctx->API == API_OPENGL) {
+ _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, GL_FALSE);
+ _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, GL_FALSE);
+ }
_mesa_set_enable(ctx, GL_CULL_FACE, GL_FALSE);
}
@@ -560,14 +596,14 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
}
if (state & MESA_META_SHADER) {
- if (ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_vertex_program) {
save->VertexProgramEnabled = ctx->VertexProgram.Enabled;
_mesa_reference_vertprog(ctx, &save->VertexProgram,
ctx->VertexProgram.Current);
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE);
}
- if (ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_fragment_program) {
save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled;
_mesa_reference_fragprog(ctx, &save->FragmentProgram,
ctx->FragmentProgram.Current);
@@ -603,25 +639,27 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
save->EnvMode = ctx->Texture.Unit[0].EnvMode;
/* Disable all texture units */
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled;
- save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled;
- if (ctx->Texture.Unit[u].Enabled ||
- ctx->Texture.Unit[u].TexGenEnabled) {
- _mesa_ActiveTextureARB(GL_TEXTURE0 + u);
- _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
- if (ctx->Extensions.ARB_texture_cube_map)
- _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
- if (ctx->Extensions.NV_texture_rectangle)
- _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
- if (ctx->Extensions.OES_EGL_image_external)
- _mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled;
+ save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled;
+ if (ctx->Texture.Unit[u].Enabled ||
+ ctx->Texture.Unit[u].TexGenEnabled) {
+ _mesa_ActiveTextureARB(GL_TEXTURE0 + u);
+ _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
+ if (ctx->Extensions.ARB_texture_cube_map)
+ _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
+ if (ctx->Extensions.NV_texture_rectangle)
+ _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
+ if (ctx->Extensions.OES_EGL_image_external)
+ _mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
+ }
}
}
@@ -634,7 +672,9 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
/* set defaults for unit[0] */
_mesa_ActiveTextureARB(GL_TEXTURE0);
_mesa_ClientActiveTextureARB(GL_TEXTURE0);
- _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ }
}
if (state & MESA_META_TRANSFORM) {
@@ -744,7 +784,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
if (state & MESA_META_MULTISAMPLE) {
save->MultisampleEnabled = ctx->Multisample.Enabled;
if (ctx->Multisample.Enabled)
- _mesa_set_enable(ctx, GL_MULTISAMPLE, GL_FALSE);
+ meta_set_enable(ctx, GL_MULTISAMPLE, GL_FALSE);
}
/* misc */
@@ -765,7 +805,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
void
_mesa_meta_end(struct gl_context *ctx)
{
- struct save_state *save = &ctx->Meta->Save[--ctx->Meta->SaveStackDepth];
+ struct save_state *save = &ctx->Meta->Save[ctx->Meta->SaveStackDepth - 1];
const GLbitfield state = save->SavedState;
if (state & MESA_META_ALPHA_TEST) {
@@ -840,11 +880,19 @@ _mesa_meta_end(struct gl_context *ctx)
}
if (state & MESA_META_RASTERIZATION) {
- _mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
- _mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
- _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple);
+ /* Core context requires that front and back mode be the same.
+ */
+ if (ctx->API == API_OPENGL_CORE) {
+ _mesa_PolygonMode(GL_FRONT_AND_BACK, save->FrontPolygonMode);
+ } else {
+ _mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
+ _mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
+ }
+ if (ctx->API == API_OPENGL) {
+ _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple);
+ _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth);
+ }
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, save->PolygonOffset);
- _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth);
_mesa_set_enable(ctx, GL_CULL_FACE, save->PolygonCull);
}
@@ -855,7 +903,7 @@ _mesa_meta_end(struct gl_context *ctx)
}
if (state & MESA_META_SHADER) {
- if (ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_vertex_program) {
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB,
save->VertexProgramEnabled);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
@@ -863,7 +911,7 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_reference_vertprog(ctx, &save->VertexProgram, NULL);
}
- if (ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_fragment_program) {
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB,
save->FragmentProgramEnabled);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
@@ -896,7 +944,7 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled);
_mesa_ClearStencil(stencil->Clear);
- if (ctx->Extensions.EXT_stencil_two_side) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.EXT_stencil_two_side) {
_mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT,
stencil->TestTwoSide);
_mesa_ActiveStencilFaceEXT(stencil->ActiveFace
@@ -928,7 +976,9 @@ _mesa_meta_end(struct gl_context *ctx)
ASSERT(ctx->Texture.CurrentUnit == 0);
/* restore texenv for unit[0] */
- _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, save->EnvMode);
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, save->EnvMode);
+ }
/* restore texture objects for unit[0] only */
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
@@ -941,16 +991,18 @@ _mesa_meta_end(struct gl_context *ctx)
}
/* Restore fixed function texture enables, texgen */
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- if (ctx->Texture.Unit[u].Enabled != save->TexEnabled[u]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- ctx->Texture.Unit[u].Enabled = save->TexEnabled[u];
- }
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ if (ctx->Texture.Unit[u].Enabled != save->TexEnabled[u]) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.Unit[u].Enabled = save->TexEnabled[u];
+ }
- if (ctx->Texture.Unit[u].TexGenEnabled != save->TexGenEnabled[u]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- ctx->Texture.Unit[u].TexGenEnabled = save->TexGenEnabled[u];
- }
+ if (ctx->Texture.Unit[u].TexGenEnabled != save->TexGenEnabled[u]) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.Unit[u].TexGenEnabled = save->TexGenEnabled[u];
+ }
+ }
}
/* restore current unit state */
@@ -1034,7 +1086,7 @@ _mesa_meta_end(struct gl_context *ctx)
if (state & MESA_META_MULTISAMPLE) {
if (ctx->Multisample.Enabled != save->MultisampleEnabled)
- _mesa_set_enable(ctx, GL_MULTISAMPLE, save->MultisampleEnabled);
+ meta_set_enable(ctx, GL_MULTISAMPLE, save->MultisampleEnabled);
}
/* misc */
@@ -1048,6 +1100,8 @@ _mesa_meta_end(struct gl_context *ctx)
if (save->TransformFeedbackNeedsResume)
_mesa_ResumeTransformFeedback();
#endif
+
+ ctx->Meta->SaveStackDepth--;
}
@@ -1400,7 +1454,8 @@ blitframebuffer_texture(struct gl_context *ctx,
_mesa_SamplerParameteri(sampler, GL_TEXTURE_SRGB_DECODE_EXT,
GL_SKIP_DECODE_EXT);
}
- if (ctx->Extensions.EXT_framebuffer_sRGB) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_framebuffer_sRGB)
+ || _mesa_is_gles3(ctx)) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
}
@@ -1799,7 +1854,7 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
"}\n";
const char *vs_int_source =
"#version 130\n"
- "attribute vec4 position;\n"
+ "in vec4 position;\n"
"void main()\n"
"{\n"
" gl_Position = position;\n"
@@ -2913,6 +2968,157 @@ setup_texture_coords(GLenum faceTarget,
}
+static void
+setup_ff_generate_mipmap(struct gl_context *ctx,
+ struct gen_mipmap_state *mipmap)
+{
+ struct vertex {
+ GLfloat x, y, tex[3];
+ };
+
+ if (mipmap->ArrayObj == 0) {
+ /* one-time setup */
+ /* create vertex array object */
+ _mesa_GenVertexArraysAPPLE(1, &mipmap->ArrayObj);
+ _mesa_BindVertexArrayAPPLE(mipmap->ArrayObj);
+
+ /* create vertex array buffer */
+ _mesa_GenBuffersARB(1, &mipmap->VBO);
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
+ /* setup vertex arrays */
+ _mesa_VertexPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
+ _mesa_TexCoordPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(tex));
+ _mesa_EnableClientState(GL_VERTEX_ARRAY);
+ _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
+ }
+
+ /* setup projection matrix */
+ _mesa_MatrixMode(GL_PROJECTION);
+ _mesa_LoadIdentity();
+ _mesa_Ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
+}
+
+
+static void
+setup_glsl_generate_mipmap(struct gl_context *ctx,
+ struct gen_mipmap_state *mipmap)
+{
+ struct vertex {
+ GLfloat x, y, tex[3];
+ };
+
+ static const char *vs_source =
+ "attribute vec2 position;\n"
+ "attribute vec3 textureCoords;\n"
+ "varying vec3 texCoords;\n"
+ "void main()\n"
+ "{\n"
+ " texCoords = textureCoords;\n"
+ " gl_Position = vec4(position, 0.0, 1.0);\n"
+ "}\n";
+ static const char *fs_source =
+ "uniform sampler2D tex2d;\n"
+ "varying vec3 texCoords;\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = texture2D(tex2d, texCoords.xy);\n"
+ "}\n";
+
+ static const char *vs_int_source =
+ "#version 130\n"
+ "in vec2 position;\n"
+ "in vec3 textureCoords;\n"
+ "out vec3 texCoords;\n"
+ "void main()\n"
+ "{\n"
+ " texCoords = textureCoords;\n"
+ " gl_Position = gl_Vertex;\n"
+ "}\n";
+ static const char *fs_int_source =
+ "#version 130\n"
+ "uniform isampler2D tex2d;\n"
+ "in vec3 texCoords;\n"
+ "out ivec4 out_color;\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ " out_color = texture(tex2d, texCoords.xy);\n"
+ "}\n";
+ GLuint vs, fs;
+
+ /* Check if already initialized */
+ if (mipmap->ArrayObj != 0)
+ return;
+ /* create vertex array object */
+ _mesa_GenVertexArrays(1, &mipmap->ArrayObj);
+ _mesa_BindVertexArray(mipmap->ArrayObj);
+
+ /* create vertex array buffer */
+ _mesa_GenBuffersARB(1, &mipmap->VBO);
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
+
+ /* setup vertex arrays */
+ _mesa_VertexAttribPointerARB(0, 2, GL_FLOAT, GL_FALSE,
+ sizeof(struct vertex), OFFSET(x));
+ _mesa_VertexAttribPointerARB(1, 3, GL_FLOAT, GL_FALSE,
+ sizeof(struct vertex), OFFSET(tex));
+
+ vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source);
+ fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source);
+
+ mipmap->ShaderProg = _mesa_CreateProgramObjectARB();
+ _mesa_AttachShader(mipmap->ShaderProg, fs);
+ _mesa_DeleteObjectARB(fs);
+ _mesa_AttachShader(mipmap->ShaderProg, vs);
+ _mesa_DeleteObjectARB(vs);
+ _mesa_BindAttribLocationARB(mipmap->ShaderProg, 0, "position");
+ _mesa_BindAttribLocationARB(mipmap->ShaderProg, 1, "texcoords");
+ _mesa_EnableVertexAttribArrayARB(0);
+ _mesa_EnableVertexAttribArrayARB(1);
+ link_program_with_debug(ctx, mipmap->ShaderProg);
+
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130) ||
+ _mesa_is_gles3(ctx)){
+ vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_int_source);
+ fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_int_source);
+
+ mipmap->IntegerShaderProg = _mesa_CreateProgramObjectARB();
+ _mesa_AttachShader(mipmap->IntegerShaderProg, fs);
+ _mesa_DeleteObjectARB(fs);
+ _mesa_AttachShader(mipmap->IntegerShaderProg, vs);
+ _mesa_DeleteObjectARB(vs);
+ _mesa_BindAttribLocationARB(mipmap->IntegerShaderProg, 0, "position");
+ _mesa_BindAttribLocationARB(mipmap->IntegerShaderProg, 1, "texcoords");
+
+ /* Note that user-defined out attributes get automatically assigned
+ * locations starting from 0, so we don't need to explicitly
+ * BindFragDataLocation to 0.
+ */
+ link_program_with_debug(ctx, mipmap->IntegerShaderProg);
+ }
+}
+
+
+static void
+meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
+ struct gen_mipmap_state *mipmap)
+{
+ if (mipmap->ArrayObj == 0)
+ return;
+ _mesa_DeleteVertexArraysAPPLE(1, &mipmap->ArrayObj);
+ mipmap->ArrayObj = 0;
+ _mesa_DeleteBuffersARB(1, &mipmap->VBO);
+ mipmap->VBO = 0;
+ _mesa_DeleteObjectARB(mipmap->ShaderProg);
+ mipmap->ShaderProg = 0;
+
+ if (mipmap->IntegerShaderProg) {
+ _mesa_DeleteObjectARB(mipmap->IntegerShaderProg);
+ mipmap->IntegerShaderProg = 0;
+ }
+}
+
+
/**
* Called via ctx->Driver.GenerateMipmap()
* Note: We don't yet support 3D textures, 1D/2D array textures or texture
@@ -2933,10 +3139,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
const GLboolean genMipmapSave = texObj->GenerateMipmap;
const GLenum srgbBufferSave = ctx->Color.sRGBEnabled;
const GLuint fboSave = ctx->DrawBuffer->Name;
- const GLuint original_active_unit = ctx->Texture.CurrentUnit;
+ const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit;
+ const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
+ ctx->Extensions.ARB_fragment_shader &&
+ (ctx->API != API_OPENGLES);
GLenum faceTarget;
GLuint dstLevel;
- const GLuint border = 0;
const GLint slice = 0;
GLuint samplerSave;
@@ -2956,36 +3164,31 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_meta_begin(ctx, MESA_META_ALL);
- samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
- ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
-
- if (original_active_unit != 0)
- _mesa_BindTexture(target, texObj->Name);
-
- if (mipmap->ArrayObj == 0) {
- /* one-time setup */
-
- /* create vertex array object */
- _mesa_GenVertexArraysAPPLE(1, &mipmap->ArrayObj);
- _mesa_BindVertexArrayAPPLE(mipmap->ArrayObj);
-
- /* create vertex array buffer */
- _mesa_GenBuffersARB(1, &mipmap->VBO);
- _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
- _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
- NULL, GL_DYNAMIC_DRAW_ARB);
+ /* Choose between glsl version and fixed function version of
+ * GenerateMipmap function.
+ */
+ if (use_glsl_version) {
+ setup_glsl_generate_mipmap(ctx, mipmap);
- /* setup vertex arrays */
- _mesa_VertexPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
- _mesa_TexCoordPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(tex));
- _mesa_EnableClientState(GL_VERTEX_ARRAY);
- _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
+ if (texObj->_IsIntegerFormat)
+ _mesa_UseProgramObjectARB(mipmap->IntegerShaderProg);
+ else
+ _mesa_UseProgramObjectARB(mipmap->ShaderProg);
}
else {
- _mesa_BindVertexArray(mipmap->ArrayObj);
- _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
+ setup_ff_generate_mipmap(ctx, mipmap);
+ _mesa_set_enable(ctx, target, GL_TRUE);
}
+ _mesa_BindVertexArray(mipmap->ArrayObj);
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
+
+ samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
+ ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
+
+ if (currentTexUnitSave != 0)
+ _mesa_BindTexture(target, texObj->Name);
+
if (!mipmap->FBO) {
_mesa_GenFramebuffersEXT(1, &mipmap->FBO);
}
@@ -2993,12 +3196,25 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
if (!mipmap->Sampler) {
_mesa_GenSamplers(1, &mipmap->Sampler);
_mesa_BindSampler(ctx->Texture.CurrentUnit, mipmap->Sampler);
- _mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+
+ if (use_glsl_version && texObj->_IsIntegerFormat)
+ _mesa_SamplerParameteri(mipmap->Sampler,
+ GL_TEXTURE_MIN_FILTER,
+ GL_NEAREST_MIPMAP_NEAREST);
+ else
+ _mesa_SamplerParameteri(mipmap->Sampler,
+ GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_LINEAR);
+
_mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
_mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
_mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
_mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
- /* We don't want to encode or decode sRGB values; treat them as linear */
+
+ /* We don't want to encode or decode sRGB values; treat them as linear.
+ * This is not technically correct for GLES3 but we don't get any API
+ * error at the moment.
+ */
if (ctx->Extensions.EXT_texture_sRGB_decode) {
_mesa_SamplerParameteri(mipmap->Sampler, GL_TEXTURE_SRGB_DECODE_EXT,
GL_SKIP_DECODE_EXT);
@@ -3015,13 +3231,13 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
else
assert(!genMipmapSave);
- if (ctx->Extensions.EXT_framebuffer_sRGB) {
+ if ((ctx->Extensions.EXT_framebuffer_sRGB &&
+ _mesa_is_desktop_gl(ctx)) ||
+ _mesa_is_gles3(ctx)) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
}
- _mesa_set_enable(ctx, target, GL_TRUE);
-
- /* setup texcoords (XXX what about border?) */
+ /* Setup texture coordinates */
setup_texture_coords(faceTarget,
slice,
0, 0, /* width, height never used here */
@@ -3031,22 +3247,18 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
verts[3].tex);
/* setup vertex positions */
- verts[0].x = 0.0F;
- verts[0].y = 0.0F;
- verts[1].x = 1.0F;
- verts[1].y = 0.0F;
- verts[2].x = 1.0F;
- verts[2].y = 1.0F;
- verts[3].x = 0.0F;
- verts[3].y = 1.0F;
-
- /* upload new vertex data */
- _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
-
- /* setup projection matrix */
- _mesa_MatrixMode(GL_PROJECTION);
- _mesa_LoadIdentity();
- _mesa_Ortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
+ verts[0].x = -1.0F;
+ verts[0].y = -1.0F;
+ verts[1].x = 1.0F;
+ verts[1].y = -1.0F;
+ verts[2].x = 1.0F;
+ verts[2].y = 1.0F;
+ verts[3].x = -1.0F;
+ verts[3].y = 1.0F;
+
+ /* upload vertex data */
+ _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
+ verts, GL_DYNAMIC_DRAW_ARB);
/* texture is already locked, unlock now */
_mesa_unlock_texture(ctx, texObj);
@@ -3059,17 +3271,17 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
GLenum status;
srcImage = _mesa_select_tex_image(ctx, texObj, faceTarget, srcLevel);
- assert(srcImage->Border == 0); /* XXX we can fix this */
+ assert(srcImage->Border == 0);
- /* src size w/out border */
- srcWidth = srcImage->Width - 2 * border;
- srcHeight = srcImage->Height - 2 * border;
- srcDepth = srcImage->Depth - 2 * border;
+ /* src size */
+ srcWidth = srcImage->Width;
+ srcHeight = srcImage->Height;
+ srcDepth = srcImage->Depth;
- /* new dst size w/ border */
- dstWidth = MAX2(1, srcWidth / 2) + 2 * border;
- dstHeight = MAX2(1, srcHeight / 2) + 2 * border;
- dstDepth = MAX2(1, srcDepth / 2) + 2 * border;
+ /* new dst size */
+ dstWidth = MAX2(1, srcWidth / 2);
+ dstHeight = MAX2(1, srcHeight / 2);
+ dstDepth = MAX2(1, srcDepth / 2);
if (dstWidth == srcImage->Width &&
dstHeight == srcImage->Height &&
@@ -3424,7 +3636,8 @@ decompress_texture_image(struct gl_context *ctx,
}
/* No sRGB decode or encode.*/
- if (ctx->Extensions.EXT_framebuffer_sRGB) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_framebuffer_sRGB)
+ || _mesa_is_gles3(ctx)) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
}
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 86409dd06..4276ad981 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -257,17 +257,17 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
* "Forward-compatible contexts are defined only for OpenGL versions
* 3.0 and later."
*
- * Moreover, Mesa can't fulfill the requirements of a forward-looking
- * context. Return failure if a forward-looking context is requested.
+ * Forward-looking contexts are supported by silently converting the
+ * requested API to API_OPENGL_CORE.
*
* In Mesa, a debug context is the same as a regular context.
*/
if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0) {
- *error = __DRI_CTX_ERROR_BAD_FLAG;
- return NULL;
+ mesa_api = API_OPENGL_CORE;
}
- if ((flags & ~__DRI_CTX_FLAG_DEBUG) != 0) {
+ if ((flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE))
+ != 0) {
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
return NULL;
}
diff --git a/mesalib/src/mesa/main/.gitignore b/mesalib/src/mesa/main/.gitignore
index caed74f40..b26be227f 100644
--- a/mesalib/src/mesa/main/.gitignore
+++ b/mesalib/src/mesa/main/.gitignore
@@ -1,5 +1,4 @@
api_exec_es1.c
-api_exec_es2.c
dispatch.h
enums.c
get_es1.c
@@ -8,6 +7,4 @@ git_sha1.h
git_sha1.h.tmp
api_exec_es1_dispatch.h
api_exec_es1_remap_helper.h
-api_exec_es2_dispatch.h
-api_exec_es2_remap_helper.h
remap_helper.h
diff --git a/mesalib/src/mesa/main/APIspec.xml b/mesalib/src/mesa/main/APIspec.xml
index 3121226ca..a65c5c529 100644
--- a/mesalib/src/mesa/main/APIspec.xml
+++ b/mesalib/src/mesa/main/APIspec.xml
@@ -58,29 +58,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="pname">
- <value name="GL_FOG_MODE"/>
- <desc name="param">
- <value name="GL_EXP"/>
- <value name="GL_EXP2"/>
- <value name="GL_LINEAR"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_FOG_COLOR"/>
-
- <desc name="params" vector_size="4"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_FOG_DENSITY"/>
- <value name="GL_FOG_START"/>
- <value name="GL_FOG_END"/>
-
- <desc name="params" vector_size="1"/>
- </desc>
</template>
<template name="FrontFace">
@@ -96,19 +73,6 @@
<param name="target" type="GLenum"/>
<param name="mode" type="GLenum"/>
</proto>
-
- <desc name="target" category="GLES1.1">
- <value name="GL_FOG_HINT"/>
- <value name="GL_LINE_SMOOTH_HINT"/>
- <value name="GL_PERSPECTIVE_CORRECTION_HINT"/>
- <value name="GL_POINT_SMOOTH_HINT"/>
- </desc>
- <desc name="target" category="OES_standard_derivatives">
- <value name="GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES"/>
- </desc>
- <desc name="target">
- <value name="GL_GENERATE_MIPMAP_HINT"/>
- </desc>
</template>
<template name="Light">
@@ -130,20 +94,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="pname">
- <value name="GL_LIGHT_MODEL_AMBIENT"/>
-
- <desc name="params" vector_size="4"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_LIGHT_MODEL_TWO_SIDE"/>
- <desc name="param">
- <value name="GL_TRUE"/>
- <value name="GL_FALSE"/>
- </desc>
- </desc>
</template>
<template name="LineWidth">
@@ -162,26 +112,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="face">
- <value name="GL_FRONT_AND_BACK"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_AMBIENT"/>
- <value name="GL_DIFFUSE"/>
- <value name="GL_AMBIENT_AND_DIFFUSE"/>
- <value name="GL_SPECULAR"/>
- <value name="GL_EMISSION"/>
-
- <desc name="params" vector_size="4"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_SHININESS"/>
-
- <desc name="params" vector_size="1"/>
- </desc>
</template>
<template name="PointSize">
@@ -252,155 +182,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="target" category="OES_point_sprite">
- <value name="GL_POINT_SPRITE_OES"/>
-
- <desc name="pname">
- <value name="GL_COORD_REPLACE_OES"/>
- </desc>
- </desc>
-
- <desc name="pname" category="OES_point_sprite">
- <value name="GL_COORD_REPLACE_OES"/>
-
- <desc name="param">
- <value name="GL_TRUE"/>
- <value name="GL_FALSE"/>
- </desc>
- </desc>
-
- <desc name="target" category="EXT_texture_lod_bias">
- <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/>
-
- <desc name="pname">
- <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
- </desc>
- </desc>
-
- <desc name="pname" category="EXT_texture_lod_bias">
- <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
- <desc name="params" vector_size="1"/>
- </desc>
-
- <desc name="target">
- <value name="GL_TEXTURE_ENV"/>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_MODE"/>
- <value name="GL_COMBINE_RGB"/>
- <value name="GL_COMBINE_ALPHA"/>
- <value name="GL_RGB_SCALE"/>
- <value name="GL_ALPHA_SCALE"/>
- <value name="GL_SRC0_RGB"/>
- <value name="GL_SRC1_RGB"/>
- <value name="GL_SRC2_RGB"/>
- <value name="GL_SRC0_ALPHA"/>
- <value name="GL_SRC1_ALPHA"/>
- <value name="GL_SRC2_ALPHA"/>
- <value name="GL_OPERAND0_RGB"/>
- <value name="GL_OPERAND1_RGB"/>
- <value name="GL_OPERAND2_RGB"/>
- <value name="GL_OPERAND0_ALPHA"/>
- <value name="GL_OPERAND1_ALPHA"/>
- <value name="GL_OPERAND2_ALPHA"/>
- <value name="GL_TEXTURE_ENV_COLOR"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_MODE"/>
-
- <desc name="param">
- <value name="GL_REPLACE"/>
- <value name="GL_MODULATE"/>
- <value name="GL_DECAL"/>
- <value name="GL_BLEND"/>
- <value name="GL_ADD"/>
- <value name="GL_COMBINE"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_COMBINE_RGB"/>
-
- <desc name="param">
- <value name="GL_REPLACE"/>
- <value name="GL_MODULATE"/>
- <value name="GL_ADD"/>
- <value name="GL_ADD_SIGNED"/>
- <value name="GL_INTERPOLATE"/>
- <value name="GL_SUBTRACT"/>
- <value name="GL_DOT3_RGB"/>
- <value name="GL_DOT3_RGBA"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_COMBINE_ALPHA"/>
-
- <desc name="param">
- <value name="GL_REPLACE"/>
- <value name="GL_MODULATE"/>
- <value name="GL_ADD"/>
- <value name="GL_ADD_SIGNED"/>
- <value name="GL_INTERPOLATE"/>
- <value name="GL_SUBTRACT"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_RGB_SCALE"/>
- <value name="GL_ALPHA_SCALE"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_SRC0_RGB"/>
- <value name="GL_SRC1_RGB"/>
- <value name="GL_SRC2_RGB"/>
- <value name="GL_SRC0_ALPHA"/>
- <value name="GL_SRC1_ALPHA"/>
- <value name="GL_SRC2_ALPHA"/>
-
- <desc name="param">
- <value name="GL_TEXTURE"/>
- <value name="GL_CONSTANT"/>
- <value name="GL_PRIMARY_COLOR"/>
- <value name="GL_PREVIOUS"/>
-
- <range base="GL_TEXTURE" from="0" to="31" category="OES_texture_env_crossbar"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_OPERAND0_RGB"/>
- <value name="GL_OPERAND1_RGB"/>
- <value name="GL_OPERAND2_RGB"/>
-
- <desc name="param">
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_OPERAND0_ALPHA"/>
- <value name="GL_OPERAND1_ALPHA"/>
- <value name="GL_OPERAND2_ALPHA"/>
-
- <desc name="param">
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_COLOR"/>
-
- <desc name="params" vector_size="4"/>
- </desc>
</template>
<template name="TexGen">
@@ -412,19 +193,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="coord" category="OES_texture_cube_map">
- <value name="GL_TEXTURE_GEN_STR_OES"/>
- </desc>
-
- <desc name="pname" category="OES_texture_cube_map">
- <value name="GL_TEXTURE_GEN_MODE_OES"/>
-
- <desc name="param">
- <value name="GL_NORMAL_MAP_OES"/>
- <value name="GL_REFLECTION_MAP_OES"/>
- </desc>
- </desc>
</template>
<template name="Clear">
@@ -432,17 +200,6 @@
<return type="void"/>
<param name="mask" type="GLbitfield"/>
</proto>
-
- <desc name="mask" error="GL_INVALID_VALUE">
- <value name="0"/>
- <value name="(GL_COLOR_BUFFER_BIT)"/>
- <value name="(GL_DEPTH_BUFFER_BIT)"/>
- <value name="(GL_STENCIL_BUFFER_BIT)"/>
- <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)"/>
- <value name="(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
- <value name="(GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
- <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
- </desc>
</template>
<template name="ClearColor">
@@ -506,56 +263,6 @@
<return type="void"/>
<param name="cap" type="GLenum"/>
</proto>
-
- <desc name="cap" category="GLES1.1">
- <value name="GL_NORMALIZE"/>
- <value name="GL_RESCALE_NORMAL"/>
-
- <range base="GL_CLIP_PLANE" from="0" to="5"/>
- <value name="GL_CLIP_PLANE0+6"/>
- <value name="GL_CLIP_PLANE0+7"/>
-
- <value name="GL_FOG"/>
- <value name="GL_LIGHTING"/>
- <value name="GL_COLOR_MATERIAL"/>
-
- <range base="GL_LIGHT" from="0" to="7"/>
-
- <value name="GL_POINT_SMOOTH"/>
- <value name="GL_LINE_SMOOTH"/>
- <value name="GL_CULL_FACE"/>
- <value name="GL_POLYGON_OFFSET_FILL"/>
- <value name="GL_MULTISAMPLE"/>
- <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
- <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
- <value name="GL_SAMPLE_COVERAGE"/>
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_SCISSOR_TEST"/>
- <value name="GL_ALPHA_TEST"/>
- <value name="GL_STENCIL_TEST"/>
- <value name="GL_DEPTH_TEST"/>
- <value name="GL_BLEND"/>
- <value name="GL_DITHER"/>
- <value name="GL_COLOR_LOGIC_OP"/>
-
- <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
- <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
- <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
- </desc>
-
- <desc name="cap" category="GLES2.0">
- <value name="GL_CULL_FACE"/>
- <value name="GL_SCISSOR_TEST"/>
- <value name="GL_POLYGON_OFFSET_FILL"/>
- <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
- <value name="GL_SAMPLE_COVERAGE"/>
- <value name="GL_STENCIL_TEST"/>
- <value name="GL_DEPTH_TEST"/>
- <value name="GL_DITHER"/>
- <value name="GL_BLEND"/>
- </desc>
</template>
<!-- it is exactly the same as Disable -->
@@ -564,56 +271,6 @@
<return type="void"/>
<param name="cap" type="GLenum"/>
</proto>
-
- <desc name="cap" category="GLES1.1">
- <value name="GL_NORMALIZE"/>
- <value name="GL_RESCALE_NORMAL"/>
-
- <range base="GL_CLIP_PLANE" from="0" to="5"/>
- <value name="GL_CLIP_PLANE0+6"/>
- <value name="GL_CLIP_PLANE0+7"/>
-
- <value name="GL_FOG"/>
- <value name="GL_LIGHTING"/>
- <value name="GL_COLOR_MATERIAL"/>
-
- <range base="GL_LIGHT" from="0" to="7"/>
-
- <value name="GL_POINT_SMOOTH"/>
- <value name="GL_LINE_SMOOTH"/>
- <value name="GL_CULL_FACE"/>
- <value name="GL_POLYGON_OFFSET_FILL"/>
- <value name="GL_MULTISAMPLE"/>
- <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
- <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
- <value name="GL_SAMPLE_COVERAGE"/>
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_SCISSOR_TEST"/>
- <value name="GL_ALPHA_TEST"/>
- <value name="GL_STENCIL_TEST"/>
- <value name="GL_DEPTH_TEST"/>
- <value name="GL_BLEND"/>
- <value name="GL_DITHER"/>
- <value name="GL_COLOR_LOGIC_OP"/>
-
- <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
- <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
- <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
- </desc>
-
- <desc name="cap" category="GLES2.0">
- <value name="GL_CULL_FACE"/>
- <value name="GL_SCISSOR_TEST"/>
- <value name="GL_POLYGON_OFFSET_FILL"/>
- <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
- <value name="GL_SAMPLE_COVERAGE"/>
- <value name="GL_STENCIL_TEST"/>
- <value name="GL_DEPTH_TEST"/>
- <value name="GL_DITHER"/>
- <value name="GL_BLEND"/>
- </desc>
</template>
<template name="Finish">
@@ -642,43 +299,6 @@
<param name="sfactor" type="GLenum"/>
<param name="dfactor" type="GLenum"/>
</proto>
-
- <desc name="sfactor">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
- <value name="GL_SRC_ALPHA_SATURATE"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
-
- <desc name="dfactor">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
</template>
<template name="LogicOp">
@@ -739,33 +359,6 @@
<param name="pname" type="GLenum"/>
<param name="param" type="GLtype"/>
</proto>
-
- <desc name="pname">
- <value name="GL_PACK_ALIGNMENT"/>
- <desc name="param" error="GL_INVALID_VALUE">
- <value name="1"/>
- <value name="2"/>
- <value name="4"/>
- <value name="8"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_UNPACK_ALIGNMENT"/>
- <desc name="param" error="GL_INVALID_VALUE">
- <value name="1"/>
- <value name="2"/>
- <value name="4"/>
- <value name="8"/>
- </desc>
- </desc>
-
- <desc name="pname" category="EXT_unpack_subimage">
- <value name="GL_UNPACK_ROW_LENGTH"/>
- <value name="GL_UNPACK_SKIP_PIXELS"/>
- <value name="GL_UNPACK_SKIP_ROWS"/>
- </desc>
-
</template>
<template name="ReadPixels" direction="get">
@@ -779,59 +372,6 @@
<param name="type" type="GLenum"/>
<param name="pixels" type="GLvoid *"/>
</proto>
-
- <!-- Technically, only two combinations are actually allowed:
- GL_RGBA/GL_UNSIGNED_BYTE, and some implementation-specific
- internal preferred combination. I don't know what that is, so I'm
- allowing any valid combination for now; the underlying support
- should fail when necessary.-->
- <desc name="format">
- <value name="GL_ALPHA"/>
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGB"/>
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_5_6_5"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGBA"/>
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
- <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE"/>
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE_ALPHA"/>
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- </desc>
- </desc>
-
- <desc name="format" category="EXT_read_format_bgra">
- <value name="GL_BGRA_EXT"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT"/>
- <value name="GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT"/>
- </desc>
- </desc>
</template>
<template name="GetClipPlane" direction="get">
@@ -876,26 +416,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="face">
- <value name="GL_FRONT"/>
- <value name="GL_BACK"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_SHININESS"/>
- <desc name="params" vector_size="1"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_AMBIENT"/>
- <value name="GL_DIFFUSE"/>
- <value name="GL_AMBIENT_AND_DIFFUSE"/>
- <value name="GL_SPECULAR"/>
- <value name="GL_EMISSION"/>
-
- <desc name="params" vector_size="4"/>
- </desc>
</template>
<template name="GetString" direction="get">
@@ -903,14 +423,6 @@
<return type="const GLubyte *"/>
<param name="name" type="GLenum"/>
</proto>
-
- <desc name="name">
- <value name="GL_VENDOR"/>
- <value name="GL_RENDERER"/>
- <value name="GL_VERSION"/>
- <value name="GL_EXTENSIONS"/>
- <value name="GL_SHADING_LANGUAGE_VERSION" category="GLES2.0"/>
- </desc>
</template>
<template name="GetTexEnv" direction="get">
@@ -920,88 +432,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="target" category="OES_point_sprite">
- <value name="GL_POINT_SPRITE_OES"/>
- <desc name="pname">
- <value name="GL_COORD_REPLACE_OES"/>
- </desc>
- </desc>
-
- <desc name="pname" category="OES_point_sprite">
- <value name="GL_COORD_REPLACE_OES"/>
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
-
- <desc name="target" category="EXT_texture_lod_bias">
- <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/>
-
- <desc name="pname">
- <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
- </desc>
- </desc>
-
- <desc name="pname" category="EXT_texture_lod_bias">
- <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
- <desc name="params" vector_size="1"/>
- </desc>
-
- <desc name="target">
- <value name="GL_TEXTURE_ENV"/>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_COLOR"/>
- <value name="GL_RGB_SCALE"/>
- <value name="GL_ALPHA_SCALE"/>
- <value name="GL_TEXTURE_ENV_MODE"/>
- <value name="GL_COMBINE_RGB"/>
- <value name="GL_COMBINE_ALPHA"/>
- <value name="GL_SRC0_RGB"/>
- <value name="GL_SRC1_RGB"/>
- <value name="GL_SRC2_RGB"/>
- <value name="GL_SRC0_ALPHA"/>
- <value name="GL_SRC1_ALPHA"/>
- <value name="GL_SRC2_ALPHA"/>
- <value name="GL_OPERAND0_RGB"/>
- <value name="GL_OPERAND1_RGB"/>
- <value name="GL_OPERAND2_RGB"/>
- <value name="GL_OPERAND0_ALPHA"/>
- <value name="GL_OPERAND1_ALPHA"/>
- <value name="GL_OPERAND2_ALPHA"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_COLOR"/>
- <desc name="params" vector_size="4"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_RGB_SCALE"/>
- <value name="GL_ALPHA_SCALE"/>
-
- <desc name="params" vector_size="1"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_ENV_MODE"/>
- <value name="GL_COMBINE_RGB"/>
- <value name="GL_COMBINE_ALPHA"/>
- <value name="GL_SRC0_RGB"/>
- <value name="GL_SRC1_RGB"/>
- <value name="GL_SRC2_RGB"/>
- <value name="GL_SRC0_ALPHA"/>
- <value name="GL_SRC1_ALPHA"/>
- <value name="GL_SRC2_ALPHA"/>
- <value name="GL_OPERAND0_RGB"/>
- <value name="GL_OPERAND1_RGB"/>
- <value name="GL_OPERAND2_RGB"/>
- <value name="GL_OPERAND0_ALPHA"/>
- <value name="GL_OPERAND1_ALPHA"/>
- <value name="GL_OPERAND2_ALPHA"/>
-
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
</template>
<template name="GetTexGen" direction="get">
@@ -1011,14 +441,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="coord">
- <value name="GL_TEXTURE_GEN_STR_OES"/>
- </desc>
- <desc name="pname">
- <value name="GL_TEXTURE_GEN_MODE_OES"/>
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
</template>
<template name="GetTexParameter" direction="get">
@@ -1035,63 +457,6 @@
<return type="GLboolean"/>
<param name="cap" type="GLenum"/>
</proto>
-
- <desc name="cap" category="GLES1.1">
- <value name="GL_NORMALIZE"/>
- <value name="GL_RESCALE_NORMAL"/>
-
- <range base="GL_CLIP_PLANE" from="0" to="5"/>
- <value name="GL_CLIP_PLANE0+6"/>
- <value name="GL_CLIP_PLANE0+7"/>
-
- <value name="GL_FOG"/>
- <value name="GL_LIGHTING"/>
- <value name="GL_COLOR_MATERIAL"/>
-
- <range base="GL_LIGHT" from="0" to="7"/>
-
- <value name="GL_POINT_SMOOTH"/>
- <value name="GL_LINE_SMOOTH"/>
- <value name="GL_CULL_FACE"/>
- <value name="GL_POLYGON_OFFSET_FILL"/>
- <value name="GL_MULTISAMPLE"/>
- <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
- <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
- <value name="GL_SAMPLE_COVERAGE"/>
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_SCISSOR_TEST"/>
- <value name="GL_ALPHA_TEST"/>
- <value name="GL_STENCIL_TEST"/>
- <value name="GL_DEPTH_TEST"/>
- <value name="GL_BLEND"/>
- <value name="GL_DITHER"/>
- <value name="GL_COLOR_LOGIC_OP"/>
-
- <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
- <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
-
- <value name="GL_VERTEX_ARRAY"/>
- <value name="GL_NORMAL_ARRAY"/>
- <value name="GL_COLOR_ARRAY"/>
- <value name="GL_TEXTURE_COORD_ARRAY"/>
- <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
- <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
- <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
- <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
- </desc>
-
- <desc name="cap" category="GLES2.0">
- <value name="GL_CULL_FACE"/>
- <value name="GL_SCISSOR_TEST"/>
- <value name="GL_POLYGON_OFFSET_FILL"/>
- <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
- <value name="GL_SAMPLE_COVERAGE"/>
- <value name="GL_STENCIL_TEST"/>
- <value name="GL_DEPTH_TEST"/>
- <value name="GL_DITHER"/>
- <value name="GL_BLEND"/>
- </desc>
</template>
<template name="DepthRange">
@@ -1132,13 +497,6 @@
<return type="void"/>
<param name="mode" type="GLenum"/>
</proto>
-
- <desc name="mode">
- <value name="GL_MODELVIEW"/>
- <value name="GL_PROJECTION"/>
- <value name="GL_TEXTURE"/>
- <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
- </desc>
</template>
<template name="MultMatrix">
@@ -1225,16 +583,6 @@
<return type="void"/>
<param name="array" type="GLenum"/>
</proto>
-
- <desc name="array">
- <value name="GL_VERTEX_ARRAY"/>
- <value name="GL_NORMAL_ARRAY"/>
- <value name="GL_COLOR_ARRAY"/>
- <value name="GL_TEXTURE_COORD_ARRAY"/>
- <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
- <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
- <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
- </desc>
</template>
<template name="DrawArrays">
@@ -1244,16 +592,6 @@
<param name="first" type="GLint"/>
<param name="count" type="GLsizei"/>
</proto>
-
- <desc name="mode">
- <value name="GL_POINTS"/>
- <value name="GL_LINES"/>
- <value name="GL_LINE_LOOP"/>
- <value name="GL_LINE_STRIP"/>
- <value name="GL_TRIANGLES"/>
- <value name="GL_TRIANGLE_STRIP"/>
- <value name="GL_TRIANGLE_FAN"/>
- </desc>
</template>
<template name="DrawElements">
@@ -1264,16 +602,6 @@
<param name="type" type="GLenum"/>
<param name="indices" type="const GLvoid *"/>
</proto>
-
- <desc name="mode">
- <value name="GL_POINTS"/>
- <value name="GL_LINES"/>
- <value name="GL_LINE_LOOP"/>
- <value name="GL_LINE_STRIP"/>
- <value name="GL_TRIANGLES"/>
- <value name="GL_TRIANGLE_STRIP"/>
- <value name="GL_TRIANGLE_FAN"/>
- </desc>
</template>
<template name="EnableClientState">
@@ -1281,16 +609,6 @@
<return type="void"/>
<param name="array" type="GLenum"/>
</proto>
-
- <desc name="array">
- <value name="GL_VERTEX_ARRAY"/>
- <value name="GL_NORMAL_ARRAY"/>
- <value name="GL_COLOR_ARRAY"/>
- <value name="GL_TEXTURE_COORD_ARRAY"/>
- <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
- <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
- <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
- </desc>
</template>
<template name="GetPointer" direction="get">
@@ -1299,16 +617,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLvoid **" size="dynamic"/>
</proto>
-
- <desc name="pname">
- <value name="GL_VERTEX_ARRAY_POINTER"/>
- <value name="GL_NORMAL_ARRAY_POINTER"/>
- <value name="GL_COLOR_ARRAY_POINTER"/>
- <value name="GL_TEXTURE_COORD_ARRAY_POINTER"/>
- <value name="GL_MATRIX_INDEX_ARRAY_POINTER_OES" category="OES_matrix_palette"/>
- <value name="GL_WEIGHT_ARRAY_POINTER_OES" category="OES_matrix_palette"/>
- <value name="GL_POINT_SIZE_ARRAY_POINTER_OES" category="OES_point_size_array"/>
- </desc>
</template>
<template name="Normal">
@@ -1611,80 +919,6 @@
<param name="srcAlpha" type="GLenum"/>
<param name="dstAlpha" type="GLenum"/>
</proto>
-
- <desc name="srcRGB">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
- <value name="GL_SRC_ALPHA_SATURATE"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
-
- <desc name="dstRGB">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
-
- <desc name="srcAlpha">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
- <value name="GL_SRC_ALPHA_SATURATE"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
-
- <desc name="dstAlpha">
- <value name="GL_ZERO"/>
- <value name="GL_ONE"/>
- <value name="GL_SRC_COLOR"/>
- <value name="GL_ONE_MINUS_SRC_COLOR"/>
- <value name="GL_SRC_ALPHA"/>
- <value name="GL_ONE_MINUS_SRC_ALPHA"/>
- <value name="GL_DST_ALPHA"/>
- <value name="GL_ONE_MINUS_DST_ALPHA"/>
- <value name="GL_DST_COLOR"/>
- <value name="GL_ONE_MINUS_DST_COLOR"/>
-
- <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
- <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
- <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
- </desc>
</template>
<template name="PointParameter">
@@ -1695,19 +929,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="pname">
- <value name="GL_POINT_SIZE_MIN"/>
- <value name="GL_POINT_SIZE_MAX"/>
- <value name="GL_POINT_FADE_THRESHOLD_SIZE"/>
-
- <desc name="params" vector_size="1"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_POINT_DISTANCE_ATTENUATION"/>
- <desc name="params" vector_size="3"/>
- </desc>
</template>
<template name="VertexAttrib">
@@ -1772,22 +993,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="pname">
- <value name="GL_VERTEX_ATTRIB_ARRAY_ENABLED"/>
- <value name="GL_VERTEX_ATTRIB_ARRAY_SIZE"/>
- <value name="GL_VERTEX_ATTRIB_ARRAY_STRIDE"/>
- <value name="GL_VERTEX_ATTRIB_ARRAY_TYPE"/>
- <value name="GL_VERTEX_ATTRIB_ARRAY_NORMALIZED"/>
- <value name="GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"/>
-
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_CURRENT_VERTEX_ATTRIB"/>
- <desc name="params" vector_size="16?" convert="false"/>
- </desc>
</template>
<template name="GetVertexAttribPointer" direction="get">
@@ -2061,13 +1266,6 @@
<return type="void"/>
<param name="target" type="GLenum"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
- </desc>
</template>
<template name="BindFramebuffer">
@@ -2126,28 +1324,6 @@
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
</proto>
-
- <desc name="internalFormat">
- <value name="GL_DEPTH_COMPONENT16_OES" category="OES_framebuffer_object"/>
- <value name="GL_RGBA4_OES" category="OES_framebuffer_object"/>
- <value name="GL_RGB5_A1_OES" category="OES_framebuffer_object"/>
- <value name="GL_RGB565_OES" category="OES_framebuffer_object"/>
- <value name="GL_STENCIL_INDEX8_OES" category="OES_stencil8"/>
-
- <value name="GL_DEPTH_COMPONENT16" category="GLES2.0"/>
- <value name="GL_RGBA4" category="GLES2.0"/>
- <value name="GL_RGB5_A1" category="GLES2.0"/>
- <value name="GL_RGB565" category="GLES2.0"/>
- <value name="GL_STENCIL_INDEX8" category="GLES2.0"/>
-
- <value name="GL_DEPTH_COMPONENT24_OES" category="OES_depth24"/>
- <value name="GL_DEPTH_COMPONENT32_OES" category="OES_depth32"/>
- <value name="GL_RGB8_OES" category="OES_rgb8_rgba8"/>
- <value name="GL_RGBA8_OES" category="OES_rgb8_rgba8"/>
- <value name="GL_STENCIL_INDEX1_OES" category="OES_stencil1"/>
- <value name="GL_STENCIL_INDEX4_OES" category="OES_stencil4"/>
- <value name="GL_DEPTH24_STENCIL8_OES" category="OES_packed_depth_stencil"/>
- </desc>
</template>
<template name="FramebufferRenderbuffer">
@@ -2169,22 +1345,6 @@
<param name="texture" type="GLuint"/>
<param name="level" type="GLint"/>
</proto>
-
- <desc name="textarget" error="GL_INVALID_OPERATION">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
- </desc>
<!-- According to the base specification, "level" must be 0. But
extension GL_OES_fbo_render_mipmap lifts that restriction,
so no restriction is placed here. -->
@@ -2217,21 +1377,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="pname">
- <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES" category="OES_framebuffer_object"/>
- <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES" category="OES_framebuffer_object"/>
- <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES" category="OES_framebuffer_object"/>
- <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES" category="OES_framebuffer_object"/>
-
- <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE" category="GLES2.0"/>
- <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME" category="GLES2.0"/>
- <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL" category="GLES2.0"/>
- <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE" category="GLES2.0"/>
- <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" category="OES_texture_3D"/>
-
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
</template>
<template name="GetRenderbufferParameter" direction="get">
@@ -2241,34 +1386,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="pname" category="OES_framebuffer_object">
- <value name="GL_RENDERBUFFER_WIDTH_OES"/>
- <value name="GL_RENDERBUFFER_HEIGHT_OES"/>
- <value name="GL_RENDERBUFFER_INTERNAL_FORMAT_OES"/>
- <value name="GL_RENDERBUFFER_RED_SIZE_OES"/>
- <value name="GL_RENDERBUFFER_GREEN_SIZE_OES"/>
- <value name="GL_RENDERBUFFER_BLUE_SIZE_OES"/>
- <value name="GL_RENDERBUFFER_ALPHA_SIZE_OES"/>
- <value name="GL_RENDERBUFFER_DEPTH_SIZE_OES"/>
- <value name="GL_RENDERBUFFER_STENCIL_SIZE_OES"/>
-
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
-
- <desc name="pname" category="GLES2.0">
- <value name="GL_RENDERBUFFER_WIDTH"/>
- <value name="GL_RENDERBUFFER_HEIGHT"/>
- <value name="GL_RENDERBUFFER_INTERNAL_FORMAT"/>
- <value name="GL_RENDERBUFFER_RED_SIZE"/>
- <value name="GL_RENDERBUFFER_GREEN_SIZE"/>
- <value name="GL_RENDERBUFFER_BLUE_SIZE"/>
- <value name="GL_RENDERBUFFER_ALPHA_SIZE"/>
- <value name="GL_RENDERBUFFER_DEPTH_SIZE"/>
- <value name="GL_RENDERBUFFER_STENCIL_SIZE"/>
-
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
</template>
<template name="IsRenderbuffer" direction="get">
@@ -2389,16 +1506,6 @@
<param name="count" type="const GLsizei *"/>
<param name="primcount" type="GLsizei"/>
</proto>
-
- <desc name="mode">
- <value name="GL_POINTS"/>
- <value name="GL_LINES"/>
- <value name="GL_LINE_LOOP"/>
- <value name="GL_LINE_STRIP"/>
- <value name="GL_TRIANGLES"/>
- <value name="GL_TRIANGLE_STRIP"/>
- <value name="GL_TRIANGLE_FAN"/>
- </desc>
</template>
<template name="MultiDrawElements">
@@ -2410,16 +1517,6 @@
<param name="indices" type="const GLvoid **"/>
<param name="primcount" type="GLsizei"/>
</proto>
-
- <desc name="mode">
- <value name="GL_POINTS"/>
- <value name="GL_LINES"/>
- <value name="GL_LINE_LOOP"/>
- <value name="GL_LINE_STRIP"/>
- <value name="GL_TRIANGLES"/>
- <value name="GL_TRIANGLE_STRIP"/>
- <value name="GL_TRIANGLE_FAN"/>
- </desc>
</template>
<template name="EGLImageTargetTexture2D">
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index 6b1499f4f..c44818945 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -106,7 +106,7 @@
#include "main/dispatch.h"
-#if FEATURE_GL
+#if FEATURE_GL || FEATURE_ES2
/**
@@ -133,7 +133,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
#endif
/* load the dispatch slots we understand */
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_AlphaFunc(exec, _mesa_AlphaFunc);
}
@@ -145,14 +145,16 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_CullFace(exec, _mesa_CullFace);
SET_Disable(exec, _mesa_Disable);
#if FEATURE_draw_read_buffer
- SET_DrawBuffer(exec, _mesa_DrawBuffer);
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGL_CORE)
+ SET_DrawBuffer(exec, _mesa_DrawBuffer);
+
SET_ReadBuffer(exec, _mesa_ReadBuffer);
#endif
SET_Enable(exec, _mesa_Enable);
SET_Finish(exec, _mesa_Finish);
SET_Flush(exec, _mesa_Flush);
SET_FrontFace(exec, _mesa_FrontFace);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_Frustum(exec, _mesa_Frustum);
}
SET_GetError(exec, _mesa_GetError);
@@ -162,37 +164,39 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_LineStipple(exec, _mesa_LineStipple);
}
SET_LineWidth(exec, _mesa_LineWidth);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_LoadIdentity(exec, _mesa_LoadIdentity);
SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
}
- SET_LogicOp(exec, _mesa_LogicOp);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGLES2) {
+ SET_LogicOp(exec, _mesa_LogicOp);
+ }
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_MatrixMode(exec, _mesa_MatrixMode);
SET_MultMatrixf(exec, _mesa_MultMatrixf);
SET_Ortho(exec, _mesa_Ortho);
}
SET_PixelStorei(exec, _mesa_PixelStorei);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_PopMatrix(exec, _mesa_PopMatrix);
SET_PushMatrix(exec, _mesa_PushMatrix);
SET_Rotatef(exec, _mesa_Rotatef);
SET_Scalef(exec, _mesa_Scalef);
}
SET_Scissor(exec, _mesa_Scissor);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_ShadeModel(exec, _mesa_ShadeModel);
}
SET_StencilFunc(exec, _mesa_StencilFunc);
SET_StencilMask(exec, _mesa_StencilMask);
SET_StencilOp(exec, _mesa_StencilOp);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_TexEnvfv(exec, _mesa_TexEnvfv);
SET_TexEnvi(exec, _mesa_TexEnvi);
}
SET_TexImage2D(exec, _mesa_TexImage2D);
SET_TexParameteri(exec, _mesa_TexParameteri);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_Translatef(exec, _mesa_Translatef);
}
SET_Viewport(exec, _mesa_Viewport);
@@ -212,7 +216,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_DepthMask(exec, _mesa_DepthMask);
SET_DepthRange(exec, _mesa_DepthRange);
- _mesa_init_drawpix_dispatch(exec);
+ if (ctx->API != API_OPENGLES2 && ctx->API != API_OPENGL_CORE) {
+ _mesa_init_drawpix_dispatch(exec);
+ }
if (ctx->API == API_OPENGL) {
_mesa_init_feedback_dispatch(exec);
}
@@ -228,7 +234,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetBooleanv(exec, _mesa_GetBooleanv);
SET_GetDoublev(exec, _mesa_GetDoublev);
SET_GetIntegerv(exec, _mesa_GetIntegerv);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_GetLightfv(exec, _mesa_GetLightfv);
SET_GetLightiv(exec, _mesa_GetLightiv);
SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
@@ -237,17 +243,21 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
}
- SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
- SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
+ if (ctx->API != API_OPENGLES2) {
+ SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
+ SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
+ }
SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
- SET_GetTexImage(exec, _mesa_GetTexImage);
+ if (ctx->API != API_OPENGLES2) {
+ SET_GetTexImage(exec, _mesa_GetTexImage);
+ }
SET_Hint(exec, _mesa_Hint);
if (ctx->API == API_OPENGL) {
SET_IndexMask(exec, _mesa_IndexMask);
}
SET_IsEnabled(exec, _mesa_IsEnabled);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_LightModelf(exec, _mesa_LightModelf);
SET_LightModelfv(exec, _mesa_LightModelfv);
SET_LightModeli(exec, _mesa_LightModeli);
@@ -265,19 +275,25 @@ _mesa_create_exec_table(struct gl_context *ctx)
_mesa_init_pixel_dispatch(exec);
}
- SET_PixelStoref(exec, _mesa_PixelStoref);
+ if (ctx->API != API_OPENGLES2) {
+ SET_PixelStoref(exec, _mesa_PixelStoref);
+ }
+
SET_PointSize(exec, _mesa_PointSize);
- SET_PolygonMode(exec, _mesa_PolygonMode);
+
+ if (ctx->API != API_OPENGLES2) {
+ SET_PolygonMode(exec, _mesa_PolygonMode);
+ }
+
SET_PolygonOffset(exec, _mesa_PolygonOffset);
if (ctx->API == API_OPENGL) {
SET_PolygonStipple(exec, _mesa_PolygonStipple);
-
_mesa_init_attrib_dispatch(exec);
_mesa_init_rastpos_dispatch(exec);
}
SET_ReadPixels(exec, _mesa_ReadPixels);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_Rotated(exec, _mesa_Rotated);
SET_Scaled(exec, _mesa_Scaled);
SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
@@ -285,11 +301,13 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_TexEnviv(exec, _mesa_TexEnviv);
}
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
_mesa_init_texgen_dispatch(exec);
}
- SET_TexImage1D(exec, _mesa_TexImage1D);
+ if (ctx->API != API_OPENGLES2) {
+ SET_TexImage1D(exec, _mesa_TexImage1D);
+ }
SET_TexParameterf(exec, _mesa_TexParameterf);
SET_TexParameterfv(exec, _mesa_TexParameterfv);
SET_TexParameteriv(exec, _mesa_TexParameteriv);
@@ -306,11 +324,17 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
SET_ColorPointer(exec, _mesa_ColorPointer);
}
- SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
+ if (ctx->API != API_OPENGLES2) {
+ SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
+ SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
+ SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
+ }
+
SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
- SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
- if (ctx->API != API_OPENGL_CORE) {
+ SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
+
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_DisableClientState(exec, _mesa_DisableClientState);
SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
SET_EnableClientState(exec, _mesa_EnableClientState);
@@ -319,13 +343,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
}
SET_IsTexture(exec, _mesa_IsTexture);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_NormalPointer(exec, _mesa_NormalPointer);
SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
}
- SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
- SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
if (ctx->API != API_OPENGL_CORE) {
SET_VertexPointer(exec, _mesa_VertexPointer);
}
@@ -392,7 +414,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 14. SGI_color_table */
#if 0
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_ColorTableSGI(exec, _mesa_ColorTable);
SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
SET_GetColorTableSGI(exec, _mesa_GetColorTable);
@@ -456,8 +478,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 200. GL_IBM_multimode_draw_arrays */
#if _HAVE_FULL_GL
- SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
- SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
+ if (ctx->API != API_OPENGLES2) {
+ SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
+ SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
+ }
#endif
/* 233. GL_NV_vertex_program */
@@ -477,7 +501,6 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
- SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
SET_IsProgramNV(exec, _mesa_IsProgramARB);
SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
@@ -491,13 +514,14 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* glVertexAttrib*NV functions handled in api_loopback.c */
}
#endif
+ SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
/* 273. GL_APPLE_vertex_array_object */
if (ctx->API == API_OPENGL) {
SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
}
- /* Reused by ARB_vertex_array_object */
+ /* Reused by ARB_vertex_array_object / OES_vertex_array_object */
SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
@@ -533,22 +557,32 @@ _mesa_create_exec_table(struct gl_context *ctx)
#endif
/* 285. GL_NV_primitive_restart */
- SET_PrimitiveRestartIndexNV(exec, _mesa_PrimitiveRestartIndex);
+ if (ctx->API != API_OPENGLES2) {
+ SET_PrimitiveRestartIndexNV(exec, _mesa_PrimitiveRestartIndex);
+ }
/* ???. GL_EXT_depth_bounds_test */
- SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
+ if (ctx->API != API_OPENGLES2) {
+ SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
+ }
/* 352. GL_EXT_transform_feedback */
/* ARB 93. GL_ARB_transform_feedback2 */
- _mesa_init_transform_feedback_dispatch(exec);
+ if (ctx->API != API_OPENGLES2) {
+ _mesa_init_transform_feedback_dispatch(exec);
+ }
/* 364. GL_EXT_provoking_vertex */
- SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT);
+ if (ctx->API != API_OPENGLES2) {
+ SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT);
+ }
/* ARB 1. GL_ARB_multitexture */
#if _HAVE_FULL_GL
SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB);
- SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB);
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
+ SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB);
+ }
#endif
/* ARB 3. GL_ARB_transpose_matrix */
@@ -568,16 +602,21 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* ARB 12. GL_ARB_texture_compression */
#if _HAVE_FULL_GL
+ if (ctx->API != API_OPENGLES2) {
+ SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
+ SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
+ SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
+ }
+
SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB);
- SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
- SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
- SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
/* ARB 104. GL_ARB_robustness */
- SET_GetnCompressedTexImageARB(exec, _mesa_GetnCompressedTexImageARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_GetnCompressedTexImageARB(exec, _mesa_GetnCompressedTexImageARB);
+ }
#endif
/* ARB 14. GL_ARB_point_parameters */
@@ -625,12 +664,15 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);
SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);
SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);
- SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
- /* glBindProgramARB aliases glBindProgramNV */
- /* glDeleteProgramsARB aliases glDeleteProgramsNV */
- /* glGenProgramsARB aliases glGenProgramsNV */
- /* glIsProgramARB aliases glIsProgramNV */
- SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
+ /* glBindProgramARB aliases glBindProgramNV */
+ /* glDeleteProgramsARB aliases glDeleteProgramsNV */
+ /* glGenProgramsARB aliases glGenProgramsNV */
+ /* glIsProgramARB aliases glIsProgramNV */
+ SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);
+ }
+
SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
/* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
@@ -656,7 +698,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
_mesa_init_bufferobj_dispatch(ctx, exec);
/* ARB 29. GL_ARB_occlusion_query */
- _mesa_init_queryobj_dispatch(exec);
+ if (ctx->API != API_OPENGLES2) {
+ _mesa_init_queryobj_dispatch(exec);
+ }
/* ARB 37. GL_ARB_draw_buffers */
#if FEATURE_draw_read_buffer
@@ -664,16 +708,22 @@ _mesa_create_exec_table(struct gl_context *ctx)
#endif
/* ARB 66. GL_ARB_sync */
- _mesa_init_sync_dispatch(exec);
+ if (ctx->API != API_OPENGLES2) {
+ _mesa_init_sync_dispatch(exec);
+ }
/* ARB 104. GL_ARB_debug_output */
- _mesa_init_errors_dispatch(exec);
+ if (ctx->API != API_OPENGLES2) {
+ _mesa_init_errors_dispatch(exec);
+ }
/* ARB 105. GL_ARB_robustness */
- SET_GetGraphicsResetStatusARB(exec, _mesa_GetGraphicsResetStatusARB);
- SET_GetnPolygonStippleARB(exec, _mesa_GetnPolygonStippleARB);
- SET_GetnTexImageARB(exec, _mesa_GetnTexImageARB);
- SET_ReadnPixelsARB(exec, _mesa_ReadnPixelsARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_GetGraphicsResetStatusARB(exec, _mesa_GetGraphicsResetStatusARB);
+ SET_GetnPolygonStippleARB(exec, _mesa_GetnPolygonStippleARB);
+ SET_GetnTexImageARB(exec, _mesa_GetnTexImageARB);
+ SET_ReadnPixelsARB(exec, _mesa_ReadnPixelsARB);
+ }
/* GL_ATI_fragment_shader */
if (ctx->API == API_OPENGL) {
@@ -700,7 +750,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT);
SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT);
SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT);
- SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
+ if (ctx->API != API_OPENGLES2) {
+ SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
+ }
SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT);
SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);
SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT);
@@ -709,7 +761,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
#endif
#if FEATURE_EXT_framebuffer_blit
- SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
+ if (ctx->API != API_OPENGLES2) {
+ SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
+ }
#endif
/* GL_EXT_gpu_program_parameters */
@@ -722,7 +776,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* GL_MESA_texture_array / GL_EXT_texture_array */
#if FEATURE_EXT_framebuffer_object
- SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
+ if (ctx->API != API_OPENGLES2) {
+ SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
+ }
#endif
/* GL_ATI_separate_stencil */
@@ -734,32 +790,42 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* The ARB_fbo functions are the union of
* GL_EXT_fbo, GL_EXT_framebuffer_blit, GL_EXT_texture_array
*/
- SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample);
+ if (ctx->API != API_OPENGLES2) {
+ SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample);
+ }
#endif
#if FEATURE_ARB_map_buffer_range
- SET_MapBufferRange(exec, _mesa_MapBufferRange);
- SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
+ if (ctx->API != API_OPENGLES2) {
+ SET_MapBufferRange(exec, _mesa_MapBufferRange);
+ SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
+ }
#endif
/* GL_ARB_copy_buffer */
- SET_CopyBufferSubData(exec, _mesa_CopyBufferSubData);
+ if (ctx->API != API_OPENGLES2) {
+ SET_CopyBufferSubData(exec, _mesa_CopyBufferSubData);
+ }
- /* GL_ARB_vertex_array_object */
+ /* GL_ARB_vertex_array_object / GL_OES_vertex_array_object */
SET_BindVertexArray(exec, _mesa_BindVertexArray);
SET_GenVertexArrays(exec, _mesa_GenVertexArrays);
/* GL_EXT_draw_buffers2 */
- SET_ColorMaskIndexedEXT(exec, _mesa_ColorMaskIndexed);
- SET_GetBooleanIndexedvEXT(exec, _mesa_GetBooleanIndexedv);
- SET_GetIntegerIndexedvEXT(exec, _mesa_GetIntegerIndexedv);
- SET_EnableIndexedEXT(exec, _mesa_EnableIndexed);
- SET_DisableIndexedEXT(exec, _mesa_DisableIndexed);
- SET_IsEnabledIndexedEXT(exec, _mesa_IsEnabledIndexed);
+ if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+ SET_ColorMaskIndexedEXT(exec, _mesa_ColorMaskIndexed);
+ SET_GetBooleanIndexedvEXT(exec, _mesa_GetBooleanIndexedv);
+ SET_GetIntegerIndexedvEXT(exec, _mesa_GetIntegerIndexedv);
+ SET_EnableIndexedEXT(exec, _mesa_EnableIndexed);
+ SET_DisableIndexedEXT(exec, _mesa_DisableIndexed);
+ SET_IsEnabledIndexedEXT(exec, _mesa_IsEnabledIndexed);
+ }
/* GL_NV_conditional_render */
- SET_BeginConditionalRenderNV(exec, _mesa_BeginConditionalRender);
- SET_EndConditionalRenderNV(exec, _mesa_EndConditionalRender);
+ if (ctx->API != API_OPENGLES2) {
+ SET_BeginConditionalRenderNV(exec, _mesa_BeginConditionalRender);
+ SET_EndConditionalRenderNV(exec, _mesa_EndConditionalRender);
+ }
#if FEATURE_OES_EGL_image
SET_EGLImageTargetTexture2DOES(exec, _mesa_EGLImageTargetTexture2DOES);
@@ -767,64 +833,90 @@ _mesa_create_exec_table(struct gl_context *ctx)
#endif
#if FEATURE_APPLE_object_purgeable
- SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
- SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
- SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
+ if (ctx->API != API_OPENGLES2) {
+ SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
+ SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
+ SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
+ }
#endif
#if FEATURE_ARB_geometry_shader4
- SET_FramebufferTextureARB(exec, _mesa_FramebufferTextureARB);
- SET_FramebufferTextureFaceARB(exec, _mesa_FramebufferTextureFaceARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_FramebufferTextureARB(exec, _mesa_FramebufferTextureARB);
+ SET_FramebufferTextureFaceARB(exec, _mesa_FramebufferTextureFaceARB);
+ }
#endif
- SET_ClampColorARB(exec, _mesa_ClampColorARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_ClampColorARB(exec, _mesa_ClampColorARB);
+ }
/* GL_EXT_texture_integer */
- SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
- SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
- SET_GetTexParameterIivEXT(exec, _mesa_GetTexParameterIiv);
- SET_GetTexParameterIuivEXT(exec, _mesa_GetTexParameterIuiv);
- SET_TexParameterIivEXT(exec, _mesa_TexParameterIiv);
- SET_TexParameterIuivEXT(exec, _mesa_TexParameterIuiv);
+ if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+ SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
+ SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
+ }
+ if (ctx->API != API_OPENGLES2) {
+ SET_GetTexParameterIivEXT(exec, _mesa_GetTexParameterIiv);
+ SET_GetTexParameterIuivEXT(exec, _mesa_GetTexParameterIuiv);
+ SET_TexParameterIivEXT(exec, _mesa_TexParameterIiv);
+ SET_TexParameterIuivEXT(exec, _mesa_TexParameterIuiv);
+ }
/* GL_EXT_gpu_shader4 / OpenGL 3.0 */
- SET_GetVertexAttribIivEXT(exec, _mesa_GetVertexAttribIiv);
- SET_GetVertexAttribIuivEXT(exec, _mesa_GetVertexAttribIuiv);
- SET_VertexAttribIPointerEXT(exec, _mesa_VertexAttribIPointer);
+ if (ctx->API != API_OPENGLES2) {
+ SET_GetVertexAttribIivEXT(exec, _mesa_GetVertexAttribIiv);
+ SET_GetVertexAttribIuivEXT(exec, _mesa_GetVertexAttribIuiv);
+ SET_VertexAttribIPointerEXT(exec, _mesa_VertexAttribIPointer);
+ }
/* GL 3.0 (functions not covered by other extensions) */
- SET_ClearBufferiv(exec, _mesa_ClearBufferiv);
- SET_ClearBufferuiv(exec, _mesa_ClearBufferuiv);
- SET_ClearBufferfv(exec, _mesa_ClearBufferfv);
- SET_ClearBufferfi(exec, _mesa_ClearBufferfi);
- SET_GetStringi(exec, _mesa_GetStringi);
- SET_ClampColor(exec, _mesa_ClampColorARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_ClearBufferiv(exec, _mesa_ClearBufferiv);
+ SET_ClearBufferuiv(exec, _mesa_ClearBufferuiv);
+ SET_ClearBufferfv(exec, _mesa_ClearBufferfv);
+ SET_ClearBufferfi(exec, _mesa_ClearBufferfi);
+ SET_GetStringi(exec, _mesa_GetStringi);
+ SET_ClampColor(exec, _mesa_ClampColorARB);
+ }
/* GL_ARB_instanced_arrays */
- SET_VertexAttribDivisorARB(exec, _mesa_VertexAttribDivisor);
+ if (ctx->API != API_OPENGLES2) {
+ SET_VertexAttribDivisorARB(exec, _mesa_VertexAttribDivisor);
+ }
/* GL_ARB_draw_buffer_blend */
- SET_BlendFunciARB(exec, _mesa_BlendFunci);
- SET_BlendFuncSeparateiARB(exec, _mesa_BlendFuncSeparatei);
- SET_BlendEquationiARB(exec, _mesa_BlendEquationi);
- SET_BlendEquationSeparateiARB(exec, _mesa_BlendEquationSeparatei);
+ if (ctx->API != API_OPENGLES2) {
+ SET_BlendFunciARB(exec, _mesa_BlendFunci);
+ SET_BlendFuncSeparateiARB(exec, _mesa_BlendFuncSeparatei);
+ SET_BlendEquationiARB(exec, _mesa_BlendEquationi);
+ SET_BlendEquationSeparateiARB(exec, _mesa_BlendEquationSeparatei);
+ }
/* GL_NV_texture_barrier */
- SET_TextureBarrierNV(exec, _mesa_TextureBarrierNV);
+ if (ctx->API != API_OPENGLES2) {
+ SET_TextureBarrierNV(exec, _mesa_TextureBarrierNV);
+ }
/* GL_ARB_texture_buffer_object */
- SET_TexBufferARB(exec, _mesa_TexBuffer);
+ if (ctx->API != API_OPENGLES2) {
+ SET_TexBufferARB(exec, _mesa_TexBuffer);
+ }
/* GL_ARB_texture_storage */
- SET_TexStorage1D(exec, _mesa_TexStorage1D);
+ if (ctx->API != API_OPENGLES2) {
+ SET_TexStorage1D(exec, _mesa_TexStorage1D);
+ SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT);
+ }
SET_TexStorage2D(exec, _mesa_TexStorage2D);
SET_TexStorage3D(exec, _mesa_TexStorage3D);
- SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT);
SET_TextureStorage2DEXT(exec, _mesa_TextureStorage2DEXT);
SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT);
#if FEATURE_ARB_sampler_objects
- _mesa_init_sampler_object_dispatch(exec);
+ if (ctx->API != API_OPENGLES2) {
+ _mesa_init_sampler_object_dispatch(exec);
+ }
#endif
if (_mesa_is_desktop_gl(ctx)) {
@@ -840,4 +932,4 @@ _mesa_create_exec_table(struct gl_context *ctx)
return exec;
}
-#endif /* FEATURE_GL */
+#endif /* FEATURE_GL || FEATURE_ES2 */
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index b15dfba73..d0d2ca4d4 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdbool.h>
#include "glheader.h"
#include "api_validate.h"
#include "bufferobj.h"
@@ -209,12 +210,36 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
GLboolean
_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
{
- if (ctx->Extensions.ARB_geometry_shader4 &&
- mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
- return GL_FALSE;
+ bool valid_enum;
+
+ switch (mode) {
+ case GL_POINTS:
+ case GL_LINES:
+ case GL_LINE_LOOP:
+ case GL_LINE_STRIP:
+ case GL_TRIANGLES:
+ case GL_TRIANGLE_STRIP:
+ case GL_TRIANGLE_FAN:
+ valid_enum = true;
+ break;
+ case GL_QUADS:
+ case GL_QUAD_STRIP:
+ case GL_POLYGON:
+ valid_enum = (ctx->API == API_OPENGL);
+ break;
+ case GL_LINES_ADJACENCY:
+ case GL_LINE_STRIP_ADJACENCY:
+ case GL_TRIANGLES_ADJACENCY:
+ case GL_TRIANGLE_STRIP_ADJACENCY:
+ valid_enum = _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_geometry_shader4;
+ break;
+ default:
+ valid_enum = false;
+ break;
}
- else if (mode > GL_POLYGON) {
+
+ if (!valid_enum) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 3439ab6b5..9337fe725 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -457,7 +457,7 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids)
* becomes current."
*/
if ( obj == ctx->Array.ArrayObj ) {
- CALL_BindVertexArrayAPPLE( ctx->Exec, (0) );
+ _mesa_BindVertexArray(0);
}
/* The ID is immediately freed for re-use */
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 1a04eebdd..8cb2a689b 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -989,7 +989,8 @@ _mesa_PopAttrib(void)
_mesa_ClampColorARB(GL_CLAMP_READ_COLOR_ARB, color->ClampReadColor);
/* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
+ if (ctx->Extensions.EXT_framebuffer_sRGB)
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
}
break;
case GL_CURRENT_BIT:
diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c
index 5bc40a028..de871a92a 100644
--- a/mesalib/src/mesa/main/blend.c
+++ b/mesalib/src/mesa/main/blend.c
@@ -58,16 +58,18 @@ legal_src_factor(const struct gl_context *ctx, GLenum factor)
case GL_DST_ALPHA:
case GL_ONE_MINUS_DST_ALPHA:
case GL_SRC_ALPHA_SATURATE:
+ return GL_TRUE;
case GL_CONSTANT_COLOR:
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
- return GL_TRUE;
+ return _mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2;
case GL_SRC1_COLOR:
case GL_SRC1_ALPHA:
case GL_ONE_MINUS_SRC1_COLOR:
case GL_ONE_MINUS_SRC1_ALPHA:
- return ctx->Extensions.ARB_blend_func_extended;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_blend_func_extended;
default:
return GL_FALSE;
}
@@ -93,17 +95,22 @@ legal_dst_factor(const struct gl_context *ctx, GLenum factor)
case GL_ONE_MINUS_SRC_ALPHA:
case GL_DST_ALPHA:
case GL_ONE_MINUS_DST_ALPHA:
+ return GL_TRUE;
case GL_CONSTANT_COLOR:
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
- return GL_TRUE;
+ return _mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2;
case GL_SRC_ALPHA_SATURATE:
+ return (_mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_blend_func_extended)
+ || _mesa_is_gles3(ctx);
case GL_SRC1_COLOR:
case GL_SRC1_ALPHA:
case GL_ONE_MINUS_SRC1_COLOR:
case GL_ONE_MINUS_SRC1_ALPHA:
- return ctx->Extensions.ARB_blend_func_extended;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_blend_func_extended;
default:
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index f8938a510..728cc51da 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -720,6 +720,10 @@ bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer)
else {
/* non-default buffer object */
newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (newBufObj == NULL && ctx->API == API_OPENGL_CORE) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBuffer(non-gen name)");
+ return;
+ }
handle_bind_buffer_gen(ctx, target, buffer, &newBufObj);
}
diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c
index 7cc204bc5..f07d5333b 100644
--- a/mesalib/src/mesa/main/clear.c
+++ b/mesalib/src/mesa/main/clear.c
@@ -167,6 +167,15 @@ _mesa_Clear( GLbitfield mask )
return;
}
+ /* Accumulation buffers were removed in core contexts, and they never
+ * existed in OpenGL ES.
+ */
+ if ((mask & GL_ACCUM_BUFFER_BIT) != 0
+ && (ctx->API == API_OPENGL_CORE || _mesa_is_gles(ctx))) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glClear(GL_ACCUM_BUFFER_BIT)");
+ return;
+ }
+
if (ctx->NewState) {
_mesa_update_state( ctx ); /* update _Xmin, etc */
}
@@ -510,7 +519,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
/* save color */
clearSave = ctx->Color.ClearColor;
/* set color */
- COPY_4V_CAST(ctx->Color.ClearColor.f, value, GLclampf);
+ COPY_4V(ctx->Color.ClearColor.f, value);
/* clear buffer(s) */
ctx->Driver.Clear(ctx, mask);
/* restore color */
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index bfa06f37d..94484d8f3 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -241,6 +241,9 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
((x & 0x00ff0000) >> 8) |
((x & 0xff000000) >> 24));
}
+#elif defined(__OpenBSD__)
+#include <sys/types.h>
+#define CPU_TO_LE32( x ) htole32( x )
#else /*__linux__ */
#include <sys/endian.h>
#define CPU_TO_LE32( x ) bswap32( x )
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index b78bceeb9..feddbaa7e 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -431,7 +431,7 @@ one_time_init( struct gl_context *ctx )
* when an app is linked to libGLES*, there are not enough dynamic
* entries.
*/
- if (_mesa_is_desktop_gl(ctx))
+ if (_mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2)
_mesa_init_remap_table();
}
@@ -964,9 +964,10 @@ _mesa_initialize_context(struct gl_context *ctx,
#if FEATURE_dispatch
/* setup the API dispatch tables */
switch (ctx->API) {
-#if FEATURE_GL
+#if FEATURE_GL || FEATURE_ES2
case API_OPENGL:
case API_OPENGL_CORE:
+ case API_OPENGLES2:
ctx->Exec = _mesa_create_exec_table(ctx);
break;
#endif
@@ -975,11 +976,6 @@ _mesa_initialize_context(struct gl_context *ctx,
ctx->Exec = _mesa_create_exec_table_es1();
break;
#endif
-#if FEATURE_ES2
- case API_OPENGLES2:
- ctx->Exec = _mesa_create_exec_table_es2();
- break;
-#endif
default:
_mesa_problem(ctx, "unknown or unsupported API");
break;
@@ -1012,7 +1008,6 @@ _mesa_initialize_context(struct gl_context *ctx,
switch (ctx->API) {
case API_OPENGL:
- case API_OPENGL_CORE:
#if FEATURE_dlist
ctx->Save = _mesa_create_save_table();
if (!ctx->Save) {
@@ -1023,6 +1018,7 @@ _mesa_initialize_context(struct gl_context *ctx,
_mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
#endif
+ case API_OPENGL_CORE:
break;
case API_OPENGLES:
/**
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index f8110578a..14eea53fe 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -38,6 +38,7 @@
#include "enums.h"
#include "api_arrayelt.h"
#include "texstate.h"
+#include "drivers/common/meta.h"
@@ -209,8 +210,6 @@ _mesa_DisableClientState( GLenum cap )
goto invalid_enum_error; \
}
-
-
/**
* Return pointer to current texture unit for setting/getting coordinate
* state.
@@ -274,12 +273,16 @@ _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)
+ goto invalid_enum_error;
if (ctx->Color.AlphaEnabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.AlphaEnabled = state;
break;
case GL_AUTO_NORMAL:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.AutoNormal == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
@@ -327,6 +330,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
#endif
case GL_COLOR_MATERIAL:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
if (ctx->Light.ColorMaterialEnabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
@@ -350,6 +355,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Depth.Test = state;
break;
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
ctx->Debug.SyncOutput = state;
break;
case GL_DITHER:
@@ -359,6 +366,8 @@ _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)
+ goto invalid_enum_error;
if (ctx->Fog.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
@@ -372,6 +381,8 @@ _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)
+ goto invalid_enum_error;
if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
@@ -385,6 +396,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
}
break;
case GL_LIGHTING:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
if (ctx->Light.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
@@ -395,6 +408,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
break;
case GL_LINE_SMOOTH:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
if (ctx->Line.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_LINE);
@@ -402,6 +417,8 @@ _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)
+ goto invalid_enum_error;
if (ctx->Line.StippleFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_LINE);
@@ -409,132 +426,176 @@ _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)
+ goto invalid_enum_error;
if (ctx->Color.IndexLogicOpEnabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.IndexLogicOpEnabled = state;
break;
case GL_COLOR_LOGIC_OP:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
if (ctx->Color.ColorLogicOpEnabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ColorLogicOpEnabled = state;
break;
case GL_MAP1_COLOR_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1Color4 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1Color4 = state;
break;
case GL_MAP1_INDEX:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1Index == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1Index = state;
break;
case GL_MAP1_NORMAL:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1Normal == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1Normal = state;
break;
case GL_MAP1_TEXTURE_COORD_1:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord1 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1TextureCoord1 = state;
break;
case GL_MAP1_TEXTURE_COORD_2:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord2 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1TextureCoord2 = state;
break;
case GL_MAP1_TEXTURE_COORD_3:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord3 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1TextureCoord3 = state;
break;
case GL_MAP1_TEXTURE_COORD_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord4 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1TextureCoord4 = state;
break;
case GL_MAP1_VERTEX_3:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1Vertex3 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1Vertex3 = state;
break;
case GL_MAP1_VERTEX_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map1Vertex4 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map1Vertex4 = state;
break;
case GL_MAP2_COLOR_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2Color4 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2Color4 = state;
break;
case GL_MAP2_INDEX:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2Index == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2Index = state;
break;
case GL_MAP2_NORMAL:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2Normal == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2Normal = state;
break;
case GL_MAP2_TEXTURE_COORD_1:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord1 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2TextureCoord1 = state;
break;
case GL_MAP2_TEXTURE_COORD_2:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord2 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2TextureCoord2 = state;
break;
case GL_MAP2_TEXTURE_COORD_3:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord3 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2TextureCoord3 = state;
break;
case GL_MAP2_TEXTURE_COORD_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord4 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2TextureCoord4 = state;
break;
case GL_MAP2_VERTEX_3:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2Vertex3 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2Vertex3 = state;
break;
case GL_MAP2_VERTEX_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
if (ctx->Eval.Map2Vertex4 == state)
return;
FLUSH_VERTICES(ctx, _NEW_EVAL);
ctx->Eval.Map2Vertex4 = state;
break;
case GL_NORMALIZE:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
if (ctx->Transform.Normalize == state)
return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
ctx->Transform.Normalize = state;
break;
case GL_POINT_SMOOTH:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
if (ctx->Point.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POINT);
@@ -542,6 +603,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
break;
case GL_POLYGON_SMOOTH:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (ctx->Polygon.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
@@ -549,6 +612,8 @@ _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)
+ goto invalid_enum_error;
if (ctx->Polygon.StippleFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
@@ -556,12 +621,16 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
break;
case GL_POLYGON_OFFSET_POINT:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (ctx->Polygon.OffsetPoint == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.OffsetPoint = state;
break;
case GL_POLYGON_OFFSET_LINE:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (ctx->Polygon.OffsetLine == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
@@ -574,6 +643,8 @@ _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)
+ goto invalid_enum_error;
if (ctx->Transform.RescaleNormals == state)
return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
@@ -592,16 +663,22 @@ _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)
+ 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)
+ 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)
+ goto invalid_enum_error;
if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) {
return;
}
@@ -612,6 +689,10 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_TEXTURE_GEN_Q:
{
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
+
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
+
if (texUnit) {
GLbitfield coordBit = S_BIT << (cap - GL_TEXTURE_GEN_S);
GLbitfield newenabled = texUnit->TexGenEnabled & ~coordBit;
@@ -630,6 +711,10 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* disable S, T, and R at the same time */
{
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
+
+ if (ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
+
if (texUnit) {
GLuint newenabled =
texUnit->TexGenEnabled & ~STR_BITS;
@@ -659,6 +744,8 @@ _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)
+ goto invalid_enum_error;
CHECK_EXTENSION(ARB_texture_cube_map, cap);
if (!enable_texture(ctx, state, TEXTURE_CUBE_BIT)) {
return;
@@ -667,6 +754,8 @@ _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)
+ goto invalid_enum_error;
CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program, cap);
if (ctx->Fog.ColorSumEnabled == state)
return;
@@ -676,6 +765,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_ARB_multisample */
case GL_MULTISAMPLE_ARB:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
if (ctx->Multisample.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
@@ -688,6 +779,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Multisample.SampleAlphaToCoverage = state;
break;
case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
if (ctx->Multisample.SampleAlphaToOne == state)
return;
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
@@ -700,6 +793,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Multisample.SampleCoverage = state;
break;
case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (ctx->Multisample.SampleCoverageInvert == state)
return;
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
@@ -708,6 +803,8 @@ _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)
+ goto invalid_enum_error;
CHECK_EXTENSION(IBM_rasterpos_clip, cap);
if (ctx->Transform.RasterPositionUnclipped == state)
return;
@@ -717,6 +814,8 @@ _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)
+ goto invalid_enum_error;
CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite, cap);
if (ctx->Point.PointSprite == state)
return;
@@ -726,6 +825,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
case GL_VERTEX_PROGRAM_ARB:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
if (ctx->VertexProgram.Enabled == state)
return;
@@ -733,6 +834,11 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->VertexProgram.Enabled = state;
break;
case GL_VERTEX_PROGRAM_POINT_SIZE_ARB:
+ /* This was added with ARB_vertex_program, but it is also used with
+ * GLSL vertex shaders on desktop.
+ */
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
if (ctx->VertexProgram.PointSizeEnabled == state)
return;
@@ -740,6 +846,8 @@ _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)
+ goto invalid_enum_error;
CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program, cap);
if (ctx->VertexProgram.TwoSideEnabled == state)
return;
@@ -764,6 +872,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_MAP1_VERTEX_ATTRIB13_4_NV:
case GL_MAP1_VERTEX_ATTRIB14_4_NV:
case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(NV_vertex_program, cap);
{
const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
@@ -787,6 +897,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_MAP2_VERTEX_ATTRIB13_4_NV:
case GL_MAP2_VERTEX_ATTRIB14_4_NV:
case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(NV_vertex_program, cap);
{
const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
@@ -798,6 +910,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
#if FEATURE_NV_fragment_program
case GL_FRAGMENT_PROGRAM_NV:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(NV_fragment_program, cap);
if (ctx->FragmentProgram.Enabled == state)
return;
@@ -808,6 +922,8 @@ _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)
+ goto invalid_enum_error;
CHECK_EXTENSION(NV_texture_rectangle, cap);
if (!enable_texture(ctx, state, TEXTURE_RECT_BIT)) {
return;
@@ -816,6 +932,8 @@ _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)
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_stencil_two_side, cap);
if (ctx->Stencil.TestTwoSide == state)
return;
@@ -830,6 +948,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
#if FEATURE_ARB_fragment_program
case GL_FRAGMENT_PROGRAM_ARB:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(ARB_fragment_program, cap);
if (ctx->FragmentProgram.Enabled == state)
return;
@@ -840,6 +960,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_EXT_depth_bounds_test */
case GL_DEPTH_BOUNDS_TEST_EXT:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_depth_bounds_test, cap);
if (ctx->Depth.BoundsTest == state)
return;
@@ -848,15 +970,19 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_DEPTH_CLAMP:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
+ CHECK_EXTENSION(ARB_depth_clamp, cap);
if (ctx->Transform.DepthClamp == state)
return;
- CHECK_EXTENSION(ARB_depth_clamp, cap);
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
ctx->Transform.DepthClamp = state;
break;
#if FEATURE_ATI_fragment_shader
case GL_FRAGMENT_SHADER_ATI:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(ATI_fragment_shader, cap);
if (ctx->ATIFragmentShader.Enabled == state)
return;
@@ -867,6 +993,8 @@ _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)
+ goto invalid_enum_error;
CHECK_EXTENSION(MESA_texture_array, cap);
if (!enable_texture(ctx, state, TEXTURE_1D_ARRAY_BIT)) {
return;
@@ -874,6 +1002,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_TEXTURE_2D_ARRAY_EXT:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(MESA_texture_array, cap);
if (!enable_texture(ctx, state, TEXTURE_2D_ARRAY_BIT)) {
return;
@@ -881,6 +1011,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(ARB_seamless_cube_map, cap);
if (ctx->Texture.CubeMapSeamless != state) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -890,6 +1022,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
#if FEATURE_EXT_transform_feedback
case GL_RASTERIZER_DISCARD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_transform_feedback, cap);
if (ctx->RasterDiscard != state) {
FLUSH_VERTICES(ctx, _NEW_RASTERIZER_DISCARD);
@@ -902,7 +1036,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
* GL_PRIMITIVE_RESTART_NV (which is client state).
*/
case GL_PRIMITIVE_RESTART:
- if (ctx->Version < 31) {
+ if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 31) {
goto invalid_enum_error;
}
if (ctx->Array.PrimitiveRestart != state) {
@@ -913,6 +1047,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL3.0 - GL_framebuffer_sRGB */
case GL_FRAMEBUFFER_SRGB_EXT:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_framebuffer_sRGB, cap);
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
ctx->Color.sRGBEnabled = state;
@@ -920,6 +1056,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_OES_EGL_image_external */
case GL_TEXTURE_EXTERNAL_OES:
+ if (!_mesa_is_gles(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(OES_EGL_image_external, cap);
if (!enable_texture(ctx, state, TEXTURE_EXTERNAL_BIT)) {
return;
@@ -1092,8 +1230,12 @@ _mesa_IsEnabled( GLenum cap )
switch (cap) {
case GL_ALPHA_TEST:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Color.AlphaEnabled;
case GL_AUTO_NORMAL:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.AutoNormal;
case GL_BLEND:
return ctx->Color.BlendEnabled & 1; /* return state for buffer[0] */
@@ -1113,18 +1255,26 @@ _mesa_IsEnabled( GLenum cap )
return (ctx->Transform.ClipPlanesEnabled >> p) & 1;
}
case GL_COLOR_MATERIAL:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Light.ColorMaterialEnabled;
case GL_CULL_FACE:
return ctx->Polygon.CullFlag;
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
return ctx->Debug.SyncOutput;
case GL_DEPTH_TEST:
return ctx->Depth.Test;
case GL_DITHER:
return ctx->Color.DitherFlag;
case GL_FOG:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Fog.Enabled;
case GL_LIGHTING:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Light.Enabled;
case GL_LIGHT0:
case GL_LIGHT1:
@@ -1134,76 +1284,142 @@ _mesa_IsEnabled( GLenum cap )
case GL_LIGHT5:
case GL_LIGHT6:
case GL_LIGHT7:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
case GL_LINE_SMOOTH:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Line.SmoothFlag;
case GL_LINE_STIPPLE:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Line.StippleFlag;
case GL_INDEX_LOGIC_OP:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Color.IndexLogicOpEnabled;
case GL_COLOR_LOGIC_OP:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Color.ColorLogicOpEnabled;
case GL_MAP1_COLOR_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1Color4;
case GL_MAP1_INDEX:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1Index;
case GL_MAP1_NORMAL:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1Normal;
case GL_MAP1_TEXTURE_COORD_1:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord1;
case GL_MAP1_TEXTURE_COORD_2:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord2;
case GL_MAP1_TEXTURE_COORD_3:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord3;
case GL_MAP1_TEXTURE_COORD_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord4;
case GL_MAP1_VERTEX_3:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1Vertex3;
case GL_MAP1_VERTEX_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map1Vertex4;
case GL_MAP2_COLOR_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2Color4;
case GL_MAP2_INDEX:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2Index;
case GL_MAP2_NORMAL:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2Normal;
case GL_MAP2_TEXTURE_COORD_1:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord1;
case GL_MAP2_TEXTURE_COORD_2:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord2;
case GL_MAP2_TEXTURE_COORD_3:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord3;
case GL_MAP2_TEXTURE_COORD_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord4;
case GL_MAP2_VERTEX_3:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2Vertex3;
case GL_MAP2_VERTEX_4:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Eval.Map2Vertex4;
case GL_NORMALIZE:
+ if (ctx->API != API_OPENGL && 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)
+ goto invalid_enum_error;
return ctx->Point.SmoothFlag;
case GL_POLYGON_SMOOTH:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
return ctx->Polygon.SmoothFlag;
case GL_POLYGON_STIPPLE:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->Polygon.StippleFlag;
case GL_POLYGON_OFFSET_POINT:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
return ctx->Polygon.OffsetPoint;
case GL_POLYGON_OFFSET_LINE:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
return ctx->Polygon.OffsetLine;
case GL_POLYGON_OFFSET_FILL:
return ctx->Polygon.OffsetFill;
case GL_RESCALE_NORMAL_EXT:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Transform.RescaleNormals;
case GL_SCISSOR_TEST:
return ctx->Scissor.Enabled;
case GL_STENCIL_TEST:
return ctx->Stencil.Enabled;
case GL_TEXTURE_1D:
+ if (ctx->API != API_OPENGL)
+ 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)
+ 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)
+ goto invalid_enum_error;
return is_texture_enabled(ctx, TEXTURE_3D_BIT);
case GL_TEXTURE_GEN_S:
case GL_TEXTURE_GEN_T:
@@ -1211,6 +1427,10 @@ _mesa_IsEnabled( GLenum cap )
case GL_TEXTURE_GEN_Q:
{
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
+
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
+
if (texUnit) {
GLbitfield coordBit = S_BIT << (cap - GL_TEXTURE_GEN_S);
return (texUnit->TexGenEnabled & coordBit) ? GL_TRUE : GL_FALSE;
@@ -1221,6 +1441,10 @@ _mesa_IsEnabled( GLenum cap )
case GL_TEXTURE_GEN_STR_OES:
{
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
+
+ if (ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
+
if (texUnit) {
return (texUnit->TexGenEnabled & STR_BITS) == STR_BITS
? GL_TRUE : GL_FALSE;
@@ -1230,26 +1454,44 @@ _mesa_IsEnabled( GLenum cap )
/* client-side state */
case GL_VERTEX_ARRAY:
+ if (ctx->API != API_OPENGL && 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)
+ 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)
+ goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled != 0);
case GL_INDEX_ARRAY:
+ if (ctx->API != API_OPENGL)
+ 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)
+ 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)
+ 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)
+ 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)
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_secondary_color);
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0);
#if FEATURE_point_size_array
case GL_POINT_SIZE_ARRAY_OES:
+ if (ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled != 0);
#endif
@@ -1260,39 +1502,60 @@ _mesa_IsEnabled( GLenum cap )
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program);
return ctx->Fog.ColorSumEnabled;
/* GL_ARB_multisample */
case GL_MULTISAMPLE_ARB:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Multisample.Enabled;
case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
return ctx->Multisample.SampleAlphaToCoverage;
case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
return ctx->Multisample.SampleAlphaToOne;
case GL_SAMPLE_COVERAGE_ARB:
return ctx->Multisample.SampleCoverage;
case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
return ctx->Multisample.SampleCoverageInvert;
/* GL_IBM_rasterpos_clip */
case GL_RASTER_POSITION_UNCLIPPED_IBM:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(IBM_rasterpos_clip);
return ctx->Transform.RasterPositionUnclipped;
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite)
return ctx->Point.PointSprite;
#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
case GL_VERTEX_PROGRAM_ARB:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
return ctx->VertexProgram.Enabled;
case GL_VERTEX_PROGRAM_POINT_SIZE_ARB:
+ /* This was added with ARB_vertex_program, but it is also used with
+ * GLSL vertex shaders on desktop.
+ */
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
return ctx->VertexProgram.PointSizeEnabled;
case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION2(ARB_vertex_program, NV_vertex_program);
return ctx->VertexProgram.TwoSideEnabled;
#endif
@@ -1313,6 +1576,8 @@ _mesa_IsEnabled( GLenum cap )
case GL_VERTEX_ATTRIB_ARRAY13_NV:
case GL_VERTEX_ATTRIB_ARRAY14_NV:
case GL_VERTEX_ATTRIB_ARRAY15_NV:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(NV_vertex_program);
{
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
@@ -1335,6 +1600,8 @@ _mesa_IsEnabled( GLenum cap )
case GL_MAP1_VERTEX_ATTRIB13_4_NV:
case GL_MAP1_VERTEX_ATTRIB14_4_NV:
case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(NV_vertex_program);
{
const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV);
@@ -1356,6 +1623,8 @@ _mesa_IsEnabled( GLenum cap )
case GL_MAP2_VERTEX_ATTRIB13_4_NV:
case GL_MAP2_VERTEX_ATTRIB14_4_NV:
case GL_MAP2_VERTEX_ATTRIB15_4_NV:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(NV_vertex_program);
{
const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV);
@@ -1365,72 +1634,94 @@ _mesa_IsEnabled( GLenum cap )
#if FEATURE_NV_fragment_program
case GL_FRAGMENT_PROGRAM_NV:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(NV_fragment_program);
return ctx->FragmentProgram.Enabled;
#endif /* FEATURE_NV_fragment_program */
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
+ if (ctx->API != API_OPENGL)
+ 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)
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_stencil_two_side);
return ctx->Stencil.TestTwoSide;
#if FEATURE_ARB_fragment_program
case GL_FRAGMENT_PROGRAM_ARB:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
return ctx->FragmentProgram.Enabled;
#endif /* FEATURE_ARB_fragment_program */
/* GL_EXT_depth_bounds_test */
case GL_DEPTH_BOUNDS_TEST_EXT:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_depth_bounds_test);
return ctx->Depth.BoundsTest;
/* GL_ARB_depth_clamp */
case GL_DEPTH_CLAMP:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(ARB_depth_clamp);
return ctx->Transform.DepthClamp;
#if FEATURE_ATI_fragment_shader
case GL_FRAGMENT_SHADER_ATI:
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum_error;
CHECK_EXTENSION(ATI_fragment_shader);
return ctx->ATIFragmentShader.Enabled;
#endif /* FEATURE_ATI_fragment_shader */
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(ARB_seamless_cube_map);
return ctx->Texture.CubeMapSeamless;
#if FEATURE_EXT_transform_feedback
case GL_RASTERIZER_DISCARD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_transform_feedback);
return ctx->RasterDiscard;
#endif
/* GL_NV_primitive_restart */
case GL_PRIMITIVE_RESTART_NV:
- if (!ctx->Extensions.NV_primitive_restart) {
+ if (ctx->API != API_OPENGL || !ctx->Extensions.NV_primitive_restart) {
goto invalid_enum_error;
}
return ctx->Array.PrimitiveRestart;
/* GL 3.1 primitive restart */
case GL_PRIMITIVE_RESTART:
- if (ctx->Version < 31) {
+ if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 31) {
goto invalid_enum_error;
}
return ctx->Array.PrimitiveRestart;
/* GL3.0 - GL_framebuffer_sRGB */
case GL_FRAMEBUFFER_SRGB_EXT:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(EXT_framebuffer_sRGB);
return ctx->Color.sRGBEnabled;
/* GL_OES_EGL_image_external */
case GL_TEXTURE_EXTERNAL_OES:
+ if (!_mesa_is_gles(ctx))
+ goto invalid_enum_error;
CHECK_EXTENSION(OES_EGL_image_external);
return is_texture_enabled(ctx, TEXTURE_EXTERNAL_BIT);
diff --git a/mesalib/src/mesa/main/es1_conversion.c b/mesalib/src/mesa/main/es1_conversion.c
index 75cdfc887..ae3c5badc 100644
--- a/mesalib/src/mesa/main/es1_conversion.c
+++ b/mesalib/src/mesa/main/es1_conversion.c
@@ -134,28 +134,7 @@ _es_DrawTexxvOES(const GLfixed *coords)
void GL_APIENTRY
_es_Fogx(GLenum pname, GLfixed param)
{
- bool convert_param_value = true;
-
- switch(pname) {
- case GL_FOG_MODE:
- if (param != GL_EXP && param != GL_EXP2 && param != GL_LINEAR) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glFogx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_FOG_DENSITY:
- case GL_FOG_START:
- case GL_FOG_END:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glFogx(pname=0x%x)", pname);
- return;
- }
-
- if (convert_param_value) {
+ if (pname != GL_FOG_MODE) {
_mesa_Fogf(pname, (GLfloat) (param / 65536.0f));
} else {
_mesa_Fogf(pname, (GLfloat) param);
@@ -173,11 +152,6 @@ _es_Fogxv(GLenum pname, const GLfixed *params)
switch(pname) {
case GL_FOG_MODE:
- if (params[0] != GL_EXP && params[0] != GL_EXP2 && params[0] != GL_LINEAR) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glFogxv(pname=0x%x)", pname);
- return;
- }
convert_params_value = false;
n_params = 1;
break;
@@ -319,7 +293,6 @@ _es_GetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
break;
case GL_AMBIENT:
case GL_DIFFUSE:
- case GL_AMBIENT_AND_DIFFUSE:
case GL_SPECULAR:
case GL_EMISSION:
n_params = 4;
@@ -425,63 +398,13 @@ _es_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
void GL_APIENTRY
_check_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
{
- unsigned int i;
- unsigned int n_params = 1;
- GLfloat converted_params[1];
-
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glGetTexGenivOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- n_params = 1;
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glGetTexGenivOES(pname=0x%x)", pname);
- return;
- }
-
- _es_GetTexGenfv(coord, pname, converted_params);
- for (i = 0; i < n_params; i++) {
- params[i] = (GLfloat) converted_params[i];
- }
+ _mesa_GetTexGeniv(coord, pname, params);
}
void GL_APIENTRY
_check_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
{
- unsigned int i;
- unsigned int n_params = 1;
- GLfloat converted_params[1];
-
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glGetTexGenxvOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- n_params = 1;
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glGetTexGenxvOES(pname=0x%x)", pname);
- return;
- }
-
- _es_GetTexGenfv(coord, pname, converted_params);
- for (i = 0; i < n_params; i++) {
- params[i] = (GLfloat) converted_params[i];
- }
+ _mesa_GetTexGeniv(coord, pname, (GLint *) params);
}
void GL_APIENTRY
@@ -535,20 +458,6 @@ _es_GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
void GL_APIENTRY
_es_LightModelx(GLenum pname, GLfixed param)
{
- switch(pname) {
- case GL_LIGHT_MODEL_TWO_SIDE:
- if (param != GL_TRUE && param != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glLightModelx(pname=0x%x)", pname);
- return;
- }
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glLightModelx(pname=0x%x)", pname);
- return;
- }
-
_mesa_LightModelf(pname, (GLfloat) param);
}
@@ -565,11 +474,6 @@ _es_LightModelxv(GLenum pname, const GLfixed *params)
n_params = 4;
break;
case GL_LIGHT_MODEL_TWO_SIDE:
- if (params[0] != GL_TRUE && params[0] != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glLightModelxv(pname=0x%x)", pname);
- return;
- }
convert_params_value = false;
n_params = 1;
break;
@@ -662,18 +566,13 @@ _es_LoadMatrixx(const GLfixed *m)
void GL_APIENTRY
_es_Materialx(GLenum face, GLenum pname, GLfixed param)
{
- switch(face) {
- case GL_FRONT_AND_BACK:
- break;
- default:
+ if (face != GL_FRONT_AND_BACK) {
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glMaterialx(face=0x%x)", face);
return;
}
- switch(pname) {
- case GL_SHININESS:
- break;
- default:
+
+ if (pname != GL_SHININESS) {
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glMaterialx(pname=0x%x)", pname);
return;
@@ -689,14 +588,12 @@ _es_Materialxv(GLenum face, GLenum pname, const GLfixed *params)
unsigned int n_params = 4;
GLfloat converted_params[4];
- switch(face) {
- case GL_FRONT_AND_BACK:
- break;
- default:
+ if (face != GL_FRONT_AND_BACK) {
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glMaterialxv(face=0x%x)", face);
return;
}
+
switch(pname) {
case GL_AMBIENT:
case GL_DIFFUSE:
@@ -779,17 +676,6 @@ _es_Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
void GL_APIENTRY
_es_PointParameterx(GLenum pname, GLfixed param)
{
- switch(pname) {
- case GL_POINT_SIZE_MIN:
- case GL_POINT_SIZE_MAX:
- case GL_POINT_FADE_THRESHOLD_SIZE:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glPointParameterx(pname=0x%x)", pname);
- return;
- }
-
_mesa_PointParameterf(pname, (GLfloat) (param / 65536.0f));
}
@@ -862,376 +748,126 @@ _es_Scalex(GLfixed x, GLfixed y, GLfixed z)
void GL_APIENTRY
_es_TexEnvx(GLenum target, GLenum pname, GLfixed param)
{
- GLfloat converted_param;
- bool convert_param_value = true;
-
switch(target) {
case GL_POINT_SPRITE:
- if (pname != GL_COORD_REPLACE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(target=0x%x)", target);
- return;
- }
- break;
case GL_TEXTURE_FILTER_CONTROL_EXT:
- if (pname != GL_TEXTURE_LOD_BIAS_EXT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(target=0x%x)", target);
- return;
- }
- break;
case GL_TEXTURE_ENV:
- if (pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && pname != GL_SRC0_RGB && pname != GL_SRC1_RGB && pname != GL_SRC2_RGB && pname != GL_SRC0_ALPHA && pname != GL_SRC1_ALPHA && pname != GL_SRC2_ALPHA && pname != GL_OPERAND0_RGB && pname != GL_OPERAND1_RGB && pname != GL_OPERAND2_RGB && pname != GL_OPERAND0_ALPHA && pname != GL_OPERAND1_ALPHA && pname != GL_OPERAND2_ALPHA && pname != GL_TEXTURE_ENV_COLOR) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(target=0x%x)", target);
- return;
- }
break;
default:
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glTexEnvx(target=0x%x)", target);
return;
}
+
switch(pname) {
case GL_COORD_REPLACE:
- if (param != GL_TRUE && param != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_TEXTURE_LOD_BIAS_EXT:
- break;
case GL_TEXTURE_ENV_MODE:
- if (param != GL_REPLACE && param != GL_MODULATE && param != GL_DECAL && param != GL_BLEND && param != GL_ADD && param != GL_COMBINE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
case GL_COMBINE_RGB:
- if (param != GL_REPLACE && param != GL_MODULATE && param != GL_ADD && param != GL_ADD_SIGNED && param != GL_INTERPOLATE && param != GL_SUBTRACT && param != GL_DOT3_RGB && param != GL_DOT3_RGBA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
case GL_COMBINE_ALPHA:
- if (param != GL_REPLACE && param != GL_MODULATE && param != GL_ADD && param != GL_ADD_SIGNED && param != GL_INTERPOLATE && param != GL_SUBTRACT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- break;
case GL_SRC0_RGB:
case GL_SRC1_RGB:
case GL_SRC2_RGB:
case GL_SRC0_ALPHA:
case GL_SRC1_ALPHA:
case GL_SRC2_ALPHA:
- convert_param_value = false;
- break;
case GL_OPERAND0_RGB:
case GL_OPERAND1_RGB:
case GL_OPERAND2_RGB:
- if (param != GL_SRC_COLOR && param != GL_ONE_MINUS_SRC_COLOR && param != GL_SRC_ALPHA && param != GL_ONE_MINUS_SRC_ALPHA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
case GL_OPERAND0_ALPHA:
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
- if (param != GL_SRC_ALPHA && param != GL_ONE_MINUS_SRC_ALPHA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
+ _mesa_TexEnvf(target, pname, (GLfloat) param);
+ break;
+ case GL_TEXTURE_LOD_BIAS_EXT:
+ case GL_RGB_SCALE:
+ case GL_ALPHA_SCALE:
+ _mesa_TexEnvf(target, pname, (GLfloat) (param / 65536.0f));
break;
default:
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glTexEnvx(pname=0x%x)", pname);
return;
}
-
- if (convert_param_value) {
- converted_param = (GLfloat) (param / 65536.0f);
- } else {
- converted_param = (GLfloat) param;
- }
-
- _mesa_TexEnvf(target, pname, converted_param);
}
void GL_APIENTRY
_es_TexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
{
- unsigned int i;
- unsigned int n_params = 4;
- GLfloat converted_params[4];
- bool convert_params_value = true;
-
switch(target) {
case GL_POINT_SPRITE:
- if (pname != GL_COORD_REPLACE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(target=0x%x)", target);
- return;
- }
- break;
case GL_TEXTURE_FILTER_CONTROL_EXT:
- if (pname != GL_TEXTURE_LOD_BIAS_EXT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(target=0x%x)", target);
- return;
- }
- break;
case GL_TEXTURE_ENV:
- if (pname != GL_TEXTURE_ENV_MODE && pname != GL_COMBINE_RGB && pname != GL_COMBINE_ALPHA && pname != GL_RGB_SCALE && pname != GL_ALPHA_SCALE && pname != GL_SRC0_RGB && pname != GL_SRC1_RGB && pname != GL_SRC2_RGB && pname != GL_SRC0_ALPHA && pname != GL_SRC1_ALPHA && pname != GL_SRC2_ALPHA && pname != GL_OPERAND0_RGB && pname != GL_OPERAND1_RGB && pname != GL_OPERAND2_RGB && pname != GL_OPERAND0_ALPHA && pname != GL_OPERAND1_ALPHA && pname != GL_OPERAND2_ALPHA && pname != GL_TEXTURE_ENV_COLOR) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(target=0x%x)", target);
- return;
- }
break;
default:
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
"glTexEnvxv(target=0x%x)", target);
return;
}
+
switch(pname) {
case GL_COORD_REPLACE:
- if (params[0] != GL_TRUE && params[0] != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
- case GL_TEXTURE_LOD_BIAS_EXT:
- n_params = 1;
- break;
case GL_TEXTURE_ENV_MODE:
- if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_DECAL && params[0] != GL_BLEND && params[0] != GL_ADD && params[0] != GL_COMBINE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
case GL_COMBINE_RGB:
- if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_ADD && params[0] != GL_ADD_SIGNED && params[0] != GL_INTERPOLATE && params[0] != GL_SUBTRACT && params[0] != GL_DOT3_RGB && params[0] != GL_DOT3_RGBA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
case GL_COMBINE_ALPHA:
- if (params[0] != GL_REPLACE && params[0] != GL_MODULATE && params[0] != GL_ADD && params[0] != GL_ADD_SIGNED && params[0] != GL_INTERPOLATE && params[0] != GL_SUBTRACT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- break;
case GL_SRC0_RGB:
case GL_SRC1_RGB:
case GL_SRC2_RGB:
case GL_SRC0_ALPHA:
case GL_SRC1_ALPHA:
case GL_SRC2_ALPHA:
- convert_params_value = false;
- n_params = 1;
- break;
case GL_OPERAND0_RGB:
case GL_OPERAND1_RGB:
case GL_OPERAND2_RGB:
- if (params[0] != GL_SRC_COLOR && params[0] != GL_ONE_MINUS_SRC_COLOR && params[0] != GL_SRC_ALPHA && params[0] != GL_ONE_MINUS_SRC_ALPHA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
- break;
case GL_OPERAND0_ALPHA:
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
- if (params[0] != GL_SRC_ALPHA && params[0] != GL_ONE_MINUS_SRC_ALPHA) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
- convert_params_value = false;
- n_params = 1;
+ _mesa_TexEnvf(target, pname, (GLfloat) params[0]);
break;
- case GL_TEXTURE_ENV_COLOR:
- n_params = 4;
+ case GL_TEXTURE_LOD_BIAS_EXT:
+ case GL_RGB_SCALE:
+ case GL_ALPHA_SCALE:
+ _mesa_TexEnvf(target, pname, (GLfloat) (params[0] / 65536.0f));
break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexEnvxv(pname=0x%x)", pname);
- return;
- }
+ case GL_TEXTURE_ENV_COLOR: {
+ unsigned int i;
+ GLfloat converted_params[4];
- if (convert_params_value) {
- for (i = 0; i < n_params; i++) {
+ for (i = 0; i < Elements(converted_params); i++) {
converted_params[i] = (GLfloat) (params[i] / 65536.0f);
}
- } else {
- for (i = 0; i < n_params; i++) {
- converted_params[i] = (GLfloat) params[i];
- }
- }
-
- _mesa_TexEnvfv(target, pname, converted_params);
-}
-void GL_APIENTRY
-_check_TexGeniOES(GLenum coord, GLenum pname, GLint param)
-{
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
+ _mesa_TexEnvfv(target, pname, converted_params);
break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGeniOES(coord=0x%x)", coord);
- return;
}
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- if (param != GL_NORMAL_MAP && param != GL_REFLECTION_MAP) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGeniOES(pname=0x%x)", pname);
- return;
- }
- break;
default:
_mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGeniOES(pname=0x%x)", pname);
+ "glTexEnvxv(pname=0x%x)", pname);
return;
}
+}
+void GL_APIENTRY
+_check_TexGeniOES(GLenum coord, GLenum pname, GLint param)
+{
_es_TexGenf(coord, pname, (GLfloat) param);
}
void GL_APIENTRY
_check_TexGenivOES(GLenum coord, GLenum pname, const GLint *params)
{
- unsigned int i;
- unsigned int n_params = 1;
- GLfloat converted_params[1];
-
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenivOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- if (params[0] != GL_NORMAL_MAP && params[0] != GL_REFLECTION_MAP) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenivOES(pname=0x%x)", pname);
- return;
- }
- n_params = 1;
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenivOES(pname=0x%x)", pname);
- return;
- }
-
- for (i = 0; i < n_params; i++) {
- converted_params[i] = (GLfloat) params[i];
- }
-
- _es_TexGenfv(coord, pname, converted_params);
+ _es_TexGenf(coord, pname, (GLfloat) params[0]);
}
void GL_APIENTRY
_check_TexGenxOES(GLenum coord, GLenum pname, GLfixed param)
{
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- if (param != GL_NORMAL_MAP && param != GL_REFLECTION_MAP) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxOES(pname=0x%x)", pname);
- return;
- }
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxOES(pname=0x%x)", pname);
- return;
- }
-
_es_TexGenf(coord, pname, (GLfloat) param);
}
void GL_APIENTRY
_check_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
{
- unsigned int i;
- unsigned int n_params = 1;
- GLfloat converted_params[1];
-
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxvOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- if (params[0] != GL_NORMAL_MAP && params[0] != GL_REFLECTION_MAP) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxvOES(pname=0x%x)", pname);
- return;
- }
- n_params = 1;
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexGenxvOES(pname=0x%x)", pname);
- return;
- }
-
- for (i = 0; i < n_params; i++) {
- converted_params[i] = (GLfloat) params[i];
- }
-
- _es_TexGenfv(coord, pname, converted_params);
+ _es_TexGenf(coord, pname, (GLfloat) params[0]);
}
void GL_APIENTRY
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index ab33ac565..7e116bdd1 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -148,7 +148,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GLL, 1999 },
{ "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2009 },
{ "GL_ARB_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 },
- { "GL_ARB_vertex_array_object", o(ARB_vertex_array_object), GL, 2006 },
+ { "GL_ARB_vertex_array_object", o(dummy_true), GL, 2006 },
{ "GL_ARB_vertex_buffer_object", o(dummy_true), GLL, 2003 },
{ "GL_ARB_vertex_program", o(ARB_vertex_program), GLL, 2002 },
{ "GL_ARB_vertex_shader", o(ARB_vertex_shader), GL, 2002 },
@@ -266,6 +266,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_texture_env_crossbar", o(ARB_texture_env_crossbar), ES1, 2005 },
{ "GL_OES_texture_mirrored_repeat", o(dummy_true), ES1, 2005 },
{ "GL_OES_texture_npot", o(ARB_texture_non_power_of_two), ES2, 2005 },
+ { "GL_OES_vertex_array_object", o(dummy_true), ES1 | ES2, 2010 },
/* Vendor extensions */
{ "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 },
@@ -276,7 +277,7 @@ static const struct extension extension_table[] = {
{ "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 },
{ "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), GLL, 2002 },
{ "GL_APPLE_texture_max_level", o(dummy_true), ES1 | ES2, 2009 },
- { "GL_APPLE_vertex_array_object", o(APPLE_vertex_array_object), GLL, 2002 },
+ { "GL_APPLE_vertex_array_object", o(dummy_true), GLL, 2002 },
{ "GL_ATI_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 },
{ "GL_ATI_draw_buffers", o(dummy_true), GLL, 2002 },
{ "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), GLL, 2001 },
@@ -438,7 +439,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.ARB_texture_rg = GL_TRUE;
ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE;
ctx->Extensions.ARB_texture_storage = GL_TRUE;
- ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
#if FEATURE_ARB_vertex_program
ctx->Extensions.ARB_vertex_program = GL_TRUE;
#endif
@@ -448,7 +448,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
#if FEATURE_ARB_sync
ctx->Extensions.ARB_sync = GL_TRUE;
#endif
- ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
#if FEATURE_APPLE_object_purgeable
ctx->Extensions.APPLE_object_purgeable = GL_TRUE;
#endif
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 792a92da3..59a5ec32d 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -1075,13 +1075,15 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
- return ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
+ return ctx->API == API_OPENGL && 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->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
+ return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ ? GL_LUMINANCE : 0;
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
case GL_LUMINANCE6_ALPHA2:
@@ -1089,139 +1091,190 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- return ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
+ return ctx->API == API_OPENGL && 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->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
+ return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ ? GL_INTENSITY : 0;
+ case GL_RGB8:
+ return GL_RGB;
case GL_RGB:
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
- case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
+ return _mesa_is_desktop_gl(ctx) ? GL_RGB : 0;
case GL_SRGB8_EXT:
- return GL_RGB;
- case GL_RGBA:
- case GL_RGBA2:
+ return _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? GL_RGB : 0;
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGBA8:
- case GL_RGB10_A2:
+ return GL_RGBA;
+ case GL_RGBA:
+ case GL_RGBA2:
case GL_RGBA12:
case GL_RGBA16:
+ return _mesa_is_desktop_gl(ctx) ? GL_RGBA : 0;
+ case GL_RGB10_A2:
case GL_SRGB8_ALPHA8_EXT:
- return GL_RGBA;
+ return _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? GL_RGBA : 0;
case GL_STENCIL_INDEX:
case GL_STENCIL_INDEX1_EXT:
case GL_STENCIL_INDEX4_EXT:
- case GL_STENCIL_INDEX8_EXT:
case GL_STENCIL_INDEX16_EXT:
+ /* There are extensions for GL_STENCIL_INDEX1 and GL_STENCIL_INDEX4 in
+ * OpenGL ES, but Mesa does not currently support them.
+ */
+ return _mesa_is_desktop_gl(ctx) ? GL_STENCIL_INDEX : 0;
+ case GL_STENCIL_INDEX8_EXT:
return GL_STENCIL_INDEX;
case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT32:
+ return _mesa_is_desktop_gl(ctx) ? GL_DEPTH_COMPONENT : 0;
case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
return GL_DEPTH_COMPONENT;
case GL_DEPTH_STENCIL_EXT:
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.EXT_packed_depth_stencil
+ ? GL_DEPTH_STENCIL_EXT : 0;
case GL_DEPTH24_STENCIL8_EXT:
- if (ctx->Extensions.EXT_packed_depth_stencil)
- return GL_DEPTH_STENCIL_EXT;
- else
- return 0;
+ return ctx->Extensions.EXT_packed_depth_stencil
+ ? GL_DEPTH_STENCIL_EXT : 0;
case GL_DEPTH_COMPONENT32F:
- if (ctx->Extensions.ARB_depth_buffer_float)
- return GL_DEPTH_COMPONENT;
- else
- return 0;
+ return ctx->Version >= 30
+ || (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
+ ? GL_DEPTH_COMPONENT : 0;
case GL_DEPTH32F_STENCIL8:
- if (ctx->Extensions.ARB_depth_buffer_float)
- return GL_DEPTH_STENCIL;
- else
- return 0;
+ return ctx->Version >= 30
+ || (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
+ ? GL_DEPTH_STENCIL : 0;
case GL_RED:
- case GL_R8:
case GL_R16:
- return ctx->Extensions.ARB_texture_rg ? GL_RED : 0;
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_rg
+ ? GL_RED : 0;
+ case GL_R8:
+ return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
+ ? GL_RED : 0;
case GL_RG:
- case GL_RG8:
case GL_RG16:
- return ctx->Extensions.ARB_texture_rg ? GL_RG : 0;
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_rg
+ ? GL_RG : 0;
+ case GL_RG8:
+ return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
+ ? GL_RG : 0;
/* signed normalized texture formats */
- case GL_RED_SNORM:
case GL_R8_SNORM:
+ return ctx->Version >= 30
+ || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ ? GL_RED : 0;
+ case GL_RED_SNORM:
case GL_R16_SNORM:
- return ctx->Extensions.EXT_texture_snorm ? GL_RED : 0;
- case GL_RG_SNORM:
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+ ? GL_RED : 0;
case GL_RG8_SNORM:
+ return ctx->Version >= 30
+ || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ ? GL_RG : 0;
+ case GL_RG_SNORM:
case GL_RG16_SNORM:
- return ctx->Extensions.EXT_texture_snorm ? GL_RG : 0;
- case GL_RGB_SNORM:
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+ ? GL_RG : 0;
case GL_RGB8_SNORM:
+ return ctx->Version >= 30
+ || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ ? GL_RGB : 0;
+ case GL_RGB_SNORM:
case GL_RGB16_SNORM:
- return ctx->Extensions.EXT_texture_snorm ? GL_RGB : 0;
- case GL_RGBA_SNORM:
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+ ? GL_RGB : 0;
case GL_RGBA8_SNORM:
+ return ctx->Version >= 30
+ || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ ? GL_RGBA : 0;
+ case GL_RGBA_SNORM:
case GL_RGBA16_SNORM:
- return ctx->Extensions.EXT_texture_snorm ? GL_RGBA : 0;
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+ ? GL_RGBA : 0;
case GL_ALPHA_SNORM:
case GL_ALPHA8_SNORM:
case GL_ALPHA16_SNORM:
- return ctx->Extensions.EXT_texture_snorm &&
+ return ctx->API == API_OPENGL &&
+ 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->Extensions.EXT_texture_snorm &&
+ return ctx->API == API_OPENGL &&
+ 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->Extensions.EXT_texture_snorm &&
+ return ctx->API == API_OPENGL &&
+ 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->Extensions.EXT_texture_snorm &&
+ return ctx->API == API_OPENGL &&
+ ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_R16F:
case GL_R32F:
- return ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.ARB_texture_float ? GL_RED : 0;
+ return ctx->Version >= 30
+ || (ctx->API == API_OPENGL &&
+ ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
case GL_RG16F:
case GL_RG32F:
- return ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.ARB_texture_float ? GL_RG : 0;
+ return ctx->Version >= 30
+ || (ctx->API == API_OPENGL &&
+ ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
case GL_RGB16F:
case GL_RGB32F:
- return ctx->Extensions.ARB_texture_float ? GL_RGB : 0;
+ return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
+ || _mesa_is_gles3(ctx)
+ ? GL_RGB : 0;
case GL_RGBA16F:
case GL_RGBA32F:
- return ctx->Extensions.ARB_texture_float ? GL_RGBA : 0;
+ return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
+ || _mesa_is_gles3(ctx)
+ ? GL_RGBA : 0;
case GL_ALPHA16F_ARB:
case GL_ALPHA32F_ARB:
- return ctx->Extensions.ARB_texture_float &&
+ return ctx->API == API_OPENGL &&
+ ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
case GL_LUMINANCE16F_ARB:
case GL_LUMINANCE32F_ARB:
- return ctx->Extensions.ARB_texture_float &&
+ return ctx->API == API_OPENGL &&
+ 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->Extensions.ARB_texture_float &&
+ return ctx->API == API_OPENGL &&
+ ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
case GL_INTENSITY16F_ARB:
case GL_INTENSITY32F_ARB:
- return ctx->Extensions.ARB_texture_float &&
+ return ctx->API == API_OPENGL &&
+ ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_RGB9_E5:
- return ctx->Extensions.EXT_texture_shared_exponent ? GL_RGB : 0;
+ return (_mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.EXT_texture_shared_exponent)
+ || _mesa_is_gles3(ctx) ? GL_RGB : 0;
case GL_R11F_G11F_B10F:
- return ctx->Extensions.EXT_packed_float ? GL_RGB : 0;
+ return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float)
+ || _mesa_is_gles3(ctx) ? GL_RGB : 0;
case GL_RGBA8UI_EXT:
case GL_RGBA16UI_EXT:
@@ -1229,8 +1282,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGBA8I_EXT:
case GL_RGBA16I_EXT:
case GL_RGBA32I_EXT:
- return ctx->Version >= 30 ||
- ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
+ return ctx->Version >= 30
+ || (_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.EXT_texture_integer) ? GL_RGBA : 0;
case GL_RGB8UI_EXT:
case GL_RGB16UI_EXT:
@@ -1238,8 +1292,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGB8I_EXT:
case GL_RGB16I_EXT:
case GL_RGB32I_EXT:
- return ctx->Version >= 30 ||
- ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
+ return ctx->Version >= 30
+ || (_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.EXT_texture_integer) ? GL_RGB : 0;
case GL_R8UI:
case GL_R8I:
@@ -1247,9 +1302,10 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_R16I:
case GL_R32UI:
case GL_R32I:
- return ctx->Version >= 30 ||
- (ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
+ return ctx->Version >= 30
+ || (_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
case GL_RG8UI:
case GL_RG8I:
@@ -1257,9 +1313,10 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RG16I:
case GL_RG32UI:
case GL_RG32I:
- return ctx->Version >= 30 ||
- (ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
+ return ctx->Version >= 30
+ || (_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
case GL_INTENSITY8I_EXT:
case GL_INTENSITY8UI_EXT:
@@ -1267,7 +1324,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_INTENSITY16UI_EXT:
case GL_INTENSITY32I_EXT:
case GL_INTENSITY32UI_EXT:
- return ctx->Extensions.EXT_texture_integer &&
+ return ctx->API == API_OPENGL &&
+ ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_LUMINANCE8I_EXT:
@@ -1276,7 +1334,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE16UI_EXT:
case GL_LUMINANCE32I_EXT:
case GL_LUMINANCE32UI_EXT:
- return ctx->Extensions.EXT_texture_integer &&
+ return ctx->API == API_OPENGL &&
+ ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
case GL_LUMINANCE_ALPHA8I_EXT:
@@ -1285,7 +1344,8 @@ _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->Extensions.EXT_texture_integer &&
+ return ctx->API == API_OPENGL &&
+ ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
case GL_ALPHA8I_EXT:
@@ -1294,14 +1354,18 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_ALPHA16UI_EXT:
case GL_ALPHA32I_EXT:
case GL_ALPHA32UI_EXT:
- return ctx->Extensions.EXT_texture_integer &&
+ return ctx->API == API_OPENGL &&
+ ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
case GL_RGB10_A2UI:
- return ctx->Extensions.ARB_texture_rgb10_a2ui ? GL_RGBA : 0;
+ return (_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.ARB_texture_rgb10_a2ui)
+ || _mesa_is_gles3(ctx) ? GL_RGBA : 0;
case GL_RGB565:
- return ctx->Extensions.ARB_ES2_compatibility ? GL_RGB : 0;
+ return _mesa_is_gles(ctx) || ctx->Extensions.ARB_ES2_compatibility
+ ? GL_RGB : 0;
default:
return 0;
}
@@ -1572,7 +1636,8 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params)
*params = get_component_bits(pname, rb->_BaseFormat, rb->Format);
break;
case GL_RENDERBUFFER_SAMPLES:
- if (ctx->Extensions.ARB_framebuffer_object) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_framebuffer_object)
+ || _mesa_is_gles3(ctx)) {
*params = rb->NumSamples;
break;
}
@@ -2137,7 +2202,8 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
error = GL_FALSE;
break;
case GL_TEXTURE_RECTANGLE:
- error = !ctx->Extensions.NV_texture_rectangle;
+ error = _mesa_is_gles(ctx)
+ || !ctx->Extensions.NV_texture_rectangle;
break;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
@@ -2148,7 +2214,8 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
error = !ctx->Extensions.ARB_texture_cube_map;
break;
case GL_TEXTURE_2D_ARRAY:
- error = !ctx->Extensions.EXT_texture_array;
+ error = (_mesa_is_gles(ctx) && ctx->Version < 30)
+ || !ctx->Extensions.EXT_texture_array;
break;
default:
error = GL_TRUE;
@@ -2360,11 +2427,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
}
else {
assert(att->Type == GL_NONE);
- if (_mesa_is_desktop_gl(ctx)) {
+ if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
*params = 0;
} else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
+ goto invalid_pname_enum;
}
}
return;
@@ -2377,8 +2443,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
"glGetFramebufferAttachmentParameterivEXT(pname)");
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
+ goto invalid_pname_enum;
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT:
@@ -2395,12 +2460,16 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
"glGetFramebufferAttachmentParameterivEXT(pname)");
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
+ goto invalid_pname_enum;
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT:
- if (att->Type == GL_TEXTURE) {
+ if (ctx->API == API_OPENGLES) {
+ goto invalid_pname_enum;
+ } else if (att->Type == GL_NONE) {
+ _mesa_error(ctx, err,
+ "glGetFramebufferAttachmentParameterivEXT(pname)");
+ } else if (att->Type == GL_TEXTURE) {
if (att->Texture && att->Texture->Target == GL_TEXTURE_3D) {
*params = att->Zoffset;
}
@@ -2408,19 +2477,14 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
*params = 0;
}
}
- else if (att->Type == GL_NONE) {
- _mesa_error(ctx, err,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
- }
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
+ goto invalid_pname_enum;
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
- if (!ctx->Extensions.ARB_framebuffer_object) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object)
+ && !_mesa_is_gles3(ctx)) {
+ goto invalid_pname_enum;
}
else if (att->Type == GL_NONE) {
_mesa_error(ctx, err,
@@ -2438,10 +2502,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
- if (!ctx->Extensions.ARB_framebuffer_object) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
- return;
+ if ((ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object)
+ && ctx->API != API_OPENGL_CORE
+ && !_mesa_is_gles3(ctx)) {
+ goto invalid_pname_enum;
}
else if (att->Type == GL_NONE) {
_mesa_error(ctx, err,
@@ -2473,9 +2537,9 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
- if (!ctx->Extensions.ARB_framebuffer_object) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object)
+ && !_mesa_is_gles3(ctx)) {
+ goto invalid_pname_enum;
}
else if (att->Type == GL_NONE) {
_mesa_error(ctx, err,
@@ -2503,10 +2567,15 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
}
return;
default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetFramebufferAttachmentParameterivEXT(pname)");
- return;
+ goto invalid_pname_enum;
}
+
+ return;
+
+invalid_pname_enum:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetFramebufferAttachmentParameteriv(pname)");
+ return;
}
@@ -2524,16 +2593,23 @@ _mesa_GenerateMipmapEXT(GLenum target)
switch (target) {
case GL_TEXTURE_1D:
+ error = _mesa_is_gles(ctx);
+ break;
case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
error = GL_FALSE;
break;
+ case GL_TEXTURE_3D:
+ error = ctx->API == API_OPENGLES;
+ break;
case GL_TEXTURE_CUBE_MAP:
error = !ctx->Extensions.ARB_texture_cube_map;
break;
case GL_TEXTURE_1D_ARRAY:
+ error = _mesa_is_gles(ctx) || !ctx->Extensions.EXT_texture_array;
+ break;
case GL_TEXTURE_2D_ARRAY:
- error = !ctx->Extensions.EXT_texture_array;
+ error = (_mesa_is_gles(ctx) && ctx->Version < 30)
+ || !ctx->Extensions.EXT_texture_array;
break;
default:
error = GL_TRUE;
diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c
index d65add930..07405fb4b 100644
--- a/mesalib/src/mesa/main/fog.c
+++ b/mesalib/src/mesa/main/fog.c
@@ -141,6 +141,8 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
update_fog_scale(ctx);
break;
case GL_FOG_INDEX:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
if (ctx->Fog.Index == *params)
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
@@ -161,7 +163,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
break;
case GL_FOG_COORDINATE_SOURCE_EXT: {
GLenum p = (GLenum) (GLint) *params;
- if (!ctx->Extensions.EXT_fog_coord ||
+ if (ctx->API != API_OPENGL || !ctx->Extensions.EXT_fog_coord ||
(p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFog");
return;
@@ -174,7 +176,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
}
case GL_FOG_DISTANCE_MODE_NV: {
GLenum p = (GLenum) (GLint) *params;
- if (!ctx->Extensions.NV_fog_distance ||
+ if (ctx->API != API_OPENGL || !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;
@@ -186,13 +188,18 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
break;
}
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
- return;
+ goto invalid_pname;
}
if (ctx->Driver.Fogfv) {
(*ctx->Driver.Fogfv)( ctx, pname, params );
}
+
+ return;
+
+invalid_pname:
+ _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 332dfaf7f..fe1035be8 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -284,6 +284,12 @@ static const int extra_GLSL_130[] = {
EXTRA_END
};
+static const int extra_texture_buffer_object[] = {
+ EXTRA_VERSION_31,
+ EXT(ARB_texture_buffer_object),
+ EXTRA_END
+};
+
static const int extra_ARB_uniform_buffer_object_and_geometry_shader[] = {
EXT(ARB_uniform_buffer_object),
EXT(ARB_geometry_shader4),
@@ -316,7 +322,6 @@ EXTRA_EXT(ARB_fragment_shader);
EXTRA_EXT(ARB_fragment_program);
EXTRA_EXT2(ARB_framebuffer_object, EXT_framebuffer_multisample);
EXTRA_EXT(EXT_framebuffer_object);
-EXTRA_EXT(APPLE_vertex_array_object);
EXTRA_EXT(ARB_seamless_cube_map);
EXTRA_EXT(EXT_compiled_vertex_array);
EXTRA_EXT(ARB_sync);
@@ -530,6 +535,9 @@ static const struct value_desc values[] = {
* GLSL: */
{ GL_MAX_CLIP_PLANES, CONTEXT_INT(Const.MaxClipPlanes), NO_EXTRA },
+ /* GL_{APPLE,ARB,OES}_vertex_array_object */
+ { GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name), NO_EXTRA },
+
#if FEATURE_GL || FEATURE_ES1
/* Enums in OpenGL and GLES1 */
{ 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGL_CORE_BIT, NO_EXTRA },
@@ -701,10 +709,19 @@ static const struct value_desc values[] = {
#endif /* FEATURE_ES1 */
#if FEATURE_GL || FEATURE_ES2
- { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES2_BIT, NO_EXTRA },
+ { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGL_CORE_BIT | API_OPENGLES2_BIT, NO_EXTRA },
{ GL_MAX_TEXTURE_COORDS_ARB, /* == GL_MAX_TEXTURE_COORDS_NV */
CONTEXT_INT(Const.MaxTextureCoordUnits),
extra_ARB_fragment_program_NV_fragment_program },
+ { GL_PACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Pack.ImageHeight), NO_EXTRA },
+ { GL_PACK_ROW_LENGTH, CONTEXT_INT(Pack.RowLength), NO_EXTRA },
+ { GL_PACK_SKIP_PIXELS, CONTEXT_INT(Pack.SkipPixels), NO_EXTRA },
+ { GL_PACK_SKIP_ROWS, CONTEXT_INT(Pack.SkipRows), NO_EXTRA },
+ { GL_UNPACK_ROW_LENGTH, CONTEXT_INT(Unpack.RowLength), NO_EXTRA },
+ { GL_UNPACK_SKIP_PIXELS, CONTEXT_INT(Unpack.SkipPixels), NO_EXTRA },
+ { GL_UNPACK_SKIP_ROWS, CONTEXT_INT(Unpack.SkipRows), NO_EXTRA },
+ { GL_UNPACK_SKIP_IMAGES_EXT, CONTEXT_INT(Unpack.SkipImages), NO_EXTRA },
+ { GL_UNPACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Unpack.ImageHeight), NO_EXTRA },
/* GL_ARB_draw_buffers */
{ GL_MAX_DRAW_BUFFERS_ARB, CONTEXT_INT(Const.MaxDrawBuffers), NO_EXTRA },
@@ -882,11 +899,7 @@ static const struct value_desc values[] = {
{ GL_MAX_PIXEL_MAP_TABLE, CONST(MAX_PIXEL_MAP_TABLE), NO_EXTRA },
{ GL_NAME_STACK_DEPTH, CONTEXT_INT(Select.NameStackDepth), NO_EXTRA },
{ GL_PACK_LSB_FIRST, CONTEXT_BOOL(Pack.LsbFirst), NO_EXTRA },
- { GL_PACK_ROW_LENGTH, CONTEXT_INT(Pack.RowLength), NO_EXTRA },
- { GL_PACK_SKIP_PIXELS, CONTEXT_INT(Pack.SkipPixels), NO_EXTRA },
- { GL_PACK_SKIP_ROWS, CONTEXT_INT(Pack.SkipRows), NO_EXTRA },
{ GL_PACK_SWAP_BYTES, CONTEXT_BOOL(Pack.SwapBytes), NO_EXTRA },
- { GL_PACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Pack.ImageHeight), NO_EXTRA },
{ GL_PACK_INVERT_MESA, CONTEXT_BOOL(Pack.Invert), NO_EXTRA },
{ GL_PIXEL_MAP_A_TO_A_SIZE, CONTEXT_INT(PixelMaps.AtoA.Size), NO_EXTRA },
{ GL_PIXEL_MAP_B_TO_B_SIZE, CONTEXT_INT(PixelMaps.BtoB.Size), NO_EXTRA },
@@ -936,12 +949,7 @@ static const struct value_desc values[] = {
{ GL_TEXTURE_GEN_Q, LOC_TEXUNIT, TYPE_BIT_3,
offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA },
{ GL_UNPACK_LSB_FIRST, CONTEXT_BOOL(Unpack.LsbFirst), NO_EXTRA },
- { GL_UNPACK_ROW_LENGTH, CONTEXT_INT(Unpack.RowLength), NO_EXTRA },
- { GL_UNPACK_SKIP_PIXELS, CONTEXT_INT(Unpack.SkipPixels), NO_EXTRA },
- { GL_UNPACK_SKIP_ROWS, CONTEXT_INT(Unpack.SkipRows), NO_EXTRA },
{ GL_UNPACK_SWAP_BYTES, CONTEXT_BOOL(Unpack.SwapBytes), NO_EXTRA },
- { GL_UNPACK_SKIP_IMAGES_EXT, CONTEXT_INT(Unpack.SkipImages), NO_EXTRA },
- { GL_UNPACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Unpack.ImageHeight), NO_EXTRA },
{ GL_ZOOM_X, CONTEXT_FLOAT(Pixel.ZoomX), NO_EXTRA },
{ GL_ZOOM_Y, CONTEXT_FLOAT(Pixel.ZoomY), NO_EXTRA },
@@ -1207,10 +1215,6 @@ static const struct value_desc values[] = {
{ GL_MAX_SAMPLES, CONTEXT_INT(Const.MaxSamples),
extra_ARB_framebuffer_object_EXT_framebuffer_multisample },
- /* GL_APPLE_vertex_array_object */
- { GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name),
- extra_APPLE_vertex_array_object },
-
/* GL_ARB_seamless_cube_map */
{ GL_TEXTURE_CUBE_MAP_SEAMLESS,
CONTEXT_BOOL(Texture.CubeMapSeamless), extra_ARB_seamless_cube_map },
@@ -1287,15 +1291,15 @@ static const struct value_desc values[] = {
/* GL_ARB_texture_buffer_object */
{ GL_MAX_TEXTURE_BUFFER_SIZE_ARB, CONTEXT_INT(Const.MaxTextureBufferSize),
- extra_ARB_texture_buffer_object },
+ extra_texture_buffer_object },
{ GL_TEXTURE_BINDING_BUFFER_ARB, LOC_CUSTOM, TYPE_INT, 0,
- extra_ARB_texture_buffer_object },
+ extra_texture_buffer_object },
{ GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
- TEXTURE_BUFFER_INDEX, extra_ARB_texture_buffer_object },
+ TEXTURE_BUFFER_INDEX, extra_texture_buffer_object },
{ GL_TEXTURE_BUFFER_FORMAT_ARB, LOC_CUSTOM, TYPE_INT, 0,
- extra_ARB_texture_buffer_object },
+ extra_texture_buffer_object },
{ GL_TEXTURE_BUFFER_ARB, LOC_CUSTOM, TYPE_INT, 0,
- extra_ARB_texture_buffer_object },
+ extra_texture_buffer_object },
/* GL_ARB_sampler_objects / GL 3.3 */
{ GL_SAMPLER_BINDING,
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index 1734fb3f5..9c9ade359 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -126,26 +126,35 @@ _mesa_GetString( GLenum name )
case GL_VERSION:
return (const GLubyte *) ctx->VersionString;
case GL_EXTENSIONS:
+ if (ctx->API == API_OPENGL_CORE) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetString(GL_EXTENSIONS)");
+ return (const GLubyte *) 0;
+ }
return (const GLubyte *) ctx->Extensions.String;
#if FEATURE_ARB_shading_language_100 || FEATURE_ES2
case GL_SHADING_LANGUAGE_VERSION:
+ if (ctx->API == API_OPENGLES)
+ break;
return shading_language_version(ctx);
#endif
#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \
FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
case GL_PROGRAM_ERROR_STRING_NV:
- if (ctx->Extensions.NV_fragment_program ||
- ctx->Extensions.ARB_fragment_program ||
- ctx->Extensions.NV_vertex_program ||
- ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL &&
+ (ctx->Extensions.NV_fragment_program ||
+ ctx->Extensions.ARB_fragment_program ||
+ ctx->Extensions.NV_vertex_program ||
+ ctx->Extensions.ARB_vertex_program)) {
return (const GLubyte *) ctx->Program.ErrorString;
}
- /* FALL-THROUGH */
+ break;
#endif
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
- return (const GLubyte *) 0;
+ break;
}
+
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
+ return (const GLubyte *) 0;
}
@@ -203,50 +212,81 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
switch (pname) {
case GL_VERTEX_ARRAY_POINTER:
+ if (ctx->API != API_OPENGL && 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)
+ 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)
+ 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)
+ 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)
+ goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Ptr;
break;
case GL_INDEX_ARRAY_POINTER:
+ if (ctx->API != API_OPENGL)
+ 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)
+ 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)
+ goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr;
break;
case GL_FEEDBACK_BUFFER_POINTER:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
*params = ctx->Feedback.Buffer;
break;
case GL_SELECTION_BUFFER_POINTER:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
*params = ctx->Select.Buffer;
break;
#if FEATURE_point_size_array
case GL_POINT_SIZE_ARRAY_POINTER_OES:
+ if (ctx->API != API_OPENGLES)
+ goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Ptr;
break;
#endif
case GL_DEBUG_CALLBACK_FUNCTION_ARB:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_pname;
*params = (GLvoid *) ctx->Debug.Callback;
break;
case GL_DEBUG_CALLBACK_USER_PARAM_ARB:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_pname;
*params = ctx->Debug.CallbackData;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
- return;
+ goto invalid_pname;
}
+
+ return;
+
+invalid_pname:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
+ return;
}
diff --git a/mesalib/src/mesa/main/hint.c b/mesalib/src/mesa/main/hint.c
index ff8d88fff..90130e3db 100644
--- a/mesalib/src/mesa/main/hint.c
+++ b/mesalib/src/mesa/main/hint.c
@@ -51,30 +51,40 @@ _mesa_Hint( GLenum target, GLenum mode )
switch (target) {
case GL_FOG_HINT:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_target;
if (ctx->Hint.Fog == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.Fog = mode;
break;
case GL_LINE_SMOOTH_HINT:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_target;
if (ctx->Hint.LineSmooth == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.LineSmooth = mode;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_target;
if (ctx->Hint.PerspectiveCorrection == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.PerspectiveCorrection = mode;
break;
case GL_POINT_SMOOTH_HINT:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_target;
if (ctx->Hint.PointSmooth == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.PointSmooth = mode;
break;
case GL_POLYGON_SMOOTH_HINT:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_target;
if (ctx->Hint.PolygonSmooth == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
@@ -83,6 +93,8 @@ _mesa_Hint( GLenum target, GLenum mode )
/* GL_EXT_clip_volume_hint */
case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
+ if (ctx->API != API_OPENGL)
+ goto invalid_target;
if (ctx->Hint.ClipVolumeClipping == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
@@ -91,6 +103,8 @@ _mesa_Hint( GLenum target, GLenum mode )
/* GL_ARB_texture_compression */
case GL_TEXTURE_COMPRESSION_HINT_ARB:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_target;
if (ctx->Hint.TextureCompression == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
@@ -99,6 +113,8 @@ _mesa_Hint( GLenum target, GLenum mode )
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
+ if (ctx->API == API_OPENGL_CORE)
+ goto invalid_target;
if (ctx->Hint.GenerateMipmap == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
@@ -107,10 +123,8 @@ _mesa_Hint( GLenum target, GLenum mode )
/* GL_ARB_fragment_shader */
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
- if (!ctx->Extensions.ARB_fragment_shader) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
- return;
- }
+ if (ctx->API == API_OPENGLES || !ctx->Extensions.ARB_fragment_shader)
+ goto invalid_target;
if (ctx->Hint.FragmentShaderDerivative == mode)
return;
FLUSH_VERTICES(ctx, _NEW_HINT);
@@ -118,13 +132,18 @@ _mesa_Hint( GLenum target, GLenum mode )
break;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
- return;
+ goto invalid_target;
}
if (ctx->Driver.Hint) {
(*ctx->Driver.Hint)( ctx, target, mode );
}
+
+ return;
+
+invalid_target:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
+ return;
}
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index d6fbcd9be..cfb53dc06 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -466,6 +466,8 @@ _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)
+ goto invalid_pname;
newbool = (params[0]!=0.0);
if (ctx->Light.Model.LocalViewer == newbool)
return;
@@ -484,6 +486,8 @@ _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)
+ goto invalid_pname;
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
newenum = GL_SINGLE_COLOR;
else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR)
@@ -499,12 +503,17 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
ctx->Light.Model.ColorControl = newenum;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
- break;
+ goto invalid_pname;
}
if (ctx->Driver.LightModelfv)
ctx->Driver.LightModelfv( ctx, pname, params );
+
+ return;
+
+invalid_pname:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
+ return;
}
@@ -789,6 +798,10 @@ _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) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" );
+ return;
+ }
params[0] = mat[MAT_ATTRIB_INDEXES(f)][0];
params[1] = mat[MAT_ATTRIB_INDEXES(f)][1];
params[2] = mat[MAT_ATTRIB_INDEXES(f)][2];
@@ -807,6 +820,8 @@ _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);
+
FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */
if (face==GL_FRONT) {
diff --git a/mesalib/src/mesa/main/lines.c b/mesalib/src/mesa/main/lines.c
index 79bf5679d..e400b3913 100644
--- a/mesalib/src/mesa/main/lines.c
+++ b/mesalib/src/mesa/main/lines.c
@@ -51,6 +51,23 @@ _mesa_LineWidth( GLfloat width )
return;
}
+ /* Page 407 (page 423 of the PDF) of the OpenGL 3.0 spec says (in the list
+ * of deprecated functionality):
+ *
+ * "Wide lines and line stipple - LineWidth is not deprecated, but
+ * values greater than 1.0 will generate an INVALID_VALUE error;"
+ *
+ * This is one of the very few cases where functionality was deprecated but
+ * *NOT* removed in a later spec. Therefore, we only disallow this in a
+ * forward compatible context.
+ */
+ if (ctx->API == API_OPENGL_CORE
+ && ((ctx->Const.ContextFlags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
+ != 0)) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
+ return;
+ }
+
if (ctx->Line.Width == width)
return;
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index d1df2ce1b..5af9487cb 100644
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -200,11 +200,16 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
(a)[3] == (b)[3])
/** Test for equality (unsigned bytes) */
+static inline GLboolean
+TEST_EQ_4UBV(const GLubyte a[4], const GLubyte b[4])
+{
#if defined(__i386__)
-#define TEST_EQ_4UBV(DST, SRC) *((GLuint*)(DST)) == *((GLuint*)(SRC))
+ return *((const GLuint *) a) == *((const GLuint *) b);
#else
-#define TEST_EQ_4UBV(DST, SRC) TEST_EQ_4V(DST, SRC)
+ return TEST_EQ_4V(a, b);
#endif
+}
+
/** Copy a 4-element vector */
#define COPY_4V( DST, SRC ) \
@@ -215,40 +220,25 @@ do { \
(DST)[3] = (SRC)[3]; \
} while (0)
-/** Copy a 4-element vector with cast */
-#define COPY_4V_CAST( DST, SRC, CAST ) \
-do { \
- (DST)[0] = (CAST)(SRC)[0]; \
- (DST)[1] = (CAST)(SRC)[1]; \
- (DST)[2] = (CAST)(SRC)[2]; \
- (DST)[3] = (CAST)(SRC)[3]; \
-} while (0)
-
/** Copy a 4-element unsigned byte vector */
+static inline void
+COPY_4UBV(GLubyte dst[4], const GLubyte src[4])
+{
#if defined(__i386__)
-#define COPY_4UBV(DST, SRC) \
-do { \
- *((GLuint*)(DST)) = *((GLuint*)(SRC)); \
-} while (0)
+ *((GLuint *) dst) = *((GLuint *) src);
#else
-/* The GLuint cast might fail if DST or SRC are not dword-aligned (RISC) */
-#define COPY_4UBV(DST, SRC) \
-do { \
- (DST)[0] = (SRC)[0]; \
- (DST)[1] = (SRC)[1]; \
- (DST)[2] = (SRC)[2]; \
- (DST)[3] = (SRC)[3]; \
-} while (0)
+ /* The GLuint cast might fail if DST or SRC are not dword-aligned (RISC) */
+ COPY_4V(dst, src);
#endif
+}
-/**
- * Copy a 4-element float vector
- * memcpy seems to be most efficient
- */
-#define COPY_4FV( DST, SRC ) \
-do { \
- memcpy(DST, SRC, sizeof(GLfloat) * 4); \
-} while (0)
+/** Copy a 4-element float vector */
+static inline void
+COPY_4FV(GLfloat dst[4], const GLfloat src[4])
+{
+ /* memcpy seems to be most efficient */
+ memcpy(dst, src, sizeof(GLfloat) * 4);
+}
/** Copy \p SZ elements into a 4-element vector */
#define COPY_SZ_4V(DST, SZ, SRC) \
@@ -584,34 +574,31 @@ do { \
/*@}*/
-/** \name Linear interpolation macros */
+/** \name Linear interpolation functions */
/*@{*/
-/**
- * Linear interpolation
- *
- * \note \p OUT argument is evaluated twice!
- * \note Be wary of using *coord++ as an argument to any of these macros!
- */
-#define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT)))
-
-#define INTERP_F( t, dstf, outf, inf ) \
- dstf = LINTERP( t, outf, inf )
-
-#define INTERP_4F( t, dst, out, in ) \
-do { \
- dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \
- dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \
- dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \
- dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \
-} while (0)
-
-#define INTERP_3F( t, dst, out, in ) \
-do { \
- dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \
- dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \
- dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \
-} while (0)
+static inline GLfloat
+LINTERP(GLfloat t, GLfloat out, GLfloat in)
+{
+ return out + t * (in - out);
+}
+
+static inline void
+INTERP_3F(GLfloat t, GLfloat dst[3], const GLfloat out[3], const GLfloat in[3])
+{
+ dst[0] = LINTERP( t, out[0], in[0] );
+ dst[1] = LINTERP( t, out[1], in[1] );
+ dst[2] = LINTERP( t, out[2], in[2] );
+}
+
+static inline void
+INTERP_4F(GLfloat t, GLfloat dst[4], const GLfloat out[4], const GLfloat in[4])
+{
+ dst[0] = LINTERP( t, out[0], in[0] );
+ dst[1] = LINTERP( t, out[1], in[1] );
+ dst[2] = LINTERP( t, out[2], in[2] );
+ dst[3] = LINTERP( t, out[3], in[3] );
+}
/*@}*/
@@ -630,43 +617,76 @@ do { \
#define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
-/** Dot product of two 2-element vectors */
-#define DOT2( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] )
-
-/** Dot product of two 3-element vectors */
-#define DOT3( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + (a)[2]*(b)[2] )
-
-/** Dot product of two 4-element vectors */
-#define DOT4( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + \
- (a)[2]*(b)[2] + (a)[3]*(b)[3] )
/** Cross product of two 3-element vectors */
-#define CROSS3(n, u, v) \
-do { \
- (n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \
- (n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \
- (n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0]; \
-} while (0)
+static inline void
+CROSS3(GLfloat n[3], const GLfloat u[3], const GLfloat v[3])
+{
+ n[0] = u[1] * v[2] - u[2] * v[1];
+ n[1] = u[2] * v[0] - u[0] * v[2];
+ n[2] = u[0] * v[1] - u[1] * v[0];
+}
-/* Normalize a 3-element vector to unit length. */
-#define NORMALIZE_3FV( V ) \
-do { \
- GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \
- if (len) { \
- len = INV_SQRTF(len); \
- (V)[0] = (GLfloat) ((V)[0] * len); \
- (V)[1] = (GLfloat) ((V)[1] * len); \
- (V)[2] = (GLfloat) ((V)[2] * len); \
- } \
-} while(0)
+/** Dot product of two 2-element vectors */
+static inline GLfloat
+DOT2(const GLfloat a[2], const GLfloat b[2])
+{
+ return a[0] * b[0] + a[1] * b[1];
+}
+
+static inline GLfloat
+DOT3(const GLfloat a[3], const GLfloat b[3])
+{
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+}
+
+static inline GLfloat
+DOT4(const GLfloat a[4], const GLfloat b[4])
+{
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+}
+
+
+static inline GLfloat
+LEN_SQUARED_3FV(const GLfloat v[3])
+{
+ return DOT3(v, v);
+}
+
+static inline GLfloat
+LEN_SQUARED_2FV(const GLfloat v[2])
+{
+ return DOT2(v, v);
+}
+
+
+static inline GLfloat
+LEN_3FV(const GLfloat v[3])
+{
+ return SQRTF(LEN_SQUARED_3FV(v));
+}
+
+static inline GLfloat
+LEN_2FV(const GLfloat v[2])
+{
+ return SQRTF(LEN_SQUARED_2FV(v));
+}
-#define LEN_3FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2]))
-#define LEN_2FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]))
-#define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])
-#define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1])
+/* Normalize a 3-element vector to unit length. */
+static inline void
+NORMALIZE_3FV(GLfloat v[3])
+{
+ GLfloat len = (GLfloat) LEN_SQUARED_3FV(v);
+ if (len) {
+ len = INV_SQRTF(len);
+ v[0] *= len;
+ v[1] *= len;
+ v[2] *= len;
+ }
+}
/** Compute ceiling of integer quotient of A divided by B. */
diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c
index b09fa4d3d..7157433de 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_NV:
case GL_MATRIX6_NV:
case GL_MATRIX7_NV:
- if (ctx->Extensions.NV_vertex_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.NV_vertex_program) {
ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV];
}
else {
@@ -203,8 +203,9 @@ _mesa_MatrixMode( GLenum mode )
case GL_MATRIX5_ARB:
case GL_MATRIX6_ARB:
case GL_MATRIX7_ARB:
- if (ctx->Extensions.ARB_vertex_program ||
- ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL
+ && (ctx->Extensions.ARB_vertex_program ||
+ ctx->Extensions.ARB_fragment_program)) {
const GLuint m = mode - GL_MATRIX0_ARB;
if (m > ctx->Const.MaxProgramMatrices) {
_mesa_error(ctx, GL_INVALID_ENUM,
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 58111a737..ba43e574d 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2999,7 +2999,6 @@ struct gl_extensions
GLboolean ARB_transform_feedback_instanced;
GLboolean ARB_transpose_matrix;
GLboolean ARB_uniform_buffer_object;
- GLboolean ARB_vertex_array_object;
GLboolean ARB_vertex_program;
GLboolean ARB_vertex_shader;
GLboolean ARB_vertex_type_2_10_10_10_rev;
@@ -3052,7 +3051,6 @@ struct gl_extensions
/* vendor extensions */
GLboolean AMD_seamless_cubemap_per_texture;
GLboolean APPLE_packed_pixels;
- GLboolean APPLE_vertex_array_object;
GLboolean APPLE_object_purgeable;
GLboolean ATI_envmap_bumpmap;
GLboolean ATI_texture_compression_3dc;
diff --git a/mesalib/src/mesa/main/pixelstore.c b/mesalib/src/mesa/main/pixelstore.c
index 81474491d..d1e96aa8f 100644
--- a/mesalib/src/mesa/main/pixelstore.c
+++ b/mesalib/src/mesa/main/pixelstore.c
@@ -45,18 +45,24 @@ _mesa_PixelStorei( GLenum pname, GLint param )
switch (pname) {
case GL_PACK_SWAP_BYTES:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (param == (GLint)ctx->Pack.SwapBytes)
return;
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
break;
case GL_PACK_LSB_FIRST:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (param == (GLint)ctx->Pack.LsbFirst)
return;
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
break;
case GL_PACK_ROW_LENGTH:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -67,6 +73,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Pack.RowLength = param;
break;
case GL_PACK_IMAGE_HEIGHT:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -77,6 +85,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Pack.ImageHeight = param;
break;
case GL_PACK_SKIP_PIXELS:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -87,6 +97,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Pack.SkipPixels = param;
break;
case GL_PACK_SKIP_ROWS:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -97,6 +109,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Pack.SkipRows = param;
break;
case GL_PACK_SKIP_IMAGES:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -117,6 +131,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Pack.Alignment = param;
break;
case GL_PACK_INVERT_MESA:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (!ctx->Extensions.MESA_pack_invert) {
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
return;
@@ -128,6 +144,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
break;
case GL_UNPACK_SWAP_BYTES:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (param == (GLint)ctx->Unpack.SwapBytes)
return;
if ((GLint)ctx->Unpack.SwapBytes == param)
@@ -136,6 +154,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
break;
case GL_UNPACK_LSB_FIRST:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
if (param == (GLint)ctx->Unpack.LsbFirst)
return;
if ((GLint)ctx->Unpack.LsbFirst == param)
@@ -144,6 +164,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
break;
case GL_UNPACK_ROW_LENGTH:
+ if (ctx->API == API_OPENGLES)
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -154,6 +176,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Unpack.RowLength = param;
break;
case GL_UNPACK_IMAGE_HEIGHT:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -165,6 +189,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Unpack.ImageHeight = param;
break;
case GL_UNPACK_SKIP_PIXELS:
+ if (ctx->API == API_OPENGLES)
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -175,6 +201,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Unpack.SkipPixels = param;
break;
case GL_UNPACK_SKIP_ROWS:
+ if (ctx->API == API_OPENGLES)
+ goto invalid_enum_error;
if (param<0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -185,6 +213,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Unpack.SkipRows = param;
break;
case GL_UNPACK_SKIP_IMAGES:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_enum_error;
if (param < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
return;
@@ -205,9 +235,14 @@ _mesa_PixelStorei( GLenum pname, GLint param )
ctx->Unpack.Alignment = param;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
- return;
+ goto invalid_enum_error;
}
+
+ return;
+
+invalid_enum_error:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
+ return;
}
diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c
index 87bfae27e..538f3cf44 100644
--- a/mesalib/src/mesa/main/points.c
+++ b/mesalib/src/mesa/main/points.c
@@ -104,88 +104,74 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ /* Drivers that support point sprites must also support point parameters.
+ * If point parameters aren't supported, then this function shouldn't even
+ * exist.
+ */
+ ASSERT(!(ctx->Extensions.ARB_point_sprite
+ || ctx->Extensions.NV_point_sprite)
+ || ctx->Extensions.EXT_point_parameters);
+
+ if (!ctx->Extensions.EXT_point_parameters) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "unsupported function called (unsupported extension)");
+ return;
+ }
+
switch (pname) {
case GL_DISTANCE_ATTENUATION_EXT:
- if (ctx->Extensions.EXT_point_parameters) {
- if (TEST_EQ_3V(ctx->Point.Params, params))
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- COPY_3V(ctx->Point.Params, params);
- ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
- ctx->Point.Params[1] != 0.0 ||
- ctx->Point.Params[2] != 0.0);
-
- if (ctx->Point._Attenuated)
- ctx->_TriangleCaps |= DD_POINT_ATTEN;
- else
- ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
+ if (TEST_EQ_3V(ctx->Point.Params, params))
return;
- }
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ COPY_3V(ctx->Point.Params, params);
+ ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
+ ctx->Point.Params[1] != 0.0 ||
+ ctx->Point.Params[2] != 0.0);
+
+ if (ctx->Point._Attenuated)
+ ctx->_TriangleCaps |= DD_POINT_ATTEN;
+ else
+ ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
break;
case GL_POINT_SIZE_MIN_EXT:
- if (ctx->Extensions.EXT_point_parameters) {
- if (params[0] < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glPointParameterf[v]{EXT,ARB}(param)" );
- return;
- }
- if (ctx->Point.MinSize == params[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.MinSize = params[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
return;
}
+ if (ctx->Point.MinSize == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.MinSize = params[0];
break;
case GL_POINT_SIZE_MAX_EXT:
- if (ctx->Extensions.EXT_point_parameters) {
- if (params[0] < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glPointParameterf[v]{EXT,ARB}(param)" );
- return;
- }
- if (ctx->Point.MaxSize == params[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.MaxSize = params[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
return;
}
+ if (ctx->Point.MaxSize == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.MaxSize = params[0];
break;
case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
- if (ctx->Extensions.EXT_point_parameters) {
- if (params[0] < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glPointParameterf[v]{EXT,ARB}(param)" );
- return;
- }
- if (ctx->Point.Threshold == params[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.Threshold = params[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glPointParameterf[v]{EXT,ARB}(pname)");
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
return;
}
+ if (ctx->Point.Threshold == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.Threshold = params[0];
break;
case GL_POINT_SPRITE_R_MODE_NV:
/* This is one area where ARB_point_sprite and NV_point_sprite
* differ. In ARB_point_sprite the POINT_SPRITE_R_MODE is
* always ZERO. NV_point_sprite adds the S and R modes.
*/
- if (ctx->Extensions.NV_point_sprite) {
+ if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.NV_point_sprite) {
GLenum value = (GLenum) params[0];
if (value != GL_ZERO && value != GL_S && value != GL_R) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -204,12 +190,11 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
}
break;
case GL_POINT_SPRITE_COORD_ORIGIN:
- /* This is not completely correct. GL_POINT_SPRITE_COORD_ORIGIN was
- * added to point sprites when the extension was merged into OpenGL
- * 2.0. It is expected that an implementation supporting OpenGL 1.4
- * and GL_ARB_point_sprite will generate an error here.
+ /* GL_POINT_SPRITE_COORD_ORIGIN was added to point sprites when the
+ * extension was merged into OpenGL 2.0.
*/
- if (ctx->Extensions.ARB_point_sprite) {
+ if ((ctx->API == API_OPENGL && ctx->Version >= 20)
+ || ctx->API == API_OPENGL_CORE) {
GLenum value = (GLenum) params[0];
if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -263,7 +248,19 @@ _mesa_init_point(struct gl_context *ctx)
ctx->Point.MaxSize
= MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA);
ctx->Point.Threshold = 1.0;
- ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */
+
+ /* Page 403 (page 423 of the PDF) of the OpenGL 3.0 spec says:
+ *
+ * "Non-sprite points (section 3.4) - Enable/Disable targets
+ * POINT_SMOOTH and POINT_SPRITE, and all associated state. Point
+ * rasterization is always performed as though POINT_SPRITE were
+ * enabled."
+ *
+ * In a core context, the state will default to true, and the setters and
+ * getters are disabled.
+ */
+ ctx->Point.PointSprite = (ctx->API == API_OPENGL_CORE);
+
ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */
ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */
for (i = 0; i < Elements(ctx->Point.CoordReplace); i++) {
diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c
index addca0228..d7d52daa8 100644
--- a/mesalib/src/mesa/main/polygon.c
+++ b/mesalib/src/mesa/main/polygon.c
@@ -143,6 +143,10 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
switch (face) {
case GL_FRONT:
+ if (ctx->API == API_OPENGL_CORE) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
+ return;
+ }
if (ctx->Polygon.FrontMode == mode)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
@@ -157,6 +161,10 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
ctx->Polygon.BackMode = mode;
break;
case GL_BACK:
+ if (ctx->API == API_OPENGL_CORE) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
+ return;
+ }
if (ctx->Polygon.BackMode == mode)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c
index f0bc157d8..7dc758152 100644
--- a/mesalib/src/mesa/main/readpix.c
+++ b/mesalib/src/mesa/main/readpix.c
@@ -38,7 +38,13 @@
#include "state.h"
#include "glformats.h"
#include "fbobject.h"
+#include "teximage.h"
+/* Inexplicably, GL_HALF_FLOAT_OES has a different value than GL_HALF_FLOAT.
+ */
+#ifndef GL_HALF_FLOAT_OES
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif
/**
* Tries to implement glReadPixels() of GL_DEPTH_COMPONENT using memcpy of the
@@ -699,6 +705,33 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
+ /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
+ * combinations of format and type that can be used.
+ *
+ * Technically, only two combinations are actually allowed:
+ * GL_RGBA/GL_UNSIGNED_BYTE, and some implementation-specific internal
+ * preferred combination. This code doesn't know what that preferred
+ * combination is, and Mesa can handle anything valid. Just work instead.
+ */
+ if (_mesa_is_gles(ctx) && ctx->Version < 30) {
+ err = _mesa_es_error_check_format_and_type(format, type, 2);
+ if (err == GL_NO_ERROR) {
+ if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
+ err = GL_INVALID_OPERATION;
+ } else if (format == GL_DEPTH_COMPONENT
+ || format == GL_DEPTH_STENCIL) {
+ err = GL_INVALID_ENUM;
+ }
+ }
+
+ if (err != GL_NO_ERROR) {
+ _mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)",
+ _mesa_lookup_enum_by_nr(format),
+ _mesa_lookup_enum_by_nr(type));
+ return;
+ }
+ }
+
if (ctx->NewState)
_mesa_update_state(ctx);
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index e5f1bd39e..f1064c5e3 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -122,7 +122,8 @@ set_combiner_mode(struct gl_context *ctx,
break;
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
- legal = (ctx->Extensions.EXT_texture_env_dot3 &&
+ legal = (ctx->API == API_OPENGL &&
+ ctx->Extensions.EXT_texture_env_dot3 &&
pname == GL_COMBINE_RGB);
break;
case GL_DOT3_RGB:
@@ -133,10 +134,12 @@ 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->Extensions.ATI_texture_env_combine3;
+ legal = (ctx->API == API_OPENGL &&
+ ctx->Extensions.ATI_texture_env_combine3);
break;
case GL_BUMP_ENVMAP_ATI:
- legal = (ctx->Extensions.ATI_envmap_bumpmap &&
+ legal = (ctx->API == API_OPENGL &&
+ ctx->Extensions.ATI_envmap_bumpmap &&
pname == GL_COMBINE_RGB);
break;
default:
@@ -203,7 +206,8 @@ set_combiner_source(struct gl_context *ctx,
return;
}
- if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) {
+ if ((term == 3) && (ctx->API != API_OPENGL
+ || !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
@@ -232,11 +236,13 @@ set_combiner_source(struct gl_context *ctx,
param - GL_TEXTURE0 < ctx->Const.MaxTextureUnits);
break;
case GL_ZERO:
- legal = (ctx->Extensions.ATI_texture_env_combine3 ||
- ctx->Extensions.NV_texture_env_combine4);
+ legal = (ctx->API == API_OPENGL &&
+ (ctx->Extensions.ATI_texture_env_combine3 ||
+ ctx->Extensions.NV_texture_env_combine4));
break;
case GL_ONE:
- legal = ctx->Extensions.ATI_texture_env_combine3;
+ legal = (ctx->API == API_OPENGL &&
+ ctx->Extensions.ATI_texture_env_combine3);
break;
default:
legal = GL_FALSE;
@@ -287,7 +293,8 @@ set_combiner_operand(struct gl_context *ctx,
return;
}
- if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) {
+ if ((term == 3) && (ctx->API != API_OPENGL
+ || !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
@@ -301,8 +308,8 @@ set_combiner_operand(struct gl_context *ctx,
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
/* The color input can only be used with GL_OPERAND[01]_RGB in the EXT
- * version. In the ARB and NV versions they can be used for any RGB
- * operand.
+ * version. In the ARB and NV versions and OpenGL ES 1.x they can be
+ * used for any RGB operand.
*/
legal = !alpha
&& ((term < 2) || ctx->Extensions.ARB_texture_env_combine
@@ -311,7 +318,7 @@ set_combiner_operand(struct gl_context *ctx,
case GL_ONE_MINUS_SRC_ALPHA:
/* GL_ONE_MINUS_SRC_ALPHA can only be used with
* GL_OPERAND[01]_(RGB|ALPHA) in the EXT version. In the ARB and NV
- * versions it can be used for any operand.
+ * versions and OpenGL ES 1.x it can be used for any operand.
*/
legal = (term < 2) || ctx->Extensions.ARB_texture_env_combine
|| ctx->Extensions.NV_texture_env_combine4;
@@ -435,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->Extensions.ATI_envmap_bumpmap) {
+ if (ctx->API != API_OPENGL || !ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
return;
}
@@ -581,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->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.SourceRGB[3];
}
else {
@@ -595,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->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.SourceA[3];
}
else {
@@ -609,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->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.OperandRGB[3];
}
else {
@@ -623,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->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.OperandA[3];
}
else {
@@ -636,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->Extensions.ATI_envmap_bumpmap) {
+ if (ctx->API == API_OPENGL && 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 0ace0b936..3788669d4 100644
--- a/mesalib/src/mesa/main/texgen.c
+++ b/mesalib/src/mesa/main/texgen.c
@@ -48,8 +48,14 @@
* Return texgen state for given coordinate
*/
static struct gl_texgen *
-get_texgen(struct gl_texture_unit *texUnit, GLenum coord)
+get_texgen(struct gl_context *ctx, struct gl_texture_unit *texUnit,
+ GLenum coord)
{
+ if (ctx->API == API_OPENGLES) {
+ return (coord == GL_TEXTURE_GEN_STR_OES)
+ ? &texUnit->GenS : NULL;
+ }
+
switch (coord) {
case GL_S:
return &texUnit->GenS;
@@ -87,7 +93,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)");
return;
@@ -126,6 +132,12 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
+ if (ctx->API != API_OPENGL
+ && (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texgen->Mode = mode;
texgen->_ModeBit = bit;
@@ -134,6 +146,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_OBJECT_PLANE:
{
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
if (TEST_EQ_4V(texgen->ObjectPlane, params))
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -144,6 +160,12 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_EYE_PLANE:
{
GLfloat tmp[4];
+
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+
/* Transform plane equation by the inverse modelview matrix */
if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
_math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
@@ -198,7 +220,6 @@ _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
void GLAPIENTRY
_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
_mesa_GetTexGenfv(GL_S, pname, params);
}
@@ -206,7 +227,11 @@ _es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
void GLAPIENTRY
_es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ if (coord != GL_TEXTURE_GEN_STR_OES) {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGen[fx](pname)" );
+ return;
+ }
/* set S, T, and R at the same time */
_mesa_TexGenf(GL_S, pname, param);
_mesa_TexGenf(GL_T, pname, param);
@@ -217,7 +242,11 @@ _es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
void GLAPIENTRY
_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ if (coord != GL_TEXTURE_GEN_STR_OES) {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGen[fx]v(pname)" );
+ return;
+ }
/* set S, T, and R at the same time */
_mesa_TexGenfv(GL_S, pname, params);
_mesa_TexGenfv(GL_T, pname, params);
@@ -279,7 +308,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)");
return;
@@ -317,7 +346,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)");
return;
@@ -328,9 +357,17 @@ _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) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
+ return;
+ }
COPY_4V(params, texgen->ObjectPlane);
break;
case GL_EYE_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
+ return;
+ }
COPY_4V(params, texgen->EyePlane);
break;
default:
@@ -340,7 +377,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
-static void GLAPIENTRY
+void GLAPIENTRY
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
{
struct gl_texture_unit *texUnit;
@@ -355,7 +392,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)");
return;
@@ -366,12 +403,20 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
params[0] = texgen->Mode;
break;
case GL_OBJECT_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
+ return;
+ }
params[0] = (GLint) texgen->ObjectPlane[0];
params[1] = (GLint) texgen->ObjectPlane[1];
params[2] = (GLint) texgen->ObjectPlane[2];
params[3] = (GLint) texgen->ObjectPlane[3];
break;
case GL_EYE_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
+ return;
+ }
params[0] = (GLint) texgen->EyePlane[0];
params[1] = (GLint) texgen->EyePlane[1];
params[2] = (GLint) texgen->EyePlane[2];
diff --git a/mesalib/src/mesa/main/texgen.h b/mesalib/src/mesa/main/texgen.h
index 60a9522af..1d13422b2 100644
--- a/mesalib/src/mesa/main/texgen.h
+++ b/mesalib/src/mesa/main/texgen.h
@@ -48,6 +48,9 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
extern void GLAPIENTRY
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+extern void GLAPIENTRY
+_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );
+
extern void
_mesa_init_texgen_dispatch(struct _glapi_table *disp);
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 59b38dee4..11b1b3043 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -87,14 +87,14 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
- return GL_ALPHA;
+ return (ctx->API != API_OPENGL_CORE) ? GL_ALPHA : -1;
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE4:
case GL_LUMINANCE8:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
- return GL_LUMINANCE;
+ return (ctx->API != API_OPENGL_CORE) ? GL_LUMINANCE : -1;
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
@@ -103,14 +103,15 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- return GL_LUMINANCE_ALPHA;
+ return (ctx->API != API_OPENGL_CORE) ? GL_LUMINANCE_ALPHA : -1;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
- return GL_INTENSITY;
+ return (ctx->API != API_OPENGL_CORE) ? GL_INTENSITY : -1;
case 3:
+ return (ctx->API != API_OPENGL_CORE) ? GL_RGB : -1;
case GL_RGB:
case GL_R3_G3_B2:
case GL_RGB4:
@@ -121,6 +122,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_RGB16:
return GL_RGB;
case 4:
+ return (ctx->API != API_OPENGL_CORE) ? GL_RGBA : -1;
case GL_RGBA:
case GL_RGBA2:
case GL_RGBA4:
@@ -754,7 +756,8 @@ _mesa_select_tex_object(struct gl_context *ctx,
case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
case GL_TEXTURE_BUFFER:
- return ctx->Extensions.ARB_texture_buffer_object
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_texture_buffer_object
? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
case GL_TEXTURE_EXTERNAL_OES:
return ctx->Extensions.OES_EGL_image_external
@@ -947,9 +950,9 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
ctx->Extensions.EXT_texture_array)
? ctx->Const.MaxTextureLevels : 0;
case GL_TEXTURE_BUFFER:
- return _mesa_is_desktop_gl(ctx) &&
- (ctx->Extensions.ARB_texture_buffer_object ||
- (ctx->Version >= 31)) ? 1 : 0;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_texture_buffer_object
+ ? 1 : 0;
case GL_TEXTURE_EXTERNAL_OES:
/* fall-through */
default:
@@ -2796,6 +2799,37 @@ _mesa_choose_texture_format(struct gl_context *ctx,
}
}
+ /* If the application requested compression to an S3TC format but we don't
+ * have the DTXn library, force a generic compressed format instead.
+ */
+ if (internalFormat != format) {
+ const GLenum before = internalFormat;
+
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ if (!ctx->Mesa_DXTn)
+ internalFormat = GL_COMPRESSED_RGB;
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ if (!ctx->Mesa_DXTn)
+ internalFormat = GL_COMPRESSED_RGBA;
+ break;
+ default:
+ break;
+ }
+
+ if (before != internalFormat) {
+ _mesa_warning(ctx,
+ "DXT compression requested (%s), "
+ "but libtxc_dxtn library not installed. Using %s "
+ "instead.",
+ _mesa_lookup_enum_by_nr(before),
+ _mesa_lookup_enum_by_nr(internalFormat));
+ }
+ }
+
/* choose format from scratch */
f = ctx->Driver.ChooseTextureFormat(ctx, texObj->Target, internalFormat,
format, type);
@@ -3975,7 +4009,8 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (!ctx->Extensions.ARB_texture_buffer_object) {
+ if (!(ctx->Extensions.ARB_texture_buffer_object
+ && _mesa_is_desktop_gl(ctx))) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer");
return;
}
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 638e418da..513f3bb05 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -1216,6 +1216,11 @@ _mesa_BindTexture( GLenum target, GLuint texName )
}
}
else {
+ if (ctx->API == API_OPENGL_CORE) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindTexture");
+ return;
+ }
+
/* if this is a new texture id, allocate a texture object now */
newTexObj = ctx->Driver.NewTextureObject(ctx, texName, target);
if (!newTexObj) {
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 8c3ddc524..91452b75f 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -133,6 +133,23 @@ update_array(struct gl_context *ctx,
GLsizei elementSize;
GLenum format = GL_RGBA;
+ /* Page 407 (page 423 of the PDF) of the OpenGL 3.0 spec says:
+ *
+ * "Client vertex arrays - all vertex array attribute pointers must
+ * refer to buffer objects (section 2.9.2). The default vertex array
+ * object (the name zero) is also deprecated. Calling
+ * VertexAttribPointer when no buffer object or no vertex array object
+ * is bound will generate an INVALID_OPERATION error..."
+ *
+ * The check for VBOs is handled below.
+ */
+ if (ctx->API == API_OPENGL_CORE
+ && (ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no array object bound)",
+ func);
+ return;
+ }
+
if (_mesa_is_gles(ctx)) {
/* Once Mesa gets support for GL_OES_vertex_half_float this mask will
* change. Adding support for this extension isn't quite as trivial as
@@ -216,11 +233,20 @@ update_array(struct gl_context *ctx,
return;
}
- if (ctx->Array.ArrayObj->ARBsemantics &&
+ /* Page 29 (page 44 of the PDF) of the OpenGL 3.3 spec says:
+ *
+ * "An INVALID_OPERATION error is generated under any of the following
+ * conditions:
+ *
+ * ...
+ *
+ * * any of the *Pointer commands specifying the location and
+ * organization of vertex array data are called while zero is bound
+ * to the ARRAY_BUFFER buffer object binding point (see section
+ * 2.9.6), and the pointer argument is not NULL."
+ */
+ if (ptr != NULL && ctx->Array.ArrayObj->ARBsemantics &&
!_mesa_is_bufferobj(ctx->Array.ArrayBufferObj)) {
- /* GL_ARB_vertex_array_object requires that all arrays reside in VBOs.
- * Generate GL_INVALID_OPERATION if that's not true.
- */
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func);
return;
}
@@ -590,12 +616,15 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
return array->BufferObj->Name;
case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- if (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4) {
+ if ((_mesa_is_desktop_gl(ctx)
+ && (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))
+ || _mesa_is_gles3(ctx)) {
return array->Integer;
}
goto error;
case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB:
- if (ctx->Extensions.ARB_instanced_arrays) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_instanced_arrays)
+ || _mesa_is_gles3(ctx)) {
return array->InstanceDivisor;
}
goto error;
@@ -613,7 +642,13 @@ static const GLfloat *
get_current_attrib(struct gl_context *ctx, GLuint index, const char *function)
{
if (index == 0) {
- if (ctx->API != API_OPENGLES2) {
+ /* In OpenGL 3.1 attribute 0 becomes non-magic, just like in OpenGL ES
+ * 2.0. Note that we cannot just check for API_OPENGL_CORE here because
+ * that will erroneously allow this usage in a 3.0 forward-compatible
+ * context too.
+ */
+ if ((ctx->API != API_OPENGL_CORE || ctx->Version < 31)
+ && ctx->API != API_OPENGLES2) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(index==0)", function);
return NULL;
}
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 59c81aedc..f22118a0d 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -137,7 +137,6 @@ compute_version(struct gl_context *ctx)
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.ARB_texture_compression_rgtc &&
- ctx->Extensions.APPLE_vertex_array_object &&
ctx->Extensions.EXT_draw_buffers2 &&
ctx->Extensions.ARB_framebuffer_object &&
ctx->Extensions.EXT_framebuffer_sRGB &&
diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h
index 94a9855d9..5b2e85afd 100644
--- a/mesalib/src/mesa/main/version.h
+++ b/mesalib/src/mesa/main/version.h
@@ -32,10 +32,10 @@ struct gl_context;
/* Mesa version */
-#define MESA_MAJOR 8
-#define MESA_MINOR 1
+#define MESA_MAJOR 9
+#define MESA_MINOR 0
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "8.1-devel"
+#define MESA_VERSION_STRING "9.0-devel"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index ce490ed9e..2b6e25ecd 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -48,9 +48,8 @@ static void
install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
const GLvertexformat *vfmt)
{
- _mesa_install_arrayelt_vtxfmt(tab, vfmt);
-
if (ctx->API != API_OPENGL_CORE) {
+ _mesa_install_arrayelt_vtxfmt(tab, vfmt);
SET_Color3f(tab, vfmt->Color3f);
SET_Color3fv(tab, vfmt->Color3fv);
SET_Color4f(tab, vfmt->Color4f);
@@ -58,7 +57,9 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_EdgeFlag(tab, vfmt->EdgeFlag);
}
- _mesa_install_eval_vtxfmt(tab, vfmt);
+ if (ctx->API == API_OPENGL) {
+ _mesa_install_eval_vtxfmt(tab, vfmt);
+ }
if (ctx->API != API_OPENGL_CORE) {
SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
@@ -94,7 +95,9 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Vertex4fv(tab, vfmt->Vertex4fv);
}
- _mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */
+ if (ctx->API == API_OPENGL) {
+ _mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */
+ }
if (ctx->API != API_OPENGL_CORE) {
SET_Begin(tab, vfmt->Begin);
@@ -218,8 +221,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
void
_mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
{
- if (_mesa_is_desktop_gl(ctx))
- install_vtxfmt( ctx, ctx->Exec, vfmt );
+ install_vtxfmt( ctx, ctx->Exec, vfmt );
}
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index 7f7ea2885..dabddf2fe 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -6,7 +6,6 @@
# this is part of MAIN_FILES
MAIN_ES_FILES = \
$(BUILDDIR)main/api_exec_es1.c \
- $(BUILDDIR)main/api_exec_es2.c \
$(SRCDIR)main/es1_conversion.c
MAIN_FILES = \
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 5e482d9f7..ac11f127c 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -495,7 +495,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
ctx->Extensions.ARB_texture_storage = GL_TRUE;
- ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
ctx->Extensions.ARB_vertex_program = GL_TRUE;
ctx->Extensions.ARB_vertex_shader = GL_TRUE;
ctx->Extensions.ARB_window_pos = GL_TRUE;
@@ -516,8 +515,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
- ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
-
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
ctx->Extensions.MESA_pack_invert = GL_TRUE;
diff --git a/mesalib/src/mesa/swrast/s_lines.c b/mesalib/src/mesa/swrast/s_lines.c
index 2078be43b..cfd3e6fa9 100644
--- a/mesalib/src/mesa/swrast/s_lines.c
+++ b/mesalib/src/mesa/swrast/s_lines.c
@@ -188,8 +188,8 @@ _swrast_add_spec_terms_line(struct gl_context *ctx,
/* draw */
SWRAST_CONTEXT(ctx)->SpecLine( ctx, ncv0, ncv1 );
/* restore original colors */
- COPY_CHAN4( ncv0->attrib[FRAG_ATTRIB_COL0], cSave[0] );
- COPY_CHAN4( ncv1->attrib[FRAG_ATTRIB_COL0], cSave[1] );
+ COPY_CHAN4(ncv0->color, cSave[0]);
+ COPY_CHAN4(ncv1->color, cSave[1]);
}
diff --git a/mesalib/src/mesa/tnl/t_vertex_generic.c b/mesalib/src/mesa/tnl/t_vertex_generic.c
index 7b7f511ce..44d625028 100644
--- a/mesalib/src/mesa/tnl/t_vertex_generic.c
+++ b/mesalib/src/mesa/tnl/t_vertex_generic.c
@@ -1049,10 +1049,7 @@ void _tnl_generic_interp( struct gl_context *ctx,
a[j].extract( &a[j], fin, vin + a[j].vertoffset );
a[j].extract( &a[j], fout, vout + a[j].vertoffset );
- INTERP_F( t, fdst[3], fout[3], fin[3] );
- INTERP_F( t, fdst[2], fout[2], fin[2] );
- INTERP_F( t, fdst[1], fout[1], fin[1] );
- INTERP_F( t, fdst[0], fout[0], fin[0] );
+ INTERP_4F(t, fdst, fout, fin);
a[j].insert[4-1]( &a[j], vdst + a[j].vertoffset, fdst );
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index fc7e40692..781e360d2 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -457,10 +457,10 @@ vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
updateMats = ALL_MATERIAL_BITS;
}
- if (face == GL_FRONT) {
+ if (ctx->API == API_OPENGL && face == GL_FRONT) {
updateMats &= FRONT_MATERIAL_BITS;
}
- else if (face == GL_BACK) {
+ else if (ctx->API == API_OPENGL && face == GL_BACK) {
updateMats &= BACK_MATERIAL_BITS;
}
else if (face != GL_FRONT_AND_BACK) {
@@ -506,6 +506,10 @@ vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
MAT_ATTR(VBO_ATTRIB_MAT_BACK_SHININESS, 1, params);
break;
case GL_COLOR_INDEXES:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMaterialfv(pname)");
+ return;
+ }
if (updateMats & MAT_BIT_FRONT_INDEXES)
MAT_ATTR(VBO_ATTRIB_MAT_FRONT_INDEXES, 3, params);
if (updateMats & MAT_BIT_BACK_INDEXES)
@@ -894,6 +898,7 @@ vbo_exec_PrimitiveRestartNV(void)
static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
{
+ struct gl_context *ctx = exec->ctx;
GLvertexformat *vfmt = &exec->vtxfmt;
_MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
@@ -942,14 +947,25 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
vfmt->Vertex4f = vbo_Vertex4f;
vfmt->Vertex4fv = vbo_Vertex4fv;
- vfmt->VertexAttrib1fARB = vbo_VertexAttrib1fARB;
- vfmt->VertexAttrib1fvARB = vbo_VertexAttrib1fvARB;
- vfmt->VertexAttrib2fARB = vbo_VertexAttrib2fARB;
- vfmt->VertexAttrib2fvARB = vbo_VertexAttrib2fvARB;
- vfmt->VertexAttrib3fARB = vbo_VertexAttrib3fARB;
- vfmt->VertexAttrib3fvARB = vbo_VertexAttrib3fvARB;
- vfmt->VertexAttrib4fARB = vbo_VertexAttrib4fARB;
- vfmt->VertexAttrib4fvARB = vbo_VertexAttrib4fvARB;
+ if (ctx->API == API_OPENGLES2) {
+ vfmt->VertexAttrib1fARB = _es_VertexAttrib1f;
+ vfmt->VertexAttrib1fvARB = _es_VertexAttrib1fv;
+ vfmt->VertexAttrib2fARB = _es_VertexAttrib2f;
+ vfmt->VertexAttrib2fvARB = _es_VertexAttrib2fv;
+ vfmt->VertexAttrib3fARB = _es_VertexAttrib3f;
+ vfmt->VertexAttrib3fvARB = _es_VertexAttrib3fv;
+ vfmt->VertexAttrib4fARB = _es_VertexAttrib4f;
+ vfmt->VertexAttrib4fvARB = _es_VertexAttrib4fv;
+ } else {
+ vfmt->VertexAttrib1fARB = vbo_VertexAttrib1fARB;
+ vfmt->VertexAttrib1fvARB = vbo_VertexAttrib1fvARB;
+ vfmt->VertexAttrib2fARB = vbo_VertexAttrib2fARB;
+ vfmt->VertexAttrib2fvARB = vbo_VertexAttrib2fvARB;
+ vfmt->VertexAttrib3fARB = vbo_VertexAttrib3fARB;
+ vfmt->VertexAttrib3fvARB = vbo_VertexAttrib3fvARB;
+ vfmt->VertexAttrib4fARB = vbo_VertexAttrib4fARB;
+ vfmt->VertexAttrib4fvARB = vbo_VertexAttrib4fvARB;
+ }
vfmt->VertexAttrib1fNV = vbo_VertexAttrib1fNV;
vfmt->VertexAttrib1fvNV = vbo_VertexAttrib1fvNV;