mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 05:27:49 +00:00
spirv-reader: Polyfill GLSLStd450 Degrees and Radians
Fixed: tint:1044 Change-Id: I5b2f3820b35c47bdc589ef41fb7a8735a7c6dff1 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59660 Auto-Submit: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
13081d4e46
commit
b32c22cead
29
test/intrinsics/degrees.spvasm
Normal file
29
test/intrinsics/degrees.spvasm
Normal file
@@ -0,0 +1,29 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 13
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 460
|
||||
OpName %main "main"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%float_42 = OpConstant %float 42
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%a = OpVariable %_ptr_Function_float Function
|
||||
%b = OpVariable %_ptr_Function_float Function
|
||||
OpStore %a %float_42
|
||||
%11 = OpLoad %float %a
|
||||
%12 = OpExtInst %float %1 Degrees %11
|
||||
OpStore %b %12
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
13
test/intrinsics/degrees.spvasm.expected.hlsl
Normal file
13
test/intrinsics/degrees.spvasm.expected.hlsl
Normal file
@@ -0,0 +1,13 @@
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
b = (a * 57.295780182f);
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
17
test/intrinsics/degrees.spvasm.expected.msl
Normal file
17
test/intrinsics/degrees.spvasm.expected.msl
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
float const x_11 = a;
|
||||
b = (x_11 * 57.295780182f);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void tint_symbol() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
35
test/intrinsics/degrees.spvasm.expected.spvasm
Normal file
35
test/intrinsics/degrees.spvasm.expected.spvasm
Normal file
@@ -0,0 +1,35 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 17
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main_1 "main_1"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%8 = OpConstantNull %float
|
||||
%float_42 = OpConstant %float 42
|
||||
%float_57_2957802 = OpConstant %float 57.2957802
|
||||
%main_1 = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%a = OpVariable %_ptr_Function_float Function %8
|
||||
%b = OpVariable %_ptr_Function_float Function %8
|
||||
OpStore %a %float_42
|
||||
%11 = OpLoad %float %a
|
||||
%13 = OpFMul %float %11 %float_57_2957802
|
||||
OpStore %b %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %1
|
||||
%15 = OpLabel
|
||||
%16 = OpFunctionCall %void %main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
13
test/intrinsics/degrees.spvasm.expected.wgsl
Normal file
13
test/intrinsics/degrees.spvasm.expected.wgsl
Normal file
@@ -0,0 +1,13 @@
|
||||
fn main_1() {
|
||||
var a : f32;
|
||||
var b : f32;
|
||||
a = 42.0;
|
||||
let x_11 : f32 = a;
|
||||
b = (x_11 * 57.295780182);
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1, 1, 1)]]
|
||||
fn main() {
|
||||
main_1();
|
||||
}
|
||||
29
test/intrinsics/radians.spvasm
Normal file
29
test/intrinsics/radians.spvasm
Normal file
@@ -0,0 +1,29 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 10
|
||||
; Bound: 13
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpSource GLSL 460
|
||||
OpName %main "main"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%float_42 = OpConstant %float 42
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%a = OpVariable %_ptr_Function_float Function
|
||||
%b = OpVariable %_ptr_Function_float Function
|
||||
OpStore %a %float_42
|
||||
%11 = OpLoad %float %a
|
||||
%12 = OpExtInst %float %1 Radians %11
|
||||
OpStore %b %12
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
13
test/intrinsics/radians.spvasm.expected.hlsl
Normal file
13
test/intrinsics/radians.spvasm.expected.hlsl
Normal file
@@ -0,0 +1,13 @@
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
b = (a * 0.017453292f);
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
17
test/intrinsics/radians.spvasm.expected.msl
Normal file
17
test/intrinsics/radians.spvasm.expected.msl
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void main_1() {
|
||||
float a = 0.0f;
|
||||
float b = 0.0f;
|
||||
a = 42.0f;
|
||||
float const x_11 = a;
|
||||
b = (x_11 * 0.017453292f);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void tint_symbol() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
35
test/intrinsics/radians.spvasm.expected.spvasm
Normal file
35
test/intrinsics/radians.spvasm.expected.spvasm
Normal file
@@ -0,0 +1,35 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 17
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main_1 "main_1"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%8 = OpConstantNull %float
|
||||
%float_42 = OpConstant %float 42
|
||||
%float_0_0174532924 = OpConstant %float 0.0174532924
|
||||
%main_1 = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%a = OpVariable %_ptr_Function_float Function %8
|
||||
%b = OpVariable %_ptr_Function_float Function %8
|
||||
OpStore %a %float_42
|
||||
%11 = OpLoad %float %a
|
||||
%13 = OpFMul %float %11 %float_0_0174532924
|
||||
OpStore %b %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %1
|
||||
%15 = OpLabel
|
||||
%16 = OpFunctionCall %void %main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
13
test/intrinsics/radians.spvasm.expected.wgsl
Normal file
13
test/intrinsics/radians.spvasm.expected.wgsl
Normal file
@@ -0,0 +1,13 @@
|
||||
fn main_1() {
|
||||
var a : f32;
|
||||
var b : f32;
|
||||
a = 42.0;
|
||||
let x_11 : f32 = a;
|
||||
b = (x_11 * 0.017453292);
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1, 1, 1)]]
|
||||
fn main() {
|
||||
main_1();
|
||||
}
|
||||
Reference in New Issue
Block a user