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>
This commit is contained in:
Samuel Pitoiset
2024-07-19 12:22:48 +02:00
committed by Marge Bot
parent 4f3f3ccd0d
commit fd5526fd87

View File

@@ -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;