aboutsummaryrefslogtreecommitdiff
path: root/tests/cases/debugger_hlsl_basic_compute.amber
blob: f1572b37b296a9e071b15bc4ca2850d82e1c7188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!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