From 50f1cf007d4b91ebd70cb9d7e7825b1a44d5c67d Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 20 Apr 2018 23:32:51 +0200 Subject: [PATCH] [dxbc] Implement precise flag May fix depth precision in Skyrim SE (issue #189). --- src/dxbc/dxbc_compiler.cpp | 6 ++++++ src/dxbc/dxbc_decoder.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 08eaeb98..0c6c0aea 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -1564,6 +1564,9 @@ namespace dxvk { return; } + if (ins.controls.precise()) + m_module.decorate(dst.id, spv::DecorationNoContraction); + // Store computed value dst = emitDstOperandModifiers(dst, ins.modifiers); emitRegisterStore(ins.dst[0], dst); @@ -1786,6 +1789,9 @@ namespace dxvk { src.at(0).id, src.at(1).id); + if (ins.controls.precise()) + m_module.decorate(dst.id, spv::DecorationNoContraction); + dst = emitDstOperandModifiers(dst, ins.modifiers); emitRegisterStore(ins.dst[0], dst); } diff --git a/src/dxbc/dxbc_decoder.h b/src/dxbc/dxbc_decoder.h index 9ddf3586..51dfaa91 100644 --- a/src/dxbc/dxbc_decoder.h +++ b/src/dxbc/dxbc_decoder.h @@ -309,6 +309,10 @@ namespace dxvk { return bit::extract(m_bits, 11, 16); } + bool precise() const { + return bit::extract(m_bits, 19, 22) != 0; + } + private: uint32_t m_bits;