mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
[naga spv-out] Abstract out non-uniform binding array access test.
Introduce a new function, `BlockContext::is_nonuniform_binding_array_access`, which determines whether a given array access expression means that the `OpAccessChain` instruction must have a `NonUniform` decoration.
This commit is contained in:
parent
58e1946bd6
commit
634a97fcb8
@ -1828,19 +1828,8 @@ impl<'w> BlockContext<'w> {
|
|||||||
let root_id = loop {
|
let root_id = loop {
|
||||||
expr_handle = match self.ir_function.expressions[expr_handle] {
|
expr_handle = match self.ir_function.expressions[expr_handle] {
|
||||||
crate::Expression::Access { base, index } => {
|
crate::Expression::Access { base, index } => {
|
||||||
if let crate::Expression::GlobalVariable(var_handle) =
|
is_non_uniform_binding_array |=
|
||||||
self.ir_function.expressions[base]
|
self.is_nonuniform_binding_array_access(base, index);
|
||||||
{
|
|
||||||
// The access chain needs to be decorated as NonUniform
|
|
||||||
// see VUID-RuntimeSpirv-NonUniform-06274
|
|
||||||
let gvar = &self.ir_module.global_variables[var_handle];
|
|
||||||
if let crate::TypeInner::BindingArray { .. } =
|
|
||||||
self.ir_module.types[gvar.ty].inner
|
|
||||||
{
|
|
||||||
is_non_uniform_binding_array =
|
|
||||||
self.fun_info[index].uniformity.non_uniform_result.is_some();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let index_id = match self.write_bounds_check(base, index, block)? {
|
let index_id = match self.write_bounds_check(base, index, block)? {
|
||||||
BoundsCheckResult::KnownInBounds(known_index) => {
|
BoundsCheckResult::KnownInBounds(known_index) => {
|
||||||
@ -1933,6 +1922,26 @@ impl<'w> BlockContext<'w> {
|
|||||||
Ok(expr_pointer)
|
Ok(expr_pointer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_nonuniform_binding_array_access(
|
||||||
|
&mut self,
|
||||||
|
base: Handle<crate::Expression>,
|
||||||
|
index: Handle<crate::Expression>,
|
||||||
|
) -> bool {
|
||||||
|
let crate::Expression::GlobalVariable(var_handle) = self.ir_function.expressions[base]
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// The access chain needs to be decorated as NonUniform
|
||||||
|
// see VUID-RuntimeSpirv-NonUniform-06274
|
||||||
|
let gvar = &self.ir_module.global_variables[var_handle];
|
||||||
|
let crate::TypeInner::BindingArray { .. } = self.ir_module.types[gvar.ty].inner else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.fun_info[index].uniformity.non_uniform_result.is_some()
|
||||||
|
}
|
||||||
|
|
||||||
/// Build the instructions for matrix - matrix column operations
|
/// Build the instructions for matrix - matrix column operations
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn write_matrix_matrix_column_op(
|
fn write_matrix_matrix_column_op(
|
||||||
|
Loading…
Reference in New Issue
Block a user