From 1197393faa285bee0d99409a1c82f575dbcbc708 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 24 Nov 2010 13:59:46 -0800 Subject: mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties. Previously, the get table listed all three as having custom locations, yet find_custom_value did not have cases to handle them. MAX_VARYING_VECTORS does not need a custom location since MaxVaryings is already stored as float[4] (or vec4). MaxUniformComponents is stored as the number of floats, however, so a custom implementation that divides by 4 is necessary. Fixes bugs.freedesktop.org #31495. --- src/mesa/main/get.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/mesa/main/get.c') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index b54af6ee86b..c8c0b8b4b1f 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -700,12 +700,9 @@ static const struct value_desc values[] = { #if FEATURE_ES2 /* Enums unique to OpenGL ES 2.0 */ { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA }, - { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_context, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA }, - { GL_MAX_VARYING_VECTORS, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_context, Const.MaxVarying), NO_EXTRA }, - { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, - offsetof(struct gl_context, Const.VertexProgram.MaxUniformComponents), NO_EXTRA }, + { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, + { GL_MAX_VARYING_VECTORS, CONTEXT_INT(Const.MaxVarying), NO_EXTRA }, + { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, { GL_SHADER_COMPILER, CONST(1), NO_EXTRA }, /* OES_get_program_binary */ { GL_NUM_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA }, @@ -1604,6 +1601,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: v->value_int = ctx->Array.ArrayObj->PointSize.BufferObj->Name; break; + + case GL_MAX_VERTEX_UNIFORM_VECTORS: + v->value_int = ctx->Const.VertexProgram.MaxUniformComponents / 4; + break; + + case GL_MAX_FRAGMENT_UNIFORM_VECTORS: + v->value_int = ctx->Const.FragmentProgram.MaxUniformComponents / 4; + break; } } -- cgit v1.2.3 From 7cba339375f4b8c4e4614853f9e160d41eb25c51 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Dec 2010 09:05:53 -0800 Subject: mesa: Add getters for the rest of the supported draw buffers. MAX_DRAW_BUFFERS is 8, so allow all 8 GL_DRAW_BUFFER# to be retrieved. Fixes complaints by oglconform. --- src/mesa/main/get.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/mesa/main/get.c') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index c8c0b8b4b1f..11ba58ae295 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1109,6 +1109,14 @@ static const struct value_desc values[] = { extra_valid_draw_buffer }, { GL_DRAW_BUFFER3_ARB, BUFFER_ENUM(ColorDrawBuffer[3]), extra_valid_draw_buffer }, + { GL_DRAW_BUFFER4_ARB, BUFFER_ENUM(ColorDrawBuffer[4]), + extra_valid_draw_buffer }, + { GL_DRAW_BUFFER5_ARB, BUFFER_ENUM(ColorDrawBuffer[5]), + extra_valid_draw_buffer }, + { GL_DRAW_BUFFER6_ARB, BUFFER_ENUM(ColorDrawBuffer[6]), + extra_valid_draw_buffer }, + { GL_DRAW_BUFFER7_ARB, BUFFER_ENUM(ColorDrawBuffer[7]), + extra_valid_draw_buffer }, /* GL_ATI_fragment_shader */ { GL_NUM_FRAGMENT_REGISTERS_ATI, CONST(6), extra_ATI_fragment_shader }, -- cgit v1.2.3 From 43491adc44c82646652e8322acbd7f8684aae889 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Dec 2010 09:24:19 -0800 Subject: mesa: Add getters for ARB_copy_buffer's attachment points. Fixes more complaints by oglconform. --- src/mesa/main/get.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/mesa/main/get.c') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 11ba58ae295..916b87d3134 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -314,6 +314,7 @@ EXTRA_EXT2(ARB_vertex_program, NV_vertex_program); EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program); EXTRA_EXT(ARB_vertex_buffer_object); EXTRA_EXT(ARB_geometry_shader4); +EXTRA_EXT(ARB_copy_buffer); static const int extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = { @@ -469,6 +470,10 @@ static const struct value_desc values[] = { { GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_vertex_buffer_object }, + /* GL_ARB_copy_buffer */ + { GL_COPY_READ_BUFFER, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer }, + { GL_COPY_WRITE_BUFFER, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer }, + /* GL_OES_read_format */ { GL_IMPLEMENTATION_COLOR_READ_TYPE_OES, LOC_CUSTOM, TYPE_INT, 0, extra_new_buffers_OES_read_format }, @@ -1569,6 +1574,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu v->value_int = ctx->Array.ElementArrayBufferObj->Name; break; + /* ARB_copy_buffer */ + case GL_COPY_READ_BUFFER: + v->value_int = ctx->CopyReadBuffer->Name; + break; + case GL_COPY_WRITE_BUFFER: + v->value_int = ctx->CopyWriteBuffer->Name; + break; + case GL_FRAGMENT_PROGRAM_BINDING_NV: v->value_int = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; -- cgit v1.2.3 From 503983b09e86b2ea1bdc1268977e12eaea42293d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Dec 2010 15:59:29 -0700 Subject: mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM In find_value() check if we've hit the 0th/invalid entry before checking if the pname matches. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=31987 NOTE: This is a candidate for the 7.9 branch. --- src/mesa/main/get.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa/main/get.c') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 916b87d3134..5ae35b868e3 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1759,16 +1759,18 @@ find_value(const char *func, GLenum pname, void **p, union value *v) hash = (pname * prime_factor); while (1) { d = &values[table[hash & mask]]; - if (likely(d->pname == pname)) - break; /* If the enum isn't valid, the hash walk ends with index 0, * which is the API mask entry at the beginning of values[]. */ - if (d->type == TYPE_API_MASK) { + if (unlikely(d->type == TYPE_API_MASK)) { _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, _mesa_lookup_enum_by_nr(pname)); return &error_value; } + + if (likely(d->pname == pname)) + break; + hash += prime_step; } -- cgit v1.2.3