#include "main/macros.h"
#include "main/transformfeedback.h"
-#include "vbo_context.h"
+#include "vbo_private.h"
/**
}
+static inline int
+sizeof_ib_type(GLenum type)
+{
+ switch (type) {
+ case GL_UNSIGNED_INT:
+ return sizeof(GLuint);
+ case GL_UNSIGNED_SHORT:
+ return sizeof(GLushort);
+ case GL_UNSIGNED_BYTE:
+ return sizeof(GLubyte);
+ default:
+ assert(!"unsupported index data type");
+ /* In case assert is turned off */
+ return 0;
+ }
+}
+
/**
* Examine the array's data for NaNs, etc.
* For debug purposes; not normally used.
j = ((const GLuint *) elements)[i];
break;
default:
- assert(0);
+ unreachable("Unexpected index buffer type");
}
/* check element j of each enabled array */
}
+/**
+ * Check if we should skip the draw call even after validation was successful.
+ */
+static bool
+skip_validated_draw(struct gl_context *ctx)
+{
+ switch (ctx->API) {
+ case API_OPENGLES2:
+ /* For ES2, we can draw if we have a vertex program/shader). */
+ return ctx->VertexProgram._Current == NULL;
+
+ case API_OPENGLES:
+ /* For OpenGL ES, only draw if we have vertex positions
+ */
+ if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled)
+ return true;
+ break;
+
+ case API_OPENGL_CORE:
+ /* Section 7.3 (Program Objects) of the OpenGL 4.5 Core Profile spec
+ * says:
+ *
+ * "If there is no active program for the vertex or fragment shader
+ * stages, the results of vertex and/or fragment processing will be
+ * undefined. However, this is not an error."
+ *
+ * The fragment shader is not tested here because other state (e.g.,
+ * GL_RASTERIZER_DISCARD) affects whether or not we actually care.
+ */
+ return ctx->VertexProgram._Current == NULL;
+
+ case API_OPENGL_COMPAT:
+ if (ctx->VertexProgram._Current != NULL) {
+ /* Draw regardless of whether or not we have any vertex arrays.
+ * (Ex: could draw a point using a constant vertex pos)
+ */
+ return false;
+ } else {
+ /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic
+ * array [0]).
+ */
+ return (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled &&
+ !ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled);
+ }
+ break;
+
+ default:
+ unreachable("Invalid API value in check_valid_to_render()");
+ }
+
+ return false;
+}
+
+
/**
* Print info/data for glDrawArrays(), for debugging.
*/
const struct gl_array_attributes *array = ctx->Array.VAO->VertexAttrib;
struct gl_vertex_array *vertexAttrib = ctx->Array.VAO->_VertexAttrib;
const struct gl_vertex_array **inputs = &exec->array.inputs[0];
- GLbitfield64 const_inputs = 0x0;
+ GLbitfield const_inputs = 0x0;
GLuint i;
- switch (get_program_mode(ctx)) {
- case VP_NONE:
+ switch (get_vp_mode(ctx)) {
+ case VP_FF:
/* When no vertex program is active (or the vertex program is generated
* from fixed-function state). We put the material values into the
* generic slots. This is the only situation where material values
}
break;
- case VP_ARB:
+ case VP_SHADER:
/* There are no shaders in OpenGL ES 1.x, so this code path should be
* impossible to reach. The meta code is careful to not use shaders in
* ES1.
else if (array[VERT_ATTRIB_POS].Enabled)
inputs[0] = &vertexAttrib[VERT_ATTRIB_POS];
else {
- inputs[0] = &vbo->currval[VBO_ATTRIB_POS];
+ inputs[0] = &vbo->currval[VBO_ATTRIB_GENERIC0];
const_inputs |= VERT_BIT_POS;
}
* Note that this might set the _NEW_VARYING_VP_INPUTS dirty flag so state
* validation must be done after this call.
*/
-void
+static void
vbo_bind_arrays(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
*/
static void
vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
- GLsizei count, GLuint numInstances, GLuint baseInstance)
+ GLsizei count, GLuint numInstances, GLuint baseInstance,
+ GLuint drawID)
{
struct vbo_context *vbo = vbo_context(ctx);
- struct _mesa_prim prim[2];
+ struct _mesa_prim prim;
+
+ if (skip_validated_draw(ctx))
+ return;
vbo_bind_arrays(ctx);
/* OpenGL 4.5 says that primitive restart is ignored with non-indexed
* draws.
*/
- memset(prim, 0, sizeof(prim));
- prim[0].begin = 1;
- prim[0].end = 1;
- prim[0].mode = mode;
- prim[0].num_instances = numInstances;
- prim[0].base_instance = baseInstance;
- prim[0].is_indirect = 0;
- prim[0].start = start;
- prim[0].count = count;
-
- vbo->draw_prims(ctx, prim, 1, NULL,
+ memset(&prim, 0, sizeof(prim));
+ prim.begin = 1;
+ prim.end = 1;
+ prim.mode = mode;
+ prim.num_instances = numInstances;
+ prim.base_instance = baseInstance;
+ prim.draw_id = drawID;
+ prim.is_indirect = 0;
+ prim.start = start;
+ prim.count = count;
+
+ vbo->draw_prims(ctx, &prim, 1, NULL,
GL_TRUE, start, start + count - 1, NULL, 0, NULL);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
_mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
_mesa_enum_to_string(mode), start, count);
- if (!_mesa_validate_DrawArrays(ctx, mode, count))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawArrays(ctx, mode, count))
+ return;
+ }
if (0)
check_draw_arrays_data(ctx, start, count);
- vbo_draw_arrays(ctx, mode, start, count, 1, 0);
+ vbo_draw_arrays(ctx, mode, start, count, 1, 0, 0);
if (0)
print_draw_arrays(ctx, mode, start, count);
_mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n",
_mesa_enum_to_string(mode), start, count, numInstances);
- if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count,
- numInstances))
- return;
+
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count,
+ numInstances))
+ return;
+ }
if (0)
check_draw_arrays_data(ctx, start, count);
- vbo_draw_arrays(ctx, mode, start, count, numInstances, 0);
+ vbo_draw_arrays(ctx, mode, start, count, numInstances, 0, 0);
if (0)
print_draw_arrays(ctx, mode, start, count);
_mesa_enum_to_string(mode), first, count,
numInstances, baseInstance);
- if (!_mesa_validate_DrawArraysInstanced(ctx, mode, first, count,
- numInstances))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawArraysInstanced(ctx, mode, first, count,
+ numInstances))
+ return;
+ }
if (0)
check_draw_arrays_data(ctx, first, count);
- vbo_draw_arrays(ctx, mode, first, count, numInstances, baseInstance);
+ vbo_draw_arrays(ctx, mode, first, count, numInstances, baseInstance, 0);
if (0)
print_draw_arrays(ctx, mode, first, count);
}
+/**
+ * Called from glMultiDrawArrays when in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_MultiDrawArrays(GLenum mode, const GLint *first,
+ const GLsizei *count, GLsizei primcount)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint i;
+
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx,
+ "glMultiDrawArrays(%s, %p, %p, %d)\n",
+ _mesa_enum_to_string(mode), first, count, primcount);
+
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_MultiDrawArrays(ctx, mode, count, primcount))
+ return;
+ }
+
+ for (i = 0; i < primcount; i++) {
+ if (count[i] > 0) {
+ if (0)
+ check_draw_arrays_data(ctx, first[i], count[i]);
+
+ /* The GL_ARB_shader_draw_parameters spec adds the following after the
+ * pseudo-code describing glMultiDrawArrays:
+ *
+ * "The index of the draw (<i> in the above pseudo-code) may be
+ * read by a vertex shader as <gl_DrawIDARB>, as described in
+ * Section 11.1.3.9."
+ */
+ vbo_draw_arrays(ctx, mode, first[i], count[i], 1, 0, i);
+
+ if (0)
+ print_draw_arrays(ctx, mode, first[i], count[i]);
+ }
+ }
+}
+
+
/**
* Map GL_ELEMENT_ARRAY_BUFFER and print contents.
#endif
+static bool
+skip_draw_elements(struct gl_context *ctx, GLsizei count,
+ const GLvoid *indices)
+{
+ if (count == 0)
+ return true;
+
+ /* Not using a VBO for indices, so avoid NULL pointer derefs later.
+ */
+ if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj) && indices == NULL)
+ return true;
+
+ if (skip_validated_draw(ctx))
+ return true;
+
+ return false;
+}
+
+
/**
* Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements.
* Do the rendering for a glDrawElements or glDrawRangeElements call after
{
struct vbo_context *vbo = vbo_context(ctx);
struct _mesa_index_buffer ib;
- struct _mesa_prim prim[1];
+ struct _mesa_prim prim;
+
+ if (!index_bounds_valid) {
+ assert(start == 0u);
+ assert(end == ~0u);
+ }
+
+ if (skip_draw_elements(ctx, count, indices))
+ return;
vbo_bind_arrays(ctx);
ib.count = count;
- ib.type = type;
+ ib.index_size = sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = indices;
- prim[0].begin = 1;
- prim[0].end = 1;
- prim[0].weak = 0;
- prim[0].pad = 0;
- prim[0].mode = mode;
- prim[0].start = 0;
- prim[0].count = count;
- prim[0].indexed = 1;
- prim[0].is_indirect = 0;
- prim[0].basevertex = basevertex;
- prim[0].num_instances = numInstances;
- prim[0].base_instance = baseInstance;
- prim[0].draw_id = 0;
+ prim.begin = 1;
+ prim.end = 1;
+ prim.weak = 0;
+ prim.pad = 0;
+ prim.mode = mode;
+ prim.start = 0;
+ prim.count = count;
+ prim.indexed = 1;
+ prim.is_indirect = 0;
+ prim.basevertex = basevertex;
+ prim.num_instances = numInstances;
+ prim.base_instance = baseInstance;
+ prim.draw_id = 0;
/* Need to give special consideration to rendering a range of
* indices starting somewhere above zero. Typically the
* for the latter case elsewhere.
*/
- vbo->draw_prims(ctx, prim, 1, &ib,
+ vbo->draw_prims(ctx, &prim, 1, &ib,
index_bounds_valid, start, end, NULL, 0, NULL);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
_mesa_enum_to_string(mode), start, end, count,
_mesa_enum_to_string(type), indices, basevertex);
- if (!_mesa_validate_DrawRangeElements(ctx, mode, start, end, count,
- type, indices))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawRangeElements(ctx, mode, start, end, count,
+ type, indices))
+ return;
+ }
if ((int) end + basevertex < 0 || start + basevertex >= max_element) {
/* The application requested we draw using a range of indices that's
(void) check_draw_elements_data;
#endif
+ if (!index_bounds_valid) {
+ start = 0;
+ end = ~0;
+ }
+
vbo_validated_drawrangeelements(ctx, mode, index_bounds_valid, start, end,
count, type, indices, basevertex, 1, 0);
}
_mesa_enum_to_string(mode), count,
_mesa_enum_to_string(type), indices);
- if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices))
+ return;
+ }
- vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, 0, ~0,
count, type, indices, 0, 1, 0);
}
GET_CURRENT_CONTEXT(ctx);
if (MESA_VERBOSE & VERBOSE_DRAW)
- _mesa_debug(ctx, "glDrawElementsBaseVertex(%s, %d, %s, %p, %d)\n",
+ _mesa_debug(ctx, "glDrawElements(%s, %u, %s, %p)\n",
_mesa_enum_to_string(mode), count,
- _mesa_enum_to_string(type), indices, basevertex);
+ _mesa_enum_to_string(type), indices);
- if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
- vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices))
+ return;
+ }
+
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, 0, ~0,
count, type, indices, basevertex, 1, 0);
}
GET_CURRENT_CONTEXT(ctx);
if (MESA_VERBOSE & VERBOSE_DRAW)
- _mesa_debug(ctx, "glDrawElementsInstanced(%s, %d, %s, %p, %d)\n",
+ _mesa_debug(ctx, "glDrawElements(%s, %u, %s, %p)\n",
_mesa_enum_to_string(mode), count,
- _mesa_enum_to_string(type), indices, numInstances);
+ _mesa_enum_to_string(type), indices);
- if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
- numInstances))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
- vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
+ indices, numInstances))
+ return;
+ }
+
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, 0, ~0,
count, type, indices, 0, numInstances, 0);
}
if (MESA_VERBOSE & VERBOSE_DRAW)
_mesa_debug(ctx,
- "glDrawElementsInstancedBaseVertex(%s, %d, %s, %p, %d; %d)\n",
+ "glDrawElementsInstancedBaseVertex"
+ "(%s, %d, %s, %p, %d; %d)\n",
_mesa_enum_to_string(mode), count,
_mesa_enum_to_string(type), indices,
numInstances, basevertex);
- if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
- numInstances))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
- vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
+ indices, numInstances))
+ return;
+ }
+
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, 0, ~0,
count, type, indices,
basevertex, numInstances, 0);
}
_mesa_enum_to_string(type), indices,
numInstances, baseInstance);
- if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
- numInstances))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
- vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
+ indices, numInstances))
+ return;
+ }
+
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, 0, ~0,
count, type, indices, 0, numInstances,
baseInstance);
}
_mesa_enum_to_string(type), indices,
numInstances, basevertex, baseInstance);
- if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
- numInstances))
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type,
+ indices, numInstances))
+ return;
+ }
- vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, 0, ~0,
count, type, indices, basevertex,
numInstances, baseInstance);
}
struct vbo_context *vbo = vbo_context(ctx);
struct _mesa_index_buffer ib;
struct _mesa_prim *prim;
- unsigned int index_type_size = vbo_sizeof_ib_type(type);
+ unsigned int index_type_size = sizeof_ib_type(type);
uintptr_t min_index_ptr, max_index_ptr;
GLboolean fallback = GL_FALSE;
int i;
if (!fallback) {
ib.count = (max_index_ptr - min_index_ptr) / index_type_size;
- ib.type = type;
+ ib.index_size = sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = (void *) min_index_ptr;
}
vbo->draw_prims(ctx, prim, primcount, &ib,
- false, ~0, ~0, NULL, 0, NULL);
+ false, 0, ~0, NULL, 0, NULL);
}
else {
/* render one prim at a time */
if (count[i] == 0)
continue;
ib.count = count[i];
- ib.type = type;
+ ib.index_size = sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = indices[i];
else
prim[0].basevertex = 0;
- vbo->draw_prims(ctx, prim, 1, &ib, false, ~0, ~0, NULL, 0, NULL);
+ vbo->draw_prims(ctx, prim, 1, &ib, false, 0, ~0, NULL, 0, NULL);
}
}
primcount))
return;
+ if (skip_validated_draw(ctx))
+ return;
+
vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
NULL);
}
{
GET_CURRENT_CONTEXT(ctx);
- if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
- primcount))
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
+ primcount))
+ return;
+ }
+
+ if (skip_validated_draw(ctx))
return;
vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
GLuint stream, GLuint numInstances)
{
struct vbo_context *vbo = vbo_context(ctx);
- struct _mesa_prim prim[2];
+ struct _mesa_prim prim;
- if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj, stream,
- numInstances)) {
- return;
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj, stream,
+ numInstances)) {
+ return;
+ }
}
if (ctx->Driver.GetTransformFeedbackVertexCount &&
!_mesa_all_varyings_in_vbos(ctx->Array.VAO))) {
GLsizei n =
ctx->Driver.GetTransformFeedbackVertexCount(ctx, obj, stream);
- vbo_draw_arrays(ctx, mode, 0, n, numInstances, 0);
+ vbo_draw_arrays(ctx, mode, 0, n, numInstances, 0, 0);
return;
}
+ if (skip_validated_draw(ctx))
+ return;
+
vbo_bind_arrays(ctx);
/* init most fields to zero */
- memset(prim, 0, sizeof(prim));
- prim[0].begin = 1;
- prim[0].end = 1;
- prim[0].mode = mode;
- prim[0].num_instances = numInstances;
- prim[0].base_instance = 0;
- prim[0].is_indirect = 0;
+ memset(&prim, 0, sizeof(prim));
+ prim.begin = 1;
+ prim.end = 1;
+ prim.mode = mode;
+ prim.num_instances = numInstances;
+ prim.base_instance = 0;
+ prim.is_indirect = 0;
/* Maybe we should do some primitive splitting for primitive restart
* (like in DrawArrays), but we have no way to know how many vertices
* will be rendered. */
- vbo->draw_prims(ctx, prim, 1, NULL, GL_FALSE, ~0, ~0, obj, stream, NULL);
+ vbo->draw_prims(ctx, &prim, 1, NULL, GL_FALSE, 0, ~0, obj, stream, NULL);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
_mesa_flush(ctx);
vbo_bind_arrays(ctx);
ib.count = 0; /* unknown */
- ib.type = type;
+ ib.index_size = sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = NULL;
/* NOTE: IndexBufferObj is guaranteed to be a VBO. */
ib.count = 0; /* unknown */
- ib.type = type;
+ ib.index_size = sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = NULL;
_mesa_debug(ctx, "glDrawArraysIndirect(%s, %p)\n",
_mesa_enum_to_string(mode), indirect);
- if (!_mesa_validate_DrawArraysIndirect(ctx, mode, indirect))
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawArraysIndirect(ctx, mode, indirect))
+ return;
+ }
+
+ if (skip_validated_draw(ctx))
return;
vbo_validated_drawarraysindirect(ctx, mode, indirect);
_mesa_enum_to_string(mode),
_mesa_enum_to_string(type), indirect);
- if (!_mesa_validate_DrawElementsIndirect(ctx, mode, type, indirect))
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_DrawElementsIndirect(ctx, mode, type, indirect))
+ return;
+ }
+
+ if (skip_validated_draw(ctx))
return;
vbo_validated_drawelementsindirect(ctx, mode, type, indirect);
if (stride == 0)
stride = 4 * sizeof(GLuint); /* sizeof(DrawArraysIndirectCommand) */
- if (!_mesa_validate_MultiDrawArraysIndirect(ctx, mode, indirect,
- primcount, stride))
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_MultiDrawArraysIndirect(ctx, mode, indirect,
+ primcount, stride))
+ return;
+ }
+
+ if (skip_validated_draw(ctx))
return;
vbo_validated_multidrawarraysindirect(ctx, mode, indirect,
if (stride == 0)
stride = 5 * sizeof(GLuint); /* sizeof(DrawElementsIndirectCommand) */
- if (!_mesa_validate_MultiDrawElementsIndirect(ctx, mode, type, indirect,
- primcount, stride))
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_MultiDrawElementsIndirect(ctx, mode, type, indirect,
+ primcount, stride))
+ return;
+ }
+
+ if (skip_validated_draw(ctx))
return;
vbo_validated_multidrawelementsindirect(ctx, mode, type, indirect,
/* NOTE: IndexBufferObj is guaranteed to be a VBO. */
ib.count = 0; /* unknown */
- ib.type = type;
+ ib.index_size = sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = NULL;
if (stride == 0)
stride = 4 * sizeof(GLuint); /* sizeof(DrawArraysIndirectCommand) */
- if (!_mesa_validate_MultiDrawArraysIndirectCount(ctx, mode,
- indirect, drawcount,
- maxdrawcount, stride))
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_MultiDrawArraysIndirectCount(ctx, mode,
+ indirect, drawcount,
+ maxdrawcount, stride))
+ return;
+ }
+
+ if (skip_validated_draw(ctx))
return;
vbo_validated_multidrawarraysindirectcount(ctx, mode, indirect, drawcount,
if (stride == 0)
stride = 5 * sizeof(GLuint); /* sizeof(DrawElementsIndirectCommand) */
- if (!_mesa_validate_MultiDrawElementsIndirectCount(ctx, mode, type,
- indirect, drawcount,
- maxdrawcount, stride))
+ if (_mesa_is_no_error_enabled(ctx)) {
+ FLUSH_CURRENT(ctx, 0);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+ } else {
+ if (!_mesa_validate_MultiDrawElementsIndirectCount(ctx, mode, type,
+ indirect, drawcount,
+ maxdrawcount, stride))
+ return;
+ }
+
+ if (skip_validated_draw(ctx))
return;
vbo_validated_multidrawelementsindirectcount(ctx, mode, type, indirect,
SET_DrawRangeElements(exec, vbo_exec_DrawRangeElements);
}
+ SET_MultiDrawArrays(exec, vbo_exec_MultiDrawArrays);
SET_MultiDrawElementsEXT(exec, vbo_exec_MultiDrawElements);
if (ctx->API == API_OPENGL_COMPAT) {