[dxbc] rename DxbcProgramVersion to DxbcProgramInfo

The version in not part of this class anymore.
This commit is contained in:
Andre Heider 2018-10-08 09:34:56 +02:00 committed by Philip Rebohle
parent 8492f0501e
commit 8fcdf78b51
10 changed files with 57 additions and 57 deletions

View File

@ -4,7 +4,7 @@ namespace dxvk {
DxbcAnalyzer::DxbcAnalyzer( DxbcAnalyzer::DxbcAnalyzer(
const DxbcModuleInfo& moduleInfo, const DxbcModuleInfo& moduleInfo,
const DxbcProgramVersion& version, const DxbcProgramInfo& programInfo,
const Rc<DxbcIsgn>& isgn, const Rc<DxbcIsgn>& isgn,
const Rc<DxbcIsgn>& osgn, const Rc<DxbcIsgn>& osgn,
DxbcAnalysisInfo& analysis) DxbcAnalysisInfo& analysis)
@ -73,4 +73,4 @@ namespace dxvk {
return result; return result;
} }
} }

View File

@ -55,7 +55,7 @@ namespace dxvk {
DxbcAnalyzer( DxbcAnalyzer(
const DxbcModuleInfo& moduleInfo, const DxbcModuleInfo& moduleInfo,
const DxbcProgramVersion& version, const DxbcProgramInfo& programInfo,
const Rc<DxbcIsgn>& isgn, const Rc<DxbcIsgn>& isgn,
const Rc<DxbcIsgn>& osgn, const Rc<DxbcIsgn>& osgn,
DxbcAnalysisInfo& analysis); DxbcAnalysisInfo& analysis);
@ -81,4 +81,4 @@ namespace dxvk {
}; };
} }

View File

