From 42d7bbfc2286428de6a12a5071c12314f41b9178 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Wed, 19 Aug 2020 14:34:11 -0700 Subject: [PATCH] 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 Part-of: --- src/compiler/nir/nir.h | 10 ++++++---- src/compiler/nir/nir_builder.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 5804670fb99..57e0d9ae092 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -328,7 +328,7 @@ typedef struct nir_variable { * * \sa nir_variable_mode */ - nir_variable_mode mode:11; + unsigned mode:11; /** * Is the variable read-only? @@ -467,12 +467,12 @@ typedef struct nir_variable { 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 * 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. @@ -483,10 +483,12 @@ typedef struct nir_variable { unsigned stream:9; /** + * See gl_access_qualifier. + * * Access flags for memory variables (SSBO/global), image uniforms, and * bindless images in uniforms/inputs/outputs. */ - enum gl_access_qualifier access:8; + unsigned access:8; /** * Descriptor set binding for sampler or UBO. diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 4a91d26915b..bcaeae382b5 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -990,7 +990,7 @@ nir_build_deref_var(nir_builder *build, nir_variable *var) nir_deref_instr *deref = 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->var = var; -- 2.30.2