aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/accum.c3
-rw-r--r--mesalib/src/mesa/main/api_exec.h4
-rw-r--r--mesalib/src/mesa/main/api_validate.c7
-rw-r--r--mesalib/src/mesa/main/arbprogram.c19
-rw-r--r--mesalib/src/mesa/main/arrayobj.c3
-rw-r--r--mesalib/src/mesa/main/attrib.c6
-rw-r--r--mesalib/src/mesa/main/blend.c14
-rw-r--r--mesalib/src/mesa/main/bufferobj.c11
-rw-r--r--mesalib/src/mesa/main/buffers.c9
-rw-r--r--mesalib/src/mesa/main/clear.c15
-rw-r--r--mesalib/src/mesa/main/clip.c2
-rw-r--r--mesalib/src/mesa/main/colortab.c10
-rw-r--r--mesalib/src/mesa/main/context.c125
-rw-r--r--mesalib/src/mesa/main/context.h25
-rw-r--r--mesalib/src/mesa/main/dd.h8
-rw-r--r--mesalib/src/mesa/main/depth.c4
-rw-r--r--mesalib/src/mesa/main/dlist.c1010
-rw-r--r--mesalib/src/mesa/main/dlist.h2
-rw-r--r--mesalib/src/mesa/main/drawpix.c9
-rw-r--r--mesalib/src/mesa/main/enable.c6
-rw-r--r--mesalib/src/mesa/main/errors.c9
-rw-r--r--mesalib/src/mesa/main/errors.h3
-rw-r--r--mesalib/src/mesa/main/eval.c10
-rw-r--r--mesalib/src/mesa/main/extensions.c22
-rw-r--r--mesalib/src/mesa/main/fbobject.c205
-rw-r--r--mesalib/src/mesa/main/feedback.c8
-rw-r--r--mesalib/src/mesa/main/fog.c1
-rw-r--r--mesalib/src/mesa/main/framebuffer.c28
-rw-r--r--mesalib/src/mesa/main/get.c15
-rw-r--r--mesalib/src/mesa/main/getstring.c1
-rw-r--r--mesalib/src/mesa/main/glformats.c16
-rw-r--r--mesalib/src/mesa/main/glformats.h3
-rw-r--r--mesalib/src/mesa/main/hint.c1
-rw-r--r--mesalib/src/mesa/main/light.c11
-rw-r--r--mesalib/src/mesa/main/lines.c2
-rw-r--r--mesalib/src/mesa/main/matrix.c28
-rw-r--r--mesalib/src/mesa/main/mtypes.h27
-rw-r--r--mesalib/src/mesa/main/multisample.c2
-rw-r--r--mesalib/src/mesa/main/pixel.c12
-rw-r--r--mesalib/src/mesa/main/pixelstore.c1
-rw-r--r--mesalib/src/mesa/main/points.c2
-rw-r--r--mesalib/src/mesa/main/polygon.c6
-rw-r--r--mesalib/src/mesa/main/queryobj.c37
-rw-r--r--mesalib/src/mesa/main/queryobj.h4
-rw-r--r--mesalib/src/mesa/main/rastpos.c4
-rw-r--r--mesalib/src/mesa/main/readpix.c85
-rw-r--r--mesalib/src/mesa/main/samplerobj.c47
-rw-r--r--mesalib/src/mesa/main/samplerobj.h4
-rw-r--r--mesalib/src/mesa/main/scissor.c1
-rw-r--r--mesalib/src/mesa/main/shaderapi.c91
-rw-r--r--mesalib/src/mesa/main/shaderapi.h4
-rw-r--r--mesalib/src/mesa/main/stencil.c11
-rwxr-xr-x[-rw-r--r--]mesalib/src/mesa/main/syncobj.c17
-rwxr-xr-x[-rw-r--r--]mesalib/src/mesa/main/syncobj.h3
-rw-r--r--mesalib/src/mesa/main/texcompress_etc_tmp.h4
-rw-r--r--mesalib/src/mesa/main/texenv.c11
-rw-r--r--mesalib/src/mesa/main/texgen.c4
-rw-r--r--mesalib/src/mesa/main/texgetimage.c6
-rw-r--r--mesalib/src/mesa/main/teximage.c99
-rw-r--r--mesalib/src/mesa/main/texobj.c16
-rw-r--r--mesalib/src/mesa/main/texparam.c11
-rw-r--r--mesalib/src/mesa/main/texstate.c81
-rw-r--r--mesalib/src/mesa/main/texturebarrier.c1
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c4
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp18
-rw-r--r--mesalib/src/mesa/main/uniforms.c45
-rw-r--r--mesalib/src/mesa/main/uniforms.h5
-rw-r--r--mesalib/src/mesa/main/varray.c54
-rw-r--r--mesalib/src/mesa/main/viewport.c5
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c2
70 files changed, 697 insertions, 1682 deletions
diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c
index 6416ee860..f5888017f 100644
--- a/mesalib/src/mesa/main/accum.c
+++ b/mesalib/src/mesa/main/accum.c
@@ -41,7 +41,6 @@ _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
{
GLfloat tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
tmp[0] = CLAMP( red, -1.0F, 1.0F );
tmp[1] = CLAMP( green, -1.0F, 1.0F );
@@ -59,7 +58,7 @@ void GLAPIENTRY
_mesa_Accum( GLenum op, GLfloat value )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
switch (op) {
case GL_ADD:
diff --git a/mesalib/src/mesa/main/api_exec.h b/mesalib/src/mesa/main/api_exec.h
index 8292c12de..94f7f41c1 100644
--- a/mesalib/src/mesa/main/api_exec.h
+++ b/mesalib/src/mesa/main/api_exec.h
@@ -31,10 +31,12 @@ struct _glapi_table;
struct gl_context;
extern struct _glapi_table *
-_mesa_alloc_dispatch_table(int size);
+_mesa_alloc_dispatch_table(void);
extern void
_mesa_initialize_exec_table(struct gl_context *ctx);
+extern void
+_mesa_initialize_dispatch_tables(struct gl_context *ctx);
#endif
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 133fb6370..53b00211b 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -313,7 +313,6 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
/* From the GLES3 specification, section 2.14.2 (Transform Feedback
@@ -380,7 +379,6 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx,
{
unsigned i;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
for (i = 0; i < primcount; i++) {
@@ -444,7 +442,6 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
/* From the GLES3 specification, section 2.14.2 (Transform Feedback
@@ -514,7 +511,6 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
{
struct gl_transform_feedback_object *xfb_obj
= ctx->TransformFeedback.CurrentObject;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
if (count <= 0) {
@@ -568,7 +564,6 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
{
struct gl_transform_feedback_object *xfb_obj
= ctx->TransformFeedback.CurrentObject;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
if (count <= 0) {
@@ -637,7 +632,6 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
const GLvoid *indices, GLsizei numInstances,
GLint basevertex)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
/* From the GLES3 specification, section 2.14.2 (Transform Feedback
@@ -707,7 +701,6 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx,
GLuint stream,
GLsizei numInstances)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback*(mode)")) {
diff --git a/mesalib/src/mesa/main/arbprogram.c b/mesalib/src/mesa/main/arbprogram.c
index 8150b5f4e..5730ea495 100644
--- a/mesalib/src/mesa/main/arbprogram.c
+++ b/mesalib/src/mesa/main/arbprogram.c
@@ -50,7 +50,6 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
{
struct gl_program *curProg, *newProg;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
/* Error-check target and get curProg */
if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
@@ -136,7 +135,8 @@ _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids)
{
GLint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (n < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" );
@@ -190,7 +190,6 @@ _mesa_GenProgramsARB(GLsizei n, GLuint *ids)
GLuint first;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGenPrograms");
@@ -304,7 +303,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
{
struct gl_program *base;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
@@ -385,7 +383,6 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
GLfloat *param;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -408,7 +405,6 @@ _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
GLfloat *param;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -425,7 +421,6 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
{
GET_CURRENT_CONTEXT(ctx);
GLfloat * dest;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -480,8 +475,6 @@ _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index,
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (get_env_param_pointer(ctx, "glGetProgramEnvParameterfv",
target, index, &param)) {
COPY_4V(params, param);
@@ -495,7 +488,6 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *param;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -522,7 +514,6 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
{
GET_CURRENT_CONTEXT(ctx);
GLfloat *dest;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -581,7 +572,6 @@ _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
{
GLfloat *param;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT",
target, index, &param)) {
@@ -596,7 +586,6 @@ _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index,
{
GLfloat *param;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT",
target, index, &param)) {
@@ -612,8 +601,6 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
struct gl_program *prog;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (target == GL_VERTEX_PROGRAM_ARB
&& ctx->Extensions.ARB_vertex_program) {
prog = &(ctx->VertexProgram.Current->Base);
@@ -796,8 +783,6 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
char *dst = (char *) string;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (target == GL_VERTEX_PROGRAM_ARB) {
prog = &(ctx->VertexProgram.Current->Base);
}
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 032af43b5..ac3e7e666 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -338,7 +338,6 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
{
struct gl_array_object * const oldObj = ctx->Array.ArrayObj;
struct gl_array_object *newObj = NULL;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
ASSERT(oldObj != NULL);
@@ -435,7 +434,6 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
{
GET_CURRENT_CONTEXT(ctx);
GLsizei i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArrayAPPLE(n)");
@@ -480,7 +478,6 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
{
GLuint first;
GLint i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGenVertexArraysAPPLE");
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index d6f298d93..a95128328 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -204,7 +204,6 @@ _mesa_PushAttrib(GLbitfield mask)
struct gl_attrib_node *head;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glPushAttrib %x\n", (int) mask);
@@ -831,7 +830,7 @@ _mesa_PopAttrib(void)
{
struct gl_attrib_node *attr, *next;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (ctx->AttribStackDepth == 0) {
_mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" );
@@ -1496,7 +1495,6 @@ _mesa_PushClientAttrib(GLbitfield mask)
struct gl_attrib_node *head;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->ClientAttribStackDepth >= MAX_CLIENT_ATTRIB_STACK_DEPTH) {
_mesa_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" );
@@ -1541,7 +1539,7 @@ _mesa_PopClientAttrib(void)
struct gl_attrib_node *node, *next;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (ctx->ClientAttribStackDepth == 0) {
_mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" );
diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c
index 1930b1c37..309f1d538 100644
--- a/mesalib/src/mesa/main/blend.c
+++ b/mesalib/src/mesa/main/blend.c
@@ -207,7 +207,6 @@ _mesa_BlendFuncSeparate( GLenum sfactorRGB, GLenum dfactorRGB,
GLuint buf, numBuffers;
GLboolean changed;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n",
@@ -274,7 +273,6 @@ _mesa_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ARB_draw_buffers_blend) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glBlendFunc[Separate]i()");
@@ -343,7 +341,6 @@ _mesa_BlendEquation( GLenum mode )
GLuint buf, numBuffers;
GLboolean changed;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBlendEquation(%s)\n",
@@ -387,7 +384,6 @@ void GLAPIENTRY
_mesa_BlendEquationiARB(GLuint buf, GLenum mode)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBlendEquationi(%u, %s)\n",
@@ -424,7 +420,6 @@ _mesa_BlendEquationSeparate( GLenum modeRGB, GLenum modeA )
GLuint buf, numBuffers;
GLboolean changed;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBlendEquationSeparateEXT(%s %s)\n",
@@ -480,7 +475,6 @@ void GLAPIENTRY
_mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBlendEquationSeparatei(%u, %s %s)\n", buf,
@@ -536,7 +530,6 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
{
GLfloat tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
tmp[0] = red;
tmp[1] = green;
@@ -573,7 +566,6 @@ void GLAPIENTRY
_mesa_AlphaFunc( GLenum func, GLclampf ref )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glAlphaFunc(%s, %f)\n",
@@ -621,7 +613,6 @@ void GLAPIENTRY
_mesa_LogicOp( GLenum opcode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glLogicOp(%s)\n", _mesa_lookup_enum_by_nr(opcode));
@@ -664,7 +655,6 @@ void GLAPIENTRY
_mesa_IndexMask( GLuint mask )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Color.IndexMask == mask)
return;
@@ -696,7 +686,6 @@ _mesa_ColorMask( GLboolean red, GLboolean green,
GLubyte tmp[4];
GLuint i;
GLboolean flushed;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glColorMask(%d, %d, %d, %d)\n",
@@ -735,7 +724,6 @@ _mesa_ColorMaski( GLuint buf, GLboolean red, GLboolean green,
{
GLubyte tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glColorMaskIndexed %u %d %d %d %d\n",
@@ -770,8 +758,6 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (clamp != GL_TRUE && clamp != GL_FALSE && clamp != GL_FIXED_ONLY_ARB) {
_mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(clamp)");
return;
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index a9cd7382e..89911fe51 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -819,7 +819,6 @@ void GLAPIENTRY
_mesa_BindBuffer(GLenum target, GLuint buffer)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBindBuffer(%s, %u)\n",
@@ -840,7 +839,6 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
{
GET_CURRENT_CONTEXT(ctx);
GLsizei i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, 0);
if (n < 0) {
@@ -951,7 +949,6 @@ _mesa_GenBuffers(GLsizei n, GLuint *buffer)
GET_CURRENT_CONTEXT(ctx);
GLuint first;
GLint i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGenBuffers(%d)\n", n);
@@ -1012,7 +1009,6 @@ _mesa_BufferData(GLenum target, GLsizeiptrARB size,
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
bool valid_usage;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBufferData(%s, %ld, %p, %s)\n",
@@ -1091,7 +1087,6 @@ _mesa_BufferSubData(GLenum target, GLintptrARB offset,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
"glBufferSubDataARB" );
@@ -1116,7 +1111,6 @@ _mesa_GetBufferSubData(GLenum target, GLintptrARB offset,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
"glGetBufferSubDataARB" );
@@ -1293,7 +1287,6 @@ _mesa_GetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = get_buffer(ctx, "glGetBufferParameterivARB", target);
if (!bufObj)
@@ -1347,7 +1340,6 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = get_buffer(ctx, "glGetBufferParameteri64v", target);
if (!bufObj)
@@ -1396,7 +1388,6 @@ _mesa_GetBufferPointerv(GLenum target, GLenum pname, GLvoid **params)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object * bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (pname != GL_BUFFER_MAP_POINTER_ARB) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");
@@ -1418,7 +1409,6 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *src, *dst;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
src = get_buffer(ctx, "glCopyBufferSubData", readTarget);
if (!src)
@@ -1628,7 +1618,6 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ARB_map_buffer_range) {
_mesa_error(ctx, GL_INVALID_OPERATION,
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index 87848fb93..3f5cbcda7 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -244,7 +244,8 @@ _mesa_DrawBuffer(GLenum buffer)
{
GLbitfield destMask;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API) {
_mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
@@ -301,7 +302,8 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers)
GLbitfield usedBufferMask, supportedMask;
GLbitfield destMask[MAX_DRAW_BUFFERS];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
/* Turns out n==0 is a valid input that should not produce an error.
* The remaining code below correctly handles the n==0 case.
@@ -609,7 +611,8 @@ _mesa_ReadBuffer(GLenum buffer)
GLbitfield supportedMask;
GLint srcBuffer;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c
index 83ffdf66b..af9433306 100644
--- a/mesalib/src/mesa/main/clear.c
+++ b/mesalib/src/mesa/main/clear.c
@@ -45,7 +45,6 @@ void GLAPIENTRY
_mesa_ClearIndex( GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Color.ClearIndex == (GLuint) c)
return;
@@ -74,7 +73,6 @@ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
{
GLfloat tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
tmp[0] = red;
tmp[1] = green;
@@ -97,7 +95,6 @@ _mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a)
{
GLint tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
tmp[0] = r;
tmp[1] = g;
@@ -120,7 +117,6 @@ _mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a)
{
GLuint tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
tmp[0] = r;
tmp[1] = g;
@@ -149,7 +145,7 @@ void GLAPIENTRY
_mesa_Clear( GLbitfield mask )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
@@ -305,7 +301,7 @@ void GLAPIENTRY
_mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
@@ -396,8 +392,8 @@ void GLAPIENTRY
_mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
if (ctx->NewState) {
@@ -468,8 +464,8 @@ void GLAPIENTRY
_mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
if (ctx->NewState) {
@@ -563,8 +559,7 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
GET_CURRENT_CONTEXT(ctx);
GLbitfield mask = 0;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
+ FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
if (buffer != GL_DEPTH_STENCIL) {
diff --git a/mesalib/src/mesa/main/clip.c b/mesalib/src/mesa/main/clip.c
index ba2028cf2..b01dd3c97 100644
--- a/mesalib/src/mesa/main/clip.c
+++ b/mesalib/src/mesa/main/clip.c
@@ -54,7 +54,6 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
GET_CURRENT_CONTEXT(ctx);
GLint p;
GLfloat equation[4];
- ASSERT_OUTSIDE_BEGIN_END(ctx);
p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) {
@@ -101,7 +100,6 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation )
{
GET_CURRENT_CONTEXT(ctx);
GLint p;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
p = (GLint) (plane - GL_CLIP_PLANE0);
if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) {
diff --git a/mesalib/src/mesa/main/colortab.c b/mesalib/src/mesa/main/colortab.c
index f1b3e585a..c201a27cb 100644
--- a/mesalib/src/mesa/main/colortab.c
+++ b/mesalib/src/mesa/main/colortab.c
@@ -45,7 +45,6 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
const GLvoid *data )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
}
@@ -57,7 +56,6 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
const GLvoid *data )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
}
@@ -68,7 +66,6 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyColorTable(target)");
}
@@ -79,7 +76,6 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyColorSubTable(target)");
}
@@ -90,7 +86,6 @@ _mesa_GetnColorTableARB( GLenum target, GLenum format, GLenum type,
GLsizei bufSize, GLvoid *data )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glGetnColorTableARB(target)");
}
@@ -100,7 +95,6 @@ _mesa_GetColorTable( GLenum target, GLenum format,
GLenum type, GLvoid *data )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
}
@@ -110,7 +104,6 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
/* no extensions use this function */
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(target)");
}
@@ -121,7 +114,6 @@ _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
{
/* no extensions use this function */
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameteriv(target)");
}
@@ -131,7 +123,6 @@ void GLAPIENTRY
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)");
}
@@ -141,6 +132,5 @@ void GLAPIENTRY
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)");
}
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 561eb4685..5e9e539b2 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -81,6 +81,7 @@
#include "imports.h"
#include "accum.h"
#include "api_exec.h"
+#include "api_loopback.h"
#include "arrayobj.h"
#include "attrib.h"
#include "blend.h"
@@ -835,7 +836,7 @@ _mesa_generic_nop(void)
* Allocate and initialize a new dispatch table.
*/
struct _glapi_table *
-_mesa_alloc_dispatch_table(int size)
+_mesa_alloc_dispatch_table()
{
/* Find the larger of Mesa's dispatch table and libGL's dispatch table.
* In practice, this'll be the same for stand-alone Mesa. But for DRI
@@ -845,9 +846,6 @@ _mesa_alloc_dispatch_table(int size)
GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
struct _glapi_table *table;
- /* should never happen, but just in case */
- numEntries = MAX2(numEntries, size);
-
table = malloc(numEntries * sizeof(_glapi_proc));
if (table) {
_glapi_proc *entry = (_glapi_proc *) table;
@@ -859,6 +857,91 @@ _mesa_alloc_dispatch_table(int size)
return table;
}
+/**
+ * Creates a minimal dispatch table for use within glBegin()/glEnd().
+ *
+ * This ensures that we generate GL_INVALID_OPERATION errors from most
+ * functions, since the set of functions that are valid within Begin/End is
+ * very small.
+ *
+ * From the GL 1.0 specification section 2.6.3, "GL Commands within
+ * Begin/End"
+ *
+ * "The only GL commands that are allowed within any Begin/End pairs are
+ * the commands for specifying vertex coordinates, vertex color, normal
+ * coordinates, and texture coordinates (Vertex, Color, Index, Normal,
+ * TexCoord), EvalCoord and EvalPoint commands (see section 5.1),
+ * commands for specifying lighting material parameters (Material
+ * commands see section 2.12.2), display list invocation commands
+ * (CallList and CallLists see section 5.4), and the EdgeFlag
+ * command. Executing Begin after Begin has already been executed but
+ * before an End is issued generates the INVALID OPERATION error, as does
+ * executing End without a previous corresponding Begin. Executing any
+ * other GL command within Begin/End results in the error INVALID
+ * OPERATION."
+ *
+ * The table entries for specifying vertex attributes are set up by
+ * install_vtxfmt() and _mesa_loopback_init_api_table(), and End() and dlists
+ * are set by install_vtxfmt() as well.
+ */
+static struct _glapi_table *
+create_beginend_table(const struct gl_context *ctx)
+{
+ struct _glapi_table *table;
+
+ table = _mesa_alloc_dispatch_table();
+ if (!table)
+ return NULL;
+
+ /* Fill in functions which return a value, since they should return some
+ * specific value even if they emit a GL_INVALID_OPERATION error from them
+ * being called within glBegin()/glEnd().
+ */
+#define COPY_DISPATCH(func) SET_##func(table, GET_##func(ctx->Exec))
+
+ COPY_DISPATCH(GenLists);
+ COPY_DISPATCH(IsProgram);
+ COPY_DISPATCH(IsVertexArray);
+ COPY_DISPATCH(IsBuffer);
+ COPY_DISPATCH(IsEnabled);
+ COPY_DISPATCH(IsEnabledi);
+ COPY_DISPATCH(IsRenderbuffer);
+ COPY_DISPATCH(IsFramebuffer);
+ COPY_DISPATCH(CheckFramebufferStatus);
+ COPY_DISPATCH(RenderMode);
+ COPY_DISPATCH(GetString);
+ COPY_DISPATCH(GetStringi);
+ COPY_DISPATCH(GetPointerv);
+ COPY_DISPATCH(IsQuery);
+ COPY_DISPATCH(IsSampler);
+ COPY_DISPATCH(IsSync);
+ COPY_DISPATCH(IsTexture);
+ COPY_DISPATCH(IsTransformFeedback);
+ COPY_DISPATCH(DeleteQueries);
+ COPY_DISPATCH(AreTexturesResident);
+ COPY_DISPATCH(FenceSync);
+ COPY_DISPATCH(ClientWaitSync);
+ COPY_DISPATCH(MapBuffer);
+ COPY_DISPATCH(UnmapBuffer);
+ COPY_DISPATCH(MapBufferRange);
+ COPY_DISPATCH(MapBufferRange);
+ COPY_DISPATCH(ObjectPurgeableAPPLE);
+ COPY_DISPATCH(ObjectUnpurgeableAPPLE);
+
+ _mesa_loopback_init_api_table(ctx, table);
+
+ return table;
+}
+
+void
+_mesa_initialize_dispatch_tables(struct gl_context *ctx)
+{
+ /* Do the code-generated setup of the exec table in api_exec.c. */
+ _mesa_initialize_exec_table(ctx);
+
+ if (ctx->Save)
+ _mesa_initialize_save_table(ctx);
+}
/**
* Initialize a struct gl_context struct (rendering context).
@@ -933,19 +1016,15 @@ _mesa_initialize_context(struct gl_context *ctx,
_mesa_reference_shared_state(ctx, &ctx->Shared, shared);
- if (!init_attrib_groups( ctx )) {
- _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
- return GL_FALSE;
- }
+ if (!init_attrib_groups( ctx ))
+ goto fail;
/* setup the API dispatch tables with all nop functions */
- ctx->Exec = _mesa_alloc_dispatch_table(_gloffset_COUNT);
-
- if (!ctx->Exec) {
- _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
- return GL_FALSE;
- }
- ctx->CurrentDispatch = ctx->Exec;
+ ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table();
+ if (!ctx->OutsideBeginEnd)
+ goto fail;
+ ctx->Exec = ctx->OutsideBeginEnd;
+ ctx->CurrentDispatch = ctx->OutsideBeginEnd;
ctx->FragmentProgram._MaintainTexEnvProgram
= (_mesa_getenv("MESA_TEX_PROG") != NULL);
@@ -967,12 +1046,10 @@ _mesa_initialize_context(struct gl_context *ctx,
switch (ctx->API) {
case API_OPENGL_COMPAT:
- ctx->Save = _mesa_create_save_table(ctx);
- if (!ctx->Save) {
- _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
- free(ctx->Exec);
- return GL_FALSE;
- }
+ ctx->BeginEnd = create_beginend_table(ctx);
+ ctx->Save = _mesa_alloc_dispatch_table();
+ if (!ctx->BeginEnd || !ctx->Save)
+ goto fail;
/* fall-through */
case API_OPENGL_CORE:
@@ -1002,6 +1079,12 @@ _mesa_initialize_context(struct gl_context *ctx,
ctx->FirstTimeCurrent = GL_TRUE;
return GL_TRUE;
+
+fail:
+ free(ctx->BeginEnd);
+ free(ctx->Exec);
+ free(ctx->Save);
+ return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h
index 063f2a381..1b881f3f3 100644
--- a/mesalib/src/mesa/main/context.h
+++ b/mesalib/src/mesa/main/context.h
@@ -262,31 +262,6 @@ do { \
} \
} while (0)
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair and flush the vertices.
- *
- * \param ctx GL context.
- */
-#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
-do { \
- ASSERT_OUTSIDE_BEGIN_END(ctx); \
- FLUSH_VERTICES(ctx, 0); \
-} while (0)
-
-/**
- * Macro to assert that the API call was made outside the
- * glBegin()/glEnd() pair and flush the vertices, with return value.
- *
- * \param ctx GL context.
- * \param retval value to return in case the assertion fails.
- */
-#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
-do { \
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
- FLUSH_VERTICES(ctx, 0); \
-} while (0)
-
/*@}*/
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 07787d41d..f91fd4120 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -723,14 +723,6 @@ struct dd_function_table {
void (*SaveFlushVertices)( struct gl_context *ctx );
/**
- * \brief Hook for drivers to prepare for a glBegin/glEnd block
- *
- * This hook is called in vbo_exec_Begin() before any action, including
- * state updates, occurs.
- */
- void (*PrepareExecBegin)( struct gl_context *ctx );
-
- /**
* Give the driver the opportunity to hook in its own vtxfmt for
* compiling optimized display lists. This is called on each valid
* glBegin() during list compilation.
diff --git a/mesalib/src/mesa/main/depth.c b/mesalib/src/mesa/main/depth.c
index bb1625440..8aec94a2d 100644
--- a/mesalib/src/mesa/main/depth.c
+++ b/mesalib/src/mesa/main/depth.c
@@ -42,7 +42,6 @@ void GLAPIENTRY
_mesa_ClearDepth( GLclampd depth )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glClearDepth(%f)\n", depth);
@@ -68,7 +67,6 @@ void GLAPIENTRY
_mesa_DepthFunc( GLenum func )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func));
@@ -104,7 +102,6 @@ void GLAPIENTRY
_mesa_DepthMask( GLboolean flag )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glDepthMask %d\n", flag);
@@ -132,7 +129,6 @@ void GLAPIENTRY
_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glDepthBounds(%f, %f)\n", zmin, zmax);
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 6b99f35bb..4b20d890d 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -5648,16 +5648,9 @@ save_Begin(GLenum mode)
Node *n;
GLboolean error = GL_FALSE;
- if (mode > GL_POLYGON) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBegin(mode=%x)", mode);
+ if (ctx->ExecuteFlag && !_mesa_valid_prim_mode(ctx, mode, "glBegin")) {
error = GL_TRUE;
}
- if (ctx->ExecuteFlag) {
- if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) {
- error = GL_TRUE;
- }
- }
-
else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
/* Typically the first begin. This may raise an error on
* playback, depending on whether CallList is issued from inside
@@ -6014,35 +6007,6 @@ save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
index_error();
}
-
-/* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
-
-static void GLAPIENTRY
-exec_BindAttribLocationARB(GLuint program, GLuint index, const GLchar *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_BindAttribLocation(ctx->Exec, (program, index, name));
-}
-
-static GLint GLAPIENTRY
-exec_GetAttribLocationARB(GLuint program, const GLchar *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_GetAttribLocation(ctx->Exec, (program, name));
-}
-
-static GLint GLAPIENTRY
-exec_GetUniformLocationARB(GLuint program, const GLchar *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_GetUniformLocation(ctx->Exec, (program, name));
-}
-/* XXX more shader functions needed here */
-
-
static void GLAPIENTRY
save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
@@ -6984,25 +6948,6 @@ save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
}
}
-/** GL_EXT_texture_integer */
-static void GLAPIENTRY
-exec_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexParameterIiv(ctx->Exec, (target, pname, params));
-}
-
-/** GL_EXT_texture_integer */
-static void GLAPIENTRY
-exec_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexParameterIuiv(ctx->Exec, (target, pname, params));
-}
-
-
/* GL_ARB_instanced_arrays */
static void GLAPIENTRY
save_VertexAttribDivisor(GLuint index, GLuint divisor)
@@ -8710,7 +8655,7 @@ _mesa_EndList(void)
{
GET_CURRENT_CONTEXT(ctx);
SAVE_FLUSH_VERTICES(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glEndList\n");
@@ -8850,721 +8795,6 @@ _mesa_ListBase(GLuint base)
ctx->List.ListBase = base;
}
-
-/* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
- */
-static void GLAPIENTRY
-exec_Finish(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_Finish(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_Flush(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_Flush(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_GetBooleanv(GLenum pname, GLboolean *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetBooleanv(ctx->Exec, (pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetClipPlane(GLenum plane, GLdouble * equation)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetClipPlane(ctx->Exec, (plane, equation));
-}
-
-static void GLAPIENTRY
-exec_GetDoublev(GLenum pname, GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetDoublev(ctx->Exec, (pname, params));
-}
-
-static GLenum GLAPIENTRY
-exec_GetError(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_GetError(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_GetFloatv(GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetFloatv(ctx->Exec, (pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetIntegerv(GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetIntegerv(ctx->Exec, (pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetLightfv(ctx->Exec, (light, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetLightiv(ctx->Exec, (light, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetMapdv(GLenum target, GLenum query, GLdouble * v)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMapdv(ctx->Exec, (target, query, v));
-}
-
-static void GLAPIENTRY
-exec_GetMapfv(GLenum target, GLenum query, GLfloat * v)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMapfv(ctx->Exec, (target, query, v));
-}
-
-static void GLAPIENTRY
-exec_GetMapiv(GLenum target, GLenum query, GLint * v)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMapiv(ctx->Exec, (target, query, v));
-}
-
-static void GLAPIENTRY
-exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMaterialfv(ctx->Exec, (face, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMaterialiv(ctx->Exec, (face, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetPixelMapfv(GLenum map, GLfloat *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPixelMapfv(ctx->Exec, (map, values));
-}
-
-static void GLAPIENTRY
-exec_GetPixelMapuiv(GLenum map, GLuint *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPixelMapuiv(ctx->Exec, (map, values));
-}
-
-static void GLAPIENTRY
-exec_GetPixelMapusv(GLenum map, GLushort *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPixelMapusv(ctx->Exec, (map, values));
-}
-
-static void GLAPIENTRY
-exec_GetPolygonStipple(GLubyte * dest)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPolygonStipple(ctx->Exec, (dest));
-}
-
-static const GLubyte *GLAPIENTRY
-exec_GetString(GLenum name)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_GetString(ctx->Exec, (name));
-}
-
-static void GLAPIENTRY
-exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexEnvfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexEnviv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexGendv(ctx->Exec, (coord, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexGenfv(ctx->Exec, (coord, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexGeniv(ctx->Exec, (coord, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexImage(GLenum target, GLint level, GLenum format,
- GLenum type, GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels));
-}
-
-static void GLAPIENTRY
-exec_GetTexLevelParameterfv(GLenum target, GLint level,
- GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexLevelParameteriv(GLenum target, GLint level,
- GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetTexParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static GLboolean GLAPIENTRY
-exec_IsEnabled(GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_IsEnabled(ctx->Exec, (cap));
-}
-
-static void GLAPIENTRY
-exec_PixelStoref(GLenum pname, GLfloat param)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_PixelStoref(ctx->Exec, (pname, param));
-}
-
-static void GLAPIENTRY
-exec_PixelStorei(GLenum pname, GLint param)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_PixelStorei(ctx->Exec, (pname, param));
-}
-
-static void GLAPIENTRY
-exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid * pixels)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels));
-}
-
-static GLint GLAPIENTRY
-exec_RenderMode(GLenum mode)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_RenderMode(ctx->Exec, (mode));
-}
-
-static void GLAPIENTRY
-exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer));
-}
-
-static void GLAPIENTRY
-exec_SelectBuffer(GLsizei size, GLuint * buffer)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_SelectBuffer(ctx->Exec, (size, buffer));
-}
-
-static GLboolean GLAPIENTRY
-exec_AreTexturesResident(GLsizei n, const GLuint * texName,
- GLboolean * residences)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences));
-}
-
-static void GLAPIENTRY
-exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_DeleteTextures(GLsizei n, const GLuint * texName)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_DeleteTextures(ctx->Exec, (n, texName));
-}
-
-static void GLAPIENTRY
-exec_DisableClientState(GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_DisableClientState(ctx->Exec, (cap));
-}
-
-static void GLAPIENTRY
-exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr));
-}
-
-static void GLAPIENTRY
-exec_EnableClientState(GLenum cap)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_EnableClientState(ctx->Exec, (cap));
-}
-
-static void GLAPIENTRY
-exec_GenTextures(GLsizei n, GLuint * texName)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GenTextures(ctx->Exec, (n, texName));
-}
-
-static void GLAPIENTRY
-exec_GetPointerv(GLenum pname, GLvoid **params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetPointerv(ctx->Exec, (pname, params));
-}
-
-static void GLAPIENTRY
-exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_IndexPointer(ctx->Exec, (type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer));
-}
-
-static GLboolean GLAPIENTRY
-exec_IsTexture(GLuint texture)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- return CALL_IsTexture(ctx->Exec, (texture));
-}
-
-static void GLAPIENTRY
-exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_NormalPointer(ctx->Exec, (type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_PopClientAttrib(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_PopClientAttrib(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_PushClientAttrib(GLbitfield mask)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_PushClientAttrib(ctx->Exec, (mask));
-}
-
-static void GLAPIENTRY
-exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetCompressedTexImage(ctx->Exec, (target, level, img));
-}
-
-static void GLAPIENTRY
-exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
- const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
- GLint x, GLint y, GLsizei width)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_CopyConvolutionFilter1D(ctx->Exec,
- (target, internalFormat, x, y, width));
-}
-
-static void GLAPIENTRY
-exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_CopyConvolutionFilter2D(ctx->Exec,
- (target, internalFormat, x, y, width,
- height));
-}
-
-static void GLAPIENTRY
-exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetColorTable(ctx->Exec, (target, format, type, data));
-}
-
-static void GLAPIENTRY
-exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
- GLvoid * image)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image));
-}
-
-static void GLAPIENTRY
-exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
- GLenum type, GLvoid *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values));
-}
-
-static void GLAPIENTRY
-exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
- GLenum type, GLvoid *values)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values));
-}
-
-static void GLAPIENTRY
-exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params));
-}
-
-static void GLAPIENTRY
-exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
- GLvoid *row, GLvoid *column, GLvoid *span)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetSeparableFilter(ctx->Exec,
- (target, format, type, row, column, span));
-}
-
-static void GLAPIENTRY
-exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
- GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid *row, const GLvoid *column)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_SeparableFilter2D(ctx->Exec,
- (target, internalFormat, width, height, format,
- type, row, column));
-}
-
-static void GLAPIENTRY
-exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
- const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
- GLsizei count, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
-}
-
-static void GLAPIENTRY
-exec_LockArraysEXT(GLint first, GLsizei count)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_LockArraysEXT(ctx->Exec, (first, count));
-}
-
-static void GLAPIENTRY
-exec_UnlockArraysEXT(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_UnlockArraysEXT(ctx->Exec, ());
-}
-
-static void GLAPIENTRY
-exec_ClientActiveTextureARB(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_ClientActiveTexture(ctx->Exec, (target));
-}
-
-static void GLAPIENTRY
-exec_SecondaryColorPointerEXT(GLint size, GLenum type,
- GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_SecondaryColorPointer(ctx->Exec, (size, type, stride, ptr));
-}
-
-static void GLAPIENTRY
-exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_FogCoordPointer(ctx->Exec, (type, stride, ptr));
-}
-
-/* GL_EXT_multi_draw_arrays */
-static void GLAPIENTRY
-exec_MultiDrawArraysEXT(GLenum mode, const GLint *first,
- const GLsizei *count, GLsizei primcount)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_MultiDrawArrays(ctx->Exec, (mode, first, count, primcount));
-}
-
-/* GL_IBM_multimode_draw_arrays */
-static void GLAPIENTRY
-exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
- const GLsizei * count, GLsizei primcount,
- GLint modestride)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_MultiModeDrawArraysIBM(ctx->Exec,
- (mode, first, count, primcount, modestride));
-}
-
-/* GL_IBM_multimode_draw_arrays */
-static void GLAPIENTRY
-exec_MultiModeDrawElementsIBM(const GLenum * mode,
- const GLsizei * count,
- GLenum type,
- const GLvoid * const *indices,
- GLsizei primcount, GLint modestride)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_MultiModeDrawElementsIBM(ctx->Exec,
- (mode, count, type, indices, primcount,
- modestride));
-}
-
/**
* Setup the given dispatch table to point to Mesa's display list
* building functions.
@@ -9573,14 +8803,17 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode,
* initialized from _mesa_init_api_defaults and from the active vtxfmt
* struct.
*/
-struct _glapi_table *
-_mesa_create_save_table(const struct gl_context *ctx)
+void
+_mesa_initialize_save_table(const struct gl_context *ctx)
{
- struct _glapi_table *table;
+ struct _glapi_table *table = ctx->Save;
+ int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
- table = _mesa_alloc_dispatch_table(_gloffset_COUNT);
- if (table == NULL)
- return NULL;
+ /* Initially populate the dispatch table with the contents of the
+ * normal-execution dispatch table. This lets us skip populating functions
+ * that should be called directly instead of compiled into display lists.
+ */
+ memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
_mesa_loopback_init_api_table(ctx, table);
@@ -9603,7 +8836,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_ColorMaterial(table, save_ColorMaterial);
SET_CopyPixels(table, save_CopyPixels);
SET_CullFace(table, save_CullFace);
- SET_DeleteLists(table, _mesa_DeleteLists);
SET_DepthFunc(table, save_DepthFunc);
SET_DepthMask(table, save_DepthMask);
SET_DepthRange(table, save_DepthRange);
@@ -9613,51 +8845,17 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_DrawPixels(table, save_DrawPixels);
SET_Enable(table, save_Enable);
SET_Enablei(table, save_EnableIndexed);
- SET_EndList(table, _mesa_EndList);
SET_EvalMesh1(table, save_EvalMesh1);
SET_EvalMesh2(table, save_EvalMesh2);
- SET_Finish(table, exec_Finish);
- SET_Flush(table, exec_Flush);
SET_Fogf(table, save_Fogf);
SET_Fogfv(table, save_Fogfv);
SET_Fogi(table, save_Fogi);
SET_Fogiv(table, save_Fogiv);
SET_FrontFace(table, save_FrontFace);
SET_Frustum(table, save_Frustum);
- SET_GenLists(table, _mesa_GenLists);
- SET_GetBooleanv(table, exec_GetBooleanv);
- SET_GetClipPlane(table, exec_GetClipPlane);
- SET_GetDoublev(table, exec_GetDoublev);
- SET_GetError(table, exec_GetError);
- SET_GetFloatv(table, exec_GetFloatv);
- SET_GetIntegerv(table, exec_GetIntegerv);
- SET_GetLightfv(table, exec_GetLightfv);
- SET_GetLightiv(table, exec_GetLightiv);
- SET_GetMapdv(table, exec_GetMapdv);
- SET_GetMapfv(table, exec_GetMapfv);
- SET_GetMapiv(table, exec_GetMapiv);
- SET_GetMaterialfv(table, exec_GetMaterialfv);
- SET_GetMaterialiv(table, exec_GetMaterialiv);
- SET_GetPixelMapfv(table, exec_GetPixelMapfv);
- SET_GetPixelMapuiv(table, exec_GetPixelMapuiv);
- SET_GetPixelMapusv(table, exec_GetPixelMapusv);
- SET_GetPolygonStipple(table, exec_GetPolygonStipple);
- SET_GetString(table, exec_GetString);
- SET_GetTexEnvfv(table, exec_GetTexEnvfv);
- SET_GetTexEnviv(table, exec_GetTexEnviv);
- SET_GetTexGendv(table, exec_GetTexGendv);
- SET_GetTexGenfv(table, exec_GetTexGenfv);
- SET_GetTexGeniv(table, exec_GetTexGeniv);
- SET_GetTexImage(table, exec_GetTexImage);
- SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv);
- SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv);
- SET_GetTexParameterfv(table, exec_GetTexParameterfv);
- SET_GetTexParameteriv(table, exec_GetTexParameteriv);
SET_Hint(table, save_Hint);
SET_IndexMask(table, save_IndexMask);
SET_InitNames(table, save_InitNames);
- SET_IsEnabled(table, exec_IsEnabled);
- SET_IsList(table, _mesa_IsList);
SET_LightModelf(table, save_LightModelf);
SET_LightModelfv(table, save_LightModelfv);
SET_LightModeli(table, save_LightModeli);
@@ -9691,8 +8889,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_PixelMapfv(table, save_PixelMapfv);
SET_PixelMapuiv(table, save_PixelMapuiv);
SET_PixelMapusv(table, save_PixelMapusv);
- SET_PixelStoref(table, exec_PixelStoref);
- SET_PixelStorei(table, exec_PixelStorei);
SET_PixelTransferf(table, save_PixelTransferf);
SET_PixelTransferi(table, save_PixelTransferi);
SET_PixelZoom(table, save_PixelZoom);
@@ -9731,15 +8927,11 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_RasterPos4s(table, save_RasterPos4s);
SET_RasterPos4sv(table, save_RasterPos4sv);
SET_ReadBuffer(table, save_ReadBuffer);
- SET_ReadPixels(table, exec_ReadPixels);
- SET_RenderMode(table, exec_RenderMode);
SET_Rotated(table, save_Rotated);
SET_Rotatef(table, save_Rotatef);
SET_Scaled(table, save_Scaled);
SET_Scalef(table, save_Scalef);
SET_Scissor(table, save_Scissor);
- SET_FeedbackBuffer(table, exec_FeedbackBuffer);
- SET_SelectBuffer(table, exec_SelectBuffer);
SET_ShadeModel(table, save_ShadeModel);
SET_StencilFunc(table, save_StencilFunc);
SET_StencilMask(table, save_StencilMask);
@@ -9765,30 +8957,14 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_Viewport(table, save_Viewport);
/* GL 1.1 */
- SET_AreTexturesResident(table, exec_AreTexturesResident);
SET_BindTexture(table, save_BindTexture);
- SET_ColorPointer(table, exec_ColorPointer);
SET_CopyTexImage1D(table, save_CopyTexImage1D);
SET_CopyTexImage2D(table, save_CopyTexImage2D);
SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
- SET_DeleteTextures(table, exec_DeleteTextures);
- SET_DisableClientState(table, exec_DisableClientState);
- SET_EdgeFlagPointer(table, exec_EdgeFlagPointer);
- SET_EnableClientState(table, exec_EnableClientState);
- SET_GenTextures(table, exec_GenTextures);
- SET_GetPointerv(table, exec_GetPointerv);
- SET_IndexPointer(table, exec_IndexPointer);
- SET_InterleavedArrays(table, exec_InterleavedArrays);
- SET_IsTexture(table, exec_IsTexture);
- SET_NormalPointer(table, exec_NormalPointer);
- SET_PopClientAttrib(table, exec_PopClientAttrib);
SET_PrioritizeTextures(table, save_PrioritizeTextures);
- SET_PushClientAttrib(table, exec_PushClientAttrib);
- SET_TexCoordPointer(table, exec_TexCoordPointer);
SET_TexSubImage1D(table, save_TexSubImage1D);
SET_TexSubImage2D(table, save_TexSubImage2D);
- SET_VertexPointer(table, exec_VertexPointer);
/* GL 1.2 */
SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
@@ -9819,26 +8995,10 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv);
SET_CopyColorSubTable(table, save_CopyColorSubTable);
SET_CopyColorTable(table, save_CopyColorTable);
- SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D);
- SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D);
- SET_GetColorTable(table, exec_GetColorTable);
- SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv);
- SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv);
- SET_GetConvolutionFilter(table, exec_GetConvolutionFilter);
- SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv);
- SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv);
- SET_GetHistogram(table, exec_GetHistogram);
- SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv);
- SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv);
- SET_GetMinmax(table, exec_GetMinmax);
- SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv);
- SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv);
- SET_GetSeparableFilter(table, exec_GetSeparableFilter);
SET_Histogram(table, save_Histogram);
SET_Minmax(table, save_Minmax);
SET_ResetHistogram(table, save_ResetHistogram);
SET_ResetMinmax(table, save_ResetMinmax);
- SET_SeparableFilter2D(table, exec_SeparableFilter2D);
/* 2. GL_EXT_blend_color */
#if 0
@@ -9859,19 +9019,8 @@ _mesa_create_save_table(const struct gl_context *ctx)
#if 0
SET_ColorTableSGI(table, save_ColorTable);
SET_ColorSubTableSGI(table, save_ColorSubTable);
- SET_GetColorTableSGI(table, exec_GetColorTable);
- SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv);
- SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv);
#endif
- /* 30. GL_EXT_vertex_array */
- SET_ColorPointerEXT(table, exec_ColorPointerEXT);
- SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT);
- SET_IndexPointerEXT(table, exec_IndexPointerEXT);
- SET_NormalPointerEXT(table, exec_NormalPointerEXT);
- SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT);
- SET_VertexPointerEXT(table, exec_VertexPointerEXT);
-
/* 37. GL_EXT_blend_minmax */
#if 0
SET_BlendEquationEXT(table, save_BlendEquationEXT);
@@ -9881,25 +9030,9 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_PointParameterf(table, save_PointParameterfEXT);
SET_PointParameterfv(table, save_PointParameterfvEXT);
- /* 97. GL_EXT_compiled_vertex_array */
- SET_LockArraysEXT(table, exec_LockArraysEXT);
- SET_UnlockArraysEXT(table, exec_UnlockArraysEXT);
-
- /* 145. GL_EXT_secondary_color */
- SET_SecondaryColorPointer(table, exec_SecondaryColorPointerEXT);
-
- /* 148. GL_EXT_multi_draw_arrays */
- SET_MultiDrawArrays(table, exec_MultiDrawArraysEXT);
-
- /* 149. GL_EXT_fog_coord */
- SET_FogCoordPointer(table, exec_FogCoordPointerEXT);
-
/* 173. GL_EXT_blend_func_separate */
SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
- /* 196. GL_MESA_resize_buffers */
- SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA);
-
/* 197. GL_MESA_window_pos */
SET_WindowPos2d(table, save_WindowPos2dMESA);
SET_WindowPos2dv(table, save_WindowPos2dvMESA);
@@ -9926,19 +9059,12 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
- /* 200. GL_IBM_multimode_draw_arrays */
- SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM);
- SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM);
-
/* 233. GL_NV_vertex_program */
/* The following commands DO NOT go into display lists:
* AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
* VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
*/
SET_BindProgramARB(table, save_BindProgramNV);
- SET_DeleteProgramsARB(table, _mesa_DeleteProgramsARB);
- SET_GenProgramsARB(table, _mesa_GenProgramsARB);
- SET_IsProgramARB(table, _mesa_IsProgramARB);
/* 244. GL_ATI_envmap_bumpmap */
SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
@@ -9955,40 +9081,11 @@ _mesa_create_save_table(const struct gl_context *ctx)
/* 268. GL_EXT_stencil_two_side */
SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
- /* 273. GL_APPLE_vertex_array_object */
- SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE);
- SET_DeleteVertexArrays(table, _mesa_DeleteVertexArrays);
- SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE);
- SET_IsVertexArray(table, _mesa_IsVertexArray);
-
- /* 310. GL_EXT_framebuffer_object */
- SET_GenFramebuffers(table, _mesa_GenFramebuffers);
- SET_BindFramebuffer(table, _mesa_BindFramebuffer);
- SET_DeleteFramebuffers(table, _mesa_DeleteFramebuffers);
- SET_CheckFramebufferStatus(table, _mesa_CheckFramebufferStatus);
- SET_GenRenderbuffers(table, _mesa_GenRenderbuffers);
- SET_BindRenderbuffer(table, _mesa_BindRenderbuffer);
- SET_DeleteRenderbuffers(table, _mesa_DeleteRenderbuffers);
- SET_RenderbufferStorage(table, _mesa_RenderbufferStorage);
- SET_FramebufferTexture1D(table, _mesa_FramebufferTexture1D);
- SET_FramebufferTexture2D(table, _mesa_FramebufferTexture2D);
- SET_FramebufferTexture3D(table, _mesa_FramebufferTexture3D);
- SET_FramebufferRenderbuffer(table, _mesa_FramebufferRenderbuffer);
- SET_GenerateMipmap(table, _mesa_GenerateMipmap);
-
- /* 317. GL_EXT_framebuffer_multisample */
- SET_RenderbufferStorageMultisample(table, _mesa_RenderbufferStorageMultisample);
-
- /* GL_ARB_vertex_array_object */
- SET_BindVertexArray(table, _mesa_BindVertexArray);
- SET_GenVertexArrays(table, _mesa_GenVertexArrays);
-
/* ???. GL_EXT_depth_bounds_test */
SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
/* ARB 1. GL_ARB_multitexture */
SET_ActiveTexture(table, save_ActiveTextureARB);
- SET_ClientActiveTexture(table, exec_ClientActiveTextureARB);
/* ARB 3. GL_ARB_transpose_matrix */
SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
@@ -10006,7 +9103,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
- SET_GetCompressedTexImage(table, exec_GetCompressedTexImageARB);
/* ARB 14. GL_ARB_point_parameters */
/* aliased with EXT_point_parameters functions */
@@ -10017,18 +9113,8 @@ _mesa_create_save_table(const struct gl_context *ctx)
/* ARB 26. GL_ARB_vertex_program */
/* ARB 27. GL_ARB_fragment_program */
/* glVertexAttrib* functions alias the NV ones, handled elsewhere */
- SET_VertexAttribPointer(table, _mesa_VertexAttribPointer);
- SET_EnableVertexAttribArray(table, _mesa_EnableVertexAttribArray);
- SET_DisableVertexAttribArray(table, _mesa_DisableVertexAttribArray);
SET_ProgramStringARB(table, save_ProgramStringARB);
SET_BindProgramARB(table, save_BindProgramNV);
- SET_DeleteProgramsARB(table, _mesa_DeleteProgramsARB);
- SET_GenProgramsARB(table, _mesa_GenProgramsARB);
- SET_IsProgramARB(table, _mesa_IsProgramARB);
- SET_GetVertexAttribdv(table, _mesa_GetVertexAttribdv);
- SET_GetVertexAttribfv(table, _mesa_GetVertexAttribfv);
- SET_GetVertexAttribiv(table, _mesa_GetVertexAttribiv);
- SET_GetVertexAttribPointerv(table, _mesa_GetVertexAttribPointerv);
SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
@@ -10037,30 +9123,7 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
- SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB);
- SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB);
- SET_GetProgramLocalParameterdvARB(table,
- _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(table,
- _mesa_GetProgramLocalParameterfvARB);
- SET_GetProgramivARB(table, _mesa_GetProgramivARB);
- SET_GetProgramStringARB(table, _mesa_GetProgramStringARB);
-
- /* ARB 28. GL_ARB_vertex_buffer_object */
- /* None of the extension's functions get compiled */
- SET_BindBuffer(table, _mesa_BindBuffer);
- SET_BufferData(table, _mesa_BufferData);
- SET_BufferSubData(table, _mesa_BufferSubData);
- SET_DeleteBuffers(table, _mesa_DeleteBuffers);
- SET_GenBuffers(table, _mesa_GenBuffers);
- SET_GetBufferParameteriv(table, _mesa_GetBufferParameteriv);
- SET_GetBufferPointerv(table, _mesa_GetBufferPointerv);
- SET_GetBufferSubData(table, _mesa_GetBufferSubData);
- SET_IsBuffer(table, _mesa_IsBuffer);
- SET_MapBuffer(table, _mesa_MapBuffer);
- SET_UnmapBuffer(table, _mesa_UnmapBuffer);
-
- _mesa_init_queryobj_dispatch(ctx, table); /* glGetQuery, etc */
+
SET_BeginQuery(table, save_BeginQueryARB);
SET_EndQuery(table, save_EndQueryARB);
SET_QueryCounter(table, save_QueryCounter);
@@ -10069,8 +9132,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
- /* GL_ARB_shader_objects */
- _mesa_init_shader_dispatch(ctx, table); /* Plug in glCreate/Delete/Get, etc */
SET_UseProgram(table, save_UseProgramObjectARB);
SET_Uniform1f(table, save_Uniform1fARB);
SET_Uniform2f(table, save_Uniform2fARB);
@@ -10098,12 +9159,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
- /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
- SET_BindAttribLocation(table, exec_BindAttribLocationARB);
- SET_GetAttribLocation(table, exec_GetAttribLocationARB);
- SET_GetUniformLocation(table, exec_GetUniformLocationARB);
- /* XXX additional functions need to be implemented here! */
-
/* 299. GL_EXT_blend_equation_separate */
SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
@@ -10111,31 +9166,14 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
- /* ARB 50. GL_ARB_map_buffer_range */
- SET_MapBufferRange(table, _mesa_MapBufferRange); /* no dlist save */
- SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */
-
- /* ARB 51. GL_ARB_texture_buffer_object */
- SET_TexBuffer(table, _mesa_TexBuffer); /* no dlist save */
-
- /* ARB 59. GL_ARB_copy_buffer */
- SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */
-
/* 364. GL_EXT_provoking_vertex */
SET_ProvokingVertex(table, save_ProvokingVertexEXT);
- /* 371. GL_APPLE_object_purgeable */
- SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE);
- SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE);
- SET_GetObjectParameterivAPPLE(table, _mesa_GetObjectParameterivAPPLE);
-
/* GL_EXT_texture_integer */
SET_ClearColorIiEXT(table, save_ClearColorIi);
SET_ClearColorIuiEXT(table, save_ClearColorIui);
SET_TexParameterIiv(table, save_TexParameterIiv);
SET_TexParameterIuiv(table, save_TexParameterIuiv);
- SET_GetTexParameterIiv(table, exec_GetTexParameterIiv);
- SET_GetTexParameterIuiv(table, exec_GetTexParameterIuiv);
/* 377. GL_EXT_separate_shader_objects */
SET_UseShaderProgramEXT(table, save_UseShaderProgramEXT);
@@ -10169,11 +9207,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
(void) save_Uniform4uiv;
#endif
- /* These are not compiled into display lists: */
- SET_BindBufferBase(table, _mesa_BindBufferBase);
- SET_BindBufferOffsetEXT(table, _mesa_BindBufferOffsetEXT);
- SET_BindBufferRange(table, _mesa_BindBufferRange);
- SET_TransformFeedbackVaryings(table, _mesa_TransformFeedbackVaryings);
/* These are: */
SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
SET_EndTransformFeedback(table, save_EndTransformFeedback);
@@ -10195,8 +9228,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
/* GL_NV_texture_barrier */
SET_TextureBarrierNV(table, save_TextureBarrierNV);
- /* GL_ARB_sampler_objects */
- _mesa_init_sampler_object_dispatch(ctx, table); /* plug in Gen/Get/etc functions */
SET_BindSampler(table, save_BindSampler);
SET_SamplerParameteri(table, save_SamplerParameteri);
SET_SamplerParameterf(table, save_SamplerParameterf);
@@ -10221,27 +9252,10 @@ _mesa_create_save_table(const struct gl_context *ctx)
SET_EndConditionalRender(table, save_EndConditionalRender);
/* GL_ARB_sync */
- _mesa_init_sync_dispatch(table);
SET_WaitSync(table, save_WaitSync);
- /* GL_ARB_texture_storage (no dlist support) */
- SET_TexStorage1D(table, _mesa_TexStorage1D);
- SET_TexStorage2D(table, _mesa_TexStorage2D);
- SET_TexStorage3D(table, _mesa_TexStorage3D);
- SET_TextureStorage1DEXT(table, _mesa_TextureStorage1DEXT);
- SET_TextureStorage2DEXT(table, _mesa_TextureStorage2DEXT);
- SET_TextureStorage3DEXT(table, _mesa_TextureStorage3DEXT);
-
- /* GL_ARB_debug_output (no dlist support) */
- _mesa_init_errors_dispatch(table);
-
/* GL_ARB_uniform_buffer_object */
SET_UniformBlockBinding(table, save_UniformBlockBinding);
-
- /* GL_NV_primitive_restart */
- SET_PrimitiveRestartIndex(table, _mesa_PrimitiveRestartIndex);
-
- return table;
}
diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h
index 9d4fc6899..e049476c1 100644
--- a/mesalib/src/mesa/main/dlist.h
+++ b/mesalib/src/mesa/main/dlist.h
@@ -74,7 +74,7 @@ extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dl
extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
-extern struct _glapi_table *_mesa_create_save_table(const struct gl_context *);
+extern void _mesa_initialize_save_table(const struct gl_context *);
extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
const GLvertexformat *vfmt);
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index 3d25ae52b..d9f55d3af 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -48,7 +48,8 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
{
GLenum err;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glDrawPixels(%d, %d, %s, %s, %p) // to %s at %d, %d\n",
@@ -191,7 +192,8 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GLenum type )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx,
@@ -297,7 +299,8 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
const GLubyte *bitmap )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (width < 0 || height < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glBitmap(width or height < 0)" );
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index 73257290e..7e85fdfb3 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -165,7 +165,6 @@ void GLAPIENTRY
_mesa_EnableClientState( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
client_state( ctx, cap, GL_TRUE );
}
@@ -181,7 +180,6 @@ void GLAPIENTRY
_mesa_DisableClientState( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
client_state( ctx, cap, GL_FALSE );
}
@@ -1039,7 +1037,6 @@ void GLAPIENTRY
_mesa_Enable( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
_mesa_set_enable( ctx, cap, GL_TRUE );
}
@@ -1053,7 +1050,6 @@ void GLAPIENTRY
_mesa_Disable( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
_mesa_set_enable( ctx, cap, GL_FALSE );
}
@@ -1102,7 +1098,6 @@ void GLAPIENTRY
_mesa_Disablei( GLenum cap, GLuint index )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
_mesa_set_enablei(ctx, cap, index, GL_FALSE);
}
@@ -1111,7 +1106,6 @@ void GLAPIENTRY
_mesa_Enablei( GLenum cap, GLuint index )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
_mesa_set_enablei(ctx, cap, index, GL_TRUE);
}
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index b692f3189..0c5e36d5a 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -726,15 +726,6 @@ _mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const GLvoid *userParam)
}
void
-_mesa_init_errors_dispatch(struct _glapi_table *disp)
-{
- SET_DebugMessageCallbackARB(disp, _mesa_DebugMessageCallbackARB);
- SET_DebugMessageControlARB(disp, _mesa_DebugMessageControlARB);
- SET_DebugMessageInsertARB(disp, _mesa_DebugMessageInsertARB);
- SET_GetDebugMessageLogARB(disp, _mesa_GetDebugMessageLogARB);
-}
-
-void
_mesa_init_errors(struct gl_context *ctx)
{
int s, t, sev;
diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h
index c41d36811..c92ee0a6e 100644
--- a/mesalib/src/mesa/main/errors.h
+++ b/mesalib/src/mesa/main/errors.h
@@ -48,9 +48,6 @@ struct _glapi_table;
struct gl_context;
extern void
-_mesa_init_errors_dispatch(struct _glapi_table *disp);
-
-extern void
_mesa_init_errors( struct gl_context *ctx );
extern void
diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c
index 59627cc43..44b57929e 100644
--- a/mesalib/src/mesa/main/eval.c
+++ b/mesalib/src/mesa/main/eval.c
@@ -311,7 +311,6 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
GLfloat *pnts;
struct gl_1d_map *map = NULL;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
if (u1 == u2) {
@@ -394,7 +393,6 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat *pnts;
struct gl_2d_map *map = NULL;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
if (u1==u2) {
@@ -501,8 +499,6 @@ _mesa_GetnMapdvARB( GLenum target, GLenum query, GLsizei bufSize, GLdouble *v )
GLuint comps;
GLsizei numBytes;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
comps = _mesa_evaluator_components(target);
if (!comps) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" );
@@ -593,8 +589,6 @@ _mesa_GetnMapfvARB( GLenum target, GLenum query, GLsizei bufSize, GLfloat *v )
GLuint comps;
GLsizei numBytes;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
comps = _mesa_evaluator_components(target);
if (!comps) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" );
@@ -687,8 +681,6 @@ _mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v )
GLuint comps;
GLsizei numBytes;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
comps = _mesa_evaluator_components(target);
if (!comps) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" );
@@ -774,7 +766,6 @@ void GLAPIENTRY
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (un<1) {
_mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" );
@@ -800,7 +791,6 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
GLint vn, GLfloat v1, GLfloat v2 )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (un<1) {
_mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 23b494836..fd25d31c6 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -45,6 +45,7 @@ enum {
GL = (1 << API_OPENGL_COMPAT) | (1 << API_OPENGL_CORE),
ES1 = 1 << API_OPENGLES,
ES2 = 1 << API_OPENGLES2,
+ ES3 = 1 << (API_OPENGL_LAST + 1),
};
/**
@@ -232,6 +233,7 @@ static const struct extension extension_table[] = {
{ "GL_EXT_unpack_subimage", o(dummy_true), ES2, 2011 },
{ "GL_EXT_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 },
{ "GL_EXT_vertex_array", o(dummy_true), GLL, 1995 },
+ { "GL_EXT_color_buffer_float", o(dummy_true), ES3, 2013 },
/* OES extensions */
{ "GL_OES_blend_equation_separate", o(EXT_blend_equation_separate), ES1, 2009 },
@@ -243,6 +245,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_depth24", o(EXT_framebuffer_object), ES1 | ES2, 2005 },
{ "GL_OES_depth32", o(dummy_false), DISABLE, 2005 },
{ "GL_OES_depth_texture", o(ARB_depth_texture), ES2, 2006 },
+ { "GL_OES_depth_texture_cube_map", o(OES_depth_texture_cube_map), ES2, 2012 },
{ "GL_OES_draw_texture", o(OES_draw_texture), ES1, 2004 },
/* FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */
{ "GL_OES_EGL_image", o(OES_EGL_image), GL | ES1 | ES2, 2006 },
@@ -745,6 +748,9 @@ _mesa_make_extension_string(struct gl_context *ctx)
const struct extension *i;
unsigned j;
unsigned maxYear = ~0;
+ unsigned api_set = (1 << ctx->API);
+ if (_mesa_is_gles3(ctx))
+ api_set |= ES3;
/* Check if the MESA_EXTENSION_MAX_YEAR env var is set */
{
@@ -761,7 +767,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
for (i = extension_table; i->name != 0; ++i) {
if (base[i->offset] &&
i->year <= maxYear &&
- (i->api_set & (1 << ctx->API))) {
+ (i->api_set & api_set)) {
length += strlen(i->name) + 1; /* +1 for space */
++count;
}
@@ -791,7 +797,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
for (i = extension_table; i->name != 0; ++i) {
if (base[i->offset] &&
i->year <= maxYear &&
- (i->api_set & (1 << ctx->API))) {
+ (i->api_set & api_set)) {
extension_indices[j++] = i - extension_table;
}
}
@@ -801,7 +807,7 @@ _mesa_make_extension_string(struct gl_context *ctx)
/* Build the extension string.*/
for (j = 0; j < count; ++j) {
i = &extension_table[extension_indices[j]];
- assert(base[i->offset] && (i->api_set & (1 << ctx->API)));
+ assert(base[i->offset] && (i->api_set & api_set));
strcat(exts, i->name);
strcat(exts, " ");
}
@@ -822,6 +828,9 @@ _mesa_get_extension_count(struct gl_context *ctx)
{
GLboolean *base;
const struct extension *i;
+ unsigned api_set = (1 << ctx->API);
+ if (_mesa_is_gles3(ctx))
+ api_set |= ES3;
/* only count once */
if (ctx->Extensions.Count != 0)
@@ -829,7 +838,7 @@ _mesa_get_extension_count(struct gl_context *ctx)
base = (GLboolean *) &ctx->Extensions;
for (i = extension_table; i->name != 0; ++i) {
- if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
+ if (base[i->offset] && (i->api_set & api_set)) {
ctx->Extensions.Count++;
}
}
@@ -845,11 +854,14 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
const GLboolean *base;
size_t n;
const struct extension *i;
+ unsigned api_set = (1 << ctx->API);
+ if (_mesa_is_gles3(ctx))
+ api_set |= ES3;
base = (GLboolean*) &ctx->Extensions;
n = 0;
for (i = extension_table; i->name != 0; ++i) {
- if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
+ if (base[i->offset] && (i->api_set & api_set)) {
if (n == index)
return (const GLubyte*) i->name;
else
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 9db5035d1..257f839a6 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -523,6 +523,50 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
/**
+ * Is the given base format a legal format for a color renderbuffer?
+ */
+static GLboolean
+is_format_color_renderable(const struct gl_context *ctx, gl_format format, GLenum internalFormat)
+{
+ const GLenum baseFormat =
+ _mesa_get_format_base_format(format);
+ GLboolean valid;
+
+ valid = _mesa_is_legal_color_format(ctx, baseFormat);
+ if (!valid || _mesa_is_desktop_gl(ctx)) {
+ return valid;
+ }
+
+ /* Reject additional cases for GLES */
+ switch (internalFormat) {
+ case GL_RGBA8_SNORM:
+ case GL_RGB32F:
+ case GL_RGB32I:
+ case GL_RGB32UI:
+ case GL_RGB16F:
+ case GL_RGB16I:
+ case GL_RGB16UI:
+ case GL_RGB8_SNORM:
+ case GL_RGB8I:
+ case GL_RGB8UI:
+ case GL_SRGB8:
+ case GL_RGB9_E5:
+ case GL_RG8_SNORM:
+ case GL_R8_SNORM:
+ return GL_FALSE;
+ default:
+ break;
+ }
+
+ if (format == MESA_FORMAT_ARGB2101010 && internalFormat != GL_RGB10_A2) {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+
+/**
* Is the given base format a legal format for a depth/stencil renderbuffer?
*/
static GLboolean
@@ -770,7 +814,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
f = texImg->_BaseFormat;
attFormat = texImg->TexFormat;
numImages++;
- if (!_mesa_is_legal_color_format(ctx, f) &&
+ if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) &&
!is_legal_depth_format(ctx, f)) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
fbo_incomplete("texture attachment incomplete", -1);
@@ -923,8 +967,6 @@ _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
struct gl_renderbuffer *newRb;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (target != GL_RENDERBUFFER_EXT) {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindRenderbufferEXT(target)");
return;
@@ -997,7 +1039,6 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
GLint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
for (i = 0; i < n; i++) {
@@ -1043,8 +1084,6 @@ _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
GLuint first;
GLint i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGenRenderbuffersEXT(n)");
return;
@@ -1217,21 +1256,27 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
case GL_R16F:
case GL_R32F:
- return (_mesa_is_desktop_gl(ctx) &&
- ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
+ return ((_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.ARB_texture_float) ||
+ _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ )
+ ? GL_RED : 0;
case GL_RG16F:
case GL_RG32F:
- return (_mesa_is_desktop_gl(ctx) &&
- ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
+ return ((_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.ARB_texture_float) ||
+ _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ )
+ ? GL_RG : 0;
case GL_RGB16F:
case GL_RGB32F:
return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
? GL_RGB : 0;
case GL_RGBA16F:
case GL_RGBA32F:
- return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
+ return ((_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.ARB_texture_float) ||
+ _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ )
? GL_RGBA : 0;
case GL_ALPHA16F_ARB:
case GL_ALPHA32F_ARB:
@@ -1258,7 +1303,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
&& ctx->Extensions.EXT_texture_shared_exponent)
? GL_RGB : 0;
case GL_R11F_G11F_B10F:
- return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float)
+ return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float) ||
+ _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ )
? GL_RGB : 0;
case GL_RGBA8UI_EXT:
@@ -1399,8 +1445,6 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
GLenum baseFormat;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (MESA_VERBOSE & VERBOSE_API) {
if (samples == NO_SAMPLES)
_mesa_debug(ctx, "%s(%s, %s, %d, %d)\n",
@@ -1423,7 +1467,8 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
baseFormat = _mesa_base_fbo_format(ctx, internalFormat);
if (baseFormat == 0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat)", func);
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat=%s)",
+ func, _mesa_lookup_enum_by_nr(internalFormat));
return;
}
@@ -1500,7 +1545,6 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
{
struct gl_renderbuffer *rb;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.OES_EGL_image) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -1594,8 +1638,6 @@ _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
struct gl_renderbuffer *rb;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (target != GL_RENDERBUFFER_EXT) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetRenderbufferParameterivEXT(target)");
@@ -1721,8 +1763,6 @@ _mesa_BindFramebuffer(GLenum target, GLuint framebuffer)
}
#endif
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (!ctx->Extensions.EXT_framebuffer_object) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBindFramebufferEXT(unsupported)");
@@ -1848,7 +1888,6 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
GLint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
for (i = 0; i < n; i++) {
@@ -1903,8 +1942,6 @@ _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers)
GLuint first;
GLint i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGenFramebuffersEXT(n)");
return;
@@ -2001,8 +2038,6 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
struct gl_framebuffer *fb;
GLenum maxLevelsTarget;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
fb = get_framebuffer_target(ctx, target);
if (!fb) {
_mesa_error(ctx, GL_INVALID_ENUM,
@@ -2276,8 +2311,6 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
struct gl_renderbuffer *rb;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
fb = get_framebuffer_target(ctx, target);
if (!fb) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferRenderbufferEXT(target)");
@@ -2359,8 +2392,6 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
GLenum err;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
/* The error differs in GL and GLES. */
err = _mesa_is_desktop_gl(ctx) ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
@@ -2524,6 +2555,22 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
}
else {
gl_format format = att->Renderbuffer->Format;
+
+ /* Page 235 (page 247 of the PDF) in section 6.1.13 of the OpenGL ES
+ * 3.0.1 spec says:
+ *
+ * "If pname is FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE.... If
+ * attachment is DEPTH_STENCIL_ATTACHMENT the query will fail and
+ * generate an INVALID_OPERATION error.
+ */
+ if (_mesa_is_gles3(ctx) && attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetFramebufferAttachmentParameteriv(cannot query "
+ "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE of "
+ "GL_DEPTH_STENCIL_ATTACHMENT");
+ return;
+ }
+
if (format == MESA_FORMAT_S8) {
/* special cases */
*params = GL_INDEX;
@@ -2599,7 +2646,6 @@ _mesa_GenerateMipmap(GLenum target)
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
switch (target) {
@@ -2784,7 +2830,6 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
const struct gl_framebuffer *readFb, *drawFb;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
if (MESA_VERBOSE & VERBOSE_API)
@@ -2856,6 +2901,23 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
if (!colorDrawRb)
continue;
+ /* Page 193 (page 205 of the PDF) in section 4.3.2 of the OpenGL
+ * ES 3.0.1 spec says:
+ *
+ * "If the source and destination buffers are identical, an
+ * INVALID_OPERATION error is generated. Different mipmap
+ * levels of a texture, different layers of a three-
+ * dimensional texture or two-dimensional array texture, and
+ * different faces of a cube map texture do not constitute
+ * identical buffers."
+ */
+ if (_mesa_is_gles3(ctx) && (colorDrawRb == colorReadRb)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebuffer(source and destination color "
+ "buffer cannot be the same)");
+ return;
+ }
+
if (!compatible_color_datatypes(colorReadRb->Format,
colorDrawRb->Format)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2905,6 +2967,13 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
else {
int read_z_bits, draw_z_bits;
+ if (_mesa_is_gles3(ctx) && (drawRb == readRb)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebuffer(source and destination stencil "
+ "buffer cannot be the same)");
+ return;
+ }
+
if (_mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) !=
_mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) {
/* There is no need to check the stencil datatype here, because
@@ -2952,6 +3021,13 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
else {
int read_s_bit, draw_s_bit;
+ if (_mesa_is_gles3(ctx) && (drawRb == readRb)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebuffer(source and destination depth "
+ "buffer cannot be the same)");
+ return;
+ }
+
if ((_mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) !=
_mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) ||
(_mesa_get_format_datatype(readRb->Format) !=
@@ -2976,23 +3052,58 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
}
}
- if (readFb->Visual.samples > 0 &&
- drawFb->Visual.samples > 0 &&
- readFb->Visual.samples != drawFb->Visual.samples) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBlitFramebufferEXT(mismatched samples)");
- return;
- }
- /* extra checks for multisample copies... */
- if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) {
- /* src and dest region sizes must be the same */
- if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) ||
- abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) {
+ if (_mesa_is_gles3(ctx)) {
+ /* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES
+ * 3.0.1 spec says:
+ *
+ * "If SAMPLE_BUFFERS for the draw framebuffer is greater than zero,
+ * an INVALID_OPERATION error is generated."
+ */
+ if (drawFb->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glBlitFramebufferEXT(bad src/dst multisample region sizes)");
+ "glBlitFramebuffer(destination samples must be 0)");
return;
}
+
+ /* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES
+ * 3.0.1 spec says:
+ *
+ * "If SAMPLE_BUFFERS for the read framebuffer is greater than zero,
+ * no copy is performed and an INVALID_OPERATION error is generated
+ * if the formats of the read and draw framebuffers are not
+ * identical or if the source and destination rectangles are not
+ * defined with the same (X0, Y0) and (X1, Y1) bounds."
+ *
+ * The format check was made above because desktop OpenGL has the same
+ * requirement.
+ */
+ if (readFb->Visual.samples > 0
+ && (srcX0 != dstX0 || srcY0 != dstY0
+ || srcX1 != dstX1 || srcY1 != dstY1)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebuffer(bad src/dst multisample region)");
+ return;
+ }
+ } else {
+ if (readFb->Visual.samples > 0 &&
+ drawFb->Visual.samples > 0 &&
+ readFb->Visual.samples != drawFb->Visual.samples) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebufferEXT(mismatched samples)");
+ return;
+ }
+
+ /* extra checks for multisample copies... */
+ if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) {
+ /* src and dest region sizes must be the same */
+ if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) ||
+ abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebufferEXT(bad src/dst multisample region sizes)");
+ return;
+ }
+ }
}
if (!ctx->Extensions.EXT_framebuffer_blit) {
@@ -3070,8 +3181,6 @@ invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments,
struct gl_framebuffer *fb;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
fb = get_framebuffer_target(ctx, target);
if (!fb) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", name);
diff --git a/mesalib/src/mesa/main/feedback.c b/mesalib/src/mesa/main/feedback.c
index 128a12622..5d4c6e40d 100644
--- a/mesalib/src/mesa/main/feedback.c
+++ b/mesalib/src/mesa/main/feedback.c
@@ -51,7 +51,6 @@ void GLAPIENTRY
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->RenderMode==GL_FEEDBACK) {
_mesa_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" );
@@ -100,7 +99,6 @@ void GLAPIENTRY
_mesa_PassThrough( GLfloat token )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->RenderMode==GL_FEEDBACK) {
FLUSH_VERTICES(ctx, 0);
@@ -163,7 +161,6 @@ void GLAPIENTRY
_mesa_SelectBuffer( GLsizei size, GLuint *buffer )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (size < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSelectBuffer(size)");
@@ -275,7 +272,7 @@ void GLAPIENTRY
_mesa_InitNames( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
/* Record the hit before the HitFlag is wiped out again. */
if (ctx->RenderMode == GL_SELECT) {
@@ -306,7 +303,6 @@ void GLAPIENTRY
_mesa_LoadName( GLuint name )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->RenderMode != GL_SELECT) {
return;
@@ -345,7 +341,6 @@ void GLAPIENTRY
_mesa_PushName( GLuint name )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->RenderMode != GL_SELECT) {
return;
@@ -376,7 +371,6 @@ void GLAPIENTRY
_mesa_PopName( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->RenderMode != GL_SELECT) {
return;
diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c
index b37e95f08..3c5228ad5 100644
--- a/mesalib/src/mesa/main/fog.c
+++ b/mesalib/src/mesa/main/fog.c
@@ -97,7 +97,6 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLenum m;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_FOG_MODE:
diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c
index 8cbfbd6bc..d3abc2b30 100644
--- a/mesalib/src/mesa/main/framebuffer.c
+++ b/mesalib/src/mesa/main/framebuffer.c
@@ -335,7 +335,7 @@ _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
void
_mesa_resizebuffers( struct gl_context *ctx )
{
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glResizeBuffersMESA\n");
@@ -871,13 +871,20 @@ _mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format)
GLenum
_mesa_get_color_read_format(struct gl_context *ctx)
{
+ const GLenum data_type = _mesa_get_format_datatype(
+ ctx->ReadBuffer->_ColorReadBuffer->Format);
+
switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
case MESA_FORMAT_ARGB8888:
return GL_BGRA;
case MESA_FORMAT_RGB565:
return GL_BGR;
default:
- return GL_RGBA;
+ if (data_type == GL_UNSIGNED_INT || data_type == GL_INT) {
+ return GL_RGBA_INTEGER;
+ } else {
+ return GL_RGBA;
+ }
}
}
@@ -888,12 +895,25 @@ _mesa_get_color_read_format(struct gl_context *ctx)
GLenum
_mesa_get_color_read_type(struct gl_context *ctx)
{
+ const GLenum data_type = _mesa_get_format_datatype(
+ ctx->ReadBuffer->_ColorReadBuffer->Format);
+
switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
- case MESA_FORMAT_ARGB8888:
- return GL_UNSIGNED_BYTE;
case MESA_FORMAT_RGB565:
return GL_UNSIGNED_SHORT_5_6_5_REV;
default:
+ break;
+ }
+
+ switch (data_type) {
+ case GL_SIGNED_NORMALIZED:
+ return GL_BYTE;
+ case GL_UNSIGNED_INT:
+ case GL_INT:
+ case GL_FLOAT:
+ return data_type;
+ case GL_UNSIGNED_NORMALIZED:
+ default:
return GL_UNSIGNED_BYTE;
}
}
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 7d922ca15..5f4e2fa51 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -1076,9 +1076,6 @@ _mesa_GetBooleanv(GLenum pname, GLboolean *params)
GLmatrix *m;
int shift, i;
void *p;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
d = find_value("glGetBooleanv", pname, &p, &v);
switch (d->type) {
@@ -1165,9 +1162,6 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params)
GLmatrix *m;
int shift, i;
void *p;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
d = find_value("glGetFloatv", pname, &p, &v);
switch (d->type) {
@@ -1254,9 +1248,6 @@ _mesa_GetIntegerv(GLenum pname, GLint *params)
GLmatrix *m;
int shift, i;
void *p;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
d = find_value("glGetIntegerv", pname, &p, &v);
switch (d->type) {
@@ -1349,9 +1340,6 @@ _mesa_GetInteger64v(GLenum pname, GLint64 *params)
GLmatrix *m;
int shift, i;
void *p;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
d = find_value("glGetInteger64v", pname, &p, &v);
switch (d->type) {
@@ -1444,9 +1432,6 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params)
GLmatrix *m;
int shift, i;
void *p;
- GET_CURRENT_CONTEXT(ctx);
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
d = find_value("glGetDoublev", pname, &p, &v);
switch (d->type) {
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index 20e7a014d..1f23cc0a4 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -195,7 +195,6 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
{
GET_CURRENT_CONTEXT(ctx);
const GLuint clientUnit = ctx->Array.ActiveTexture;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index 7969f77a4..e4f784179 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -1697,8 +1697,7 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum type,
*/
GLenum
_mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
- GLenum internalFormat,
- unsigned dimensions)
+ GLenum internalFormat)
{
GLboolean type_valid = GL_TRUE;
@@ -2068,17 +2067,16 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
break;
case GL_DEPTH_COMPONENT:
- if (dimensions != 2) {
- return GL_INVALID_OPERATION;
- }
switch (type) {
case GL_UNSIGNED_SHORT:
- if (internalFormat != GL_DEPTH_COMPONENT16)
+ if (internalFormat != GL_DEPTH_COMPONENT
+ && internalFormat != GL_DEPTH_COMPONENT16)
return GL_INVALID_OPERATION;
break;
case GL_UNSIGNED_INT:
switch (internalFormat) {
+ case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT24:
break;
@@ -2098,12 +2096,10 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
break;
case GL_DEPTH_STENCIL:
- if (dimensions != 2) {
- return GL_INVALID_OPERATION;
- }
switch (type) {
case GL_UNSIGNED_INT_24_8:
- if (internalFormat != GL_DEPTH24_STENCIL8)
+ if (internalFormat != GL_DEPTH_STENCIL
+ && internalFormat != GL_DEPTH24_STENCIL8)
return GL_INVALID_OPERATION;
break;
diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h
index 4cbc82f5e..cdd2b9427 100644
--- a/mesalib/src/mesa/main/glformats.h
+++ b/mesalib/src/mesa/main/glformats.h
@@ -122,8 +122,7 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum type,
extern GLenum
_mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
- GLenum internalFormat,
- unsigned dimensions);
+ GLenum internalFormat);
#ifdef __cplusplus
diff --git a/mesalib/src/mesa/main/hint.c b/mesalib/src/mesa/main/hint.c
index 83d7966cd..c2560192a 100644
--- a/mesalib/src/mesa/main/hint.c
+++ b/mesalib/src/mesa/main/hint.c
@@ -37,7 +37,6 @@ void GLAPIENTRY
_mesa_Hint( GLenum target, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glHint %s %s\n",
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index aae5d0ae9..3c43ec766 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -39,7 +39,6 @@ void GLAPIENTRY
_mesa_ShadeModel( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
@@ -69,7 +68,6 @@ void GLAPIENTRY
_mesa_ProvokingVertex(GLenum mode)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glProvokingVertexEXT 0x%x\n", mode);
@@ -212,7 +210,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
GET_CURRENT_CONTEXT(ctx);
GLint i = (GLint) (light - GL_LIGHT0);
GLfloat temp[4];
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (i < 0 || i >= (GLint) ctx->Const.MaxLights) {
_mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light );
@@ -335,7 +332,6 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLint l = (GLint) (light - GL_LIGHT0);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (l < 0 || l >= (GLint) ctx->Const.MaxLights) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" );
@@ -385,7 +381,6 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
GLint l = (GLint) (light - GL_LIGHT0);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (l < 0 || l >= (GLint) ctx->Const.MaxLights) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" );
@@ -456,7 +451,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
GLenum newenum;
GLboolean newbool;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_LIGHT_MODEL_AMBIENT:
@@ -729,7 +723,6 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_SPECULAR |
MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE |
MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glColorMaterial %s %s\n",
@@ -766,7 +759,7 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
GET_CURRENT_CONTEXT(ctx);
GLuint f;
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
+ FLUSH_VERTICES(ctx, 0); /* update materials */
FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */
@@ -818,10 +811,10 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
GET_CURRENT_CONTEXT(ctx);
GLuint f;
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
ASSERT(ctx->API == API_OPENGL_COMPAT);
+ FLUSH_VERTICES(ctx, 0); /* update materials */
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 e400b3913..a01219c42 100644
--- a/mesalib/src/mesa/main/lines.c
+++ b/mesalib/src/mesa/main/lines.c
@@ -41,7 +41,6 @@ void GLAPIENTRY
_mesa_LineWidth( GLfloat width )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glLineWidth %f\n", width);
@@ -95,7 +94,6 @@ void GLAPIENTRY
_mesa_LineStipple( GLint factor, GLushort pattern )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glLineStipple %d %u\n", factor, pattern);
diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c
index a4e576237..f2fd56787 100644
--- a/mesalib/src/mesa/main/matrix.c
+++ b/mesalib/src/mesa/main/matrix.c
@@ -68,7 +68,8 @@ _mesa_Frustum( GLdouble left, GLdouble right,
GLdouble nearval, GLdouble farval )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (nearval <= 0.0 ||
farval <= 0.0 ||
@@ -110,7 +111,8 @@ _mesa_Ortho( GLdouble left, GLdouble right,
GLdouble nearval, GLdouble farval )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glOrtho(%f, %f, %f, %f, %f, %f)\n",
@@ -147,7 +149,6 @@ void GLAPIENTRY
_mesa_MatrixMode( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Transform.MatrixMode == mode && mode != GL_TEXTURE)
return;
@@ -226,7 +227,6 @@ _mesa_PushMatrix( void )
{
GET_CURRENT_CONTEXT(ctx);
struct gl_matrix_stack *stack = ctx->CurrentStack;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glPushMatrix %s\n",
@@ -266,7 +266,8 @@ _mesa_PopMatrix( void )
{
GET_CURRENT_CONTEXT(ctx);
struct gl_matrix_stack *stack = ctx->CurrentStack;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glPopMatrix %s\n",
@@ -303,7 +304,8 @@ void GLAPIENTRY
_mesa_LoadIdentity( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glLoadIdentity()\n");
@@ -337,7 +339,7 @@ _mesa_LoadMatrixf( const GLfloat *m )
m[2], m[6], m[10], m[14],
m[3], m[7], m[11], m[15]);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
_math_matrix_loadf( ctx->CurrentStack->Top, m );
ctx->NewState |= ctx->CurrentStack->DirtyFlag;
}
@@ -366,7 +368,8 @@ _mesa_MultMatrixf( const GLfloat *m )
m[1], m[5], m[9], m[13],
m[2], m[6], m[10], m[14],
m[3], m[7], m[11], m[15]);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
_math_matrix_mul_floats( ctx->CurrentStack->Top, m );
ctx->NewState |= ctx->CurrentStack->DirtyFlag;
}
@@ -390,7 +393,8 @@ void GLAPIENTRY
_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (angle != 0.0F) {
_math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z);
ctx->NewState |= ctx->CurrentStack->DirtyFlag;
@@ -415,7 +419,8 @@ void GLAPIENTRY
_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
_math_matrix_scale( ctx->CurrentStack->Top, x, y, z);
ctx->NewState |= ctx->CurrentStack->DirtyFlag;
}
@@ -438,7 +443,8 @@ void GLAPIENTRY
_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
_math_matrix_translate( ctx->CurrentStack->Top, x, y, z);
ctx->NewState |= ctx->CurrentStack->DirtyFlag;
}
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index d0c0e24ac..ead75d50e 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2274,7 +2274,6 @@ struct gl_uniform_buffer_variable
{
char *Name;
const struct glsl_type *Type;
- unsigned int Buffer;
unsigned int Offset;
GLboolean RowMajor;
};
@@ -3134,6 +3133,7 @@ struct gl_extensions
GLboolean S3_s3tc;
GLboolean OES_EGL_image;
GLboolean OES_draw_texture;
+ GLboolean OES_depth_texture_cube_map;
GLboolean OES_EGL_image_external;
GLboolean OES_compressed_ETC1_RGB8_texture;
GLboolean extension_sentinel;
@@ -3440,9 +3440,28 @@ struct gl_context
/** \name API function pointer tables */
/*@{*/
gl_api API;
- struct _glapi_table *Save; /**< Display list save functions */
- struct _glapi_table *Exec; /**< Execute functions */
- struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */
+ /**
+ * The current dispatch table for non-displaylist-saving execution, either
+ * BeginEnd or OutsideBeginEnd
+ */
+ struct _glapi_table *Exec;
+ /**
+ * The normal dispatch table for non-displaylist-saving, non-begin/end
+ */
+ struct _glapi_table *OutsideBeginEnd;
+ /** The dispatch table used between glNewList() and glEndList() */
+ struct _glapi_table *Save;
+ /**
+ * The dispatch table used between glBegin() and glEnd() (outside of a
+ * display list). Only valid functions between those two are set, which is
+ * mostly just the set in a GLvertexformat struct.
+ */
+ struct _glapi_table *BeginEnd;
+ /**
+ * Tracks the current dispatch table out of the 3 above, so that it can be
+ * re-set on glXMakeCurrent().
+ */
+ struct _glapi_table *CurrentDispatch;
/*@}*/
struct gl_config Visual;
diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c
index 347e98e4e..f792ad01e 100644
--- a/mesalib/src/mesa/main/multisample.c
+++ b/mesalib/src/mesa/main/multisample.c
@@ -38,7 +38,7 @@ _mesa_SampleCoverage(GLclampf value, GLboolean invert)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
+ FLUSH_VERTICES(ctx, 0);
ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0);
ctx->Multisample.SampleCoverageInvert = invert;
diff --git a/mesalib/src/mesa/main/pixel.c b/mesalib/src/mesa/main/pixel.c
index 9940eda52..e9f75a7df 100644
--- a/mesalib/src/mesa/main/pixel.c
+++ b/mesalib/src/mesa/main/pixel.c
@@ -49,8 +49,6 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (ctx->Pixel.ZoomX == xfactor &&
ctx->Pixel.ZoomY == yfactor)
return;
@@ -181,7 +179,6 @@ void GLAPIENTRY
_mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
/* XXX someday, test against ctx->Const.MaxPixelMapTableSize */
if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) {
@@ -224,7 +221,6 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
{
GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" );
@@ -280,7 +276,6 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
{
GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapusv(mapsize)" );
@@ -338,8 +333,6 @@ _mesa_GetnPixelMapfvARB( GLenum map, GLsizei bufSize, GLfloat *values )
GLint mapsize, i;
const struct gl_pixelmap *pm;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
pm = get_pixelmap(ctx, map);
if (!pm) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapfv(map)");
@@ -389,8 +382,6 @@ _mesa_GetnPixelMapuivARB( GLenum map, GLsizei bufSize, GLuint *values )
GLint mapsize, i;
const struct gl_pixelmap *pm;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
pm = get_pixelmap(ctx, map);
if (!pm) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapuiv(map)");
@@ -440,8 +431,6 @@ _mesa_GetnPixelMapusvARB( GLenum map, GLsizei bufSize, GLushort *values )
GLint mapsize, i;
const struct gl_pixelmap *pm;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
pm = get_pixelmap(ctx, map);
if (!pm) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapusv(map)");
@@ -506,7 +495,6 @@ void GLAPIENTRY
_mesa_PixelTransferf( GLenum pname, GLfloat param )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_MAP_COLOR:
diff --git a/mesalib/src/mesa/main/pixelstore.c b/mesalib/src/mesa/main/pixelstore.c
index e56d5049f..01068e8ea 100644
--- a/mesalib/src/mesa/main/pixelstore.c
+++ b/mesalib/src/mesa/main/pixelstore.c
@@ -41,7 +41,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
{
/* NOTE: this call can't be compiled into the display list */
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (pname) {
case GL_PACK_SWAP_BYTES:
diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c
index b5fc5d5bb..17786408c 100644
--- a/mesalib/src/mesa/main/points.c
+++ b/mesalib/src/mesa/main/points.c
@@ -44,7 +44,6 @@ void GLAPIENTRY
_mesa_PointSize( GLfloat size )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (size <= 0.0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" );
@@ -99,7 +98,6 @@ void GLAPIENTRY
_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
diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c
index eb53f8a4a..cdef01a2f 100644
--- a/mesalib/src/mesa/main/polygon.c
+++ b/mesalib/src/mesa/main/polygon.c
@@ -54,7 +54,6 @@ void GLAPIENTRY
_mesa_CullFace( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode));
@@ -90,7 +89,6 @@ void GLAPIENTRY
_mesa_FrontFace( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode));
@@ -129,7 +127,6 @@ void GLAPIENTRY
_mesa_PolygonMode( GLenum face, GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glPolygonMode %s %s\n",
@@ -220,7 +217,6 @@ void GLAPIENTRY
_mesa_PolygonStipple( const GLubyte *pattern )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glPolygonStipple\n");
@@ -241,7 +237,6 @@ void GLAPIENTRY
_mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glGetPolygonStipple\n");
@@ -270,7 +265,6 @@ void GLAPIENTRY
_mesa_PolygonOffset( GLfloat factor, GLfloat units )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units);
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index bd7d0d297..3fdb75323 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -192,7 +192,6 @@ _mesa_GenQueries(GLsizei n, GLuint *ids)
{
GLuint first;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGenQueries(%d)\n", n);
@@ -231,7 +230,6 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids)
{
GLint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
@@ -309,7 +307,6 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
{
struct gl_query_object *q, **bindpt;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glBeginQueryIndexed(%s, %u, %u)\n",
@@ -387,7 +384,6 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index)
{
struct gl_query_object *q, **bindpt;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glEndQueryIndexed(%s, %u)\n",
@@ -445,7 +441,6 @@ _mesa_QueryCounter(GLuint id, GLenum target)
{
struct gl_query_object *q;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glQueryCounter(%u, %s)\n", id,
@@ -503,7 +498,6 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname,
{
struct gl_query_object *q = NULL, **bindpt = NULL;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetQueryIndexediv(%s, %u, %s)\n",
@@ -583,7 +577,6 @@ _mesa_GetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
{
struct gl_query_object *q = NULL;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetQueryObjectiv(%u, %s)\n", id,
@@ -635,7 +628,6 @@ _mesa_GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
{
struct gl_query_object *q = NULL;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetQueryObjectuiv(%u, %s)\n", id,
@@ -690,7 +682,6 @@ _mesa_GetQueryObjecti64v(GLuint id, GLenum pname, GLint64EXT *params)
{
struct gl_query_object *q = NULL;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetQueryObjecti64v(%u, %s)\n", id,
@@ -731,7 +722,6 @@ _mesa_GetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params)
{
struct gl_query_object *q = NULL;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetQueryObjectui64v(%u, %s)\n", id,
@@ -763,33 +753,6 @@ _mesa_GetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params)
}
}
-
-void
-_mesa_init_queryobj_dispatch(const struct gl_context *ctx,
- struct _glapi_table *disp)
-{
- SET_GenQueries(disp, _mesa_GenQueries);
- SET_DeleteQueries(disp, _mesa_DeleteQueries);
- SET_IsQuery(disp, _mesa_IsQuery);
- SET_BeginQuery(disp, _mesa_BeginQuery);
- SET_EndQuery(disp, _mesa_EndQuery);
- SET_GetQueryiv(disp, _mesa_GetQueryiv);
- SET_GetQueryObjectuiv(disp, _mesa_GetQueryObjectuiv);
-
- if (_mesa_is_desktop_gl(ctx)) {
- SET_GetQueryObjectiv(disp, _mesa_GetQueryObjectiv);
- SET_QueryCounter(disp, _mesa_QueryCounter);
-
- SET_GetQueryObjecti64v(disp, _mesa_GetQueryObjecti64v);
- SET_GetQueryObjectui64v(disp, _mesa_GetQueryObjectui64v);
-
- SET_BeginQueryIndexed(disp, _mesa_BeginQueryIndexed);
- SET_EndQueryIndexed(disp, _mesa_EndQueryIndexed);
- SET_GetQueryIndexediv(disp, _mesa_GetQueryIndexediv);
- }
-}
-
-
/**
* Allocate/init the context state related to query objects.
*/
diff --git a/mesalib/src/mesa/main/queryobj.h b/mesalib/src/mesa/main/queryobj.h
index 78cbfc294..0616c943e 100644
--- a/mesalib/src/mesa/main/queryobj.h
+++ b/mesalib/src/mesa/main/queryobj.h
@@ -44,10 +44,6 @@ extern void
_mesa_init_query_object_functions(struct dd_function_table *driver);
extern void
-_mesa_init_queryobj_dispatch(const struct gl_context *ctx,
- struct _glapi_table *disp);
-
-extern void
_mesa_init_queryobj(struct gl_context *ctx);
extern void
diff --git a/mesalib/src/mesa/main/rastpos.c b/mesalib/src/mesa/main/rastpos.c
index 51747acab..5a030be44 100644
--- a/mesalib/src/mesa/main/rastpos.c
+++ b/mesalib/src/mesa/main/rastpos.c
@@ -53,7 +53,7 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
p[2] = z;
p[3] = w;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
if (ctx->NewState)
@@ -225,7 +225,7 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z)
GET_CURRENT_CONTEXT(ctx);
GLfloat z2;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near)
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c
index 5b80e9a8b..2f130ae9a 100644
--- a/mesalib/src/mesa/main/readpix.c
+++ b/mesalib/src/mesa/main/readpix.c
@@ -674,16 +674,65 @@ _mesa_readpixels(struct gl_context *ctx,
}
+static GLenum
+read_pixels_es3_error_check(GLenum format, GLenum type,
+ const struct gl_renderbuffer *rb)
+{
+ const GLenum internalFormat = rb->InternalFormat;
+ const GLenum data_type = _mesa_get_format_datatype(rb->Format);
+ GLboolean is_unsigned_int = GL_FALSE;
+ GLboolean is_signed_int = GL_FALSE;
+
+ if (!_mesa_is_color_format(internalFormat)) {
+ return GL_INVALID_OPERATION;
+ }
+
+ is_unsigned_int = _mesa_is_enum_format_unsigned_int(internalFormat);
+ if (!is_unsigned_int) {
+ is_signed_int = _mesa_is_enum_format_signed_int(internalFormat);
+ }
+
+ switch (format) {
+ case GL_RGBA:
+ if (type == GL_FLOAT && data_type == GL_FLOAT)
+ return GL_NO_ERROR; /* EXT_color_buffer_float */
+ if (type == GL_UNSIGNED_BYTE && data_type == GL_UNSIGNED_NORMALIZED)
+ return GL_NO_ERROR;
+ if (internalFormat == GL_RGB10_A2 &&
+ type == GL_UNSIGNED_INT_2_10_10_10_REV)
+ return GL_NO_ERROR;
+ if (internalFormat == GL_RGB10_A2UI && type == GL_UNSIGNED_BYTE)
+ return GL_NO_ERROR;
+ break;
+ case GL_BGRA:
+ /* GL_EXT_read_format_bgra */
+ if (type == GL_UNSIGNED_BYTE ||
+ type == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
+ type == GL_UNSIGNED_SHORT_1_5_5_5_REV)
+ return GL_NO_ERROR;
+ break;
+ case GL_RGBA_INTEGER:
+ if ((is_signed_int && type == GL_INT) ||
+ (is_unsigned_int && type == GL_UNSIGNED_INT))
+ return GL_NO_ERROR;
+ break;
+ }
+
+ return GL_INVALID_OPERATION;
+}
+
+
void GLAPIENTRY
_mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, GLsizei bufSize,
GLvoid *pixels )
{
GLenum err = GL_NO_ERROR;
+ struct gl_renderbuffer *rb;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
@@ -699,6 +748,22 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+ "glReadPixels(incomplete framebuffer)" );
+ return;
+ }
+
+ rb = _mesa_get_read_renderbuffer_for_format(ctx, format);
+ if (rb == NULL) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glReadPixels(read buffer)");
+ return;
+ }
+
/* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
* combinations of format and type that can be used.
*
@@ -708,13 +773,20 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
* combination is, and Mesa can handle anything valid. Just work instead.
*/
if (_mesa_is_gles(ctx)) {
- if (ctx->Version < 30) {
+ if (ctx->API == API_OPENGLES2 &&
+ _mesa_is_color_format(format) &&
+ _mesa_get_color_read_format(ctx) == format &&
+ _mesa_get_color_read_type(ctx) == type) {
+ err = GL_NO_ERROR;
+ } else if (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 {
+ err = read_pixels_es3_error_check(format, type, rb);
}
if (err == GL_NO_ERROR && (format == GL_DEPTH_COMPONENT
@@ -730,9 +802,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
}
}
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
err = _mesa_error_check_format_and_type(ctx, format, type);
if (err != GL_NO_ERROR) {
_mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)",
@@ -741,12 +810,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
- if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
- "glReadPixels(incomplete framebuffer)" );
- return;
- }
-
if (_mesa_is_user_fbo(ctx->ReadBuffer) &&
ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");
diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c
index 773bebf26..319a444d7 100644
--- a/mesalib/src/mesa/main/samplerobj.c
+++ b/mesalib/src/mesa/main/samplerobj.c
@@ -166,8 +166,6 @@ _mesa_GenSamplers(GLsizei count, GLuint *samplers)
GLuint first;
GLint i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGenSamplers(%d)\n", count);
@@ -197,7 +195,6 @@ _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
GET_CURRENT_CONTEXT(ctx);
GLsizei i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, 0);
if (count < 0) {
@@ -606,8 +603,6 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteri(sampler %u)",
@@ -693,8 +688,6 @@ _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterf(sampler %u)",
@@ -779,8 +772,6 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(sampler %u)",
@@ -873,8 +864,6 @@ _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterfv(sampler %u)",
@@ -960,8 +949,6 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIiv(sampler %u)",
@@ -1048,8 +1035,6 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIuiv(sampler %u)",
@@ -1135,8 +1120,6 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameteriv(sampler %u)",
@@ -1215,8 +1198,6 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameterfv(sampler %u)",
@@ -1295,8 +1276,6 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -1376,8 +1355,6 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -1457,27 +1434,3 @@ _mesa_init_sampler_object_functions(struct dd_function_table *driver)
driver->NewSamplerObject = _mesa_new_sampler_object;
driver->DeleteSamplerObject = _mesa_delete_sampler_object;
}
-
-
-void
-_mesa_init_sampler_object_dispatch(const struct gl_context *ctx,
- struct _glapi_table *disp)
-{
- SET_GenSamplers(disp, _mesa_GenSamplers);
- SET_DeleteSamplers(disp, _mesa_DeleteSamplers);
- SET_IsSampler(disp, _mesa_IsSampler);
- SET_BindSampler(disp, _mesa_BindSampler);
- SET_SamplerParameteri(disp, _mesa_SamplerParameteri);
- SET_SamplerParameterf(disp, _mesa_SamplerParameterf);
- SET_SamplerParameteriv(disp, _mesa_SamplerParameteriv);
- SET_SamplerParameterfv(disp, _mesa_SamplerParameterfv);
- SET_GetSamplerParameteriv(disp, _mesa_GetSamplerParameteriv);
- SET_GetSamplerParameterfv(disp, _mesa_GetSamplerParameterfv);
-
- if (_mesa_is_desktop_gl(ctx)) {
- SET_SamplerParameterIiv(disp, _mesa_SamplerParameterIiv);
- SET_SamplerParameterIuiv(disp, _mesa_SamplerParameterIuiv);
- SET_GetSamplerParameterIiv(disp, _mesa_GetSamplerParameterIiv);
- SET_GetSamplerParameterIuiv(disp, _mesa_GetSamplerParameterIuiv);
- }
-}
diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h
index dce7c6c30..311425701 100644
--- a/mesalib/src/mesa/main/samplerobj.h
+++ b/mesalib/src/mesa/main/samplerobj.h
@@ -69,10 +69,6 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name);
extern void
_mesa_init_sampler_object_functions(struct dd_function_table *driver);
-extern void
-_mesa_init_sampler_object_dispatch(const struct gl_context *ctx,
- struct _glapi_table *disp);
-
void GLAPIENTRY
_mesa_GenSamplers(GLsizei count, GLuint *samplers);
void GLAPIENTRY
diff --git a/mesalib/src/mesa/main/scissor.c b/mesalib/src/mesa/main/scissor.c
index df665994a..0c2a91f5c 100644
--- a/mesalib/src/mesa/main/scissor.c
+++ b/mesalib/src/mesa/main/scissor.c
@@ -36,7 +36,6 @@ void GLAPIENTRY
_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 7f5fce796..2590abe7e 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -1400,8 +1400,6 @@ _mesa_UseProgram(GLhandleARB program)
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUseProgram(transform feedback active)");
@@ -1522,8 +1520,6 @@ _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length,
struct gl_shader_program *shProg;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetProgramBinary");
if (!shProg)
return;
@@ -1558,8 +1554,6 @@ _mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
struct gl_shader_program *shProg;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramBinary");
if (!shProg)
return;
@@ -1577,8 +1571,6 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
struct gl_shader_program *shProg;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
shProg = _mesa_lookup_shader_program_err(ctx, program,
"glProgramParameteri");
if (!shProg)
@@ -1707,8 +1699,6 @@ _mesa_UseShaderProgramEXT(GLenum type, GLuint program)
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg = NULL;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (!validate_shader_target(ctx, type)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glUseShaderProgramEXT(type)");
return;
@@ -1799,84 +1789,3 @@ _mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
return program;
}
-
-/**
- * Plug in shader-related functions into API dispatch table.
- */
-void
-_mesa_init_shader_dispatch(const struct gl_context *ctx,
- struct _glapi_table *exec)
-{
-#if FEATURE_GL
- /* GL_ARB_vertex/fragment_shader */
- if (_mesa_is_desktop_gl(ctx)) {
- SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
- SET_GetHandleARB(exec, _mesa_GetHandleARB);
- SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
- SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
- SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
- SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
- SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
- SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
- SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
- SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
- }
-
- if (ctx->API != API_OPENGLES) {
- SET_ShaderSource(exec, _mesa_ShaderSource);
- SET_CompileShader(exec, _mesa_CompileShader);
- SET_LinkProgram(exec, _mesa_LinkProgram);
- SET_UseProgram(exec, _mesa_UseProgram);
- SET_ValidateProgram(exec, _mesa_ValidateProgram);
- SET_GetShaderSource(exec, _mesa_GetShaderSource);
-
- /* OpenGL 2.0 */
- SET_AttachShader(exec, _mesa_AttachShader);
- SET_CreateProgram(exec, _mesa_CreateProgram);
- SET_CreateShader(exec, _mesa_CreateShader);
- SET_DeleteProgram(exec, _mesa_DeleteProgram);
- SET_DeleteShader(exec, _mesa_DeleteShader);
- SET_DetachShader(exec, _mesa_DetachShader);
- SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
- SET_GetProgramiv(exec, _mesa_GetProgramiv);
- SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
- SET_GetShaderiv(exec, _mesa_GetShaderiv);
- SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
- SET_IsProgram(exec, _mesa_IsProgram);
- SET_IsShader(exec, _mesa_IsShader);
-
- /* GL_ARB_vertex_shader */
- SET_BindAttribLocation(exec, _mesa_BindAttribLocation);
- SET_GetActiveAttrib(exec, _mesa_GetActiveAttrib);
- SET_GetAttribLocation(exec, _mesa_GetAttribLocation);
- }
-
- if (ctx->API == API_OPENGL_COMPAT) {
- SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT);
- SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT);
- SET_CreateShaderProgramEXT(exec, _mesa_CreateShaderProgramEXT);
- }
-
- /* GL_EXT_gpu_shader4 / GL 3.0 */
- if (_mesa_is_desktop_gl(ctx)) {
- SET_BindFragDataLocation(exec, _mesa_BindFragDataLocation);
- }
- if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
- SET_GetFragDataLocation(exec, _mesa_GetFragDataLocation);
- }
-
- /* GL_ARB_ES2_compatibility */
- if (ctx->API != API_OPENGLES) {
- SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler);
- SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat);
- SET_ShaderBinary(exec, _mesa_ShaderBinary);
- }
-
- /* GL_ARB_blend_func_extended */
- if (_mesa_is_desktop_gl(ctx)) {
- SET_BindFragDataLocationIndexed(exec, _mesa_BindFragDataLocationIndexed);
- SET_GetFragDataIndex(exec, _mesa_GetFragDataIndex);
- }
-#endif /* FEATURE_GL */
-}
-
diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h
index d3199db96..342b58905 100644
--- a/mesalib/src/mesa/main/shaderapi.h
+++ b/mesalib/src/mesa/main/shaderapi.h
@@ -50,10 +50,6 @@ extern void
_mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
const char *caller);
-extern void
-_mesa_init_shader_dispatch(const struct gl_context *ctx,
- struct _glapi_table *exec);
-
extern unsigned
_mesa_count_active_attribs(struct gl_shader_program *shProg);
diff --git a/mesalib/src/mesa/main/stencil.c b/mesalib/src/mesa/main/stencil.c
index 8d2948b8e..c161808e5 100644
--- a/mesalib/src/mesa/main/stencil.c
+++ b/mesalib/src/mesa/main/stencil.c
@@ -108,7 +108,6 @@ void GLAPIENTRY
_mesa_ClearStencil( GLint s )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Stencil.Clear == (GLuint) s)
return;
@@ -137,7 +136,6 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui
{
GET_CURRENT_CONTEXT(ctx);
const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glStencilFuncSeparateATI()\n");
@@ -196,7 +194,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
GET_CURRENT_CONTEXT(ctx);
const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
const GLint face = ctx->Stencil.ActiveFace;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glStencilFunc()\n");
@@ -268,8 +265,6 @@ _mesa_StencilMask( GLuint mask )
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glStencilMask()\n");
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (face != 0) {
/* Only modify the EXT_stencil_two_side back-face state.
*/
@@ -325,8 +320,6 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glStencilOp()\n");
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (!validate_stencil_op(ctx, fail)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(sfail)");
return;
@@ -387,7 +380,6 @@ void GLAPIENTRY
_mesa_ActiveStencilFaceEXT(GLenum face)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glActiveStencilFaceEXT()\n");
@@ -419,7 +411,6 @@ _mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)
{
GLboolean set = GL_FALSE;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glStencilOpSeparate()\n");
@@ -477,7 +468,6 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
{
GET_CURRENT_CONTEXT(ctx);
const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glStencilFuncSeparate()\n");
@@ -518,7 +508,6 @@ void GLAPIENTRY
_mesa_StencilMaskSeparate(GLenum face, GLuint mask)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glStencilMaskSeparate()\n");
diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c
index f155fea8b..67eb2d357 100644..100755
--- a/mesalib/src/mesa/main/syncobj.c
+++ b/mesalib/src/mesa/main/syncobj.c
@@ -141,20 +141,6 @@ _mesa_init_sync_object_functions(struct dd_function_table *driver)
driver->ServerWaitSync = _mesa_wait_sync;
}
-
-void GLAPIENTRY
-_mesa_init_sync_dispatch(struct _glapi_table *disp)
-{
- SET_IsSync(disp, _mesa_IsSync);
- SET_DeleteSync(disp, _mesa_DeleteSync);
- SET_FenceSync(disp, _mesa_FenceSync);
- SET_ClientWaitSync(disp, _mesa_ClientWaitSync);
- SET_WaitSync(disp, _mesa_WaitSync);
- SET_GetInteger64v(disp, _mesa_GetInteger64v);
- SET_GetSynciv(disp, _mesa_GetSynciv);
-}
-
-
/**
* Allocate/init the context state related to sync objects.
*/
@@ -234,7 +220,6 @@ _mesa_DeleteSync(GLsync sync)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
/* From the GL_ARB_sync spec:
*
@@ -358,7 +343,6 @@ _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!_mesa_validate_sync(ctx, syncObj)) {
_mesa_error(ctx, GL_INVALID_VALUE, "glWaitSync (not a valid sync object)");
@@ -388,7 +372,6 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length,
struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync;
GLsizei size = 0;
GLint v[1];
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!_mesa_validate_sync(ctx, syncObj)) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetSynciv (not a valid sync object)");
diff --git a/mesalib/src/mesa/main/syncobj.h b/mesalib/src/mesa/main/syncobj.h
index b0e09a605..5be2ba10d 100644..100755
--- a/mesalib/src/mesa/main/syncobj.h
+++ b/mesalib/src/mesa/main/syncobj.h
@@ -43,9 +43,6 @@ extern void GLAPIENTRY
_mesa_init_sync_object_functions(struct dd_function_table *driver);
extern void GLAPIENTRY
-_mesa_init_sync_dispatch(struct _glapi_table *disp);
-
-extern void GLAPIENTRY
_mesa_init_sync(struct gl_context *);
extern void GLAPIENTRY
diff --git a/mesalib/src/mesa/main/texcompress_etc_tmp.h b/mesalib/src/mesa/main/texcompress_etc_tmp.h
index 8bbb2cde8..549756632 100644
--- a/mesalib/src/mesa/main/texcompress_etc_tmp.h
+++ b/mesalib/src/mesa/main/texcompress_etc_tmp.h
@@ -153,9 +153,9 @@ etc1_unpack_rgba8888(uint8_t *dst_row,
for (x = 0; x < width; x+= bw) {
etc1_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < MIN2(bh, height - y); j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < MIN2(bw, width - x); i++) {
etc1_fetch_texel(&block, i, j, dst);
dst[3] = 255;
dst += comps;
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index e8f3af082..0fe5fbd7a 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -392,9 +392,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
const GLint iparam0 = (GLint) param[0];
struct gl_texture_unit *texUnit;
GLuint maxUnit;
-
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
@@ -507,7 +505,8 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
}
}
else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target );
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(target=%s)",
+ _mesa_lookup_enum_by_nr(target));
return;
}
@@ -667,7 +666,6 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
GLuint maxUnit;
const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
@@ -731,7 +729,6 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
GLuint maxUnit;
const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
@@ -796,7 +793,6 @@ _mesa_TexBumpParameterivATI( GLenum pname, const GLint *param )
{
GLfloat p[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ATI_envmap_bumpmap) {
/* This isn't an "official" error case, but let's tell the user
@@ -826,7 +822,6 @@ _mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param )
{
struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterfvATI");
@@ -859,7 +854,6 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
const struct gl_texture_unit *texUnit;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterivATI");
@@ -911,7 +905,6 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
const struct gl_texture_unit *texUnit;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterfvATI");
diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c
index fe5fc852d..e45cfe176 100644
--- a/mesalib/src/mesa/main/texgen.c
+++ b/mesalib/src/mesa/main/texgen.c
@@ -74,7 +74,6 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
struct gl_texture_unit *texUnit;
struct gl_texgen *texgen;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n",
@@ -294,7 +293,6 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
struct gl_texture_unit *texUnit;
struct gl_texgen *texgen;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)");
@@ -332,7 +330,6 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
struct gl_texture_unit *texUnit;
struct gl_texgen *texgen;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)");
@@ -378,7 +375,6 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
struct gl_texture_unit *texUnit;
struct gl_texgen *texgen;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)");
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index d435c8269..3a550d941 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -813,7 +813,8 @@ _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (getteximage_error_check(ctx, target, level, format, type,
bufSize, pixels)) {
@@ -944,7 +945,8 @@ _mesa_GetnCompressedTexImageARB(GLenum target, GLint level, GLsizei bufSize,
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (getcompressedteximage_error_check(ctx, target, level, bufSize, img)) {
return;
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 5e451e235..24a551061 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1896,8 +1896,7 @@ texture_error_check( struct gl_context *ctx,
if (_mesa_is_gles(ctx)) {
if (_mesa_is_gles3(ctx)) {
err = _mesa_es3_error_check_format_and_type(format, type,
- internalFormat,
- dimensions);
+ internalFormat);
} else {
if (format != internalFormat) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2006,7 +2005,8 @@ texture_error_check( struct gl_context *ctx,
}
/* additional checks for depth textures */
- if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
+ if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT
+ || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) {
/* Only 1D, 2D, rect, array and cube textures supported, not 3D
* Cubemaps are only supported for GL version > 3.0 or with EXT_gpu_shader4 */
if (target != GL_TEXTURE_1D &&
@@ -2020,7 +2020,8 @@ texture_error_check( struct gl_context *ctx,
target != GL_TEXTURE_RECTANGLE_ARB &&
target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
!((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
- (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4)) &&
+ (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4
+ || (ctx->API == API_OPENGLES2 && ctx->Extensions.OES_depth_texture_cube_map))) &&
!((target == GL_TEXTURE_CUBE_MAP_ARRAY ||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) &&
ctx->Extensions.ARB_texture_cube_map_array)) {
@@ -2347,6 +2348,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
GLint width, GLint height, GLint border )
{
GLint baseFormat;
+ GLint rb_base_format;
struct gl_renderbuffer *rb;
GLenum rb_internal_format;
@@ -2420,12 +2422,85 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
baseFormat = _mesa_base_tex_format(ctx, internalFormat);
if (baseFormat < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
+ _mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyTexImage%dD(internalFormat)", dimensions);
return GL_TRUE;
}
rb_internal_format = rb->InternalFormat;
+ rb_base_format = _mesa_base_tex_format(ctx, rb->InternalFormat);
+ if (_mesa_is_color_format(internalFormat)) {
+ if (rb_base_format < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexImage%dD(internalFormat)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
+ if (_mesa_is_gles(ctx)) {
+ bool valid = true;
+ if (_mesa_base_format_component_count(baseFormat) >
+ _mesa_base_format_component_count(rb_base_format)) {
+ valid = false;
+ }
+ if (baseFormat == GL_DEPTH_COMPONENT ||
+ baseFormat == GL_DEPTH_STENCIL ||
+ rb_base_format == GL_DEPTH_COMPONENT ||
+ rb_base_format == GL_DEPTH_STENCIL ||
+ ((baseFormat == GL_LUMINANCE_ALPHA ||
+ baseFormat == GL_ALPHA) &&
+ rb_base_format != GL_RGBA) ||
+ internalFormat == GL_RGB9_E5) {
+ valid = false;
+ }
+ if (internalFormat == GL_RGB9_E5) {
+ valid = false;
+ }
+ if (!valid) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyTexImage%dD(internalFormat)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
+ if ((_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.ARB_framebuffer_object) ||
+ _mesa_is_gles3(ctx)) {
+ bool rb_is_srgb = false;
+ bool dst_is_srgb = false;
+
+ if (ctx->Extensions.EXT_framebuffer_sRGB &&
+ _mesa_get_format_color_encoding(rb->Format) == GL_SRGB) {
+ rb_is_srgb = true;
+ }
+
+ if (_mesa_get_linear_internalformat(internalFormat) != internalFormat) {
+ dst_is_srgb = true;
+ }
+
+ if (rb_is_srgb != dst_is_srgb) {
+ /* Page 190 (page 211 of the PDF) in section 8.6 of the OpenGL 4.3
+ * Core Profile spec says:
+ *
+ * "An INVALID_OPERATION error is generated under any of the
+ * following conditions:
+ *
+ * ...
+ *
+ * - if the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
+ * for the framebuffer attachment corresponding to the read
+ * buffer is LINEAR (see section 9.2.3) and internalformat
+ * is one of the sRGB formats in table 8.23
+ * - if the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
+ * for the framebuffer attachment corresponding to the read
+ * buffer is SRGB and internalformat is not one of the sRGB
+ * formats. in table 8.23."
+ */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyTexImage%dD(srgb usage mismatch)", dimensions);
+ return GL_TRUE;
+ }
+ }
if (!_mesa_source_buffer_exists(ctx, baseFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2869,7 +2944,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
gl_format texFormat;
GLboolean dimensionsOK, sizeOK;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) {
if (compressed)
@@ -3099,7 +3174,7 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
struct gl_texture_image *texImage;
bool valid_target;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
switch (target) {
case GL_TEXTURE_2D:
@@ -3161,7 +3236,7 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glTexSubImage%uD %s %d %d %d %d %d %d %d %s %s %p\n",
@@ -3300,7 +3375,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,
const GLuint face = _mesa_tex_target_to_face(target);
gl_format texFormat;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glCopyTexImage%uD %s %d %s %d %d %d %d %d\n",
@@ -3423,7 +3498,7 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glCopyTexSubImage%uD %s %d %d %d %d %d %d %d %d\n",
@@ -3671,7 +3746,7 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level,
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (compressed_subtexture_error_check(ctx, dims, target, level,
xoffset, yoffset, zoffset,
@@ -3937,7 +4012,7 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
gl_format format;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
if (!(ctx->API == API_OPENGL_CORE &&
ctx->Extensions.ARB_texture_buffer_object)) {
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index cb7ac19a8..e99b0dc38 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -468,7 +468,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
}
if (t->MaxLevel < baseLevel) {
- incomplete(t, BASE, "MAX_LEVEL (%d) < BASE_LEVEL (%d)",
+ incomplete(t, MIPMAP, "MAX_LEVEL (%d) < BASE_LEVEL (%d)",
t->MaxLevel, baseLevel);
return;
}
@@ -576,7 +576,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
GLuint width, height, depth, face;
if (minLevel > maxLevel) {
- incomplete(t, BASE, "minLevel > maxLevel");
+ incomplete(t, MIPMAP, "minLevel > maxLevel");
return;
}
@@ -959,7 +959,6 @@ _mesa_GenTextures( GLsizei n, GLuint *textures )
GET_CURRENT_CONTEXT(ctx);
GLuint first;
GLint i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
@@ -1069,7 +1068,8 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
+
+ FLUSH_VERTICES(ctx, 0); /* too complex */
if (!textures)
return;
@@ -1184,7 +1184,6 @@ _mesa_BindTexture( GLenum target, GLuint texName )
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
struct gl_texture_object *newTexObj = NULL;
GLint targetIndex;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glBindTexture %s %d\n",
@@ -1290,7 +1289,8 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (n < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
@@ -1428,8 +1428,6 @@ _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset,
struct gl_texture_image *image;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
t = invalidate_tex_image_error_check(ctx, texture, level,
"glInvalidateTexSubImage");
@@ -1568,8 +1566,6 @@ _mesa_InvalidateTexImage(GLuint texture, GLint level)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
invalidate_tex_image_error_check(ctx, texture, level,
"glInvalidateTexImage");
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 4d32fd6dd..8d0ae16fb 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -642,7 +642,6 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
texObj = get_texobj(ctx, target, GL_FALSE);
if (!texObj)
@@ -698,7 +697,6 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
texObj = get_texobj(ctx, target, GL_FALSE);
if (!texObj)
@@ -770,7 +768,6 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
texObj = get_texobj(ctx, target, GL_FALSE);
if (!texObj)
@@ -814,7 +811,6 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
GLboolean need_update;
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
texObj = get_texobj(ctx, target, GL_FALSE);
if (!texObj)
@@ -875,7 +871,6 @@ _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
{
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
texObj = get_texobj(ctx, target, GL_FALSE);
if (!texObj)
@@ -905,7 +900,6 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
{
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
texObj = get_texobj(ctx, target, GL_FALSE);
if (!texObj)
@@ -1242,7 +1236,6 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
struct gl_texture_object *texObj;
GLint maxLevels;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Texture.CurrentUnit >= ctx->Const.MaxCombinedTextureImageUnits) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -1280,7 +1273,6 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
{
struct gl_texture_object *obj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
obj = get_texobj(ctx, target, GL_TRUE);
if (!obj)
@@ -1465,7 +1457,6 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
{
struct gl_texture_object *obj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
obj = get_texobj(ctx, target, GL_TRUE);
if (!obj)
@@ -1644,7 +1635,6 @@ _mesa_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
{
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
texObj = get_texobj(ctx, target, GL_TRUE);
if (!texObj)
@@ -1666,7 +1656,6 @@ _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
{
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
texObj = get_texobj(ctx, target, GL_TRUE);
if (!texObj)
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 8e9bbf6a1..9e591d3b9 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -297,8 +297,6 @@ _mesa_ActiveTexture(GLenum texture)
ctx->Const.MaxTextureCoordUnits);
ASSERT(k <= Elements(ctx->Texture.Unit));
-
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glActiveTexture %s\n",
@@ -329,7 +327,6 @@ _mesa_ClientActiveTexture(GLenum texture)
{
GET_CURRENT_CONTEXT(ctx);
GLuint texUnit = texture - GL_TEXTURE0;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE))
_mesa_debug(ctx, "glClientActiveTexture %s\n",
@@ -480,6 +477,43 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
}
}
+static void
+update_texgen(struct gl_context *ctx)
+{
+ GLuint unit;
+
+ /* Setup texgen for those texture coordinate sets that are in use */
+ for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) {
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+
+ texUnit->_GenFlags = 0x0;
+
+ if (!(ctx->Texture._EnabledCoordUnits & (1 << unit)))
+ continue;
+
+ if (texUnit->TexGenEnabled) {
+ if (texUnit->TexGenEnabled & S_BIT) {
+ texUnit->_GenFlags |= texUnit->GenS._ModeBit;
+ }
+ if (texUnit->TexGenEnabled & T_BIT) {
+ texUnit->_GenFlags |= texUnit->GenT._ModeBit;
+ }
+ if (texUnit->TexGenEnabled & R_BIT) {
+ texUnit->_GenFlags |= texUnit->GenR._ModeBit;
+ }
+ if (texUnit->TexGenEnabled & Q_BIT) {
+ texUnit->_GenFlags |= texUnit->GenQ._ModeBit;
+ }
+
+ ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
+ ctx->Texture._GenFlags |= texUnit->_GenFlags;
+ }
+
+ ASSERT(unit < Elements(ctx->TextureMatrixStack));
+ if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
+ ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
+ }
+}
/**
* \note This routine refers to derived texture matrix values to
@@ -500,11 +534,6 @@ update_texture_state( struct gl_context *ctx )
if (ctx->Shader.CurrentVertexProgram &&
ctx->Shader.CurrentVertexProgram->LinkStatus) {
vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
- } else if (ctx->VertexProgram._Enabled) {
- /* XXX enable this if/when non-shader vertex programs get
- * texture fetches:
- vprog = &ctx->VertexProgram.Current->Base;
- */
}
if (ctx->Shader.CurrentFragmentProgram &&
@@ -623,7 +652,8 @@ update_texture_state( struct gl_context *ctx )
if (enabledFragTargets)
enabledFragUnits |= (1 << unit);
- update_tex_combine(ctx, texUnit);
+ if (!fprog)
+ update_tex_combine(ctx, texUnit);
}
@@ -637,37 +667,8 @@ update_texture_state( struct gl_context *ctx )
ctx->Texture._EnabledCoordUnits = enabledFragUnits;
}
- /* Setup texgen for those texture coordinate sets that are in use */
- for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- texUnit->_GenFlags = 0x0;
-
- if (!(ctx->Texture._EnabledCoordUnits & (1 << unit)))
- continue;
-
- if (texUnit->TexGenEnabled) {
- if (texUnit->TexGenEnabled & S_BIT) {
- texUnit->_GenFlags |= texUnit->GenS._ModeBit;
- }
- if (texUnit->TexGenEnabled & T_BIT) {
- texUnit->_GenFlags |= texUnit->GenT._ModeBit;
- }
- if (texUnit->TexGenEnabled & R_BIT) {
- texUnit->_GenFlags |= texUnit->GenR._ModeBit;
- }
- if (texUnit->TexGenEnabled & Q_BIT) {
- texUnit->_GenFlags |= texUnit->GenQ._ModeBit;
- }
-
- ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
- ctx->Texture._GenFlags |= texUnit->_GenFlags;
- }
-
- ASSERT(unit < Elements(ctx->TextureMatrixStack));
- if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
- ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
- }
+ if (!fprog || !vprog)
+ update_texgen(ctx);
}
diff --git a/mesalib/src/mesa/main/texturebarrier.c b/mesalib/src/mesa/main/texturebarrier.c
index 56cc8718c..08ff56150 100644
--- a/mesalib/src/mesa/main/texturebarrier.c
+++ b/mesalib/src/mesa/main/texturebarrier.c
@@ -48,7 +48,6 @@ void GLAPIENTRY
_mesa_TextureBarrierNV(void)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
ctx->Driver.TextureBarrier(ctx);
}
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index 1bf4beaeb..fd4718d87 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -757,8 +757,6 @@ _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names)
GLuint first;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGenTransformFeedbacks(n < 0)");
return;
@@ -854,8 +852,6 @@ _mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names)
GLint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glDeleteTransformFeedbacks(n < 0)");
return;
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index efff8f381..dc550bc43 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -46,8 +46,6 @@ _mesa_GetActiveUniform(GLhandleARB program, GLuint index,
struct gl_shader_program *shProg =
_mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniform");
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (!shProg)
return;
@@ -59,7 +57,7 @@ _mesa_GetActiveUniform(GLhandleARB program, GLuint index,
const struct gl_uniform_storage *const uni = &shProg->UniformStorage[index];
if (nameOut) {
- _mesa_copy_string(nameOut, maxLength, length, uni->name);
+ _mesa_get_uniform_name(uni, maxLength, length, nameOut);
}
if (size) {
@@ -122,6 +120,16 @@ _mesa_GetActiveUniformsiv(GLuint program,
case GL_UNIFORM_NAME_LENGTH:
params[i] = strlen(uni->name) + 1;
+
+ /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0
+ * spec says:
+ *
+ * "If the active uniform is an array, the uniform name returned
+ * in name will always be the name of the uniform array appended
+ * with "[0]"."
+ */
+ if (uni->array_elements != 0)
+ params[i] += 3;
break;
case GL_UNIFORM_BLOCK_INDEX:
@@ -583,8 +591,6 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
enum glsl_base_type basicType;
struct gl_uniform_storage *uni;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (!validate_uniform_parameters(ctx, shProg, location, count,
&loc, &offset, "glUniform", false))
return;
@@ -836,8 +842,6 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
unsigned elements;
struct gl_uniform_storage *uni;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
if (!validate_uniform_parameters(ctx, shProg, location, count,
&loc, &offset, "glUniformMatrix", false))
return;
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index 77b195edb..62c85b3c0 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -782,8 +782,6 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
return;
}
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniformName");
if (!shProg)
@@ -795,7 +793,46 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
}
if (uniformName) {
- _mesa_copy_string(uniformName, bufSize, length,
- shProg->UniformStorage[uniformIndex].name);
+ _mesa_get_uniform_name(& shProg->UniformStorage[uniformIndex],
+ bufSize, length, uniformName);
+ }
+}
+
+void
+_mesa_get_uniform_name(const struct gl_uniform_storage *uni,
+ GLsizei maxLength, GLsizei *length,
+ GLchar *nameOut)
+{
+ GLsizei localLength;
+
+ if (length == NULL)
+ length = &localLength;
+
+ _mesa_copy_string(nameOut, maxLength, length, uni->name);
+
+ /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0
+ * spec says:
+ *
+ * "If the active uniform is an array, the uniform name returned in
+ * name will always be the name of the uniform array appended with
+ * "[0]"."
+ *
+ * The same text also appears in the OpenGL 4.2 spec. It does not,
+ * however, appear in any previous spec. Previous specifications are
+ * ambiguous in this regard. However, either name can later be passed
+ * to glGetUniformLocation (and related APIs), so there shouldn't be any
+ * harm in always appending "[0]" to uniform array names.
+ */
+ if (uni->array_elements != 0) {
+ unsigned i;
+
+ /* The comparison is strange because *length does *NOT* include the
+ * terminating NUL, but maxLength does.
+ */
+ for (i = 0; i < 3 && (*length + i + 1) < maxLength; i++)
+ nameOut[*length + i] = "[0]"[i];
+
+ nameOut[*length + i] = '\0';
+ *length += i;
}
}
diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h
index 287d7106b..f17503121 100644
--- a/mesalib/src/mesa/main/uniforms.h
+++ b/mesalib/src/mesa/main/uniforms.h
@@ -213,6 +213,11 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
extern const struct gl_program_parameter *
get_uniform_parameter(struct gl_shader_program *shProg, GLint index);
+extern void
+_mesa_get_uniform_name(const struct gl_uniform_storage *uni,
+ GLsizei maxLength, GLsizei *length,
+ GLchar *nameOut);
+
struct gl_builtin_uniform_element {
const char *field;
int tokens[STATE_LENGTH];
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 0f7e2a69b..213b845c9 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -283,7 +283,8 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
DOUBLE_BIT | HALF_BIT |
UNSIGNED_INT_2_10_10_10_REV_BIT |
INT_2_10_10_10_REV_BIT);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
update_array(ctx, "glVertexPointer", VERT_ATTRIB_POS,
legalTypes, 2, 4,
@@ -301,7 +302,8 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
UNSIGNED_INT_2_10_10_10_REV_BIT |
INT_2_10_10_10_REV_BIT);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
update_array(ctx, "glNormalPointer", VERT_ATTRIB_NORMAL,
legalTypes, 3, 3,
@@ -322,7 +324,8 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
UNSIGNED_INT_2_10_10_10_REV_BIT |
INT_2_10_10_10_REV_BIT);
const GLint sizeMin = (ctx->API == API_OPENGLES) ? 4 : 3;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0,
legalTypes, sizeMin, BGRA_OR_4,
@@ -335,7 +338,8 @@ _mesa_FogCoordPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
{
const GLbitfield legalTypes = (HALF_BIT | FLOAT_BIT | DOUBLE_BIT);
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
update_array(ctx, "glFogCoordPointer", VERT_ATTRIB_FOG,
legalTypes, 1, 1,
@@ -349,7 +353,8 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT | INT_BIT |
FLOAT_BIT | DOUBLE_BIT);
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
update_array(ctx, "glIndexPointer", VERT_ATTRIB_COLOR_INDEX,
legalTypes, 1, 1,
@@ -368,7 +373,8 @@ _mesa_SecondaryColorPointer(GLint size, GLenum type,
UNSIGNED_INT_2_10_10_10_REV_BIT |
INT_2_10_10_10_REV_BIT);
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
update_array(ctx, "glSecondaryColorPointer", VERT_ATTRIB_COLOR1,
legalTypes, 3, BGRA_OR_4,
@@ -389,7 +395,8 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
INT_2_10_10_10_REV_BIT);
const GLint sizeMin = (ctx->API == API_OPENGLES) ? 2 : 1;
const GLuint unit = ctx->Array.ActiveTexture;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
update_array(ctx, "glTexCoordPointer", VERT_ATTRIB_TEX(unit),
legalTypes, sizeMin, 4,
@@ -405,7 +412,8 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr)
/* see table 2.4 edits in GL_EXT_gpu_shader4 spec: */
const GLboolean integer = GL_TRUE;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
update_array(ctx, "glEdgeFlagPointer", VERT_ATTRIB_EDGEFLAG,
legalTypes, 1, 1,
@@ -418,7 +426,8 @@ _mesa_PointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *ptr)
{
const GLbitfield legalTypes = (FLOAT_BIT | FIXED_ES_BIT);
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (ctx->API != API_OPENGLES) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -450,7 +459,6 @@ _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
UNSIGNED_INT_2_10_10_10_REV_BIT |
INT_2_10_10_10_REV_BIT);
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (index >= ctx->Const.VertexProgram.MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)");
@@ -479,7 +487,6 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type,
const GLboolean normalized = GL_FALSE;
const GLboolean integer = GL_TRUE;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (index >= ctx->Const.VertexProgram.MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribIPointer(index)");
@@ -498,7 +505,6 @@ _mesa_EnableVertexAttribArray(GLuint index)
{
struct gl_array_object *arrayObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (index >= ctx->Const.VertexProgram.MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -525,7 +531,6 @@ _mesa_DisableVertexAttribArray(GLuint index)
{
struct gl_array_object *arrayObj;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (index >= ctx->Const.VertexProgram.MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -634,7 +639,6 @@ void GLAPIENTRY
_mesa_GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribfv");
@@ -653,7 +657,6 @@ void GLAPIENTRY
_mesa_GetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribdv");
@@ -675,7 +678,6 @@ void GLAPIENTRY
_mesa_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribiv");
@@ -699,7 +701,6 @@ void GLAPIENTRY
_mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
const GLint *v = (const GLint *)
@@ -720,7 +721,6 @@ void GLAPIENTRY
_mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
const GLuint *v = (const GLuint *)
@@ -740,7 +740,6 @@ void GLAPIENTRY
_mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (index >= ctx->Const.VertexProgram.MaxAttribs) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)");
@@ -823,7 +822,7 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
GLint defstride; /* default stride */
GLint c, f;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
f = sizeof(GLfloat);
c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f);
@@ -993,7 +992,8 @@ void GLAPIENTRY
_mesa_LockArraysEXT(GLint first, GLsizei count)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glLockArrays %d %d\n", first, count);
@@ -1022,7 +1022,8 @@ void GLAPIENTRY
_mesa_UnlockArraysEXT( void )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glUnlockArrays\n");
@@ -1046,7 +1047,7 @@ _mesa_MultiDrawArrays( GLenum mode, const GLint *first,
GET_CURRENT_CONTEXT(ctx);
GLint i;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
for (i = 0; i < primcount; i++) {
if (count[i] > 0) {
@@ -1065,7 +1066,7 @@ _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
GET_CURRENT_CONTEXT(ctx);
GLint i;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
for ( i = 0 ; i < primcount ; i++ ) {
if ( count[i] > 0 ) {
@@ -1085,7 +1086,7 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
GET_CURRENT_CONTEXT(ctx);
GLint i;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
/* XXX not sure about ARB_vertex_buffer_object handling here */
@@ -1111,8 +1112,6 @@ _mesa_PrimitiveRestartIndex(GLuint index)
return;
}
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
ctx->Array.RestartIndex = index;
if (ctx->Array.PrimitiveRestart && ctx->Array._RestartIndex != index) {
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
@@ -1131,7 +1130,6 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
{
struct gl_client_array *array;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ARB_instanced_arrays) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribDivisor()");
diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c
index a58697ab3..92f04cdf1 100644
--- a/mesalib/src/mesa/main/viewport.c
+++ b/mesalib/src/mesa/main/viewport.c
@@ -46,7 +46,7 @@ void GLAPIENTRY
_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ FLUSH_VERTICES(ctx, 0);
_mesa_set_viewport(ctx, x, y, width, height);
}
@@ -116,7 +116,8 @@ void GLAPIENTRY
_mesa_DepthRange(GLclampd nearval, GLclampd farval)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index 6d687de60..347d07d57 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -252,6 +252,8 @@ void
_mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
{
install_vtxfmt( ctx, ctx->Exec, vfmt );
+ if (ctx->BeginEnd)
+ install_vtxfmt( ctx, ctx->BeginEnd, vfmt );
}