Fix clippy::use_self in extension modules (#423)

* Fix clippy::use_self warnings in extension modules

* Deny clippy::use_self in extension modules

Note that clippy::use_self generates some false positives that must be ignored
This commit is contained in:
Philippe Renon 2021-04-27 12:12:38 +02:00 committed by GitHub
parent 6a522c878a
commit 434330ca3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 139 additions and 143 deletions

View file

@ -39,6 +39,10 @@ vk_bitflags_wrapped!(
0b1111111111111111111111111111111,
Flags
);
// ignore clippy::use_self false positives
// changing GpaSqShaderStageFlags::PS.0 to Self::PS.0 as suggested by clippy generates:
// error[E0401]: can't use generic parameters from outer function
#[allow(clippy::use_self)]
impl fmt::Debug for GpaSqShaderStageFlags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[
@ -54,21 +58,21 @@ impl fmt::Debug for GpaSqShaderStageFlags {
}
}
impl GpaSqShaderStageFlags {
pub const PS: Self = GpaSqShaderStageFlags(0b1);
pub const VS: Self = GpaSqShaderStageFlags(0b10);
pub const GS: Self = GpaSqShaderStageFlags(0b100);
pub const ES: Self = GpaSqShaderStageFlags(0b1000);
pub const HS: Self = GpaSqShaderStageFlags(0b10000);
pub const LS: Self = GpaSqShaderStageFlags(0b100000);
pub const CS: Self = GpaSqShaderStageFlags(0b1000000);
pub const PS: Self = Self(0b1);
pub const VS: Self = Self(0b10);
pub const GS: Self = Self(0b100);
pub const ES: Self = Self(0b1000);
pub const HS: Self = Self(0b10000);
pub const LS: Self = Self(0b100000);
pub const CS: Self = Self(0b1000000);
}
impl StructureType {
pub const PHYSICAL_DEVICE_GPA_FEATURES_AMD: Self = StructureType(1000133000);
pub const PHYSICAL_DEVICE_GPA_PROPERTIES_AMD: Self = StructureType(1000133001);
pub const GPA_SAMPLE_BEGIN_INFO_AMD: Self = StructureType(1000133002);
pub const GPA_SESSION_CREATE_INFO_AMD: Self = StructureType(1000133003);
pub const GPA_DEVICE_CLOCK_MODE_INFO_AMD: Self = StructureType(1000133004);
pub const PHYSICAL_DEVICE_GPA_FEATURES_AMD: Self = Self(1000133000);
pub const PHYSICAL_DEVICE_GPA_PROPERTIES_AMD: Self = Self(1000133001);
pub const GPA_SAMPLE_BEGIN_INFO_AMD: Self = Self(1000133002);
pub const GPA_SESSION_CREATE_INFO_AMD: Self = Self(1000133003);
pub const GPA_DEVICE_CLOCK_MODE_INFO_AMD: Self = Self(1000133004);
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
@ -76,19 +80,19 @@ impl StructureType {
pub struct GpaDeviceClockModeAmd(pub(crate) i32);
impl GpaDeviceClockModeAmd {
pub fn from_raw(x: i32) -> Self {
GpaDeviceClockModeAmd(x)
Self(x)
}
pub fn as_raw(self) -> i32 {
self.0
}
}
impl GpaDeviceClockModeAmd {
pub const DEFAULT: Self = GpaDeviceClockModeAmd(0);
pub const QUERY: Self = GpaDeviceClockModeAmd(1);
pub const PROFILING: Self = GpaDeviceClockModeAmd(2);
pub const MIN_MEMORY: Self = GpaDeviceClockModeAmd(3);
pub const MIN_ENGINE: Self = GpaDeviceClockModeAmd(4);
pub const PEAK: Self = GpaDeviceClockModeAmd(5);
pub const DEFAULT: Self = Self(0);
pub const QUERY: Self = Self(1);
pub const PROFILING: Self = Self(2);
pub const MIN_MEMORY: Self = Self(3);
pub const MIN_ENGINE: Self = Self(4);
pub const PEAK: Self = Self(5);
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
@ -96,45 +100,45 @@ impl GpaDeviceClockModeAmd {
pub struct GpaPerfBlockAmd(pub(crate) i32);
impl GpaPerfBlockAmd {
pub fn from_raw(x: i32) -> Self {
GpaPerfBlockAmd(x)
Self(x)
}
pub fn as_raw(self) -> i32 {
self.0
}
}
impl GpaPerfBlockAmd {
pub const CPF: Self = GpaPerfBlockAmd(0);
pub const IA: Self = GpaPerfBlockAmd(1);
pub const VGT: Self = GpaPerfBlockAmd(2);
pub const PA: Self = GpaPerfBlockAmd(3);
pub const SC: Self = GpaPerfBlockAmd(4);
pub const SPI: Self = GpaPerfBlockAmd(5);
pub const SQ: Self = GpaPerfBlockAmd(6);
pub const SX: Self = GpaPerfBlockAmd(7);
pub const TA: Self = GpaPerfBlockAmd(8);
pub const TD: Self = GpaPerfBlockAmd(9);
pub const TCP: Self = GpaPerfBlockAmd(10);
pub const TCC: Self = GpaPerfBlockAmd(11);
pub const TCA: Self = GpaPerfBlockAmd(12);
pub const DB: Self = GpaPerfBlockAmd(13);
pub const CB: Self = GpaPerfBlockAmd(14);
pub const GDS: Self = GpaPerfBlockAmd(15);
pub const SRBM: Self = GpaPerfBlockAmd(16);
pub const GRBM: Self = GpaPerfBlockAmd(17);
pub const GRBM_SE: Self = GpaPerfBlockAmd(18);
pub const RLC: Self = GpaPerfBlockAmd(19);
pub const DMA: Self = GpaPerfBlockAmd(20);
pub const MC: Self = GpaPerfBlockAmd(21);
pub const CPG: Self = GpaPerfBlockAmd(22);
pub const CPC: Self = GpaPerfBlockAmd(23);
pub const WD: Self = GpaPerfBlockAmd(24);
pub const TCS: Self = GpaPerfBlockAmd(25);
pub const ATC: Self = GpaPerfBlockAmd(26);
pub const ATC_L2: Self = GpaPerfBlockAmd(27);
pub const MC_VM_L2: Self = GpaPerfBlockAmd(28);
pub const EA: Self = GpaPerfBlockAmd(29);
pub const RPB: Self = GpaPerfBlockAmd(30);
pub const RMI: Self = GpaPerfBlockAmd(31);
pub const CPF: Self = Self(0);
pub const IA: Self = Self(1);
pub const VGT: Self = Self(2);
pub const PA: Self = Self(3);
pub const SC: Self = Self(4);
pub const SPI: Self = Self(5);
pub const SQ: Self = Self(6);
pub const SX: Self = Self(7);
pub const TA: Self = Self(8);
pub const TD: Self = Self(9);
pub const TCP: Self = Self(10);
pub const TCC: Self = Self(11);
pub const TCA: Self = Self(12);
pub const DB: Self = Self(13);
pub const CB: Self = Self(14);
pub const GDS: Self = Self(15);
pub const SRBM: Self = Self(16);
pub const GRBM: Self = Self(17);
pub const GRBM_SE: Self = Self(18);
pub const RLC: Self = Self(19);
pub const DMA: Self = Self(20);
pub const MC: Self = Self(21);
pub const CPG: Self = Self(22);
pub const CPC: Self = Self(23);
pub const WD: Self = Self(24);
pub const TCS: Self = Self(25);
pub const ATC: Self = Self(26);
pub const ATC_L2: Self = Self(27);
pub const MC_VM_L2: Self = Self(28);
pub const EA: Self = Self(29);
pub const RPB: Self = Self(30);
pub const RMI: Self = Self(31);
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
@ -142,16 +146,16 @@ impl GpaPerfBlockAmd {
pub struct GpaSampleTypeAmd(pub(crate) i32);
impl GpaSampleTypeAmd {
pub fn from_raw(x: i32) -> Self {
GpaSampleTypeAmd(x)
Self(x)
}
pub fn as_raw(self) -> i32 {
self.0
}
}
impl GpaSampleTypeAmd {
pub const CUMULATIVE: Self = GpaSampleTypeAmd(0);
pub const TRACE: Self = GpaSampleTypeAmd(1);
pub const TIMING: Self = GpaSampleTypeAmd(2);
pub const CUMULATIVE: Self = Self(0);
pub const TRACE: Self = Self(1);
pub const TIMING: Self = Self(2);
}
handle_nondispatchable!(GpaSessionAmd, UNKNOWN);
@ -200,8 +204,8 @@ pub struct PhysicalDeviceGpaPropertiesAmd {
}
impl ::std::default::Default for PhysicalDeviceGpaPropertiesAmd {
fn default() -> PhysicalDeviceGpaPropertiesAmd {
PhysicalDeviceGpaPropertiesAmd {
fn default() -> Self {
Self {
s_type: StructureType::PHYSICAL_DEVICE_GPA_PROPERTIES_AMD,
p_next: ::std::ptr::null_mut(),
flags: Flags::default(),
@ -215,7 +219,7 @@ impl ::std::default::Default for PhysicalDeviceGpaPropertiesAmd {
impl PhysicalDeviceGpaPropertiesAmd {
pub fn builder<'a>() -> PhysicalDeviceGpaPropertiesAmdBuilder<'a> {
PhysicalDeviceGpaPropertiesAmdBuilder {
inner: PhysicalDeviceGpaPropertiesAmd::default(),
inner: Self::default(),
marker: ::std::marker::PhantomData,
}
}
@ -365,7 +369,7 @@ unsafe impl Sync for AmdGpaInterfaceFn {}
impl ::std::clone::Clone for AmdGpaInterfaceFn {
fn clone(&self) -> Self {
AmdGpaInterfaceFn {
Self {
create_gpa_session: self.create_gpa_session,
destroy_gpa_session: self.destroy_gpa_session,
set_gpa_device_clock_mode: self.set_gpa_device_clock_mode,
@ -386,7 +390,7 @@ impl AmdGpaInterfaceFn {
where
F: FnMut(&::std::ffi::CStr) -> *const c_void,
{
AmdGpaInterfaceFn {
Self {
create_gpa_session: unsafe {
extern "system" fn create_gpa_session_amd(
_device: Device,
@ -629,8 +633,8 @@ impl AmdGpaInterfaceFn {
// Extension: `VK_AMD_wave_limits`
impl StructureType {
pub const WAVE_LIMIT_AMD: Self = StructureType(1000045000);
pub const PHYSICAL_DEVICE_WAVE_LIMIT_PROPERTIES_AMD: Self = StructureType(1000045001);
pub const WAVE_LIMIT_AMD: Self = Self(1000045000);
pub const PHYSICAL_DEVICE_WAVE_LIMIT_PROPERTIES_AMD: Self = Self(1000045001);
}
#[repr(C)]
@ -643,8 +647,8 @@ pub struct PhysicalDeviceWaveLimitPropertiesAmd {
}
impl ::std::default::Default for PhysicalDeviceWaveLimitPropertiesAmd {
fn default() -> PhysicalDeviceWaveLimitPropertiesAmd {
PhysicalDeviceWaveLimitPropertiesAmd {
fn default() -> Self {
Self {
s_type: StructureType::PHYSICAL_DEVICE_WAVE_LIMIT_PROPERTIES_AMD,
p_next: ::std::ptr::null_mut(),
cu_count: u32::default(),
@ -655,7 +659,7 @@ impl ::std::default::Default for PhysicalDeviceWaveLimitPropertiesAmd {
impl PhysicalDeviceWaveLimitPropertiesAmd {
pub fn builder<'a>() -> PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a> {
PhysicalDeviceWaveLimitPropertiesAmdBuilder {
inner: PhysicalDeviceWaveLimitPropertiesAmd::default(),
inner: Self::default(),
marker: ::std::marker::PhantomData,
}
}

View file

@ -11,11 +11,11 @@ pub struct BufferDeviceAddress {
}
impl BufferDeviceAddress {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> BufferDeviceAddress {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let fns = vk::ExtBufferDeviceAddressFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
BufferDeviceAddress {
Self {
handle: device.handle(),
fns,
}

View file

@ -11,11 +11,11 @@ pub struct DebugMarker {
}
impl DebugMarker {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> DebugMarker {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let debug_marker_fn = vk::ExtDebugMarkerFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
DebugMarker { debug_marker_fn }
Self { debug_marker_fn }
}
pub fn name() -> &'static CStr {

View file

@ -13,11 +13,11 @@ pub struct DebugReport {
}
impl DebugReport {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> DebugReport {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let debug_report_fn = vk::ExtDebugReportFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
DebugReport {
Self {
handle: instance.handle(),
debug_report_fn,
}

View file

@ -12,11 +12,11 @@ pub struct DebugUtils {
}
impl DebugUtils {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> DebugUtils {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let debug_utils_fn = vk::ExtDebugUtilsFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
DebugUtils {
Self {
handle: instance.handle(),
debug_utils_fn,
}

View file

@ -13,11 +13,11 @@ pub struct FullScreenExclusive {
}
impl FullScreenExclusive {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> FullScreenExclusive {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let full_screen_exclusive_fn = vk::ExtFullScreenExclusiveFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
FullScreenExclusive {
Self {
handle: device.handle(),
full_screen_exclusive_fn,
}

View file

@ -13,11 +13,11 @@ pub struct MetalSurface {
}
impl MetalSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> MetalSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::ExtMetalSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
MetalSurface {
Self {
handle: instance.handle(),
metal_surface_fn: surface_fn,
}

View file

@ -13,11 +13,11 @@ pub struct ToolingInfo {
}
impl ToolingInfo {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> ToolingInfo {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let tooling_info_fn = vk::ExtToolingInfoFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
ToolingInfo {
Self {
handle: instance.handle(),
tooling_info_fn,
}

View file

@ -13,11 +13,11 @@ pub struct AndroidSurface {
}
impl AndroidSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> AndroidSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::KhrAndroidSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
AndroidSurface {
Self {
handle: instance.handle(),
android_surface_fn: surface_fn,
}

View file

@ -11,11 +11,11 @@ pub struct BufferDeviceAddress {
}
impl BufferDeviceAddress {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> BufferDeviceAddress {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let fns = vk::KhrBufferDeviceAddressFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
BufferDeviceAddress {
Self {
handle: device.handle(),
fns,
}

View file

@ -13,11 +13,11 @@ pub struct CreateRenderPass2 {
}
impl CreateRenderPass2 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> CreateRenderPass2 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let khr_create_renderpass2_fn = vk::KhrCreateRenderpass2Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
CreateRenderPass2 {
Self {
handle: device.handle(),
khr_create_renderpass2_fn,
}

View file

@ -13,11 +13,11 @@ pub struct Display {
}
impl Display {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Display {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let display_fn = vk::KhrDisplayFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
Display {
Self {
handle: instance.handle(),
display_fn,
}

View file

@ -13,11 +13,11 @@ pub struct DisplaySwapchain {
}
impl DisplaySwapchain {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> DisplaySwapchain {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let swapchain_fn = vk::KhrDisplaySwapchainFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
DisplaySwapchain {
Self {
handle: device.handle(),
swapchain_fn,
}

View file

@ -11,12 +11,11 @@ pub struct DrawIndirectCount {
}
impl DrawIndirectCount {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> DrawIndirectCount {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let draw_indirect_count_fn = vk::KhrDrawIndirectCountFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
DrawIndirectCount {
Self {
handle: device.handle(),
draw_indirect_count_fn,
}

View file

@ -12,11 +12,11 @@ pub struct GetMemoryRequirements2 {
}
impl GetMemoryRequirements2 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> GetMemoryRequirements2 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let get_memory_requirements2_fn = vk::KhrGetMemoryRequirements2Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
GetMemoryRequirements2 {
Self {
handle: device.handle(),
get_memory_requirements2_fn,
}

View file

@ -13,15 +13,12 @@ pub struct GetPhysicalDeviceProperties2 {
}
impl GetPhysicalDeviceProperties2 {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(
entry: &E,
instance: &I,
) -> GetPhysicalDeviceProperties2 {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let get_physical_device_properties2_fn =
vk::KhrGetPhysicalDeviceProperties2Fn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
GetPhysicalDeviceProperties2 {
Self {
handle: instance.handle(),
get_physical_device_properties2_fn,
}

View file

@ -11,11 +11,11 @@ pub struct Maintenance1 {
}
impl Maintenance1 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Maintenance1 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let fns = vk::KhrMaintenance1Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
Maintenance1 {
Self {
handle: device.handle(),
fns,
}

View file

@ -11,11 +11,11 @@ pub struct Maintenance3 {
}
impl Maintenance3 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Maintenance3 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let fns = vk::KhrMaintenance3Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
Maintenance3 {
Self {
handle: device.handle(),
fns,
}

View file

@ -13,16 +13,12 @@ pub struct PipelineExecutableProperties {
}
impl PipelineExecutableProperties {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(
entry: &E,
instance: &I,
) -> PipelineExecutableProperties {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let pipeline_executable_properties_fn =
vk::KhrPipelineExecutablePropertiesFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
PipelineExecutableProperties {
Self {
handle: instance.handle(),
pipeline_executable_properties_fn,
}

View file

@ -12,12 +12,11 @@ pub struct PushDescriptor {
}
impl PushDescriptor {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> PushDescriptor {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let push_descriptors_fn = vk::KhrPushDescriptorFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
PushDescriptor {
Self {
handle: instance.handle(),
push_descriptors_fn,
}

View file

@ -14,11 +14,11 @@ pub struct Surface {
}
impl Surface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Surface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::KhrSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
Surface {
Self {
handle: instance.handle(),
surface_fn,
}

View file

@ -14,11 +14,11 @@ pub struct Swapchain {
}
impl Swapchain {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Swapchain {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let swapchain_fn = vk::KhrSwapchainFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
Swapchain {
Self {
handle: device.handle(),
swapchain_fn,
}

View file

@ -12,12 +12,11 @@ pub struct TimelineSemaphore {
}
impl TimelineSemaphore {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> TimelineSemaphore {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let timeline_semaphore_fn = vk::KhrTimelineSemaphoreFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
TimelineSemaphore {
Self {
handle: instance.handle(),
timeline_semaphore_fn,
}

View file

@ -13,11 +13,11 @@ pub struct WaylandSurface {
}
impl WaylandSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> WaylandSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::KhrWaylandSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
WaylandSurface {
Self {
handle: instance.handle(),
wayland_surface_fn: surface_fn,
}

View file

@ -13,11 +13,11 @@ pub struct Win32Surface {
}
impl Win32Surface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Win32Surface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::KhrWin32SurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
Win32Surface {
Self {
handle: instance.handle(),
win32_surface_fn: surface_fn,
}

View file

@ -13,11 +13,11 @@ pub struct XcbSurface {
}
impl XcbSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> XcbSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::KhrXcbSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
XcbSurface {
Self {
handle: instance.handle(),
xcb_surface_fn: surface_fn,
}

View file

@ -13,11 +13,11 @@ pub struct XlibSurface {
}
impl XlibSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> XlibSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::KhrXlibSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
XlibSurface {
Self {
handle: instance.handle(),
xlib_surface_fn: surface_fn,
}

View file

@ -1,3 +1,4 @@
#![deny(clippy::use_self)]
pub mod experimental;
pub mod ext;
pub mod khr;

View file

@ -13,11 +13,11 @@ pub struct IOSSurface {
}
impl IOSSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> IOSSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::MvkIosSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
IOSSurface {
Self {
handle: instance.handle(),
ios_surface_fn: surface_fn,
}

View file

@ -13,11 +13,11 @@ pub struct MacOSSurface {
}
impl MacOSSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> MacOSSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::MvkMacosSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
MacOSSurface {
Self {
handle: instance.handle(),
macos_surface_fn: surface_fn,
}

View file

@ -13,11 +13,11 @@ pub struct ViSurface {
}
impl ViSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> ViSurface {
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> Self {
let surface_fn = vk::NnViSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
ViSurface {
Self {
handle: instance.handle(),
vi_surface_fn: surface_fn,
}

View file

@ -11,15 +11,12 @@ pub struct DeviceDiagnosticCheckpoints {
}
impl DeviceDiagnosticCheckpoints {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(
instance: &I,
device: &D,
) -> DeviceDiagnosticCheckpoints {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let device_diagnostic_checkpoints_fn =
vk::NvDeviceDiagnosticCheckpointsFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
DeviceDiagnosticCheckpoints {
Self {
device_diagnostic_checkpoints_fn,
}
}

View file

@ -10,12 +10,13 @@ pub struct MeshShader {
}
impl MeshShader {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> MeshShader {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let mesh_shader_fn = vk::NvMeshShaderFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
MeshShader { mesh_shader_fn }
Self { mesh_shader_fn }
}
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdDrawMeshTasksNV.html>"]
pub unsafe fn cmd_draw_mesh_tasks(
&self,
@ -26,6 +27,7 @@ impl MeshShader {
self.mesh_shader_fn
.cmd_draw_mesh_tasks_nv(command_buffer, task_count, first_task);
}
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdDrawMeshTasksIndirectNV.html>"]
pub unsafe fn cmd_draw_mesh_tasks_indirect(
&self,
@ -43,6 +45,7 @@ impl MeshShader {
stride,
);
}
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdDrawMeshTasksIndirectCountNV.html>"]
pub unsafe fn cmd_draw_mesh_tasks_indirect_count(
&self,
@ -64,6 +67,7 @@ impl MeshShader {
stride,
);
}
pub fn name() -> &'static CStr {
vk::NvMeshShaderFn::name()
}

View file

@ -13,11 +13,11 @@ pub struct RayTracing {
}
impl RayTracing {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> RayTracing {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Self {
let ray_tracing_fn = vk::NvRayTracingFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
RayTracing {
Self {
handle: device.handle(),
ray_tracing_fn,
}