diff options
author | Iago Toral Quiroga <[email protected]> | 2018-01-25 10:25:00 +0100 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2018-01-26 14:06:46 +0100 |
commit | e1a49f974bc086c54b567471908f78c53b467072 (patch) | |
tree | da3b9784d3c4a6370bbb47c97468846f7a5851a0 /src/intel/vulkan/anv_nir_lower_ycbcr_textures.c | |
parent | 14f6275c92f1aa2c76308132f58096b66fe3901a (diff) |
anv/pipeline: don't take the layout from the pipeline to compile shaders
The Vulkan spec states that VkPipelineLayout objects must not be
destroyed while any command buffer that uses them is in the recording
state, but it permits them to be destroyed otherwise. This means that
applications are allowed to free pipeline layouts after command recording
is finished even if there are pipeline objects that still exist and were
created with these layouts.
There are two solutions to this, one is to use reference counting on
pipeline layout objects. The other is to avoid holding references to
pipeline layouts where they are not really needed.
This patch takes a step towards the second option by making the
pipeline shader compile code take pipeline layout from the
VkGraphicsPipelineCreateInfo provided rather than the pipeline
object.
A follow-up patch will remove any remaining uses of the layout field
so we can remove it from the pipeline object and avoid the need
for reference counting.
v2: Use ANV_FROM_HANDLE, remove unnecessary braces (Jason)
Suggested-by: Jason Ekstrand <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_nir_lower_ycbcr_textures.c')
-rw-r--r-- | src/intel/vulkan/anv_nir_lower_ycbcr_textures.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c b/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c index 028f24e2f60..ad793ee0a0c 100644 --- a/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c +++ b/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c @@ -316,13 +316,13 @@ swizzle_channel(struct isl_swizzle swizzle, unsigned channel) } static bool -try_lower_tex_ycbcr(struct anv_pipeline *pipeline, +try_lower_tex_ycbcr(struct anv_pipeline_layout *layout, nir_builder *builder, nir_tex_instr *tex) { nir_variable *var = tex->texture->var; const struct anv_descriptor_set_layout *set_layout = - pipeline->layout->set[var->data.descriptor_set].layout; + layout->set[var->data.descriptor_set].layout; const struct anv_descriptor_set_binding_layout *binding = &set_layout->binding[var->data.binding]; @@ -440,7 +440,8 @@ try_lower_tex_ycbcr(struct anv_pipeline *pipeline, } bool -anv_nir_lower_ycbcr_textures(nir_shader *shader, struct anv_pipeline *pipeline) +anv_nir_lower_ycbcr_textures(nir_shader *shader, + struct anv_pipeline_layout *layout) { bool progress = false; @@ -458,7 +459,7 @@ anv_nir_lower_ycbcr_textures(nir_shader *shader, struct anv_pipeline *pipeline) continue; nir_tex_instr *tex = nir_instr_as_tex(instr); - function_progress |= try_lower_tex_ycbcr(pipeline, &builder, tex); + function_progress |= try_lower_tex_ycbcr(layout, &builder, tex); } } |