mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxbc] Implemented interpolation modes for pixel shader inputs
This commit is contained in:
parent
bd8dc20fa2
commit
8887e8b2fa
@ -102,8 +102,10 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxbcInterpolationMode im = DxbcInterpolationMode::Undefined;
|
DxbcInterpolationMode im = DxbcInterpolationMode::Undefined;
|
||||||
|
|
||||||
if (hasInterpolationMode)
|
if (hasInterpolationMode) {
|
||||||
im = op.token().interpolationMode();
|
im = static_cast<DxbcInterpolationMode>(
|
||||||
|
bit::extract(ins.token().control(), 0, 3));
|
||||||
|
}
|
||||||
|
|
||||||
m_gen->dclInterfaceVar(
|
m_gen->dclInterfaceVar(
|
||||||
op.token().type(), regId, regDim,
|
op.token().type(), regId, regDim,
|
||||||
|
@ -287,17 +287,6 @@ namespace dxvk {
|
|||||||
return DxbcComponentMask(bit::extract(m_token, 4, 5));
|
return DxbcComponentMask(bit::extract(m_token, 4, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Interpolatin mode
|
|
||||||
*
|
|
||||||
* Used by input declarations in pixel shaders.
|
|
||||||
* Undefined for all other instructions.
|
|
||||||
*/
|
|
||||||
DxbcInterpolationMode interpolationMode() const {
|
|
||||||
return static_cast<DxbcInterpolationMode>(
|
|
||||||
bit::extract(m_token, 11, 14));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Operand type
|
* \brief Operand type
|
||||||
*
|
*
|
||||||
|
@ -421,7 +421,7 @@ namespace dxvk {
|
|||||||
Linear = 2,
|
Linear = 2,
|
||||||
LinearCentroid = 3,
|
LinearCentroid = 3,
|
||||||
LinearNoPerspective = 4,
|
LinearNoPerspective = 4,
|
||||||
LinearNoperspectiveCentroid = 5,
|
LinearNoPerspectiveCentroid = 5,
|
||||||
LinearSample = 6,
|
LinearSample = 6,
|
||||||
LinearNoPerspectiveSample = 7,
|
LinearNoPerspectiveSample = 7,
|
||||||
};
|
};
|
||||||
|
@ -58,6 +58,40 @@ namespace dxvk {
|
|||||||
m_module.decorateLocation(m_vRegs.at(regId).valueId, regId);
|
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());
|
||||||
|
|
||||||
|
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);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DxbcInterpolationMode::LinearCentroid:
|
||||||
|
m_module.decorate(m_vRegs.at(regId).valueId, spv::DecorationCentroid);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DxbcInterpolationMode::LinearNoPerspective:
|
||||||
|
m_module.decorate(m_vRegs.at(regId).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);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DxbcInterpolationMode::LinearSample:
|
||||||
|
m_module.decorate(m_vRegs.at(regId).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);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -227,6 +227,15 @@ namespace dxvk {
|
|||||||
m_typeConstDefs.putWord(constIds[i]);
|
m_typeConstDefs.putWord(constIds[i]);
|
||||||
return resultId;
|
return resultId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SpirvModule::decorate(
|
||||||
|
uint32_t object,
|
||||||
|
spv::Decoration decoration) {
|
||||||
|
m_annotations.putIns (spv::OpDecorate, 3);
|
||||||
|
m_annotations.putWord (object);
|
||||||
|
m_annotations.putWord (decoration);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SpirvModule::decorateBinding(
|
void SpirvModule::decorateBinding(
|
||||||
|
@ -84,6 +84,10 @@ namespace dxvk {
|
|||||||
uint32_t constCount,
|
uint32_t constCount,
|
||||||
const uint32_t* constIds);
|
const uint32_t* constIds);
|
||||||
|
|
||||||
|
void decorate(
|
||||||
|
uint32_t object,
|
||||||
|
spv::Decoration decoration);
|
||||||
|
|
||||||
void decorateBinding(
|
void decorateBinding(
|
||||||
uint32_t object,
|
uint32_t object,
|
||||||
uint32_t binding);
|
uint32_t binding);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user