-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wgsl-out] Correct handling of named pointer expressions.
Treat expressions in `Function::named_expressions` like WGSL `let` declarations, assuming that the Load Rule was applied to the rhs of the declaration, meaning that their values are always `Indirection::Ordinary`. Split `write_expr_plain_form` out from `write_expr_with_indirection`, to clean up the parenthesis generation: no more `opened_paren` variable, just function calls. This makes the early return for named expressions neater. Fixes #1382.
- Loading branch information
Showing
7 changed files
with
95 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
( | ||
spv: ( | ||
version: (1, 2), | ||
debug: true, | ||
adjust_coordinate_space: false, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fn f() { | ||
var v: vec2<i32>; | ||
let px = &v.x; | ||
*px = 10; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; SPIR-V | ||
; Version: 1.2 | ||
; Generator: rspirv | ||
; Bound: 16 | ||
OpCapability Shader | ||
OpCapability Linkage | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel Logical GLSL450 | ||
OpSource GLSL 450 | ||
OpName %6 "v" | ||
OpName %9 "f" | ||
%2 = OpTypeVoid | ||
%4 = OpTypeInt 32 1 | ||
%3 = OpConstant %4 10 | ||
%5 = OpTypeVector %4 2 | ||
%7 = OpTypePointer Function %5 | ||
%10 = OpTypeFunction %2 | ||
%12 = OpTypePointer Function %4 | ||
%14 = OpTypeInt 32 0 | ||
%13 = OpConstant %14 0 | ||
%9 = OpFunction %2 None %10 | ||
%8 = OpLabel | ||
%6 = OpVariable %7 Function | ||
OpBranch %11 | ||
%11 = OpLabel | ||
%15 = OpAccessChain %12 %6 %13 | ||
OpStore %15 %3 | ||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fn f() { | ||
var v: vec2<i32>; | ||
|
||
let px: ptr<function, i32> = (&v.x); | ||
(*px) = 10; | ||
return; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters