| #!amber |
| # Copyright 2020 The Amber Authors. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # https:#www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| SET ENGINE_DATA fence_timeout_ms 1000000 |
| |
| VIRTUAL_FILE "compute.hlsl" |
| |
| [[vk::binding(0)]] |
| RWStructuredBuffer<int> data; |
| |
| [numthreads(1,1,1)] |
| void main() { |
| int a = data[0]; |
| int b = data[1]; |
| int c = data[2]; |
| int d = data[3]; |
| data[0] = a + b + c + d; |
| } |
| END |
| |
| SHADER compute shader HLSL VIRTUAL_FILE "compute.hlsl" |
| |
| BUFFER data DATA_TYPE int32 DATA |
| 10 20 30 40 |
| END |
| |
| PIPELINE compute pipeline |
| ATTACH shader |
| SHADER_OPTIMIZATION shader |
| --legalize-hlsl |
| END |
| BIND BUFFER data AS storage DESCRIPTOR_SET 0 BINDING 0 |
| END |
| |
| DEBUG pipeline 1 1 1 |
| THREAD GLOBAL_INVOCATION_ID 0 0 0 |
| EXPECT LOCATION "compute.hlsl" 7 " int a = data[0];" |
| STEP_IN |
| EXPECT LOCATION "compute.hlsl" 8 " int b = data[1];" |
| EXPECT LOCAL "a" EQ 10 |
| STEP_IN |
| EXPECT LOCATION "compute.hlsl" 9 " int c = data[2];" |
| EXPECT LOCAL "a" EQ 10 |
| EXPECT LOCAL "b" EQ 20 |
| STEP_IN |
| EXPECT LOCATION "compute.hlsl" 10 " int d = data[3];" |
| EXPECT LOCAL "a" EQ 10 |
| EXPECT LOCAL "b" EQ 20 |
| EXPECT LOCAL "c" EQ 30 |
| STEP_IN |
| EXPECT LOCATION "compute.hlsl" 11 " data[0] = a + b + c + d;" |
| EXPECT LOCAL "a" EQ 10 |
| EXPECT LOCAL "b" EQ 20 |
| EXPECT LOCAL "c" EQ 30 |
| EXPECT LOCAL "d" EQ 40 |
| CONTINUE |
| END |
| END |
| |
| EXPECT data IDX 0 EQ 100 |