forked from gfx-rs/wgpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[naga hlsl-out] Handle array types for function return values and cal…
…ls (gfx-rs#6971)
- Loading branch information
1 parent
5e2bcc9
commit 0282d61
Showing
9 changed files
with
165 additions
and
57 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
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,32 @@ | ||
typedef float ret_Constructarray2_float_[2]; | ||
ret_Constructarray2_float_ Constructarray2_float_(float arg0, float arg1) { | ||
float ret[2] = { arg0, arg1 }; | ||
return ret; | ||
} | ||
|
||
typedef float ret_ret_array[2]; | ||
ret_ret_array ret_array() | ||
{ | ||
return Constructarray2_float_(1.0, 2.0); | ||
} | ||
|
||
typedef float ret_Constructarray3_array2_float__[3][2]; | ||
ret_Constructarray3_array2_float__ Constructarray3_array2_float__(float arg0[2], float arg1[2], float arg2[2]) { | ||
float ret[3][2] = { arg0, arg1, arg2 }; | ||
return ret; | ||
} | ||
|
||
typedef float ret_ret_array_array[3][2]; | ||
ret_ret_array_array ret_array_array() | ||
{ | ||
const float _e0[2] = ret_array(); | ||
const float _e1[2] = ret_array(); | ||
const float _e2[2] = ret_array(); | ||
return Constructarray3_array2_float__(_e0, _e1, _e2); | ||
} | ||
|
||
float4 main() : SV_Target0 | ||
{ | ||
const float _e0[3][2] = ret_array_array(); | ||
return float4(_e0[0][0], _e0[0][1], 0.0, 1.0); | ||
} |
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,12 @@ | ||
( | ||
vertex:[ | ||
], | ||
fragment:[ | ||
( | ||
entry_point:"main", | ||
target_profile:"ps_5_1", | ||
), | ||
], | ||
compute:[ | ||
], | ||
) |
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,42 +1,58 @@ | ||
; SPIR-V | ||
; Version: 1.1 | ||
; Generator: rspirv | ||
; Bound: 26 | ||
; Bound: 38 | ||
OpCapability Shader | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel Logical GLSL450 | ||
OpEntryPoint Fragment %18 "main" %16 | ||
OpExecutionMode %18 OriginUpperLeft | ||
OpEntryPoint Fragment %28 "main" %26 | ||
OpExecutionMode %28 OriginUpperLeft | ||
OpDecorate %4 ArrayStride 4 | ||
OpDecorate %16 Location 0 | ||
OpDecorate %7 ArrayStride 8 | ||
OpDecorate %26 Location 0 | ||
%2 = OpTypeVoid | ||
%3 = OpTypeFloat 32 | ||
%6 = OpTypeInt 32 0 | ||
%5 = OpConstant %6 2 | ||
%4 = OpTypeArray %3 %5 | ||
%7 = OpTypeVector %3 4 | ||
%10 = OpTypeFunction %4 | ||
%11 = OpConstant %3 1.0 | ||
%12 = OpConstant %3 2.0 | ||
%13 = OpConstantComposite %4 %11 %12 | ||
%17 = OpTypePointer Output %7 | ||
%16 = OpVariable %17 Output | ||
%19 = OpTypeFunction %2 | ||
%20 = OpConstant %3 0.0 | ||
%9 = OpFunction %4 None %10 | ||
%8 = OpLabel | ||
OpBranch %14 | ||
%14 = OpLabel | ||
OpReturnValue %13 | ||
%8 = OpConstant %6 3 | ||
%7 = OpTypeArray %4 %8 | ||
%9 = OpTypeVector %3 4 | ||
%12 = OpTypeFunction %4 | ||
%13 = OpConstant %3 1.0 | ||
%14 = OpConstant %3 2.0 | ||
%15 = OpConstantComposite %4 %13 %14 | ||
%19 = OpTypeFunction %7 | ||
%27 = OpTypePointer Output %9 | ||
%26 = OpVariable %27 Output | ||
%29 = OpTypeFunction %2 | ||
%30 = OpConstant %3 0.0 | ||
%11 = OpFunction %4 None %12 | ||
%10 = OpLabel | ||
OpBranch %16 | ||
%16 = OpLabel | ||
OpReturnValue %15 | ||
OpFunctionEnd | ||
%18 = OpFunction %2 None %19 | ||
%15 = OpLabel | ||
OpBranch %21 | ||
%21 = OpLabel | ||
%22 = OpFunctionCall %4 %9 | ||
%23 = OpCompositeExtract %3 %22 0 | ||
%24 = OpCompositeExtract %3 %22 1 | ||
%25 = OpCompositeConstruct %7 %23 %24 %20 %11 | ||
OpStore %16 %25 | ||
%18 = OpFunction %7 None %19 | ||
%17 = OpLabel | ||
OpBranch %20 | ||
%20 = OpLabel | ||
%21 = OpFunctionCall %4 %11 | ||
%22 = OpFunctionCall %4 %11 | ||
%23 = OpFunctionCall %4 %11 | ||
%24 = OpCompositeConstruct %7 %21 %22 %23 | ||
OpReturnValue %24 | ||
OpFunctionEnd | ||
%28 = OpFunction %2 None %29 | ||
%25 = OpLabel | ||
OpBranch %31 | ||
%31 = OpLabel | ||
%32 = OpFunctionCall %7 %18 | ||
%33 = OpCompositeExtract %4 %32 0 | ||
%34 = OpCompositeExtract %3 %33 0 | ||
%35 = OpCompositeExtract %4 %32 0 | ||
%36 = OpCompositeExtract %3 %35 1 | ||
%37 = OpCompositeConstruct %9 %34 %36 %30 %13 | ||
OpStore %26 %37 | ||
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
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