summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-hlsl.cpp
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-02-05 16:23:40 -0800
committerGitHub <noreply@github.com>2025-02-05 16:23:40 -0800
commitd8a8559a5baebb81361b15cf86d28c9e8019b177 (patch)
tree4cf19e1e940dfa3bcaebb05448c2ee3321441015 /source/slang/slang-emit-hlsl.cpp
parentf6cbb81e1c0080518185294ee94705f5e93aa849 (diff)
maxtessfactor attribute should take a floating point value (#6289)
* maxtessfactor attribute should take a floating point value * Support integer value on maxtessfactor
Diffstat (limited to 'source/slang/slang-emit-hlsl.cpp')
-rw-r--r--source/slang/slang-emit-hlsl.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index 53545b31f..9ebec0893 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -60,6 +60,32 @@ void HLSLSourceEmitter::_emitHLSLDecorationSingleInt(
m_writer->emit(")]\n");
}
+void HLSLSourceEmitter::_emitHLSLDecorationSingleFloat(
+ const char* name,
+ IRFunc* entryPoint,
+ IRFloatLit* val)
+{
+ SLANG_UNUSED(entryPoint);
+ SLANG_ASSERT(val);
+
+ m_writer->emit("[");
+ m_writer->emit(name);
+ m_writer->emit("(");
+
+ switch (val->getOp())
+ {
+ default:
+ SLANG_UNEXPECTED("needed a known floating point value");
+ break;
+
+ case kIROp_FloatLit:
+ m_writer->emit(static_cast<IRConstant*>(val)->value.floatVal);
+ break;
+ }
+
+ m_writer->emit(")]\n");
+}
+
void HLSLSourceEmitter::_emitHLSLRegisterSemantic(
LayoutResourceKind kind,
EmitVarChain* chain,
@@ -511,6 +537,12 @@ void HLSLSourceEmitter::emitEntryPointAttributesImpl(
_emitHLSLDecorationSingleString("outputtopology", irFunc, decor->getTopology());
}
+ /* [maxtessfactor(16.0)] */
+ if (auto decor = irFunc->findDecoration<IRMaxTessFactorDecoration>())
+ {
+ _emitHLSLDecorationSingleFloat("maxtessfactor", irFunc, decor->getMaxTessFactor());
+ }
+
/* [outputcontrolpoints(4)] */
if (auto decor = irFunc->findDecoration<IROutputControlPointsDecoration>())
{