nir: Use 'unsigned' instead of enum types in nir_variable::data

MSVC treats enums as signed, so storing values that use the topmost
bit of the explicitly sized field loads as a negative value instead.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6393>
This commit is contained in:
Jesse Natalie
2020-08-19 14:34:11 -07:00
committed by Marge Bot
parent 1ccd681109
commit 42d7bbfc22
2 changed files with 7 additions and 5 deletions

View File

@@ -328,7 +328,7 @@ typedef struct nir_variable {
* *
* \sa nir_variable_mode * \sa nir_variable_mode
*/ */
nir_variable_mode mode:11; unsigned mode:11;
/** /**
* Is the variable read-only? * Is the variable read-only?
@@ -467,12 +467,12 @@ typedef struct nir_variable {
unsigned per_view:1; unsigned per_view:1;
/** /**
* \brief Layout qualifier for gl_FragDepth. * \brief Layout qualifier for gl_FragDepth. See nir_depth_layout.
* *
* This is not equal to \c ir_depth_layout_none if and only if this * This is not equal to \c ir_depth_layout_none if and only if this
* variable is \c gl_FragDepth and a layout qualifier is specified. * variable is \c gl_FragDepth and a layout qualifier is specified.
*/ */
nir_depth_layout depth_layout:3; unsigned depth_layout:3;
/** /**
* Vertex stream output identifier. * Vertex stream output identifier.
@@ -483,10 +483,12 @@ typedef struct nir_variable {
unsigned stream:9; unsigned stream:9;
/** /**
* See gl_access_qualifier.
*
* Access flags for memory variables (SSBO/global), image uniforms, and * Access flags for memory variables (SSBO/global), image uniforms, and
* bindless images in uniforms/inputs/outputs. * bindless images in uniforms/inputs/outputs.
*/ */
enum gl_access_qualifier access:8; unsigned access:8;
/** /**
* Descriptor set binding for sampler or UBO. * Descriptor set binding for sampler or UBO.

View File

@@ -990,7 +990,7 @@ nir_build_deref_var(nir_builder *build, nir_variable *var)
nir_deref_instr *deref = nir_deref_instr *deref =
nir_deref_instr_create(build->shader, nir_deref_type_var); nir_deref_instr_create(build->shader, nir_deref_type_var);
deref->mode = var->data.mode; deref->mode = (nir_variable_mode)var->data.mode;
deref->type = var->type; deref->type = var->type;
deref->var = var; deref->var = var;