<param name="buffer" type="GLuint"/>
</function>
- <function name="PrimitiveRestartIndex" no_error="true">
+ <function name="PrimitiveRestartIndex" no_error="true"
+ marshal_call_after="_mesa_glthread_PrimitiveRestartIndex(ctx, index);">
<param name="index" type="GLuint"/>
</function>
<glx rop="137"/>
</function>
- <function name="Disable" es1="1.0" es2="2.0">
+ <function name="Disable" es1="1.0" es2="2.0"
+ marshal_call_after="if (cap == GL_PRIMITIVE_RESTART || cap == GL_PRIMITIVE_RESTART_FIXED_INDEX) _mesa_glthread_set_prim_restart(ctx, cap, false);">
<param name="cap" type="GLenum"/>
<glx rop="138" handcode="client"/>
</function>
<function name="Enable" es1="1.0" es2="2.0"
- marshal_call_after='if (cap == GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB) _mesa_glthread_disable(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");'>
+ marshal_call_after='if (cap == GL_PRIMITIVE_RESTART || cap == GL_PRIMITIVE_RESTART_FIXED_INDEX) { _mesa_glthread_set_prim_restart(ctx, cap, true); } else if (cap == GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB) { _mesa_glthread_disable(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)"); }'>
<param name="cap" type="GLenum"/>
<glx rop="139" handcode="client"/>
</function>
*/
#define MARSHAL_MAX_BATCHES 8
+/* Special value for glEnableClientState(GL_PRIMITIVE_RESTART_NV). */
+#define VERT_ATTRIB_PRIMITIVE_RESTART_NV -1
+
#include <inttypes.h>
#include <stdbool.h>
#include "util/u_queue.h"
/** Caps. */
GLboolean SupportsBufferUploads;
+ /** Primitive restart state. */
+ bool PrimitiveRestart;
+ bool PrimitiveRestartFixedIndex;
+ bool _PrimitiveRestart;
+ GLuint RestartIndex;
+ GLuint _RestartIndex[4]; /**< Restart index for index_size = 1,2,4. */
+
/** Vertex Array objects tracked by glthread independently of Mesa. */
struct _mesa_HashTable *VAOs;
struct glthread_vao *CurrentVAO;
GLsizei n, const GLuint *ids);
void _mesa_glthread_GenVertexArrays(struct gl_context *ctx,
GLsizei n, GLuint *arrays);
+void _mesa_glthread_set_prim_restart(struct gl_context *ctx, GLenum cap,
+ bool value);
+void _mesa_glthread_PrimitiveRestartIndex(struct gl_context *ctx, GLuint index);
void _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj,
gl_vert_attrib attrib, bool enable);
void _mesa_glthread_AttribDivisor(struct gl_context *ctx, const GLuint *vaobj,
return VERT_ATTRIB_COLOR1;
case GL_POINT_SIZE_ARRAY_OES:
return VERT_ATTRIB_POINT_SIZE;
+ case GL_PRIMITIVE_RESTART_NV:
+ return VERT_ATTRIB_PRIMITIVE_RESTART_NV;
default:
if (array >= GL_TEXTURE0 && array <= GL_TEXTURE7)
return VERT_ATTRIB_TEX(array - GL_TEXTURE0);
#include "main/mtypes.h"
#include "main/hash.h"
#include "main/dispatch.h"
+#include "main/varray.h"
/* TODO:
* - Handle ARB_vertex_attrib_binding (incl. EXT_dsa and ARB_dsa)
return ctx->GLThread.CurrentVAO;
}
+static void
+update_primitive_restart(struct gl_context *ctx)
+{
+ struct glthread_state *glthread = &ctx->GLThread;
+
+ glthread->_PrimitiveRestart = glthread->PrimitiveRestart ||
+ glthread->PrimitiveRestartFixedIndex;
+ glthread->_RestartIndex[0] =
+ _mesa_get_prim_restart_index(glthread->PrimitiveRestartFixedIndex,
+ glthread->RestartIndex, 1);
+ glthread->_RestartIndex[1] =
+ _mesa_get_prim_restart_index(glthread->PrimitiveRestartFixedIndex,
+ glthread->RestartIndex, 2);
+ glthread->_RestartIndex[3] =
+ _mesa_get_prim_restart_index(glthread->PrimitiveRestartFixedIndex,
+ glthread->RestartIndex, 4);
+}
+
+void
+_mesa_glthread_set_prim_restart(struct gl_context *ctx, GLenum cap, bool value)
+{
+ switch (cap) {
+ case GL_PRIMITIVE_RESTART:
+ ctx->GLThread.PrimitiveRestart = value;
+ break;
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ ctx->GLThread.PrimitiveRestartFixedIndex = value;
+ break;
+ }
+
+ update_primitive_restart(ctx);
+}
+
+void
+_mesa_glthread_PrimitiveRestartIndex(struct gl_context *ctx, GLuint index)
+{
+ ctx->GLThread.RestartIndex = index;
+ update_primitive_restart(ctx);
+}
+
void
_mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj,
gl_vert_attrib attrib, bool enable)
{
+ /* The primitive restart client state uses a special value. */
+ if (attrib == VERT_ATTRIB_PRIMITIVE_RESTART_NV) {
+ ctx->GLThread.PrimitiveRestart = enable;
+ update_primitive_restart(ctx);
+ return;
+ }
+
if (attrib >= VERT_ATTRIB_MAX)
return;