mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
glthread: track primitive restart state
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4314>
This commit is contained in:
parent
9037005d60
commit
47cf310a67
5 changed files with 68 additions and 3 deletions
|
|
@ -563,7 +563,8 @@
|
|||
<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>
|
||||
|
||||
|
|
|
|||
|
|
@ -2372,13 +2372,14 @@
|
|||
<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>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@
|
|||
*/
|
||||
#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"
|
||||
|
|
@ -127,6 +130,13 @@ struct glthread_state
|
|||
/** 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;
|
||||
|
|
@ -162,6 +172,9 @@ 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_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,
|
||||
|
|
|
|||
|
|
@ -399,6 +399,8 @@ _mesa_array_to_attrib(struct gl_context *ctx, GLenum array)
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#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)
|
||||
|
|
@ -140,10 +141,57 @@ get_vao(struct gl_context *ctx, const GLuint *vaobj)
|
|||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue