[core] Use label field of TextureDescriptor (#9714)

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Sam authored and GitHub committed 2026-06-23 09:18:24 -04:00
1 parent 47cce259cb
commit ed57d2e82a
4 files changed
+14 -13

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
use alloc::{sync::Arc, vec::Vec};
use alloc::{string::String, sync::Arc, vec::Vec};
use core::ops::Range;
use crate::{
@@ -370,7 +370,7 @@ pub(crate) fn clear_texture<T: TextureTrackerSetSingle>(
}
fn clear_texture_via_buffer_copies(
texture_desc: &wgt::TextureDescriptor<(), Vec<wgt::TextureFormat>>,
texture_desc: &wgt::TextureDescriptor<String, Vec<wgt::TextureFormat>>,
alignments: &hal::Alignments,
zero_buffer: &dyn hal::DynBuffer, // Buffer of size device::ZERO_BUFFER_SIZE
range: TextureInitRange,
+2 -2
View File
@@ -451,7 +451,7 @@ pub(crate) fn validate_texture_copy_dst_format(
pub(crate) fn validate_texture_buffer_copy<T>(
texture_copy_view: &wgt::TexelCopyTextureInfo<T>,
aspect: hal::FormatAspects,
desc: &wgt::TextureDescriptor<(), Vec<wgt::TextureFormat>>,
desc: &wgt::TextureDescriptor<String, Vec<wgt::TextureFormat>>,
layout: &wgt::TexelCopyBufferLayout,
aligned: bool,
) -> Result<(), TransferError> {
@@ -502,7 +502,7 @@ pub(crate) fn validate_texture_buffer_copy<T>(
/// [vtcr]: https://gpuweb.github.io/gpuweb/#abstract-opdef-validating-texture-copy-range
pub(crate) fn validate_texture_copy_range<T>(
texture_copy_view: &wgt::TexelCopyTextureInfo<T>,
desc: &wgt::TextureDescriptor<(), Vec<wgt::TextureFormat>>,
desc: &wgt::TextureDescriptor<String, Vec<wgt::TextureFormat>>,
texture_side: CopySide,
copy_size: &Extent3d,
) -> Result<(hal::CopyExtent, u32), TransferError> {
+2 -2
View File
@@ -1,6 +1,6 @@
use super::{InitTracker, MemoryInitKind};
use crate::resource::Texture;
use alloc::{sync::Arc, vec::Vec};
use alloc::{string::String, sync::Arc, vec::Vec};
use arrayvec::ArrayVec;
use core::ops::Range;
use wgt::TextureSelector;
@@ -18,7 +18,7 @@ pub(crate) struct TextureInitRange {
pub(crate) fn has_copy_partial_init_tracker_coverage<T>(
copy_size: &wgt::Extent3d,
copy_info: &wgt::TexelCopyTextureInfo<T>,
desc: &wgt::TextureDescriptor<(), Vec<wgt::TextureFormat>>,
desc: &wgt::TextureDescriptor<String, Vec<wgt::TextureFormat>>,
) -> bool {
let target_size = desc.mip_level_size(copy_info.mip_level).unwrap();
copy_size.width != target_size.width
+8 -7
View File
@@ -1357,13 +1357,11 @@ pub enum TextureClearMode {
pub struct Texture {
pub(crate) inner: Snatchable<TextureInner>,
pub(crate) device: Arc<Device>,
pub(crate) desc: wgt::TextureDescriptor<(), Vec<wgt::TextureFormat>>,
pub(crate) desc: wgt::TextureDescriptor<String, Vec<wgt::TextureFormat>>,
pub(crate) _hal_usage: wgt::TextureUses,
pub(crate) format_features: wgt::TextureFormatFeatures,
pub(crate) initialization_status: RwLock<TextureInitTracker>,
pub(crate) full_range: TextureSelector,
/// The `label` from the descriptor used to create the resource.
pub(crate) label: String,
pub(crate) tracking_data: TrackingData,
pub(crate) clear_mode: RwLock<TextureClearMode>,
pub(crate) views: Mutex<WeakVec<TextureView>>,
@@ -1384,7 +1382,7 @@ impl Texture {
Texture {
inner: Snatchable::new(inner),
device: device.clone(),
desc: desc.map_label(|_| ()),
desc: desc.map_label(|label| label.to_string()),
_hal_usage: hal_usage,
format_features,
initialization_status: RwLock::new(
@@ -1399,7 +1397,6 @@ impl Texture {
mips: 0..desc.mip_level_count,
layers: 0..desc.array_layer_count(),
},
label: desc.label.to_string(),
tracking_data: TrackingData::new(device.tracker_indices.textures.clone()),
clear_mode: RwLock::new(rank::TEXTURE_CLEAR_MODE, clear_mode),
views: Mutex::new(rank::TEXTURE_VIEWS, WeakVec::new()),
@@ -1491,7 +1488,7 @@ impl Texture {
pub(crate) fn get_clear_view<'a>(
clear_mode: &'a TextureClearMode,
desc: &'a wgt::TextureDescriptor<(), Vec<wgt::TextureFormat>>,
desc: &'a wgt::TextureDescriptor<String, Vec<wgt::TextureFormat>>,
mip_level: u32,
depth_or_layer: u32,
) -> &'a dyn hal::DynTextureView {
@@ -1731,7 +1728,11 @@ pub enum CreateTextureError {
}
crate::impl_resource_type!(Texture);
crate::impl_labeled!(Texture);
impl Labeled for Texture {
fn label(&self) -> &str {
&self.desc.label
}
}
crate::impl_parent_device!(Texture);
crate::impl_storage_item!(Texture);
crate::impl_trackable!(Texture);