*/
#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"
#include "GL/gl.h"
#include "compiler/shader_enums.h"
+#include "main/config.h"
struct gl_context;
struct gl_buffer_object;
struct glthread_vao {
GLuint Name;
GLuint CurrentElementBufferName;
- GLbitfield Enabled;
- GLbitfield UserPointerMask;
- GLbitfield NonZeroDivisorMask;
+ GLbitfield UserEnabled; /**< Vertex attribs enabled by the user. */
+ GLbitfield Enabled; /**< UserEnabled with POS vs GENERIC0 aliasing resolved. */
+ GLbitfield BufferEnabled; /**< "Enabled" converted to buffer bindings. */
+ GLbitfield BufferInterleaved; /**< Bitmask of buffers used by multiple attribs. */
+ GLbitfield UserPointerMask; /**< Bitmask of buffer bindings. */
+ GLbitfield NonZeroDivisorMask; /**< Bitmask of buffer bindings. */
struct {
+ /* Per attrib: */
GLuint ElementSize;
+ GLuint RelativeOffset;
+ GLuint BufferIndex; /**< Referring to Attrib[BufferIndex]. */
+
+ /* Per buffer binding: */
GLsizei Stride;
GLuint Divisor;
+ int EnabledAttribCount; /**< Number of enabled attribs using this buffer. */
const void *Pointer;
} Attrib[VERT_ATTRIB_MAX];
};
uint8_t buffer[MARSHAL_MAX_CMD_SIZE];
};
+struct glthread_client_attrib {
+ struct glthread_vao VAO;
+ GLuint CurrentArrayBufferName;
+ int ClientActiveTexture;
+ GLuint RestartIndex;
+ bool PrimitiveRestart;
+ bool PrimitiveRestartFixedIndex;
+
+ /** Whether this element of the client attrib stack contains saved state. */
+ bool Valid;
+};
+
struct glthread_state
{
/** Multithreaded queue. */
/** Whether GLThread is enabled. */
bool enabled;
+ /** Whether GLThread is inside a display list generation. */
+ bool inside_dlist;
+
/** The ring of batches in memory. */
struct glthread_batch batches[MARSHAL_MAX_BATCHES];
/** Caps. */
GLboolean SupportsBufferUploads;
+ GLboolean SupportsNonVBOUploads;
+
+ /** 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;
struct glthread_vao *LastLookedUpVAO;
struct glthread_vao DefaultVAO;
+ struct glthread_client_attrib ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH];
+ int ClientAttribStackTop;
int ClientActiveTexture;
/** Currently-bound buffer object IDs. */
GLsizeiptr size, unsigned *out_offset,
struct gl_buffer_object **out_buffer,
uint8_t **out_ptr);
+void _mesa_glthread_reset_vao(struct glthread_vao *vao);
void _mesa_glthread_BindBuffer(struct gl_context *ctx, GLenum target,
GLuint buffer);
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,
GLuint buffer, gl_vert_attrib attrib,
GLint size, GLenum type, GLsizei stride,
GLintptr offset);
+void _mesa_glthread_AttribFormat(struct gl_context *ctx, GLuint attribindex,
+ GLint size, GLenum type, GLuint relativeoffset);
+void _mesa_glthread_DSAAttribFormat(struct gl_context *ctx, GLuint vaobj,
+ GLuint attribindex, GLint size, GLenum type,
+ GLuint relativeoffset);
+void _mesa_glthread_VertexBuffer(struct gl_context *ctx, GLuint bindingindex,
+ GLuint buffer, GLintptr offset, GLsizei stride);
+void _mesa_glthread_DSAVertexBuffer(struct gl_context *ctx, GLuint vaobj,
+ GLuint bindingindex, GLuint buffer,
+ GLintptr offset, GLsizei stride);
+void _mesa_glthread_DSAVertexBuffers(struct gl_context *ctx, GLuint vaobj,
+ GLuint first, GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizei *strides);
+void _mesa_glthread_BindingDivisor(struct gl_context *ctx, GLuint bindingindex,
+ GLuint divisor);
+void _mesa_glthread_DSABindingDivisor(struct gl_context *ctx, GLuint vaobj,
+ GLuint bindingindex, GLuint divisor);
+void _mesa_glthread_AttribBinding(struct gl_context *ctx, GLuint attribindex,
+ GLuint bindingindex);
+void _mesa_glthread_DSAAttribBinding(struct gl_context *ctx, GLuint vaobj,
+ GLuint attribindex, GLuint bindingindex);
+void _mesa_glthread_DSAElementBuffer(struct gl_context *ctx, GLuint vaobj,
+ GLuint buffer);
+void _mesa_glthread_PushClientAttrib(struct gl_context *ctx, GLbitfield mask,
+ bool set_default);
+void _mesa_glthread_PopClientAttrib(struct gl_context *ctx);
+void _mesa_glthread_ClientAttribDefault(struct gl_context *ctx, GLbitfield mask);
#endif /* _GLTHREAD_H*/