HLSL: pass tessellation execution modes through to SPIR-V
The SPIR-V generator had assumed tessellation modes such as primitive type and vertex order would only appear in tess eval (domain) shaders. SPIR-V allows either, and HLSL allows and possibly requires them to be in the hull shader. This change: 1. Passes them through for either tessellation stage, and, 2. Does not set up defaults in the domain stage for HLSl compilation, to avoid conflicting definitions.
This commit is contained in:
@@ -869,14 +869,20 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
|
||||
builder.addCapability(spv::CapabilityShader);
|
||||
break;
|
||||
|
||||
case EShLangTessEvaluation:
|
||||
case EShLangTessControl:
|
||||
builder.addCapability(spv::CapabilityTessellation);
|
||||
builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices, glslangIntermediate->getVertices());
|
||||
break;
|
||||
|
||||
case EShLangTessEvaluation:
|
||||
builder.addCapability(spv::CapabilityTessellation);
|
||||
switch (glslangIntermediate->getInputPrimitive()) {
|
||||
glslang::TLayoutGeometry primitive;
|
||||
|
||||
if (glslangIntermediate->getStage() == EShLangTessControl) {
|
||||
builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices, glslangIntermediate->getVertices());
|
||||
primitive = glslangIntermediate->getOutputPrimitive();
|
||||
} else {
|
||||
primitive = glslangIntermediate->getInputPrimitive();
|
||||
}
|
||||
|
||||
switch (primitive) {
|
||||
case glslang::ElgTriangles: mode = spv::ExecutionModeTriangles; break;
|
||||
case glslang::ElgQuads: mode = spv::ExecutionModeQuads; break;
|
||||
case glslang::ElgIsolines: mode = spv::ExecutionModeIsolines; break;
|
||||
|
||||
Reference in New Issue
Block a user