mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +01:00
[dxvk] Normalize dynamic depth-stencil state based on bound attachment
We already do the same for monolothic pipelines. SpellForce 3 tries to write depth with a read-only layout, which is a bad idea.
This commit is contained in:
parent
b00d7f35f5
commit
0f6ba59f16
@ -4532,16 +4532,14 @@ namespace dxvk {
|
||||
// For pipelines created from graphics pipeline libraries, we need
|
||||
// to apply a bunch of dynamic state that is otherwise static
|
||||
if (pipelineInfo.second == DxvkGraphicsPipelineType::BasePipeline) {
|
||||
VkImageAspectFlags dsReadOnlyAspects = m_state.gp.state.rt.getDepthStencilReadOnlyAspects();
|
||||
|
||||
m_cmd->cmdSetDepthState(
|
||||
m_state.gp.state.ds.enableDepthTest(),
|
||||
m_state.gp.state.ds.enableDepthWrite(),
|
||||
m_state.gp.state.ds.enableDepthWrite() &&
|
||||
!(dsReadOnlyAspects & VK_IMAGE_ASPECT_DEPTH_BIT),
|
||||
m_state.gp.state.ds.depthCompareOp());
|
||||
|
||||
m_cmd->cmdSetStencilState(
|
||||
m_state.gp.state.ds.enableStencilTest(),
|
||||
m_state.gp.state.dsFront.state(),
|
||||
m_state.gp.state.dsBack.state());
|
||||
|
||||
if (m_device->features().core.features.depthBounds) {
|
||||
m_cmd->cmdSetDepthBoundsState(
|
||||
m_state.gp.state.ds.enableDepthBoundsTest());
|
||||
@ -4549,12 +4547,21 @@ namespace dxvk {
|
||||
m_flags.set(DxvkContextFlag::GpDynamicDepthBounds);
|
||||
}
|
||||
|
||||
VkStencilOpState dsFront = m_state.gp.state.dsFront.state();
|
||||
VkStencilOpState dsBack = m_state.gp.state.dsBack.state();
|
||||
|
||||
if (dsReadOnlyAspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
dsFront.writeMask = 0;
|
||||
dsBack.writeMask = 0;
|
||||
}
|
||||
|
||||
m_cmd->cmdSetStencilState(
|
||||
m_state.gp.state.ds.enableStencilTest(),
|
||||
dsFront, dsBack);
|
||||
|
||||
m_cmd->cmdSetDepthBiasState(
|
||||
m_state.gp.state.rs.depthBiasEnable());
|
||||
|
||||
if (!m_flags.test(DxvkContextFlag::GpDynamicRasterizerState))
|
||||
m_cmd->cmdSetRasterizerState(VK_CULL_MODE_FRONT_AND_BACK, VK_FRONT_FACE_CLOCKWISE);
|
||||
|
||||
m_flags.set(
|
||||
DxvkContextFlag::GpDynamicDepthBias,
|
||||
DxvkContextFlag::GpDynamicStencilRef,
|
||||
|
Loading…
x
Reference in New Issue
Block a user