mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +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
|
// For pipelines created from graphics pipeline libraries, we need
|
||||||
// to apply a bunch of dynamic state that is otherwise static
|
// to apply a bunch of dynamic state that is otherwise static
|
||||||
if (pipelineInfo.second == DxvkGraphicsPipelineType::BasePipeline) {
|
if (pipelineInfo.second == DxvkGraphicsPipelineType::BasePipeline) {
|
||||||
|
VkImageAspectFlags dsReadOnlyAspects = m_state.gp.state.rt.getDepthStencilReadOnlyAspects();
|
||||||
|
|
||||||
m_cmd->cmdSetDepthState(
|
m_cmd->cmdSetDepthState(
|
||||||
m_state.gp.state.ds.enableDepthTest(),
|
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_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) {
|
if (m_device->features().core.features.depthBounds) {
|
||||||
m_cmd->cmdSetDepthBoundsState(
|
m_cmd->cmdSetDepthBoundsState(
|
||||||
m_state.gp.state.ds.enableDepthBoundsTest());
|
m_state.gp.state.ds.enableDepthBoundsTest());
|
||||||
@ -4549,12 +4547,21 @@ namespace dxvk {
|
|||||||
m_flags.set(DxvkContextFlag::GpDynamicDepthBounds);
|
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_cmd->cmdSetDepthBiasState(
|
||||||
m_state.gp.state.rs.depthBiasEnable());
|
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(
|
m_flags.set(
|
||||||
DxvkContextFlag::GpDynamicDepthBias,
|
DxvkContextFlag::GpDynamicDepthBias,
|
||||||
DxvkContextFlag::GpDynamicStencilRef,
|
DxvkContextFlag::GpDynamicStencilRef,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user