if p.count:
out('memcpy(cmd->{0}, {0}, {1});'.format(
p.name, p.size_string()))
+ elif p.type_string() == 'GLenum':
+ out('cmd->{0} = MIN2({0}, 0xffff); /* clamped to 0xffff (invalid enum) */'.format(p.name))
else:
out('cmd->{0} = {0};'.format(p.name))
if variable_params:
'GLboolean': 1,
'GLbyte': 1,
'GLubyte': 1,
+ 'GLenum': 2, # uses GLenum16, clamped to 0xffff (invalid enum)
'GLshort': 2,
'GLushort': 2,
'GLhalfNV': 2,
- 'GLenum': 4,
'GLint': 4,
'GLuint': 4,
'GLbitfield': 4,
out('{0} {1}[{2}];'.format(
p.get_base_type_string(), p.name, p.count))
else:
- out('{0} {1};'.format(p.type_string(), p.name))
+ type = p.type_string()
+ if type == 'GLenum':
+ type = 'GLenum16'
+ out('{0} {1};'.format(type, p.name))
for p in variable_params:
if p.img_null_flag:
#include "GL/gl.h"
#include "compiler/shader_enums.h"
#include "main/config.h"
+#include "glheader.h"
#ifdef __cplusplus
extern "C" {
struct glthread_attrib_node {
GLbitfield Mask;
int ActiveTexture;
- GLenum MatrixMode;
+ GLenum16 MatrixMode;
bool CullFace;
bool DepthTest;
};
bool inside_begin_end;
/** Display lists. */
- GLenum ListMode; /**< Zero if not inside display list, else list mode. */
+ GLenum16 ListMode; /**< Zero if not inside display list, else list mode. */
unsigned ListBase;
unsigned ListCallDepth;
/** Basic matrix state tracking. */
int ActiveTexture;
- GLenum MatrixMode;
+ GLenum16 MatrixMode;
gl_matrix_index MatrixIndex;
struct glthread_attrib_node AttribStack[MAX_ATTRIB_STACK_DEPTH];
int AttribStackDepth;
struct marshal_cmd_DrawElementsInstancedARB
{
struct marshal_cmd_base cmd_base;
- GLenum mode;
- GLenum type;
+ GLenum16 mode;
+ GLenum16 type;
GLsizei count;
GLsizei instance_count;
GLint basevertex;
struct marshal_cmd_DrawRangeElementsBaseVertex
{
struct marshal_cmd_base cmd_base;
- GLenum mode;
- GLenum type;
+ GLenum16 mode;
+ GLenum16 type;
GLsizei count;
GLint basevertex;
GLuint min_index;
struct marshal_cmd_DrawRangeElementsBaseVertex *cmd =
_mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DrawRangeElementsBaseVertex, cmd_size);
- cmd->mode = mode;
+ cmd->mode = MIN2(mode, 0xffff);
+ cmd->type = MIN2(type, 0xffff);
cmd->count = count;
- cmd->type = type;
cmd->indices = indices;
cmd->basevertex = basevertex;
cmd->min_index = min_index;
struct marshal_cmd_DrawElementsInstancedARB *cmd =
_mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DrawElementsInstancedARB, cmd_size);
- cmd->mode = mode;
+ cmd->mode = MIN2(mode, 0xffff);
+ cmd->type = MIN2(type, 0xffff);
cmd->count = count;
- cmd->type = type;
cmd->indices = indices;
cmd->instance_count = instance_count;
cmd->basevertex = basevertex;
{
struct marshal_cmd_base cmd_base;
bool index_bounds_valid;
- GLenum mode;
- GLenum type;
+ GLenum16 mode;
+ GLenum16 type;
GLsizei count;
GLsizei instance_count;
GLint basevertex;
struct marshal_cmd_DrawElementsInstancedBaseVertexBaseInstance *cmd;
cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DrawElementsInstancedBaseVertexBaseInstance, cmd_size);
- cmd->mode = mode;
+ cmd->mode = MIN2(mode, 0xffff);
+ cmd->type = MIN2(type, 0xffff);
cmd->count = count;
- cmd->type = type;
cmd->indices = indices;
cmd->instance_count = instance_count;
cmd->basevertex = basevertex;
{
struct marshal_cmd_base cmd_base;
bool has_base_vertex;
- GLenum mode;
- GLenum type;
+ GLenum16 mode;
+ GLenum16 type;
GLsizei draw_count;
GLuint user_buffer_mask;
struct gl_buffer_object *index_buffer;
}
cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MultiDrawElementsBaseVertex, cmd_size);
- cmd->mode = mode;
- cmd->type = type;
+ cmd->mode = MIN2(mode, 0xffff);
+ cmd->type = MIN2(type, 0xffff);
cmd->draw_count = draw_count;
cmd->user_buffer_mask = user_buffer_mask;
cmd->index_buffer = index_buffer;
return;
ctx->GLThread.MatrixIndex = _mesa_get_matrix_index(ctx, mode);
- ctx->GLThread.MatrixMode = mode;
+ ctx->GLThread.MatrixMode = MIN2(mode, 0xffff);
}
static inline void
}
static inline void
-_mesa_glthread_NewList(struct gl_context *ctx, GLuint list, GLuint mode)
+_mesa_glthread_NewList(struct gl_context *ctx, GLuint list, GLenum mode)
{
if (!ctx->GLThread.ListMode)
- ctx->GLThread.ListMode = mode;
+ ctx->GLThread.ListMode = MIN2(mode, 0xffff);
}
static inline void