aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp11
-rw-r--r--src/compiler/nir/nir.h42
-rw-r--r--src/compiler/nir/nir_gather_xfb_info.c12
-rw-r--r--src/compiler/spirv/vtn_variables.c4
4 files changed, 38 insertions, 31 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 9b9da7f8187..2e6570e5d6c 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -600,14 +600,17 @@ nir_visitor::visit(ir_variable *ir)
var->data.bindless = ir->data.bindless;
var->data.offset = ir->data.offset;
- var->data.image.access = (gl_access_qualifier)image_access;
- var->data.image.format = ir->data.image_format;
+ if (var->type->is_image()) {
+ var->data.image.access = (gl_access_qualifier)image_access;
+ var->data.image.format = ir->data.image_format;
+ } else {
+ var->data.xfb.buffer = ir->data.xfb_buffer;
+ var->data.xfb.stride = ir->data.xfb_stride;
+ }
var->data.fb_fetch_output = ir->data.fb_fetch_output;
var->data.explicit_xfb_buffer = ir->data.explicit_xfb_buffer;
var->data.explicit_xfb_stride = ir->data.explicit_xfb_stride;
- var->data.xfb_buffer = ir->data.xfb_buffer;
- var->data.xfb_stride = ir->data.xfb_stride;
var->num_state_slots = ir->get_num_state_slots();
if (var->num_state_slots > 0) {
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index e1f0fdd707c..8e93a913f32 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -478,25 +478,29 @@ typedef struct nir_variable {
*/
unsigned offset;
- /**
- * Transform feedback buffer.
- */
- unsigned xfb_buffer;
-
- /**
- * Transform feedback stride.
- */
- unsigned xfb_stride;
-
- /**
- * ARB_shader_image_load_store qualifiers.
- */
- struct {
- enum gl_access_qualifier access;
-
- /** Image internal format if specified explicitly, otherwise GL_NONE. */
- GLenum format;
- } image;
+ union {
+ /**
+ * ARB_shader_image_load_store qualifiers.
+ */
+ struct {
+ enum gl_access_qualifier access;
+
+ /** Image internal format if specified explicitly, otherwise GL_NONE. */
+ GLenum format;
+ } image;
+
+ struct {
+ /**
+ * Transform feedback buffer.
+ */
+ uint16_t buffer:2;
+
+ /**
+ * Transform feedback stride.
+ */
+ uint16_t stride;
+ } xfb;
+ };
} data;
/* Number of nir_variable_data members */
diff --git a/src/compiler/nir/nir_gather_xfb_info.c b/src/compiler/nir/nir_gather_xfb_info.c
index 562bacbed62..bcbc2a3a4c3 100644
--- a/src/compiler/nir/nir_gather_xfb_info.c
+++ b/src/compiler/nir/nir_gather_xfb_info.c
@@ -38,9 +38,9 @@ add_var_xfb_varying(nir_xfb_info *xfb,
nir_xfb_varying_info *varying = &varyings->varyings[varyings->varying_count++];
varying->type = type;
- varying->buffer = var->data.xfb_buffer;
+ varying->buffer = var->data.xfb.buffer;
varying->offset = offset;
- xfb->buffers[var->data.xfb_buffer].varying_count++;
+ xfb->buffers[var->data.xfb.buffer].varying_count++;
}
@@ -100,11 +100,11 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
} else {
assert(buffer < NIR_MAX_XFB_BUFFERS);
if (xfb->buffers_written & (1 << buffer)) {
- assert(xfb->buffers[buffer].stride == var->data.xfb_stride);
+ assert(xfb->buffers[buffer].stride == var->data.xfb.stride);
assert(xfb->buffer_to_stream[buffer] == var->data.stream);
} else {
xfb->buffers_written |= (1 << buffer);
- xfb->buffers[buffer].stride = var->data.xfb_stride;
+ xfb->buffers[buffer].stride = var->data.xfb.stride;
xfb->buffer_to_stream[buffer] = var->data.stream;
}
@@ -235,7 +235,7 @@ nir_gather_xfb_info_with_varyings(const nir_shader *shader,
if (var->data.explicit_offset && !is_array_block) {
unsigned offset = var->data.offset;
- add_var_xfb_outputs(xfb, varyings_info, var, var->data.xfb_buffer,
+ add_var_xfb_outputs(xfb, varyings_info, var, var->data.xfb.buffer,
&location, &offset, var->type, false);
} else if (is_array_block) {
assert(glsl_type_is_struct_or_ifc(var->interface_type));
@@ -253,7 +253,7 @@ nir_gather_xfb_info_with_varyings(const nir_shader *shader,
}
unsigned offset = foffset;
- add_var_xfb_outputs(xfb, varyings_info, var, var->data.xfb_buffer + b,
+ add_var_xfb_outputs(xfb, varyings_info, var, var->data.xfb.buffer + b,
&location, &offset, ftype, false);
}
}
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 188931ec77b..af611b68b13 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1586,12 +1586,12 @@ apply_var_decoration(struct vtn_builder *b,
case SpvDecorationXfbBuffer:
var_data->explicit_xfb_buffer = true;
- var_data->xfb_buffer = dec->operands[0];
+ var_data->xfb.buffer = dec->operands[0];
var_data->always_active_io = true;
break;
case SpvDecorationXfbStride:
var_data->explicit_xfb_stride = true;
- var_data->xfb_stride = dec->operands[0];
+ var_data->xfb.stride = dec->operands[0];
break;
case SpvDecorationOffset:
var_data->explicit_offset = true;