From 270d3a1aa4137dc15d7b7e5a0958cc8c0bef9a1a Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 25 Oct 2013 08:48:17 +0200 Subject: fontconfig mesa git update 25 oct 2013 fontconfig commit 65872e9e46d17e4461c3a891ef23abe156005e04 mesa commit e8f6f244bb1963c4af81f431865355beef1b9cbb --- mesalib/src/mesa/main/mtypes.h | 14 ++++- mesalib/src/mesa/main/shaderapi.c | 108 +++++++++++++++----------------------- 2 files changed, 55 insertions(+), 67 deletions(-) (limited to 'mesalib/src/mesa/main') diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 6374e8c0d..97ed1bd6a 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1965,6 +1965,12 @@ struct gl_program GLboolean UsesGather; /**< Does this program use gather4 at all? */ + /** + * For vertex and geometry shaders, true if the program uses the + * gl_ClipDistance output. Ignored for fragment shaders. + */ + GLboolean UsesClipDistanceOut; + /** Named parameters, constants, etc. from program text */ struct gl_program_parameter_list *Parameters; @@ -2009,7 +2015,6 @@ struct gl_vertex_program { struct gl_program Base; /**< base class */ GLboolean IsPositionInvariant; - GLboolean UsesClipDistance; }; @@ -2023,7 +2028,6 @@ struct gl_geometry_program GLenum InputType; /**< GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_ARB, GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */ GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */ - GLboolean UsesClipDistance; GLboolean UsesEndPrimitive; }; @@ -2476,6 +2480,12 @@ struct gl_shader_program unsigned NumUserUniformStorage; struct gl_uniform_storage *UniformStorage; + /** + * Size of the gl_ClipDistance array that is output from the last pipeline + * stage before the fragment shader. + */ + unsigned LastClipDistanceArraySize; + struct gl_uniform_block *UniformBlocks; unsigned NumUniformBlocks; diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index d3677c851..f5c04b9f3 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -459,6 +459,31 @@ get_handle(struct gl_context *ctx, GLenum pname) } +/** + * Check if a geometry shader query is valid at this time. If not, report an + * error and return false. + * + * From GL 3.2 section 6.1.16 (Shader and Program Queries): + * + * "If GEOMETRY_VERTICES_OUT, GEOMETRY_INPUT_TYPE, or GEOMETRY_OUTPUT_TYPE + * are queried for a program which has not been linked successfully, or + * which does not contain objects to form a geometry shader, then an + * INVALID_OPERATION error is generated." + */ +static bool +check_gs_query(struct gl_context *ctx, const struct gl_shader_program *shProg) +{ + if (shProg->LinkStatus && + shProg->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) { + return true; + } + + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetProgramv(linked geometry shader required)"); + return false; +} + + /** * glGetProgramiv() - get shader program state. * Note that this is for GLSL shader programs, not ARB vertex/fragment @@ -477,9 +502,10 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param || ctx->API == API_OPENGL_CORE || _mesa_is_gles3(ctx); - /* Are geometry shaders available in this context? + /* True if geometry shaders (of the form that was adopted into GLSL 1.50 + * and GL 3.2) are available in this context */ - const bool has_gs = _mesa_has_geometry_shaders(ctx); + const bool has_core_gs = _mesa_is_desktop_gl(ctx) && ctx->Version >= 32; /* Are uniform buffer objects available in this context? */ @@ -564,20 +590,23 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param break; *params = shProg->TransformFeedback.BufferMode; return; - case GL_GEOMETRY_VERTICES_OUT_ARB: - if (!has_gs) + case GL_GEOMETRY_VERTICES_OUT: + if (!has_core_gs) break; - *params = shProg->Geom.VerticesOut; + if (check_gs_query(ctx, shProg)) + *params = shProg->Geom.VerticesOut; return; - case GL_GEOMETRY_INPUT_TYPE_ARB: - if (!has_gs) + case GL_GEOMETRY_INPUT_TYPE: + if (!has_core_gs) break; - *params = shProg->Geom.InputType; + if (check_gs_query(ctx, shProg)) + *params = shProg->Geom.InputType; return; - case GL_GEOMETRY_OUTPUT_TYPE_ARB: - if (!has_gs) + case GL_GEOMETRY_OUTPUT_TYPE: + if (!has_core_gs) break; - *params = shProg->Geom.OutputType; + if (check_gs_query(ctx, shProg)) + *params = shProg->Geom.OutputType; return; case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: { unsigned i; @@ -1631,55 +1660,6 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) return; switch (pname) { - case GL_GEOMETRY_VERTICES_OUT_ARB: - if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) - break; - - if (value < 0 || - (unsigned) value > ctx->Const.MaxGeometryOutputVertices) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glProgramParameteri(GL_GEOMETRY_VERTICES_OUT_ARB=%d)", - value); - return; - } - shProg->Geom.VerticesOut = value; - return; - case GL_GEOMETRY_INPUT_TYPE_ARB: - if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) - break; - - switch (value) { - case GL_POINTS: - case GL_LINES: - case GL_LINES_ADJACENCY_ARB: - case GL_TRIANGLES: - case GL_TRIANGLES_ADJACENCY_ARB: - shProg->Geom.InputType = value; - break; - default: - _mesa_error(ctx, GL_INVALID_VALUE, - "glProgramParameteri(geometry input type = %s)", - _mesa_lookup_enum_by_nr(value)); - return; - } - return; - case GL_GEOMETRY_OUTPUT_TYPE_ARB: - if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) - break; - - switch (value) { - case GL_POINTS: - case GL_LINE_STRIP: - case GL_TRIANGLE_STRIP: - shProg->Geom.OutputType = value; - break; - default: - _mesa_error(ctx, GL_INVALID_VALUE, - "glProgramParameteri(geometry output type = %s)", - _mesa_lookup_enum_by_nr(value)); - return; - } - return; case GL_PROGRAM_BINARY_RETRIEVABLE_HINT: /* This enum isn't part of the OES extension for OpenGL ES 2.0, but it * is part of OpenGL ES 3.0. For the ES2 case, this function shouldn't @@ -1855,10 +1835,8 @@ _mesa_copy_linked_program_data(gl_shader_type type, struct gl_program *dst) { switch (type) { - case MESA_SHADER_VERTEX: { - struct gl_vertex_program *dst_vp = (struct gl_vertex_program *) dst; - dst_vp->UsesClipDistance = src->Vert.UsesClipDistance; - } + case MESA_SHADER_VERTEX: + dst->UsesClipDistanceOut = src->Vert.UsesClipDistance; break; case MESA_SHADER_GEOMETRY: { struct gl_geometry_program *dst_gp = (struct gl_geometry_program *) dst; @@ -1866,7 +1844,7 @@ _mesa_copy_linked_program_data(gl_shader_type type, dst_gp->VerticesOut = src->Geom.VerticesOut; dst_gp->InputType = src->Geom.InputType; dst_gp->OutputType = src->Geom.OutputType; - dst_gp->UsesClipDistance = src->Geom.UsesClipDistance; + dst->UsesClipDistanceOut = src->Geom.UsesClipDistance; dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive; } break; -- cgit v1.2.3