diff options
author | Marek Olšák <[email protected]> | 2011-12-18 02:43:31 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-07-12 13:05:58 +0200 |
commit | 375e73d85948b43aa509e25f0a210ebd10238b6f (patch) | |
tree | c9296d6e5ba7fb2b937ebd0000f5e22ec7610c2e /src | |
parent | 21cb5ed20d1d7984b7695395327ed0ba0b0d16e2 (diff) |
mesa: implement glGet queries and error handling for ARB_transform_feedback3
Acked-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/context.c | 1 | ||||
-rw-r--r-- | src/mesa/main/get.c | 9 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 1 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.c | 32 |
4 files changed, 43 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7de714b818a..d5ccce076b9 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -655,6 +655,7 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxTransformFeedbackBuffers = MAX_FEEDBACK_BUFFERS; ctx->Const.MaxTransformFeedbackSeparateComponents = 4 * MAX_FEEDBACK_ATTRIBS; ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS; + ctx->Const.MaxVertexStreams = 1; /** GL_ARB_uniform_buffer_object */ ctx->Const.MaxCombinedUniformBlocks = 36; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index cff4cf39455..15de321e400 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -328,6 +328,7 @@ EXTRA_EXT(ARB_sync); EXTRA_EXT(ARB_vertex_shader); EXTRA_EXT(EXT_transform_feedback); EXTRA_EXT(ARB_transform_feedback2); +EXTRA_EXT(ARB_transform_feedback3); EXTRA_EXT(EXT_pixel_buffer_object); EXTRA_EXT(ARB_vertex_program); EXTRA_EXT2(NV_point_sprite, ARB_point_sprite); @@ -1247,6 +1248,14 @@ static const struct value_desc values[] = { { GL_TRANSFORM_FEEDBACK_BINDING, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_transform_feedback2 }, + /* GL_ARB_transform_feedback3 */ + { GL_MAX_TRANSFORM_FEEDBACK_BUFFERS, + CONTEXT_INT(Const.MaxTransformFeedbackBuffers), + extra_ARB_transform_feedback3 }, + { GL_MAX_VERTEX_STREAMS, + CONTEXT_INT(Const.MaxVertexStreams), + extra_ARB_transform_feedback3 }, + /* GL_ARB_geometry_shader4 */ { GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB, CONTEXT_INT(Const.MaxGeometryTextureImageUnits), diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 276bfe5c1f5..578ac9485d7 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2837,6 +2837,7 @@ struct gl_constants GLuint MaxTransformFeedbackBuffers; GLuint MaxTransformFeedbackSeparateComponents; GLuint MaxTransformFeedbackInterleavedComponents; + GLuint MaxVertexStreams; /** GL_EXT_gpu_shader4 */ GLint MinProgramTexelOffset, MaxProgramTexelOffset; diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 6f822120105..7679b4b0853 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -603,6 +603,38 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, return; } + if (ctx->Extensions.ARB_transform_feedback3) { + if (bufferMode == GL_INTERLEAVED_ATTRIBS) { + unsigned buffers = 1; + + for (i = 0; i < count; i++) { + if (strcmp(varyings[i], "gl_NextBuffer") == 0) + buffers++; + } + + if (buffers > ctx->Const.MaxTransformFeedbackBuffers) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTransformFeedbackVaryings(too many gl_NextBuffer " + "occurences)"); + return; + } + } else { + for (i = 0; i < count; i++) { + if (strcmp(varyings[i], "gl_NextBuffer") == 0 || + strcmp(varyings[i], "gl_SkipComponents1") == 0 || + strcmp(varyings[i], "gl_SkipComponents2") == 0 || + strcmp(varyings[i], "gl_SkipComponents3") == 0 || + strcmp(varyings[i], "gl_SkipComponents4") == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTransformFeedbackVaryings(SEPARATE_ATTRIBS," + "varying=%s)", + varyings[i]); + return; + } + } + } + } + /* free existing varyings, if any */ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) { free(shProg->TransformFeedback.VaryingNames[i]); |