writer/hlsl: Support bitcast of vectors

Add end to end tests

Fixed: tint:1026
Change-Id: I10813cbe6dc4f1bccddf9a8a29e3a249a364c051
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59663
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-07-26 15:08:28 +00:00 committed by Tint LUCI CQ
parent dcd3dcec70
commit 64dfcd2c32
91 changed files with 841 additions and 0 deletions

View File

@ -268,6 +268,10 @@ bool GeneratorImpl::EmitArrayAccessor(std::ostream& out,
bool GeneratorImpl::EmitBitcast(std::ostream& out,
ast::BitcastExpression* expr) {
auto* type = TypeOf(expr);
if (auto* vec = type->UnwrapRef()->As<sem::Vector>()) {
type = vec->type();
}
if (!type->is_integer_scalar() && !type->is_float_scalar()) {
diagnostics_.add_error(diag::System::Writer,
"Unable to do bitcast to type " + type->type_name());

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : f32 = 1.;
let b : f32 = bitcast<f32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const float b = asfloat(1.0f);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
float const a = 1.0f;
float const b = as_type<float>(a);
return;
}

View File

@ -0,0 +1,19 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 8
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%float_1 = OpConstant %float 1
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpCopyObject %float %float_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : f32 = 1.0;
let b : f32 = bitcast<f32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : f32 = 1.;
let b : i32 = bitcast<i32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const int b = asint(1.0f);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
float const a = 1.0f;
int const b = as_type<int>(a);
return;
}

View File

@ -0,0 +1,20 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%float_1 = OpConstant %float 1
%int = OpTypeInt 32 1
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpBitcast %int %float_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : f32 = 1.0;
let b : i32 = bitcast<i32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : f32 = 1.;
let b : u32 = bitcast<u32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const uint b = asuint(1.0f);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
float const a = 1.0f;
uint const b = as_type<uint>(a);
return;
}

View File

@ -0,0 +1,20 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%float_1 = OpConstant %float 1
%uint = OpTypeInt 32 0
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpBitcast %uint %float_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : f32 = 1.0;
let b : u32 = bitcast<u32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : i32 = 1;
let b : f32 = bitcast<f32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const float b = asfloat(1);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
int const a = 1;
float const b = as_type<float>(a);
return;
}

View File

@ -0,0 +1,20 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%float = OpTypeFloat 32
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpBitcast %float %int_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : i32 = 1;
let b : f32 = bitcast<f32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : i32 = 1;
let b : i32 = bitcast<i32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const int b = asint(1);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
int const a = 1;
int const b = as_type<int>(a);
return;
}

View File

@ -0,0 +1,19 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 8
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpCopyObject %int %int_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : i32 = 1;
let b : i32 = bitcast<i32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : i32 = 1;
let b : u32 = bitcast<u32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const uint b = asuint(1);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
int const a = 1;
uint const b = as_type<uint>(a);
return;
}

View File

@ -0,0 +1,20 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%uint = OpTypeInt 32 0
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpBitcast %uint %int_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : i32 = 1;
let b : u32 = bitcast<u32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : u32 = 1u;
let b : f32 = bitcast<f32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const float b = asfloat(1u);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
uint const a = 1u;
float const b = as_type<float>(a);
return;
}

View File

@ -0,0 +1,20 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%float = OpTypeFloat 32
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpBitcast %float %uint_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : u32 = 1u;
let b : f32 = bitcast<f32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : u32 = 1u;
let b : i32 = bitcast<i32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const int b = asint(1u);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
uint const a = 1u;
int const b = as_type<int>(a);
return;
}

View File

@ -0,0 +1,20 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%int = OpTypeInt 32 1
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpBitcast %int %uint_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : u32 = 1u;
let b : i32 = bitcast<i32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : u32 = 1u;
let b : u32 = bitcast<u32>(a);
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const uint b = asuint(1u);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
uint const a = 1u;
uint const b = as_type<uint>(a);
return;
}

View File

@ -0,0 +1,19 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 8
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%f = OpFunction %void None %1
%4 = OpLabel
%7 = OpCopyObject %uint %uint_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : u32 = 1u;
let b : u32 = bitcast<u32>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<f32> = vec3<f32>(1., 2., 3.);
let b : vec3<f32> = bitcast<vec3<f32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const float3 a = float3(1.0f, 2.0f, 3.0f);
const float3 b = asfloat(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
float3 const a = float3(1.0f, 2.0f, 3.0f);
float3 const b = as_type<float3>(a);
return;
}

