yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1//TEST:SIMPLE(filecheck=CHECK_ANY):-target spirv-assembly -entry computeMain -stage compute 2//TEST:SIMPLE(filecheck=CHECK_ANY):-target spirv-assembly -entry computeMain -stage compute -denorm-mode-fp16 any 3//TEST:SIMPLE(filecheck=CHECK_PRESERVE_SPIRV):-target spirv-assembly -entry computeMain -stage compute -denorm-mode-fp32 preserve 4//TEST:SIMPLE(filecheck=CHECK_FTZ_SPIRV):-target spirv-assembly -entry computeMain -stage compute -denorm-mode-fp32 ftz 5 6//TEST:SIMPLE(filecheck=CHECK_ANY):-target dxil-assembly -entry computeMain -stage compute -profile cs_6_2 7//TEST:SIMPLE(filecheck=CHECK_ANY):-target dxil-assembly -entry computeMain -stage compute -profile cs_6_2 -denorm-mode-fp32 any 8//TEST:SIMPLE(filecheck=CHECK_PRESERVE_DXIL):-target dxil-assembly -entry computeMain -stage compute -profile cs_6_2 -denorm-mode-fp32 preserve 9//TEST:SIMPLE(filecheck=CHECK_FTZ_DXIL):-target dxil-assembly -entry computeMain -stage compute -profile cs_6_2 -denorm-mode-fp32 ftz 10 11// Capability shaderDenormPreserveFloat32 is VK_FALSE on the Vulkan device used for CI testing, resulting in 12// runtime error VUID-RuntimeSpirv-shaderDenormPreserveFloat32-06297 during CI testing 13//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=PRESERVE):-vk -compute -Xslang -denorm-mode-fp32 -Xslang preserve 14// Capability shaderDenormFlushToZeroFloat32 is VK_FALSE on the Vulkan device used for CI testing, resulting in 15// runtime error VUID-RuntimeSpirv-shaderDenormFlushToZeroFloat32-06300 during CI testing 16//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=FTZ):-vk -compute -Xslang -denorm-mode-fp32 -Xslang ftz 17 18//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=PRESERVE):-slang -compute -dx12 -profile cs_6_2 -shaderobj -Xslang -denorm-mode-fp32 -Xslang preserve 19//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=FTZ):-slang -compute -dx12 -profile cs_6_2 -Xslang -denorm-mode-fp32 -Xslang ftz 20 21// CHECK_ANY-NOT: DenormPreserve 22// CHECK_ANY-NOT: DenormFlushToZero 23 24// CHECK_PRESERVE_SPIRV: OpExecutionMode %computeMain DenormPreserve 32 25// CHECK_PRESERVE_SPIRV-NOT: OpExecutionMode %computeMain DenormPreserve 16 26// CHECK_PRESERVE_SPIRV-NOT: OpExecutionMode %computeMain DenormPreserve 64 27// CHECK_PRESERVE_SPIRV-NOT: DenormFlushToZero 28 29// CHECK_FTZ_SPIRV: OpExecutionMode %computeMain DenormFlushToZero 32 30// CHECK_FTZ_SPIRV-NOT: OpExecutionMode %computeMain DenormFlushToZero 16 31// CHECK_FTZ_SPIRV-NOT: OpExecutionMode %computeMain DenormFlushToZero 64 32// CHECK_FTZ_SPIRV-NOT: DenormPreserve 33 34// CHECK_ANY-NOT: preserve 35// CHECK_ANY-NOT: ftz 36 37// CHECK_PRESERVE_DXIL: attributes #0 = { "fp32-denorm-mode"="preserve" } 38// CHECK_PRESERVE_DXIL-NOT: ftz 39 40// CHECK_FTZ_DXIL: attributes #0 = { "fp32-denorm-mode"="ftz" } 41// CHECK_FTZ_DXIL-NOT: preserve 42 43// In preserve mode, denormalized numbers should be preserved 44// PRESERVE: CCCCD 45 46// In flush-to-zero mode, denormalized numbers should be flushed to zero 47// FTZ: 0 48 49// Smallest normal fp32 50//TEST_INPUT: set inputBuffer = ubuffer(data=[0x00800000], stride=4) 51RWStructuredBuffer<float> inputBuffer; 52 53//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer 54RWStructuredBuffer<float> outputBuffer; 55 56[shader("compute")] 57[numthreads(1, 1, 1)] 58void computeMain() 59{ 60 float smallestNormal = inputBuffer[0]; 61 float denormal = smallestNormal / 10; 62 63 outputBuffer[0] = denormal; 64}