mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
test: add regr. cvg. for conflicting idents. in shader I/O and locals
This commit is contained in:
parent
e711a35998
commit
2302b5fac6
16
naga/tests/in/6438-conflicting-idents.wgsl
Normal file
16
naga/tests/in/6438-conflicting-idents.wgsl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
struct OurVertexShaderOutput {
|
||||||
|
@builtin(position) position: vec4f,
|
||||||
|
@location(0) texcoord: vec2f,
|
||||||
|
};
|
||||||
|
|
||||||
|
@vertex fn vs(
|
||||||
|
@location(0) xy: vec2f
|
||||||
|
) -> OurVertexShaderOutput {
|
||||||
|
var vsOutput: OurVertexShaderOutput;
|
||||||
|
vsOutput.position = vec4f(xy, 0.0, 1.0);
|
||||||
|
return vsOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment fn fs() -> @location(0) vec4f {
|
||||||
|
return vec4f(1.0, 0.0, 0.0, 1.0);
|
||||||
|
}
|
16
naga/tests/out/glsl/6438-conflicting-idents.fs.Fragment.glsl
Normal file
16
naga/tests/out/glsl/6438-conflicting-idents.fs.Fragment.glsl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
precision highp int;
|
||||||
|
|
||||||
|
struct OurVertexShaderOutput {
|
||||||
|
vec4 position;
|
||||||
|
vec2 texcoord;
|
||||||
|
};
|
||||||
|
layout(location = 0) out vec4 _fs2p_location0;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
_fs2p_location0 = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
23
naga/tests/out/glsl/6438-conflicting-idents.vs.Vertex.glsl
Normal file
23
naga/tests/out/glsl/6438-conflicting-idents.vs.Vertex.glsl
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#version 310 es
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
precision highp int;
|
||||||
|
|
||||||
|
struct OurVertexShaderOutput {
|
||||||
|
vec4 position;
|
||||||
|
vec2 texcoord;
|
||||||
|
};
|
||||||
|
layout(location = 0) in vec2 _p2vs_location0;
|
||||||
|
layout(location = 0) smooth out vec2 _vs2fs_location0;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 xy = _p2vs_location0;
|
||||||
|
OurVertexShaderOutput vsOutput = OurVertexShaderOutput(vec4(0.0), vec2(0.0));
|
||||||
|
vsOutput.position = vec4(xy, 0.0, 1.0);
|
||||||
|
OurVertexShaderOutput _e6 = vsOutput;
|
||||||
|
gl_Position = _e6.position;
|
||||||
|
_vs2fs_location0 = _e6.texcoord;
|
||||||
|
gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
25
naga/tests/out/hlsl/6438-conflicting-idents.hlsl
Normal file
25
naga/tests/out/hlsl/6438-conflicting-idents.hlsl
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
struct OurVertexShaderOutput {
|
||||||
|
float4 position : SV_Position;
|
||||||
|
float2 texcoord : LOC0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VertexOutput_vs {
|
||||||
|
float2 texcoord : LOC0;
|
||||||
|
float4 position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
VertexOutput_vs vs(float2 xy : LOC0)
|
||||||
|
{
|
||||||
|
OurVertexShaderOutput vsOutput = (OurVertexShaderOutput)0;
|
||||||
|
|
||||||
|
vsOutput.position = float4(xy, 0.0, 1.0);
|
||||||
|
OurVertexShaderOutput _e6 = vsOutput;
|
||||||
|
const OurVertexShaderOutput ourvertexshaderoutput = _e6;
|
||||||
|
const VertexOutput_vs ourvertexshaderoutput_1 = { ourvertexshaderoutput.texcoord, ourvertexshaderoutput.position };
|
||||||
|
return ourvertexshaderoutput_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 fs() : SV_Target0
|
||||||
|
{
|
||||||
|
return float4(1.0, 0.0, 0.0, 1.0);
|
||||||
|
}
|
16
naga/tests/out/hlsl/6438-conflicting-idents.ron
Normal file
16
naga/tests/out/hlsl/6438-conflicting-idents.ron
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
(
|
||||||
|
vertex:[
|
||||||
|
(
|
||||||
|
entry_point:"vs",
|
||||||
|
target_profile:"vs_5_1",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
fragment:[
|
||||||
|
(
|
||||||
|
entry_point:"fs",
|
||||||
|
target_profile:"ps_5_1",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
compute:[
|
||||||
|
],
|
||||||
|
)
|
37
naga/tests/out/msl/6438-conflicting-idents.msl
Normal file
37
naga/tests/out/msl/6438-conflicting-idents.msl
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// language: metal1.0
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using metal::uint;
|
||||||
|
|
||||||
|
struct OurVertexShaderOutput {
|
||||||
|
metal::float4 position;
|
||||||
|
metal::float2 texcoord;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vsInput {
|
||||||
|
metal::float2 xy [[attribute(0)]];
|
||||||
|
};
|
||||||
|
struct vsOutput {
|
||||||
|
metal::float4 position [[position]];
|
||||||
|
metal::float2 texcoord [[user(loc0), center_perspective]];
|
||||||
|
};
|
||||||
|
vertex vsOutput vs(
|
||||||
|
vsInput varyings [[stage_in]]
|
||||||
|
) {
|
||||||
|
const auto xy = varyings.xy;
|
||||||
|
OurVertexShaderOutput vsOutput = {};
|
||||||
|
vsOutput.position = metal::float4(xy, 0.0, 1.0);
|
||||||
|
OurVertexShaderOutput _e6 = vsOutput;
|
||||||
|
const auto _tmp = _e6;
|
||||||
|
return vsOutput { _tmp.position, _tmp.texcoord };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct fsOutput {
|
||||||
|
metal::float4 member_1 [[color(0)]];
|
||||||
|
};
|
||||||
|
fragment fsOutput fs(
|
||||||
|
) {
|
||||||
|
return fsOutput { metal::float4(1.0, 0.0, 0.0, 1.0) };
|
||||||
|
}
|
60
naga/tests/out/spv/6438-conflicting-idents.spvasm
Normal file
60
naga/tests/out/spv/6438-conflicting-idents.spvasm
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.1
|
||||||
|
; Generator: rspirv
|
||||||
|
; Bound: 36
|
||||||
|
OpCapability Shader
|
||||||
|
%1 = OpExtInstImport "GLSL.std.450"
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint Vertex %15 "vs" %8 %11 %13
|
||||||
|
OpEntryPoint Fragment %33 "fs" %32
|
||||||
|
OpExecutionMode %33 OriginUpperLeft
|
||||||
|
OpMemberDecorate %6 0 Offset 0
|
||||||
|
OpMemberDecorate %6 1 Offset 16
|
||||||
|
OpDecorate %8 Location 0
|
||||||
|
OpDecorate %11 BuiltIn Position
|
||||||
|
OpDecorate %13 Location 0
|
||||||
|
OpDecorate %32 Location 0
|
||||||
|
%2 = OpTypeVoid
|
||||||
|
%4 = OpTypeFloat 32
|
||||||
|
%3 = OpTypeVector %4 4
|
||||||
|
%5 = OpTypeVector %4 2
|
||||||
|
%6 = OpTypeStruct %3 %5
|
||||||
|
%9 = OpTypePointer Input %5
|
||||||
|
%8 = OpVariable %9 Input
|
||||||
|
%12 = OpTypePointer Output %3
|
||||||
|
%11 = OpVariable %12 Output
|
||||||
|
%14 = OpTypePointer Output %5
|
||||||
|
%13 = OpVariable %14 Output
|
||||||
|
%16 = OpTypeFunction %2
|
||||||
|
%17 = OpConstant %4 0.0
|
||||||
|
%18 = OpConstant %4 1.0
|
||||||
|
%20 = OpTypePointer Function %6
|
||||||
|
%21 = OpConstantNull %6
|
||||||
|
%23 = OpTypePointer Function %3
|
||||||
|
%26 = OpTypeInt 32 0
|
||||||
|
%25 = OpConstant %26 0
|
||||||
|
%32 = OpVariable %12 Output
|
||||||
|
%34 = OpConstantComposite %3 %18 %17 %17 %18
|
||||||
|
%15 = OpFunction %2 None %16
|
||||||
|
%7 = OpLabel
|
||||||
|
%19 = OpVariable %20 Function %21
|
||||||
|
%10 = OpLoad %5 %8
|
||||||
|
OpBranch %22
|
||||||
|
%22 = OpLabel
|
||||||
|
%24 = OpCompositeConstruct %3 %10 %17 %18
|
||||||
|
%27 = OpAccessChain %23 %19 %25
|
||||||
|
OpStore %27 %24
|
||||||
|
%28 = OpLoad %6 %19
|
||||||
|
%29 = OpCompositeExtract %3 %28 0
|
||||||
|
OpStore %11 %29
|
||||||
|
%30 = OpCompositeExtract %5 %28 1
|
||||||
|
OpStore %13 %30
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
%33 = OpFunction %2 None %16
|
||||||
|
%31 = OpLabel
|
||||||
|
OpBranch %35
|
||||||
|
%35 = OpLabel
|
||||||
|
OpStore %32 %34
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
18
naga/tests/out/wgsl/6438-conflicting-idents.wgsl
Normal file
18
naga/tests/out/wgsl/6438-conflicting-idents.wgsl
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
struct OurVertexShaderOutput {
|
||||||
|
@builtin(position) position: vec4<f32>,
|
||||||
|
@location(0) texcoord: vec2<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
@vertex
|
||||||
|
fn vs(@location(0) xy: vec2<f32>) -> OurVertexShaderOutput {
|
||||||
|
var vsOutput: OurVertexShaderOutput;
|
||||||
|
|
||||||
|
vsOutput.position = vec4<f32>(xy, 0f, 1f);
|
||||||
|
let _e6 = vsOutput;
|
||||||
|
return _e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
@fragment
|
||||||
|
fn fs() -> @location(0) vec4<f32> {
|
||||||
|
return vec4<f32>(1f, 0f, 0f, 1f);
|
||||||
|
}
|
@ -937,6 +937,10 @@ fn convert_wgsl() {
|
|||||||
),
|
),
|
||||||
("6220-break-from-loop", Targets::SPIRV),
|
("6220-break-from-loop", Targets::SPIRV),
|
||||||
("index-by-value", Targets::SPIRV | Targets::IR),
|
("index-by-value", Targets::SPIRV | Targets::IR),
|
||||||
|
(
|
||||||
|
"6438-conflicting-idents",
|
||||||
|
Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
for &(name, targets) in inputs.iter() {
|
for &(name, targets) in inputs.iter() {
|
||||||
|
Loading…
Reference in New Issue
Block a user