mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
tint: Fix Renamer transform with type short-names
Fixed: tint:1783 Change-Id: I0ffd5860405651f15961dc8fe753eeac6edc8434 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113441 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
384e2bee88
commit
06c1af47bd
@@ -5,8 +5,8 @@ void unused_entry_point() {
|
||||
|
||||
void f() {
|
||||
{
|
||||
const int vec3f = 1;
|
||||
const int b = vec3f;
|
||||
const int vec3f_1 = 1;
|
||||
const int b = vec3f_1;
|
||||
}
|
||||
const float3 c = (0.0f).xxx;
|
||||
const float3 d = (0.0f).xxx;
|
||||
|
||||
@@ -5,8 +5,8 @@ void unused_entry_point() {
|
||||
|
||||
void f() {
|
||||
{
|
||||
const int vec3f = 1;
|
||||
const int b = vec3f;
|
||||
const int vec3f_1 = 1;
|
||||
const int b = vec3f_1;
|
||||
}
|
||||
const float3 c = (0.0f).xxx;
|
||||
const float3 d = (0.0f).xxx;
|
||||
|
||||
@@ -6,8 +6,8 @@ void unused_entry_point() {
|
||||
}
|
||||
void f() {
|
||||
{
|
||||
int vec3f = 1;
|
||||
int b = vec3f;
|
||||
int vec3f_1 = 1;
|
||||
int b = vec3f_1;
|
||||
}
|
||||
vec3 c = vec3(0.0f);
|
||||
vec3 d = vec3(0.0f);
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
using namespace metal;
|
||||
void f() {
|
||||
{
|
||||
int const vec3f = 1;
|
||||
int const b = vec3f;
|
||||
int const vec3f_1 = 1;
|
||||
int const b = vec3f_1;
|
||||
}
|
||||
float3 const c = float3(0.0f);
|
||||
float3 const d = float3(0.0f);
|
||||
|
||||
10
test/tint/shadowing/short_names/renamer/function.wgsl
Normal file
10
test/tint/shadowing/short_names/renamer/function.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
// flags: --transform renamer
|
||||
|
||||
// Evilness 😈. Don't go getting any ideas!
|
||||
fn vec4f() -> i32 { return 0; }
|
||||
fn vec2f(i : i32) -> f32 { return f32(i); }
|
||||
fn vec2i(f : f32) -> bool { return bool(f); }
|
||||
|
||||
@vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4<f32> {
|
||||
return select(vec4<f32>(), vec4<f32>(1), vec2i(vec2f(vec4f())));
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
int vec4f() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float vec2f(int i) {
|
||||
return float(i);
|
||||
}
|
||||
|
||||
bool vec2i(float f) {
|
||||
return bool(f);
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(uint VertexIndex) {
|
||||
const float4 tint_symbol_3 = (0.0f).xxxx;
|
||||
const float4 tint_symbol_4 = (1.0f).xxxx;
|
||||
const int tint_symbol_5 = vec4f();
|
||||
const float tint_symbol_6 = vec2f(tint_symbol_5);
|
||||
const bool tint_symbol_7 = vec2i(tint_symbol_6);
|
||||
return (tint_symbol_7 ? tint_symbol_4 : tint_symbol_3);
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 inner_result = main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
int vec4f() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float vec2f(int i) {
|
||||
return float(i);
|
||||
}
|
||||
|
||||
bool vec2i(float f) {
|
||||
return bool(f);
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(uint VertexIndex) {
|
||||
const float4 tint_symbol_3 = (0.0f).xxxx;
|
||||
const float4 tint_symbol_4 = (1.0f).xxxx;
|
||||
const int tint_symbol_5 = vec4f();
|
||||
const float tint_symbol_6 = vec2f(tint_symbol_5);
|
||||
const bool tint_symbol_7 = vec2i(tint_symbol_6);
|
||||
return (tint_symbol_7 ? tint_symbol_4 : tint_symbol_3);
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 inner_result = main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#version 310 es
|
||||
|
||||
int vec4f() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float vec2f(int i) {
|
||||
return float(i);
|
||||
}
|
||||
|
||||
bool vec2i(float f) {
|
||||
return bool(f);
|
||||
}
|
||||
|
||||
vec4 tint_symbol(uint VertexIndex) {
|
||||
vec4 tint_symbol_1 = vec4(0.0f);
|
||||
vec4 tint_symbol_2 = vec4(1.0f);
|
||||
int tint_symbol_3 = vec4f();
|
||||
float tint_symbol_4 = vec2f(tint_symbol_3);
|
||||
bool tint_symbol_5 = vec2i(tint_symbol_4);
|
||||
return (tint_symbol_5 ? tint_symbol_2 : tint_symbol_1);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = tint_symbol(uint(gl_VertexID));
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
int vec4f() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float vec2f(int i) {
|
||||
return float(i);
|
||||
}
|
||||
|
||||
bool vec2i(float f) {
|
||||
return bool(f);
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 tint_symbol_inner(uint VertexIndex) {
|
||||
float4 const tint_symbol_2 = float4(0.0f);
|
||||
float4 const tint_symbol_3 = float4(1.0f);
|
||||
int const tint_symbol_4 = vec4f();
|
||||
float const tint_symbol_5 = vec2f(tint_symbol_4);
|
||||
bool const tint_symbol_6 = vec2i(tint_symbol_5);
|
||||
return select(tint_symbol_2, tint_symbol_3, tint_symbol_6);
|
||||
}
|
||||
|
||||
vertex tint_symbol_1 tint_symbol(uint VertexIndex [[vertex_id]]) {
|
||||
float4 const inner_result = tint_symbol_inner(VertexIndex);
|
||||
tint_symbol_1 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 49
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %tint_symbol_5 "tint_symbol_5" %tint_symbol_6_1 %value %vertex_point_size
|
||||
OpName %tint_symbol_6_1 "tint_symbol_6_1"
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol_3 "tint_symbol_3"
|
||||
OpName %tint_symbol_4 "tint_symbol_4"
|
||||
OpName %tint_symbol_5_inner "tint_symbol_5_inner"
|
||||
OpName %tint_symbol_6 "tint_symbol_6"
|
||||
OpName %tint_symbol_5 "tint_symbol_5"
|
||||
OpDecorate %tint_symbol_6_1 BuiltIn VertexIndex
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%tint_symbol_6_1 = OpVariable %_ptr_Input_uint Input
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%8 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %8
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%11 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %11
|
||||
%int = OpTypeInt 32 1
|
||||
%12 = OpTypeFunction %int
|
||||
%16 = OpConstantNull %int
|
||||
%17 = OpTypeFunction %float %int
|
||||
%bool = OpTypeBool
|
||||
%22 = OpTypeFunction %bool %float
|
||||
%28 = OpTypeFunction %v4float %uint
|
||||
%float_1 = OpConstant %float 1
|
||||
%33 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%v4bool = OpTypeVector %bool 4
|
||||
%_ptr_Function_v4bool = OpTypePointer Function %v4bool
|
||||
%41 = OpConstantNull %v4bool
|
||||
%void = OpTypeVoid
|
||||
%43 = OpTypeFunction %void
|
||||
%tint_symbol = OpFunction %int None %12
|
||||
%15 = OpLabel
|
||||
OpReturnValue %16
|
||||
OpFunctionEnd
|
||||
%tint_symbol_1 = OpFunction %float None %17
|
||||
%tint_symbol_2 = OpFunctionParameter %int
|
||||
%20 = OpLabel
|
||||
%21 = OpConvertSToF %float %tint_symbol_2
|
||||
OpReturnValue %21
|
||||
OpFunctionEnd
|
||||
%tint_symbol_3 = OpFunction %bool None %22
|
||||
%tint_symbol_4 = OpFunctionParameter %float
|
||||
%26 = OpLabel
|
||||
%27 = OpFUnordNotEqual %bool %tint_symbol_4 %11
|
||||
OpReturnValue %27
|
||||
OpFunctionEnd
|
||||
%tint_symbol_5_inner = OpFunction %v4float None %28
|
||||
%tint_symbol_6 = OpFunctionParameter %uint
|
||||
%31 = OpLabel
|
||||
%39 = OpVariable %_ptr_Function_v4bool Function %41
|
||||
%34 = OpFunctionCall %int %tint_symbol
|
||||
%35 = OpFunctionCall %float %tint_symbol_1 %34
|
||||
%36 = OpFunctionCall %bool %tint_symbol_3 %35
|
||||
%42 = OpCompositeConstruct %v4bool %36 %36 %36 %36
|
||||
%37 = OpSelect %v4float %42 %33 %8
|
||||
OpReturnValue %37
|
||||
OpFunctionEnd
|
||||
%tint_symbol_5 = OpFunction %void None %43
|
||||
%46 = OpLabel
|
||||
%48 = OpLoad %uint %tint_symbol_6_1
|
||||
%47 = OpFunctionCall %v4float %tint_symbol_5_inner %48
|
||||
OpStore %value %47
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,16 @@
|
||||
fn tint_symbol() -> i32 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fn tint_symbol_1(tint_symbol_2 : i32) -> f32 {
|
||||
return f32(tint_symbol_2);
|
||||
}
|
||||
|
||||
fn tint_symbol_3(tint_symbol_4 : f32) -> bool {
|
||||
return bool(tint_symbol_4);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn tint_symbol_5(@builtin(vertex_index) tint_symbol_6 : u32) -> @builtin(position) vec4<f32> {
|
||||
return select(vec4<f32>(), vec4<f32>(1), tint_symbol_3(tint_symbol_1(tint_symbol())));
|
||||
}
|
||||
5
test/tint/shadowing/short_names/renamer/renamer.wgsl
Normal file
5
test/tint/shadowing/short_names/renamer/renamer.wgsl
Normal file
@@ -0,0 +1,5 @@
|
||||
// flags: --transform renamer
|
||||
|
||||
@vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4f {
|
||||
return vec4f(vec2f(vec2i()), 0.0, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(uint VertexIndex) {
|
||||
return float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 inner_result = main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(uint VertexIndex) {
|
||||
return float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 inner_result = main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
|
||||
vec4 tint_symbol(uint VertexIndex) {
|
||||
return vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = tint_symbol(uint(gl_VertexID));
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_1 {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 tint_symbol_inner(uint VertexIndex) {
|
||||
return float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol_1 tint_symbol(uint VertexIndex [[vertex_id]]) {
|
||||
float4 const inner_result = tint_symbol_inner(VertexIndex);
|
||||
tint_symbol_1 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 24
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %tint_symbol "tint_symbol" %tint_symbol_1_1 %value %vertex_point_size
|
||||
OpName %tint_symbol_1_1 "tint_symbol_1_1"
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_symbol_inner "tint_symbol_inner"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpDecorate %tint_symbol_1_1 BuiltIn VertexIndex
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%tint_symbol_1_1 = OpVariable %_ptr_Input_uint Input
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%8 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %8
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%11 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %11
|
||||
%12 = OpTypeFunction %v4float %uint
|
||||
%float_1 = OpConstant %float 1
|
||||
%17 = OpConstantComposite %v4float %11 %11 %11 %float_1
|
||||
%void = OpTypeVoid
|
||||
%18 = OpTypeFunction %void
|
||||
%tint_symbol_inner = OpFunction %v4float None %12
|
||||
%tint_symbol_1 = OpFunctionParameter %uint
|
||||
%15 = OpLabel
|
||||
OpReturnValue %17
|
||||
OpFunctionEnd
|
||||
%tint_symbol = OpFunction %void None %18
|
||||
%21 = OpLabel
|
||||
%23 = OpLoad %uint %tint_symbol_1_1
|
||||
%22 = OpFunctionCall %v4float %tint_symbol_inner %23
|
||||
OpStore %value %22
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,4 @@
|
||||
@vertex
|
||||
fn tint_symbol(@builtin(vertex_index) tint_symbol_1 : u32) -> @builtin(position) vec4f {
|
||||
return vec4f(vec2f(vec2i()), 0.0, 1.0);
|
||||
}
|
||||
13
test/tint/shadowing/short_names/renamer/type.wgsl
Normal file
13
test/tint/shadowing/short_names/renamer/type.wgsl
Normal file
@@ -0,0 +1,13 @@
|
||||
// flags: --transform renamer
|
||||
|
||||
// Evilness 😈. Don't go getting any ideas!
|
||||
struct vec4f { i : i32, }
|
||||
type vec2f = f32;
|
||||
type vec2i = bool;
|
||||
|
||||
@vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4<f32> {
|
||||
let s = vec4f(1);
|
||||
let f : f32 = vec2f(s.i);
|
||||
let b : bool = vec2i(f);
|
||||
return select(vec4<f32>(), vec4<f32>(1), b);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
struct vec4f {
|
||||
int i;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(uint VertexIndex) {
|
||||
const vec4f s = {1};
|
||||
const float f = float(s.i);
|
||||
const bool b = bool(f);
|
||||
return (b ? (1.0f).xxxx : (0.0f).xxxx);
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 inner_result = main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
struct vec4f {
|
||||
int i;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(uint VertexIndex) {
|
||||
const vec4f s = {1};
|
||||
const float f = float(s.i);
|
||||
const bool b = bool(f);
|
||||
return (b ? (1.0f).xxxx : (0.0f).xxxx);
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 inner_result = main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
struct vec4f {
|
||||
int i;
|
||||
};
|
||||
|
||||
vec4 tint_symbol(uint VertexIndex) {
|
||||
vec4f s = vec4f(1);
|
||||
float f = float(s.i);
|
||||
bool b = bool(f);
|
||||
return (b ? vec4(1.0f) : vec4(0.0f));
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = tint_symbol(uint(gl_VertexID));
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct vec4f {
|
||||
int i;
|
||||
};
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 tint_symbol_inner(uint VertexIndex) {
|
||||
vec4f const s = vec4f{.i=1};
|
||||
float const f = float(s.i);
|
||||
bool const b = bool(f);
|
||||
return select(float4(0.0f), float4(1.0f), b);
|
||||
}
|
||||
|
||||
vertex tint_symbol_1 tint_symbol(uint VertexIndex [[vertex_id]]) {
|
||||
float4 const inner_result = tint_symbol_inner(VertexIndex);
|
||||
tint_symbol_1 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 38
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %tint_symbol_4 "tint_symbol_4" %tint_symbol_5_1 %value %vertex_point_size
|
||||
OpName %tint_symbol_5_1 "tint_symbol_5_1"
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %tint_symbol_4_inner "tint_symbol_4_inner"
|
||||
OpName %tint_symbol_5 "tint_symbol_5"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpMemberName %tint_symbol 0 "tint_symbol_1"
|
||||
OpName %tint_symbol_4 "tint_symbol_4"
|
||||
OpDecorate %tint_symbol_5_1 BuiltIn VertexIndex
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpMemberDecorate %tint_symbol 0 Offset 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%tint_symbol_5_1 = OpVariable %_ptr_Input_uint Input
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%8 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %8
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%11 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %11
|
||||
%12 = OpTypeFunction %v4float %uint
|
||||
%int = OpTypeInt 32 1
|
||||
%tint_symbol = OpTypeStruct %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%19 = OpConstantComposite %tint_symbol %int_1
|
||||
%bool = OpTypeBool
|
||||
%float_1 = OpConstant %float 1
|
||||
%26 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%v4bool = OpTypeVector %bool 4
|
||||
%_ptr_Function_v4bool = OpTypePointer Function %v4bool
|
||||
%30 = OpConstantNull %v4bool
|
||||
%void = OpTypeVoid
|
||||
%32 = OpTypeFunction %void
|
||||
%tint_symbol_4_inner = OpFunction %v4float None %12
|
||||
%tint_symbol_5 = OpFunctionParameter %uint
|
||||
%15 = OpLabel
|
||||
%28 = OpVariable %_ptr_Function_v4bool Function %30
|
||||
%21 = OpCompositeExtract %int %19 0
|
||||
%20 = OpConvertSToF %float %21
|
||||
%22 = OpFUnordNotEqual %bool %20 %11
|
||||
%31 = OpCompositeConstruct %v4bool %22 %22 %22 %22
|
||||
%24 = OpSelect %v4float %31 %26 %8
|
||||
OpReturnValue %24
|
||||
OpFunctionEnd
|
||||
%tint_symbol_4 = OpFunction %void None %32
|
||||
%35 = OpLabel
|
||||
%37 = OpLoad %uint %tint_symbol_5_1
|
||||
%36 = OpFunctionCall %v4float %tint_symbol_4_inner %37
|
||||
OpStore %value %36
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,15 @@
|
||||
struct tint_symbol {
|
||||
tint_symbol_1 : i32,
|
||||
}
|
||||
|
||||
type tint_symbol_2 = f32;
|
||||
|
||||
type tint_symbol_3 = bool;
|
||||
|
||||
@vertex
|
||||
fn tint_symbol_4(@builtin(vertex_index) tint_symbol_5 : u32) -> @builtin(position) vec4<f32> {
|
||||
let tint_symbol_6 = tint_symbol(1);
|
||||
let tint_symbol_7 : f32 = tint_symbol_2(tint_symbol_6.tint_symbol_1);
|
||||
let tint_symbol_8 : bool = tint_symbol_3(tint_symbol_7);
|
||||
return select(vec4<f32>(), vec4<f32>(1), tint_symbol_8);
|
||||
}
|
||||
@@ -5,8 +5,8 @@ void unused_entry_point() {
|
||||
|
||||
void f() {
|
||||
{
|
||||
int vec3f = 1;
|
||||
int b = vec3f;
|
||||
int vec3f_1 = 1;
|
||||
int b = vec3f_1;
|
||||
}
|
||||
float3 c = (0.0f).xxx;
|
||||
float3 d = (0.0f).xxx;
|
||||
|
||||
@@ -5,8 +5,8 @@ void unused_entry_point() {
|
||||
|
||||
void f() {
|
||||
{
|
||||
int vec3f = 1;
|
||||
int b = vec3f;
|
||||
int vec3f_1 = 1;
|
||||
int b = vec3f_1;
|
||||
}
|
||||
float3 c = (0.0f).xxx;
|
||||
float3 d = (0.0f).xxx;
|
||||
|
||||
@@ -6,8 +6,8 @@ void unused_entry_point() {
|
||||
}
|
||||
void f() {
|
||||
{
|
||||
int vec3f = 1;
|
||||
int b = vec3f;
|
||||
int vec3f_1 = 1;
|
||||
int b = vec3f_1;
|
||||
}
|
||||
vec3 c = vec3(0.0f);
|
||||
vec3 d = vec3(0.0f);
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
using namespace metal;
|
||||
void f() {
|
||||
{
|
||||
int vec3f = 1;
|
||||
int b = vec3f;
|
||||
int vec3f_1 = 1;
|
||||
int b = vec3f_1;
|
||||
}
|
||||
float3 c = float3(0.0f);
|
||||
float3 d = float3(0.0f);
|
||||
|
||||
3
test/tint/types/short_names/short_names.wgsl
Normal file
3
test/tint/types/short_names/short_names.wgsl
Normal file
@@ -0,0 +1,3 @@
|
||||
@vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4f {
|
||||
return vec4f(vec2f(vec2i()), 0.0, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(uint VertexIndex) {
|
||||
return float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 inner_result = main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(uint VertexIndex) {
|
||||
return float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 inner_result = main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
14
test/tint/types/short_names/short_names.wgsl.expected.glsl
Normal file
14
test/tint/types/short_names/short_names.wgsl.expected.glsl
Normal file
@@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
|
||||
vec4 tint_symbol(uint VertexIndex) {
|
||||
return vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = tint_symbol(uint(gl_VertexID));
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
18
test/tint/types/short_names/short_names.wgsl.expected.msl
Normal file
18
test/tint/types/short_names/short_names.wgsl.expected.msl
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_1 {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 tint_symbol_inner(uint VertexIndex) {
|
||||
return float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol_1 tint_symbol(uint VertexIndex [[vertex_id]]) {
|
||||
float4 const inner_result = tint_symbol_inner(VertexIndex);
|
||||
tint_symbol_1 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
46
test/tint/types/short_names/short_names.wgsl.expected.spvasm
Normal file
46
test/tint/types/short_names/short_names.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,46 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 24
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %main "main" %VertexIndex_1 %value %vertex_point_size
|
||||
OpName %VertexIndex_1 "VertexIndex_1"
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %VertexIndex "VertexIndex"
|
||||
OpName %main "main"
|
||||
OpDecorate %VertexIndex_1 BuiltIn VertexIndex
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%VertexIndex_1 = OpVariable %_ptr_Input_uint Input
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%8 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %8
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%11 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %11
|
||||
%12 = OpTypeFunction %v4float %uint
|
||||
%float_1 = OpConstant %float 1
|
||||
%17 = OpConstantComposite %v4float %11 %11 %11 %float_1
|
||||
%void = OpTypeVoid
|
||||
%18 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %v4float None %12
|
||||
%VertexIndex = OpFunctionParameter %uint
|
||||
%15 = OpLabel
|
||||
OpReturnValue %17
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %18
|
||||
%21 = OpLabel
|
||||
%23 = OpLoad %uint %VertexIndex_1
|
||||
%22 = OpFunctionCall %v4float %main_inner %23
|
||||
OpStore %value %22
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,4 @@
|
||||
@vertex
|
||||
fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4f {
|
||||
return vec4f(vec2f(vec2i()), 0.0, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user