writers: Use the new sem::Module::DependencyOrderedDeclarations

As the resolver currently enforces in-order declarations, this does not
change the declaration order from iterating over the
ast::Module::GlobalDeclarations.

The MSL backend has been changed to use the
sem::Module::DependencyOrderedDeclarations list instead of looping over
different declaration types separately.

Bug: tint:1266
Change-Id: I698d612032285311017bfceab3c42adae1928a0e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79767
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2022-02-09 23:55:51 +00:00
parent a52be6c9ec
commit 8ec32a6ec9
841 changed files with 3258 additions and 2784 deletions

View File

@@ -6,31 +6,10 @@ struct tint_symbol_1 {
float2 a_particleVel [[attribute(1)]];
float2 a_pos [[attribute(2)]];
};
struct tint_symbol_2 {
float4 value [[position]];
};
struct tint_symbol_3 {
float4 value [[color(0)]];
};
struct Particle {
/* 0x0000 */ float2 pos;
/* 0x0008 */ float2 vel;
};
struct SimParams {
/* 0x0000 */ float deltaT;
/* 0x0004 */ float rule1Distance;
/* 0x0008 */ float rule2Distance;
/* 0x000c */ float rule3Distance;
/* 0x0010 */ float rule1Scale;
/* 0x0014 */ float rule2Scale;
/* 0x0018 */ float rule3Scale;
};
struct tint_array_wrapper {
/* 0x0000 */ Particle arr[5];
};
struct Particles {
/* 0x0000 */ tint_array_wrapper particles;
};
float4 vert_main_inner(float2 a_particlePos, float2 a_particleVel, float2 a_pos) {
float angle = -(atan2(a_particleVel[0], a_particleVel[1]));
@@ -45,6 +24,10 @@ vertex tint_symbol_2 vert_main(tint_symbol_1 tint_symbol [[stage_in]]) {
return wrapper_result;
}
struct tint_symbol_3 {
float4 value [[color(0)]];
};
float4 frag_main_inner() {
return float4(1.0f, 1.0f, 1.0f, 1.0f);
}
@@ -56,6 +39,29 @@ fragment tint_symbol_3 frag_main() {
return wrapper_result_1;
}
struct Particle {
/* 0x0000 */ float2 pos;
/* 0x0008 */ float2 vel;
};
struct SimParams {
/* 0x0000 */ float deltaT;
/* 0x0004 */ float rule1Distance;
/* 0x0008 */ float rule2Distance;
/* 0x000c */ float rule3Distance;
/* 0x0010 */ float rule1Scale;
/* 0x0014 */ float rule2Scale;
/* 0x0018 */ float rule3Scale;
};
struct tint_array_wrapper {
/* 0x0000 */ Particle arr[5];
};
struct Particles {
/* 0x0000 */ tint_array_wrapper particles;
};
void comp_main_inner(uint3 gl_GlobalInvocationID, device Particles* const tint_symbol_4, const constant SimParams* const tint_symbol_5, device Particles* const tint_symbol_6) {
uint index = gl_GlobalInvocationID[0];
if ((index >= 5u)) {

View File

@@ -4,28 +4,26 @@ using namespace metal;
struct Uniforms {
/* 0x0000 */ float4x4 modelViewProjectionMatrix;
};
struct VertexInput {
float4 cur_position;
float4 color;
};
struct VertexOutput {
float4 vtxFragColor;
float4 Position;
};
struct tint_symbol_1 {
float4 cur_position [[attribute(0)]];
float4 color [[attribute(1)]];
};
struct tint_symbol_2 {
float4 vtxFragColor [[user(locn0)]];
float4 Position [[position]];
};
struct tint_symbol_4 {
float4 fragColor [[user(locn0)]];
};
struct tint_symbol_5 {
float4 value [[color(0)]];
};
VertexOutput vtx_main_inner(VertexInput input, const constant Uniforms* const tint_symbol_7) {
VertexOutput output = {};
@@ -43,6 +41,14 @@ vertex tint_symbol_2 vtx_main(const constant Uniforms* tint_symbol_8 [[buffer(0)
return wrapper_result;
}
struct tint_symbol_4 {
float4 fragColor [[user(locn0)]];
};
struct tint_symbol_5 {
float4 value [[color(0)]];
};
float4 frag_main_inner(float4 fragColor) {
return fragColor;
}

View File

@@ -1,13 +1,13 @@
#include <metal_stdlib>
using namespace metal;
void bar() {
}
struct tint_symbol_1 {
float4 value [[color(0)]];
};
void bar() {
}
float4 tint_symbol_inner() {
float2 a = float2();
bar();

View File

@@ -1,18 +1,19 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 gl_Position;
};
struct tint_symbol_1 {
float4 gl_Position [[position]];
};
void main_1(thread float4* const tint_symbol_3) {
*(tint_symbol_3) = float4(0.0f, 0.0f, 0.0f, 0.0f);
return;
}
struct main_out {
float4 gl_Position;
};
struct tint_symbol_1 {
float4 gl_Position [[position]];
};
main_out tint_symbol_inner(thread float4* const tint_symbol_4) {
main_1(tint_symbol_4);
main_out const tint_symbol_2 = {.gl_Position=*(tint_symbol_4)};

View File

@@ -4,14 +4,13 @@ using namespace metal;
struct tint_array_wrapper {
float2 arr[3];
};
constant tint_array_wrapper pos = {.arr={float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)}};
struct tint_symbol {
float4 value [[position]];
};
struct tint_symbol_1 {
float4 value [[color(0)]];
};
constant tint_array_wrapper pos = {.arr={float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)}};
float4 vtx_main_inner(uint VertexIndex) {
return float4(pos.arr[VertexIndex], 0.0f, 1.0f);
}
@@ -23,6 +22,10 @@ vertex tint_symbol vtx_main(uint VertexIndex [[vertex_id]]) {
return wrapper_result;
}
struct tint_symbol_1 {
float4 value [[color(0)]];
};
float4 frag_main_inner() {
return float4(1.0f, 0.0f, 0.0f, 1.0f);
}