mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Fix a few stray uses of "storage class". (#1712)
This commit is contained in:
@@ -392,10 +392,9 @@ fn needs_array_length(ty: Handle<crate::Type>, arena: &crate::UniqueArena<crate:
|
||||
}
|
||||
|
||||
impl crate::AddressSpace {
|
||||
/// Returns true for storage classes, for which the global
|
||||
/// variables are passed in function arguments.
|
||||
/// These arguments need to be passed through any functions
|
||||
/// called from the entry point.
|
||||
/// Returns true if global variables in this address space are
|
||||
/// passed in function arguments. These arguments need to be
|
||||
/// passed through any functions called from the entry point.
|
||||
fn needs_pass_through(&self) -> bool {
|
||||
match *self {
|
||||
crate::AddressSpace::Uniform
|
||||
@@ -1695,8 +1694,8 @@ impl<W: Write> Writer<W> {
|
||||
context: &ExpressionContext,
|
||||
is_scoped: bool,
|
||||
) -> BackendResult {
|
||||
// Since access chains never cross storage classes, we can just check the index
|
||||
// bounds check policy once at the top.
|
||||
// Since access chains never cross between address spaces, we can just
|
||||
// check the index bounds check policy once at the top.
|
||||
let policy = context.choose_bounds_check_policy(pointer);
|
||||
if policy == index::BoundsCheckPolicy::ReadZeroSkipWrite
|
||||
&& self.put_bounds_checks(
|
||||
|
||||
@@ -315,7 +315,7 @@ impl<'w> BlockContext<'w> {
|
||||
/// Emit code for bounds checks for an array, vector, or matrix access.
|
||||
///
|
||||
/// This implements either `index_bounds_check_policy` or
|
||||
/// `buffer_bounds_check_policy`, depending on the storage class of the
|
||||
/// `buffer_bounds_check_policy`, depending on the address space of the
|
||||
/// pointer being accessed.
|
||||
///
|
||||
/// Return a `BoundsCheckResult` indicating how the index should be
|
||||
|
||||
@@ -1298,9 +1298,10 @@ impl Writer {
|
||||
|
||||
pointer_type_id
|
||||
} else {
|
||||
// This is a global variable in a Storage class. The only way it could
|
||||
// have `global_needs_wrapper() == false` is if it has a runtime-sized array.
|
||||
// In this case, we need to decorate it with Block.
|
||||
// This is a global variable in the Storage address space. The only
|
||||
// way it could have `global_needs_wrapper() == false` is if it has
|
||||
// a runtime-sized array. In this case, we need to decorate it with
|
||||
// Block.
|
||||
if let crate::AddressSpace::Storage { .. } = global_variable.space {
|
||||
self.decorate(inner_type_id, Decoration::Block, &[]);
|
||||
}
|
||||
|
||||
@@ -811,9 +811,9 @@ impl Parser {
|
||||
),
|
||||
handle,
|
||||
),
|
||||
// If the argument is a pointer whose address space isn't `Function` an
|
||||
// indirection trough a local variable is needed to align the storage
|
||||
// classes of the call argument and the overload parameter
|
||||
// If the argument is a pointer whose address space isn't `Function`, an
|
||||
// indirection through a local variable is needed to align the address
|
||||
// spaces of the call argument and the overload parameter.
|
||||
TypeInner::Pointer { base, space } if space != AddressSpace::Function => (
|
||||
base,
|
||||
ctx.add_expression(
|
||||
|
||||
@@ -72,7 +72,7 @@ pub struct BoundsCheckPolicies {
|
||||
|
||||
/// How should the generated code handle array, vector, or matrix indices
|
||||
/// that are out of range, when those values live in a [`GlobalVariable`] in
|
||||
/// the [`Storage`] or [`Uniform`] storage classes?
|
||||
/// the [`Storage`] or [`Uniform`] address spaces?
|
||||
///
|
||||
/// Some graphics hardware provides "robust buffer access", a feature that
|
||||
/// ensures that using a pointer cannot access memory outside the 'buffer'
|
||||
@@ -143,7 +143,7 @@ impl BoundsCheckPolicies {
|
||||
match info[access].ty.inner_with(types).pointer_space() {
|
||||
Some(crate::AddressSpace::Storage { access: _ })
|
||||
| Some(crate::AddressSpace::Uniform) => self.buffer,
|
||||
// This covers other storage classes, but also accessing vectors and
|
||||
// This covers other address spaces, but also accessing vectors and
|
||||
// matrices by value, where no pointer is involved.
|
||||
_ => self.index,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user