mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 14:08:04 +00:00
e2e tests: generate missing expected files
Change-Id: I6b4aee4bb08b0f4c02c015f469edc24be1623fc3 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73340 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
667bc2d929
commit
a9d6c34d86
@@ -0,0 +1,38 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
|
||||
return lhs * vec<T, N>(rhs);
|
||||
}
|
||||
|
||||
template<typename T, int N, int M>
|
||||
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
|
||||
return vec<T, M>(lhs) * rhs;
|
||||
}
|
||||
|
||||
struct Simulation {
|
||||
/* 0x0000 */ uint i;
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ float3 arr[8];
|
||||
};
|
||||
struct Particle {
|
||||
/* 0x0000 */ tint_array_wrapper position;
|
||||
/* 0x0080 */ float lifetime;
|
||||
/* 0x0084 */ int8_t tint_pad[12];
|
||||
/* 0x0090 */ float4 color;
|
||||
/* 0x00a0 */ packed_float3 velocity;
|
||||
/* 0x00ac */ int8_t tint_pad_1[4];
|
||||
};
|
||||
struct Particles {
|
||||
/* 0x0000 */ Particle p[1];
|
||||
};
|
||||
|
||||
kernel void tint_symbol(const device Particles* tint_symbol_1 [[buffer(1)]], const constant Simulation* tint_symbol_2 [[buffer(0)]]) {
|
||||
Particle particle = (*(tint_symbol_1)).p[0];
|
||||
particle.position.arr[(*(tint_symbol_2)).i] = particle.position.arr[(*(tint_symbol_2)).i];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 37
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %Particles "Particles"
|
||||
OpMemberName %Particles 0 "p"
|
||||
OpName %Particle "Particle"
|
||||
OpMemberName %Particle 0 "position"
|
||||
OpMemberName %Particle 1 "lifetime"
|
||||
OpMemberName %Particle 2 "color"
|
||||
OpMemberName %Particle 3 "velocity"
|
||||
OpName %particles "particles"
|
||||
OpName %Simulation "Simulation"
|
||||
OpMemberName %Simulation 0 "i"
|
||||
OpName %sim "sim"
|
||||
OpName %main "main"
|
||||
OpName %particle "particle"
|
||||
OpDecorate %Particles Block
|
||||
OpMemberDecorate %Particles 0 Offset 0
|
||||
OpMemberDecorate %Particle 0 Offset 0
|
||||
OpDecorate %_arr_v3float_uint_8 ArrayStride 16
|
||||
OpMemberDecorate %Particle 1 Offset 128
|
||||
OpMemberDecorate %Particle 2 Offset 144
|
||||
OpMemberDecorate %Particle 3 Offset 160
|
||||
OpDecorate %_runtimearr_Particle ArrayStride 176
|
||||
OpDecorate %particles NonWritable
|
||||
OpDecorate %particles DescriptorSet 1
|
||||
OpDecorate %particles Binding 3
|
||||
OpDecorate %Simulation Block
|
||||
OpMemberDecorate %Simulation 0 Offset 0
|
||||
OpDecorate %sim NonWritable
|
||||
OpDecorate %sim DescriptorSet 1
|
||||
OpDecorate %sim Binding 4
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_8 = OpConstant %uint 8
|
||||
%_arr_v3float_uint_8 = OpTypeArray %v3float %uint_8
|
||||
%v4float = OpTypeVector %float 4
|
||||
%Particle = OpTypeStruct %_arr_v3float_uint_8 %float %v4float %v3float
|
||||
%_runtimearr_Particle = OpTypeRuntimeArray %Particle
|
||||
%Particles = OpTypeStruct %_runtimearr_Particle
|
||||
%_ptr_StorageBuffer_Particles = OpTypePointer StorageBuffer %Particles
|
||||
%particles = OpVariable %_ptr_StorageBuffer_Particles StorageBuffer
|
||||
%Simulation = OpTypeStruct %uint
|
||||
%_ptr_Uniform_Simulation = OpTypePointer Uniform %Simulation
|
||||
%sim = OpVariable %_ptr_Uniform_Simulation Uniform
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_StorageBuffer_Particle = OpTypePointer StorageBuffer %Particle
|
||||
%_ptr_Function_Particle = OpTypePointer Function %Particle
|
||||
%27 = OpConstantNull %Particle
|
||||
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%main = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%particle = OpVariable %_ptr_Function_Particle Function %27
|
||||
%23 = OpAccessChain %_ptr_StorageBuffer_Particle %particles %uint_0 %int_0
|
||||
%24 = OpLoad %Particle %23
|
||||
OpStore %particle %24
|
||||
%29 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0
|
||||
%30 = OpLoad %uint %29
|
||||
%32 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %30
|
||||
%33 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0
|
||||
%34 = OpLoad %uint %33
|
||||
%35 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %34
|
||||
%36 = OpLoad %v3float %35
|
||||
OpStore %32 %36
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,24 @@
|
||||
struct Simulation {
|
||||
i : u32;
|
||||
};
|
||||
|
||||
struct Particle {
|
||||
position : array<vec3<f32>, 8>;
|
||||
lifetime : f32;
|
||||
color : vec4<f32>;
|
||||
velocity : vec3<f32>;
|
||||
};
|
||||
|
||||
struct Particles {
|
||||
p : array<Particle>;
|
||||
};
|
||||
|
||||
[[group(1), binding(3)]] var<storage, read> particles : Particles;
|
||||
|
||||
[[group(1), binding(4)]] var<uniform> sim : Simulation;
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
var particle = particles.p[0];
|
||||
particle.position[sim.i] = particle.position[sim.i];
|
||||
}
|
||||
Reference in New Issue
Block a user