@ -8,7 +8,7 @@ namespace dxvk {
// numbers, and the high word contains the program type. // numbers, and the high word contains the program type.
reader.skip(2); reader.skip(2);
auto pType = reader.readEnum<DxbcProgramType>(); auto pType = reader.readEnum<DxbcProgramType>();
m_version = DxbcProgramVersion(pType); m_programInfo = DxbcProgramInfo(pType);
// Read the actual shader code as an array of DWORDs. // Read the actual shader code as an array of DWORDs.
auto codeLength = reader.readu32() - 2; auto codeLength = reader.readu32() - 2;

View File

@ -20,8 +20,8 @@ namespace dxvk {
DxbcShex(DxbcReader reader); DxbcShex(DxbcReader reader);
~DxbcShex(); ~DxbcShex();
DxbcProgramVersion version() const { DxbcProgramInfo programInfo() const {
return m_version; return m_programInfo;
} }
DxbcCodeSlice slice() const { DxbcCodeSlice slice() const {
@ -31,9 +31,9 @@ namespace dxvk {
private: private:
DxbcProgramVersion m_version; DxbcProgramInfo m_programInfo;
std::vector<uint32_t> m_code; std::vector<uint32_t> m_code;
}; };
} }

View File

@ -2,7 +2,7 @@
namespace dxvk { namespace dxvk {
VkShaderStageFlagBits DxbcProgramVersion::shaderStage() const { VkShaderStageFlagBits DxbcProgramInfo::shaderStage() const {
switch (m_type) { switch (m_type) {
case DxbcProgramType::PixelShader : return VK_SHADER_STAGE_FRAGMENT_BIT; case DxbcProgramType::PixelShader : return VK_SHADER_STAGE_FRAGMENT_BIT;
case DxbcProgramType::VertexShader : return VK_SHADER_STAGE_VERTEX_BIT; case DxbcProgramType::VertexShader : return VK_SHADER_STAGE_VERTEX_BIT;
@ -12,11 +12,11 @@ namespace dxvk {
case DxbcProgramType::ComputeShader : return VK_SHADER_STAGE_COMPUTE_BIT; case DxbcProgramType::ComputeShader : return VK_SHADER_STAGE_COMPUTE_BIT;
} }
throw DxvkError("DxbcProgramVersion::shaderStage: Unsupported program type"); throw DxvkError("DxbcProgramInfo::shaderStage: Unsupported program type");
} }
spv::ExecutionModel DxbcProgramVersion::executionModel() const { spv::ExecutionModel DxbcProgramInfo::executionModel() const {
switch (m_type) { switch (m_type) {
case DxbcProgramType::PixelShader : return spv::ExecutionModelFragment; case DxbcProgramType::PixelShader : return spv::ExecutionModelFragment;
case DxbcProgramType::VertexShader : return spv::ExecutionModelVertex; case DxbcProgramType::VertexShader : return spv::ExecutionModelVertex;
@ -26,7 +26,7 @@ namespace dxvk {
case DxbcProgramType::ComputeShader : return spv::ExecutionModelGLCompute; case DxbcProgramType::ComputeShader : return spv::ExecutionModelGLCompute;
} }
throw DxvkError("DxbcProgramVersion::executionModel: Unsupported program type"); throw DxvkError("DxbcProgramInfo::executionModel: Unsupported program type");
} }
} }

View File

@ -25,12 +25,12 @@ namespace dxvk {
* *
* Stores the shader program type. * Stores the shader program type.
*/ */
class DxbcProgramVersion { class DxbcProgramInfo {
public: public:
DxbcProgramVersion() { } DxbcProgramInfo() { }
DxbcProgramVersion(DxbcProgramType type) DxbcProgramInfo(DxbcProgramType type)
: m_type(type) { } : m_type(type) { }
/** /**

View File

@ -12,15 +12,15 @@ namespace dxvk {
DxbcCompiler::DxbcCompiler( DxbcCompiler::DxbcCompiler(
const std::string& fileName, const std::string& fileName,
const DxbcModuleInfo& moduleInfo, const DxbcModuleInfo& moduleInfo,
const DxbcProgramVersion& version, const DxbcProgramInfo& programInfo,
const Rc<DxbcIsgn>& isgn, const Rc<DxbcIsgn>& isgn,
const Rc<DxbcIsgn>& osgn, const Rc<DxbcIsgn>& osgn,
const DxbcAnalysisInfo& analysis) const DxbcAnalysisInfo& analysis)
: m_moduleInfo(moduleInfo), : m_moduleInfo (moduleInfo),
m_version (version), m_programInfo(programInfo),
m_isgn (isgn), m_isgn (isgn),
m_osgn (osgn), m_osgn (osgn),
m_analysis (&analysis) { m_analysis (&analysis) {
// Declare an entry point ID. We'll need it during the // Declare an entry point ID. We'll need it during the
// initialization phase where the execution mode is set. // initialization phase where the execution mode is set.
m_entryPointId = m_module.allocateId(); m_entryPointId = m_module.allocateId();
@ -183,7 +183,7 @@ namespace dxvk {
// Depending on the shader type, this will prepare // Depending on the shader type, this will prepare
// input registers, call various shader functions // input registers, call various shader functions
// and write back the output registers. // and write back the output registers.
switch (m_version.type()) { switch (m_programInfo.type()) {
case DxbcProgramType::VertexShader: this->emitVsFinalize(); break; case DxbcProgramType::VertexShader: this->emitVsFinalize(); break;
case DxbcProgramType::HullShader: this->emitHsFinalize(); break; case DxbcProgramType::HullShader: this->emitHsFinalize(); break;
case DxbcProgramType::DomainShader: this->emitDsFinalize(); break; case DxbcProgramType::DomainShader: this->emitDsFinalize(); break;
@ -195,14 +195,14 @@ namespace dxvk {
// Declare the entry point, we now have all the // Declare the entry point, we now have all the
// information we need, including the interfaces // information we need, including the interfaces
m_module.addEntryPoint(m_entryPointId, m_module.addEntryPoint(m_entryPointId,
m_version.executionModel(), "main", m_programInfo.executionModel(), "main",
m_entryPointInterfaces.size(), m_entryPointInterfaces.size(),
m_entryPointInterfaces.data()); m_entryPointInterfaces.data());
m_module.setDebugName(m_entryPointId, "main"); m_module.setDebugName(m_entryPointId, "main");
// Create the shader module object // Create the shader module object
return new DxvkShader( return new DxvkShader(
m_version.shaderStage(), m_programInfo.shaderStage(),
m_resourceSlots.size(), m_resourceSlots.size(),
m_resourceSlots.data(), m_resourceSlots.data(),
m_interfaceSlots, m_interfaceSlots,
@ -359,7 +359,7 @@ namespace dxvk {
void DxbcCompiler::emitDclInterfaceReg(const DxbcShaderInstruction& ins) { void DxbcCompiler::emitDclInterfaceReg(const DxbcShaderInstruction& ins) {
switch (ins.dst[0].type) { switch (ins.dst[0].type) {
case DxbcOperandType::InputControlPoint: case DxbcOperandType::InputControlPoint:
if (m_version.type() != DxbcProgramType::HullShader) if (m_programInfo.type() != DxbcProgramType::HullShader)
break; break;
/* fall through */ /* fall through */
@ -652,7 +652,7 @@ namespace dxvk {
&& sv != DxbcSystemValue::CullDistance) && sv != DxbcSystemValue::CullDistance)
m_oMappings.push_back({ regIdx, regMask, sv }); m_oMappings.push_back({ regIdx, regMask, sv });
if (m_version.type() == DxbcProgramType::HullShader) { if (m_programInfo.type() == DxbcProgramType::HullShader) {
// Hull shaders don't use standard outputs // Hull shaders don't use standard outputs
if (getCurrentHsForkJoinPhase() != nullptr) if (getCurrentHsForkJoinPhase() != nullptr)
m_hs.outputPerPatchMask |= 1 << regIdx; m_hs.outputPerPatchMask |= 1 << regIdx;
@ -725,7 +725,7 @@ namespace dxvk {
// Compute the DXVK binding slot index for the buffer. // Compute the DXVK binding slot index for the buffer.
// D3D11 needs to bind the actual buffers to this slot. // D3D11 needs to bind the actual buffers to this slot.
const uint32_t bindingId = computeResourceSlotId( const uint32_t bindingId = computeResourceSlotId(
m_version.type(), DxbcBindingType::ConstantBuffer, m_programInfo.type(), DxbcBindingType::ConstantBuffer,
regIdx); regIdx);
m_module.decorateDescriptorSet(varId, 0); m_module.decorateDescriptorSet(varId, 0);
@ -775,7 +775,7 @@ namespace dxvk {
// Compute binding slot index for the sampler // Compute binding slot index for the sampler
const uint32_t bindingId = computeResourceSlotId( const uint32_t bindingId = computeResourceSlotId(
m_version.type(), DxbcBindingType::ImageSampler, samplerId); m_programInfo.type(), DxbcBindingType::ImageSampler, samplerId);
m_module.decorateDescriptorSet(varId, 0); m_module.decorateDescriptorSet(varId, 0);
m_module.decorateBinding(varId, bindingId); m_module.decorateBinding(varId, bindingId);
@ -891,7 +891,7 @@ namespace dxvk {
// Compute the DXVK binding slot index for the resource. // Compute the DXVK binding slot index for the resource.
// D3D11 needs to bind the actual resource to this slot. // D3D11 needs to bind the actual resource to this slot.
const uint32_t bindingId = computeResourceSlotId( const uint32_t bindingId = computeResourceSlotId(
m_version.type(), isUav m_programInfo.type(), isUav
? DxbcBindingType::UnorderedAccessView ? DxbcBindingType::UnorderedAccessView
: DxbcBindingType::ShaderResource, : DxbcBindingType::ShaderResource,
registerId); registerId);
@ -1018,7 +1018,7 @@ namespace dxvk {
// Compute the DXVK binding slot index for the resource. // Compute the DXVK binding slot index for the resource.
const uint32_t bindingId = computeResourceSlotId( const uint32_t bindingId = computeResourceSlotId(
m_version.type(), isUav m_programInfo.type(), isUav
? DxbcBindingType::UnorderedAccessView ? DxbcBindingType::UnorderedAccessView
: DxbcBindingType::ShaderResource, : DxbcBindingType::ShaderResource,
registerId); registerId);
@ -1167,7 +1167,7 @@ namespace dxvk {
void DxbcCompiler::emitDclInputControlPointCount(const DxbcShaderInstruction& ins) { void DxbcCompiler::emitDclInputControlPointCount(const DxbcShaderInstruction& ins) {
// dcl_input_control_points has the control point // dcl_input_control_points has the control point
// count embedded within the opcode token. // count embedded within the opcode token.
if (m_version.type() == DxbcProgramType::HullShader) { if (m_programInfo.type() == DxbcProgramType::HullShader) {
m_hs.vertexCountIn = ins.controls.controlPointCount(); m_hs.vertexCountIn = ins.controls.controlPointCount();
emitDclInputArray(m_hs.vertexCountIn); emitDclInputArray(m_hs.vertexCountIn);
@ -1291,7 +1291,7 @@ namespace dxvk {
str::format("u", regId, "_meta").c_str()); str::format("u", regId, "_meta").c_str());
const uint32_t bindingId = computeResourceSlotId( const uint32_t bindingId = computeResourceSlotId(
m_version.type(), DxbcBindingType::UavCounter, m_programInfo.type(), DxbcBindingType::UavCounter,
regId); regId);
m_module.decorateDescriptorSet(varId, 0); m_module.decorateDescriptorSet(varId, 0);
@ -4312,11 +4312,11 @@ namespace dxvk {
const InputArray array = [&] () -> InputArray { const InputArray array = [&] () -> InputArray {
switch (operand.type) { switch (operand.type) {
case DxbcOperandType::InputControlPoint: case DxbcOperandType::InputControlPoint:
return m_version.type() == DxbcProgramType::HullShader return m_programInfo.type() == DxbcProgramType::HullShader
? InputArray { m_vArray, spv::StorageClassPrivate } ? InputArray { m_vArray, spv::StorageClassPrivate }
: InputArray { m_ds.inputPerVertex, spv::StorageClassInput }; : InputArray { m_ds.inputPerVertex, spv::StorageClassInput };
case DxbcOperandType::InputPatchConstant: case DxbcOperandType::InputPatchConstant:
return m_version.type() == DxbcProgramType::HullShader return m_programInfo.type() == DxbcProgramType::HullShader
? InputArray { m_hs.outputPerPatch, spv::StorageClassPrivate } ? InputArray { m_hs.outputPerPatch, spv::StorageClassPrivate }
: InputArray { m_ds.inputPerPatch, spv::StorageClassInput }; : InputArray { m_ds.inputPerPatch, spv::StorageClassInput };
case DxbcOperandType::OutputControlPoint: case DxbcOperandType::OutputControlPoint:
@ -4342,7 +4342,7 @@ namespace dxvk {
DxbcRegisterPointer DxbcCompiler::emitGetOutputPtr( DxbcRegisterPointer DxbcCompiler::emitGetOutputPtr(
const DxbcRegister& operand) { const DxbcRegister& operand) {
if (m_version.type() == DxbcProgramType::HullShader) { if (m_programInfo.type() == DxbcProgramType::HullShader) {
// Hull shaders are special in that they have two sets of // Hull shaders are special in that they have two sets of
// output registers, one for per-patch values and one for // output registers, one for per-patch values and one for
// per-vertex values. // per-vertex values.
@ -5136,10 +5136,10 @@ namespace dxvk {
const uint32_t registerId = m_module.consti32(map.regId); const uint32_t registerId = m_module.consti32(map.regId);
const DxbcRegisterValue value = [&] { const DxbcRegisterValue value = [&] {
switch (m_version.type()) { switch (m_programInfo.type()) {
case DxbcProgramType::VertexShader: return emitVsSystemValueLoad(map.sv, map.regMask); case DxbcProgramType::VertexShader: return emitVsSystemValueLoad(map.sv, map.regMask);
case DxbcProgramType::PixelShader: return emitPsSystemValueLoad(map.sv, map.regMask); case DxbcProgramType::PixelShader: return emitPsSystemValueLoad(map.sv, map.regMask);
default: throw DxvkError(str::format("DxbcCompiler: Unexpected stage: ", m_version.type())); default: throw DxvkError(str::format("DxbcCompiler: Unexpected stage: ", m_programInfo.type()));
} }
}(); }();
@ -5193,9 +5193,9 @@ namespace dxvk {
for (uint32_t v = 0; v < vertexCount; v++) { for (uint32_t v = 0; v < vertexCount; v++) {
const DxbcRegisterValue value = [&] { const DxbcRegisterValue value = [&] {
switch (m_version.type()) { switch (m_programInfo.type()) {
case DxbcProgramType::GeometryShader: return emitGsSystemValueLoad(map.sv, map.regMask, v); case DxbcProgramType::GeometryShader: return emitGsSystemValueLoad(map.sv, map.regMask, v);
default: throw DxvkError(str::format("DxbcCompiler: Unexpected stage: ", m_version.type())); default: throw DxvkError(str::format("DxbcCompiler: Unexpected stage: ", m_programInfo.type()));
} }
}(); }();
@ -5218,7 +5218,7 @@ namespace dxvk {
for (const DxbcSvMapping& svMapping : m_oMappings) { for (const DxbcSvMapping& svMapping : m_oMappings) {
DxbcRegisterPointer outputReg = m_oRegs.at(svMapping.regId); DxbcRegisterPointer outputReg = m_oRegs.at(svMapping.regId);
if (m_version.type() == DxbcProgramType::HullShader) { if (m_programInfo.type() == DxbcProgramType::HullShader) {
uint32_t registerIndex = m_module.constu32(svMapping.regId); uint32_t registerIndex = m_module.constu32(svMapping.regId);
outputReg.type = { DxbcScalarType::Float32, 4 }; outputReg.type = { DxbcScalarType::Float32, 4 };
@ -5234,7 +5234,7 @@ namespace dxvk {
auto mask = svMapping.regMask; auto mask = svMapping.regMask;
auto value = emitValueLoad(outputReg); auto value = emitValueLoad(outputReg);
switch (m_version.type()) { switch (m_programInfo.type()) {
case DxbcProgramType::VertexShader: emitVsSystemValueStore(sv, mask, value); break; case DxbcProgramType::VertexShader: emitVsSystemValueStore(sv, mask, value); break;
case DxbcProgramType::GeometryShader: emitGsSystemValueStore(sv, mask, value); break; case DxbcProgramType::GeometryShader: emitGsSystemValueStore(sv, mask, value); break;
case DxbcProgramType::HullShader: emitHsSystemValueStore(sv, mask, value); break; case DxbcProgramType::HullShader: emitHsSystemValueStore(sv, mask, value); break;
@ -5543,7 +5543,7 @@ namespace dxvk {
} break; } break;
case DxbcSystemValue::RenderTargetId: { case DxbcSystemValue::RenderTargetId: {
if (m_version.type() != DxbcProgramType::GeometryShader) if (m_programInfo.type() != DxbcProgramType::GeometryShader)
enableShaderViewportIndexLayer(); enableShaderViewportIndexLayer();
if (m_gs.builtinLayer == 0) { if (m_gs.builtinLayer == 0) {
@ -5566,7 +5566,7 @@ namespace dxvk {
} break; } break;
case DxbcSystemValue::ViewportId: { case DxbcSystemValue::ViewportId: {
if (m_version.type() != DxbcProgramType::GeometryShader) if (m_programInfo.type() != DxbcProgramType::GeometryShader)
enableShaderViewportIndexLayer(); enableShaderViewportIndexLayer();
if (m_gs.builtinViewportId == 0) { if (m_gs.builtinViewportId == 0) {
@ -5844,7 +5844,7 @@ namespace dxvk {
// Initialize the shader module with capabilities // Initialize the shader module with capabilities
// etc. Each shader type has its own peculiarities. // etc. Each shader type has its own peculiarities.
switch (m_version.type()) { switch (m_programInfo.type()) {
case DxbcProgramType::VertexShader: emitVsInit(); break; case DxbcProgramType::VertexShader: emitVsInit(); break;
case DxbcProgramType::HullShader: emitHsInit(); break; case DxbcProgramType::HullShader: emitHsInit(); break;
case DxbcProgramType::DomainShader: emitDsInit(); break; case DxbcProgramType::DomainShader: emitDsInit(); break;
@ -6714,7 +6714,7 @@ namespace dxvk {
DxbcVectorType DxbcCompiler::getInputRegType(uint32_t regIdx) const { DxbcVectorType DxbcCompiler::getInputRegType(uint32_t regIdx) const {
switch (m_version.type()) { switch (m_programInfo.type()) {
case DxbcProgramType::VertexShader: { case DxbcProgramType::VertexShader: {
const DxbcSgnEntry* entry = m_isgn->findByRegister(regIdx); const DxbcSgnEntry* entry = m_isgn->findByRegister(regIdx);
@ -6748,7 +6748,7 @@ namespace dxvk {
DxbcVectorType DxbcCompiler::getOutputRegType(uint32_t regIdx) const { DxbcVectorType DxbcCompiler::getOutputRegType(uint32_t regIdx) const {
switch (m_version.type()) { switch (m_programInfo.type()) {
case DxbcProgramType::PixelShader: { case DxbcProgramType::PixelShader: {
const DxbcSgnEntry* entry = m_osgn->findByRegister(regIdx); const DxbcSgnEntry* entry = m_osgn->findByRegister(regIdx);
@ -6909,4 +6909,4 @@ namespace dxvk {
} }
} }
} }

View File

@ -358,7 +358,7 @@ namespace dxvk {
DxbcCompiler( DxbcCompiler(
const std::string& fileName, const std::string& fileName,
const DxbcModuleInfo& moduleInfo, const DxbcModuleInfo& moduleInfo,
const DxbcProgramVersion& version, const DxbcProgramInfo& programInfo,
const Rc<DxbcIsgn>& isgn, const Rc<DxbcIsgn>& isgn,
const Rc<DxbcIsgn>& osgn, const Rc<DxbcIsgn>& osgn,
const DxbcAnalysisInfo& analysis); const DxbcAnalysisInfo& analysis);
@ -380,7 +380,7 @@ namespace dxvk {
private: private:
DxbcModuleInfo m_moduleInfo; DxbcModuleInfo m_moduleInfo;
DxbcProgramVersion m_version; DxbcProgramInfo m_programInfo;
SpirvModule m_module; SpirvModule m_module;
Rc<DxbcIsgn> m_isgn; Rc<DxbcIsgn> m_isgn;
@ -1167,4 +1167,4 @@ namespace dxvk {
}; };
} }

View File

@ -46,7 +46,7 @@ namespace dxvk {
DxbcAnalysisInfo analysisInfo; DxbcAnalysisInfo analysisInfo;
DxbcAnalyzer analyzer(moduleInfo, DxbcAnalyzer analyzer(moduleInfo,
m_shexChunk->version(), m_shexChunk->programInfo(),
m_isgnChunk, m_osgnChunk, m_isgnChunk, m_osgnChunk,
analysisInfo); analysisInfo);
@ -54,7 +54,7 @@ namespace dxvk {
DxbcCompiler compiler( DxbcCompiler compiler(
fileName, moduleInfo, fileName, moduleInfo,
m_shexChunk->version(), m_shexChunk->programInfo(),
m_isgnChunk, m_osgnChunk, m_isgnChunk, m_osgnChunk,
analysisInfo); analysisInfo);
@ -91,4 +91,4 @@ namespace dxvk {
} }
} }
} }

View File

@ -35,8 +35,8 @@ namespace dxvk {
* \brief Shader type * \brief Shader type
* \returns Shader type * \returns Shader type
*/ */
DxbcProgramVersion version() const { DxbcProgramInfo programInfo() const {
return m_shexChunk->version(); return m_shexChunk->programInfo();
} }
/** /**
@ -78,4 +78,4 @@ namespace dxvk {
}; };
} }