extensions: Remove get_properties() helper from extension wrappers (#728)

This helper function isn't consistently implemented across most
extension wrappers, and promotes bad Vulkan patterns by not making it
obvious to the caller that `get_physical_device_properties2()` can and
should be used to fill multiple properties structs at once.
This commit is contained in:
Marijn Suijten 2023-03-30 11:12:36 +02:00 committed by GitHub
parent a9fbc7147b
commit f98cab47dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 64 deletions

View file

@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed experimental AMD extensions (#607)
- Removed `query_count` parameter from `get_query_pool_results()` in favour of `data.len()` (#644)
- Removed misnamed, deprecated `debug_utils_set_object_name()` and `debug_utils_set_object_tag()` entirely, use `set_debug_utils_object_name()` and `set_debug_utils_object_tag()` instead (#661)
- Removed `get_properties` helper from extension wrappers (and `ext::PhysicalDeviceDrm`). Directly call `get_physical_device_properties2()` with a possible chain of multiple structs instead (#728)
## [0.37.2] - 2022-01-11

View file

@ -16,7 +16,6 @@ pub use self::image_compression_control::ImageCompressionControl;
pub use self::image_drm_format_modifier::ImageDrmFormatModifier;
pub use self::mesh_shader::MeshShader;
pub use self::metal_surface::MetalSurface;
pub use self::physical_device_drm::PhysicalDeviceDrm;
pub use self::private_data::PrivateData;
pub use self::sample_locations::SampleLocations;
pub use self::tooling_info::ToolingInfo;
@ -39,7 +38,6 @@ mod image_compression_control;
mod image_drm_format_modifier;
mod mesh_shader;
mod metal_surface;
mod physical_device_drm;
mod private_data;
mod sample_locations;
mod tooling_info;

View file

@ -1,23 +0,0 @@
use crate::vk;
use crate::Instance;
use std::ffi::CStr;
#[derive(Clone)]
pub struct PhysicalDeviceDrm;
impl PhysicalDeviceDrm {
#[inline]
pub unsafe fn get_properties(
instance: &Instance,
pdevice: vk::PhysicalDevice,
) -> vk::PhysicalDeviceDrmPropertiesEXT {
let mut props_drm = vk::PhysicalDeviceDrmPropertiesEXT::default();
{
let mut props = vk::PhysicalDeviceProperties2::default().push_next(&mut props_drm);
instance.get_physical_device_properties2(pdevice, &mut props);
}
props_drm
}
pub const NAME: &'static CStr = vk::ExtPhysicalDeviceDrmFn::NAME;
}

View file

@ -20,19 +20,6 @@ impl AccelerationStructure {
Self { handle, fp }
}
#[inline]
pub unsafe fn get_properties(
instance: &Instance,
pdevice: vk::PhysicalDevice,
) -> vk::PhysicalDeviceAccelerationStructurePropertiesKHR {
let mut props_rt = vk::PhysicalDeviceAccelerationStructurePropertiesKHR::default();
{
let mut props = vk::PhysicalDeviceProperties2::default().push_next(&mut props_rt);
instance.get_physical_device_properties2(pdevice, &mut props);
}
props_rt
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAccelerationStructureKHR.html>
#[inline]
pub unsafe fn create_acceleration_structure(

View file

@ -20,19 +20,6 @@ impl RayTracingPipeline {
Self { handle, fp }
}
#[inline]
pub unsafe fn get_properties(
instance: &Instance,
pdevice: vk::PhysicalDevice,
) -> vk::PhysicalDeviceRayTracingPipelinePropertiesKHR {
let mut props_rt = vk::PhysicalDeviceRayTracingPipelinePropertiesKHR::default();
{
let mut props = vk::PhysicalDeviceProperties2::default().push_next(&mut props_rt);
instance.get_physical_device_properties2(pdevice, &mut props);
}
props_rt
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysKHR.html>
#[inline]
pub unsafe fn cmd_trace_rays(

View file

@ -20,19 +20,6 @@ impl RayTracing {
Self { handle, fp }
}
#[inline]
pub unsafe fn get_properties(
instance: &Instance,
pdevice: vk::PhysicalDevice,
) -> vk::PhysicalDeviceRayTracingPropertiesNV {
let mut props_rt = vk::PhysicalDeviceRayTracingPropertiesNV::default();
{
let mut props = vk::PhysicalDeviceProperties2::default().push_next(&mut props_rt);
instance.get_physical_device_properties2(pdevice, &mut props);
}
props_rt
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAccelerationStructureNV.html>
#[inline]
pub unsafe fn create_acceleration_structure(