mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-18 12:30:47 +02:00
glthread: clean up how vertex stride is packed
Use a better type name. Also check the function name more accurately (no change in behavior). Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27350>
This commit is contained in:
parent
617cdedd35
commit
13a8efcb2c
3 changed files with 14 additions and 6 deletions
|
|
@ -227,7 +227,7 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
p.name, p.size_string()))
|
||||
elif type == 'GLenum16':
|
||||
out('cmd->{0} = MIN2({0}, 0xffff); /* clamped to 0xffff (invalid enum) */'.format(p.name))
|
||||
elif type == 'int16_t':
|
||||
elif type == 'GLclamped16i':
|
||||
out('cmd->{0} = CLAMP({0}, INT16_MIN, INT16_MAX);'.format(p.name))
|
||||
else:
|
||||
out('cmd->{0} = {0};'.format(p.name))
|
||||
|
|
|
|||
|
|
@ -33,10 +33,15 @@ def get_marshal_type(func_name, param):
|
|||
if type == 'GLenum':
|
||||
return 'GLenum16' # clamped to 0xffff (always invalid enum)
|
||||
|
||||
# Use int16_t for the vertex stride, the max value is usually 2048.
|
||||
if ((type, param.name) == ('GLsizei', 'stride') and
|
||||
('Vertex' in func_name or 'Pointer' in func_name or 'Interleaved' in func_name)):
|
||||
return 'int16_t' # clamped to INT16_MAX (always invalid value)
|
||||
if (func_name == 'InterleavedArrays' or
|
||||
func_name.endswith('VertexBuffer') or
|
||||
func_name.endswith('VertexBufferEXT') or
|
||||
func_name.endswith('Pointer') or
|
||||
func_name.endswith('PointerEXT') or
|
||||
func_name.endswith('PointerOES') or
|
||||
func_name.endswith('OffsetEXT')):
|
||||
if (type, param.name) == ('GLsizei', 'stride'):
|
||||
return 'GLclamped16i'
|
||||
|
||||
return type
|
||||
|
||||
|
|
@ -54,7 +59,7 @@ def get_type_size(func_name, param):
|
|||
'GLshort': 2,
|
||||
'GLushort': 2,
|
||||
'GLhalfNV': 2,
|
||||
'int16_t': 2, # clamped by glthread
|
||||
'GLclamped16i': 2, # clamped by glthread
|
||||
'GLint': 4,
|
||||
'GLuint': 4,
|
||||
'GLbitfield': 4,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@
|
|||
#include "main/macros.h"
|
||||
#include "main/matrix.h"
|
||||
|
||||
/* 32-bit signed integer clamped to 16 bits. */
|
||||
typedef int16_t GLclamped16i;
|
||||
|
||||
struct marshal_cmd_base
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue