mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[glsl-in] Use local for mutable non pointer args
This commit is contained in:
committed by
Dzmitry Malyshau
parent
605bab12e3
commit
b15b0b6862
@@ -395,7 +395,41 @@ impl<'function> Context<'function> {
|
||||
None
|
||||
};
|
||||
|
||||
if let Some(current) = self.scopes.last_mut() {
|
||||
if mutable && load.is_none() {
|
||||
let handle = self.locals.append(LocalVariable {
|
||||
name: Some(name.clone()),
|
||||
ty,
|
||||
init: None,
|
||||
});
|
||||
let local_expr = self.add_expression(Expression::LocalVariable(handle), body);
|
||||
|
||||
self.emit_flush(body);
|
||||
self.emit_start();
|
||||
|
||||
body.push(Statement::Store {
|
||||
pointer: local_expr,
|
||||
value: expr,
|
||||
});
|
||||
|
||||
let local_load = self.add_expression(
|
||||
Expression::Load {
|
||||
pointer: local_expr,
|
||||
},
|
||||
body,
|
||||
);
|
||||
|
||||
if let Some(current) = self.scopes.last_mut() {
|
||||
(*current).insert(
|
||||
name,
|
||||
VariableReference {
|
||||
expr: local_expr,
|
||||
load: Some(local_load),
|
||||
mutable,
|
||||
entry_arg: None,
|
||||
},
|
||||
);
|
||||
}
|
||||
} else if let Some(current) = self.scopes.last_mut() {
|
||||
(*current).insert(
|
||||
name,
|
||||
VariableReference {
|
||||
|
||||
Reference in New Issue
Block a user