diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-10-03 00:05:39 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-02 09:05:39 -0700 |
| commit | cea230bc686ef87db4cff47e367bbf824b90377d (patch) | |
| tree | 4a99efe2c4a3a04a47842ce07f05953f1b1b5880 | |
| parent | ccf2611c024ab12dcccd978f3f501d4ee9fc52bc (diff) | |
Use const ref for mesh payload (#3254)
* Use const ref for mesh payload
* Test mesh payload hlsl output
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 12 | ||||
| -rw-r--r-- | tests/pipeline/rasterization/mesh/task-simple.slang | 4 |
2 files changed, 9 insertions, 7 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 09992fb14..065263a59 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -2527,19 +2527,17 @@ void addCallArgsForParam( /// Compute the direction for a parameter based on its declaration ParameterDirection getParameterDirection(VarDeclBase* paramDecl) { - if( paramDecl->hasModifier<RefModifier>() + if( paramDecl->hasModifier<RefModifier>()) + { + return kParameterDirection_Ref; + } + if (paramDecl->hasModifier<ConstRefModifier>() || paramDecl->hasModifier<HLSLPayloadModifier>() ) { - // The AST specified `ref` or `payload`: - // The payload types are a groupshared variable, and we really don't // want to copy that into registers in every invocation on platforms // where this matters, so treat them as by-reference here. - return kParameterDirection_Ref; - } - if (paramDecl->hasModifier<ConstRefModifier>()) - { return kParameterDirection_ConstRef; } if( paramDecl->hasModifier<InOutModifier>() ) diff --git a/tests/pipeline/rasterization/mesh/task-simple.slang b/tests/pipeline/rasterization/mesh/task-simple.slang index 67bd729b1..58ec9a527 100644 --- a/tests/pipeline/rasterization/mesh/task-simple.slang +++ b/tests/pipeline/rasterization/mesh/task-simple.slang @@ -1,5 +1,6 @@ //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -task -output-using-type -dx12 -use-dxil -profile sm_6_6 -render-features mesh-shader //TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -task -output-using-type -vk -profile glsl_450+spirv_1_4 -render-features mesh-shader +//TEST:SIMPLE(filecheck=HLSL):-target hlsl -entry meshMain -stage mesh // To test a simple mesh shader, we'll generate 4 triangles, the vertices of // each one will hold the triangle index and a value (the square). The fragment @@ -69,6 +70,9 @@ const static uint MAX_PRIMS = 4; void meshMain( in uint tig : SV_GroupIndex, in payload MeshPayload meshPayload, + // Check that we correctly generate the specific 'in payload' that HLSL + // requires: + // HLSL: , in payload MeshPayload out Vertices<Vertex, MAX_VERTS> verts, out Indices<uint3, MAX_PRIMS> triangles) { |
