mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
radv: Add create_build_pipeline_spv helper
Just a copy of the non SPIR-V version that creates the shader module from SPIR-V. Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17028>
This commit is contained in:
parent
dfa5612067
commit
83a59403ae
1 changed files with 57 additions and 0 deletions
|
|
@ -1257,6 +1257,63 @@ create_build_pipeline(struct radv_device *device, nir_shader *shader, unsigned p
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
create_build_pipeline_spv(struct radv_device *device, const uint32_t *spv, uint32_t spv_size,
|
||||
unsigned push_constant_size, VkPipeline *pipeline,
|
||||
VkPipelineLayout *layout)
|
||||
{
|
||||
const VkPipelineLayoutCreateInfo pl_create_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
|
||||
.setLayoutCount = 0,
|
||||
.pushConstantRangeCount = 1,
|
||||
.pPushConstantRanges =
|
||||
&(VkPushConstantRange){VK_SHADER_STAGE_COMPUTE_BIT, 0, push_constant_size},
|
||||
};
|
||||
|
||||
VkShaderModuleCreateInfo module_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.codeSize = spv_size,
|
||||
.pCode = spv,
|
||||
};
|
||||
|
||||
VkShaderModule module;
|
||||
VkResult result = device->vk.dispatch_table.CreateShaderModule(
|
||||
radv_device_to_handle(device), &module_info, &device->meta_state.alloc, &module);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
result = radv_CreatePipelineLayout(radv_device_to_handle(device), &pl_create_info,
|
||||
&device->meta_state.alloc, layout);
|
||||
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 = module,
|
||||
.pName = "main",
|
||||
.pSpecializationInfo = NULL,
|
||||
};
|
||||
|
||||
VkComputePipelineCreateInfo pipeline_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
|
||||
.stage = shader_stage,
|
||||
.flags = 0,
|
||||
.layout = *layout,
|
||||
};
|
||||
|
||||
result = radv_CreateComputePipelines(radv_device_to_handle(device),
|
||||
radv_pipeline_cache_to_handle(&device->meta_state.cache), 1,
|
||||
&pipeline_info, &device->meta_state.alloc, pipeline);
|
||||
|
||||
cleanup:
|
||||
device->vk.dispatch_table.DestroyShaderModule(radv_device_to_handle(device), module,
|
||||
&device->meta_state.alloc);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
radix_sort_fill_buffer(VkCommandBuffer commandBuffer,
|
||||
radix_sort_vk_buffer_info_t const *buffer_info, VkDeviceSize offset,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue