aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-29 16:09:45 +0200
committermarha <marha@users.sourceforge.net>2012-06-29 16:09:45 +0200
commit8e69b2fa996acf8fa1d218b67a203eb67e280899 (patch)
tree1caebab7024f5b62dc57e49a69a20ef10cb8210f /mesalib/src
parentcd103d3f4d59ac4f09cfcf126e572ddb0b9d4628 (diff)
parentf6d1847eef027266daa0f75ee92ceb09698b2761 (diff)
downloadvcxsrv-8e69b2fa996acf8fa1d218b67a203eb67e280899.tar.gz
vcxsrv-8e69b2fa996acf8fa1d218b67a203eb67e280899.tar.bz2
vcxsrv-8e69b2fa996acf8fa1d218b67a203eb67e280899.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/hw/xwin/glx/gen_gl_wrappers.py xorg-server/hw/xwin/glx/indirect.c
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/mesa/main/api_validate.c82
-rw-r--r--mesalib/src/mesa/main/api_validate.h6
-rw-r--r--mesalib/src/mesa/main/bufferobj.c2
-rw-r--r--mesalib/src/mesa/main/config.h1
-rw-r--r--mesalib/src/mesa/main/context.c2
-rw-r--r--mesalib/src/mesa/main/get.c8
-rw-r--r--mesalib/src/mesa/main/mtypes.h12
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c3
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c43
10 files changed, 107 insertions, 60 deletions
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 02495a15a..631bceecf 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -272,7 +272,7 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, GL_FALSE);
if (count <= 0) {
if (count < 0)
@@ -318,6 +318,76 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
/**
+ * Error checking for glMultiDrawElements(). Includes parameter checking
+ * and VBO bounds checking.
+ * \return GL_TRUE if OK to render, GL_FALSE if error found
+ */
+GLboolean
+_mesa_validate_MultiDrawElements(struct gl_context *ctx,
+ GLenum mode, const GLsizei *count,
+ GLenum type, const GLvoid * const *indices,
+ GLuint primcount, const GLint *basevertex)
+{
+ unsigned i;
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, GL_FALSE);
+
+ for (i = 0; i < primcount; i++) {
+ if (count[i] <= 0) {
+ if (count[i] < 0)
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMultiDrawElements(count)" );
+ return GL_FALSE;
+ }
+ }
+
+ if (!_mesa_valid_prim_mode(ctx, mode, "glMultiDrawElements")) {
+ return GL_FALSE;
+ }
+
+ if (type != GL_UNSIGNED_INT &&
+ type != GL_UNSIGNED_BYTE &&
+ type != GL_UNSIGNED_SHORT)
+ {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMultiDrawElements(type)" );
+ return GL_FALSE;
+ }
+
+ if (!check_valid_to_render(ctx, "glMultiDrawElements"))
+ return GL_FALSE;
+
+ /* Vertex buffer object tests */
+ if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
+ /* use indices in the buffer object */
+ /* make sure count doesn't go outside buffer bounds */
+ for (i = 0; i < primcount; i++) {
+ if (index_bytes(type, count[i]) >
+ ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
+ _mesa_warning(ctx,
+ "glMultiDrawElements index out of buffer bounds");
+ return GL_FALSE;
+ }
+ }
+ }
+ else {
+ /* not using a VBO */
+ for (i = 0; i < primcount; i++) {
+ if (!indices[i])
+ return GL_FALSE;
+ }
+ }
+
+ for (i = 0; i < primcount; i++) {
+ if (!check_index_bounds(ctx, count[i], type, indices[i],
+ basevertex ? basevertex[i] : 0))
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+
+/**
* Error checking for glDrawRangeElements(). Includes parameter checking
* and VBO bounds checking.
* \return GL_TRUE if OK to render, GL_FALSE if error found
@@ -328,7 +398,7 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, GL_FALSE);
if (count <= 0) {
if (count < 0)
@@ -386,7 +456,7 @@ GLboolean
_mesa_validate_DrawArrays(struct gl_context *ctx,
GLenum mode, GLint start, GLsizei count)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, GL_FALSE);
if (count <= 0) {
if (count < 0)
@@ -414,7 +484,7 @@ GLboolean
_mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first,
GLsizei count, GLsizei numInstances)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, GL_FALSE);
if (count <= 0) {
if (count < 0)
@@ -458,7 +528,7 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
const GLvoid *indices, GLsizei numInstances,
GLint basevertex)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, GL_FALSE);
if (count <= 0) {
if (count < 0)
@@ -519,7 +589,7 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx,
GLenum mode,
struct gl_transform_feedback_object *obj)
{
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, GL_FALSE);
if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback")) {
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h
index d92fd433f..59f329768 100644
--- a/mesalib/src/mesa/main/api_validate.h
+++ b/mesalib/src/mesa/main/api_validate.h
@@ -56,6 +56,12 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
const GLvoid *indices, GLint basevertex);
extern GLboolean
+_mesa_validate_MultiDrawElements(struct gl_context *ctx,
+ GLenum mode, const GLsizei *count,
+ GLenum type, const GLvoid * const *indices,
+ GLuint primcount, const GLint *basevertex);
+
+extern GLboolean
_mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type,
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index d74b7d74f..2cf1217d5 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -869,7 +869,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
if (ctx->TransformFeedback.CurrentBuffer == bufObj) {
_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) {
_mesa_BindBufferBase( GL_TRANSFORM_FEEDBACK_BUFFER, j, 0 );
}
diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h
index 1d5a0622d..ead1d323c 100644
--- a/mesalib/src/mesa/main/config.h
+++ b/mesalib/src/mesa/main/config.h
@@ -249,6 +249,7 @@
#define SUPPORTED_ATI_BUMP_UNITS 0xff
/** For GL_EXT_transform_feedback */
+#define MAX_FEEDBACK_BUFFERS 4
#define MAX_FEEDBACK_ATTRIBS 32
/** For GL_ARB_geometry_shader4 */
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 643476b94..7de714b81 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -652,7 +652,7 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE;
/* 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.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS;
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 67732521c..a83d36721 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -1232,7 +1232,7 @@ static const struct value_desc values[] = {
CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents),
extra_EXT_transform_feedback },
{ GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
- CONTEXT_INT(Const.MaxTransformFeedbackSeparateAttribs),
+ CONTEXT_INT(Const.MaxTransformFeedbackBuffers),
extra_EXT_transform_feedback },
{ GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS,
CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents),
@@ -2544,7 +2544,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
return TYPE_INT_4;
case GL_TRANSFORM_FEEDBACK_BUFFER_START:
- if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs)
+ if (index >= ctx->Const.MaxTransformFeedbackBuffers)
goto invalid_value;
if (!ctx->Extensions.EXT_transform_feedback)
goto invalid_enum;
@@ -2552,7 +2552,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
return TYPE_INT64;
case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
- if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs)
+ if (index >= ctx->Const.MaxTransformFeedbackBuffers)
goto invalid_value;
if (!ctx->Extensions.EXT_transform_feedback)
goto invalid_enum;
@@ -2560,7 +2560,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
return TYPE_INT64;
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
- if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs)
+ if (index >= ctx->Const.MaxTransformFeedbackBuffers)
goto invalid_value;
if (!ctx->Extensions.EXT_transform_feedback)
goto invalid_enum;
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index d37c1f3de..5768ed7cd 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1795,7 +1795,7 @@ struct gl_transform_feedback_info
* hardware back-ends to determine the correct stride when interleaving
* 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
at least once? */
/** The feedback buffers */
- GLuint BufferNames[MAX_FEEDBACK_ATTRIBS];
- struct gl_buffer_object *Buffers[MAX_FEEDBACK_ATTRIBS];
+ GLuint BufferNames[MAX_FEEDBACK_BUFFERS];
+ struct gl_buffer_object *Buffers[MAX_FEEDBACK_BUFFERS];
/** 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) */
- GLsizeiptr Size[MAX_FEEDBACK_ATTRIBS];
+ GLsizeiptr Size[MAX_FEEDBACK_BUFFERS];
};
@@ -2834,7 +2834,7 @@ struct gl_constants
GLbitfield ProfileMask; /**< Mask of CONTEXT_x_PROFILE_BIT */
/** GL_EXT_transform_feedback */
- GLuint MaxTransformFeedbackSeparateAttribs;
+ GLuint MaxTransformFeedbackBuffers;
GLuint MaxTransformFeedbackSeparateComponents;
GLuint MaxTransformFeedbackInterleavedComponents;
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index d02b6a056..6f8221201 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -447,7 +447,7 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
return;
}
- if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ if (index >= ctx->Const.MaxTransformFeedbackBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d)", index);
return;
}
@@ -490,7 +490,7 @@ _mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,
return;
}
- if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ if (index >= ctx->Const.MaxTransformFeedbackBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferBase(index=%d)", index);
return;
}
@@ -531,7 +531,7 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
return;
}
- if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ if (index >= ctx->Const.MaxTransformFeedbackBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glBindBufferOffsetEXT(index=%d)", index);
return;
@@ -590,7 +590,7 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count,
if (count < 0 ||
(bufferMode == GL_SEPARATE_ATTRIBS &&
- (GLuint) count > ctx->Const.MaxTransformFeedbackSeparateAttribs)) {
+ (GLuint) count > ctx->Const.MaxTransformFeedbackBuffers)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glTransformFeedbackVaryings(count=%d)", count);
return;
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index dacad9bfb..6fea1fa08 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -236,8 +236,9 @@ void st_init_limits(struct st_context *st)
c->UniformBooleanTrue = ~0;
- c->MaxTransformFeedbackSeparateAttribs =
+ c->MaxTransformFeedbackBuffers =
screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS);
+ c->MaxTransformFeedbackBuffers = MIN2(c->MaxTransformFeedbackBuffers, MAX_FEEDBACK_BUFFERS);
c->MaxTransformFeedbackSeparateComponents =
screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS);
c->MaxTransformFeedbackInterleavedComponents =
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 6f6a2983a..d2854dd6c 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -666,8 +666,6 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
_mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
_mesa_lookup_enum_by_nr(mode), start, count);
- FLUSH_CURRENT(ctx, 0);
-
if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
return;
@@ -695,8 +693,6 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
_mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n",
_mesa_lookup_enum_by_nr(mode), start, count, numInstances);
- FLUSH_CURRENT(ctx, 0);
-
if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, numInstances))
return;
@@ -728,11 +724,6 @@ vbo_exec_DrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count
numInstances))
return;
- FLUSH_CURRENT(ctx, 0);
-
- if (!_mesa_valid_to_render(ctx, "glDrawArraysInstancedBaseInstance"))
- return;
-
if (0)
check_draw_arrays_data(ctx, first, count);
@@ -902,8 +893,6 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
_mesa_lookup_enum_by_nr(mode), start, end, count,
_mesa_lookup_enum_by_nr(type), indices, basevertex);
- FLUSH_CURRENT(ctx, 0);
-
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
type, indices, basevertex ))
return;
@@ -1002,8 +991,6 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices);
- FLUSH_CURRENT(ctx, 0);
-
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
return;
@@ -1026,8 +1013,6 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices, basevertex);
- FLUSH_CURRENT(ctx, 0);
-
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
basevertex ))
return;
@@ -1051,8 +1036,6 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices, numInstances);
- FLUSH_CURRENT(ctx, 0);
-
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
numInstances, 0))
return;
@@ -1078,8 +1061,6 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type
_mesa_lookup_enum_by_nr(type), indices,
numInstances, basevertex);
- FLUSH_CURRENT(ctx, 0);
-
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
numInstances, basevertex))
return;
@@ -1273,15 +1254,10 @@ vbo_exec_MultiDrawElements(GLenum mode,
GLsizei primcount)
{
GET_CURRENT_CONTEXT(ctx);
- GLint i;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- for (i = 0; i < primcount; i++) {
- if (!_mesa_validate_DrawElements(ctx, mode, count[i], type, indices[i],
- 0))
- return;
- }
+ if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
+ primcount, NULL))
+ return;
vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
NULL);
@@ -1296,15 +1272,10 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode,
const GLsizei *basevertex)
{
GET_CURRENT_CONTEXT(ctx);
- GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- for (i = 0; i < primcount; i++) {
- if (!_mesa_validate_DrawElements(ctx, mode, count[i], type, indices[i],
- basevertex[i]))
- return;
- }
+ if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
+ primcount, basevertex))
+ return;
vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
basevertex);
@@ -1363,8 +1334,6 @@ vbo_exec_DrawTransformFeedback(GLenum mode, GLuint name)
_mesa_debug(ctx, "glDrawTransformFeedback(%s, %d)\n",
_mesa_lookup_enum_by_nr(mode), name);
- FLUSH_CURRENT(ctx, 0);
-
if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj)) {
return;
}