1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 19:24:10 +01:00

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

View File

@ -55,7 +55,7 @@ namespace dxvk {
DxbcAnalyzer(
const DxbcModuleInfo& moduleInfo,
const DxbcProgramVersion& version,
const DxbcProgramInfo& programInfo,
const Rc<DxbcIsgn>& isgn,
const Rc<DxbcIsgn>& osgn,
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.
reader.skip(2);
auto pType = reader.readEnum<DxbcProgramType>();
m_version = DxbcProgramVersion(pType);
m_programInfo = DxbcProgramInfo(pType);
// Read the actual shader code as an array of DWORDs.
auto codeLength = reader.readu32() - 2;

View File

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

View File

@ -2,7 +2,7 @@
namespace dxvk {
VkShaderStageFlagBits DxbcProgramVersion::shaderStage() const {
VkShaderStageFlagBits DxbcProgramInfo::shaderStage() const {
switch (m_type) {
case DxbcProgramType::PixelShader : return VK_SHADER_STAGE_FRAGMENT_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;
}
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) {
case DxbcProgramType::PixelShader : return spv::ExecutionModelFragment;
case DxbcProgramType::VertexShader : return spv::ExecutionModelVertex;
@ -26,7 +26,7 @@ namespace dxvk {
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.
*/
class DxbcProgramVersion {
class DxbcProgramInfo {
public:
DxbcProgramVersion() { }
DxbcProgramVersion(DxbcProgramType type)
DxbcProgramInfo() { }
DxbcProgramInfo(DxbcProgramType type)
: m_type(type) { }
/**

View File

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

View File

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

View File

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

View File

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