@@ -33,7 +33,7 @@ use core::arch::asm;
33
33
#[ spirv_std_macros:: gpu_only]
34
34
#[ doc( alias = "OpControlBarrier" ) ]
35
35
#[ inline]
36
- pub unsafe fn control_barrier <
36
+ pub fn control_barrier <
37
37
const EXECUTION : u32 , // Scope
38
38
const MEMORY : u32 , // Scope
39
39
const SEMANTICS : u32 , // Semantics
@@ -70,7 +70,7 @@ pub unsafe fn control_barrier<
70
70
#[ spirv_std_macros:: gpu_only]
71
71
#[ doc( alias = "OpMemoryBarrier" ) ]
72
72
#[ inline]
73
- pub unsafe fn memory_barrier <
73
+ pub fn memory_barrier <
74
74
const MEMORY : u32 , // Scope
75
75
const SEMANTICS : u32 , // Semantics
76
76
> ( ) {
@@ -93,16 +93,14 @@ pub unsafe fn memory_barrier<
93
93
/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/groupmemorybarrier>
94
94
#[ spirv_std_macros:: gpu_only]
95
95
#[ inline]
96
- pub unsafe fn workgroup_memory_barrier ( ) {
97
- unsafe {
98
- memory_barrier :: <
99
- { crate :: memory:: Scope :: Workgroup as u32 } ,
100
- {
101
- crate :: memory:: Semantics :: WORKGROUP_MEMORY . bits ( )
102
- | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
103
- } ,
104
- > ( ) ;
105
- }
96
+ pub fn workgroup_memory_barrier ( ) {
97
+ memory_barrier :: <
98
+ { crate :: memory:: Scope :: Workgroup as u32 } ,
99
+ {
100
+ crate :: memory:: Semantics :: WORKGROUP_MEMORY . bits ( )
101
+ | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
102
+ } ,
103
+ > ( ) ;
106
104
}
107
105
108
106
/// Blocks execution of all threads in a group until all group shared accesses have been completed and all threads in the group have reached this call.
@@ -112,17 +110,15 @@ pub unsafe fn workgroup_memory_barrier() {
112
110
/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/groupmemorybarrierwithgroupsync>
113
111
#[ spirv_std_macros:: gpu_only]
114
112
#[ inline]
115
- pub unsafe fn workgroup_memory_barrier_with_group_sync ( ) {
116
- unsafe {
117
- control_barrier :: <
118
- { crate :: memory:: Scope :: Workgroup as u32 } ,
119
- { crate :: memory:: Scope :: Workgroup as u32 } ,
120
- {
121
- crate :: memory:: Semantics :: WORKGROUP_MEMORY . bits ( )
122
- | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
123
- } ,
124
- > ( ) ;
125
- }
113
+ pub fn workgroup_memory_barrier_with_group_sync ( ) {
114
+ control_barrier :: <
115
+ { crate :: memory:: Scope :: Workgroup as u32 } ,
116
+ { crate :: memory:: Scope :: Workgroup as u32 } ,
117
+ {
118
+ crate :: memory:: Semantics :: WORKGROUP_MEMORY . bits ( )
119
+ | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
120
+ } ,
121
+ > ( ) ;
126
122
}
127
123
128
124
/// Blocks execution of all threads in a group until all device memory accesses have been completed.
@@ -132,17 +128,15 @@ pub unsafe fn workgroup_memory_barrier_with_group_sync() {
132
128
/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/devicememorybarrier>
133
129
#[ spirv_std_macros:: gpu_only]
134
130
#[ inline]
135
- pub unsafe fn device_memory_barrier ( ) {
136
- unsafe {
137
- memory_barrier :: <
138
- { crate :: memory:: Scope :: Device as u32 } ,
139
- {
140
- crate :: memory:: Semantics :: IMAGE_MEMORY . bits ( )
141
- | crate :: memory:: Semantics :: UNIFORM_MEMORY . bits ( )
142
- | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
143
- } ,
144
- > ( ) ;
145
- }
131
+ pub fn device_memory_barrier ( ) {
132
+ memory_barrier :: <
133
+ { crate :: memory:: Scope :: Device as u32 } ,
134
+ {
135
+ crate :: memory:: Semantics :: IMAGE_MEMORY . bits ( )
136
+ | crate :: memory:: Semantics :: UNIFORM_MEMORY . bits ( )
137
+ | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
138
+ } ,
139
+ > ( ) ;
146
140
}
147
141
148
142
/// Blocks execution of all threads in a group until all device memory accesses have been completed and all threads in the group have reached this call.
@@ -152,18 +146,16 @@ pub unsafe fn device_memory_barrier() {
152
146
/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/devicememorybarrierwithgroupsync>
153
147
#[ spirv_std_macros:: gpu_only]
154
148
#[ inline]
155
- pub unsafe fn device_memory_barrier_with_group_sync ( ) {
156
- unsafe {
157
- control_barrier :: <
158
- { crate :: memory:: Scope :: Workgroup as u32 } ,
159
- { crate :: memory:: Scope :: Device as u32 } ,
160
- {
161
- crate :: memory:: Semantics :: IMAGE_MEMORY . bits ( )
162
- | crate :: memory:: Semantics :: UNIFORM_MEMORY . bits ( )
163
- | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
164
- } ,
165
- > ( ) ;
166
- }
149
+ pub fn device_memory_barrier_with_group_sync ( ) {
150
+ control_barrier :: <
151
+ { crate :: memory:: Scope :: Workgroup as u32 } ,
152
+ { crate :: memory:: Scope :: Device as u32 } ,
153
+ {
154
+ crate :: memory:: Semantics :: IMAGE_MEMORY . bits ( )
155
+ | crate :: memory:: Semantics :: UNIFORM_MEMORY . bits ( )
156
+ | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
157
+ } ,
158
+ > ( ) ;
167
159
}
168
160
169
161
/// Blocks execution of all threads in a group until all memory accesses have been completed.
@@ -173,18 +165,16 @@ pub unsafe fn device_memory_barrier_with_group_sync() {
173
165
/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/allmemorybarrier>
174
166
#[ spirv_std_macros:: gpu_only]
175
167
#[ inline]
176
- pub unsafe fn all_memory_barrier ( ) {
177
- unsafe {
178
- memory_barrier :: <
179
- { crate :: memory:: Scope :: Device as u32 } ,
180
- {
181
- crate :: memory:: Semantics :: WORKGROUP_MEMORY . bits ( )
182
- | crate :: memory:: Semantics :: IMAGE_MEMORY . bits ( )
183
- | crate :: memory:: Semantics :: UNIFORM_MEMORY . bits ( )
184
- | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
185
- } ,
186
- > ( ) ;
187
- }
168
+ pub fn all_memory_barrier ( ) {
169
+ memory_barrier :: <
170
+ { crate :: memory:: Scope :: Device as u32 } ,
171
+ {
172
+ crate :: memory:: Semantics :: WORKGROUP_MEMORY . bits ( )
173
+ | crate :: memory:: Semantics :: IMAGE_MEMORY . bits ( )
174
+ | crate :: memory:: Semantics :: UNIFORM_MEMORY . bits ( )
175
+ | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
176
+ } ,
177
+ > ( ) ;
188
178
}
189
179
190
180
/// Blocks execution of all threads in a group until all memory accesses have been completed and all threads in the group have reached this call.
@@ -194,17 +184,15 @@ pub unsafe fn all_memory_barrier() {
194
184
/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/allmemorybarrierwithgroupsync>
195
185
#[ spirv_std_macros:: gpu_only]
196
186
#[ inline]
197
- pub unsafe fn all_memory_barrier_with_group_sync ( ) {
198
- unsafe {
199
- control_barrier :: <
200
- { crate :: memory:: Scope :: Workgroup as u32 } ,
201
- { crate :: memory:: Scope :: Device as u32 } ,
202
- {
203
- crate :: memory:: Semantics :: WORKGROUP_MEMORY . bits ( )
204
- | crate :: memory:: Semantics :: IMAGE_MEMORY . bits ( )
205
- | crate :: memory:: Semantics :: UNIFORM_MEMORY . bits ( )
206
- | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
207
- } ,
208
- > ( ) ;
209
- }
187
+ pub fn all_memory_barrier_with_group_sync ( ) {
188
+ control_barrier :: <
189
+ { crate :: memory:: Scope :: Workgroup as u32 } ,
190
+ { crate :: memory:: Scope :: Device as u32 } ,
191
+ {
192
+ crate :: memory:: Semantics :: WORKGROUP_MEMORY . bits ( )
193
+ | crate :: memory:: Semantics :: IMAGE_MEMORY . bits ( )
194
+ | crate :: memory:: Semantics :: UNIFORM_MEMORY . bits ( )
195
+ | crate :: memory:: Semantics :: ACQUIRE_RELEASE . bits ( )
196
+ } ,
197
+ > ( ) ;
210
198
}
0 commit comments