From bd8dc20fa2d56be95e1f885ead6ed94fcae569c8 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 8 Dec 2017 14:18:30 +0100 Subject: [PATCH] [dxbc] User-defined shader interface cannot be an array due to interpolation modes --- src/dxbc/gen/dxbc_gen_pixel.cpp | 39 +++----------------------------- src/dxbc/gen/dxbc_gen_pixel.h | 3 --- src/dxbc/gen/dxbc_gen_vertex.cpp | 39 ++------------------------------ src/dxbc/gen/dxbc_gen_vertex.h | 1 - 4 files changed, 5 insertions(+), 77 deletions(-) diff --git a/src/dxbc/gen/dxbc_gen_pixel.cpp b/src/dxbc/gen/dxbc_gen_pixel.cpp index 375b0863..58e6f4f7 100644 --- a/src/dxbc/gen/dxbc_gen_pixel.cpp +++ b/src/dxbc/gen/dxbc_gen_pixel.cpp @@ -19,19 +19,6 @@ namespace dxvk { spv::FunctionControlMaskNone); m_module.opLabel(m_module.allocateId()); - // Declare user input block - m_psIn = m_module.newVar( - m_module.defPointerType( - m_module.defArrayType( - m_module.defVectorType( - m_module.defFloatType(32), 4), - m_module.constu32(32)), - spv::StorageClassInput), - spv::StorageClassInput); - m_entryPointInterfaces.push_back(m_psIn); - m_module.decorateLocation(m_psIn, 0); - m_module.setDebugName(m_psIn, "ps_in"); - // Declare outputs based on the input signature for (auto e = osgn->begin(); e != osgn->end(); e++) { if (e->systemValue == DxbcSystemValue::None) { @@ -67,7 +54,8 @@ namespace dxvk { if (m_vRegs.at(regId).valueId == 0) { m_vRegs.at(regId) = this->defVar( DxbcValueType(DxbcScalarType::Float32, 4), - spv::StorageClassPrivate); + spv::StorageClassInput); + m_module.decorateLocation(m_vRegs.at(regId).valueId, regId); m_module.setDebugName(m_vRegs.at(regId).valueId, str::format("v", regId).c_str()); } @@ -169,14 +157,7 @@ namespace dxvk { void DxbcPsCodeGen::prepareSvInputs() { - for (uint32_t i = 0; i < m_vRegs.size(); i++) { - if (m_vRegs.at(i).valueId != 0) { - this->regStore( - m_vRegs.at(i), - this->regLoad(this->getPsInPtr(i)), - DxbcComponentMask(true, true, true, true)); - } - } + } @@ -194,18 +175,4 @@ namespace dxvk { } } - - DxbcPointer DxbcPsCodeGen::getPsInPtr(uint32_t id) { - const uint32_t memberId = m_module.constu32(id); - - DxbcPointer result; - result.type = DxbcPointerType( - DxbcValueType(DxbcScalarType::Float32, 4), - spv::StorageClassInput); - result.valueId = m_module.opAccessChain( - this->defPointerType(result.type), - m_psIn, 1, &memberId); - return result; - } - } \ No newline at end of file diff --git a/src/dxbc/gen/dxbc_gen_pixel.h b/src/dxbc/gen/dxbc_gen_pixel.h index 04400080..a7fc3c36 100644 --- a/src/dxbc/gen/dxbc_gen_pixel.h +++ b/src/dxbc/gen/dxbc_gen_pixel.h @@ -37,7 +37,6 @@ namespace dxvk { private: uint32_t m_function = 0; - uint32_t m_psIn = 0; DxbcPointer m_svPosition; @@ -50,8 +49,6 @@ namespace dxvk { void prepareSvInputs(); void prepareSvOutputs(); - DxbcPointer getPsInPtr(uint32_t id); - }; } \ No newline at end of file diff --git a/src/dxbc/gen/dxbc_gen_vertex.cpp b/src/dxbc/gen/dxbc_gen_vertex.cpp index f64196f6..1e4c955a 100644 --- a/src/dxbc/gen/dxbc_gen_vertex.cpp +++ b/src/dxbc/gen/dxbc_gen_vertex.cpp @@ -25,19 +25,6 @@ namespace dxvk { m_entryPointInterfaces.push_back(m_vsPerVertex); m_module.setDebugName(m_vsPerVertex, "vs_per_vertex"); - // Declare per-vertex user output block - m_vsOut = m_module.newVar( - m_module.defPointerType( - m_module.defArrayType( - m_module.defVectorType( - m_module.defFloatType(32), 4), - m_module.constu32(32)), - spv::StorageClassOutput), - spv::StorageClassOutput); - m_entryPointInterfaces.push_back(m_vsOut); - m_module.decorateLocation(m_vsOut, 0); - m_module.setDebugName(m_vsOut, "vs_out"); - // Declare vertex inputs based on the input signature for (auto e = isgn->begin(); e != isgn->end(); e++) { if (e->systemValue == DxbcSystemValue::None) { @@ -88,7 +75,8 @@ namespace dxvk { if (m_oRegs.at(regId).valueId == 0) { m_oRegs.at(regId) = this->defVar( DxbcValueType(DxbcScalarType::Float32, 4), - spv::StorageClassPrivate); + spv::StorageClassOutput); + m_module.decorateLocation(m_oRegs.at(regId).valueId, regId); m_module.setDebugName(m_oRegs.at(regId).valueId, str::format("o", regId).c_str()); } @@ -186,15 +174,6 @@ namespace dxvk { void DxbcVsCodeGen::prepareSvOutputs() { - for (uint32_t i = 0; i < m_oRegs.size(); i++) { - if (m_oRegs.at(i).valueId != 0) { - this->regStore( - this->getVsOutPtr(i), - this->regLoad(m_oRegs.at(i)), - DxbcComponentMask(true, true, true, true)); - } - } - for (const auto& mapping : m_svOut) { DxbcValue srcValue = this->regLoad(m_oRegs.at(mapping.regId)); @@ -221,18 +200,4 @@ namespace dxvk { return result; } - - DxbcPointer DxbcVsCodeGen::getVsOutPtr(uint32_t id) { - const uint32_t memberId = m_module.constu32(id); - - DxbcPointer result; - result.type = DxbcPointerType( - DxbcValueType(DxbcScalarType::Float32, 4), - spv::StorageClassOutput); - result.valueId = m_module.opAccessChain( - this->defPointerType(result.type), - m_vsOut, 1, &memberId); - return result; - } - } \ No newline at end of file diff --git a/src/dxbc/gen/dxbc_gen_vertex.h b/src/dxbc/gen/dxbc_gen_vertex.h index 58d517c7..bbfaba5e 100644 --- a/src/dxbc/gen/dxbc_gen_vertex.h +++ b/src/dxbc/gen/dxbc_gen_vertex.h @@ -38,7 +38,6 @@ namespace dxvk { uint32_t m_function = 0; uint32_t m_vsPerVertex = 0; - uint32_t m_vsOut = 0; std::array m_vsIn; std::array m_vRegs;