This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add array-in-function-return-type test
- Loading branch information
Showing
7 changed files
with
109 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
( | ||
) |
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,9 @@ | ||
fn ret_array() -> array<f32, 2> { | ||
return array<f32, 2>(1.0, 2.0); | ||
} | ||
|
||
@fragment | ||
fn main() -> @location(0) vec4<f32> { | ||
let a = ret_array(); | ||
return vec4<f32>(a[0], a[1], 0.0, 1.0); | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/out/glsl/array-in-function-return-type.main.Fragment.glsl
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,17 @@ | ||
#version 310 es | ||
|
||
precision highp float; | ||
precision highp int; | ||
|
||
layout(location = 0) out vec4 _fs2p_location0; | ||
|
||
float[2] ret_array() { | ||
return float[2](1.0, 2.0); | ||
} | ||
|
||
void main() { | ||
float _e0[2] = ret_array(); | ||
_fs2p_location0 = vec4(_e0[0], _e0[1], 0.0, 1.0); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// language: metal2.0 | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using metal::uint; | ||
|
||
struct type_1 { | ||
float inner[2]; | ||
}; | ||
|
||
type_1 ret_array( | ||
) { | ||
return type_1 {1.0, 2.0}; | ||
} | ||
|
||
struct main_Output { | ||
metal::float4 member [[color(0)]]; | ||
}; | ||
fragment main_Output main_( | ||
) { | ||
type_1 _e0 = ret_array(); | ||
return main_Output { metal::float4(_e0.inner[0], _e0.inner[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,44 @@ | ||
; SPIR-V | ||
; Version: 1.1 | ||
; Generator: rspirv | ||
; Bound: 28 | ||
OpCapability Shader | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel Logical GLSL450 | ||
OpEntryPoint Fragment %20 "main" %18 | ||
OpExecutionMode %20 OriginUpperLeft | ||
OpDecorate %6 ArrayStride 4 | ||
OpDecorate %18 Location 0 | ||
%2 = OpTypeVoid | ||
%4 = OpTypeInt 32 1 | ||
%3 = OpConstant %4 2 | ||
%5 = OpTypeFloat 32 | ||
%8 = OpTypeInt 32 0 | ||
%7 = OpConstant %8 2 | ||
%6 = OpTypeArray %5 %7 | ||
%9 = OpTypeVector %5 4 | ||
%12 = OpTypeFunction %6 | ||
%13 = OpConstant %5 1.0 | ||
%14 = OpConstant %5 2.0 | ||
%19 = OpTypePointer Output %9 | ||
%18 = OpVariable %19 Output | ||
%21 = OpTypeFunction %2 | ||
%22 = OpConstant %5 0.0 | ||
%11 = OpFunction %6 None %12 | ||
%10 = OpLabel | ||
OpBranch %15 | ||
%15 = OpLabel | ||
%16 = OpCompositeConstruct %6 %13 %14 | ||
OpReturnValue %16 | ||
OpFunctionEnd | ||
%20 = OpFunction %2 None %21 | ||
%17 = OpLabel | ||
OpBranch %23 | ||
%23 = OpLabel | ||
%24 = OpFunctionCall %6 %11 | ||
%25 = OpCompositeExtract %5 %24 0 | ||
%26 = OpCompositeExtract %5 %24 1 | ||
%27 = OpCompositeConstruct %9 %25 %26 %22 %13 | ||
OpStore %18 %27 | ||
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,9 @@ | ||
fn ret_array() -> array<f32, 2> { | ||
return array<f32, 2>(1.0, 2.0); | ||
} | ||
|
||
@fragment | ||
fn main() -> @location(0) vec4<f32> { | ||
let _e0 = ret_array(); | ||
return vec4<f32>(_e0[0], _e0[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