@@ -33,7 +33,7 @@ use core::arch::asm;
3333#[ spirv_std_macros:: gpu_only]
3434#[ doc( alias = "OpControlBarrier" ) ]
3535#[ inline]
36- pub unsafe fn control_barrier <
36+ pub fn control_barrier <
3737 const EXECUTION : u32 , // Scope
3838 const MEMORY : u32 , // Scope
3939 const SEMANTICS : u32 , // Semantics
@@ -70,7 +70,7 @@ pub unsafe fn control_barrier<
7070#[ spirv_std_macros:: gpu_only]
7171#[ doc( alias = "OpMemoryBarrier" ) ]
7272#[ inline]
73- pub unsafe fn memory_barrier <
73+ pub fn memory_barrier <
7474 const MEMORY : u32 , // Scope
7575 const SEMANTICS : u32 , // Semantics
7676> ( ) {
@@ -93,16 +93,14 @@ pub unsafe fn memory_barrier<
9393/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/groupmemorybarrier>
9494#[ spirv_std_macros:: gpu_only]
9595#[ 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+ > ( ) ;
106104}
107105
108106/// 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() {
112110/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/groupmemorybarrierwithgroupsync>
113111#[ spirv_std_macros:: gpu_only]
114112#[ 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+ > ( ) ;
126122}
127123
128124/// 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() {
132128/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/devicememorybarrier>
133129#[ spirv_std_macros:: gpu_only]
134130#[ 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+ > ( ) ;
146140}
147141
148142/// 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() {
152146/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/devicememorybarrierwithgroupsync>
153147#[ spirv_std_macros:: gpu_only]
154148#[ 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+ > ( ) ;
167159}
168160
169161/// 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() {
173165/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/allmemorybarrier>
174166#[ spirv_std_macros:: gpu_only]
175167#[ 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+ > ( ) ;
188178}
189179
190180/// 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() {
194184/// From <https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/allmemorybarrierwithgroupsync>
195185#[ spirv_std_macros:: gpu_only]
196186#[ 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+ > ( ) ;
210198}
0 commit comments