-
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.
Split
const-exprs.rs
test into separate functions.
Also, just use a single out variable for each type. rather than introducing a new output variable for every test we add.
- Loading branch information
Showing
6 changed files
with
186 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
@group(0) @binding(0) var<storage, read_write> out: vec4<i32>; | ||
@group(0) @binding(1) var<storage, read_write> out2: i32; | ||
@group(0) @binding(2) var<storage, read_write> out3: i32; | ||
|
||
@compute @workgroup_size(1) | ||
fn main() { | ||
swizzle_of_compose(); | ||
index_of_compose(); | ||
compose_three_deep(); | ||
} | ||
|
||
// Swizzle the value of nested Compose expressions. | ||
fn swizzle_of_compose() { | ||
let a = vec2(1, 2); | ||
let b = vec2(3, 4); | ||
out = vec4(a, b).wzyx; | ||
out = vec4(a, b).wzyx; // should assign vec4(4, 3, 2, 1); | ||
} | ||
|
||
out2 = vec4(a, b)[1]; | ||
// Index the value of nested Compose expressions. | ||
fn index_of_compose() { | ||
let a = vec2(1, 2); | ||
let b = vec2(3, 4); | ||
out2 += vec4(a, b)[1]; // should assign 2 | ||
} | ||
|
||
out3 = vec4(vec3(vec2(6, 7), 8), 9)[0]; | ||
// Index the value of Compose expressions nested three deep | ||
fn compose_three_deep() { | ||
out2 += vec4(vec3(vec2(6, 7), 8), 9)[0]; // should assign 6 | ||
} |
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 |
---|---|---|
@@ -1,14 +1,35 @@ | ||
RWByteAddressBuffer out_ : register(u0); | ||
RWByteAddressBuffer out2_ : register(u1); | ||
RWByteAddressBuffer out3_ : register(u2); | ||
|
||
[numthreads(1, 1, 1)] | ||
void main() | ||
void index_of_compose() | ||
{ | ||
int2 a = int2(1, 2); | ||
int2 b = int2(3, 4); | ||
int _expr8 = asint(out2_.Load(0)); | ||
out2_.Store(0, asuint((_expr8 + 2))); | ||
return; | ||
} | ||
|
||
void swizzle_of_compose() | ||
{ | ||
int2 a_1 = int2(1, 2); | ||
int2 b_1 = int2(3, 4); | ||
out_.Store4(0, asuint(int4(4, 3, 2, 1))); | ||
out2_.Store(0, asuint(2)); | ||
out3_.Store(0, asuint(6)); | ||
return; | ||
} | ||
|
||
void compose_three_deep() | ||
{ | ||
int _expr8 = asint(out2_.Load(0)); | ||
out2_.Store(0, asuint((_expr8 + 6))); | ||
return; | ||
} | ||
|
||
[numthreads(1, 1, 1)] | ||
void main() | ||
{ | ||
swizzle_of_compose(); | ||
index_of_compose(); | ||
compose_three_deep(); | ||
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
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 |
---|---|---|
@@ -1,67 +1,86 @@ | ||
; SPIR-V | ||
; Version: 1.1 | ||
; Generator: rspirv | ||
; Bound: 41 | ||
; Bound: 55 | ||
OpCapability Shader | ||
OpExtension "SPV_KHR_storage_buffer_storage_class" | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel Logical GLSL450 | ||
OpEntryPoint GLCompute %20 "main" | ||
OpExecutionMode %20 LocalSize 1 1 1 | ||
OpEntryPoint GLCompute %48 "main" | ||
OpExecutionMode %48 LocalSize 1 1 1 | ||
OpDecorate %7 DescriptorSet 0 | ||
OpDecorate %7 Binding 0 | ||
OpDecorate %8 Block | ||
OpMemberDecorate %8 0 Offset 0 | ||
OpDecorate %10 DescriptorSet 0 | ||
OpDecorate %10 Binding 0 | ||
OpDecorate %10 Binding 1 | ||
OpDecorate %11 Block | ||
OpMemberDecorate %11 0 Offset 0 | ||
OpDecorate %13 DescriptorSet 0 | ||
OpDecorate %13 Binding 1 | ||
OpDecorate %14 Block | ||
OpMemberDecorate %14 0 Offset 0 | ||
OpDecorate %16 DescriptorSet 0 | ||
OpDecorate %16 Binding 2 | ||
OpDecorate %17 Block | ||
OpMemberDecorate %17 0 Offset 0 | ||
%2 = OpTypeVoid | ||
%4 = OpTypeInt 32 1 | ||
%3 = OpTypeVector %4 4 | ||
%5 = OpTypeVector %4 2 | ||
%6 = OpTypeVector %4 3 | ||
%7 = OpConstant %4 0 | ||
%8 = OpConstant %4 1 | ||
%9 = OpConstant %4 2 | ||
%11 = OpTypeStruct %3 | ||
%8 = OpTypeStruct %3 | ||
%9 = OpTypePointer StorageBuffer %8 | ||
%7 = OpVariable %9 StorageBuffer | ||
%11 = OpTypeStruct %4 | ||
%12 = OpTypePointer StorageBuffer %11 | ||
%10 = OpVariable %12 StorageBuffer | ||
%14 = OpTypeStruct %4 | ||
%15 = OpTypePointer StorageBuffer %14 | ||
%13 = OpVariable %15 StorageBuffer | ||
%17 = OpTypeStruct %4 | ||
%18 = OpTypePointer StorageBuffer %17 | ||
%16 = OpVariable %18 StorageBuffer | ||
%21 = OpTypeFunction %2 | ||
%22 = OpTypePointer StorageBuffer %3 | ||
%24 = OpTypeInt 32 0 | ||
%23 = OpConstant %24 0 | ||
%26 = OpTypePointer StorageBuffer %4 | ||
%29 = OpConstantComposite %5 %8 %9 | ||
%30 = OpConstant %4 3 | ||
%31 = OpConstant %4 4 | ||
%32 = OpConstantComposite %5 %30 %31 | ||
%33 = OpConstantComposite %3 %31 %30 %9 %8 | ||
%34 = OpConstant %4 6 | ||
%35 = OpConstant %4 7 | ||
%36 = OpConstantComposite %5 %34 %35 | ||
%37 = OpConstant %4 8 | ||
%38 = OpConstantComposite %6 %34 %35 %37 | ||
%39 = OpConstant %4 9 | ||
%20 = OpFunction %2 None %21 | ||
%19 = OpLabel | ||
%25 = OpAccessChain %22 %10 %23 | ||
%27 = OpAccessChain %26 %13 %23 | ||
%28 = OpAccessChain %26 %16 %23 | ||
OpBranch %40 | ||
%40 = OpLabel | ||
OpStore %25 %33 | ||
OpStore %27 %9 | ||
OpStore %28 %34 | ||
%15 = OpTypeFunction %2 | ||
%16 = OpTypePointer StorageBuffer %4 | ||
%18 = OpTypeInt 32 0 | ||
%17 = OpConstant %18 0 | ||
%20 = OpConstant %4 1 | ||
%21 = OpConstant %4 2 | ||
%22 = OpConstantComposite %5 %20 %21 | ||
%23 = OpConstant %4 3 | ||
%24 = OpConstant %4 4 | ||
%25 = OpConstantComposite %5 %23 %24 | ||
%31 = OpTypePointer StorageBuffer %3 | ||
%33 = OpConstantComposite %3 %24 %23 %21 %20 | ||
%38 = OpConstant %4 6 | ||
%39 = OpConstant %4 7 | ||
%40 = OpConstantComposite %5 %38 %39 | ||
%41 = OpConstant %4 8 | ||
%42 = OpConstantComposite %6 %38 %39 %41 | ||
%43 = OpConstant %4 9 | ||
%14 = OpFunction %2 None %15 | ||
%13 = OpLabel | ||
%19 = OpAccessChain %16 %10 %17 | ||
OpBranch %26 | ||
%26 = OpLabel | ||
%27 = OpLoad %4 %19 | ||
%28 = OpIAdd %4 %27 %21 | ||
OpStore %19 %28 | ||
OpReturn | ||
OpFunctionEnd | ||
%30 = OpFunction %2 None %15 | ||
%29 = OpLabel | ||
%32 = OpAccessChain %31 %7 %17 | ||
OpBranch %34 | ||
%34 = OpLabel | ||
OpStore %32 %33 | ||
OpReturn | ||
OpFunctionEnd | ||
%36 = OpFunction %2 None %15 | ||
%35 = OpLabel | ||
%37 = OpAccessChain %16 %10 %17 | ||
OpBranch %44 | ||
%44 = OpLabel | ||
%45 = OpLoad %4 %37 | ||
%46 = OpIAdd %4 %45 %38 | ||
OpStore %37 %46 | ||
OpReturn | ||
OpFunctionEnd | ||
%48 = OpFunction %2 None %15 | ||
%47 = OpLabel | ||
%49 = OpAccessChain %31 %7 %17 | ||
%50 = OpAccessChain %16 %10 %17 | ||
OpBranch %51 | ||
%51 = OpLabel | ||
%52 = OpFunctionCall %2 %30 | ||
%53 = OpFunctionCall %2 %14 | ||
%54 = OpFunctionCall %2 %36 | ||
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