mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-03 10:45:36 +00:00
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>
77 lines
2.4 KiB
Plaintext
77 lines
2.4 KiB
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
struct ssbOut {
|
|
/* 0x0000 */ float result[1];
|
|
};
|
|
|
|
struct ssbA {
|
|
/* 0x0000 */ float A[1];
|
|
};
|
|
|
|
struct Uniforms {
|
|
/* 0x0000 */ float tint_symbol;
|
|
/* 0x0004 */ int aShape;
|
|
/* 0x0008 */ int outShape;
|
|
/* 0x000c */ int outShapeStrides;
|
|
/* 0x0010 */ int size;
|
|
};
|
|
|
|
float getAAtOutCoords_(thread uint3* const tint_symbol_2, const device ssbA* const tint_symbol_3) {
|
|
uint const x_42 = (*(tint_symbol_2))[0];
|
|
float const x_44 = (*(tint_symbol_3)).A[x_42];
|
|
return x_44;
|
|
}
|
|
|
|
float unaryOperation_f1_(thread float* const a) {
|
|
float const x_47 = *(a);
|
|
if ((x_47 < 0.0f)) {
|
|
return INFINITY;
|
|
}
|
|
float const x_55 = *(a);
|
|
return log(x_55);
|
|
}
|
|
|
|
void setOutput_i1_f1_(thread int* const flatIndex, thread float* const value, device ssbOut* const tint_symbol_4) {
|
|
int const x_27 = *(flatIndex);
|
|
float const x_28 = *(value);
|
|
(*(tint_symbol_4)).result[x_27] = x_28;
|
|
return;
|
|
}
|
|
|
|
void main_1(thread uint3* const tint_symbol_5, const constant Uniforms* const tint_symbol_6, const device ssbA* const tint_symbol_7, device ssbOut* const tint_symbol_8) {
|
|
int index = 0;
|
|
float a_1 = 0.0f;
|
|
float param = 0.0f;
|
|
int param_1 = 0;
|
|
float param_2 = 0.0f;
|
|
uint const x_61 = (*(tint_symbol_5))[0];
|
|
index = as_type<int>(x_61);
|
|
int const x_63 = index;
|
|
int const x_70 = (*(tint_symbol_6)).size;
|
|
if ((x_63 < x_70)) {
|
|
float const x_75 = getAAtOutCoords_(tint_symbol_5, tint_symbol_7);
|
|
a_1 = x_75;
|
|
float const x_77 = a_1;
|
|
param = x_77;
|
|
float const x_78 = unaryOperation_f1_(&(param));
|
|
int const x_80 = index;
|
|
param_1 = x_80;
|
|
param_2 = x_78;
|
|
setOutput_i1_f1_(&(param_1), &(param_2), tint_symbol_8);
|
|
}
|
|
return;
|
|
}
|
|
|
|
void tint_symbol_1_inner(uint3 gl_GlobalInvocationID_param, thread uint3* const tint_symbol_9, const constant Uniforms* const tint_symbol_10, const device ssbA* const tint_symbol_11, device ssbOut* const tint_symbol_12) {
|
|
*(tint_symbol_9) = gl_GlobalInvocationID_param;
|
|
main_1(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12);
|
|
}
|
|
|
|
kernel void tint_symbol_1(const constant Uniforms* tint_symbol_14 [[buffer(0)]], const device ssbA* tint_symbol_15 [[buffer(2)]], device ssbOut* tint_symbol_16 [[buffer(1)]], uint3 gl_GlobalInvocationID_param [[thread_position_in_grid]]) {
|
|
thread uint3 tint_symbol_13 = 0u;
|
|
tint_symbol_1_inner(gl_GlobalInvocationID_param, &(tint_symbol_13), tint_symbol_14, tint_symbol_15, tint_symbol_16);
|
|
return;
|
|
}
|
|
|