[Mesa-dev] [PATCH 04/10] mesa: implement glGet queries and error handling for ARB_transform_feedback3
Marek Olšák
maraeo at gmail.com
Thu Jul 5 04:20:53 PDT 2012
---
src/mesa/main/context.c | 1 +
src/mesa/main/get.c | 9 +++++++++
src/mesa/main/mtypes.h | 1 +
src/mesa/main/transformfeedback.c | 32 ++++++++++++++++++++++++++++++++
4 files changed, 43 insertions(+)
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 7de714b..d5ccce0 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 a83d367..b4f472d 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);
@@ -1246,6 +1247,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 276bfe5..578ac94 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 6f82212..7679b4b 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]);
--
1.7.9.5
More information about the mesa-dev
mailing list