From df0831f3750918ce3cd9cc1f5610bafc8b87c8e4 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 10 Jul 2010 18:14:47 -0400 Subject: mesa: GL_TRIANGLE_STRIP_ADJACENCY_ARB is the last valid primitive --- src/mesa/main/api_validate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 150bc3886c..b3b5c6cc05 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -193,7 +193,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" ); return GL_FALSE; } @@ -250,7 +250,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" ); return GL_FALSE; } @@ -309,7 +309,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); return GL_FALSE; } @@ -339,7 +339,7 @@ _mesa_validate_DrawArraysInstanced(GLcontext *ctx, GLenum mode, GLint first, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArraysInstanced(mode=0x%x)", mode); return GL_FALSE; @@ -384,7 +384,7 @@ _mesa_validate_DrawElementsInstanced(GLcontext *ctx, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElementsInstanced(mode = 0x%x)", mode); return GL_FALSE; -- cgit v1.2.3 From 79b643dd02ac4e19f24c9cd88843719746f8ec69 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 10 Jul 2010 19:21:42 -0400 Subject: mesa: make uniform work with geometry shaders --- src/mesa/main/uniforms.c | 29 +++++++++++++++++++++++++++++ src/mesa/program/prog_uniform.c | 18 +++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index c869942d2e..d68a7768df 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -132,6 +132,11 @@ get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index) progPos = shProg->Uniforms->Uniforms[index].FragPos; if (progPos >= 0) { prog = &shProg->FragmentProgram->Base; + } else { + progPos = shProg->Uniforms->Uniforms[index].GeomPos; + if (progPos >= 0) { + prog = &shProg->GeometryProgram->Base; + } } } @@ -315,6 +320,11 @@ lookup_uniform_parameter(GLcontext *ctx, GLuint program, GLint location, progPos = shProg->Uniforms->Uniforms[location].FragPos; if (progPos >= 0) { prog = &shProg->FragmentProgram->Base; + } else { + progPos = shProg->Uniforms->Uniforms[location].GeomPos; + if (progPos >= 0) { + prog = &shProg->GeometryProgram->Base; + } } } } @@ -829,6 +839,15 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, } } + if (shProg->GeometryProgram) { + /* convert uniform location to program parameter index */ + GLint index = uniform->GeomPos; + if (index >= 0) { + set_program_uniform(ctx, &shProg->GeometryProgram->Base, + index, offset, type, count, elems, values); + } + } + uniform->Initialized = GL_TRUE; } @@ -962,6 +981,16 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, } } + if (shProg->GeometryProgram) { + /* convert uniform location to program parameter index */ + GLint index = uniform->GeomPos; + if (index >= 0) { + set_program_uniform_matrix(ctx, &shProg->GeometryProgram->Base, + index, offset, + count, rows, cols, transpose, values); + } + } + uniform->Initialized = GL_TRUE; } diff --git a/src/mesa/program/prog_uniform.c b/src/mesa/program/prog_uniform.c index c408a8492c..5aa9878d43 100644 --- a/src/mesa/program/prog_uniform.c +++ b/src/mesa/program/prog_uniform.c @@ -61,7 +61,8 @@ _mesa_append_uniform(struct gl_uniform_list *list, GLint index; assert(target == GL_VERTEX_PROGRAM_ARB || - target == GL_FRAGMENT_PROGRAM_ARB); + target == GL_FRAGMENT_PROGRAM_ARB || + target == MESA_GEOMETRY_PROGRAM); index = _mesa_lookup_uniform(list, name); if (index < 0) { @@ -90,6 +91,7 @@ _mesa_append_uniform(struct gl_uniform_list *list, uniform->Name = _mesa_strdup(name); uniform->VertPos = -1; uniform->FragPos = -1; + uniform->GeomPos = -1; uniform->Initialized = GL_FALSE; list->NumUniforms++; @@ -106,13 +108,18 @@ _mesa_append_uniform(struct gl_uniform_list *list, return GL_FALSE; } uniform->VertPos = progPos; - } - else { + } else if (target == GL_FRAGMENT_PROGRAM_ARB) { if (uniform->FragPos != -1) { /* this uniform is already in the list - that shouldn't happen */ return GL_FALSE; } uniform->FragPos = progPos; + } else { + if (uniform->GeomPos != -1) { + /* this uniform is already in the list - that shouldn't happen */ + return GL_FALSE; + } + uniform->GeomPos = progPos; } return uniform; @@ -156,10 +163,11 @@ _mesa_print_uniforms(const struct gl_uniform_list *list) GLuint i; printf("Uniform list %p:\n", (void *) list); for (i = 0; i < list->NumUniforms; i++) { - printf("%d: %s %d %d\n", + printf("%d: %s %d %d %d\n", i, list->Uniforms[i].Name, list->Uniforms[i].VertPos, - list->Uniforms[i].FragPos); + list->Uniforms[i].FragPos, + list->Uniforms[i].GeomPos); } } -- cgit v1.2.3