diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-02-14 08:27:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-14 08:27:46 -0500 |
| commit | b059de80b7619e4406dbddf26fd7f2fb7ce6a965 (patch) | |
| tree | aee9bf78c48d57a86a6689d347e08561c78fdaaf | |
| parent | 4133192e7d390fb14465fc1ce45a1337b33927b7 (diff) | |
* Add cross compile test (#849)
* Add intrinsic for StructuredBuffer.Load
| -rw-r--r-- | source/slang/hlsl.meta.slang | 1 | ||||
| -rw-r--r-- | source/slang/hlsl.meta.slang.h | 1 | ||||
| -rw-r--r-- | source/slang/parser.cpp | 2 | ||||
| -rw-r--r-- | tests/bugs/vk-structured-buffer-load.hlsl | 3 | ||||
| -rw-r--r-- | tests/bugs/vk-structured-buffer-load.hlsl.glsl | 35 |
5 files changed, 40 insertions, 2 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index 4831e6ce2..fc02395d4 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -52,6 +52,7 @@ struct StructuredBuffer out uint numStructs, out uint stride); + __target_intrinsic(glsl, "$0._data[$1]") T Load(int location); T Load(int location, out uint status); diff --git a/source/slang/hlsl.meta.slang.h b/source/slang/hlsl.meta.slang.h index ef1a6d273..1dcf55f2a 100644 --- a/source/slang/hlsl.meta.slang.h +++ b/source/slang/hlsl.meta.slang.h @@ -61,6 +61,7 @@ SLANG_RAW(" void GetDimensions(\n") SLANG_RAW(" out uint numStructs,\n") SLANG_RAW(" out uint stride);\n") SLANG_RAW("\n") +SLANG_RAW(" __target_intrinsic(glsl, \"$0._data[$1]\") \n") SLANG_RAW(" T Load(int location);\n") SLANG_RAW(" T Load(int location, out uint status);\n") SLANG_RAW("\n") diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index 38a28745a..e2085eb7d 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -4520,7 +4520,7 @@ namespace Slang // __intrinsic_op(<identifier>) // // Finally, we can leave off the specification, so that the - // op name will be derived fromthe function name: + // op name will be derived from the function name: // // __intrinsic_op // diff --git a/tests/bugs/vk-structured-buffer-load.hlsl b/tests/bugs/vk-structured-buffer-load.hlsl index 0acc2e905..e8b1eae86 100644 --- a/tests/bugs/vk-structured-buffer-load.hlsl +++ b/tests/bugs/vk-structured-buffer-load.hlsl @@ -1,4 +1,4 @@ -//TEST_DISABLED:SIMPLE: -profile lib_6_3 -entry HitMain -stage closesthit -target spirv -o vk-structured-buffer-load.spv -D HLSL +//TEST:CROSS_COMPILE: -profile lib_6_3 -entry HitMain -stage closesthit -target spirv-assembly struct ParameterBlockTest { SamplerState sam; @@ -19,5 +19,6 @@ void HitMain(inout RayHitInfoPacked RayData, BuiltInTriangleIntersectionAttribut RayData.PackedHitInfoA.x = HitT; uint offs = 0; float offsfloat = gParamBlock.sbuf.Load(offs); + RayData.PackedHitInfoA.y = offsfloat; } diff --git a/tests/bugs/vk-structured-buffer-load.hlsl.glsl b/tests/bugs/vk-structured-buffer-load.hlsl.glsl new file mode 100644 index 000000000..28703cac4 --- /dev/null +++ b/tests/bugs/vk-structured-buffer-load.hlsl.glsl @@ -0,0 +1,35 @@ +// vk-structured-buffer-load.hlsl.glsl +#version 460 +layout(row_major) uniform; +layout(row_major) buffer; +#extension GL_NV_ray_tracing : require + +layout(std430, binding = 2) readonly buffer _S1 { + float _data[]; +} gParamBlock_sbuf_0; + +struct RayHitInfoPacked_0 +{ + vec4 PackedHitInfoA_0; +}; + +rayPayloadInNV RayHitInfoPacked_0 _S2; + +struct BuiltInTriangleIntersectionAttributes_0 +{ + vec2 barycentrics_0; +}; + +hitAttributeNV BuiltInTriangleIntersectionAttributes_0 _S3; + +void main() +{ + float HitT_0 = (gl_HitTNV); + _S2.PackedHitInfoA_0.x = HitT_0; + + float offsfloat_0 = ((gParamBlock_sbuf_0)._data[(int(uint(0)))]); + + _S2.PackedHitInfoA_0.y = offsfloat_0; + + return; +}
\ No newline at end of file |
