diff --git a/src/amd/vulkan/meta/radv_meta.c b/src/amd/vulkan/meta/radv_meta.c index e5b70b60cc6..8c4e4fb1ff8 100644 --- a/src/amd/vulkan/meta/radv_meta.c +++ b/src/amd/vulkan/meta/radv_meta.c @@ -720,3 +720,26 @@ radv_break_on_count(nir_builder *b, nir_variable *var, nir_def *count) counter = nir_iadd_imm(b, counter, 1); nir_store_var(b, var, counter, 0x1); } + +VkResult +radv_meta_create_compute_pipeline(struct radv_device *device, nir_shader *nir, VkPipelineLayout pipeline_layout, + VkPipeline *pipeline) +{ + const VkPipelineShaderStageCreateInfo stage_info = { + .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, + .stage = VK_SHADER_STAGE_COMPUTE_BIT, + .module = vk_shader_module_handle_from_nir(nir), + .pName = "main", + .pSpecializationInfo = NULL, + }; + + const VkComputePipelineCreateInfo pipeline_info = { + .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, + .stage = stage_info, + .flags = 0, + .layout = pipeline_layout, + }; + + return radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &pipeline_info, NULL, + pipeline); +} diff --git a/src/amd/vulkan/meta/radv_meta.h b/src/amd/vulkan/meta/radv_meta.h index 96c2c49dd18..c411fc0e4be 100644 --- a/src/amd/vulkan/meta/radv_meta.h +++ b/src/amd/vulkan/meta/radv_meta.h @@ -308,6 +308,9 @@ void radv_cmd_buffer_resolve_rendering_fs(struct radv_cmd_buffer *cmd_buffer, st void radv_depth_stencil_resolve_rendering_fs(struct radv_cmd_buffer *cmd_buffer, VkImageAspectFlags aspects, VkResolveModeFlagBits resolve_mode); +VkResult radv_meta_create_compute_pipeline(struct radv_device *device, nir_shader *nir, + VkPipelineLayout pipeline_layout, VkPipeline *pipeline); + #ifdef __cplusplus } #endif diff --git a/src/amd/vulkan/meta/radv_meta_buffer.c b/src/amd/vulkan/meta/radv_meta_buffer.c index 65c0b4502ec..31fb1983b73 100644 --- a/src/amd/vulkan/meta/radv_meta_buffer.c +++ b/src/amd/vulkan/meta/radv_meta_buffer.c @@ -96,43 +96,13 @@ radv_device_init_meta_buffer_state(struct radv_device *device) if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo fill_pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(fill_cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo fill_vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = fill_pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.buffer.fill_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, - &fill_vk_pipeline_info, NULL, &device->meta_state.buffer.fill_pipeline); + result = radv_meta_create_compute_pipeline(device, fill_cs, device->meta_state.buffer.fill_p_layout, + &device->meta_state.buffer.fill_pipeline); if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo copy_pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(copy_cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo copy_vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = copy_pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.buffer.copy_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, - ©_vk_pipeline_info, NULL, &device->meta_state.buffer.copy_pipeline); + result = radv_meta_create_compute_pipeline(device, copy_cs, device->meta_state.buffer.copy_p_layout, + &device->meta_state.buffer.copy_pipeline); if (result != VK_SUCCESS) goto fail; diff --git a/src/amd/vulkan/meta/radv_meta_bufimage.c b/src/amd/vulkan/meta/radv_meta_bufimage.c index 67ee3ae5a59..7b1b4dbfc67 100644 --- a/src/amd/vulkan/meta/radv_meta_bufimage.c +++ b/src/amd/vulkan/meta/radv_meta_bufimage.c @@ -97,43 +97,13 @@ radv_device_init_meta_itob_state(struct radv_device *device) if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.itob.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, &device->meta_state.itob.pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.itob.img_p_layout, + &device->meta_state.itob.pipeline); if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pipeline_shader_stage_3d = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs_3d), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info_3d = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage_3d, - .flags = 0, - .layout = device->meta_state.itob.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info_3d, - NULL, &device->meta_state.itob.pipeline_3d); + result = radv_meta_create_compute_pipeline(device, cs_3d, device->meta_state.itob.img_p_layout, + &device->meta_state.itob.pipeline_3d); if (result != VK_SUCCESS) goto fail; @@ -241,43 +211,13 @@ radv_device_init_meta_btoi_state(struct radv_device *device) if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.btoi.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, &device->meta_state.btoi.pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.btoi.img_p_layout, + &device->meta_state.btoi.pipeline); if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pipeline_shader_stage_3d = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs_3d), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info_3d = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage_3d, - .flags = 0, - .layout = device->meta_state.btoi.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info_3d, - NULL, &device->meta_state.btoi.pipeline_3d); + result = radv_meta_create_compute_pipeline(device, cs_3d, device->meta_state.btoi.img_p_layout, + &device->meta_state.btoi.pipeline_3d); ralloc_free(cs_3d); ralloc_free(cs); @@ -389,23 +329,8 @@ radv_device_init_meta_btoi_r32g32b32_state(struct radv_device *device) if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.btoi_r32g32b32.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, &device->meta_state.btoi_r32g32b32.pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.btoi_r32g32b32.img_p_layout, + &device->meta_state.btoi_r32g32b32.pipeline); fail: ralloc_free(cs); @@ -484,23 +409,7 @@ create_itoi_pipeline(struct radv_device *device, int samples, VkPipeline *pipeli nir_shader *cs = build_nir_itoi_compute_shader(device, false, false, samples); VkResult result; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = state->itoi.img_p_layout, - }; - - result = - radv_compute_pipeline_create(radv_device_to_handle(device), state->cache, &vk_pipeline_info, NULL, pipeline); + result = radv_meta_create_compute_pipeline(device, cs, state->itoi.img_p_layout, pipeline); ralloc_free(cs); return result; } @@ -566,23 +475,7 @@ radv_device_init_meta_itoi_state(struct radv_device *device) nir_shader *cs_3d = build_nir_itoi_compute_shader(device, src_3d, dst_3d, 1); - VkPipelineShaderStageCreateInfo pipeline_shader_stage_3d = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs_3d), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info_3d = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage_3d, - .flags = 0, - .layout = device->meta_state.itoi.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, - &vk_pipeline_info_3d, NULL, pipeline); + result = radv_meta_create_compute_pipeline(device, cs_3d, device->meta_state.itoi.img_p_layout, pipeline); ralloc_free(cs_3d); @@ -705,23 +598,8 @@ radv_device_init_meta_itoi_r32g32b32_state(struct radv_device *device) if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.itoi_r32g32b32.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, &device->meta_state.itoi_r32g32b32.pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.itoi_r32g32b32.img_p_layout, + &device->meta_state.itoi_r32g32b32.pipeline); fail: ralloc_free(cs); @@ -782,23 +660,7 @@ create_cleari_pipeline(struct radv_device *device, int samples, VkPipeline *pipe nir_shader *cs = build_nir_cleari_compute_shader(device, false, samples); VkResult result; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.cleari.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.cleari.img_p_layout, pipeline); ralloc_free(cs); return result; } @@ -846,23 +708,8 @@ radv_device_init_meta_cleari_state(struct radv_device *device) nir_shader *cs_3d = build_nir_cleari_compute_shader(device, true, 1); - VkPipelineShaderStageCreateInfo pipeline_shader_stage_3d = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs_3d), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info_3d = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage_3d, - .flags = 0, - .layout = device->meta_state.cleari.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info_3d, - NULL, &device->meta_state.cleari.pipeline_3d); + result = radv_meta_create_compute_pipeline(device, cs_3d, device->meta_state.cleari.img_p_layout, + &device->meta_state.cleari.pipeline_3d); ralloc_free(cs_3d); return VK_SUCCESS; @@ -956,23 +803,8 @@ radv_device_init_meta_cleari_r32g32b32_state(struct radv_device *device) if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.cleari_r32g32b32.img_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, &device->meta_state.cleari_r32g32b32.pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.cleari_r32g32b32.img_p_layout, + &device->meta_state.cleari_r32g32b32.pipeline); fail: ralloc_free(cs); diff --git a/src/amd/vulkan/meta/radv_meta_clear.c b/src/amd/vulkan/meta/radv_meta_clear.c index 8dc50599889..e729db01b81 100644 --- a/src/amd/vulkan/meta/radv_meta_clear.c +++ b/src/amd/vulkan/meta/radv_meta_clear.c @@ -862,23 +862,8 @@ init_meta_clear_htile_mask_state(struct radv_device *device) if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = shader_stage, - .flags = 0, - .layout = state->clear_htile_mask_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), state->cache, &pipeline_info, NULL, - &state->clear_htile_mask_pipeline); + result = radv_meta_create_compute_pipeline(device, cs, state->clear_htile_mask_p_layout, + &state->clear_htile_mask_pipeline); fail: ralloc_free(cs); @@ -935,22 +920,7 @@ create_dcc_comp_to_single_pipeline(struct radv_device *device, bool is_msaa, VkP VkResult result; nir_shader *cs = build_clear_dcc_comp_to_single_shader(device, is_msaa); - VkPipelineShaderStageCreateInfo shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = shader_stage, - .flags = 0, - .layout = state->clear_dcc_comp_to_single_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), state->cache, &pipeline_info, NULL, pipeline); + result = radv_meta_create_compute_pipeline(device, cs, state->clear_dcc_comp_to_single_p_layout, pipeline); ralloc_free(cs); return result; diff --git a/src/amd/vulkan/meta/radv_meta_copy_vrs_htile.c b/src/amd/vulkan/meta/radv_meta_copy_vrs_htile.c index 08058dad4bb..7dadec5279d 100644 --- a/src/amd/vulkan/meta/radv_meta_copy_vrs_htile.c +++ b/src/amd/vulkan/meta/radv_meta_copy_vrs_htile.c @@ -149,23 +149,8 @@ radv_device_init_meta_copy_vrs_htile_state(struct radv_device *device, struct ra if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = shader_stage, - .flags = 0, - .layout = state->copy_vrs_htile_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), state->cache, &pipeline_info, NULL, - &state->copy_vrs_htile_pipeline); + result = + radv_meta_create_compute_pipeline(device, cs, state->copy_vrs_htile_p_layout, &state->copy_vrs_htile_pipeline); fail: ralloc_free(cs); return result; diff --git a/src/amd/vulkan/meta/radv_meta_dcc_retile.c b/src/amd/vulkan/meta/radv_meta_dcc_retile.c index 792b695258d..5b8d5955c47 100644 --- a/src/amd/vulkan/meta/radv_meta_dcc_retile.c +++ b/src/amd/vulkan/meta/radv_meta_dcc_retile.c @@ -123,23 +123,8 @@ radv_device_init_meta_dcc_retile_state(struct radv_device *device, struct radeon if (result != VK_SUCCESS) goto cleanup; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.dcc_retile.p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, &device->meta_state.dcc_retile.pipeline[surf->u.gfx9.swizzle_mode]); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.dcc_retile.p_layout, + &device->meta_state.dcc_retile.pipeline[surf->u.gfx9.swizzle_mode]); if (result != VK_SUCCESS) goto cleanup; diff --git a/src/amd/vulkan/meta/radv_meta_decompress.c b/src/amd/vulkan/meta/radv_meta_decompress.c index d3bf147c6b5..b69a72da7e5 100644 --- a/src/amd/vulkan/meta/radv_meta_decompress.c +++ b/src/amd/vulkan/meta/radv_meta_decompress.c @@ -95,23 +95,8 @@ create_expand_depth_stencil_compute(struct radv_device *device) if (result != VK_SUCCESS) goto cleanup; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.expand_depth_stencil_compute_p_layout, - }; - - result = radv_CreateComputePipelines(radv_device_to_handle(device), device->meta_state.cache, 1, &vk_pipeline_info, - NULL, &device->meta_state.expand_depth_stencil_compute_pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.expand_depth_stencil_compute_p_layout, + &device->meta_state.expand_depth_stencil_compute_pipeline); if (result != VK_SUCCESS) goto cleanup; diff --git a/src/amd/vulkan/meta/radv_meta_fast_clear.c b/src/amd/vulkan/meta/radv_meta_fast_clear.c index 030c30f3d7c..780f46b344f 100644 --- a/src/amd/vulkan/meta/radv_meta_fast_clear.c +++ b/src/amd/vulkan/meta/radv_meta_fast_clear.c @@ -93,23 +93,9 @@ create_dcc_compress_compute(struct radv_device *device) if (result != VK_SUCCESS) goto cleanup; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.fast_clear_flush.dcc_decompress_compute_p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, &device->meta_state.fast_clear_flush.dcc_decompress_compute_pipeline); + result = + radv_meta_create_compute_pipeline(device, cs, device->meta_state.fast_clear_flush.dcc_decompress_compute_p_layout, + &device->meta_state.fast_clear_flush.dcc_decompress_compute_pipeline); if (result != VK_SUCCESS) goto cleanup; diff --git a/src/amd/vulkan/meta/radv_meta_fmask_copy.c b/src/amd/vulkan/meta/radv_meta_fmask_copy.c index 966e9fa66fd..786cc6527b9 100644 --- a/src/amd/vulkan/meta/radv_meta_fmask_copy.c +++ b/src/amd/vulkan/meta/radv_meta_fmask_copy.c @@ -103,23 +103,7 @@ create_fmask_copy_pipeline(struct radv_device *device, int samples, VkPipeline * nir_shader *cs = build_fmask_copy_compute_shader(device, samples); VkResult result; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = state->fmask_copy.p_layout, - }; - - result = - radv_compute_pipeline_create(radv_device_to_handle(device), state->cache, &vk_pipeline_info, NULL, pipeline); + result = radv_meta_create_compute_pipeline(device, cs, state->fmask_copy.p_layout, pipeline); ralloc_free(cs); return result; } diff --git a/src/amd/vulkan/meta/radv_meta_fmask_expand.c b/src/amd/vulkan/meta/radv_meta_fmask_expand.c index 9e815277af1..664f33e16a6 100644 --- a/src/amd/vulkan/meta/radv_meta_fmask_expand.c +++ b/src/amd/vulkan/meta/radv_meta_fmask_expand.c @@ -152,25 +152,8 @@ create_fmask_expand_pipeline(struct radv_device *device, int samples, VkPipeline struct radv_meta_state *state = &device->meta_state; VkResult result; nir_shader *cs = build_fmask_expand_compute_shader(device, samples); - ; - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = state->fmask_expand.p_layout, - }; - - result = - radv_compute_pipeline_create(radv_device_to_handle(device), state->cache, &vk_pipeline_info, NULL, pipeline); + result = radv_meta_create_compute_pipeline(device, cs, state->fmask_expand.p_layout, pipeline); ralloc_free(cs); return result; diff --git a/src/amd/vulkan/meta/radv_meta_resolve_cs.c b/src/amd/vulkan/meta/radv_meta_resolve_cs.c index ab10ede6e4f..6730515b3da 100644 --- a/src/amd/vulkan/meta/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/meta/radv_meta_resolve_cs.c @@ -221,23 +221,7 @@ create_resolve_pipeline(struct radv_device *device, int samples, bool is_integer nir_shader *cs = build_resolve_compute_shader(device, is_integer, is_srgb, samples); - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.resolve_compute.p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.resolve_compute.p_layout, pipeline); if (result != VK_SUCCESS) goto fail; @@ -264,23 +248,7 @@ create_depth_stencil_resolve_pipeline(struct radv_device *device, int samples, i nir_shader *cs = build_depth_stencil_resolve_compute_shader(device, samples, index, resolve_mode); - VkPipelineShaderStageCreateInfo pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.resolve_compute.p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &vk_pipeline_info, - NULL, pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.resolve_compute.p_layout, pipeline); if (result != VK_SUCCESS) goto fail; diff --git a/src/amd/vulkan/radv_device_generated_commands.c b/src/amd/vulkan/radv_device_generated_commands.c index 8f1a986e35a..d872593cba6 100644 --- a/src/amd/vulkan/radv_device_generated_commands.c +++ b/src/amd/vulkan/radv_device_generated_commands.c @@ -2110,23 +2110,8 @@ radv_device_init_dgc_prepare_state(struct radv_device *device) if (result != VK_SUCCESS) goto cleanup; - VkPipelineShaderStageCreateInfo shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = shader_stage, - .flags = 0, - .layout = device->meta_state.dgc_prepare.p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &pipeline_info, - &device->meta_state.alloc, &device->meta_state.dgc_prepare.pipeline); + result = radv_meta_create_compute_pipeline(device, cs, device->meta_state.dgc_prepare.p_layout, + &device->meta_state.dgc_prepare.pipeline); if (result != VK_SUCCESS) goto cleanup; diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c index 7ab546a4617..3cd48be1f21 100644 --- a/src/amd/vulkan/radv_query.c +++ b/src/amd/vulkan/radv_query.c @@ -927,126 +927,32 @@ radv_device_init_meta_query_state_internal(struct radv_device *device) if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo occlusion_pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(occlusion_cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo occlusion_vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = occlusion_pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.query.p_layout, - }; - - result = - radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &occlusion_vk_pipeline_info, - NULL, &device->meta_state.query.occlusion_query_pipeline); + result = radv_meta_create_compute_pipeline(device, occlusion_cs, device->meta_state.query.p_layout, + &device->meta_state.query.occlusion_query_pipeline); if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pipeline_statistics_pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(pipeline_statistics_cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo pipeline_statistics_vk_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pipeline_statistics_pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.query.p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, - &pipeline_statistics_vk_pipeline_info, NULL, - &device->meta_state.query.pipeline_statistics_query_pipeline); + result = radv_meta_create_compute_pipeline(device, pipeline_statistics_cs, device->meta_state.query.p_layout, + &device->meta_state.query.pipeline_statistics_query_pipeline); if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo tfb_pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(tfb_cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo tfb_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = tfb_pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.query.p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &tfb_pipeline_info, - NULL, &device->meta_state.query.tfb_query_pipeline); + result = radv_meta_create_compute_pipeline(device, tfb_cs, device->meta_state.query.p_layout, + &device->meta_state.query.tfb_query_pipeline); if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo timestamp_pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(timestamp_cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo timestamp_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = timestamp_pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.query.p_layout, - }; - - result = - radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, ×tamp_pipeline_info, - NULL, &device->meta_state.query.timestamp_query_pipeline); + result = radv_meta_create_compute_pipeline(device, timestamp_cs, device->meta_state.query.p_layout, + &device->meta_state.query.timestamp_query_pipeline); if (result != VK_SUCCESS) goto fail; - VkPipelineShaderStageCreateInfo pg_pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(pg_cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo pg_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = pg_pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.query.p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, &pg_pipeline_info, - NULL, &device->meta_state.query.pg_query_pipeline); + result = radv_meta_create_compute_pipeline(device, pg_cs, device->meta_state.query.p_layout, + &device->meta_state.query.pg_query_pipeline); if (pdev->emulate_mesh_shader_queries) { - VkPipelineShaderStageCreateInfo ms_prim_gen_pipeline_shader_stage = { - .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - .stage = VK_SHADER_STAGE_COMPUTE_BIT, - .module = vk_shader_module_handle_from_nir(ms_prim_gen_cs), - .pName = "main", - .pSpecializationInfo = NULL, - }; - - VkComputePipelineCreateInfo ms_prim_gen_pipeline_info = { - .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = ms_prim_gen_pipeline_shader_stage, - .flags = 0, - .layout = device->meta_state.query.p_layout, - }; - - result = radv_compute_pipeline_create(radv_device_to_handle(device), device->meta_state.cache, - &ms_prim_gen_pipeline_info, NULL, - &device->meta_state.query.ms_prim_gen_query_pipeline); + result = radv_meta_create_compute_pipeline(device, ms_prim_gen_cs, device->meta_state.query.p_layout, + &device->meta_state.query.ms_prim_gen_query_pipeline); } fail: