[dxvk] Disable depthWriteEnable if depth attachment has read-only layout

Fixes water rendering in SpellForce 3.
This commit is contained in:
Philip Rebohle 2019-05-03 14:38:21 +02:00
parent 6eeb3b6da9
commit 53aa27336b
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 8 additions and 5 deletions

View File

@ -121,7 +121,7 @@ namespace dxvk {
// If no pipeline instance exists with the given state
// vector, create a new one and add it to the list.
newPipelineHandle = this->compilePipeline(state, renderPassHandle, m_basePipeline);
newPipelineHandle = this->compilePipeline(state, renderPass, m_basePipeline);
// Add new pipeline to the set
m_pipelines.emplace_back(state, renderPassHandle, newPipelineHandle);
@ -152,12 +152,15 @@ namespace dxvk {
VkPipeline DxvkGraphicsPipeline::compilePipeline(
const DxvkGraphicsPipelineStateInfo& state,
VkRenderPass renderPass,
const DxvkRenderPass& renderPass,
VkPipeline baseHandle) const {
if (Logger::logLevel() <= LogLevel::Debug) {
Logger::debug("Compiling graphics pipeline...");
this->logPipelineState(LogLevel::Debug, state);
}
// Render pass format and image layouts
DxvkRenderPassFormat passFormat = renderPass.format();
// Set up dynamic states as needed
std::array<VkDynamicState, 5> dynamicStates;
@ -349,7 +352,7 @@ namespace dxvk {
dsInfo.pNext = nullptr;
dsInfo.flags = 0;
dsInfo.depthTestEnable = state.dsEnableDepthTest;
dsInfo.depthWriteEnable = state.dsEnableDepthWrite;
dsInfo.depthWriteEnable = state.dsEnableDepthWrite && !util::isDepthReadOnlyLayout(passFormat.depth.layout);
dsInfo.depthCompareOp = state.dsDepthCompareOp;
dsInfo.depthBoundsTestEnable = VK_FALSE;
dsInfo.stencilTestEnable = state.dsEnableStencilTest;
@ -393,7 +396,7 @@ namespace dxvk {
info.pColorBlendState = &cbInfo;
info.pDynamicState = &dyInfo;
info.layout = m_layout->pipelineLayout();
info.renderPass = renderPass;
info.renderPass = renderPass.getDefaultHandle();
info.subpass = 0;
info.basePipelineHandle = baseHandle;
info.basePipelineIndex = -1;

View File

@ -274,7 +274,7 @@ namespace dxvk {
VkPipeline compilePipeline(
const DxvkGraphicsPipelineStateInfo& state,
VkRenderPass renderPass,
const DxvkRenderPass& renderPass,
VkPipeline baseHandle) const;
void destroyPipeline(