OSDN Git Service

spirv: Get rid of vtn_variable_mode_image/sampler
authorNeil Roberts <nroberts@igalia.com>
Thu, 1 Mar 2018 16:51:58 +0000 (17:51 +0100)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 21 Jun 2018 12:25:05 +0000 (14:25 +0200)
commit386f09be9b7984d99d7106b2ec10ba25d5cf2673
treef56055e56985211b8a8b4a0598732948e438e729
parent23edc5b1ef36226a84a4e0bf325d05d3dbdff350
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 <elima@igalia.com>
Signed-off-by: Neil Roberts <nroberts@igalia.com
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/spirv/spirv_to_nir.c
src/compiler/spirv/vtn_cfg.c
src/compiler/spirv/vtn_private.h
src/compiler/spirv/vtn_variables.c
src/intel/vulkan/anv_nir_apply_pipeline_layout.c