yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
313677160
master
1// precompiled-module-library-resource.slang 2 3// Compile this library source with embedded DXIL and SPIRV options. 4// Tests that modules can be precompiled to downstream IR despite having resource 5// parameters or return types. 6 7//TEST(windows):COMPILE: tests/library/precompiled-module-library-resource.slang -o tests/library/precompiled-module-library-resource-dxil.slang-module -target dxil -embed-downstream-ir -profile lib_6_6 -incomplete-library 8//TEST:COMPILE: tests/library/precompiled-module-library-resource.slang -o tests/library/precompiled-module-library-resource-spv.slang-module -target spirv -embed-downstream-ir -incomplete-library 9 10module "precompiled-module-library-resource"; 11 12public struct ResourceStruct { 13 public StructuredBuffer<int> buffer; 14 15 __init(StructuredBuffer<int> bufferIn) 16 { 17 buffer = bufferIn; 18 } 19}; 20 21public int resource_in_parameter(StructuredBuffer<int> buffer) 22{ 23 return buffer[0]; 24} 25 26public int resource_in_struct_parameter(ResourceStruct rs) 27{ 28 return rs.buffer[0]; 29} 30 31internal float matrix_in_parameter_internal(float2x2 matrix) 32{ 33 return matrix[0][0]; 34} 35 36public float matrix_in_parameter_public(float a) 37{ 38 float2x2 matrix = {a, .2, .3, .4}; 39 return matrix_in_parameter_internal(matrix); 40}