• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![allow(clippy::unreadable_literal)]
2 
3 /*
4  ***********************************************************************************************************************
5  *
6  *  Copyright (c) 2014-2019 Advanced Micro Devices, Inc. All Rights Reserved.
7  *
8  *  Permission is hereby granted, free of charge, to any person obtaining a copy
9  *  of this software and associated documentation files (the "Software"), to deal
10  *  in the Software without restriction, including without limitation the rights
11  *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  *  copies of the Software, and to permit persons to whom the Software is
13  *  furnished to do so, subject to the following conditions:
14  *
15  *  The above copyright notice and this permission notice shall be included in all
16  *  copies or substantial portions of the Software.
17  *
18  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24  *  SOFTWARE.
25  *
26  **********************************************************************************************************************/
27 
28 use crate::vk::*;
29 use std::fmt;
30 use std::os::raw::*;
31 
32 // Extension: `VK_AMD_gpa_interface`
33 
34 #[repr(transparent)]
35 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
36 pub struct GpaSqShaderStageFlags(pub(crate) Flags);
37 vk_bitflags_wrapped!(
38     GpaSqShaderStageFlags,
39     0b1111111111111111111111111111111,
40     Flags
41 );
42 // ignore clippy::use_self false positives
43 // changing GpaSqShaderStageFlags::PS.0 to Self::PS.0 as suggested by clippy generates:
44 // error[E0401]: can't use generic parameters from outer function
45 #[allow(clippy::use_self)]
46 impl fmt::Debug for GpaSqShaderStageFlags {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result47     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
48         const KNOWN: &[(Flags, &str)] = &[
49             (GpaSqShaderStageFlags::PS.0, "PS"),
50             (GpaSqShaderStageFlags::VS.0, "VS"),
51             (GpaSqShaderStageFlags::GS.0, "GS"),
52             (GpaSqShaderStageFlags::ES.0, "ES"),
53             (GpaSqShaderStageFlags::HS.0, "HS"),
54             (GpaSqShaderStageFlags::LS.0, "LS"),
55             (GpaSqShaderStageFlags::CS.0, "CS"),
56         ];
57         debug_flags(f, KNOWN, self.0)
58     }
59 }
60 impl GpaSqShaderStageFlags {
61     pub const PS: Self = Self(0b1);
62     pub const VS: Self = Self(0b10);
63     pub const GS: Self = Self(0b100);
64     pub const ES: Self = Self(0b1000);
65     pub const HS: Self = Self(0b10000);
66     pub const LS: Self = Self(0b100000);
67     pub const CS: Self = Self(0b1000000);
68 }
69 
70 impl StructureType {
71     pub const PHYSICAL_DEVICE_GPA_FEATURES_AMD: Self = Self(1000133000);
72     pub const PHYSICAL_DEVICE_GPA_PROPERTIES_AMD: Self = Self(1000133001);
73     pub const GPA_SAMPLE_BEGIN_INFO_AMD: Self = Self(1000133002);
74     pub const GPA_SESSION_CREATE_INFO_AMD: Self = Self(1000133003);
75     pub const GPA_DEVICE_CLOCK_MODE_INFO_AMD: Self = Self(1000133004);
76 }
77 
78 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
79 #[repr(transparent)]
80 pub struct GpaDeviceClockModeAmd(pub(crate) i32);
81 impl GpaDeviceClockModeAmd {
from_raw(x: i32) -> Self82     pub fn from_raw(x: i32) -> Self {
83         Self(x)
84     }
as_raw(self) -> i3285     pub fn as_raw(self) -> i32 {
86         self.0
87     }
88 }
89 impl GpaDeviceClockModeAmd {
90     pub const DEFAULT: Self = Self(0);
91     pub const QUERY: Self = Self(1);
92     pub const PROFILING: Self = Self(2);
93     pub const MIN_MEMORY: Self = Self(3);
94     pub const MIN_ENGINE: Self = Self(4);
95     pub const PEAK: Self = Self(5);
96 }
97 
98 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
99 #[repr(transparent)]
100 pub struct GpaPerfBlockAmd(pub(crate) i32);
101 impl GpaPerfBlockAmd {
from_raw(x: i32) -> Self102     pub fn from_raw(x: i32) -> Self {
103         Self(x)
104     }
as_raw(self) -> i32105     pub fn as_raw(self) -> i32 {
106         self.0
107     }
108 }
109 impl GpaPerfBlockAmd {
110     pub const CPF: Self = Self(0);
111     pub const IA: Self = Self(1);
112     pub const VGT: Self = Self(2);
113     pub const PA: Self = Self(3);
114     pub const SC: Self = Self(4);
115     pub const SPI: Self = Self(5);
116     pub const SQ: Self = Self(6);
117     pub const SX: Self = Self(7);
118     pub const TA: Self = Self(8);
119     pub const TD: Self = Self(9);
120     pub const TCP: Self = Self(10);
121     pub const TCC: Self = Self(11);
122     pub const TCA: Self = Self(12);
123     pub const DB: Self = Self(13);
124     pub const CB: Self = Self(14);
125     pub const GDS: Self = Self(15);
126     pub const SRBM: Self = Self(16);
127     pub const GRBM: Self = Self(17);
128     pub const GRBM_SE: Self = Self(18);
129     pub const RLC: Self = Self(19);
130     pub const DMA: Self = Self(20);
131     pub const MC: Self = Self(21);
132     pub const CPG: Self = Self(22);
133     pub const CPC: Self = Self(23);
134     pub const WD: Self = Self(24);
135     pub const TCS: Self = Self(25);
136     pub const ATC: Self = Self(26);
137     pub const ATC_L2: Self = Self(27);
138     pub const MC_VM_L2: Self = Self(28);
139     pub const EA: Self = Self(29);
140     pub const RPB: Self = Self(30);
141     pub const RMI: Self = Self(31);
142 }
143 
144 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
145 #[repr(transparent)]
146 pub struct GpaSampleTypeAmd(pub(crate) i32);
147 impl GpaSampleTypeAmd {
from_raw(x: i32) -> Self148     pub fn from_raw(x: i32) -> Self {
149         Self(x)
150     }
as_raw(self) -> i32151     pub fn as_raw(self) -> i32 {
152         self.0
153     }
154 }
155 impl GpaSampleTypeAmd {
156     pub const CUMULATIVE: Self = Self(0);
157     pub const TRACE: Self = Self(1);
158     pub const TIMING: Self = Self(2);
159 }
160 
161 handle_nondispatchable!(GpaSessionAmd, UNKNOWN);
162 
163 #[repr(C)]
164 #[derive(Copy, Clone, Debug)]
165 pub struct GpaSessionCreateInfoAmd {
166     pub s_type: StructureType,
167     pub p_next: *const c_void,
168     pub secondary_copy_source: GpaSessionAmd,
169 }
170 
171 #[repr(C)]
172 #[derive(Copy, Clone, Debug)]
173 pub struct GpaPerfBlockPropertiesAmd {
174     pub block_type: GpaPerfBlockAmd,
175     pub flags: Flags,
176     pub instance_count: u32,
177     pub max_event_id: u32,
178     pub max_global_only_counters: u32,
179     pub max_global_shared_counters: u32,
180     pub max_streaming_counters: u32,
181 }
182 
183 #[repr(C)]
184 #[derive(Copy, Clone, Debug)]
185 pub struct PhysicalDeviceGpaFeaturesAmd {
186     pub s_type: StructureType,
187     pub p_next: *const c_void,
188     pub perf_counters: Bool32,
189     pub streaming_perf_counters: Bool32,
190     pub sq_thread_tracing: Bool32,
191     pub clock_modes: Bool32,
192 }
193 
194 #[repr(C)]
195 #[derive(Copy, Clone, Debug)]
196 pub struct PhysicalDeviceGpaPropertiesAmd {
197     pub s_type: StructureType,
198     pub p_next: *const c_void,
199     pub flags: Flags,
200     pub max_sqtt_se_buffer_size: DeviceSize,
201     pub shader_engine_count: u32,
202     pub perf_block_count: u32,
203     pub p_perf_block_properties: *mut GpaPerfBlockPropertiesAmd,
204 }
205 
206 impl ::std::default::Default for PhysicalDeviceGpaPropertiesAmd {
default() -> Self207     fn default() -> Self {
208         Self {
209             s_type: StructureType::PHYSICAL_DEVICE_GPA_PROPERTIES_AMD,
210             p_next: ::std::ptr::null_mut(),
211             flags: Flags::default(),
212             max_sqtt_se_buffer_size: DeviceSize::default(),
213             shader_engine_count: u32::default(),
214             perf_block_count: u32::default(),
215             p_perf_block_properties: ::std::ptr::null_mut(),
216         }
217     }
218 }
219 impl PhysicalDeviceGpaPropertiesAmd {
builder<'a>() -> PhysicalDeviceGpaPropertiesAmdBuilder<'a>220     pub fn builder<'a>() -> PhysicalDeviceGpaPropertiesAmdBuilder<'a> {
221         PhysicalDeviceGpaPropertiesAmdBuilder {
222             inner: Self::default(),
223             marker: ::std::marker::PhantomData,
224         }
225     }
226 }
227 pub struct PhysicalDeviceGpaPropertiesAmdBuilder<'a> {
228     inner: PhysicalDeviceGpaPropertiesAmd,
229     marker: ::std::marker::PhantomData<&'a ()>,
230 }
231 pub unsafe trait ExtendsPhysicalDeviceGpaPropertiesAmd {}
232 unsafe impl ExtendsPhysicalDeviceProperties2 for PhysicalDeviceGpaPropertiesAmd {}
233 impl<'a> ::std::ops::Deref for PhysicalDeviceGpaPropertiesAmdBuilder<'a> {
234     type Target = PhysicalDeviceGpaPropertiesAmd;
deref(&self) -> &Self::Target235     fn deref(&self) -> &Self::Target {
236         &self.inner
237     }
238 }
239 impl<'a> PhysicalDeviceGpaPropertiesAmdBuilder<'a> {
next<T>(mut self, next: &'a mut T) -> PhysicalDeviceGpaPropertiesAmdBuilder<'a> where T: ExtendsPhysicalDeviceGpaPropertiesAmd,240     pub fn next<T>(mut self, next: &'a mut T) -> PhysicalDeviceGpaPropertiesAmdBuilder<'a>
241     where
242         T: ExtendsPhysicalDeviceGpaPropertiesAmd,
243     {
244         self.inner.p_next = next as *mut T as *mut c_void;
245         self
246     }
build(self) -> PhysicalDeviceGpaPropertiesAmd247     pub fn build(self) -> PhysicalDeviceGpaPropertiesAmd {
248         self.inner
249     }
250 }
251 
252 #[repr(C)]
253 #[derive(Copy, Clone, Debug)]
254 pub struct GpaPerfCounterAmd {
255     pub block_type: GpaPerfBlockAmd,
256     pub block_instance: u32,
257     pub event_id: u32,
258 }
259 
260 #[repr(C)]
261 #[derive(Copy, Clone, Debug)]
262 pub struct GpaSampleBeginInfoAmd {
263     pub s_type: StructureType,
264     pub p_next: *const c_void,
265     pub sample_type: GpaSampleTypeAmd,
266     pub sample_internal_operations: Bool32,
267     pub cache_flush_on_counter_collection: Bool32,
268     pub sq_shader_mask_enable: Bool32,
269     pub sq_shader_mask: GpaSqShaderStageFlags,
270     pub perf_counter_count: u32,
271     pub p_perf_counters: *const GpaPerfCounterAmd,
272     pub streaming_perf_trace_sample_interval: u32,
273     pub perf_counter_device_memory_limit: DeviceSize,
274     pub sq_thread_trace_enable: Bool32,
275     pub sq_thread_trace_suppress_instruction_tokens: Bool32,
276     pub sq_thread_trace_device_memory_limit: DeviceSize,
277     pub timing_pre_sample: PipelineStageFlags,
278     pub timing_post_sample: PipelineStageFlags,
279 }
280 
281 #[repr(C)]
282 #[derive(Copy, Clone, Debug)]
283 pub struct GpaDeviceClockModeInfoAmd {
284     pub s_type: StructureType,
285     pub p_next: *const c_void,
286     pub clock_mode: GpaDeviceClockModeAmd,
287     pub memory_clock_ratio_to_peak: f32,
288     pub engine_clock_ratio_to_peak: f32,
289 }
290 
291 #[allow(non_camel_case_types)]
292 pub type PFN_vkCreateGpaSessionAMD = extern "system" fn(
293     device: Device,
294     p_create_info: *const GpaSessionCreateInfoAmd,
295     p_allocator: *const AllocationCallbacks,
296     p_gpa_session: *mut GpaSessionAmd,
297 ) -> Result;
298 
299 #[allow(non_camel_case_types)]
300 pub type PFN_vkDestroyGpaSessionAMD = extern "system" fn(
301     device: Device,
302     gpa_session: GpaSessionAmd,
303     p_allocator: *const AllocationCallbacks,
304 ) -> c_void;
305 
306 #[allow(non_camel_case_types)]
307 pub type PFN_vkSetGpaDeviceClockModeAMD =
308     extern "system" fn(device: Device, p_info: *mut GpaDeviceClockModeInfoAmd) -> Result;
309 
310 #[allow(non_camel_case_types)]
311 pub type PFN_vkCmdBeginGpaSessionAMD =
312     extern "system" fn(commandBuffer: CommandBuffer, gpa_session: GpaSessionAmd) -> Result;
313 
314 #[allow(non_camel_case_types)]
315 pub type PFN_vkCmdEndGpaSessionAMD =
316     extern "system" fn(commandBuffer: CommandBuffer, gpa_session: GpaSessionAmd) -> Result;
317 
318 #[allow(non_camel_case_types)]
319 pub type PFN_vkCmdBeginGpaSampleAMD = extern "system" fn(
320     commandBuffer: CommandBuffer,
321     gpa_session: GpaSessionAmd,
322     p_gpa_sample_begin_info: *const GpaSampleBeginInfoAmd,
323     p_sample_id: *mut u32,
324 ) -> Result;
325 
326 #[allow(non_camel_case_types)]
327 pub type PFN_vkCmdEndGpaSampleAMD = extern "system" fn(
328     commandBuffer: CommandBuffer,
329     gpa_session: GpaSessionAmd,
330     sample_id: u32,
331 ) -> c_void;
332 
333 #[allow(non_camel_case_types)]
334 pub type PFN_vkGetGpaSessionStatusAMD =
335     extern "system" fn(device: Device, gpaSession: GpaSessionAmd) -> Result;
336 
337 #[allow(non_camel_case_types)]
338 pub type PFN_vkGetGpaSessionResultsAMD = extern "system" fn(
339     device: Device,
340     gpaSession: GpaSessionAmd,
341     sample_id: u32,
342     p_size_in_bytes: *mut usize,
343     p_data: *mut c_void,
344 ) -> Result;
345 
346 #[allow(non_camel_case_types)]
347 pub type PFN_vkResetGpaSessionAMD =
348     extern "system" fn(device: Device, gpaSession: GpaSessionAmd) -> Result;
349 
350 #[allow(non_camel_case_types)]
351 pub type PFN_vkCmdCopyGpaSessionResultsAMD =
352     extern "system" fn(commandBuffer: CommandBuffer, gpaSession: GpaSessionAmd) -> c_void;
353 
354 pub struct AmdGpaInterfaceFn {
355     pub create_gpa_session: PFN_vkCreateGpaSessionAMD,
356     pub destroy_gpa_session: PFN_vkDestroyGpaSessionAMD,
357     pub set_gpa_device_clock_mode: PFN_vkSetGpaDeviceClockModeAMD,
358     pub cmd_begin_gpa_session: PFN_vkCmdBeginGpaSessionAMD,
359     pub cmd_end_gpa_session: PFN_vkCmdEndGpaSessionAMD,
360     pub cmd_begin_gpa_sample: PFN_vkCmdBeginGpaSampleAMD,
361     pub cmd_end_gpa_sample: PFN_vkCmdEndGpaSampleAMD,
362     pub get_gpa_session_status: PFN_vkGetGpaSessionStatusAMD,
363     pub get_gpa_session_results: PFN_vkGetGpaSessionResultsAMD,
364     pub reset_gpa_session: PFN_vkResetGpaSessionAMD,
365     pub cmd_copy_gpa_session_results: PFN_vkCmdCopyGpaSessionResultsAMD,
366 }
367 unsafe impl Send for AmdGpaInterfaceFn {}
368 unsafe impl Sync for AmdGpaInterfaceFn {}
369 
370 impl ::std::clone::Clone for AmdGpaInterfaceFn {
clone(&self) -> Self371     fn clone(&self) -> Self {
372         Self {
373             create_gpa_session: self.create_gpa_session,
374             destroy_gpa_session: self.destroy_gpa_session,
375             set_gpa_device_clock_mode: self.set_gpa_device_clock_mode,
376             cmd_begin_gpa_session: self.cmd_begin_gpa_session,
377             cmd_end_gpa_session: self.cmd_end_gpa_session,
378             cmd_begin_gpa_sample: self.cmd_begin_gpa_sample,
379             cmd_end_gpa_sample: self.cmd_end_gpa_sample,
380             get_gpa_session_status: self.get_gpa_session_status,
381             get_gpa_session_results: self.get_gpa_session_results,
382             reset_gpa_session: self.reset_gpa_session,
383             cmd_copy_gpa_session_results: self.cmd_copy_gpa_session_results,
384         }
385     }
386 }
387 
388 impl AmdGpaInterfaceFn {
load<F>(mut _f: F) -> Self where F: FnMut(&::std::ffi::CStr) -> *const c_void,389     pub fn load<F>(mut _f: F) -> Self
390     where
391         F: FnMut(&::std::ffi::CStr) -> *const c_void,
392     {
393         Self {
394             create_gpa_session: unsafe {
395                 extern "system" fn create_gpa_session_amd(
396                     _device: Device,
397                     _p_create_info: *const GpaSessionCreateInfoAmd,
398                     _p_allocator: *const AllocationCallbacks,
399                     _p_gpa_session: *mut GpaSessionAmd,
400                 ) -> Result {
401                     panic!(concat!(
402                         "Unable to load ",
403                         stringify!(create_gpa_session_amd)
404                     ))
405                 }
406                 let raw_name = stringify!(vkCreateGpaSessionAMD);
407                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
408                 let val = _f(&cname);
409                 if val.is_null() {
410                     create_gpa_session_amd
411                 } else {
412                     ::std::mem::transmute(val)
413                 }
414             },
415             destroy_gpa_session: unsafe {
416                 extern "system" fn destroy_gpa_session_amd(
417                     _device: Device,
418                     _gpa_session: GpaSessionAmd,
419                     _p_allocator: *const AllocationCallbacks,
420                 ) -> c_void {
421                     panic!(concat!(
422                         "Unable to load ",
423                         stringify!(destroy_gpa_session_amd)
424                     ))
425                 }
426                 let raw_name = stringify!(vkDestroyGpaSessionAMD);
427                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
428                 let val = _f(&cname);
429                 if val.is_null() {
430                     destroy_gpa_session_amd
431                 } else {
432                     ::std::mem::transmute(val)
433                 }
434             },
435             set_gpa_device_clock_mode: unsafe {
436                 extern "system" fn set_gpa_device_clock_mode_amd(
437                     _device: Device,
438                     _p_info: *mut GpaDeviceClockModeInfoAmd,
439                 ) -> Result {
440                     panic!(concat!(
441                         "Unable to load ",
442                         stringify!(set_gpa_device_clock_mode_amd)
443                     ))
444                 }
445                 let raw_name = stringify!(vkSetGpaDeviceClockModeAMD);
446                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
447                 let val = _f(&cname);
448                 if val.is_null() {
449                     set_gpa_device_clock_mode_amd
450                 } else {
451                     ::std::mem::transmute(val)
452                 }
453             },
454             cmd_begin_gpa_session: unsafe {
455                 extern "system" fn cmd_begin_gpa_session_amd(
456                     _command_buffer: CommandBuffer,
457                     _gpa_session: GpaSessionAmd,
458                 ) -> Result {
459                     panic!(concat!(
460                         "Unable to load ",
461                         stringify!(cmd_begin_gpa_session_amd)
462                     ))
463                 }
464                 let raw_name = stringify!(vkCmdBeginGpaSessionAMD);
465                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
466                 let val = _f(&cname);
467                 if val.is_null() {
468                     cmd_begin_gpa_session_amd
469                 } else {
470                     ::std::mem::transmute(val)
471                 }
472             },
473             cmd_end_gpa_session: unsafe {
474                 extern "system" fn cmd_end_gpa_session_amd(
475                     _command_buffer: CommandBuffer,
476                     _gpa_session: GpaSessionAmd,
477                 ) -> Result {
478                     panic!(concat!(
479                         "Unable to load ",
480                         stringify!(cmd_end_gpa_session_amd)
481                     ))
482                 }
483                 let raw_name = stringify!(vkCmdEndGpaSessionAMD);
484                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
485                 let val = _f(&cname);
486                 if val.is_null() {
487                     cmd_end_gpa_session_amd
488                 } else {
489                     ::std::mem::transmute(val)
490                 }
491             },
492             cmd_begin_gpa_sample: unsafe {
493                 extern "system" fn cmd_begin_gpa_sample_amd(
494                     _command_buffer: CommandBuffer,
495                     _gpa_session: GpaSessionAmd,
496                     _p_gpa_sample_begin_info: *const GpaSampleBeginInfoAmd,
497                     _p_sample_id: *mut u32,
498                 ) -> Result {
499                     panic!(concat!(
500                         "Unable to load ",
501                         stringify!(cmd_begin_gpa_sample_amd)
502                     ))
503                 }
504                 let raw_name = stringify!(vkCmdBeginGpaSampleAMD);
505                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
506                 let val = _f(&cname);
507                 if val.is_null() {
508                     cmd_begin_gpa_sample_amd
509                 } else {
510                     ::std::mem::transmute(val)
511                 }
512             },
513             cmd_end_gpa_sample: unsafe {
514                 extern "system" fn cmd_end_gpa_sample_amd(
515                     _command_buffer: CommandBuffer,
516                     _gpa_session: GpaSessionAmd,
517                     _sample_id: u32,
518                 ) -> c_void {
519                     panic!(concat!(
520                         "Unable to load ",
521                         stringify!(cmd_end_gpa_sample_amd)
522                     ))
523                 }
524                 let raw_name = stringify!(vkCmdEndGpaSampleAMD);
525                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
526                 let val = _f(&cname);
527                 if val.is_null() {
528                     cmd_end_gpa_sample_amd
529                 } else {
530                     ::std::mem::transmute(val)
531                 }
532             },
533             get_gpa_session_status: unsafe {
534                 extern "system" fn get_gpa_session_status_amd(
535                     _device: Device,
536                     _gpa_session: GpaSessionAmd,
537                 ) -> Result {
538                     panic!(concat!(
539                         "Unable to load ",
540                         stringify!(get_gpa_session_status_amd)
541                     ))
542                 }
543                 let raw_name = stringify!(vkGetGpaSessionStatusAMD);
544                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
545                 let val = _f(&cname);
546                 if val.is_null() {
547                     get_gpa_session_status_amd
548                 } else {
549                     ::std::mem::transmute(val)
550                 }
551             },
552             get_gpa_session_results: unsafe {
553                 extern "system" fn get_gpa_session_results_amd(
554                     _device: Device,
555                     _gpa_session: GpaSessionAmd,
556                     _sample_id: u32,
557                     _p_size_in_bytes: *mut usize,
558                     _p_data: *mut c_void,
559                 ) -> Result {
560                     panic!(concat!(
561                         "Unable to load ",
562                         stringify!(get_gpa_session_results_amd)
563                     ))
564                 }
565                 let raw_name = stringify!(vkGetGpaSessionResultsAMD);
566                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
567                 let val = _f(&cname);
568                 if val.is_null() {
569                     get_gpa_session_results_amd
570                 } else {
571                     ::std::mem::transmute(val)
572                 }
573             },
574             reset_gpa_session: unsafe {
575                 extern "system" fn reset_gpa_session_amd(
576                     _device: Device,
577                     _gpa_session: GpaSessionAmd,
578                 ) -> Result {
579                     panic!(concat!(
580                         "Unable to load ",
581                         stringify!(reset_gpa_session_amd)
582                     ))
583                 }
584                 let raw_name = stringify!(vkCmdEndGpaSampleAMD);
585                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
586                 let val = _f(&cname);
587                 if val.is_null() {
588                     reset_gpa_session_amd
589                 } else {
590                     ::std::mem::transmute(val)
591                 }
592             },
593             cmd_copy_gpa_session_results: unsafe {
594                 extern "system" fn cmd_copy_gpa_session_results_amd(
595                     _command_buffer: CommandBuffer,
596                     _gpa_session: GpaSessionAmd,
597                 ) -> c_void {
598                     panic!(concat!(
599                         "Unable to load ",
600                         stringify!(cmd_copy_gpa_session_results_amd)
601                     ))
602                 }
603                 let raw_name = stringify!(vkCmdCopyGpaSessionResultsAMD);
604                 let cname = ::std::ffi::CString::new(raw_name).unwrap();
605                 let val = _f(&cname);
606                 if val.is_null() {
607                     cmd_copy_gpa_session_results_amd
608                 } else {
609                     ::std::mem::transmute(val)
610                 }
611             },
612         }
613     }
create_gpa_session( &self, device: Device, create_info: *const GpaSessionCreateInfoAmd, allocator: *const AllocationCallbacks, gpa_session: *mut GpaSessionAmd, ) -> Result614     pub unsafe fn create_gpa_session(
615         &self,
616         device: Device,
617         create_info: *const GpaSessionCreateInfoAmd,
618         allocator: *const AllocationCallbacks,
619         gpa_session: *mut GpaSessionAmd,
620     ) -> Result {
621         (self.create_gpa_session)(device, create_info, allocator, gpa_session)
622     }
destroy_gpa_session( &self, device: Device, gpa_session: GpaSessionAmd, allocator: *const AllocationCallbacks, ) -> c_void623     pub unsafe fn destroy_gpa_session(
624         &self,
625         device: Device,
626         gpa_session: GpaSessionAmd,
627         allocator: *const AllocationCallbacks,
628     ) -> c_void {
629         (self.destroy_gpa_session)(device, gpa_session, allocator)
630     }
631 }
632 
633 // Extension: `VK_AMD_wave_limits`
634 
635 impl StructureType {
636     pub const WAVE_LIMIT_AMD: Self = Self(1000045000);
637     pub const PHYSICAL_DEVICE_WAVE_LIMIT_PROPERTIES_AMD: Self = Self(1000045001);
638 }
639 
640 #[repr(C)]
641 #[derive(Copy, Clone, Debug)]
642 pub struct PhysicalDeviceWaveLimitPropertiesAmd {
643     pub s_type: StructureType,
644     pub p_next: *const c_void,
645     pub cu_count: u32,
646     pub max_waves_per_cu: u32,
647 }
648 
649 impl ::std::default::Default for PhysicalDeviceWaveLimitPropertiesAmd {
default() -> Self650     fn default() -> Self {
651         Self {
652             s_type: StructureType::PHYSICAL_DEVICE_WAVE_LIMIT_PROPERTIES_AMD,
653             p_next: ::std::ptr::null_mut(),
654             cu_count: u32::default(),
655             max_waves_per_cu: u32::default(),
656         }
657     }
658 }
659 impl PhysicalDeviceWaveLimitPropertiesAmd {
builder<'a>() -> PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a>660     pub fn builder<'a>() -> PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a> {
661         PhysicalDeviceWaveLimitPropertiesAmdBuilder {
662             inner: Self::default(),
663             marker: ::std::marker::PhantomData,
664         }
665     }
666 }
667 pub struct PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a> {
668     inner: PhysicalDeviceWaveLimitPropertiesAmd,
669     marker: ::std::marker::PhantomData<&'a ()>,
670 }
671 pub unsafe trait ExtendsPhysicalDeviceWaveLimitPropertiesAmd {}
672 unsafe impl ExtendsPhysicalDeviceProperties2 for PhysicalDeviceWaveLimitPropertiesAmd {}
673 impl<'a> ::std::ops::Deref for PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a> {
674     type Target = PhysicalDeviceWaveLimitPropertiesAmd;
deref(&self) -> &Self::Target675     fn deref(&self) -> &Self::Target {
676         &self.inner
677     }
678 }
679 impl<'a> PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a> {
push_next<T>( mut self, next: &'a mut T, ) -> PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a> where T: ExtendsPhysicalDeviceWaveLimitPropertiesAmd,680     pub fn push_next<T>(
681         mut self,
682         next: &'a mut T,
683     ) -> PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a>
684     where
685         T: ExtendsPhysicalDeviceWaveLimitPropertiesAmd,
686     {
687         unsafe {
688             let next_ptr = next as *mut T as *mut BaseOutStructure;
689             let last_next = ptr_chain_iter(next).last().unwrap();
690             (*last_next).p_next = self.inner.p_next as _;
691             self.inner.p_next = next_ptr as _;
692         }
693         self
694     }
build(self) -> PhysicalDeviceWaveLimitPropertiesAmd695     pub fn build(self) -> PhysicalDeviceWaveLimitPropertiesAmd {
696         self.inner
697     }
698 }
699 
700 #[repr(C)]
701 #[derive(Copy, Clone, Debug)]
702 pub struct PipelineShaderStageCreateInfoWaveLimitAmd {
703     pub s_type: StructureType,
704     pub p_next: *const c_void,
705     pub waves_per_cu: f32,
706     pub cu_enable_mask: *mut u32,
707 }
708