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

[dxbc] Implemented DclHsMaxTessFactor

This commit is contained in:
Philip Rebohle 2018-03-10 15:02:27 +01:00
parent afaa3b5a30
commit 28880d0fa8
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 32 additions and 7 deletions

View File

@ -247,6 +247,9 @@ namespace dxvk {
case DxbcOpcode::DclOutputControlPointCount:
return this->emitDclOutputControlPointCount(ins);
case DxbcOpcode::DclHsMaxTessFactor:
return this->emitDclHsMaxTessFactor(ins);
case DxbcOpcode::DclTessDomain:
return this->emitDclTessDomain(ins);
@ -1109,6 +1112,11 @@ namespace dxvk {
}
void DxbcCompiler::emitDclHsMaxTessFactor(const DxbcShaderInstruction& ins) {
m_hs.maxTessFactor = ins.imm[0].f32;
}
void DxbcCompiler::emitDclTessDomain(const DxbcShaderInstruction& ins) {
const spv::ExecutionMode executionMode = [&] {
switch (ins.controls.tessDomain) {
@ -5033,6 +5041,12 @@ namespace dxvk {
const uint32_t tessFactorArrayIndex
= m_module.constu32(tessFactor.index);
// Apply global tess factor limit
DxbcRegisterValue tessValue = emitRegisterExtract(value, mask);
tessValue.id = m_module.opFClamp(getVectorTypeId(tessValue.type),
tessValue.id, m_module.constf32(0.0f),
m_module.constf32(m_hs.maxTessFactor));
DxbcRegisterPointer ptr;
ptr.type.ctype = DxbcScalarType::Float32;
ptr.type.ccount = 1;
@ -5043,7 +5057,7 @@ namespace dxvk {
tessFactor.array, 1,
&tessFactorArrayIndex);
emitValueStore(ptr, emitRegisterExtract(value, mask),
emitValueStore(ptr, tessValue,
DxbcRegMask(true, false, false, false));
} else {
Logger::warn(str::format(

View File

@ -200,6 +200,8 @@ namespace dxvk {
DxbcCompilerHsPhase currPhaseType = DxbcCompilerHsPhase::None;
size_t currPhaseId = 0;
float maxTessFactor = 64.0f;
uint32_t vertexCountIn = 0;
uint32_t vertexCountOut = 0;
@ -484,6 +486,9 @@ namespace dxvk {
void emitDclOutputControlPointCount(
const DxbcShaderInstruction& ins);
void emitDclHsMaxTessFactor(
const DxbcShaderInstruction& ins);
void emitDclTessDomain(
const DxbcShaderInstruction& ins);

View File

@ -273,9 +273,12 @@ namespace dxvk {
* \brief Immediate value
*
* Immediate argument represented either
* as a 32-bit or 64-bit unsigned integer.
* as a 32-bit or 64-bit unsigned integer,
* or a 32-bit or 32-bit floating point number.
*/
union DxbcImmediate {
float f32;
double f64;
uint32_t u32;
uint64_t u64;
};

View File

@ -726,7 +726,9 @@ namespace dxvk {
/* DclTessOutputPrimitive */
{ 0, DxbcInstClass::Declaration },
/* DclHsMaxTessFactor */
{ },
{ 1, DxbcInstClass::Declaration, {
{ DxbcOperandKind::Imm32, DxbcScalarType::Float32 },
} },
/* DclHsForkPhaseInstanceCount */
{ 1, DxbcInstClass::HullShaderInstCnt, {
{ DxbcOperandKind::Imm32, DxbcScalarType::Uint32 },

View File

@ -23,8 +23,9 @@ namespace dxvk {
}
} else {
// Global resource slots
// 0 - 7: Uniform access views
// 8 - 11: Stream output buffers
// 0 - 7: Unordered access views
// 8 - 15: UAV counter buffers
// 16 - 19: Stream output buffers
// Per-stage resource slots:
// 0 - 13: Constant buffers
// 14 - 29: Samplers