diff --git a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs index 849cff55..269b2adc 100644 --- a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs @@ -70,6 +70,48 @@ namespace ComputeSharp.Tests } } + // See https://github.com/Sergio0694/ComputeSharp/issues/313 + [TestMethod] + public void ReservedKeywordsFromHlslTypesAndBuiltInValues() + { + _ = ReflectionServices.GetShaderInfo(); + } + + [AutoConstructor] + public readonly partial struct ReservedKeywordsFromHlslTypesAndBuiltInValuesShader : IComputeShader + { + public readonly ReadWriteBuffer fragmentKeyword; + public readonly ReadWriteBuffer compile_fragment; + public readonly ReadWriteBuffer shaderProfile; + public readonly ReadWriteBuffer maxvertexcount; + public readonly ReadWriteBuffer TriangleStream; + public readonly ReadWriteBuffer Buffer; + public readonly ReadWriteBuffer ByteAddressBuffer; + public readonly int ConsumeStructuredBuffer; + public readonly int RWTexture2D; + public readonly int Texture2D; + public readonly int Texture2DArray; + public readonly int SV_DomainLocation; + public readonly int SV_GroupIndex; + public readonly int SV_OutputControlPointID; + public readonly int SV_StencilRef; + + public void Execute() + { + float sum = ConsumeStructuredBuffer + RWTexture2D + Texture2D + Texture2DArray; + + sum += SV_DomainLocation + SV_GroupIndex + SV_OutputControlPointID + SV_StencilRef; + + fragmentKeyword[ThreadIds.X] = sum; + compile_fragment[ThreadIds.X] = sum; + shaderProfile[ThreadIds.X] = sum; + maxvertexcount[ThreadIds.X] = sum; + TriangleStream[ThreadIds.X] = sum; + Buffer[ThreadIds.X] = sum; + ByteAddressBuffer[ThreadIds.X] = sum; + } + } + [TestMethod] public void ReservedKeywordsPrecompiled() {