aboutsummaryrefslogtreecommitdiff
path: root/tests/cases/debugger_spirv_line_stepping.amber
blob: 1d3e33b7d1dbc72c38a62f2b3b1a69abef79588e (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!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

# #version 450
# layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
# layout(binding = 0, std430) buffer InBuffer
# {
#     int Data[];
# } In;
# layout(binding = 1, std430) buffer OutBuffer
# {
#     int Data[];
# } Out;
# void main()
# {
#     Out.Data[gl_GlobalInvocationID.x] = In.Data[gl_GlobalInvocationID.x];
# }
SHADER compute mah_shader SPIRV-ASM
      OpCapability Shader
      OpMemoryModel Logical GLSL450
      OpEntryPoint GLCompute %1 "main" %2
      OpExecutionMode %1 LocalSize 4 1 1
      OpDecorate %3 ArrayStride 4
      OpMemberDecorate %4 0 Offset 0
      OpDecorate %4 BufferBlock
      OpDecorate %5 DescriptorSet 0
      OpDecorate %5 Binding 1
      OpDecorate %2 BuiltIn GlobalInvocationId
      OpDecorate %6 DescriptorSet 0
      OpDecorate %6 Binding 0
 %7 = OpTypeVoid
 %8 = OpTypeFunction %7
 %9 = OpTypeInt 32 1
%10 = OpTypeInt 32 0
 %3 = OpTypeRuntimeArray %9
 %4 = OpTypeStruct %3
%11 = OpTypePointer Uniform %4
 %5 = OpVariable %11 Uniform
%12 = OpConstant %9 0
%13 = OpConstant %10 0
%14 = OpTypeVector %10 3
%15 = OpTypePointer Input %14
 %2 = OpVariable %15 Input
%16 = OpTypePointer Input %10
 %6 = OpVariable %11 Uniform
%17 = OpTypePointer Uniform %9
 %1 = OpFunction %7 None %8
%18 = OpLabel
%19 = OpAccessChain %16 %2 %13
%20 = OpLoad %10 %19
%21 = OpAccessChain %17 %6 %12 %20
%22 = OpLoad %9 %21
%23 = OpAccessChain %17 %5 %12 %20
      OpStore %23 %22
      OpReturn
      OpFunctionEnd
END

BUFFER buf_in DATA_TYPE uint32 DATA
    20 30 40 50 60
END

BUFFER buf_out DATA_TYPE uint32 DATA
    99 99 99 99 99
END

PIPELINE compute pipeline
  ATTACH mah_shader

  BIND BUFFER buf_in  AS storage DESCRIPTOR_SET 0 BINDING 0
  BIND BUFFER buf_out AS storage DESCRIPTOR_SET 0 BINDING 1
END

# Only one workgroup.  Having only one invocation execute ensures
# there are no race conditions.
DEBUG pipeline 1 1 1
    THREAD GLOBAL_INVOCATION_ID 2 0 0
        EXPECT CALLSTACK
            "SPIR-V" "ComputeShader0.spvasm" 20
        END
        EXPECT LOCATION "ComputeShader0.spvasm" 20 "%5 = OpVariable %11 Uniform"
        STEP_IN
        EXPECT LOCATION "ComputeShader0.spvasm" 25 "%2 = OpVariable %15 Input"
        STEP_IN
        EXPECT LOCATION "ComputeShader0.spvasm" 27 "%6 = OpVariable %11 Uniform"
        STEP_IN
        EXPECT LOCATION "ComputeShader0.spvasm" 31 "%19 = OpAccessChain %16 %2 %13"
        STEP_IN
        EXPECT LOCATION "ComputeShader0.spvasm" 32 "%20 = OpLoad %10 %19"
        STEP_IN
        EXPECT LOCAL "%20" EQ 2
        EXPECT LOCATION "ComputeShader0.spvasm" 33 "%21 = OpAccessChain %17 %6 %12 %20"
        STEP_IN
        EXPECT LOCATION "ComputeShader0.spvasm" 34 "%22 = OpLoad %9 %21"
        STEP_IN
        EXPECT LOCAL "%22" EQ 40
        EXPECT LOCATION "ComputeShader0.spvasm" 35 "%23 = OpAccessChain %17 %5 %12 %20"
        STEP_IN
        EXPECT LOCATION "ComputeShader0.spvasm" 36 "OpStore %23 %22"
        STEP_IN
        EXPECT CALLSTACK
            "SPIR-V" "ComputeShader0.spvasm" 37
        END
        EXPECT LOCATION "ComputeShader0.spvasm" 37 "OpReturn"
        CONTINUE
    END
END

EXPECT buf_in  IDX 0 EQ 20 30 40 50 60
EXPECT buf_out IDX 0 EQ 20 30 40 50 99