tint/intrinsics.def: Add @test_value() annotation
Specifies the value to use for argument values when generating end-to-end tests. Use this to provide a legal value for atanh(). Change-Id: I008050c856f9d687ab918c68e90678c4e74f3a1d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106887 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
c3adc78cbc
commit
95dd428c75
|
@ -423,8 +423,8 @@ fn asinh<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
|
|||
@const fn atan<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
|
||||
@const fn atan2<T: fa_f32_f16>(T, T) -> T
|
||||
@const fn atan2<T: fa_f32_f16, N: num>(vec<N, T>, vec<N, T>) -> vec<N, T>
|
||||
fn atanh<T: f32_f16>(T) -> T
|
||||
fn atanh<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
|
||||
fn atanh<T: f32_f16>(@test_value(0.5) T) -> T
|
||||
fn atanh<N: num, T: f32_f16>(@test_value(0.5) vec<N, T>) -> vec<N, T>
|
||||
fn ceil<T: f32_f16>(T) -> T
|
||||
fn ceil<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
|
||||
@const fn clamp<T: fia_fiu32_f16>(T, T, T) -> T
|
||||
|
|
|
@ -13997,8 +13997,8 @@ constexpr IntrinsicInfo kBuiltins[] = {
|
|||
},
|
||||
{
|
||||
/* [10] */
|
||||
/* fn atanh<T : f32_f16>(T) -> T */
|
||||
/* fn atanh<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
|
||||
/* fn atanh<T : f32_f16>(@test_value(0.5) T) -> T */
|
||||
/* fn atanh<N : num, T : f32_f16>(@test_value(0.5) vec<N, T>) -> vec<N, T> */
|
||||
/* num overloads */ 2,
|
||||
/* overloads */ &kOverloads[404],
|
||||
},
|
||||
|
|
|
@ -265,17 +265,22 @@ enable f16;
|
|||
{{- /* Returns a value that can be used for the parameter argument */ -}}
|
||||
{{- /* ------------------------------------------------------------------ */ -}}
|
||||
{{- $ty := .Type -}}
|
||||
{{- if eq $ty.Target.Name "i32" -}}1i
|
||||
{{- else if eq $ty.Target.Name "u32" -}}1u
|
||||
{{- else if eq $ty.Target.Name "f32" -}}1.f
|
||||
{{- else if eq $ty.Target.Name "fa" -}}1
|
||||
{{- else if eq $ty.Target.Name "ia" -}}1.0
|
||||
{{- $value := printf "%v" .TestValue }}
|
||||
{{- /* $float_value is $value with a '.' suffix (if it wasn't a float already) */ -}}
|
||||
{{- $float_value := $value }}
|
||||
{{- if not (Contains $value ".") }}{{$float_value = printf "%v." $value}}{{end}}
|
||||
{{- /* emit the value with any necessary suffixes */ -}}
|
||||
{{- if eq $ty.Target.Name "i32" -}}{{$value}}i
|
||||
{{- else if eq $ty.Target.Name "u32" -}}{{$value}}u
|
||||
{{- else if eq $ty.Target.Name "f32" -}}{{$float_value}}f
|
||||
{{- else if eq $ty.Target.Name "fa" -}}{{$value}}
|
||||
{{- else if eq $ty.Target.Name "ia" -}}{{$float_value}}0
|
||||
{{- else if eq $ty.Target.Name "bool" -}}true
|
||||
{{- else if eq $ty.Target.Name "vec" -}}
|
||||
{{- $el := Eval "ArgumentValue" "Type" (ElementType .Type) "Name" ""}}
|
||||
{{- $el := Eval "ArgumentValue" "Type" (ElementType .Type) "Name" "" "TestValue" .TestValue }}
|
||||
{{- template "Type" $ty}}({{$el}})
|
||||
{{- else if eq $ty.Target.Name "mat" -}}{{template "Type" $ty}}(
|
||||
{{- $el := Eval "ArgumentValue" "Type" (ElementType .Type) "Name" ""}}
|
||||
{{- $el := Eval "ArgumentValue" "Type" (ElementType .Type) "Name" "" "TestValue" .TestValue }}
|
||||
{{- range $col := Iterate (index $ty.TemplateArguments 0) }}
|
||||
{{- range $row := Iterate (index $ty.TemplateArguments 1) }}
|
||||
{{- if or $col $row -}}, {{end}}{{$el}}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// fn atanh(vec<3, f32>) -> vec<3, f32>
|
||||
fn atanh_440cca() {
|
||||
var res: vec3<f32> = atanh(vec3<f32>(1.f));
|
||||
var res: vec3<f32> = atanh(vec3<f32>(0.5f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
|
@ -3,7 +3,7 @@ float3 tint_atanh(float3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
float3 res = tint_atanh((1.0f).xxx);
|
||||
float3 res = tint_atanh((0.5f).xxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -3,7 +3,7 @@ float3 tint_atanh(float3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
float3 res = tint_atanh((1.0f).xxx);
|
||||
float3 res = tint_atanh((0.5f).xxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -5,7 +5,7 @@ vec3 tint_atanh(vec3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
vec3 res = tint_atanh(vec3(1.0f));
|
||||
vec3 res = tint_atanh(vec3(0.5f));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
|
@ -29,7 +29,7 @@ vec3 tint_atanh(vec3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
vec3 res = tint_atanh(vec3(1.0f));
|
||||
vec3 res = tint_atanh(vec3(0.5f));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
|
@ -47,7 +47,7 @@ vec3 tint_atanh(vec3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
vec3 res = tint_atanh(vec3(1.0f));
|
||||
vec3 res = tint_atanh(vec3(0.5f));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
|
|
|
@ -6,7 +6,7 @@ float3 tint_atanh(float3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
float3 res = tint_atanh(float3(1.0f));
|
||||
float3 res = tint_atanh(float3(0.5f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 43
|
||||
; Bound: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%22 = OpExtInstImport "GLSL.std.450"
|
||||
|
@ -40,8 +40,10 @@
|
|||
%20 = OpConstantNull %v3float
|
||||
%void = OpTypeVoid
|
||||
%23 = OpTypeFunction %void
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%29 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%30 = OpTypeFunction %v4float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%tint_atanh = OpFunction %v3float None %9
|
||||
%x = OpFunctionParameter %v3float
|
||||
%13 = OpLabel
|
||||
|
@ -53,29 +55,29 @@
|
|||
%atanh_440cca = OpFunction %void None %23
|
||||
%26 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v3float Function %20
|
||||
%27 = OpFunctionCall %v3float %tint_atanh %16
|
||||
%27 = OpFunctionCall %v3float %tint_atanh %29
|
||||
OpStore %res %27
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %30
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %atanh_440cca
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %atanh_440cca
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %23
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %36
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %23
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %atanh_440cca
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %void %atanh_440cca
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %23
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %atanh_440cca
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %atanh_440cca
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn atanh_440cca() {
|
||||
var res : vec3<f32> = atanh(vec3<f32>(1.0f));
|
||||
var res : vec3<f32> = atanh(vec3<f32>(0.5f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// fn atanh(f32) -> f32
|
||||
fn atanh_7997d8() {
|
||||
var res: f32 = atanh(1.f);
|
||||
var res: f32 = atanh(0.5f);
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
|
@ -3,7 +3,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float res = tint_atanh(1.0f);
|
||||
float res = tint_atanh(0.5f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -3,7 +3,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float res = tint_atanh(1.0f);
|
||||
float res = tint_atanh(0.5f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -5,7 +5,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float res = tint_atanh(1.0f);
|
||||
float res = tint_atanh(0.5f);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
|
@ -29,7 +29,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float res = tint_atanh(1.0f);
|
||||
float res = tint_atanh(0.5f);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
|
@ -47,7 +47,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float res = tint_atanh(1.0f);
|
||||
float res = tint_atanh(0.5f);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
|
|
|
@ -6,7 +6,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float res = tint_atanh(1.0f);
|
||||
float res = tint_atanh(0.5f);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 39
|
||||
; Bound: 40
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%18 = OpExtInstImport "GLSL.std.450"
|
||||
|
@ -36,8 +36,9 @@
|
|||
%bool = OpTypeBool
|
||||
%void = OpTypeVoid
|
||||
%19 = OpTypeFunction %void
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%26 = OpTypeFunction %v4float
|
||||
%27 = OpTypeFunction %v4float
|
||||
%tint_atanh = OpFunction %float None %9
|
||||
%x = OpFunctionParameter %float
|
||||
%12 = OpLabel
|
||||
|
@ -49,29 +50,29 @@
|
|||
%atanh_7997d8 = OpFunction %void None %19
|
||||
%22 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_float Function %8
|
||||
%23 = OpFunctionCall %float %tint_atanh %float_1
|
||||
%23 = OpFunctionCall %float %tint_atanh %float_0_5
|
||||
OpStore %res %23
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %26
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %void %atanh_7997d8
|
||||
%vertex_main_inner = OpFunction %v4float None %27
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %atanh_7997d8
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %19
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %32
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %33
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %19
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %atanh_7997d8
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %atanh_7997d8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %19
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %atanh_7997d8
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %atanh_7997d8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn atanh_7997d8() {
|
||||
var res : f32 = atanh(1.0f);
|
||||
var res : f32 = atanh(0.5f);
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// fn atanh(vec<2, f32>) -> vec<2, f32>
|
||||
fn atanh_c0e634() {
|
||||
var res: vec2<f32> = atanh(vec2<f32>(1.f));
|
||||
var res: vec2<f32> = atanh(vec2<f32>(0.5f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
|
@ -3,7 +3,7 @@ float2 tint_atanh(float2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
float2 res = tint_atanh((1.0f).xx);
|
||||
float2 res = tint_atanh((0.5f).xx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -3,7 +3,7 @@ float2 tint_atanh(float2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
float2 res = tint_atanh((1.0f).xx);
|
||||
float2 res = tint_atanh((0.5f).xx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -5,7 +5,7 @@ vec2 tint_atanh(vec2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
vec2 res = tint_atanh(vec2(1.0f));
|
||||
vec2 res = tint_atanh(vec2(0.5f));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
|
@ -29,7 +29,7 @@ vec2 tint_atanh(vec2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
vec2 res = tint_atanh(vec2(1.0f));
|
||||
vec2 res = tint_atanh(vec2(0.5f));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
|
@ -47,7 +47,7 @@ vec2 tint_atanh(vec2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
vec2 res = tint_atanh(vec2(1.0f));
|
||||
vec2 res = tint_atanh(vec2(0.5f));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
|
|
|
@ -6,7 +6,7 @@ float2 tint_atanh(float2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
float2 res = tint_atanh(float2(1.0f));
|
||||
float2 res = tint_atanh(float2(0.5f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 43
|
||||
; Bound: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%22 = OpExtInstImport "GLSL.std.450"
|
||||
|
@ -40,8 +40,10 @@
|
|||
%20 = OpConstantNull %v2float
|
||||
%void = OpTypeVoid
|
||||
%23 = OpTypeFunction %void
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%29 = OpConstantComposite %v2float %float_0_5 %float_0_5
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%30 = OpTypeFunction %v4float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%tint_atanh = OpFunction %v2float None %9
|
||||
%x = OpFunctionParameter %v2float
|
||||
%13 = OpLabel
|
||||
|
@ -53,29 +55,29 @@
|
|||
%atanh_c0e634 = OpFunction %void None %23
|
||||
%26 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2float Function %20
|
||||
%27 = OpFunctionCall %v2float %tint_atanh %16
|
||||
%27 = OpFunctionCall %v2float %tint_atanh %29
|
||||
OpStore %res %27
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %30
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %atanh_c0e634
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %atanh_c0e634
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %23
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %36
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %23
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %atanh_c0e634
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %void %atanh_c0e634
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %23
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %atanh_c0e634
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %atanh_c0e634
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn atanh_c0e634() {
|
||||
var res : vec2<f32> = atanh(vec2<f32>(1.0f));
|
||||
var res : vec2<f32> = atanh(vec2<f32>(0.5f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// fn atanh(vec<4, f32>) -> vec<4, f32>
|
||||
fn atanh_f3e01b() {
|
||||
var res: vec4<f32> = atanh(vec4<f32>(1.f));
|
||||
var res: vec4<f32> = atanh(vec4<f32>(0.5f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
|
@ -3,7 +3,7 @@ float4 tint_atanh(float4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
float4 res = tint_atanh((1.0f).xxxx);
|
||||
float4 res = tint_atanh((0.5f).xxxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -3,7 +3,7 @@ float4 tint_atanh(float4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
float4 res = tint_atanh((1.0f).xxxx);
|
||||
float4 res = tint_atanh((0.5f).xxxx);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -5,7 +5,7 @@ vec4 tint_atanh(vec4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
vec4 res = tint_atanh(vec4(1.0f));
|
||||
vec4 res = tint_atanh(vec4(0.5f));
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
|
@ -29,7 +29,7 @@ vec4 tint_atanh(vec4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
vec4 res = tint_atanh(vec4(1.0f));
|
||||
vec4 res = tint_atanh(vec4(0.5f));
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
|
@ -47,7 +47,7 @@ vec4 tint_atanh(vec4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
vec4 res = tint_atanh(vec4(1.0f));
|
||||
vec4 res = tint_atanh(vec4(0.5f));
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
|
|
|
@ -6,7 +6,7 @@ float4 tint_atanh(float4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
float4 res = tint_atanh(float4(1.0f));
|
||||
float4 res = tint_atanh(float4(0.5f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 41
|
||||
; Bound: 43
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%20 = OpExtInstImport "GLSL.std.450"
|
||||
|
@ -38,8 +38,10 @@
|
|||
%v4bool = OpTypeVector %bool 4
|
||||
%void = OpTypeVoid
|
||||
%21 = OpTypeFunction %void
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%27 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%28 = OpTypeFunction %v4float
|
||||
%30 = OpTypeFunction %v4float
|
||||
%tint_atanh = OpFunction %v4float None %9
|
||||
%x = OpFunctionParameter %v4float
|
||||
%12 = OpLabel
|
||||
|
@ -51,29 +53,29 @@
|
|||
%atanh_f3e01b = OpFunction %void None %21
|
||||
%24 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%25 = OpFunctionCall %v4float %tint_atanh %15
|
||||
%25 = OpFunctionCall %v4float %tint_atanh %27
|
||||
OpStore %res %25
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %28
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %atanh_f3e01b
|
||||
%vertex_main_inner = OpFunction %v4float None %30
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %atanh_f3e01b
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %21
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %34
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %36
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %21
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %atanh_f3e01b
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %atanh_f3e01b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %21
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %atanh_f3e01b
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %atanh_f3e01b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn atanh_f3e01b() {
|
||||
var res : vec4<f32> = atanh(vec4<f32>(1.0f));
|
||||
var res : vec4<f32> = atanh(vec4<f32>(0.5f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// fn atanh(vec<3, f32>) -> vec<3, f32>
|
||||
fn atanh_440cca() {
|
||||
var arg_0 = vec3<f32>(1.f);
|
||||
var arg_0 = vec3<f32>(0.5f);
|
||||
var res: vec3<f32> = atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ float3 tint_atanh(float3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
float3 arg_0 = (1.0f).xxx;
|
||||
float3 arg_0 = (0.5f).xxx;
|
||||
float3 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ float3 tint_atanh(float3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
float3 arg_0 = (1.0f).xxx;
|
||||
float3 arg_0 = (0.5f).xxx;
|
||||
float3 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ vec3 tint_atanh(vec3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
vec3 arg_0 = vec3(1.0f);
|
||||
vec3 arg_0 = vec3(0.5f);
|
||||
vec3 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ vec3 tint_atanh(vec3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
vec3 arg_0 = vec3(1.0f);
|
||||
vec3 arg_0 = vec3(0.5f);
|
||||
vec3 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ vec3 tint_atanh(vec3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
vec3 arg_0 = vec3(1.0f);
|
||||
vec3 arg_0 = vec3(0.5f);
|
||||
vec3 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ float3 tint_atanh(float3 x) {
|
|||
}
|
||||
|
||||
void atanh_440cca() {
|
||||
float3 arg_0 = float3(1.0f);
|
||||
float3 arg_0 = float3(0.5f);
|
||||
float3 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 45
|
||||
; Bound: 47
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%22 = OpExtInstImport "GLSL.std.450"
|
||||
|
@ -41,8 +41,10 @@
|
|||
%20 = OpConstantNull %v3float
|
||||
%void = OpTypeVoid
|
||||
%23 = OpTypeFunction %void
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%28 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%34 = OpTypeFunction %v4float
|
||||
%tint_atanh = OpFunction %v3float None %9
|
||||
%x = OpFunctionParameter %v3float
|
||||
%13 = OpLabel
|
||||
|
@ -55,31 +57,31 @@
|
|||
%26 = OpLabel
|
||||
%arg_0 = OpVariable %_ptr_Function_v3float Function %20
|
||||
%res = OpVariable %_ptr_Function_v3float Function %20
|
||||
OpStore %arg_0 %16
|
||||
%30 = OpLoad %v3float %arg_0
|
||||
%29 = OpFunctionCall %v3float %tint_atanh %30
|
||||
OpStore %res %29
|
||||
OpStore %arg_0 %28
|
||||
%32 = OpLoad %v3float %arg_0
|
||||
%31 = OpFunctionCall %v3float %tint_atanh %32
|
||||
OpStore %res %31
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %atanh_440cca
|
||||
%vertex_main_inner = OpFunction %v4float None %34
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %atanh_440cca
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %23
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %40
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %23
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %void %atanh_440cca
|
||||
%42 = OpLabel
|
||||
%43 = OpFunctionCall %void %atanh_440cca
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %23
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %atanh_440cca
|
||||
%45 = OpLabel
|
||||
%46 = OpFunctionCall %void %atanh_440cca
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn atanh_440cca() {
|
||||
var arg_0 = vec3<f32>(1.0f);
|
||||
var arg_0 = vec3<f32>(0.5f);
|
||||
var res : vec3<f32> = atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// fn atanh(f32) -> f32
|
||||
fn atanh_7997d8() {
|
||||
var arg_0 = 1.f;
|
||||
var arg_0 = 0.5f;
|
||||
var res: f32 = atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float arg_0 = 1.0f;
|
||||
float arg_0 = 0.5f;
|
||||
float res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float arg_0 = 1.0f;
|
||||
float arg_0 = 0.5f;
|
||||
float res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float arg_0 = 1.0f;
|
||||
float arg_0 = 0.5f;
|
||||
float res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float arg_0 = 1.0f;
|
||||
float arg_0 = 0.5f;
|
||||
float res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float arg_0 = 1.0f;
|
||||
float arg_0 = 0.5f;
|
||||
float res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ float tint_atanh(float x) {
|
|||
}
|
||||
|
||||
void atanh_7997d8() {
|
||||
float arg_0 = 1.0f;
|
||||
float arg_0 = 0.5f;
|
||||
float res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 41
|
||||
; Bound: 42
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%18 = OpExtInstImport "GLSL.std.450"
|
||||
|
@ -37,8 +37,9 @@
|
|||
%bool = OpTypeBool
|
||||
%void = OpTypeVoid
|
||||
%19 = OpTypeFunction %void
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%28 = OpTypeFunction %v4float
|
||||
%29 = OpTypeFunction %v4float
|
||||
%tint_atanh = OpFunction %float None %9
|
||||
%x = OpFunctionParameter %float
|
||||
%12 = OpLabel
|
||||
|
@ -51,31 +52,31 @@
|
|||
%22 = OpLabel
|
||||
%arg_0 = OpVariable %_ptr_Function_float Function %8
|
||||
%res = OpVariable %_ptr_Function_float Function %8
|
||||
OpStore %arg_0 %float_1
|
||||
%26 = OpLoad %float %arg_0
|
||||
%25 = OpFunctionCall %float %tint_atanh %26
|
||||
OpStore %res %25
|
||||
OpStore %arg_0 %float_0_5
|
||||
%27 = OpLoad %float %arg_0
|
||||
%26 = OpFunctionCall %float %tint_atanh %27
|
||||
OpStore %res %26
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %28
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %atanh_7997d8
|
||||
%vertex_main_inner = OpFunction %v4float None %29
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %atanh_7997d8
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %19
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %34
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %35
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %19
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %atanh_7997d8
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %atanh_7997d8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %19
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %atanh_7997d8
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %void %atanh_7997d8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn atanh_7997d8() {
|
||||
var arg_0 = 1.0f;
|
||||
var arg_0 = 0.5f;
|
||||
var res : f32 = atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// fn atanh(vec<2, f32>) -> vec<2, f32>
|
||||
fn atanh_c0e634() {
|
||||
var arg_0 = vec2<f32>(1.f);
|
||||
var arg_0 = vec2<f32>(0.5f);
|
||||
var res: vec2<f32> = atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ float2 tint_atanh(float2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
float2 arg_0 = (1.0f).xx;
|
||||
float2 arg_0 = (0.5f).xx;
|
||||
float2 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ float2 tint_atanh(float2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
float2 arg_0 = (1.0f).xx;
|
||||
float2 arg_0 = (0.5f).xx;
|
||||
float2 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ vec2 tint_atanh(vec2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
vec2 arg_0 = vec2(1.0f);
|
||||
vec2 arg_0 = vec2(0.5f);
|
||||
vec2 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ vec2 tint_atanh(vec2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
vec2 arg_0 = vec2(1.0f);
|
||||
vec2 arg_0 = vec2(0.5f);
|
||||
vec2 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ vec2 tint_atanh(vec2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
vec2 arg_0 = vec2(1.0f);
|
||||
vec2 arg_0 = vec2(0.5f);
|
||||
vec2 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ float2 tint_atanh(float2 x) {
|
|||
}
|
||||
|
||||
void atanh_c0e634() {
|
||||
float2 arg_0 = float2(1.0f);
|
||||
float2 arg_0 = float2(0.5f);
|
||||
float2 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 45
|
||||
; Bound: 47
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%22 = OpExtInstImport "GLSL.std.450"
|
||||
|
@ -41,8 +41,10 @@
|
|||
%20 = OpConstantNull %v2float
|
||||
%void = OpTypeVoid
|
||||
%23 = OpTypeFunction %void
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%28 = OpConstantComposite %v2float %float_0_5 %float_0_5
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%34 = OpTypeFunction %v4float
|
||||
%tint_atanh = OpFunction %v2float None %9
|
||||
%x = OpFunctionParameter %v2float
|
||||
%13 = OpLabel
|
||||
|
@ -55,31 +57,31 @@
|
|||
%26 = OpLabel
|
||||
%arg_0 = OpVariable %_ptr_Function_v2float Function %20
|
||||
%res = OpVariable %_ptr_Function_v2float Function %20
|
||||
OpStore %arg_0 %16
|
||||
%30 = OpLoad %v2float %arg_0
|
||||
%29 = OpFunctionCall %v2float %tint_atanh %30
|
||||
OpStore %res %29
|
||||
OpStore %arg_0 %28
|
||||
%32 = OpLoad %v2float %arg_0
|
||||
%31 = OpFunctionCall %v2float %tint_atanh %32
|
||||
OpStore %res %31
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %atanh_c0e634
|
||||
%vertex_main_inner = OpFunction %v4float None %34
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %atanh_c0e634
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %23
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %40
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %23
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %void %atanh_c0e634
|
||||
%42 = OpLabel
|
||||
%43 = OpFunctionCall %void %atanh_c0e634
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %23
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %atanh_c0e634
|
||||
%45 = OpLabel
|
||||
%46 = OpFunctionCall %void %atanh_c0e634
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn atanh_c0e634() {
|
||||
var arg_0 = vec2<f32>(1.0f);
|
||||
var arg_0 = vec2<f32>(0.5f);
|
||||
var res : vec2<f32> = atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// fn atanh(vec<4, f32>) -> vec<4, f32>
|
||||
fn atanh_f3e01b() {
|
||||
var arg_0 = vec4<f32>(1.f);
|
||||
var arg_0 = vec4<f32>(0.5f);
|
||||
var res: vec4<f32> = atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ float4 tint_atanh(float4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
float4 arg_0 = (1.0f).xxxx;
|
||||
float4 arg_0 = (0.5f).xxxx;
|
||||
float4 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ float4 tint_atanh(float4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
float4 arg_0 = (1.0f).xxxx;
|
||||
float4 arg_0 = (0.5f).xxxx;
|
||||
float4 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ vec4 tint_atanh(vec4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
vec4 arg_0 = vec4(1.0f);
|
||||
vec4 arg_0 = vec4(0.5f);
|
||||
vec4 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ vec4 tint_atanh(vec4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
vec4 arg_0 = vec4(1.0f);
|
||||
vec4 arg_0 = vec4(0.5f);
|
||||
vec4 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ vec4 tint_atanh(vec4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
vec4 arg_0 = vec4(1.0f);
|
||||
vec4 arg_0 = vec4(0.5f);
|
||||
vec4 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ float4 tint_atanh(float4 x) {
|
|||
}
|
||||
|
||||
void atanh_f3e01b() {
|
||||
float4 arg_0 = float4(1.0f);
|
||||
float4 arg_0 = float4(0.5f);
|
||||
float4 res = tint_atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 43
|
||||
; Bound: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%20 = OpExtInstImport "GLSL.std.450"
|
||||
|
@ -39,8 +39,10 @@
|
|||
%v4bool = OpTypeVector %bool 4
|
||||
%void = OpTypeVoid
|
||||
%21 = OpTypeFunction %void
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%26 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%30 = OpTypeFunction %v4float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%tint_atanh = OpFunction %v4float None %9
|
||||
%x = OpFunctionParameter %v4float
|
||||
%12 = OpLabel
|
||||
|
@ -53,31 +55,31 @@
|
|||
%24 = OpLabel
|
||||
%arg_0 = OpVariable %_ptr_Function_v4float Function %5
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
OpStore %arg_0 %15
|
||||
%28 = OpLoad %v4float %arg_0
|
||||
%27 = OpFunctionCall %v4float %tint_atanh %28
|
||||
OpStore %res %27
|
||||
OpStore %arg_0 %26
|
||||
%30 = OpLoad %v4float %arg_0
|
||||
%29 = OpFunctionCall %v4float %tint_atanh %30
|
||||
OpStore %res %29
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %30
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %atanh_f3e01b
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %atanh_f3e01b
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %21
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %36
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %21
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %atanh_f3e01b
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %void %atanh_f3e01b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %21
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %atanh_f3e01b
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %atanh_f3e01b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn atanh_f3e01b() {
|
||||
var arg_0 = vec4<f32>(1.0f);
|
||||
var arg_0 = vec4<f32>(0.5f);
|
||||
var res : vec4<f32> = atanh(arg_0);
|
||||
}
|
||||
|
||||
|
|
|
@ -303,6 +303,7 @@ func (g *generator) bindAndParse(t *template.Template, text string) error {
|
|||
"Title": strings.Title,
|
||||
"PascalCase": pascalCase,
|
||||
"SplitDisplayName": gen.SplitDisplayName,
|
||||
"Contains": strings.Contains,
|
||||
"HasPrefix": strings.HasPrefix,
|
||||
"HasSuffix": strings.HasSuffix,
|
||||
"TrimPrefix": strings.TrimPrefix,
|
||||
|
|
|
@ -367,7 +367,7 @@ func (l *Attributes) Take(name string) *Attribute {
|
|||
type Attribute struct {
|
||||
Source tok.Source
|
||||
Name string
|
||||
Values []string
|
||||
Values []any
|
||||
}
|
||||
|
||||
// Format implements the fmt.Formatter interface
|
||||
|
|
|
@ -86,6 +86,7 @@ func (p *Permuter) Permute(overload *sem.Overload) ([]Permutation, error) {
|
|||
Name: p.Name,
|
||||
Type: ty,
|
||||
IsConst: p.IsConst,
|
||||
TestValue: p.TestValue,
|
||||
})
|
||||
}
|
||||
if overload.ReturnType != nil {
|
||||
|
|
|
@ -104,7 +104,23 @@ func (l *lexer) lex() error {
|
|||
case unicode.IsLetter(l.peek(0)) || l.peek(0) == '_':
|
||||
l.tok(l.count(alphaNumericOrUnderscore), tok.Identifier)
|
||||
case unicode.IsNumber(l.peek(0)):
|
||||
l.tok(l.count(unicode.IsNumber), tok.Integer)
|
||||
isFloat := false
|
||||
pred := func(r rune) bool {
|
||||
if unicode.IsNumber(r) {
|
||||
return true
|
||||
}
|
||||
if !isFloat && r == '.' {
|
||||
isFloat = true
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
n := l.count(pred)
|
||||
if isFloat {
|
||||
l.tok(n, tok.Float)
|
||||
} else {
|
||||
l.tok(n, tok.Integer)
|
||||
}
|
||||
case l.match("&&", tok.AndAnd):
|
||||
case l.match("&", tok.And):
|
||||
case l.match("||", tok.OrOr):
|
||||
|
|
|
@ -20,12 +20,13 @@ import (
|
|||
|
||||
"dawn.googlesource.com/dawn/tools/src/tint/intrinsic/lexer"
|
||||
"dawn.googlesource.com/dawn/tools/src/tint/intrinsic/tok"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
func TestLexTokens(t *testing.T) {
|
||||
type test struct {
|
||||
src string
|
||||
expect tok.Token
|
||||
expect []tok.Token
|
||||
}
|
||||
|
||||
filepath := "test.txt"
|
||||
|
@ -34,144 +35,153 @@ func TestLexTokens(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range []test{
|
||||
{"ident", tok.Token{Kind: tok.Identifier, Runes: []rune("ident"), Source: tok.Source{
|
||||
{"ident", []tok.Token{{Kind: tok.Identifier, Runes: []rune("ident"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 6, 5),
|
||||
}}},
|
||||
{"ident_123", tok.Token{Kind: tok.Identifier, Runes: []rune("ident_123"), Source: tok.Source{
|
||||
}}}},
|
||||
{"ident_123", []tok.Token{{Kind: tok.Identifier, Runes: []rune("ident_123"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 10, 9),
|
||||
}}},
|
||||
{"_ident_", tok.Token{Kind: tok.Identifier, Runes: []rune("_ident_"), Source: tok.Source{
|
||||
}}}},
|
||||
{"_ident_", []tok.Token{{Kind: tok.Identifier, Runes: []rune("_ident_"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 8, 7),
|
||||
}}},
|
||||
{"123456789", tok.Token{Kind: tok.Integer, Runes: []rune("123456789"), Source: tok.Source{
|
||||
}}}},
|
||||
{"123456789", []tok.Token{{Kind: tok.Integer, Runes: []rune("123456789"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 10, 9),
|
||||
}}},
|
||||
{"match", tok.Token{Kind: tok.Match, Runes: []rune("match"), Source: tok.Source{
|
||||
}}}},
|
||||
{"1234.56789", []tok.Token{{Kind: tok.Float, Runes: []rune("1234.56789"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 11, 10),
|
||||
}}}},
|
||||
{"123.456.789", []tok.Token{
|
||||
{Kind: tok.Float, Runes: []rune("123.456"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 8, 7),
|
||||
}},
|
||||
{Kind: tok.Dot, Runes: []rune("."), Source: tok.Source{
|
||||
S: loc(1, 8, 7), E: loc(1, 9, 8),
|
||||
}},
|
||||
{Kind: tok.Integer, Runes: []rune("789"), Source: tok.Source{
|
||||
S: loc(1, 9, 8), E: loc(1, 12, 11),
|
||||
}},
|
||||
}},
|
||||
{"match", []tok.Token{{Kind: tok.Match, Runes: []rune("match"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 6, 5),
|
||||
}}},
|
||||
{"fn", tok.Token{Kind: tok.Function, Runes: []rune("fn"), Source: tok.Source{
|
||||
}}}},
|
||||
{"fn", []tok.Token{{Kind: tok.Function, Runes: []rune("fn"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"op", tok.Token{Kind: tok.Operator, Runes: []rune("op"), Source: tok.Source{
|
||||
}}}},
|
||||
{"op", []tok.Token{{Kind: tok.Operator, Runes: []rune("op"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"type", tok.Token{Kind: tok.Type, Runes: []rune("type"), Source: tok.Source{
|
||||
}}}},
|
||||
{"type", []tok.Token{{Kind: tok.Type, Runes: []rune("type"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||
}}},
|
||||
{"init", tok.Token{Kind: tok.Initializer, Runes: []rune("init"), Source: tok.Source{
|
||||
}}}},
|
||||
{"init", []tok.Token{{Kind: tok.Initializer, Runes: []rune("init"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||
}}},
|
||||
{"conv", tok.Token{Kind: tok.Converter, Runes: []rune("conv"), Source: tok.Source{
|
||||
}}}},
|
||||
{"conv", []tok.Token{{Kind: tok.Converter, Runes: []rune("conv"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||
}}},
|
||||
{"enum", tok.Token{Kind: tok.Enum, Runes: []rune("enum"), Source: tok.Source{
|
||||
}}}},
|
||||
{"enum", []tok.Token{{Kind: tok.Enum, Runes: []rune("enum"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||
}}},
|
||||
{":", tok.Token{Kind: tok.Colon, Runes: []rune(":"), Source: tok.Source{
|
||||
}}}},
|
||||
{":", []tok.Token{{Kind: tok.Colon, Runes: []rune(":"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{",", tok.Token{Kind: tok.Comma, Runes: []rune(","), Source: tok.Source{
|
||||
}}}},
|
||||
{",", []tok.Token{{Kind: tok.Comma, Runes: []rune(","), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"<", tok.Token{Kind: tok.Lt, Runes: []rune("<"), Source: tok.Source{
|
||||
}}}},
|
||||
{"<", []tok.Token{{Kind: tok.Lt, Runes: []rune("<"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{">", tok.Token{Kind: tok.Gt, Runes: []rune(">"), Source: tok.Source{
|
||||
}}}},
|
||||
{">", []tok.Token{{Kind: tok.Gt, Runes: []rune(">"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"{", tok.Token{Kind: tok.Lbrace, Runes: []rune("{"), Source: tok.Source{
|
||||
}}}},
|
||||
{"{", []tok.Token{{Kind: tok.Lbrace, Runes: []rune("{"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"}", tok.Token{Kind: tok.Rbrace, Runes: []rune("}"), Source: tok.Source{
|
||||
}}}},
|
||||
{"}", []tok.Token{{Kind: tok.Rbrace, Runes: []rune("}"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"&&", tok.Token{Kind: tok.AndAnd, Runes: []rune("&&"), Source: tok.Source{
|
||||
}}}},
|
||||
{"&&", []tok.Token{{Kind: tok.AndAnd, Runes: []rune("&&"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"&", tok.Token{Kind: tok.And, Runes: []rune("&"), Source: tok.Source{
|
||||
}}}},
|
||||
{"&", []tok.Token{{Kind: tok.And, Runes: []rune("&"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"||", tok.Token{Kind: tok.OrOr, Runes: []rune("||"), Source: tok.Source{
|
||||
}}}},
|
||||
{"||", []tok.Token{{Kind: tok.OrOr, Runes: []rune("||"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"|", tok.Token{Kind: tok.Or, Runes: []rune("|"), Source: tok.Source{
|
||||
}}}},
|
||||
{"|", []tok.Token{{Kind: tok.Or, Runes: []rune("|"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"!", tok.Token{Kind: tok.Not, Runes: []rune("!"), Source: tok.Source{
|
||||
}}}},
|
||||
{"!", []tok.Token{{Kind: tok.Not, Runes: []rune("!"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"!=", tok.Token{Kind: tok.NotEqual, Runes: []rune("!="), Source: tok.Source{
|
||||
}}}},
|
||||
{"!=", []tok.Token{{Kind: tok.NotEqual, Runes: []rune("!="), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"==", tok.Token{Kind: tok.Equal, Runes: []rune("=="), Source: tok.Source{
|
||||
}}}},
|
||||
{"==", []tok.Token{{Kind: tok.Equal, Runes: []rune("=="), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"=", tok.Token{Kind: tok.Assign, Runes: []rune("="), Source: tok.Source{
|
||||
}}}},
|
||||
{"=", []tok.Token{{Kind: tok.Assign, Runes: []rune("="), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"<<", tok.Token{Kind: tok.Shl, Runes: []rune("<<"), Source: tok.Source{
|
||||
}}}},
|
||||
{"<<", []tok.Token{{Kind: tok.Shl, Runes: []rune("<<"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"<=", tok.Token{Kind: tok.Le, Runes: []rune("<="), Source: tok.Source{
|
||||
}}}},
|
||||
{"<=", []tok.Token{{Kind: tok.Le, Runes: []rune("<="), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"<", tok.Token{Kind: tok.Lt, Runes: []rune("<"), Source: tok.Source{
|
||||
}}}},
|
||||
{"<", []tok.Token{{Kind: tok.Lt, Runes: []rune("<"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{">=", tok.Token{Kind: tok.Ge, Runes: []rune(">="), Source: tok.Source{
|
||||
}}}},
|
||||
{">=", []tok.Token{{Kind: tok.Ge, Runes: []rune(">="), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{">>", tok.Token{Kind: tok.Shr, Runes: []rune(">>"), Source: tok.Source{
|
||||
}}}},
|
||||
{">>", []tok.Token{{Kind: tok.Shr, Runes: []rune(">>"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{">", tok.Token{Kind: tok.Gt, Runes: []rune(">"), Source: tok.Source{
|
||||
}}}},
|
||||
{">", []tok.Token{{Kind: tok.Gt, Runes: []rune(">"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"@", tok.Token{Kind: tok.Attr, Runes: []rune("@"), Source: tok.Source{
|
||||
}}}},
|
||||
{"@", []tok.Token{{Kind: tok.Attr, Runes: []rune("@"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"(", tok.Token{Kind: tok.Lparen, Runes: []rune("("), Source: tok.Source{
|
||||
}}}},
|
||||
{"(", []tok.Token{{Kind: tok.Lparen, Runes: []rune("("), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{")", tok.Token{Kind: tok.Rparen, Runes: []rune(")"), Source: tok.Source{
|
||||
}}}},
|
||||
{")", []tok.Token{{Kind: tok.Rparen, Runes: []rune(")"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"|", tok.Token{Kind: tok.Or, Runes: []rune("|"), Source: tok.Source{
|
||||
}}}},
|
||||
{"|", []tok.Token{{Kind: tok.Or, Runes: []rune("|"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"*", tok.Token{Kind: tok.Star, Runes: []rune("*"), Source: tok.Source{
|
||||
}}}},
|
||||
{"*", []tok.Token{{Kind: tok.Star, Runes: []rune("*"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{"->", tok.Token{Kind: tok.Arrow, Runes: []rune("->"), Source: tok.Source{
|
||||
}}}},
|
||||
{"->", []tok.Token{{Kind: tok.Arrow, Runes: []rune("->"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 3, 2),
|
||||
}}},
|
||||
{"x // y ", tok.Token{Kind: tok.Identifier, Runes: []rune("x"), Source: tok.Source{
|
||||
}}}},
|
||||
{"x // y ", []tok.Token{{Kind: tok.Identifier, Runes: []rune("x"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 2, 1),
|
||||
}}},
|
||||
{`"abc"`, tok.Token{Kind: tok.String, Runes: []rune("abc"), Source: tok.Source{
|
||||
}}}},
|
||||
{`"abc"`, []tok.Token{{Kind: tok.String, Runes: []rune("abc"), Source: tok.Source{
|
||||
S: loc(1, 2, 1), E: loc(1, 5, 4),
|
||||
}}},
|
||||
}}}},
|
||||
{`
|
||||
//
|
||||
ident
|
||||
|
||||
`, tok.Token{Kind: tok.Identifier, Runes: []rune("ident"), Source: tok.Source{
|
||||
`, []tok.Token{{Kind: tok.Identifier, Runes: []rune("ident"), Source: tok.Source{
|
||||
S: loc(3, 4, 10), E: loc(3, 9, 15),
|
||||
}}},
|
||||
}}}},
|
||||
} {
|
||||
got, err := lexer.Lex([]rune(test.src), filepath)
|
||||
name := fmt.Sprintf(`Lex("%v")`, test.src)
|
||||
switch {
|
||||
case err != nil:
|
||||
if err != nil {
|
||||
t.Errorf("%v returned error: %v", name, err)
|
||||
case len(got) != 1:
|
||||
t.Errorf("%v returned %d tokens: %v", name, len(got), got)
|
||||
case got[0].Kind != test.expect.Kind:
|
||||
t.Errorf(`%v returned unexpected token kind: got "%+v", expected "%+v"`, name, got[0], test.expect)
|
||||
case string(got[0].Runes) != string(test.expect.Runes):
|
||||
t.Errorf(`%v returned unexpected token runes: got "%+v", expected "%+v"`, name, string(got[0].Runes), string(test.expect.Runes))
|
||||
case got[0].Source != test.expect.Source:
|
||||
t.Errorf(`%v returned unexpected token source: got %+v, expected %+v`, name, got[0].Source, test.expect.Source)
|
||||
continue
|
||||
}
|
||||
if diff := cmp.Diff(got, test.expect); diff != "" {
|
||||
t.Errorf(`%v: %v`, name, diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package parser
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"dawn.googlesource.com/dawn/tools/src/tint/intrinsic/ast"
|
||||
"dawn.googlesource.com/dawn/tools/src/tint/intrinsic/lexer"
|
||||
|
@ -145,10 +146,26 @@ func (p *parser) attributes() ast.Attributes {
|
|||
var out ast.Attributes
|
||||
for p.match(tok.Attr) != nil && p.err == nil {
|
||||
name := p.expect(tok.Identifier, "attribute name")
|
||||
values := []string{}
|
||||
var values []any
|
||||
if p.match(tok.Lparen) != nil {
|
||||
loop:
|
||||
for p.err == nil {
|
||||
values = append(values, string(p.next().Runes))
|
||||
t := p.next()
|
||||
switch t.Kind {
|
||||
case tok.Rparen:
|
||||
break loop
|
||||
case tok.String:
|
||||
values = append(values, string(t.Runes))
|
||||
case tok.Integer:
|
||||
i, _ := strconv.ParseInt(string(t.Runes), 10, 64)
|
||||
values = append(values, int(i))
|
||||
case tok.Float:
|
||||
f, _ := strconv.ParseFloat(string(t.Runes), 64)
|
||||
values = append(values, f)
|
||||
default:
|
||||
p.err = fmt.Errorf("%v invalid attribute value kind: %v", t.Source, t.Kind)
|
||||
return nil
|
||||
}
|
||||
if p.match(tok.Comma) == nil {
|
||||
break
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ func TestParser(t *testing.T) {
|
|||
{
|
||||
Attributes: ast.Attributes{{
|
||||
Name: "attr",
|
||||
Values: []string{},
|
||||
Values: nil,
|
||||
}},
|
||||
Name: "B",
|
||||
},
|
||||
|
@ -85,7 +85,7 @@ func TestParser(t *testing.T) {
|
|||
ast.AST{
|
||||
Types: []ast.TypeDecl{{
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr", Values: []string{}},
|
||||
{Name: "attr", Values: nil},
|
||||
},
|
||||
Name: "T",
|
||||
}},
|
||||
|
@ -96,8 +96,8 @@ func TestParser(t *testing.T) {
|
|||
ast.AST{
|
||||
Types: []ast.TypeDecl{{
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr_a", Values: []string{}},
|
||||
{Name: "attr_b", Values: []string{}},
|
||||
{Name: "attr_a", Values: nil},
|
||||
{Name: "attr_b", Values: nil},
|
||||
},
|
||||
Name: "T",
|
||||
}},
|
||||
|
@ -107,17 +107,17 @@ func TestParser(t *testing.T) {
|
|||
`@attr("a", "b") type T`, ast.AST{
|
||||
Types: []ast.TypeDecl{{
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr", Values: []string{"a", "b"}},
|
||||
{Name: "attr", Values: []any{"a", "b"}},
|
||||
},
|
||||
Name: "T",
|
||||
}},
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
`@attr(1, "x") type T`, ast.AST{
|
||||
`@attr(1, "x", 2.0) type T`, ast.AST{
|
||||
Types: []ast.TypeDecl{{
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr", Values: []string{"1", "x"}},
|
||||
{Name: "attr", Values: []any{1, "x", 2.0}},
|
||||
},
|
||||
Name: "T",
|
||||
}},
|
||||
|
@ -194,7 +194,7 @@ func TestParser(t *testing.T) {
|
|||
Kind: ast.Builtin,
|
||||
Name: "F",
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr", Values: []string{}},
|
||||
{Name: "attr", Values: nil},
|
||||
},
|
||||
Parameters: ast.Parameters{},
|
||||
}},
|
||||
|
@ -318,7 +318,7 @@ func TestParser(t *testing.T) {
|
|||
Kind: ast.Operator,
|
||||
Name: "F",
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr", Values: []string{}},
|
||||
{Name: "attr", Values: nil},
|
||||
},
|
||||
Parameters: ast.Parameters{},
|
||||
}},
|
||||
|
@ -344,7 +344,7 @@ func TestParser(t *testing.T) {
|
|||
Name: "F",
|
||||
Parameters: ast.Parameters{
|
||||
{
|
||||
Attributes: ast.Attributes{{Name: "blah", Values: []string{}}},
|
||||
Attributes: ast.Attributes{{Name: "blah", Values: nil}},
|
||||
Type: ast.TemplatedName{Name: "a"}},
|
||||
},
|
||||
}},
|
||||
|
@ -456,7 +456,7 @@ func TestParser(t *testing.T) {
|
|||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr", Values: []string{}},
|
||||
{Name: "attr", Values: nil},
|
||||
},
|
||||
Parameters: ast.Parameters{},
|
||||
}},
|
||||
|
@ -580,7 +580,7 @@ func TestParser(t *testing.T) {
|
|||
Kind: ast.Converter,
|
||||
Name: "F",
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr", Values: []string{}},
|
||||
{Name: "attr", Values: nil},
|
||||
},
|
||||
Parameters: ast.Parameters{},
|
||||
}},
|
||||
|
|
|
@ -17,7 +17,6 @@ package resolver
|
|||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"dawn.googlesource.com/dawn/tools/src/container"
|
||||
"dawn.googlesource.com/dawn/tools/src/tint/intrinsic/ast"
|
||||
|
@ -184,15 +183,15 @@ func (r *resolver) ty(a ast.TypeDecl) error {
|
|||
if len(d.Values) != 1 {
|
||||
return fmt.Errorf("%v expected a single value for 'display' attribute", d.Source)
|
||||
}
|
||||
t.DisplayName = d.Values[0]
|
||||
t.DisplayName = fmt.Sprint(d.Values[0])
|
||||
}
|
||||
if d := a.Attributes.Take("precedence"); d != nil {
|
||||
if len(d.Values) != 1 {
|
||||
return fmt.Errorf("%v expected a single integer value for 'precedence' attribute", d.Source)
|
||||
}
|
||||
n, err := strconv.Atoi(d.Values[0])
|
||||
if err != nil {
|
||||
return fmt.Errorf("%v %v", d.Source, err)
|
||||
n, ok := d.Values[0].(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("%v @precedence value must be an integer", d.Source)
|
||||
}
|
||||
t.Precedence = n
|
||||
}
|
||||
|
@ -358,7 +357,11 @@ func (r *resolver) intrinsic(
|
|||
overload.ConstEvalFunction = "Conv"
|
||||
}
|
||||
case 1:
|
||||
overload.ConstEvalFunction = constEvalFn.Values[0]
|
||||
fn, ok := constEvalFn.Values[0].(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("%v optional @const value must be a string", constEvalFn.Source)
|
||||
}
|
||||
overload.ConstEvalFunction = fn
|
||||
default:
|
||||
return fmt.Errorf("%v too many values for @const attribute", constEvalFn.Source)
|
||||
}
|
||||
|
@ -405,6 +408,17 @@ func (r *resolver) intrinsic(
|
|||
if attribute := p.Attributes.Take("const"); attribute != nil {
|
||||
isConst = true
|
||||
}
|
||||
testValue := 1.0
|
||||
if attribute := p.Attributes.Take("test_value"); attribute != nil {
|
||||
switch v := attribute.Values[0].(type) {
|
||||
case int:
|
||||
testValue = float64(v)
|
||||
case float64:
|
||||
testValue = v
|
||||
default:
|
||||
return fmt.Errorf("%v @test_value must be an integer or float", p.Attributes[0].Source)
|
||||
}
|
||||
}
|
||||
if len(p.Attributes) != 0 {
|
||||
return fmt.Errorf("%v unknown attribute", p.Attributes[0].Source)
|
||||
}
|
||||
|
@ -412,6 +426,7 @@ func (r *resolver) intrinsic(
|
|||
Name: p.Name,
|
||||
Type: usage,
|
||||
IsConst: isConst,
|
||||
TestValue: testValue,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,6 +245,7 @@ type Parameter struct {
|
|||
Name string
|
||||
Type FullyQualifiedName
|
||||
IsConst bool // Did this parameter have a @const attribute?
|
||||
TestValue float64 // Value to use for end-to-end tests
|
||||
}
|
||||
|
||||
// Format implements the fmt.Formatter interface
|
||||
|
|
|
@ -26,6 +26,7 @@ const (
|
|||
InvalidToken Kind = "<invalid>"
|
||||
Identifier Kind = "ident"
|
||||
Integer Kind = "integer"
|
||||
Float Kind = "float"
|
||||
String Kind = "string"
|
||||
Match Kind = "match"
|
||||
Function Kind = "fn"
|
||||
|
|
Loading…
Reference in New Issue