mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 04:29:15 +01:00
[dxbc] Minor cleanups
This commit is contained in:
parent
8887e8b2fa
commit
9f4cc6b77d
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ namespace dxvk {
|
||||
private:
|
||||
|
||||
uint32_t m_function = 0;
|
||||
uint32_t m_psIn = 0;
|
||||
|
||||
DxbcPointer m_svPosition;
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ namespace dxvk {
|
||||
uint32_t m_function = 0;
|
||||
uint32_t m_vsPerVertex = 0;
|
||||
|
||||
std::array<DxbcPointer, 32> m_vsIn;
|
||||
std::array<DxbcPointer, 32> m_vRegs;
|
||||
std::array<DxbcPointer, 32> m_oRegs;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user