mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 16:29:16 +01:00
[dxvk] Using derivative graphics pipelines
This commit is contained in:
parent
3ab75c8538
commit
8bccbbccc8
@ -35,7 +35,7 @@ namespace dxvk {
|
|||||||
info.stage = m_cs->stageInfo(nullptr);
|
info.stage = m_cs->stageInfo(nullptr);
|
||||||
info.layout = m_layout->pipelineLayout();
|
info.layout = m_layout->pipelineLayout();
|
||||||
info.basePipelineHandle = VK_NULL_HANDLE;
|
info.basePipelineHandle = VK_NULL_HANDLE;
|
||||||
info.basePipelineIndex = 0;
|
info.basePipelineIndex = -1;
|
||||||
|
|
||||||
if (m_vkd->vkCreateComputePipelines(m_vkd->device(),
|
if (m_vkd->vkCreateComputePipelines(m_vkd->device(),
|
||||||
VK_NULL_HANDLE, 1, &info, nullptr, &m_pipeline) != VK_SUCCESS)
|
VK_NULL_HANDLE, 1, &info, nullptr, &m_pipeline) != VK_SUCCESS)
|
||||||
|
@ -73,14 +73,18 @@ namespace dxvk {
|
|||||||
return pair.pipeline;
|
return pair.pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipeline pipeline = this->compilePipeline(state);
|
VkPipeline pipeline = this->compilePipeline(state, m_basePipeline);
|
||||||
m_pipelines.push_back({ state, pipeline });
|
m_pipelines.push_back({ state, pipeline });
|
||||||
|
|
||||||
|
if (m_basePipeline == VK_NULL_HANDLE)
|
||||||
|
m_basePipeline = pipeline;
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VkPipeline DxvkGraphicsPipeline::compilePipeline(
|
VkPipeline DxvkGraphicsPipeline::compilePipeline(
|
||||||
const DxvkGraphicsPipelineStateInfo& state) const {
|
const DxvkGraphicsPipelineStateInfo& state,
|
||||||
|
VkPipeline baseHandle) const {
|
||||||
std::array<VkDynamicState, 4> dynamicStates = {
|
std::array<VkDynamicState, 4> dynamicStates = {
|
||||||
VK_DYNAMIC_STATE_VIEWPORT,
|
VK_DYNAMIC_STATE_VIEWPORT,
|
||||||
VK_DYNAMIC_STATE_SCISSOR,
|
VK_DYNAMIC_STATE_SCISSOR,
|
||||||
@ -197,7 +201,9 @@ namespace dxvk {
|
|||||||
VkGraphicsPipelineCreateInfo info;
|
VkGraphicsPipelineCreateInfo info;
|
||||||
info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||||
info.pNext = nullptr;
|
info.pNext = nullptr;
|
||||||
info.flags = 0;
|
info.flags = baseHandle == VK_NULL_HANDLE
|
||||||
|
? VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT
|
||||||
|
: VK_PIPELINE_CREATE_DERIVATIVE_BIT;
|
||||||
info.stageCount = stages.size();
|
info.stageCount = stages.size();
|
||||||
info.pStages = stages.data();
|
info.pStages = stages.data();
|
||||||
info.pVertexInputState = &viInfo;
|
info.pVertexInputState = &viInfo;
|
||||||
@ -212,8 +218,8 @@ namespace dxvk {
|
|||||||
info.layout = m_layout->pipelineLayout();
|
info.layout = m_layout->pipelineLayout();
|
||||||
info.renderPass = state.omRenderPass;
|
info.renderPass = state.omRenderPass;
|
||||||
info.subpass = 0;
|
info.subpass = 0;
|
||||||
info.basePipelineHandle = VK_NULL_HANDLE; // TODO use this
|
info.basePipelineHandle = baseHandle;
|
||||||
info.basePipelineIndex = 0;
|
info.basePipelineIndex = -1;
|
||||||
|
|
||||||
VkPipeline pipeline = VK_NULL_HANDLE;
|
VkPipeline pipeline = VK_NULL_HANDLE;
|
||||||
if (m_vkd->vkCreateGraphicsPipelines(m_vkd->device(),
|
if (m_vkd->vkCreateGraphicsPipelines(m_vkd->device(),
|
||||||
|
@ -134,9 +134,11 @@ namespace dxvk {
|
|||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
std::vector<PipelineStruct> m_pipelines;
|
std::vector<PipelineStruct> m_pipelines;
|
||||||
|
|
||||||
VkPipeline compilePipeline(
|
VkPipeline m_basePipeline = VK_NULL_HANDLE;
|
||||||
const DxvkGraphicsPipelineStateInfo& state) const;
|
|
||||||
|
|
||||||
|
VkPipeline compilePipeline(
|
||||||
|
const DxvkGraphicsPipelineStateInfo& state,
|
||||||
|
VkPipeline baseHandle) const;
|
||||||
void destroyPipelines();
|
void destroyPipelines();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user