glthread: don't upload for glDraw inside a display list and always sync
[mesa.git] / src / mesa / main / glthread.h
index f979e5931d4389bf5890326395495dc96b96f6d7..34a5443a6daff75f3affb53b0fe1cd3835461df3 100644 (file)
@@ -51,6 +51,7 @@
 #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;
@@ -65,7 +66,8 @@ struct glthread_attrib_binding {
 struct glthread_vao {
    GLuint Name;
    GLuint CurrentElementBufferName;
-   GLbitfield Enabled;
+   GLbitfield UserEnabled; /**< Vertex attrib arrays enabled by the user. */
+   GLbitfield Enabled; /**< UserEnabled with POS vs GENERIC0 aliasing resolved. */
    GLbitfield UserPointerMask;
    GLbitfield NonZeroDivisorMask;
 
@@ -98,6 +100,18 @@ struct glthread_batch
    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. */
@@ -109,6 +123,9 @@ struct glthread_state
    /** 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];
 
@@ -129,6 +146,7 @@ struct glthread_state
 
    /** Caps. */
    GLboolean SupportsBufferUploads;
+   GLboolean SupportsNonVBOUploads;
 
    /** Primitive restart state. */
    bool PrimitiveRestart;
@@ -142,6 +160,8 @@ struct glthread_state
    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. */
@@ -187,5 +207,9 @@ void _mesa_glthread_DSAAttribPointer(struct gl_context *ctx, GLuint vao,
                                      GLuint buffer, gl_vert_attrib attrib,
                                      GLint size, GLenum type, GLsizei stride,
                                      GLintptr offset);
+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*/