[naga spv-out] Rename write_expression_pointer to write_access_chain.

This function's sole purpose is to generate `OpAccessChain`
instructions, so there's no point in being coy about it.
This commit is contained in:
Jim Blandy 2024-10-30 11:16:18 -07:00 committed by Erich Gubler
parent 57fcc69768
commit 6b85e65f51

View File

@ -24,7 +24,7 @@ fn get_dimension(type_inner: &crate::TypeInner) -> Dimension {
/// types are simply the direct SPIR-V analog of the Naga IR's. But in some /// types are simply the direct SPIR-V analog of the Naga IR's. But in some
/// cases, the Naga IR and SPIR-V types need to diverge. /// cases, the Naga IR and SPIR-V types need to diverge.
/// ///
/// This enum specifies how [`BlockContext::write_expression_pointer`] should /// This enum specifies how [`BlockContext::write_access_chain`] should
/// choose a SPIR-V result type for the `OpAccessChain` it generates, based on /// choose a SPIR-V result type for the `OpAccessChain` it generates, based on
/// the type of the given Naga IR [`Expression`] it's generating code for. /// the type of the given Naga IR [`Expression`] it's generating code for.
/// ///
@ -68,7 +68,7 @@ enum AccessTypeAdjustment {
/// The results of emitting code for a left-hand-side expression. /// The results of emitting code for a left-hand-side expression.
/// ///
/// On success, `write_expression_pointer` returns one of these. /// On success, `write_access_chain` returns one of these.
enum ExpressionPointer { enum ExpressionPointer {
/// The pointer to the expression's value is available, as the value of the /// The pointer to the expression's value is available, as the value of the
/// expression with the given id. /// expression with the given id.
@ -407,7 +407,7 @@ impl<'w> BlockContext<'w> {
} => { } => {
// Only binding arrays in the `Handle` address space will take // Only binding arrays in the `Handle` address space will take
// this path, since we handled the `Pointer` case above. // this path, since we handled the `Pointer` case above.
let result_id = match self.write_expression_pointer( let result_id = match self.write_access_chain(
expr_handle, expr_handle,
block, block,
AccessTypeAdjustment::IntroducePointer( AccessTypeAdjustment::IntroducePointer(
@ -498,7 +498,7 @@ impl<'w> BlockContext<'w> {
} => { } => {
// Only binding arrays in the `Handle` address space will take // Only binding arrays in the `Handle` address space will take
// this path, since we handled the `Pointer` case above. // this path, since we handled the `Pointer` case above.
let result_id = match self.write_expression_pointer( let result_id = match self.write_access_chain(
expr_handle, expr_handle,
block, block,
AccessTypeAdjustment::IntroducePointer( AccessTypeAdjustment::IntroducePointer(
@ -1751,7 +1751,7 @@ impl<'w> BlockContext<'w> {
/// ///
/// On success, the return value is an [`ExpressionPointer`] value; see the /// On success, the return value is an [`ExpressionPointer`] value; see the
/// documentation for that type. /// documentation for that type.
fn write_expression_pointer( fn write_access_chain(
&mut self, &mut self,
mut expr_handle: Handle<crate::Expression>, mut expr_handle: Handle<crate::Expression>,
block: &mut Block, block: &mut Block,
@ -1982,7 +1982,7 @@ impl<'w> BlockContext<'w> {
access_type_adjustment: AccessTypeAdjustment, access_type_adjustment: AccessTypeAdjustment,
result_type_id: Word, result_type_id: Word,
) -> Result<Word, Error> { ) -> Result<Word, Error> {
match self.write_expression_pointer(pointer, block, access_type_adjustment)? { match self.write_access_chain(pointer, block, access_type_adjustment)? {
ExpressionPointer::Ready { pointer_id } => { ExpressionPointer::Ready { pointer_id } => {
let id = self.gen_id(); let id = self.gen_id();
let atomic_space = let atomic_space =
@ -2603,7 +2603,7 @@ impl<'w> BlockContext<'w> {
} }
Statement::Store { pointer, value } => { Statement::Store { pointer, value } => {
let value_id = self.cached[value]; let value_id = self.cached[value];
match self.write_expression_pointer( match self.write_access_chain(
pointer, pointer,
&mut block, &mut block,
AccessTypeAdjustment::None, AccessTypeAdjustment::None,
@ -2703,7 +2703,7 @@ impl<'w> BlockContext<'w> {
self.cached[result] = id; self.cached[result] = id;
} }
let pointer_id = match self.write_expression_pointer( let pointer_id = match self.write_access_chain(
pointer, pointer,
&mut block, &mut block,
AccessTypeAdjustment::None, AccessTypeAdjustment::None,
@ -2875,7 +2875,7 @@ impl<'w> BlockContext<'w> {
.write_barrier(crate::Barrier::WORK_GROUP, &mut block); .write_barrier(crate::Barrier::WORK_GROUP, &mut block);
let result_type_id = self.get_expression_type_id(&self.fun_info[result].ty); let result_type_id = self.get_expression_type_id(&self.fun_info[result].ty);
// Embed the body of // Embed the body of
match self.write_expression_pointer( match self.write_access_chain(
pointer, pointer,
&mut block, &mut block,
AccessTypeAdjustment::None, AccessTypeAdjustment::None,