summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>2019-05-22 14:55:45 +0300
committerJuan A. Suarez Romero <jasuarez@igalia.com>2019-05-27 08:26:47 +0000
commit03fd3447764588a64a555534473faf8e30204ec7 (patch)
tree61319830c901731cc8f4d4d336cdd25403ca4569
parent9037cf26bb9933a34cc92f39c8b104220c9e1c61 (diff)
anv: Do not emulate texture swizzle for INPUT_ATTACHMENT, STORAGE_IMAGE
If descriptorType is VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageView member of each element of pImageInfo must have been created with the identity swizzle. Fixes: d2aa65eb Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (cherry picked from commit c82dcf89ae853f6c499bc2c4422293750b4e1d1b)
-rw-r--r--src/intel/vulkan/anv_descriptor_set.c6
-rw-r--r--src/intel/vulkan/anv_nir_apply_pipeline_layout.c12
2 files changed, 12 insertions, 6 deletions
diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 18c4ceffb44..a6b49468f73 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -103,7 +103,11 @@ anv_descriptor_data_for_type(const struct anv_physical_device *device,
type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC))
data |= ANV_DESCRIPTOR_ADDRESS_RANGE;
- /* On Ivy Bridge and Bay Trail, we need swizzles textures in the shader */
+ /* On Ivy Bridge and Bay Trail, we need swizzles textures in the shader
+ * Do not handle VK_DESCRIPTOR_TYPE_STORAGE_IMAGE and
+ * VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT because they already must
+ * have identity swizzle.
+ */
if (device->info.gen == 7 && !device->info.is_haswell &&
(type == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE ||
type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER))
diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index 2777762a322..456df1853ec 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -929,13 +929,15 @@ lower_gen7_tex_swizzle(nir_tex_instr *tex, unsigned plane,
assert(deref_src_idx >= 0);
nir_deref_instr *deref = nir_src_as_deref(tex->src[deref_src_idx].src);
- UNUSED nir_variable *var = nir_deref_instr_get_variable(deref);
+ nir_variable *var = nir_deref_instr_get_variable(deref);
- UNUSED unsigned set = var->data.descriptor_set;
- UNUSED unsigned binding = var->data.binding;
- UNUSED const struct anv_descriptor_set_binding_layout *bind_layout =
+ unsigned set = var->data.descriptor_set;
+ unsigned binding = var->data.binding;
+ const struct anv_descriptor_set_binding_layout *bind_layout =
&state->layout->set[set].layout->binding[binding];
- assert(bind_layout->data & ANV_DESCRIPTOR_TEXTURE_SWIZZLE);
+
+ if ((bind_layout->data & ANV_DESCRIPTOR_TEXTURE_SWIZZLE) == 0)
+ return;
nir_builder *b = &state->builder;
b->cursor = nir_before_instr(&tex->instr);