diff options
| author | Yong He <yonghe@outlook.com> | 2023-01-23 06:59:25 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-23 06:59:25 -0800 |
| commit | 46a4d98baa1d43b33717b4377aefeeaf46b9c2ff (patch) | |
| tree | c89f3a1c416330f859887d00f896b18bcc7488a5 /tests | |
| parent | 263ca18ea516cfce43fda703c0a411aaf1938e42 (diff) | |
Full address insts elimination for backward autodiff. (#2604)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
14 files changed, 159 insertions, 87 deletions
diff --git a/tests/autodiff/reverse-struct-multi-write.slang b/tests/autodiff/reverse-struct-multi-write.slang new file mode 100644 index 000000000..dd12c7d3d --- /dev/null +++ b/tests/autodiff/reverse-struct-multi-write.slang @@ -0,0 +1,48 @@ + +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +struct A : IDifferentiable +{ + float x; + float y; +}; + +[BackwardDifferentiable] +A f(A a) +{ + // Read/writes to local struct variables won't be SSA'd out by default. + // The backward diff preparation pass will kick in to create temp vars for them. + A aout; + aout.y = 2 * a.x; + aout.y = aout.y + 2 * a.x; + aout.x = aout.y + 5 * a.x; + + // The result should be equivalent to: + /* + A aout; + var tmp = 2 * a.x; + tmp = tmp + 2 * a.x; + aout.y = tmp; + aout.x = tmp + 5 * a.x; + */ + return aout; + +} + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + A a = {1.0, 2.0}; + + var dpa = diffPair(a); + + A.Differential dout = {1.0, 1.0}; + + __bwd_diff(f)(dpa, dout); + outputBuffer[0] = dpa.d.x; // Expect: 13 + outputBuffer[1] = dpa.d.y; // Expect: 0 +} diff --git a/tests/autodiff/reverse-struct-multi-write.slang.expected.txt b/tests/autodiff/reverse-struct-multi-write.slang.expected.txt new file mode 100644 index 000000000..403f2ffd4 --- /dev/null +++ b/tests/autodiff/reverse-struct-multi-write.slang.expected.txt @@ -0,0 +1,6 @@ +type: float +13.000000 +0.000000 +0.000000 +0.000000 +0.000000 diff --git a/tests/compute/half-texture.slang.glsl b/tests/compute/half-texture.slang.glsl index 88f585378..0eccccaaf 100644 --- a/tests/compute/half-texture.slang.glsl +++ b/tests/compute/half-texture.slang.glsl @@ -21,20 +21,23 @@ layout(std430, binding = 0) buffer _S1 { int _data[]; } outputBuffer_0; -layout(local_size_x = 4, local_size_y = 4, local_size_z = 1) in;void main() +layout(local_size_x = 4, local_size_y = 4, local_size_z = 1) in; +void main() { ivec2 pos_0 = ivec2(gl_GlobalInvocationID.xy); const float _S2 = 1.00000000000000000000 / 3.00000000000000000000; - ivec2 pos2_0 = ivec2(3 - pos_0.y, 3 - pos_0.x); + int _S3 = pos_0.y; + int _S4 = pos_0.x; + ivec2 pos2_0 = ivec2(3 - _S3, 3 - _S4); float16_t h_0 = (float16_t(imageLoad((halfTexture_0), ivec2((uvec2(pos2_0)))).x)); f16vec2 h2_0 = (f16vec2(imageLoad((halfTexture2_0), ivec2((uvec2(pos2_0)))).xy)); f16vec4 h4_0 = (f16vec4(imageLoad((halfTexture4_0), ivec2((uvec2(pos2_0)))))); - imageStore((halfTexture_0), ivec2((uvec2(pos_0))), f16vec4(h2_0.x + h2_0.y, float16_t(0), float16_t(0), float16_t(0))); - imageStore((halfTexture2_0), ivec2((uvec2(pos_0))), f16vec4(h4_0.xy, float16_t(0), float16_t(0))); - imageStore((halfTexture4_0), ivec2((uvec2(pos_0))), f16vec4(h2_0, h_0, h_0)); + imageStore((halfTexture_0), ivec2((uvec2(pos_0))), f16vec4(h2_0.x + h2_0.y, float16_t(0), float16_t(0), float16_t(0))); + imageStore((halfTexture2_0), ivec2((uvec2(pos_0))), f16vec4(h4_0.xy, float16_t(0), float16_t(0))); + imageStore((halfTexture4_0), ivec2((uvec2(pos_0))), f16vec4(h2_0, h_0, h_0)); - int index_0 = pos_0.x + pos_0.y * 4; + int index_0 = _S4 + _S3 * 4; ((outputBuffer_0)._data[(uint(index_0))]) = index_0; return; diff --git a/tests/compute/half-texture.slang.hlsl b/tests/compute/half-texture.slang.hlsl index c606703a4..2d04ee17f 100644 --- a/tests/compute/half-texture.slang.hlsl +++ b/tests/compute/half-texture.slang.hlsl @@ -8,19 +8,21 @@ RWStructuredBuffer<int > outputBuffer_0 : register(u0); [shader("compute")][numthreads(4, 4, 1)] void computeMain(uint3 dispatchThreadID_0 : SV_DISPATCHTHREADID) { - int2 pos_0 = (int2) dispatchThreadID_0.xy; + int2 pos_0 = int2(dispatchThreadID_0.xy); float _S1 = 1.00000000000000000000 / 3.00000000000000000000; - int2 pos2_0 = int2(int(3) - pos_0.y, int(3) - pos_0.x); + int _S2 = pos_0.y; + int _S3 = pos_0.x; + int2 pos2_0 = int2(int(3) - _S2, int(3) - _S3); - half h_0 = halfTexture_0[(uint2) pos2_0]; - vector<half,2> h2_0 = halfTexture2_0[(uint2) pos2_0]; - vector<half,4> h4_0 = halfTexture4_0[(uint2) pos2_0]; + half h_0 = halfTexture_0[uint2(pos2_0)]; + vector<half, 2> h2_0 = halfTexture2_0[uint2(pos2_0)]; + vector<half, 4> h4_0 = halfTexture4_0[uint2(pos2_0)]; - halfTexture_0[(uint2) pos_0] = h2_0.x + h2_0.y; - halfTexture2_0[(uint2) pos_0] = h4_0.xy; - halfTexture4_0[(uint2) pos_0] = vector<half,4>(h2_0, h_0, h_0); + halfTexture_0[uint2(pos_0)] = h2_0.x + h2_0.y; + halfTexture2_0[uint2(pos_0)] = h4_0.xy; + halfTexture4_0[uint2(pos_0)] = vector<half, 4>(h2_0, h_0, h_0); - int index_0 = pos_0.x + pos_0.y * int(4); - outputBuffer_0[(uint) index_0] = index_0; + int index_0 = _S3 + _S2 * int(4); + outputBuffer_0[uint(index_0)] = index_0; return; } diff --git a/tests/cross-compile/precise-keyword.slang.glsl b/tests/cross-compile/precise-keyword.slang.glsl index 17fed739e..027a8eb3b 100644 --- a/tests/cross-compile/precise-keyword.slang.glsl +++ b/tests/cross-compile/precise-keyword.slang.glsl @@ -11,15 +11,18 @@ in vec2 _S2; void main() { + float _S3 = _S2.x; + precise float z_0; - if(_S2.x > float(0)) + if(_S3 > 0.00000000000000000000) { - z_0 = _S2.x * _S2.y + _S2.x; + z_0 = _S3 * _S2.y + _S3; } else { - z_0 = _S2.y * _S2.x + _S2.y; + float _S4 = _S2.y; + z_0 = _S4 * _S3 + _S4; } _S1 = vec4(z_0); return; diff --git a/tests/cross-compile/precise-keyword.slang.hlsl b/tests/cross-compile/precise-keyword.slang.hlsl index 54017868b..7a07fdc5e 100644 --- a/tests/cross-compile/precise-keyword.slang.hlsl +++ b/tests/cross-compile/precise-keyword.slang.hlsl @@ -3,15 +3,17 @@ float4 main(float2 v_0 : V) : SV_TARGET { + float _S1 = v_0.x; precise float z_0; - if(v_0.x > (float) 0) + if (_S1 > 0.00000000000000000000) { - z_0 = v_0.x * v_0.y + v_0.x; + z_0 = _S1 * v_0.y + _S1; } else { - z_0 = v_0.y * v_0.x + v_0.y; + float _S2 = v_0.y; + z_0 = _S2 * _S1 + _S2; } return (float4) z_0; diff --git a/tests/experimental/liveness/liveness-6.slang.expected b/tests/experimental/liveness/liveness-6.slang.expected index ac1894f95..26a537330 100644 --- a/tests/experimental/liveness/liveness-6.slang.expected +++ b/tests/experimental/liveness/liveness-6.slang.expected @@ -60,15 +60,16 @@ int calcThing_0(int offset_0) i_0 = i_0 + 1; } livenessEnd_0(i_0, 0); - int _S3 = another_0[k_0 & 1]; - int _S4 = total_0; + int _S3 = k_0 & 1; + int _S4 = another_0[_S3]; + int _S5 = total_0; livenessEnd_0(total_0, 0); - int total_1 = _S4 + _S3; - int _S5 = arr_0[k_0 & 1]; + int total_1 = _S5 + _S4; + int _S6 = arr_0[_S3]; livenessEnd_1(arr_0, 0); - int total_2 = total_1 + _S5; - int _S6 = (k_0 + 7) % 5; - if(_S6 == 4) + int total_2 = total_1 + _S6; + int _S7 = (k_0 + 7) % 5; + if(_S7 == 4) { livenessEnd_0(k_0, 0); livenessEnd_1(another_0, 0); @@ -83,32 +84,32 @@ int calcThing_0(int offset_0) int total_3; if(total_0 > 4) { - int _S7 = total_0; + int _S8 = total_0; livenessEnd_0(total_0, 0); - int _S8 = - _S7; + int _S9 = - _S8; livenessStart_1(total_3, 0); - total_3 = _S8; + total_3 = _S9; } else { - int _S9 = total_0; + int _S10 = total_0; livenessEnd_0(total_0, 0); livenessStart_1(total_3, 0); - total_3 = _S9; + total_3 = _S10; } return total_3; } -layout(std430, binding = 0) buffer _S10 { +layout(std430, binding = 0) buffer _S11 { int _data[]; } outputBuffer_0; layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; void main() { int index_0 = int(gl_GlobalInvocationID.x); - uint _S11 = uint(index_0); - int _S12 = calcThing_0(index_0); - ((outputBuffer_0)._data[(_S11)]) = _S12; + uint _S12 = uint(index_0); + int _S13 = calcThing_0(index_0); + ((outputBuffer_0)._data[(_S12)]) = _S13; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected index 8fc391feb..15221b921 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected @@ -57,15 +57,16 @@ uint calcValue_0(hitObjectNV hit_0) uint hitKind_0 = (hitObjectGetHitKindNV((hit_0))); uint r_1 = 0U + hitKind_0 + instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0; RayDesc_0 ray_1 = HitObject_GetRayDesc_0(hit_0); - uint r_2 = r_1 + uint(ray_1.TMin_0 > 0.00000000000000000000) + uint(ray_1.TMax_0 < ray_1.TMin_0); + float _S6 = ray_1.TMin_0; + uint r_2 = r_1 + uint(_S6 > 0.00000000000000000000) + uint(ray_1.TMax_0 < _S6); SomeValues_0 objSomeValues_0 = HitObject_GetAttributes_0(hit_0); r_0 = r_2 + uint(objSomeValues_0.a_0); } else { - bool _S6 = (hitObjectIsMissNV((hit_0))); + bool _S7 = (hitObjectIsMissNV((hit_0))); uint r_3; - if(_S6) + if(_S7) { r_3 = 1U; } @@ -78,29 +79,29 @@ uint calcValue_0(hitObjectNV hit_0) return r_0; } -layout(std430, binding = 1) buffer _S7 { +layout(std430, binding = 1) buffer _S8 { uint _data[]; } outputBuffer_0; void main() { - uvec3 _S8 = ((gl_LaunchIDEXT)); - ivec2 launchID_0 = ivec2(_S8.xy); - uvec3 _S9 = ((gl_LaunchSizeEXT)); + uvec3 _S9 = ((gl_LaunchIDEXT)); + ivec2 launchID_0 = ivec2(_S9.xy); + uvec3 _S10 = ((gl_LaunchSizeEXT)); int idx_0 = launchID_0.x; RayDesc_0 ray_2; ray_2.Origin_0 = vec3(float(idx_0), 0.00000000000000000000, 0.00000000000000000000); ray_2.TMin_0 = 0.00999999977648258209; ray_2.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); ray_2.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S10 = ray_2; + RayDesc_0 _S11 = ray_2; hitObjectNV hitObj_0; - hitObjectRecordHitWithIndexNV(hitObj_0, scene_0, int(uint(idx_0)), int(uint(idx_0 * 2)), int(uint(idx_0 * 3)), 0U, 0U, _S10.Origin_0, _S10.TMin_0, _S10.Direction_0, _S10.TMax_0, (0)); + hitObjectRecordHitWithIndexNV(hitObj_0, scene_0, int(uint(idx_0)), int(uint(idx_0 * 2)), int(uint(idx_0 * 3)), 0U, 0U, _S11.Origin_0, _S11.TMin_0, _S11.Direction_0, _S11.TMax_0, (0)); uint r_4 = calcValue_0(hitObj_0); - RayDesc_0 _S11 = ray_2; + RayDesc_0 _S12 = ray_2; hitObjectNV hitObj_1; - hitObjectRecordHitNV(hitObj_1, scene_0, int(uint(idx_0)), int(uint(idx_0 * 3)), int(uint(idx_0 * 2)), 0U, 0U, 4U, _S11.Origin_0, _S11.TMin_0, _S11.Direction_0, _S11.TMax_0, (0)); - uint _S12 = calcValue_0(hitObj_1); - uint r_5 = r_4 + _S12; + hitObjectRecordHitNV(hitObj_1, scene_0, int(uint(idx_0)), int(uint(idx_0 * 3)), int(uint(idx_0 * 2)), 0U, 0U, 4U, _S12.Origin_0, _S12.TMin_0, _S12.Direction_0, _S12.TMax_0, (0)); + uint _S13 = calcValue_0(hitObj_1); + uint r_5 = r_4 + _S13; ((outputBuffer_0)._data[(uint(idx_0))]) = r_5; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected index 90223115b..f250c1c92 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected @@ -79,36 +79,37 @@ void main() ivec2 launchID_0 = ivec2(_S3.xy); uvec3 _S4 = ((gl_LaunchSizeEXT)); int idx_0 = launchID_0.x; - SomeValues_0 someValues_0 = { idx_0, float(idx_0) * 2.00000000000000000000 }; + float _S5 = float(idx_0); + SomeValues_0 someValues_0 = { idx_0, _S5 * 2.00000000000000000000 }; RayDesc_0 ray_0; - ray_0.Origin_0 = vec3(float(idx_0), 0.00000000000000000000, 0.00000000000000000000); + ray_0.Origin_0 = vec3(_S5, 0.00000000000000000000, 0.00000000000000000000); ray_0.TMin_0 = 0.00999999977648258209; ray_0.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); ray_0.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S5 = ray_0; + RayDesc_0 _S6 = ray_0; p_0 = someValues_0; hitObjectNV hitObj_0; - hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S5.Origin_0, _S5.TMin_0, _S5.Direction_0, _S5.TMax_0, (0)); + hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S6.Origin_0, _S6.TMin_0, _S6.Direction_0, _S6.TMax_0, (0)); uint r_1 = calcValue_0(hitObj_0); reorderThreadNV(hitObj_0); SomeValues_0 otherValues_0; - SomeValues_0 _S6 = { idx_0 * -1, float(idx_0) * 4.00000000000000000000 }; - otherValues_0 = _S6; + SomeValues_0 _S7 = { idx_0 * -1, _S5 * 4.00000000000000000000 }; + otherValues_0 = _S7; HitObject_Invoke_0(scene_0, hitObj_0, otherValues_0); - uint _S7 = calcValue_0(hitObj_0); - uint r_2 = r_1 + _S7; + uint _S8 = calcValue_0(hitObj_0); + uint r_2 = r_1 + _S8; reorderThreadNV(hitObj_0, uint(idx_0 & 3), 2U); - SomeValues_0 _S8 = { idx_0 * -2, float(idx_0) * 8.00000000000000000000 }; - otherValues_0 = _S8; + SomeValues_0 _S9 = { idx_0 * -2, _S5 * 8.00000000000000000000 }; + otherValues_0 = _S9; HitObject_Invoke_0(scene_0, hitObj_0, otherValues_0); - uint _S9 = calcValue_0(hitObj_0); - uint r_3 = r_2 + _S9; + uint _S10 = calcValue_0(hitObj_0); + uint r_3 = r_2 + _S10; reorderThreadNV(uint(idx_0 & 1), 1U); - SomeValues_0 _S10 = { idx_0 * -4, float(idx_0) * 16.00000000000000000000 }; - otherValues_0 = _S10; + SomeValues_0 _S11 = { idx_0 * -4, _S5 * 16.00000000000000000000 }; + otherValues_0 = _S11; HitObject_Invoke_0(scene_0, hitObj_0, otherValues_0); - uint _S11 = calcValue_0(hitObj_0); - uint r_4 = r_3 + _S11; + uint _S12 = calcValue_0(hitObj_0); + uint r_4 = r_3 + _S12; ((outputBuffer_0)._data[(uint(idx_0))]) = r_4; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected index a86dc6aa7..f6f6f132d 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected @@ -70,19 +70,20 @@ void main() int idx_0 = launchID_0.x; int _S5 = idx_0 / 4; float currentTime_0 = float(_S5); - SomeValues_0 someValues_0 = { idx_0, float(idx_0) * 2.00000000000000000000 }; + float _S6 = float(idx_0); + SomeValues_0 someValues_0 = { idx_0, _S6 * 2.00000000000000000000 }; RayDesc_0 ray_0; - ray_0.Origin_0 = vec3(float(idx_0), 0.00000000000000000000, 0.00000000000000000000); + ray_0.Origin_0 = vec3(_S6, 0.00000000000000000000, 0.00000000000000000000); ray_0.TMin_0 = 0.00999999977648258209; ray_0.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); ray_0.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S6 = ray_0; + RayDesc_0 _S7 = ray_0; p_0 = someValues_0; hitObjectNV hitObj_0; - hitObjectTraceRayMotionNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S6.Origin_0, _S6.TMin_0, _S6.Direction_0, _S6.TMax_0, currentTime_0, (0)); - uint _S7 = uint(idx_0); - uint _S8 = calcValue_0(hitObj_0); - ((outputBuffer_0)._data[(_S7)]) = _S8; + hitObjectTraceRayMotionNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S7.Origin_0, _S7.TMin_0, _S7.Direction_0, _S7.TMax_0, currentTime_0, (0)); + uint _S8 = uint(idx_0); + uint _S9 = calcValue_0(hitObj_0); + ((outputBuffer_0)._data[(_S8)]) = _S9; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected index 38ddbf233..16099b5e2 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected @@ -67,19 +67,20 @@ void main() ivec2 launchID_0 = ivec2(_S3.xy); uvec3 _S4 = ((gl_LaunchSizeEXT)); int idx_0 = launchID_0.x; - SomeValues_0 someValues_0 = { idx_0, float(idx_0) * 2.00000000000000000000 }; + float _S5 = float(idx_0); + SomeValues_0 someValues_0 = { idx_0, _S5 * 2.00000000000000000000 }; RayDesc_0 ray_0; - ray_0.Origin_0 = vec3(float(idx_0), 0.00000000000000000000, 0.00000000000000000000); + ray_0.Origin_0 = vec3(_S5, 0.00000000000000000000, 0.00000000000000000000); ray_0.TMin_0 = 0.00999999977648258209; ray_0.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); ray_0.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S5 = ray_0; + RayDesc_0 _S6 = ray_0; p_0 = someValues_0; hitObjectNV hitObj_0; - hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S5.Origin_0, _S5.TMin_0, _S5.Direction_0, _S5.TMax_0, (0)); - uint _S6 = uint(idx_0); - uint _S7 = calcValue_0(hitObj_0); - ((outputBuffer_0)._data[(_S6)]) = _S7; + hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S6.Origin_0, _S6.TMin_0, _S6.Direction_0, _S6.TMax_0, (0)); + uint _S7 = uint(idx_0); + uint _S8 = calcValue_0(hitObj_0); + ((outputBuffer_0)._data[(_S7)]) = _S8; return; } diff --git a/tests/pipeline/rasterization/fragment-shader-interlock.slang.glsl b/tests/pipeline/rasterization/fragment-shader-interlock.slang.glsl index 1818b7789..84eba46f0 100644 --- a/tests/pipeline/rasterization/fragment-shader-interlock.slang.glsl +++ b/tests/pipeline/rasterization/fragment-shader-interlock.slang.glsl @@ -19,11 +19,13 @@ void main() { beginInvocationInterlockARB(); - vec4 _S3 = (imageLoad((entryPointParams_texture_0), ivec2((uvec2(_S1.xy))))); - imageStore((entryPointParams_texture_0), ivec2((uvec2(_S1.xy))), _S3 + _S1); + vec2 _S3 = _S1.xy; + + vec4 _S4 = (imageLoad((entryPointParams_texture_0), ivec2((uvec2(_S3))))); + imageStore((entryPointParams_texture_0), ivec2((uvec2(_S3))), _S4 + _S1); endInvocationInterlockARB(); - _S2 = _S3; + _S2 = _S4; return; } diff --git a/tests/pipeline/rasterization/get-attribute-at-vertex.slang.glsl b/tests/pipeline/rasterization/get-attribute-at-vertex.slang.glsl index 1da5f4f8a..864f44eb3 100644 --- a/tests/pipeline/rasterization/get-attribute-at-vertex.slang.glsl +++ b/tests/pipeline/rasterization/get-attribute-at-vertex.slang.glsl @@ -14,6 +14,7 @@ out vec4 _S2; void main() { + uvec2 _S3 = uvec2(0U, 0U); _S2 = gl_BaryCoordNV.x * ((_S1)[(0U)]) + gl_BaryCoordNV.y * ((_S1)[(1U)]) + gl_BaryCoordNV.z * ((_S1)[(2U)]); return; } diff --git a/tests/pipeline/rasterization/get-attribute-at-vertex.slang.hlsl b/tests/pipeline/rasterization/get-attribute-at-vertex.slang.hlsl index 257b334bf..ce23492c9 100644 --- a/tests/pipeline/rasterization/get-attribute-at-vertex.slang.hlsl +++ b/tests/pipeline/rasterization/get-attribute-at-vertex.slang.hlsl @@ -8,7 +8,7 @@ void main( vector<float,3> bary_0 : SV_BARYCENTRICS, out vector<float,4> result_0 : SV_TARGET) { - result_0 = bary_0.x * GetAttributeAtVertex(color_0, (uint) int(0)) - + bary_0.y * GetAttributeAtVertex(color_0, (uint) int(1)) - + bary_0.z * GetAttributeAtVertex(color_0, (uint) int(2)); + result_0 = bary_0.x * GetAttributeAtVertex(color_0, 0U) + + bary_0.y * GetAttributeAtVertex(color_0, 1U) + + bary_0.z * GetAttributeAtVertex(color_0, 2U); } |
