New snapshot test for global variables

This commit is contained in:
Dzmitry Malyshau 2021-05-28 21:49:50 -04:00 committed by Dzmitry Malyshau
parent 0244853d4c
commit d1e2ac57fe
9 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,3 @@
(
spv_version: (1, 0),
)

9
tests/in/globals.wgsl Normal file
View File

@ -0,0 +1,9 @@
// Global variable & constant declarations
let Foo: bool = true;
var<workgroup> wg : array<f32, 10>;
[[stage(compute), workgroup_size(1)]]
fn main() {
}

View File

@ -1,4 +1,4 @@
// Testing various parts of the pipeline interface: locations, built-ins, bindings, and entry points
// Testing various parts of the pipeline interface: locations, built-ins, and entry points
struct VertexOutput {
[[builtin(position)]] position: vec4<f32>;

View File

@ -1,3 +1,5 @@
//TODO: mere with "interface"?
struct FragmentInput {
[[builtin(position)]] position: vec4<f32>;
[[location(0), interpolate(flat)]] flat : u32;

View File

@ -0,0 +1,11 @@
#version 310 es
precision highp float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
return;
}

12
tests/out/globals.msl Normal file
View File

@ -0,0 +1,12 @@
#include <metal_stdlib>
#include <simd/simd.h>
constexpr constant bool Foo = true;
struct type2 {
float inner[10];
};
kernel void main1(
) {
return;
}

26
tests/out/globals.spvasm Normal file
View File

@ -0,0 +1,26 @@
; SPIR-V
; Version: 1.0
; Generator: rspirv
; Bound: 15
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %12 "main"
OpExecutionMode %12 LocalSize 1 1 1
OpDecorate %8 ArrayStride 4
%2 = OpTypeVoid
%4 = OpTypeBool
%3 = OpConstantTrue %4
%6 = OpTypeInt 32 1
%5 = OpConstant %6 10
%7 = OpTypeFloat 32
%8 = OpTypeArray %7 %5
%10 = OpTypePointer Workgroup %8
%9 = OpVariable %10 Workgroup
%13 = OpTypeFunction %2
%12 = OpFunction %2 None %13
%11 = OpLabel
OpBranch %14
%14 = OpLabel
OpReturn
OpFunctionEnd

8
tests/out/globals.wgsl Normal file
View File

@ -0,0 +1,8 @@
let Foo: bool = true;
var<workgroup> wg: array<f32,10>;
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
return;
}

View File

@ -293,6 +293,10 @@ fn convert_wgsl() {
),
//TODO: GLSL https://github.com/gfx-rs/naga/issues/874
("interface", Targets::SPIRV | Targets::METAL | Targets::WGSL),
(
"globals",
Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::WGSL,
),
];
for &(name, targets) in inputs.iter() {