summaryrefslogtreecommitdiff
path: root/tests/pipeline/rasterization/mesh/nested-component-write.slang
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2022-11-16 09:49:06 +0800
committerGitHub <noreply@github.com>2022-11-16 09:49:06 +0800
commit1643471da0d6239177d11b0301c26d1adf95c0fb (patch)
tree9b8fddf92a5f817541e055a2657f9b0a00f90069 /tests/pipeline/rasterization/mesh/nested-component-write.slang
parent4917d71100aafcc38a81cd99d2a44a4cb3a89a0c (diff)
Mesh shader support (#2464)
* Add gdb generated files to .gitignore * Switch to c++17 TODO: Ellie update coding style doc * WIP mesh shaders * Add MeshOutputType and mesh output decorations * Lift array type layout creation out of _createTypeLayout in preparation for sharing it elsewhere * Initial pass at GLSL legalization for mesh shaders * Create output types for builtin mesh outputs This should be rendered as an out paramter block * Handle writes to member fields in mesh shader output * Per primitive output from mesh shaders * Add mesh shader tests * Redeclare mesh output builtins * Remove unused instruction * Emit explicit mesh output max max size * Add unimplemented warning for array members in mesh output * Implement mesh output splitting for GLSL in terms of getSubscriptVal * Allow HLSL syntax for mesh output modifiers * Improve error messages for mesh output * Add test for HLSL style mesh output syntax * Emit explicit mesh output indices max size * HLSL generation support for mesh shaders * Better errors for mesh shader misuse * Neaten comments * Regenerate vs2019 project files * Fix build on vs2019 * Retreat on c++17 Will make the change in a separate PR * slang-glslang binary dep 11.10.0 -> 11.12.0-32 * Fixes for msvc compiler * Update msvc project
Diffstat (limited to 'tests/pipeline/rasterization/mesh/nested-component-write.slang')
-rw-r--r--tests/pipeline/rasterization/mesh/nested-component-write.slang51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/pipeline/rasterization/mesh/nested-component-write.slang b/tests/pipeline/rasterization/mesh/nested-component-write.slang
new file mode 100644
index 000000000..68bb6dfb9
--- /dev/null
+++ b/tests/pipeline/rasterization/mesh/nested-component-write.slang
@@ -0,0 +1,51 @@
+// nested-component-write.slang
+
+// This tests that writing to individual components nested structs works for
+// mesh shader outputs.
+
+//TEST:CROSS_COMPILE:-target spirv -profile glsl_450+spirv_1_4 -entry main -stage mesh
+
+struct Foo
+{
+ float4 pos : SV_Position;
+ Bar bar;
+};
+
+struct Bar
+{
+ Baz baz : Color;
+};
+
+struct Baz
+{
+ float3 color;
+};
+
+struct Vertex
+{
+ Foo foo;
+};
+
+const static uint MAX_VERTS = 3;
+const static uint MAX_PRIMS = 1;
+
+[outputtopology("triangle")]
+[numthreads(3, 1, 1)]
+void main(
+ in uint tig : SV_GroupIndex,
+ out Vertices<Vertex, MAX_VERTS> verts,
+ out Indices<uint3, MAX_PRIMS> triangles
+ )
+{
+ SetMeshOutputCounts(3, 1);
+
+ if(tig < 3) {
+ verts[tig].foo.pos = float4(0, 0, 0, 1);
+ verts[tig].foo.bar.baz.color = float3(1, 2, 3);
+ }
+
+ if(tig < 1) {
+ triangles[tig] = uint3(0,1,2);
+ }
+}
+