anv/pipeline: don't take the layout from the pipeline to compile shaders
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 25 Jan 2018 09:25:00 +0000 (10:25 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Fri, 26 Jan 2018 13:06:46 +0000 (14:06 +0100)
commite1a49f974bc086c54b567471908f78c53b467072
treeda3b9784d3c4a6370bbb47c97468846f7a5851a0
parent14f6275c92f1aa2c76308132f58096b66fe3901a
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 <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_nir.h
src/intel/vulkan/anv_nir_apply_pipeline_layout.c
src/intel/vulkan/anv_nir_lower_ycbcr_textures.c
src/intel/vulkan/anv_pipeline.c