mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
refactor(vulkan): extract tiling parameter from create_image_without_memory (#9365)
Co-authored-by: Your Name <you@example.com>
This commit is contained in:
1 parent
ed4a28aef0
commit
e25b34fbe2
1 file changed
+20
-1
@@ -456,6 +456,21 @@ impl super::Device {
|
||||
&self,
|
||||
desc: &crate::TextureDescriptor,
|
||||
external_memory_image_create_info: Option<&mut vk::ExternalMemoryImageCreateInfo>,
|
||||
) -> Result<ImageWithoutMemory, crate::DeviceError> {
|
||||
self.create_image_without_memory_with_tiling(
|
||||
desc,
|
||||
vk::ImageTiling::OPTIMAL,
|
||||
external_memory_image_create_info,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
fn create_image_without_memory_with_tiling(
|
||||
&self,
|
||||
desc: &crate::TextureDescriptor,
|
||||
tiling: vk::ImageTiling,
|
||||
external_memory_image_create_info: Option<&mut vk::ExternalMemoryImageCreateInfo>,
|
||||
drm_modifier_info: Option<&mut vk::ImageDrmFormatModifierExplicitCreateInfoEXT>,
|
||||
) -> Result<ImageWithoutMemory, crate::DeviceError> {
|
||||
let copy_size = desc.copy_extent();
|
||||
|
||||
@@ -496,7 +511,7 @@ impl super::Device {
|
||||
.mip_levels(desc.mip_level_count)
|
||||
.array_layers(desc.array_layer_count())
|
||||
.samples(vk::SampleCountFlags::from_raw(desc.sample_count))
|
||||
.tiling(vk::ImageTiling::OPTIMAL)
|
||||
.tiling(tiling)
|
||||
.usage(conv::map_texture_usage(desc.usage))
|
||||
.sharing_mode(vk::SharingMode::EXCLUSIVE)
|
||||
.initial_layout(vk::ImageLayout::UNDEFINED);
|
||||
@@ -511,6 +526,10 @@ impl super::Device {
|
||||
vk_info = vk_info.push_next(ext_info);
|
||||
}
|
||||
|
||||
if let Some(drm_info) = drm_modifier_info {
|
||||
vk_info = vk_info.push_next(drm_info);
|
||||
}
|
||||
|
||||
let raw = unsafe { self.shared.raw.create_image(&vk_info, None) }.map_err(map_err)?;
|
||||
fn map_err(err: vk::Result) -> crate::DeviceError {
|
||||
// We don't use VK_EXT_image_compression_control
|
||||
|
||||
Reference in new issue
Block a user