diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2024-07-19 12:22:48 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2024-07-19 14:53:44 +0000 |
commit | fd5526fd87ef99505434cc722023c3ed72aad4df (patch) | |
tree | 6cc3ad073bfba477a29beedd8497be8548e3d3e7 /src/amd | |
parent | 4f3f3ccd0d3ea85ae197a57c3cdfbcb07a1ab23c (diff) |
radv/meta: create the layouts for FMASK expand on-demand
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30262>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/vulkan/meta/radv_meta_fmask_expand.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/src/amd/vulkan/meta/radv_meta_fmask_expand.c b/src/amd/vulkan/meta/radv_meta_fmask_expand.c index 78c29039f4c..930553ff60c 100644 --- a/src/amd/vulkan/meta/radv_meta_fmask_expand.c +++ b/src/amd/vulkan/meta/radv_meta_fmask_expand.c @@ -54,6 +54,35 @@ create_pipeline(struct radv_device *device, int samples, VkPipeline *pipeline) { struct radv_meta_state *state = &device->meta_state; VkResult result; + + if (!state->fmask_expand.ds_layout) { + const VkDescriptorSetLayoutBinding bindings[] = { + { + .binding = 0, + .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, + .descriptorCount = 1, + .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT, + }, + { + .binding = 1, + .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, + .descriptorCount = 1, + .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT, + }, + }; + + result = radv_meta_create_descriptor_set_layout(device, 2, bindings, &state->fmask_expand.ds_layout); + if (result != VK_SUCCESS) + return result; + } + + if (!state->fmask_expand.p_layout) { + result = radv_meta_create_pipeline_layout(device, &state->fmask_expand.ds_layout, 0, NULL, + &state->fmask_expand.p_layout); + if (result != VK_SUCCESS) + return result; + } + nir_shader *cs = build_fmask_expand_compute_shader(device, samples); result = radv_meta_create_compute_pipeline(device, cs, state->fmask_expand.p_layout, pipeline); @@ -183,30 +212,6 @@ radv_device_init_meta_fmask_expand_state(struct radv_device *device, bool on_dem struct radv_meta_state *state = &device->meta_state; VkResult result; - const VkDescriptorSetLayoutBinding bindings[] = { - { - .binding = 0, - .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, - .descriptorCount = 1, - .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT, - }, - { - .binding = 1, - .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, - .descriptorCount = 1, - .stageFlags = VK_SHADER_STAGE_COMPUTE_BIT, - }, - }; - - result = radv_meta_create_descriptor_set_layout(device, 2, bindings, &state->fmask_expand.ds_layout); - if (result != VK_SUCCESS) - return result; - - result = - radv_meta_create_pipeline_layout(device, &state->fmask_expand.ds_layout, 0, NULL, &state->fmask_expand.p_layout); - if (result != VK_SUCCESS) - return result; - if (on_demand) return VK_SUCCESS; |