mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Add snapshots for function.wgsl
This commit is contained in:
committed by
Dzmitry Malyshau
parent
51cdb0403a
commit
d71ebe2881
@@ -116,3 +116,9 @@ fn converts_wgsl_quad() {
|
||||
fn converts_wgsl_simple() {
|
||||
convert_wgsl("simple");
|
||||
}
|
||||
|
||||
#[cfg(feature = "wgsl-in")]
|
||||
#[test]
|
||||
fn converts_wgsl_function() {
|
||||
convert_wgsl("function");
|
||||
}
|
||||
|
||||
5
tests/snapshots/in/function.param.ron
Normal file
5
tests/snapshots/in/function.param.ron
Normal file
@@ -0,0 +1,5 @@
|
||||
(
|
||||
spv_capabilities: [ Shader ],
|
||||
mtl_bindings: {
|
||||
}
|
||||
)
|
||||
8
tests/snapshots/in/function.wgsl
Normal file
8
tests/snapshots/in/function.wgsl
Normal file
@@ -0,0 +1,8 @@
|
||||
fn test_function(test: f32) -> f32 {
|
||||
return test;
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
var test: f32 = test_function(1.0);
|
||||
}
|
||||
27
tests/snapshots/snapshots__function.msl.snap
Normal file
27
tests/snapshots/snapshots__function.msl.snap
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
source: tests/snapshots.rs
|
||||
expression: msl
|
||||
---
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
typedef float type;
|
||||
|
||||
type test_function(
|
||||
type test
|
||||
) {
|
||||
return test;
|
||||
}
|
||||
struct main1Input {
|
||||
};
|
||||
struct main1Output {
|
||||
};
|
||||
vertex main1Output main1(
|
||||
main1Input input [[stage_in]]
|
||||
) {
|
||||
main1Output output;
|
||||
type test1;
|
||||
test1 = test_function(1.0);
|
||||
return output;
|
||||
}
|
||||
|
||||
31
tests/snapshots/snapshots__function.spvasm.snap
Normal file
31
tests/snapshots/snapshots__function.spvasm.snap
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
source: tests/snapshots.rs
|
||||
expression: dis
|
||||
---
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: rspirv
|
||||
; Bound: 16
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %11 "main"
|
||||
%2 = OpTypeFloat 32
|
||||
%4 = OpTypePointer Function %2
|
||||
%6 = OpTypeFunction %2 %4
|
||||
%10 = OpTypeVoid
|
||||
%12 = OpTypeFunction %10
|
||||
%15 = OpConstant %2 1.0
|
||||
%5 = OpFunction %2 None %6
|
||||
%3 = OpFunctionParameter %4
|
||||
%7 = OpLabel
|
||||
%8 = OpLoad %2 %3
|
||||
OpReturnValue %8
|
||||
OpFunctionEnd
|
||||
%11 = OpFunction %10 None %12
|
||||
%13 = OpLabel
|
||||
%9 = OpVariable %4 Function
|
||||
%14 = OpFunctionCall %2 %5 %15
|
||||
OpStore %9 %14
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
Reference in New Issue
Block a user