From 96e6ef80d932f12d3ed7ab5bc4aff6b370d6dc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 25 Oct 2019 15:21:30 -0400 Subject: [PATCH] nir: pack the rest of nir_variable::data Reviewed-by: Connor Abbott --- src/compiler/nir/nir.h | 67 +++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 8e93a913f32..3aa72a6a5c6 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -62,6 +62,7 @@ extern "C" { #define NIR_MAX_MATRIX_COLUMNS 4 #define NIR_STREAM_PACKED (1 << 8) typedef uint8_t nir_component_mask_t; +typedef unsigned short GLenum16; /** Defines a cast function * @@ -107,7 +108,7 @@ typedef enum { nir_var_mem_ssbo = (1 << 7), nir_var_mem_shared = (1 << 8), nir_var_mem_global = (1 << 9), - nir_var_all = ~0, + nir_var_all = (1 << 10) - 1, } nir_variable_mode; /** @@ -314,7 +315,7 @@ typedef struct nir_variable { * * \sa nir_variable_mode */ - nir_variable_mode mode; + nir_variable_mode mode:10; /** * Is the variable read-only? @@ -419,7 +420,32 @@ typedef struct nir_variable { * 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; + nir_depth_layout depth_layout:3; + + /** + * Vertex stream output identifier. + * + * For packed outputs, NIR_STREAM_PACKED is set and bits [2*i+1,2*i] + * indicate the stream of the i-th component. + */ + unsigned stream:9; + + /** + * output index for dual source blending. + */ + unsigned index; + + /** + * Descriptor set binding for sampler or UBO. + */ + int descriptor_set:5; + + /** + * Initial binding point for a sampler or UBO. + * + * For array types, this represents the binding point for the first element. + */ + unsigned binding:5; /** * Storage location of the base of this variable @@ -443,35 +469,10 @@ typedef struct nir_variable { int location; /** - * The actual location of the variable in the IR. Only valid for inputs - * and outputs. + * The actual location of the variable in the IR. Only valid for inputs, + * outputs, and uniforms (including samplers and images). */ - unsigned int driver_location; - - /** - * Vertex stream output identifier. - * - * For packed outputs, NIR_STREAM_PACKED is set and bits [2*i+1,2*i] - * indicate the stream of the i-th component. - */ - unsigned stream:9; - - /** - * output index for dual source blending. - */ - int index; - - /** - * Descriptor set binding for sampler or UBO. - */ - int descriptor_set; - - /** - * Initial binding point for a sampler or UBO. - * - * For array types, this represents the binding point for the first element. - */ - unsigned binding; + unsigned driver_location; /** * Location an atomic counter or transform feedback is stored at. @@ -483,10 +484,10 @@ typedef struct nir_variable { * ARB_shader_image_load_store qualifiers. */ struct { - enum gl_access_qualifier access; + enum gl_access_qualifier access:8; /** Image internal format if specified explicitly, otherwise GL_NONE. */ - GLenum format; + GLenum16 format; } image; struct {