diff --git a/src/dxbc/gen/dxbc_gen_pixel.cpp b/src/dxbc/gen/dxbc_gen_pixel.cpp index ab26da7e..ab7bf3b0 100644 --- a/src/dxbc/gen/dxbc_gen_pixel.cpp +++ b/src/dxbc/gen/dxbc_gen_pixel.cpp @@ -22,16 +22,16 @@ namespace dxvk { // Declare outputs based on the input signature for (auto e = osgn->begin(); e != osgn->end(); e++) { if (e->systemValue == DxbcSystemValue::None) { - m_psOut.at(e->registerId) = this->defVar( + const DxbcPointer var = this->defVar( DxbcValueType(e->componentType, e->componentMask.componentCount()), spv::StorageClassOutput); - m_module.decorateLocation( - m_psOut.at(e->registerId).valueId, - e->registerId); - m_module.setDebugName(m_psOut.at(e->registerId).valueId, + + m_psOut.at(e->registerId) = var; + + m_module.decorateLocation(var.valueId, e->registerId); + m_module.setDebugName(var.valueId, str::format("ps_out", e->registerId).c_str()); - m_entryPointInterfaces.push_back( - m_psOut.at(e->registerId).valueId); + m_entryPointInterfaces.push_back(var.valueId); } } } @@ -52,44 +52,44 @@ namespace dxvk { switch (regType) { case DxbcOperandType::Input: { if (m_vRegs.at(regId).valueId == 0) { - m_vRegs.at(regId) = this->defVar( + const DxbcPointer var = this->defVar( DxbcValueType(DxbcScalarType::Float32, 4), spv::StorageClassInput); - m_module.decorateLocation(m_vRegs.at(regId).valueId, regId); - m_module.setDebugName(m_vRegs.at(regId).valueId, + + m_vRegs.at(regId) = var; + m_module.decorateLocation(var.valueId, regId); + m_module.setDebugName(var.valueId, str::format("v", regId).c_str()); switch (im) { case DxbcInterpolationMode::Undefined: - Logger::err("Undefined interpolation mode"); - break; case DxbcInterpolationMode::Linear: - Logger::err("Linear interpolation mode"); break; case DxbcInterpolationMode::Constant: - m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationFlat); + m_module.decorate(var.valueId, spv::DecorationFlat); break; case DxbcInterpolationMode::LinearCentroid: - m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationCentroid); + m_module.decorate(var.valueId, spv::DecorationCentroid); break; case DxbcInterpolationMode::LinearNoPerspective: - m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationNoPerspective); + m_module.decorate(var.valueId, spv::DecorationNoPerspective); break; + case DxbcInterpolationMode::LinearNoPerspectiveCentroid: - m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationNoPerspective); - m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationCentroid); + m_module.decorate(var.valueId, spv::DecorationNoPerspective); + m_module.decorate(var.valueId, spv::DecorationCentroid); break; case DxbcInterpolationMode::LinearSample: - m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationSample); + m_module.decorate(var.valueId, spv::DecorationSample); break; case DxbcInterpolationMode::LinearNoPerspectiveSample: - m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationNoPerspective); - m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationSample); + m_module.decorate(var.valueId, spv::DecorationNoPerspective); + m_module.decorate(var.valueId, spv::DecorationSample); break; } } diff --git a/src/dxbc/gen/dxbc_gen_pixel.h b/src/dxbc/gen/dxbc_gen_pixel.h index a7fc3c36..2b02d128 100644 --- a/src/dxbc/gen/dxbc_gen_pixel.h +++ b/src/dxbc/gen/dxbc_gen_pixel.h @@ -37,6 +37,7 @@ namespace dxvk { private: uint32_t m_function = 0; + uint32_t m_psIn = 0; DxbcPointer m_svPosition; diff --git a/src/dxbc/gen/dxbc_gen_vertex.cpp b/src/dxbc/gen/dxbc_gen_vertex.cpp index 1e4c955a..40f6869d 100644 --- a/src/dxbc/gen/dxbc_gen_vertex.cpp +++ b/src/dxbc/gen/dxbc_gen_vertex.cpp @@ -24,22 +24,6 @@ namespace dxvk { spv::StorageClassOutput); m_entryPointInterfaces.push_back(m_vsPerVertex); m_module.setDebugName(m_vsPerVertex, "vs_per_vertex"); - - // Declare vertex inputs based on the input signature - for (auto e = isgn->begin(); e != isgn->end(); e++) { - if (e->systemValue == DxbcSystemValue::None) { - m_vsIn.at(e->registerId) = this->defVar( - DxbcValueType(e->componentType, 4), - spv::StorageClassInput); - m_module.decorateLocation( - m_vsIn.at(e->registerId).valueId, - e->registerId); - m_module.setDebugName(m_vsIn.at(e->registerId).valueId, - str::format("vs_in", e->registerId).c_str()); - m_entryPointInterfaces.push_back( - m_vsIn.at(e->registerId).valueId); - } - } } @@ -60,7 +44,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()); } @@ -159,16 +144,6 @@ namespace dxvk { void DxbcVsCodeGen::prepareSvInputs() { DxbcValueType targetType(DxbcScalarType::Float32, 4); - // Copy vertex inputs to the actual shader input registers - for (uint32_t i = 0; i < m_vsIn.size(); i++) { - if ((m_vsIn.at(i).valueId != 0) && (m_vRegs.at(i).valueId != 0)) { - DxbcValue srcValue = this->regLoad(m_vsIn.at(i)); - srcValue = this->regCast(srcValue, targetType); - this->regStore(m_vRegs.at(i), srcValue, - DxbcComponentMask(true, true, true, true)); - } - } - // TODO system values } diff --git a/src/dxbc/gen/dxbc_gen_vertex.h b/src/dxbc/gen/dxbc_gen_vertex.h index bbfaba5e..8a3096fb 100644 --- a/src/dxbc/gen/dxbc_gen_vertex.h +++ b/src/dxbc/gen/dxbc_gen_vertex.h @@ -39,7 +39,6 @@ namespace dxvk { uint32_t m_function = 0; uint32_t m_vsPerVertex = 0; - std::array m_vsIn; std::array m_vRegs; std::array m_oRegs;