mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 11:52:12 +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;
|
||||
|
||||
if (hasInterpolationMode)
|
||||
im = op.token().interpolationMode();
|
||||
if (hasInterpolationMode) {
|
||||
im = static_cast<DxbcInterpolationMode>(
|
||||
bit::extract(ins.token().control(), 0, 3));
|
||||
}
|
||||
|
||||
m_gen->dclInterfaceVar(
|
||||
op.token().type(), regId, regDim,
|
||||
|
@ -287,17 +287,6 @@ namespace dxvk {
|
||||
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
|
||||
*
|
||||
|
@ -421,7 +421,7 @@ namespace dxvk {
|
||||
Linear = 2,
|
||||
LinearCentroid = 3,
|
||||
LinearNoPerspective = 4,
|
||||
LinearNoperspectiveCentroid = 5,
|
||||
LinearNoPerspectiveCentroid = 5,
|
||||
LinearSample = 6,
|
||||
LinearNoPerspectiveSample = 7,
|
||||
};
|
||||
|
@ -58,6 +58,40 @@ namespace dxvk {
|
||||
m_module.decorateLocation(m_vRegs.at(regId).valueId, regId);
|
||||
m_module.setDebugName(m_vRegs.at(regId).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);
|
||||
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;
|
||||
|
||||
|
@ -227,6 +227,15 @@ namespace dxvk {
|
||||
m_typeConstDefs.putWord(constIds[i]);
|
||||
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(
|
||||
|
@ -84,6 +84,10 @@ namespace dxvk {
|
||||
uint32_t constCount,
|
||||
const uint32_t* constIds);
|
||||
|
||||
void decorate(
|
||||
uint32_t object,
|
||||
spv::Decoration decoration);
|
||||
|
||||
void decorateBinding(
|
||||
uint32_t object,
|
||||
uint32_t binding);
|
||||
|
Loading…
x
Reference in New Issue
Block a user