Commit 15ac66e3 authored by Marek Olšák's avatar Marek Olšák

mesa: rename MaxTransformFeedbackSeparateAttribs to MaxTransformFeedbackBuffers

This is a cleanup for ARB_transform_feedback3, where
GL_MAX_TRANSFORM_FEEDBACK_BUFFERS is introduced for interleaved attribs and
has the same meaning as GL_MAX_.._SEPARATE_ATTRIBS for separate attribs.

Also, the maximum number of TFB buffers is reduced from 32 to 4, which makes
this patch useful even without the extension.
I don't know of any hardware which can do more than 4.
Reviewed-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
parent 638779e4
...@@ -138,7 +138,7 @@ brwCreateContext(int api, ...@@ -138,7 +138,7 @@ brwCreateContext(int api,
* So we need to override the Mesa default (which is based only on software * So we need to override the Mesa default (which is based only on software
* limits). * limits).
*/ */
ctx->Const.MaxTransformFeedbackSeparateAttribs = BRW_MAX_SOL_BUFFERS; ctx->Const.MaxTransformFeedbackBuffers = BRW_MAX_SOL_BUFFERS;
/* On Gen6, in the worst case, we use up one binding table entry per /* On Gen6, in the worst case, we use up one binding table entry per
* transform feedback component (see comments above the definition of * transform feedback component (see comments above the definition of
......
...@@ -869,7 +869,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) ...@@ -869,7 +869,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
if (ctx->TransformFeedback.CurrentBuffer == bufObj) { if (ctx->TransformFeedback.CurrentBuffer == bufObj) {
_mesa_BindBufferARB( GL_TRANSFORM_FEEDBACK_BUFFER, 0 ); _mesa_BindBufferARB( GL_TRANSFORM_FEEDBACK_BUFFER, 0 );
} }
for (j = 0; j < MAX_FEEDBACK_ATTRIBS; j++) { for (j = 0; j < MAX_FEEDBACK_BUFFERS; j++) {
if (ctx->TransformFeedback.CurrentObject->Buffers[j] == bufObj) { if (ctx->TransformFeedback.CurrentObject->Buffers[j] == bufObj) {
_mesa_BindBufferBase( GL_TRANSFORM_FEEDBACK_BUFFER, j, 0 ); _mesa_BindBufferBase( GL_TRANSFORM_FEEDBACK_BUFFER, j, 0 );
} }
......
...@@ -249,6 +249,7 @@ ...@@ -249,6 +249,7 @@
#define SUPPORTED_ATI_BUMP_UNITS 0xff #define SUPPORTED_ATI_BUMP_UNITS 0xff
/** For GL_EXT_transform_feedback */ /** For GL_EXT_transform_feedback */
#define MAX_FEEDBACK_BUFFERS 4
#define MAX_FEEDBACK_ATTRIBS 32 #define MAX_FEEDBACK_ATTRIBS 32
/** For GL_ARB_geometry_shader4 */ /** For GL_ARB_geometry_shader4 */
......
...@@ -652,7 +652,7 @@ _mesa_init_constants(struct gl_context *ctx) ...@@ -652,7 +652,7 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE; ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE;
/* GL_EXT_transform_feedback */ /* GL_EXT_transform_feedback */
ctx->Const.MaxTransformFeedbackSeparateAttribs = MAX_FEEDBACK_ATTRIBS; ctx->Const.MaxTransformFeedbackBuffers = MAX_FEEDBACK_BUFFERS;
ctx->Const.MaxTransformFeedbackSeparateComponents = 4 * MAX_FEEDBACK_ATTRIBS; ctx->Const.MaxTransformFeedbackSeparateComponents = 4 * MAX_FEEDBACK_ATTRIBS;
ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS; ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS;
......
...@@ -1232,7 +1232,7 @@ static const struct value_desc values[] = { ...@@ -1232,7 +1232,7 @@ static const struct value_desc values[] = {
CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents), CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents),
extra_EXT_transform_feedback }, extra_EXT_transform_feedback },
{ GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
CONTEXT_INT(Const.MaxTransformFeedbackSeparateAttribs), CONTEXT_INT(Const.MaxTransformFeedbackBuffers),
extra_EXT_transform_feedback }, extra_EXT_transform_feedback },
{ GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS,
CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents), CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents),
...@@ -2544,7 +2544,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v) ...@@ -2544,7 +2544,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
return TYPE_INT_4; return TYPE_INT_4;
case GL_TRANSFORM_FEEDBACK_BUFFER_START: case GL_TRANSFORM_FEEDBACK_BUFFER_START:
if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) if (index >= ctx->Const.MaxTransformFeedbackBuffers)
goto invalid_value; goto invalid_value;
if (!ctx->Extensions.EXT_transform_feedback) if (!ctx->Extensions.EXT_transform_feedback)
goto invalid_enum; goto invalid_enum;
...@@ -2552,7 +2552,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v) ...@@ -2552,7 +2552,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
return TYPE_INT64; return TYPE_INT64;
case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) if (index >= ctx->Const.MaxTransformFeedbackBuffers)
goto invalid_value; goto invalid_value;
if (!ctx->Extensions.EXT_transform_feedback) if (!ctx->Extensions.EXT_transform_feedback)
goto invalid_enum; goto invalid_enum;
...@@ -2560,7 +2560,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v) ...@@ -2560,7 +2560,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
return TYPE_INT64; return TYPE_INT64;
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) if (index >= ctx->Const.MaxTransformFeedbackBuffers)
goto invalid_value; goto invalid_value;
if (!ctx->Extensions.EXT_transform_feedback) if (!ctx->Extensions.EXT_transform_feedback)
goto invalid_enum; goto invalid_enum;
......
...@@ -1795,7 +1795,7 @@ struct gl_transform_feedback_info ...@@ -1795,7 +1795,7 @@ struct gl_transform_feedback_info
* hardware back-ends to determine the correct stride when interleaving * hardware back-ends to determine the correct stride when interleaving
* multiple transform feedback outputs in the same buffer. * multiple transform feedback outputs in the same buffer.
*/ */
unsigned BufferStride[MAX_FEEDBACK_ATTRIBS]; unsigned BufferStride[MAX_FEEDBACK_BUFFERS];
}; };
...@@ -1812,13 +1812,13 @@ struct gl_transform_feedback_object ...@@ -1812,13 +1812,13 @@ struct gl_transform_feedback_object
at least once? */ at least once? */
/** The feedback buffers */ /** The feedback buffers */
GLuint BufferNames[MAX_FEEDBACK_ATTRIBS]; GLuint BufferNames[MAX_FEEDBACK_BUFFERS];
struct gl_buffer_object *Buffers[MAX_FEEDBACK_ATTRIBS]; struct gl_buffer_object *Buffers[MAX_FEEDBACK_BUFFERS];
/** Start of feedback data in dest buffer */ /** Start of feedback data in dest buffer */
GLintptr Offset[MAX_FEEDBACK_ATTRIBS]; GLintptr Offset[MAX_FEEDBACK_BUFFERS];
/** Max data to put into dest buffer (in bytes) */ /** Max data to put into dest buffer (in bytes) */
GLsizeiptr Size[MAX_FEEDBACK_ATTRIBS]; GLsizeiptr Size[MAX_FEEDBACK_BUFFERS];
}; };
...@@ -2834,7 +2834,7 @@ struct gl_constants ...@@ -2834,7 +2834,7 @@ struct gl_constants
GLbitfield ProfileMask; /**< Mask of CONTEXT_x_PROFILE_BIT */ GLbitfield ProfileMask; /**< Mask of CONTEXT_x_PROFILE_BIT */
/** GL_EXT_transform_feedback */ /** GL_EXT_transform_feedback */
GLuint MaxTransformFeedbackSeparateAttribs; GLuint MaxTransformFeedbackBuffers;
GLuint MaxTransformFeedbackSeparateComponents; GLuint MaxTransformFeedbackSeparateComponents;
GLuint MaxTransformFeedbackInterleavedComponents; GLuint MaxTransformFeedbackInterleavedComponents;
......
...@@ -447,7 +447,7 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, ...@@ -447,7 +447,7 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
return; return;
} }
if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { if (index >= ctx->Const.MaxTransformFeedbackBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d)", index); _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d)", index);
return; return;
} }
...@@ -490,7 +490,7 @@ _mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx, ...@@ -490,7 +490,7 @@ _mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,
return; return;
} }
if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { if (index >= ctx->Const.MaxTransformFeedbackBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferBase(index=%d)", index); _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferBase(index=%d)", index);
return; return;
} }
...@@ -531,7 +531,7 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, ...@@ -531,7 +531,7 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
return; return;
} }
if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { if (index >= ctx->Const.MaxTransformFeedbackBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, _mesa_error(ctx, GL_INVALID_VALUE,
"glBindBufferOffsetEXT(index=%d)", index); "glBindBufferOffsetEXT(index=%d)", index);
return; return;
...@@ -590,7 +590,7 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, ...@@ -590,7 +590,7 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count,
if (count < 0 || if (count < 0 ||
(bufferMode == GL_SEPARATE_ATTRIBS && (bufferMode == GL_SEPARATE_ATTRIBS &&
(GLuint) count > ctx->Const.MaxTransformFeedbackSeparateAttribs)) { (GLuint) count > ctx->Const.MaxTransformFeedbackBuffers)) {
_mesa_error(ctx, GL_INVALID_VALUE, _mesa_error(ctx, GL_INVALID_VALUE,
"glTransformFeedbackVaryings(count=%d)", count); "glTransformFeedbackVaryings(count=%d)", count);
return; return;
......
...@@ -236,8 +236,9 @@ void st_init_limits(struct st_context *st) ...@@ -236,8 +236,9 @@ void st_init_limits(struct st_context *st)
c->UniformBooleanTrue = ~0; c->UniformBooleanTrue = ~0;
c->MaxTransformFeedbackSeparateAttribs = c->MaxTransformFeedbackBuffers =
screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS); screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS);
c->MaxTransformFeedbackBuffers = MIN2(c->MaxTransformFeedbackBuffers, MAX_FEEDBACK_BUFFERS);
c->MaxTransformFeedbackSeparateComponents = c->MaxTransformFeedbackSeparateComponents =
screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS); screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS);
c->MaxTransformFeedbackInterleavedComponents = c->MaxTransformFeedbackInterleavedComponents =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment