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:
parent
e3533fb634
commit
0843349d72
@ -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:
|
||||||
|
@ -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
|
||||||
*
|
*
|
||||||
|
@ -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,
|
||||||
|
@ -95,11 +95,12 @@ namespace dxvk {
|
|||||||
DxbcComponentMask mask);
|
DxbcComponentMask mask);
|
||||||
|
|
||||||
virtual void dclInterfaceVar(
|
virtual void dclInterfaceVar(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
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,
|
||||||
|
@ -56,11 +56,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void DxbcPsCodeGen::dclInterfaceVar(
|
void DxbcPsCodeGen::dclInterfaceVar(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
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) {
|
||||||
@ -91,8 +92,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxbcPointer DxbcPsCodeGen::ptrInterfaceVar(
|
DxbcPointer DxbcPsCodeGen::ptrInterfaceVar(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
uint32_t regId) {
|
uint32_t regId) {
|
||||||
switch (regType) {
|
switch (regType) {
|
||||||
case DxbcOperandType::Input:
|
case DxbcOperandType::Input:
|
||||||
return m_vRegs.at(regId);
|
return m_vRegs.at(regId);
|
||||||
@ -109,9 +110,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxbcPointer DxbcPsCodeGen::ptrInterfaceVarIndexed(
|
DxbcPointer DxbcPsCodeGen::ptrInterfaceVarIndexed(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
uint32_t regId,
|
uint32_t regId,
|
||||||
const DxbcValue& index) {
|
const DxbcValue& index) {
|
||||||
throw DxvkError(str::format(
|
throw DxvkError(str::format(
|
||||||
"DxbcPsCodeGen::ptrInterfaceVarIndexed:\n",
|
"DxbcPsCodeGen::ptrInterfaceVarIndexed:\n",
|
||||||
"Pixel shaders do not support indexed interface variables"));
|
"Pixel shaders do not support indexed interface variables"));
|
||||||
@ -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();
|
||||||
|
@ -16,20 +16,21 @@ namespace dxvk {
|
|||||||
~DxbcPsCodeGen();
|
~DxbcPsCodeGen();
|
||||||
|
|
||||||
void dclInterfaceVar(
|
void dclInterfaceVar(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
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,
|
||||||
uint32_t regId);
|
uint32_t regId);
|
||||||
|
|
||||||
DxbcPointer ptrInterfaceVarIndexed(
|
DxbcPointer ptrInterfaceVarIndexed(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
uint32_t regId,
|
uint32_t regId,
|
||||||
const DxbcValue& index);
|
const DxbcValue& index);
|
||||||
|
|
||||||
SpirvCodeBuffer finalize() final;
|
SpirvCodeBuffer finalize() final;
|
||||||
|
|
||||||
|
@ -62,11 +62,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void DxbcVsCodeGen::dclInterfaceVar(
|
void DxbcVsCodeGen::dclInterfaceVar(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
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) {
|
||||||
@ -107,8 +108,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxbcPointer DxbcVsCodeGen::ptrInterfaceVar(
|
DxbcPointer DxbcVsCodeGen::ptrInterfaceVar(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
uint32_t regId) {
|
uint32_t regId) {
|
||||||
switch (regType) {
|
switch (regType) {
|
||||||
case DxbcOperandType::Input:
|
case DxbcOperandType::Input:
|
||||||
return m_vRegs.at(regId);
|
return m_vRegs.at(regId);
|
||||||
@ -125,9 +126,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxbcPointer DxbcVsCodeGen::ptrInterfaceVarIndexed(
|
DxbcPointer DxbcVsCodeGen::ptrInterfaceVarIndexed(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
uint32_t regId,
|
uint32_t regId,
|
||||||
const DxbcValue& index) {
|
const DxbcValue& index) {
|
||||||
throw DxvkError(str::format(
|
throw DxvkError(str::format(
|
||||||
"DxbcVsCodeGen::ptrInterfaceVarIndexed:\n",
|
"DxbcVsCodeGen::ptrInterfaceVarIndexed:\n",
|
||||||
"Vertex shaders do not support indexed interface variables"));
|
"Vertex shaders do not support indexed interface variables"));
|
||||||
|
@ -16,20 +16,21 @@ namespace dxvk {
|
|||||||
~DxbcVsCodeGen();
|
~DxbcVsCodeGen();
|
||||||
|
|
||||||
void dclInterfaceVar(
|
void dclInterfaceVar(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
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,
|
||||||
uint32_t regId);
|
uint32_t regId);
|
||||||
|
|
||||||
DxbcPointer ptrInterfaceVarIndexed(
|
DxbcPointer ptrInterfaceVarIndexed(
|
||||||
DxbcOperandType regType,
|
DxbcOperandType regType,
|
||||||
uint32_t regId,
|
uint32_t regId,
|
||||||
const DxbcValue& index);
|
const DxbcValue& index);
|
||||||
|
|
||||||
SpirvCodeBuffer finalize() final;
|
SpirvCodeBuffer finalize() final;
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user