1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-04-01 09:25:24 +02:00

[dxvk] Don't create shader modules for internal clear pipelines

This commit is contained in:
Philip Rebohle 2025-03-23 22:28:24 +01:00
parent 1b77415607
commit 662df399b2
2 changed files with 21 additions and 21 deletions

View File

@ -149,38 +149,30 @@ namespace dxvk {
VkPipeline DxvkMetaClearObjects::createPipeline( VkPipeline DxvkMetaClearObjects::createPipeline(
const SpirvCodeBuffer& spirvCode, size_t size,
const uint32_t* code,
VkPipelineLayout pipeLayout) { VkPipelineLayout pipeLayout) {
VkShaderModuleCreateInfo shaderInfo = { VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO }; VkShaderModuleCreateInfo shaderInfo = { VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO };
shaderInfo.codeSize = spirvCode.size(); shaderInfo.codeSize = size;
shaderInfo.pCode = spirvCode.data(); shaderInfo.pCode = code;
VkShaderModule shaderModule = VK_NULL_HANDLE; VkPipelineShaderStageCreateInfo stageInfo = { VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, &shaderInfo };
if (m_vkd->vkCreateShaderModule(m_vkd->device(),
&shaderInfo, nullptr, &shaderModule) != VK_SUCCESS)
throw DxvkError("Dxvk: Failed to create meta clear shader module");
VkPipelineShaderStageCreateInfo stageInfo = { VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO };
stageInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT; stageInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT;
stageInfo.module = shaderModule;
stageInfo.pName = "main"; stageInfo.pName = "main";
stageInfo.pSpecializationInfo = nullptr;
VkComputePipelineCreateInfo pipeInfo = { VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO }; VkComputePipelineCreateInfo pipeInfo = { VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO };
pipeInfo.stage = stageInfo; pipeInfo.stage = stageInfo;
pipeInfo.layout = pipeLayout; pipeInfo.layout = pipeLayout;
pipeInfo.basePipelineIndex = -1; pipeInfo.basePipelineIndex = -1;
VkPipeline result = VK_NULL_HANDLE; VkPipeline result = VK_NULL_HANDLE;
const VkResult status = m_vkd->vkCreateComputePipelines( const VkResult status = m_vkd->vkCreateComputePipelines(
m_vkd->device(), VK_NULL_HANDLE, 1, &pipeInfo, nullptr, &result); m_vkd->device(), VK_NULL_HANDLE, 1, &pipeInfo, nullptr, &result);
m_vkd->vkDestroyShaderModule(m_vkd->device(), shaderModule, nullptr);
if (status != VK_SUCCESS) if (status != VK_SUCCESS)
throw DxvkError("Dxvk: Failed to create meta clear compute pipeline"); throw DxvkError("Dxvk: Failed to create meta clear compute pipeline");
return result; return result;
} }
} }

View File

@ -103,9 +103,17 @@ namespace dxvk {
VkDescriptorSetLayout dsetLayout); VkDescriptorSetLayout dsetLayout);
VkPipeline createPipeline( VkPipeline createPipeline(
const SpirvCodeBuffer& spirvCode, size_t size,
const uint32_t* code,
VkPipelineLayout pipeLayout); VkPipelineLayout pipeLayout);
template<size_t N>
VkPipeline createPipeline(
const uint32_t (&code)[N],
VkPipelineLayout pipeLayout) {
return createPipeline(sizeof(uint32_t) * N, &code[0], pipeLayout);
}
}; };
} }