diff options
author | Neil Roberts <[email protected]> | 2018-03-01 17:51:58 +0100 |
---|---|---|
committer | Alejandro Piñeiro <[email protected]> | 2018-06-21 14:25:05 +0200 |
commit | 386f09be9b7984d99d7106b2ec10ba25d5cf2673 (patch) | |
tree | f56055e56985211b8a8b4a0598732948e438e729 /src/compiler/spirv/vtn_cfg.c | |
parent | 23edc5b1ef36226a84a4e0bf325d05d3dbdff350 (diff) |
spirv: Get rid of vtn_variable_mode_image/sampler
vtn_variable_mode_image and _sampler are instead replaced with
vtn_variable_mode_uniform which encompasses both of them. In the few
places where it was neccessary to distinguish between the two, the
GLSL type of the pointer is used instead.
The main reason to do this is that on OpenGL it is permitted to put
images and samplers into structs and declare a uniform with them. That
means that variables can now have a mix of uniform, sampler and image
modes so picking a single one of those modes for a variable no longer
makes sense.
This fixes OpLoad on a sampler within a struct which was previously
using the variable mode to determine whether it was a sampler or not.
The type of the variable is a struct so it was not being considered to
be uniform mode even though the member being loaded should be sampler
mode.
The previous code appeared to be using var->interface_type as a place
to store the type of the variable without the enclosing array for
images and samplers. I guess this worked because opaque types can not
appear in interfaces so the interface_type is sort of unused. This
patch removes the overloading of var->interface_type and any places
that needed the type without the array can now just deduce it from
var->type.
v2: squash in this patch the changes to anv/nir (Timothy)
Signed-off-by: Eduardo Lima <[email protected]>
Signed-off-by: Neil Roberts <[email protected]
Signed-off-by: Alejandro Piñeiro <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_cfg.c')
-rw-r--r-- | src/compiler/spirv/vtn_cfg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index ad4374112e1..cea40cefc85 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -124,10 +124,10 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode, without_array = without_array->array_element; if (glsl_type_is_image(without_array->type)) { - vtn_var->mode = vtn_variable_mode_image; + vtn_var->mode = vtn_variable_mode_uniform; param->interface_type = without_array->type; } else if (glsl_type_is_sampler(without_array->type)) { - vtn_var->mode = vtn_variable_mode_sampler; + vtn_var->mode = vtn_variable_mode_uniform; param->interface_type = without_array->type; } else { vtn_var->mode = vtn_variable_mode_param; |