summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-11-15 15:21:08 -0800
committerJason Ekstrand <[email protected]>2016-11-22 13:44:55 -0800
commit0acb28e0cfcb961a6b0650626adcabeea6f4d371 (patch)
treedc70153da174d37266e2217a16ae12722391739e
parent3f1eda0b42eae5009a96b7f3c088b2d85eea44db (diff)
anv/pipeline: Add a input_attachment_index to the bindings
This allows us to go from the binding to either the descriptor or the input attachment at will. Reviewed-by: Jordan Justen <[email protected]>
-rw-r--r--src/intel/vulkan/anv_nir_apply_pipeline_layout.c27
-rw-r--r--src/intel/vulkan/anv_private.h3
2 files changed, 30 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index 02991bef273..8846c2e6c08 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -346,6 +346,33 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
}
}
+ nir_foreach_variable(var, &shader->uniforms) {
+ if (!glsl_type_is_image(var->interface_type))
+ continue;
+
+ enum glsl_sampler_dim dim = glsl_get_sampler_dim(var->interface_type);
+ if (dim != GLSL_SAMPLER_DIM_SUBPASS &&
+ dim != GLSL_SAMPLER_DIM_SUBPASS_MS)
+ continue;
+
+ const uint32_t set = var->data.descriptor_set;
+ const uint32_t binding = var->data.binding;
+ const uint32_t array_size =
+ layout->set[set].layout->binding[binding].array_size;
+
+ if (!BITSET_TEST(state.set[set].used, binding))
+ continue;
+
+ struct anv_pipeline_binding *pipe_binding =
+ &map->surface_to_descriptor[state.set[set].surface_offsets[binding]];
+ for (unsigned i = 0; i < array_size; i++) {
+ assert(pipe_binding[i].set == set);
+ assert(pipe_binding[i].binding == binding);
+ assert(pipe_binding[i].index == i);
+ pipe_binding[i].input_attachment_index = var->data.index + i;
+ }
+ }
+
nir_foreach_function(function, shader) {
if (!function->impl)
continue;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index c7e44742e2e..ba2e85a535f 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -913,6 +913,9 @@ struct anv_pipeline_binding {
/* Index in the binding */
uint8_t index;
+
+ /* Input attachment index (relative to the subpass) */
+ uint8_t input_attachment_index;
};
struct anv_pipeline_layout {