mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +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
|
// Declare outputs based on the input signature
|
||||||
for (auto e = osgn->begin(); e != osgn->end(); e++) {
|
for (auto e = osgn->begin(); e != osgn->end(); e++) {
|
||||||
if (e->systemValue == DxbcSystemValue::None) {
|
if (e->systemValue == DxbcSystemValue::None) {
|
||||||
m_psOut.at(e->registerId) = this->defVar(
|
const DxbcPointer var = this->defVar(
|
||||||
DxbcValueType(e->componentType, e->componentMask.componentCount()),
|
DxbcValueType(e->componentType, e->componentMask.componentCount()),
|
||||||
spv::StorageClassOutput);
|
spv::StorageClassOutput);
|
||||||
m_module.decorateLocation(
|
|
||||||
m_psOut.at(e->registerId).valueId,
|
m_psOut.at(e->registerId) = var;
|
||||||
e->registerId);
|
|
||||||
m_module.setDebugName(m_psOut.at(e->registerId).valueId,
|
m_module.decorateLocation(var.valueId, e->registerId);
|
||||||
|
m_module.setDebugName(var.valueId,
|
||||||
str::format("ps_out", e->registerId).c_str());
|
str::format("ps_out", e->registerId).c_str());
|
||||||
m_entryPointInterfaces.push_back(
|
m_entryPointInterfaces.push_back(var.valueId);
|
||||||
m_psOut.at(e->registerId).valueId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,44 +52,44 @@ namespace dxvk {
|
|||||||
switch (regType) {
|
switch (regType) {
|
||||||
case DxbcOperandType::Input: {
|
case DxbcOperandType::Input: {
|
||||||
if (m_vRegs.at(regId).valueId == 0) {
|
if (m_vRegs.at(regId).valueId == 0) {
|
||||||
m_vRegs.at(regId) = this->defVar(
|
const DxbcPointer var = this->defVar(
|
||||||
DxbcValueType(DxbcScalarType::Float32, 4),
|
DxbcValueType(DxbcScalarType::Float32, 4),
|
||||||
spv::StorageClassInput);
|
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());
|
str::format("v", regId).c_str());
|
||||||
|
|
||||||
switch (im) {
|
switch (im) {
|
||||||
case DxbcInterpolationMode::Undefined:
|
case DxbcInterpolationMode::Undefined:
|
||||||
Logger::err("Undefined interpolation mode");
|
|
||||||
break;
|
|
||||||
case DxbcInterpolationMode::Linear:
|
case DxbcInterpolationMode::Linear:
|
||||||
Logger::err("Linear interpolation mode");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DxbcInterpolationMode::Constant:
|
case DxbcInterpolationMode::Constant:
|
||||||
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationFlat);
|
m_module.decorate(var.valueId, spv::DecorationFlat);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DxbcInterpolationMode::LinearCentroid:
|
case DxbcInterpolationMode::LinearCentroid:
|
||||||
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationCentroid);
|
m_module.decorate(var.valueId, spv::DecorationCentroid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DxbcInterpolationMode::LinearNoPerspective:
|
case DxbcInterpolationMode::LinearNoPerspective:
|
||||||
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationNoPerspective);
|
m_module.decorate(var.valueId, spv::DecorationNoPerspective);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DxbcInterpolationMode::LinearNoPerspectiveCentroid:
|
case DxbcInterpolationMode::LinearNoPerspectiveCentroid:
|
||||||
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationNoPerspective);
|
m_module.decorate(var.valueId, spv::DecorationNoPerspective);
|
||||||
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationCentroid);
|
m_module.decorate(var.valueId, spv::DecorationCentroid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DxbcInterpolationMode::LinearSample:
|
case DxbcInterpolationMode::LinearSample:
|
||||||
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationSample);
|
m_module.decorate(var.valueId, spv::DecorationSample);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DxbcInterpolationMode::LinearNoPerspectiveSample:
|
case DxbcInterpolationMode::LinearNoPerspectiveSample:
|
||||||
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationNoPerspective);
|
m_module.decorate(var.valueId, spv::DecorationNoPerspective);
|
||||||
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationSample);
|
m_module.decorate(var.valueId, spv::DecorationSample);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ namespace dxvk {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
uint32_t m_function = 0;
|
uint32_t m_function = 0;
|
||||||
|
uint32_t m_psIn = 0;
|
||||||
|
|
||||||
DxbcPointer m_svPosition;
|
DxbcPointer m_svPosition;
|
||||||
|
|
||||||
|
@ -24,22 +24,6 @@ namespace dxvk {
|
|||||||
spv::StorageClassOutput);
|
spv::StorageClassOutput);
|
||||||
m_entryPointInterfaces.push_back(m_vsPerVertex);
|
m_entryPointInterfaces.push_back(m_vsPerVertex);
|
||||||
m_module.setDebugName(m_vsPerVertex, "vs_per_vertex");
|
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) {
|
if (m_vRegs.at(regId).valueId == 0) {
|
||||||
m_vRegs.at(regId) = this->defVar(
|
m_vRegs.at(regId) = this->defVar(
|
||||||
DxbcValueType(DxbcScalarType::Float32, 4),
|
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,
|
m_module.setDebugName(m_vRegs.at(regId).valueId,
|
||||||
str::format("v", regId).c_str());
|
str::format("v", regId).c_str());
|
||||||
}
|
}
|
||||||
@ -159,16 +144,6 @@ namespace dxvk {
|
|||||||
void DxbcVsCodeGen::prepareSvInputs() {
|
void DxbcVsCodeGen::prepareSvInputs() {
|
||||||
DxbcValueType targetType(DxbcScalarType::Float32, 4);
|
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
|
// TODO system values
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ namespace dxvk {
|
|||||||
uint32_t m_function = 0;
|
uint32_t m_function = 0;
|
||||||
uint32_t m_vsPerVertex = 0;
|
uint32_t m_vsPerVertex = 0;
|
||||||
|
|
||||||
std::array<DxbcPointer, 32> m_vsIn;
|
|
||||||
std::array<DxbcPointer, 32> m_vRegs;
|
std::array<DxbcPointer, 32> m_vRegs;
|
||||||
std::array<DxbcPointer, 32> m_oRegs;
|
std::array<DxbcPointer, 32> m_oRegs;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user