1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[dxvk] Don't cache shader modules for compute pipelines

This commit is contained in:
Philip Rebohle 2019-04-03 19:46:28 +02:00
parent 632b254714
commit 79e867624a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 20 additions and 18 deletions

View File

@ -23,23 +23,17 @@ namespace dxvk {
DxvkPipelineManager* pipeMgr,
const Rc<DxvkShader>& cs)
: m_vkd(pipeMgr->m_device->vkd()),
m_pipeMgr(pipeMgr) {
DxvkDescriptorSlotMapping slotMapping;
cs->defineResourceSlots(slotMapping);
m_pipeMgr(pipeMgr), m_cs(cs) {
cs->defineResourceSlots(m_slotMapping);
slotMapping.makeDescriptorsDynamic(
m_slotMapping.makeDescriptorsDynamic(
m_pipeMgr->m_device->options().maxNumDynamicUniformBuffers,
m_pipeMgr->m_device->options().maxNumDynamicStorageBuffers);
m_layout = new DxvkPipelineLayout(m_vkd,
slotMapping.bindingCount(),
slotMapping.bindingInfos(),
m_slotMapping.bindingCount(),
m_slotMapping.bindingInfos(),
VK_PIPELINE_BIND_POINT_COMPUTE);
DxvkShaderModuleCreateInfo moduleInfo;
moduleInfo.fsDualSrcBlend = false;
m_cs = cs->createShaderModule(m_vkd, slotMapping, moduleInfo);
}
@ -98,9 +92,15 @@ namespace dxvk {
if (Logger::logLevel() <= LogLevel::Debug) {
Logger::debug("Compiling compute pipeline...");
Logger::debug(str::format(" cs : ", m_cs->shader()->debugName()));
Logger::debug(str::format(" cs : ", m_cs->debugName()));
}
DxvkShaderModuleCreateInfo moduleInfo;
moduleInfo.fsDualSrcBlend = false;
auto csm = m_cs->createShaderModule(m_vkd, m_slotMapping, moduleInfo);
DxvkSpecConstantData specData;
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
@ -118,7 +118,7 @@ namespace dxvk {
info.flags = baseHandle == VK_NULL_HANDLE
? VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT
: VK_PIPELINE_CREATE_DERIVATIVE_BIT;
info.stage = m_cs->stageInfo(&specInfo);
info.stage = csm->stageInfo(&specInfo);
info.layout = m_layout->pipelineLayout();
info.basePipelineHandle = baseHandle;
info.basePipelineIndex = -1;
@ -130,7 +130,7 @@ namespace dxvk {
if (m_vkd->vkCreateComputePipelines(m_vkd->device(),
m_pipeMgr->m_cache->handle(), 1, &info, nullptr, &pipeline) != VK_SUCCESS) {
Logger::err("DxvkComputePipeline: Failed to compile pipeline");
Logger::err(str::format(" cs : ", m_cs->shader()->debugName()));
Logger::err(str::format(" cs : ", m_cs->debugName()));
return VK_NULL_HANDLE;
}

View File

@ -71,11 +71,13 @@ namespace dxvk {
VkPipeline pipeline;
};
Rc<vk::DeviceFn> m_vkd;
DxvkPipelineManager* m_pipeMgr;
Rc<vk::DeviceFn> m_vkd;
DxvkPipelineManager* m_pipeMgr;
DxvkDescriptorSlotMapping m_slotMapping;
Rc<DxvkPipelineLayout> m_layout;
Rc<DxvkShaderModule> m_cs;
Rc<DxvkShader> m_cs;
Rc<DxvkPipelineLayout> m_layout;
sync::Spinlock m_mutex;
std::vector<PipelineStruct> m_pipelines;