#ifndef _GLTHREAD_H
#define _GLTHREAD_H
#define MARSHAL_MAX_CMD_SIZE (8 * 1024)
#define MARSHAL_MAX_BATCHES 8
#include <inttypes.h>
#include <stdbool.h>
#include "util/u_queue.h"
#include "GL/gl.h"
#include "compiler/shader_enums.h"
struct gl_context;
struct _mesa_HashTable;
struct glthread_vao {
GLuint Name;
GLuint CurrentElementBufferName;
GLbitfield Enabled;
GLbitfield UserPointerMask;
};
struct glthread_batch
{
struct util_queue_fence fence;
struct gl_context *ctx;
int used;
#ifdef _MSC_VER
__declspec(align(8))
#else
__attribute__((aligned(8)))
#endif
uint8_t buffer[MARSHAL_MAX_CMD_SIZE];
};
struct glthread_state
{
struct util_queue queue;
struct util_queue_monitoring stats;
bool enabled;
struct glthread_batch batches[MARSHAL_MAX_BATCHES];
struct glthread_batch *next_batch;
unsigned last;
unsigned next;
struct _mesa_HashTable *VAOs;
struct glthread_vao *CurrentVAO;
struct glthread_vao *LastLookedUpVAO;
struct glthread_vao DefaultVAO;
int ClientActiveTexture;
GLuint CurrentArrayBufferName;
GLuint CurrentDrawIndirectBufferName;
};
void _mesa_glthread_init(struct gl_context *ctx);
void _mesa_glthread_destroy(struct gl_context *ctx);
void _mesa_glthread_restore_dispatch(struct gl_context *ctx, const char *func);
void _mesa_glthread_disable(struct gl_context *ctx, const char *func);
void _mesa_glthread_flush_batch(struct gl_context *ctx);
void _mesa_glthread_finish(struct gl_context *ctx);
void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func);
void _mesa_glthread_BindBuffer(struct gl_context *ctx, GLenum target,
GLuint buffer);
void _mesa_glthread_DeleteBuffers(struct gl_context *ctx, GLsizei n,
const GLuint *buffers);
void _mesa_glthread_BindVertexArray(struct gl_context *ctx, GLuint id);
void _mesa_glthread_DeleteVertexArrays(struct gl_context *ctx,
GLsizei n, const GLuint *ids);
void _mesa_glthread_GenVertexArrays(struct gl_context *ctx,
GLsizei n, GLuint *arrays);
void _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj,
gl_vert_attrib attrib, bool enable);
void _mesa_glthread_AttribPointer(struct gl_context *ctx,
gl_vert_attrib attrib);
#endif