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

[dxbc] Added interpolation mode decoder

This commit is contained in:
Philip Rebohle 2017-12-08 13:24:08 +01:00
parent e3533fb634
commit 0843349d72
10 changed files with 95 additions and 46 deletions

View File

@ -96,9 +96,18 @@ namespace dxvk {
if (hasSv) if (hasSv)
sv = ins.readEnum<DxbcSystemValue>(op.length()); sv = ins.readEnum<DxbcSystemValue>(op.length());
const bool hasInterpolationMode =
opcode == DxbcOpcode::DclInputPs
|| opcode == DxbcOpcode::DclInputPsSiv;
DxbcInterpolationMode im = DxbcInterpolationMode::Undefined;
if (hasInterpolationMode)
im = op.token().interpolationMode();
m_gen->dclInterfaceVar( m_gen->dclInterfaceVar(
op.token().type(), regId, regDim, op.token().type(), regId, regDim,
op.token().componentMask(), sv); op.token().componentMask(), sv, im);
} break; } break;
default: default:

View File

@ -287,6 +287,17 @@ 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
* *

View File

@ -415,6 +415,18 @@ namespace dxvk {
}; };
enum class DxbcInterpolationMode : uint32_t {
Undefined = 0,
Constant = 1,
Linear = 2,
LinearCentroid = 3,
LinearNoPerspective = 4,
LinearNoperspectiveCentroid = 5,
LinearSample = 6,
LinearNoPerspectiveSample = 7,
};
enum class DxbcGlobalFlag : uint32_t { enum class DxbcGlobalFlag : uint32_t {
RefactoringAllowed = 0, RefactoringAllowed = 0,
DoublePrecision = 1, DoublePrecision = 1,

View File

@ -99,7 +99,8 @@ namespace dxvk {
uint32_t regId, uint32_t regId,
uint32_t regDim, uint32_t regDim,
DxbcComponentMask regMask, DxbcComponentMask regMask,
DxbcSystemValue sv) = 0; DxbcSystemValue sv,
DxbcInterpolationMode im) = 0;
virtual DxbcPointer ptrInterfaceVar( virtual DxbcPointer ptrInterfaceVar(
DxbcOperandType regType, DxbcOperandType regType,

View File

@ -60,7 +60,8 @@ namespace dxvk {
uint32_t regId, uint32_t regId,
uint32_t regDim, uint32_t regDim,
DxbcComponentMask regMask, DxbcComponentMask regMask,
DxbcSystemValue sv) { DxbcSystemValue sv,
DxbcInterpolationMode im) {
switch (regType) { switch (regType) {
case DxbcOperandType::Input: { case DxbcOperandType::Input: {
if (m_vRegs.at(regId).valueId == 0) { if (m_vRegs.at(regId).valueId == 0) {
@ -140,6 +141,7 @@ namespace dxvk {
spv::ExecutionModelFragment, "main", spv::ExecutionModelFragment, "main",
m_entryPointInterfaces.size(), m_entryPointInterfaces.size(),
m_entryPointInterfaces.data()); m_entryPointInterfaces.data());
m_module.setOriginUpperLeft(m_entryPointId);
m_module.setDebugName(m_entryPointId, "main"); m_module.setDebugName(m_entryPointId, "main");
return m_module.compile(); return m_module.compile();

View File

@ -20,7 +20,8 @@ namespace dxvk {
uint32_t regId, uint32_t regId,
uint32_t regDim, uint32_t regDim,
DxbcComponentMask regMask, DxbcComponentMask regMask,
DxbcSystemValue sv); DxbcSystemValue sv,
DxbcInterpolationMode im);
DxbcPointer ptrInterfaceVar( DxbcPointer ptrInterfaceVar(
DxbcOperandType regType, DxbcOperandType regType,

View File

@ -66,7 +66,8 @@ namespace dxvk {
uint32_t regId, uint32_t regId,
uint32_t regDim, uint32_t regDim,
DxbcComponentMask regMask, DxbcComponentMask regMask,
DxbcSystemValue sv) { DxbcSystemValue sv,
DxbcInterpolationMode im) {
switch (regType) { switch (regType) {
case DxbcOperandType::Input: { case DxbcOperandType::Input: {
if (m_vRegs.at(regId).valueId == 0) { if (m_vRegs.at(regId).valueId == 0) {

View File

@ -20,7 +20,8 @@ namespace dxvk {
uint32_t regId, uint32_t regId,
uint32_t regDim, uint32_t regDim,
DxbcComponentMask regMask, DxbcComponentMask regMask,
DxbcSystemValue sv); DxbcSystemValue sv,
DxbcInterpolationMode im);
DxbcPointer ptrInterfaceVar( DxbcPointer ptrInterfaceVar(
DxbcOperandType regType, DxbcOperandType regType,

View File

@ -95,6 +95,14 @@ namespace dxvk {
} }
void SpirvModule::setOriginUpperLeft(
uint32_t entryPointId) {
m_execModeInfo.putIns (spv::OpExecutionMode, 3);
m_execModeInfo.putWord(entryPointId);
m_execModeInfo.putWord(spv::ExecutionModeOriginUpperLeft);
}
void SpirvModule::setDebugName( void SpirvModule::setDebugName(
uint32_t expressionId, uint32_t expressionId,
const char* debugName) { const char* debugName) {

View File

@ -46,6 +46,9 @@ namespace dxvk {
uint32_t y, uint32_t y,
uint32_t z); uint32_t z);
void setOriginUpperLeft(
uint32_t entryPointId);
void setDebugName( void setDebugName(
uint32_t expressionId, uint32_t expressionId,
const char* debugName); const char* debugName);