[SPIR-V] Apply nointerpolation to mesh output (#6260)

Mesh shader output variables may be decorated with the `nointerpolation`
attribute, which should be translated to a `Flat` decoration in the
SPIR-V backend.

Fixes #6250
This commit is contained in:
Natalie Chouinard 2024-02-08 14:44:13 -05:00 коммит произвёл GitHub
Родитель f59df3d3e8
Коммит a6ac52720d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 19 добавлений и 3 удалений

Просмотреть файл

@ -3310,10 +3310,11 @@ SpirvVariable *DeclResultIdMapper::createSpirvInterfaceVariable(
}
}
// Decorate with interpolation modes for pixel shader input variables
// or vertex shader output variables.
// Decorate with interpolation modes for pixel shader input variables, vertex
// shader output variables, or mesh shader output variables.
if ((spvContext.isPS() && stageVarData.sigPoint->IsInput()) ||
(spvContext.isVS() && stageVarData.sigPoint->IsOutput()))
(spvContext.isVS() && stageVarData.sigPoint->IsOutput()) ||
(spvContext.isMS() && stageVarData.sigPoint->IsOutput()))
decorateInterpolationMode(stageVarData.decl, stageVarData.type, varInstr,
*stageVarData.semantic);

Просмотреть файл

@ -0,0 +1,15 @@
// RUN: %dxc -T ms_6_5 -E main -fcgl %s -spirv | FileCheck %s
struct MeshOutput {
float4 PositionCS : SV_POSITION;
// CHECK: OpDecorate %out_var_VERTEX_INDEX Flat
nointerpolation uint VertexIndex : VERTEX_INDEX;
};
[outputtopology("triangle")]
[numthreads(128, 1, 1)]
void main(
uint gtid : SV_GroupThreadID,
uint gid : SV_GroupID,
out indices uint3 triangles[128],
out vertices MeshOutput vertices[64]) {}