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