View File

@ -0,0 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpCopyObject %v3float %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
let b : vec3<f32> = bitcast<vec3<f32>>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<f32> = vec3<f32>(1., 2., 3.);
let b : vec3<i32> = bitcast<vec3<i32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const float3 a = float3(1.0f, 2.0f, 3.0f);
const int3 b = asint(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
float3 const a = float3(1.0f, 2.0f, 3.0f);
int3 const b = as_type<int3>(a);
return;
}

View File

@ -0,0 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpBitcast %v3int %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
let b : vec3<i32> = bitcast<vec3<i32>>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<f32> = vec3<f32>(1., 2., 3.);
let b : vec3<u32> = bitcast<vec3<u32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const float3 a = float3(1.0f, 2.0f, 3.0f);
const uint3 b = asuint(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
float3 const a = float3(1.0f, 2.0f, 3.0f);
uint3 const b = as_type<uint3>(a);
return;
}

View File

@ -0,0 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpBitcast %v3uint %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
let b : vec3<u32> = bitcast<vec3<u32>>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<i32> = vec3<i32>(1, 2, 3);
let b : vec3<f32> = bitcast<vec3<f32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const int3 a = int3(1, 2, 3);
const float3 b = asfloat(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
int3 const a = int3(1, 2, 3);
float3 const b = as_type<float3>(a);
return;
}

View File

@ -0,0 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%10 = OpConstantComposite %v3int %int_1 %int_2 %int_3
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpBitcast %v3float %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<i32> = vec3<i32>(1, 2, 3);
let b : vec3<f32> = bitcast<vec3<f32>>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<i32> = vec3<i32>(1, 2, 3);
let b : vec3<i32> = bitcast<vec3<i32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = asint(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
int3 const a = int3(1, 2, 3);
int3 const b = as_type<int3>(a);
return;
}

View File

@ -0,0 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%10 = OpConstantComposite %v3int %int_1 %int_2 %int_3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpCopyObject %v3int %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<i32> = vec3<i32>(1, 2, 3);
let b : vec3<i32> = bitcast<vec3<i32>>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<i32> = vec3<i32>(1, 2, 3);
let b : vec3<u32> = bitcast<vec3<u32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const int3 a = int3(1, 2, 3);
const uint3 b = asuint(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
int3 const a = int3(1, 2, 3);
uint3 const b = as_type<uint3>(a);
return;
}

View File

@ -0,0 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%10 = OpConstantComposite %v3int %int_1 %int_2 %int_3
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpBitcast %v3uint %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<i32> = vec3<i32>(1, 2, 3);
let b : vec3<u32> = bitcast<vec3<u32>>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<u32> = vec3<u32>(1u, 2u, 3u);
let b : vec3<f32> = bitcast<vec3<f32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const float3 b = asfloat(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
uint3 const a = uint3(1u, 2u, 3u);
float3 const b = as_type<float3>(a);
return;
}

View File

@ -0,0 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpBitcast %v3float %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<u32> = vec3<u32>(1u, 2u, 3u);
let b : vec3<f32> = bitcast<vec3<f32>>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<u32> = vec3<u32>(1u, 2u, 3u);
let b : vec3<i32> = bitcast<vec3<i32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const int3 b = asint(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
uint3 const a = uint3(1u, 2u, 3u);
int3 const b = as_type<int3>(a);
return;
}

View File

@ -0,0 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpBitcast %v3int %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<u32> = vec3<u32>(1u, 2u, 3u);
let b : vec3<i32> = bitcast<vec3<i32>>(a);
}

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<u32> = vec3<u32>(1u, 2u, 3u);
let b : vec3<u32> = bitcast<vec3<u32>>(a);
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = asuint(a);
return;
}

View File

@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
uint3 const a = uint3(1u, 2u, 3u);
uint3 const b = as_type<uint3>(a);
return;
}

View File

@ -0,0 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
%f = OpFunction %void None %1
%4 = OpLabel
%11 = OpCopyObject %v3uint %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,5 @@
[[stage(compute), workgroup_size(1)]]
fn f() {
let a : vec3<u32> = vec3<u32>(1u, 2u, 3u);
let b : vec3<u32> = bitcast<vec3<u32>>(a);
}