1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-11 10:24:10 +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: case DxbcOpcode::DclOutputControlPointCount:
return this->emitDclOutputControlPointCount(ins); return this->emitDclOutputControlPointCount(ins);
case DxbcOpcode::DclHsMaxTessFactor:
return this->emitDclHsMaxTessFactor(ins);
case DxbcOpcode::DclTessDomain: case DxbcOpcode::DclTessDomain:
return this->emitDclTessDomain(ins); 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) { void DxbcCompiler::emitDclTessDomain(const DxbcShaderInstruction& ins) {
const spv::ExecutionMode executionMode = [&] { const spv::ExecutionMode executionMode = [&] {
switch (ins.controls.tessDomain) { switch (ins.controls.tessDomain) {
@ -5033,6 +5041,12 @@ namespace dxvk {
const uint32_t tessFactorArrayIndex const uint32_t tessFactorArrayIndex
= m_module.constu32(tessFactor.index); = 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; DxbcRegisterPointer ptr;
ptr.type.ctype = DxbcScalarType::Float32; ptr.type.ctype = DxbcScalarType::Float32;
ptr.type.ccount = 1; ptr.type.ccount = 1;
@ -5043,7 +5057,7 @@ namespace dxvk {
tessFactor.array, 1, tessFactor.array, 1,
&tessFactorArrayIndex); &tessFactorArrayIndex);
emitValueStore(ptr, emitRegisterExtract(value, mask), emitValueStore(ptr, tessValue,
DxbcRegMask(true, false, false, false)); DxbcRegMask(true, false, false, false));
} else { } else {
Logger::warn(str::format( Logger::warn(str::format(

View File

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

View File

@ -273,9 +273,12 @@ namespace dxvk {
* \brief Immediate value * \brief Immediate value
* *
* Immediate argument represented either * 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 { union DxbcImmediate {
float f32;
double f64;
uint32_t u32; uint32_t u32;
uint64_t u64; uint64_t u64;
}; };

View File

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

View File

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