tint/transform: Fix ICE when combining polyfills

There's a reason the overload of `ctx.Replace()` that takes a pointer to the replacement is deprecated - it doesn't play well when used as part of another replacement.
Switch to using the callback overload of Replace() to fix bad transform output.

Bug: tint:1386647
Change-Id: I94292eeb65d24d7b2446b16b8b4ad13bdd27965a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111000
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2022-11-21 17:11:05 +00:00 committed by Dawn LUCI CQ
parent f5eec817de
commit 619f9bd639
69 changed files with 941 additions and 756 deletions

View File

@ -41,6 +41,10 @@ struct BuiltinPolyfill::State {
/// @param p the builtins to polyfill /// @param p the builtins to polyfill
State(CloneContext& c, Builtins p) : ctx(c), polyfill(p) {} State(CloneContext& c, Builtins p) : ctx(c), polyfill(p) {}
////////////////////////////////////////////////////////////////////////////
// Function polyfills
////////////////////////////////////////////////////////////////////////////
/// Builds the polyfill function for the `acosh` builtin /// Builds the polyfill function for the `acosh` builtin
/// @param ty the parameter and return type for the function /// @param ty the parameter and return type for the function
/// @return the polyfill function name /// @return the polyfill function name
@ -559,63 +563,6 @@ struct BuiltinPolyfill::State {
return name; return name;
} }
/// Builds the polyfill function for a divide or modulo operator with integer scalar or vector
/// operands.
/// @param sig the signature of the binary operator
/// @return the polyfill function name
Symbol int_div_mod(const BinaryOpSignature& sig) {
const auto op = std::get<0>(sig);
const auto* lhs_ty = std::get<1>(sig);
const auto* rhs_ty = std::get<2>(sig);
const bool is_div = op == ast::BinaryOp::kDivide;
uint32_t lhs_width = 1;
uint32_t rhs_width = 1;
const auto* lhs_el_ty = sem::Type::ElementOf(lhs_ty, &lhs_width);
const auto* rhs_el_ty = sem::Type::ElementOf(rhs_ty, &rhs_width);
const uint32_t width = std::max(lhs_width, rhs_width);
const char* lhs = "lhs";
const char* rhs = "rhs";
utils::Vector<const ast::Statement*, 4> body;
if (lhs_width < width) {
// lhs is scalar, rhs is vector. Convert lhs to vector.
body.Push(b.Decl(b.Let("l", b.vec(T(lhs_el_ty), width, b.Expr(lhs)))));
lhs = "l";
}
if (rhs_width < width) {
// lhs is vector, rhs is scalar. Convert rhs to vector.
body.Push(b.Decl(b.Let("r", b.vec(T(rhs_el_ty), width, b.Expr(rhs)))));
rhs = "r";
}
auto name = b.Symbols().New(is_div ? "tint_div" : "tint_mod");
auto* use_one = b.Equal(rhs, ScalarOrVector(width, 0_a));
if (lhs_ty->is_signed_scalar_or_vector()) {
const auto bits = lhs_el_ty->Size() * 8;
auto min_int = AInt(AInt::kLowestValue >> (AInt::kNumBits - bits));
const ast::Expression* lhs_is_min = b.Equal(lhs, ScalarOrVector(width, min_int));
const ast::Expression* rhs_is_minus_one = b.Equal(rhs, ScalarOrVector(width, -1_a));
// use_one = use_one | ((lhs == MIN_INT) & (rhs == -1))
use_one = b.Or(use_one, b.And(lhs_is_min, rhs_is_minus_one));
}
auto* select = b.Call("select", rhs, ScalarOrVector(width, 1_a), use_one);
body.Push(b.Return(is_div ? b.Div(lhs, select) : b.Mod(lhs, select)));
b.Func(name,
utils::Vector{
b.Param("lhs", T(lhs_ty)),
b.Param("rhs", T(rhs_ty)),
},
width == 1 ? T(lhs_ty) : b.ty.vec(T(lhs_el_ty), width), // return type
std::move(body));
return name;
}
/// Builds the polyfill function for the `saturate` builtin /// Builds the polyfill function for the `saturate` builtin
/// @param ty the parameter and return type for the function /// @param ty the parameter and return type for the function
/// @return the polyfill function name /// @return the polyfill function name
@ -677,6 +624,89 @@ struct BuiltinPolyfill::State {
return name; return name;
} }
////////////////////////////////////////////////////////////////////////////
// Inline polyfills
////////////////////////////////////////////////////////////////////////////
/// Builds the polyfill inline expression for a bitshift left or bitshift right, ensuring that
/// the RHS is modulo the bit-width of the LHS.
/// @param bin_op the original BinaryExpression
/// @return the polyfill value for bitshift operation
const ast::Expression* BitshiftModulo(const ast::BinaryExpression* bin_op) {
auto* lhs_ty = ctx.src->TypeOf(bin_op->lhs)->UnwrapRef();
auto* rhs_ty = ctx.src->TypeOf(bin_op->rhs)->UnwrapRef();
auto* lhs_el_ty = sem::Type::DeepestElementOf(lhs_ty);
const ast::Expression* mask = b.Expr(AInt(lhs_el_ty->Size() * 8 - 1));
if (rhs_ty->Is<sem::Vector>()) {
mask = b.Construct(CreateASTTypeFor(ctx, rhs_ty), mask);
}
auto* lhs = ctx.Clone(bin_op->lhs);
auto* rhs = b.And(ctx.Clone(bin_op->rhs), mask);
return b.create<ast::BinaryExpression>(ctx.Clone(bin_op->source), bin_op->op, lhs, rhs);
}
/// Builds the polyfill inline expression for a integer divide or modulo, preventing DBZs and
/// integer overflows.
/// @param bin_op the original BinaryExpression
/// @return the polyfill divide or modulo
const ast::Expression* IntDivMod(const ast::BinaryExpression* bin_op) {
auto* lhs_ty = ctx.src->TypeOf(bin_op->lhs)->UnwrapRef();
auto* rhs_ty = ctx.src->TypeOf(bin_op->rhs)->UnwrapRef();
BinaryOpSignature sig{bin_op->op, lhs_ty, rhs_ty};
auto fn = binary_op_polyfills.GetOrCreate(sig, [&] {
const bool is_div = bin_op->op == ast::BinaryOp::kDivide;
uint32_t lhs_width = 1;
uint32_t rhs_width = 1;
const auto* lhs_el_ty = sem::Type::ElementOf(lhs_ty, &lhs_width);
const auto* rhs_el_ty = sem::Type::ElementOf(rhs_ty, &rhs_width);
const uint32_t width = std::max(lhs_width, rhs_width);
const char* lhs = "lhs";
const char* rhs = "rhs";
utils::Vector<const ast::Statement*, 4> body;
if (lhs_width < width) {
// lhs is scalar, rhs is vector. Convert lhs to vector.
body.Push(b.Decl(b.Let("l", b.vec(T(lhs_el_ty), width, b.Expr(lhs)))));
lhs = "l";
}
if (rhs_width < width) {
// lhs is vector, rhs is scalar. Convert rhs to vector.
body.Push(b.Decl(b.Let("r", b.vec(T(rhs_el_ty), width, b.Expr(rhs)))));
rhs = "r";
}
auto name = b.Symbols().New(is_div ? "tint_div" : "tint_mod");
auto* use_one = b.Equal(rhs, ScalarOrVector(width, 0_a));
if (lhs_ty->is_signed_scalar_or_vector()) {
const auto bits = lhs_el_ty->Size() * 8;
auto min_int = AInt(AInt::kLowestValue >> (AInt::kNumBits - bits));
const ast::Expression* lhs_is_min = b.Equal(lhs, ScalarOrVector(width, min_int));
const ast::Expression* rhs_is_minus_one = b.Equal(rhs, ScalarOrVector(width, -1_a));
// use_one = use_one | ((lhs == MIN_INT) & (rhs == -1))
use_one = b.Or(use_one, b.And(lhs_is_min, rhs_is_minus_one));
}
auto* select = b.Call("select", rhs, ScalarOrVector(width, 1_a), use_one);
body.Push(b.Return(is_div ? b.Div(lhs, select) : b.Mod(lhs, select)));
b.Func(name,
utils::Vector{
b.Param("lhs", T(lhs_ty)),
b.Param("rhs", T(rhs_ty)),
},
width == 1 ? T(lhs_ty) : b.ty.vec(T(lhs_el_ty), width), // return type
std::move(body));
return name;
});
auto* lhs = ctx.Clone(bin_op->lhs);
auto* rhs = ctx.Clone(bin_op->rhs);
return b.Call(fn, lhs, rhs);
}
private: private:
/// The clone context /// The clone context
CloneContext& ctx; CloneContext& ctx;
@ -687,6 +717,9 @@ struct BuiltinPolyfill::State {
/// The source clone context /// The source clone context
const sem::Info& sem = ctx.src->Sem(); const sem::Info& sem = ctx.src->Sem();
// Polyfill functions for binary operators.
utils::Hashmap<BinaryOpSignature, Symbol, 8> binary_op_polyfills;
/// @returns the AST type for the given sem type /// @returns the AST type for the given sem type
const ast::Type* T(const sem::Type* ty) const { return CreateASTTypeFor(ctx, ty); } const ast::Type* T(const sem::Type* ty) const { return CreateASTTypeFor(ctx, ty); }
@ -724,7 +757,6 @@ Transform::ApplyResult BuiltinPolyfill::Apply(const Program* src,
auto& polyfill = cfg->builtins; auto& polyfill = cfg->builtins;
utils::Hashmap<const sem::Builtin*, Symbol, 8> builtin_polyfills; utils::Hashmap<const sem::Builtin*, Symbol, 8> builtin_polyfills;
utils::Hashmap<BinaryOpSignature, Symbol, 8> binary_op_polyfills;
ProgramBuilder b; ProgramBuilder b;
CloneContext ctx{&b, src, /* auto_clone_symbols */ true}; CloneContext ctx{&b, src, /* auto_clone_symbols */ true};
@ -849,15 +881,7 @@ Transform::ApplyResult BuiltinPolyfill::Apply(const Program* src,
case ast::BinaryOp::kShiftLeft: case ast::BinaryOp::kShiftLeft:
case ast::BinaryOp::kShiftRight: { case ast::BinaryOp::kShiftRight: {
if (polyfill.bitshift_modulo) { if (polyfill.bitshift_modulo) {
auto* lhs_ty = src->TypeOf(bin_op->lhs)->UnwrapRef(); ctx.Replace(bin_op, [bin_op, &s] { return s.BitshiftModulo(bin_op); });
auto* rhs_ty = src->TypeOf(bin_op->rhs)->UnwrapRef();
auto* lhs_el_ty = sem::Type::DeepestElementOf(lhs_ty);
const ast::Expression* mask = b.Expr(AInt(lhs_el_ty->Size() * 8 - 1));
if (rhs_ty->Is<sem::Vector>()) {
mask = b.Construct(CreateASTTypeFor(ctx, rhs_ty), mask);
}
auto* mod = b.And(ctx.Clone(bin_op->rhs), mask);
ctx.Replace(bin_op->rhs, mod);
made_changes = true; made_changes = true;
} }
break; break;
@ -867,13 +891,7 @@ Transform::ApplyResult BuiltinPolyfill::Apply(const Program* src,
if (polyfill.int_div_mod) { if (polyfill.int_div_mod) {
auto* lhs_ty = src->TypeOf(bin_op->lhs)->UnwrapRef(); auto* lhs_ty = src->TypeOf(bin_op->lhs)->UnwrapRef();
if (lhs_ty->is_integer_scalar_or_vector()) { if (lhs_ty->is_integer_scalar_or_vector()) {
auto* rhs_ty = src->TypeOf(bin_op->rhs)->UnwrapRef(); ctx.Replace(bin_op, [bin_op, &s] { return s.IntDivMod(bin_op); });
BinaryOpSignature sig{bin_op->op, lhs_ty, rhs_ty};
auto fn = binary_op_polyfills.GetOrCreate(
sig, [&] { return s.int_div_mod(sig); });
auto* lhs = ctx.Clone(bin_op->lhs);
auto* rhs = ctx.Clone(bin_op->rhs);
ctx.Replace(bin_op, b.Call(fn, lhs, rhs));
made_changes = true; made_changes = true;
} }
} }

View File

@ -3000,5 +3000,37 @@ fn f() {
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
////////////////////////////////////////////////////////////////////////////////
// Polyfill combinations
////////////////////////////////////////////////////////////////////////////////
TEST_F(BuiltinPolyfillTest, BitshiftAndModulo) {
auto* src = R"(
fn f(x : i32, y : u32, z : u32) {
let l = x << (y % z);
}
)";
auto* expect = R"(
fn tint_mod(lhs : u32, rhs : u32) -> u32 {
return (lhs % select(rhs, 1, (rhs == 0)));
}
fn f(x : i32, y : u32, z : u32) {
let l = (x << (tint_mod(y, z) & 31));
}
)";
BuiltinPolyfill::Builtins builtins;
builtins.bitshift_modulo = true;
builtins.int_div_mod = true;
DataMap data;
data.Add<BuiltinPolyfill::Config>(builtins);
auto got = Run<BuiltinPolyfill>(src, std::move(data));
EXPECT_EQ(expect, str(got));
}
} // namespace } // namespace
} // namespace tint::transform } // namespace tint::transform

View File

@ -1,11 +1,3 @@
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
void marg8uintin() { void marg8uintin() {
} }
@ -35,6 +27,14 @@ uint toIndex1D(uint gridSize, float3 voxelPos) {
return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z));
} }
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
uint3 toIndex4D(uint gridSize, uint index) { uint3 toIndex4D(uint gridSize, uint index) {
uint z_1 = tint_div(gridSize, (index * index)); uint z_1 = tint_div(gridSize, (index * index));
uint y_1 = tint_div((gridSize - ((gridSize * gridSize) * z_1)), gridSize); uint y_1 = tint_div((gridSize - ((gridSize * gridSize) * z_1)), gridSize);

View File

@ -1,11 +1,3 @@
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
void marg8uintin() { void marg8uintin() {
} }
@ -35,6 +27,14 @@ uint toIndex1D(uint gridSize, float3 voxelPos) {
return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z));
} }
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
uint3 toIndex4D(uint gridSize, uint index) { uint3 toIndex4D(uint gridSize, uint index) {
uint z_1 = tint_div(gridSize, (index * index)); uint z_1 = tint_div(gridSize, (index * index));
uint y_1 = tint_div((gridSize - ((gridSize * gridSize) * z_1)), gridSize); uint y_1 = tint_div((gridSize - ((gridSize * gridSize) * z_1)), gridSize);

View File

@ -14,14 +14,6 @@ struct tint_array {
T elements[N]; T elements[N];
}; };
uint tint_div(uint lhs, uint rhs) {
return (lhs / select(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % select(rhs, 1u, (rhs == 0u)));
}
void marg8uintin() { void marg8uintin() {
} }
@ -88,6 +80,14 @@ uint toIndex1D(uint gridSize, float3 voxelPos) {
return ((icoord[0] + (gridSize * icoord[1])) + ((gridSize * gridSize) * icoord[2])); return ((icoord[0] + (gridSize * icoord[1])) + ((gridSize * gridSize) * icoord[2]));
} }
uint tint_div(uint lhs, uint rhs) {
return (lhs / select(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % select(rhs, 1u, (rhs == 0u)));
}
uint3 toIndex4D(uint gridSize, uint index) { uint3 toIndex4D(uint gridSize, uint index) {
uint z_1 = tint_div(gridSize, (index * index)); uint z_1 = tint_div(gridSize, (index * index));
uint y_1 = tint_div((gridSize - ((gridSize * gridSize) * z_1)), gridSize); uint y_1 = tint_div((gridSize - ((gridSize * gridSize) * z_1)), gridSize);

View File

@ -4,7 +4,7 @@
; Bound: 290 ; Bound: 290
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%86 = OpExtInstImport "GLSL.std.450" %69 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1 OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1
OpExecutionMode %main_count LocalSize 128 1 1 OpExecutionMode %main_count LocalSize 128 1 1
@ -47,12 +47,6 @@
OpMemberName %Dbg 10 "value_f32_2" OpMemberName %Dbg 10 "value_f32_2"
OpMemberName %Dbg 11 "value_f32_3" OpMemberName %Dbg 11 "value_f32_3"
OpName %dbg "dbg" OpName %dbg "dbg"
OpName %tint_div "tint_div"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %tint_mod "tint_mod"
OpName %lhs_0 "lhs"
OpName %rhs_0 "rhs"
OpName %marg8uintin "marg8uintin" OpName %marg8uintin "marg8uintin"
OpName %toVoxelPos "toVoxelPos" OpName %toVoxelPos "toVoxelPos"
OpName %position "position" OpName %position "position"
@ -68,6 +62,12 @@
OpName %gridSize_0 "gridSize" OpName %gridSize_0 "gridSize"
OpName %voxelPos "voxelPos" OpName %voxelPos "voxelPos"
OpName %icoord "icoord" OpName %icoord "icoord"
OpName %tint_div "tint_div"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %tint_mod "tint_mod"
OpName %lhs_0 "lhs"
OpName %rhs_0 "rhs"
OpName %toIndex4D "toIndex4D" OpName %toIndex4D "toIndex4D"
OpName %gridSize_1 "gridSize" OpName %gridSize_1 "gridSize"
OpName %index "index" OpName %index "index"
@ -177,27 +177,27 @@
%dbg_block = OpTypeStruct %Dbg %dbg_block = OpTypeStruct %Dbg
%_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block %_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block
%dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer %dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer
%32 = OpTypeFunction %uint %uint %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid %void = OpTypeVoid
%50 = OpTypeFunction %void %32 = OpTypeFunction %void
%54 = OpTypeFunction %v3float %v3float %36 = OpTypeFunction %v3float %v3float
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%71 = OpConstantNull %v3float %54 = OpConstantNull %v3float
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%96 = OpConstantNull %float %79 = OpConstantNull %float
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%133 = OpTypeFunction %uint %uint %v3float %116 = OpTypeFunction %uint %uint %v3float
%_ptr_Function_v3uint = OpTypePointer Function %v3uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint
%141 = OpConstantNull %v3uint %124 = OpConstantNull %v3uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%137 = OpTypeFunction %uint %uint %uint
%143 = OpConstantNull %uint
%bool = OpTypeBool
%154 = OpTypeFunction %v3uint %uint %uint %154 = OpTypeFunction %v3uint %uint %uint
%174 = OpTypeFunction %v3float %uint %174 = OpTypeFunction %v3float %uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
@ -210,132 +210,132 @@
%222 = OpTypeFunction %void %v3uint %222 = OpTypeFunction %void %v3uint
%float_3 = OpConstant %float 3 %float_3 = OpConstant %float 3
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%tint_div = OpFunction %uint None %32 %marg8uintin = OpFunction %void None %32
%lhs = OpFunctionParameter %uint %35 = OpLabel
%rhs = OpFunctionParameter %uint
%36 = OpLabel
%39 = OpIEqual %bool %rhs %38
%37 = OpSelect %uint %39 %uint_1 %rhs
%42 = OpUDiv %uint %lhs %37
OpReturnValue %42
OpFunctionEnd
%tint_mod = OpFunction %uint None %32
%lhs_0 = OpFunctionParameter %uint
%rhs_0 = OpFunctionParameter %uint
%46 = OpLabel
%48 = OpIEqual %bool %rhs_0 %38
%47 = OpSelect %uint %48 %uint_1 %rhs_0
%49 = OpUMod %uint %lhs_0 %47
OpReturnValue %49
OpFunctionEnd
%marg8uintin = OpFunction %void None %50
%53 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%toVoxelPos = OpFunction %v3float None %54 %toVoxelPos = OpFunction %v3float None %36
%position = OpFunctionParameter %v3float %position = OpFunctionParameter %v3float
%57 = OpLabel %39 = OpLabel
%bbMin = OpVariable %_ptr_Function_v3float Function %71 %bbMin = OpVariable %_ptr_Function_v3float Function %54
%bbMax = OpVariable %_ptr_Function_v3float Function %71 %bbMax = OpVariable %_ptr_Function_v3float Function %54
%bbSize = OpVariable %_ptr_Function_v3float Function %71 %bbSize = OpVariable %_ptr_Function_v3float Function %54
%cubeSize = OpVariable %_ptr_Function_float Function %96 %cubeSize = OpVariable %_ptr_Function_float Function %79
%gridSize = OpVariable %_ptr_Function_float Function %96 %gridSize = OpVariable %_ptr_Function_float Function %79
%gx = OpVariable %_ptr_Function_float Function %96 %gx = OpVariable %_ptr_Function_float Function %79
%gy = OpVariable %_ptr_Function_float Function %96 %gy = OpVariable %_ptr_Function_float Function %79
%gz = OpVariable %_ptr_Function_float Function %96 %gz = OpVariable %_ptr_Function_float Function %79
%61 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0 %43 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%62 = OpLoad %float %61 %44 = OpLoad %float %43
%63 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1 %46 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%64 = OpLoad %float %63 %47 = OpLoad %float %46
%66 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2 %49 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%67 = OpLoad %float %66 %50 = OpLoad %float %49
%68 = OpCompositeConstruct %v3float %62 %64 %67 %51 = OpCompositeConstruct %v3float %44 %47 %50
OpStore %bbMin %68 OpStore %bbMin %51
%73 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0 %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0
%74 = OpLoad %float %73 %57 = OpLoad %float %56
%75 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1 %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1
%76 = OpLoad %float %75 %59 = OpLoad %float %58
%77 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2 %60 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2
%78 = OpLoad %float %77 %61 = OpLoad %float %60
%79 = OpCompositeConstruct %v3float %74 %76 %78 %62 = OpCompositeConstruct %v3float %57 %59 %61
OpStore %bbMax %79 OpStore %bbMax %62
%81 = OpLoad %v3float %bbMin %64 = OpLoad %v3float %bbMin
%82 = OpLoad %v3float %bbMin %65 = OpLoad %v3float %bbMin
%83 = OpFSub %v3float %81 %82 %66 = OpFSub %v3float %64 %65
OpStore %bbSize %83 OpStore %bbSize %66
%89 = OpAccessChain %_ptr_Function_float %bbMax %uint_0 %72 = OpAccessChain %_ptr_Function_float %bbMax %uint_0
%90 = OpLoad %float %89 %73 = OpLoad %float %72
%91 = OpAccessChain %_ptr_Function_float %bbMax %uint_1 %74 = OpAccessChain %_ptr_Function_float %bbMax %uint_1
%92 = OpLoad %float %91 %75 = OpLoad %float %74
%87 = OpExtInst %float %86 NMax %90 %92 %70 = OpExtInst %float %69 NMax %73 %75
%93 = OpAccessChain %_ptr_Function_float %bbSize %uint_2 %76 = OpAccessChain %_ptr_Function_float %bbSize %uint_2
%94 = OpLoad %float %93 %77 = OpLoad %float %76
%85 = OpExtInst %float %86 NMax %87 %94 %68 = OpExtInst %float %69 NMax %70 %77
OpStore %cubeSize %85 OpStore %cubeSize %68
%99 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 %82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%100 = OpLoad %uint %99 %83 = OpLoad %uint %82
%97 = OpConvertUToF %float %100 %80 = OpConvertUToF %float %83
OpStore %gridSize %97 OpStore %gridSize %80
%102 = OpLoad %float %cubeSize %85 = OpLoad %float %cubeSize
%103 = OpCompositeExtract %float %position 0 %86 = OpCompositeExtract %float %position 0
%104 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0 %87 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%105 = OpLoad %float %104 %88 = OpLoad %float %87
%106 = OpFSub %float %103 %105 %89 = OpFSub %float %86 %88
%107 = OpFMul %float %102 %106 %90 = OpFMul %float %85 %89
%108 = OpLoad %float %cubeSize %91 = OpLoad %float %cubeSize
%109 = OpFDiv %float %107 %108 %92 = OpFDiv %float %90 %91
OpStore %gx %109 OpStore %gx %92
%111 = OpLoad %float %gx %94 = OpLoad %float %gx
%112 = OpCompositeExtract %float %position 1 %95 = OpCompositeExtract %float %position 1
%113 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1 %96 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%114 = OpLoad %float %113 %97 = OpLoad %float %96
%115 = OpFSub %float %112 %114 %98 = OpFSub %float %95 %97
%116 = OpFMul %float %111 %115 %99 = OpFMul %float %94 %98
%117 = OpLoad %float %gridSize %100 = OpLoad %float %gridSize
%118 = OpFDiv %float %116 %117 %101 = OpFDiv %float %99 %100
OpStore %gy %118 OpStore %gy %101
%120 = OpLoad %float %gridSize %103 = OpLoad %float %gridSize
%121 = OpCompositeExtract %float %position 2 %104 = OpCompositeExtract %float %position 2
%122 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2 %105 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%123 = OpLoad %float %122 %106 = OpLoad %float %105
%124 = OpFSub %float %121 %123 %107 = OpFSub %float %104 %106
%125 = OpFMul %float %120 %124 %108 = OpFMul %float %103 %107
%126 = OpLoad %float %gridSize %109 = OpLoad %float %gridSize
%127 = OpFDiv %float %125 %126 %110 = OpFDiv %float %108 %109
OpStore %gz %127 OpStore %gz %110
%129 = OpLoad %float %gz %112 = OpLoad %float %gz
%130 = OpLoad %float %gz %113 = OpLoad %float %gz
%131 = OpLoad %float %gz %114 = OpLoad %float %gz
%132 = OpCompositeConstruct %v3float %129 %130 %131 %115 = OpCompositeConstruct %v3float %112 %113 %114
OpReturnValue %132 OpReturnValue %115
OpFunctionEnd OpFunctionEnd
%toIndex1D = OpFunction %uint None %133 %toIndex1D = OpFunction %uint None %116
%gridSize_0 = OpFunctionParameter %uint %gridSize_0 = OpFunctionParameter %uint
%voxelPos = OpFunctionParameter %v3float %voxelPos = OpFunctionParameter %v3float
%137 = OpLabel %120 = OpLabel
%icoord = OpVariable %_ptr_Function_v3uint Function %141 %icoord = OpVariable %_ptr_Function_v3uint Function %124
%138 = OpConvertFToU %v3uint %voxelPos %121 = OpConvertFToU %v3uint %voxelPos
OpStore %icoord %138 OpStore %icoord %121
%143 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 %126 = OpAccessChain %_ptr_Function_uint %icoord %uint_0
%144 = OpLoad %uint %143 %127 = OpLoad %uint %126
%145 = OpAccessChain %_ptr_Function_uint %icoord %uint_1 %128 = OpAccessChain %_ptr_Function_uint %icoord %uint_1
%146 = OpLoad %uint %145 %129 = OpLoad %uint %128
%147 = OpIMul %uint %gridSize_0 %146 %130 = OpIMul %uint %gridSize_0 %129
%148 = OpIAdd %uint %144 %147 %131 = OpIAdd %uint %127 %130
%149 = OpIMul %uint %gridSize_0 %gridSize_0 %132 = OpIMul %uint %gridSize_0 %gridSize_0
%150 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 %133 = OpAccessChain %_ptr_Function_uint %icoord %uint_2
%151 = OpLoad %uint %150 %134 = OpLoad %uint %133
%152 = OpIMul %uint %149 %151 %135 = OpIMul %uint %132 %134
%153 = OpIAdd %uint %148 %152 %136 = OpIAdd %uint %131 %135
OpReturnValue %136
OpFunctionEnd
%tint_div = OpFunction %uint None %137
%lhs = OpFunctionParameter %uint
%rhs = OpFunctionParameter %uint
%141 = OpLabel
%144 = OpIEqual %bool %rhs %143
%142 = OpSelect %uint %144 %uint_1 %rhs
%146 = OpUDiv %uint %lhs %142
OpReturnValue %146
OpFunctionEnd
%tint_mod = OpFunction %uint None %137
%lhs_0 = OpFunctionParameter %uint
%rhs_0 = OpFunctionParameter %uint
%150 = OpLabel
%152 = OpIEqual %bool %rhs_0 %143
%151 = OpSelect %uint %152 %uint_1 %rhs_0
%153 = OpUMod %uint %lhs_0 %151
OpReturnValue %153 OpReturnValue %153
OpFunctionEnd OpFunctionEnd
%toIndex4D = OpFunction %v3uint None %154 %toIndex4D = OpFunction %v3uint None %154
%gridSize_1 = OpFunctionParameter %uint %gridSize_1 = OpFunctionParameter %uint
%index = OpFunctionParameter %uint %index = OpFunctionParameter %uint
%158 = OpLabel %158 = OpLabel
%z = OpVariable %_ptr_Function_uint Function %38 %z = OpVariable %_ptr_Function_uint Function %143
%y = OpVariable %_ptr_Function_uint Function %38 %y = OpVariable %_ptr_Function_uint Function %143
%x = OpVariable %_ptr_Function_uint Function %38 %x = OpVariable %_ptr_Function_uint Function %143
%160 = OpIMul %uint %index %index %160 = OpIMul %uint %index %index
%159 = OpFunctionCall %uint %tint_div %gridSize_1 %160 %159 = OpFunctionCall %uint %tint_div %gridSize_1 %160
OpStore %z %159 OpStore %z %159
@ -356,9 +356,9 @@
%loadPosition = OpFunction %v3float None %174 %loadPosition = OpFunction %v3float None %174
%vertexIndex = OpFunctionParameter %uint %vertexIndex = OpFunctionParameter %uint
%177 = OpLabel %177 = OpLabel
%position_0 = OpVariable %_ptr_Function_v3float Function %71 %position_0 = OpVariable %_ptr_Function_v3float Function %54
%179 = OpIMul %uint %uint_3 %vertexIndex %179 = OpIMul %uint %uint_3 %vertexIndex
%180 = OpIAdd %uint %179 %38 %180 = OpIAdd %uint %179 %143
%182 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %180 %182 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %180
%183 = OpLoad %float %182 %183 = OpLoad %float %182
%184 = OpIMul %uint %uint_3 %vertexIndex %184 = OpIMul %uint %uint_3 %vertexIndex
@ -374,13 +374,13 @@
%194 = OpLoad %v3float %position_0 %194 = OpLoad %v3float %position_0
OpReturnValue %194 OpReturnValue %194
OpFunctionEnd OpFunctionEnd
%doIgnore = OpFunction %void None %50 %doIgnore = OpFunction %void None %32
%196 = OpLabel %196 = OpLabel
%g43 = OpVariable %_ptr_Function_uint Function %38 %g43 = OpVariable %_ptr_Function_uint Function %143
%kj6 = OpVariable %_ptr_Function_uint Function %38 %kj6 = OpVariable %_ptr_Function_uint Function %143
%b53 = OpVariable %_ptr_Function_uint Function %38 %b53 = OpVariable %_ptr_Function_uint Function %143
%rwg = OpVariable %_ptr_Function_uint Function %38 %rwg = OpVariable %_ptr_Function_uint Function %143
%rb5 = OpVariable %_ptr_Function_float Function %96 %rb5 = OpVariable %_ptr_Function_float Function %79
%g55 = OpVariable %_ptr_Function_int Function %206 %g55 = OpVariable %_ptr_Function_int Function %206
%197 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 %197 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%198 = OpLoad %uint %197 %198 = OpLoad %uint %197
@ -405,17 +405,17 @@
%main_count_inner = OpFunction %void None %222 %main_count_inner = OpFunction %void None %222
%GlobalInvocationID = OpFunctionParameter %v3uint %GlobalInvocationID = OpFunctionParameter %v3uint
%225 = OpLabel %225 = OpLabel
%triangleIndex = OpVariable %_ptr_Function_uint Function %38 %triangleIndex = OpVariable %_ptr_Function_uint Function %143
%i0 = OpVariable %_ptr_Function_uint Function %38 %i0 = OpVariable %_ptr_Function_uint Function %143
%i1 = OpVariable %_ptr_Function_uint Function %38 %i1 = OpVariable %_ptr_Function_uint Function %143
%i2 = OpVariable %_ptr_Function_uint Function %38 %i2 = OpVariable %_ptr_Function_uint Function %143
%p0 = OpVariable %_ptr_Function_v3float Function %71 %p0 = OpVariable %_ptr_Function_v3float Function %54
%p1 = OpVariable %_ptr_Function_v3float Function %71 %p1 = OpVariable %_ptr_Function_v3float Function %54
%p2 = OpVariable %_ptr_Function_v3float Function %71 %p2 = OpVariable %_ptr_Function_v3float Function %54
%269 = OpVariable %_ptr_Function_v3float Function %71 %269 = OpVariable %_ptr_Function_v3float Function %54
%center = OpVariable %_ptr_Function_v3float Function %71 %center = OpVariable %_ptr_Function_v3float Function %54
%voxelPos_0 = OpVariable %_ptr_Function_v3float Function %71 %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %54
%lIndex = OpVariable %_ptr_Function_uint Function %38 %lIndex = OpVariable %_ptr_Function_uint Function %143
%triangleOffset = OpVariable %_ptr_Function_int Function %206 %triangleOffset = OpVariable %_ptr_Function_int Function %206
%226 = OpCompositeExtract %uint %GlobalInvocationID 0 %226 = OpCompositeExtract %uint %GlobalInvocationID 0
OpStore %triangleIndex %226 OpStore %triangleIndex %226
@ -431,7 +431,7 @@
%234 = OpFunctionCall %void %doIgnore %234 = OpFunctionCall %void %doIgnore
%235 = OpLoad %uint %triangleIndex %235 = OpLoad %uint %triangleIndex
%236 = OpIMul %uint %uint_3 %235 %236 = OpIMul %uint %uint_3 %235
%237 = OpIAdd %uint %236 %38 %237 = OpIAdd %uint %236 %143
%238 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %237 %238 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %237
%239 = OpLoad %uint %238 %239 = OpLoad %uint %238
OpStore %i0 %239 OpStore %i0 %239
@ -478,7 +478,7 @@
OpStore %triangleOffset %280 OpStore %triangleOffset %280
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main_count = OpFunction %void None %50 %main_count = OpFunction %void None %32
%287 = OpLabel %287 = OpLabel
%289 = OpLoad %v3uint %GlobalInvocationID_1 %289 = OpLoad %v3uint %GlobalInvocationID_1
%288 = OpFunctionCall %void %main_count_inner %289 %288 = OpFunctionCall %void %main_count_inner %289

View File

@ -0,0 +1,4 @@
@compute @workgroup_size(1)
fn f(@builtin(global_invocation_id) v : vec3<u32>) {
let l = v.x << (v.y % 1);
}

View File

@ -0,0 +1,19 @@
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
struct tint_symbol_1 {
uint3 v : SV_DispatchThreadID;
};
void f_inner(uint3 v) {
const uint tint_symbol_2 = v.x;
const uint tint_symbol_3 = tint_mod(v.y, 1u);
const uint l = (tint_symbol_2 << (tint_symbol_3 & 31u));
}
[numthreads(1, 1, 1)]
void f(tint_symbol_1 tint_symbol) {
f_inner(tint_symbol.v);
return;
}

View File

@ -0,0 +1,19 @@
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
struct tint_symbol_1 {
uint3 v : SV_DispatchThreadID;
};
void f_inner(uint3 v) {
const uint tint_symbol_2 = v.x;
const uint tint_symbol_3 = tint_mod(v.y, 1u);
const uint l = (tint_symbol_2 << (tint_symbol_3 & 31u));
}
[numthreads(1, 1, 1)]
void f(tint_symbol_1 tint_symbol) {
f_inner(tint_symbol.v);
return;
}

View File

@ -0,0 +1,17 @@
#version 310 es
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
void f(uvec3 v) {
uint tint_symbol = v.x;
uint tint_symbol_1 = tint_mod(v.y, 1u);
uint l = (tint_symbol << (tint_symbol_1 & 31u));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f(gl_GlobalInvocationID);
return;
}

View File

@ -0,0 +1,18 @@
#include <metal_stdlib>
using namespace metal;
uint tint_mod(uint lhs, uint rhs) {
return (lhs % select(rhs, 1u, (rhs == 0u)));
}
void f_inner(uint3 v) {
uint const tint_symbol = v[0];
uint const tint_symbol_1 = tint_mod(v[1], 1u);
uint const l = (tint_symbol << (tint_symbol_1 & 31u));
}
kernel void f(uint3 v [[thread_position_in_grid]]) {
f_inner(v);
return;
}

View File

@ -0,0 +1,54 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" %v_1
OpExecutionMode %f LocalSize 1 1 1
OpName %v_1 "v_1"
OpName %tint_mod "tint_mod"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %f_inner "f_inner"
OpName %v "v"
OpName %f "f"
OpDecorate %v_1 BuiltIn GlobalInvocationId
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%v_1 = OpVariable %_ptr_Input_v3uint Input
%5 = OpTypeFunction %uint %uint %uint
%11 = OpConstantNull %uint
%bool = OpTypeBool
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%16 = OpTypeFunction %void %v3uint
%uint_31 = OpConstant %uint 31
%27 = OpTypeFunction %void
%tint_mod = OpFunction %uint None %5
%lhs = OpFunctionParameter %uint
%rhs = OpFunctionParameter %uint
%9 = OpLabel
%12 = OpIEqual %bool %rhs %11
%10 = OpSelect %uint %12 %uint_1 %rhs
%15 = OpUMod %uint %lhs %10
OpReturnValue %15
OpFunctionEnd
%f_inner = OpFunction %void None %16
%v = OpFunctionParameter %v3uint
%20 = OpLabel
%21 = OpCompositeExtract %uint %v 0
%23 = OpCompositeExtract %uint %v 1
%22 = OpFunctionCall %uint %tint_mod %23 %uint_1
%25 = OpBitwiseAnd %uint %22 %uint_31
%26 = OpShiftLeftLogical %uint %21 %25
OpReturn
OpFunctionEnd
%f = OpFunction %void None %27
%29 = OpLabel
%31 = OpLoad %v3uint %v_1
%30 = OpFunctionCall %void %f_inner %31
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,4 @@
@compute @workgroup_size(1)
fn f(@builtin(global_invocation_id) v : vec3<u32>) {
let l = (v.x << (v.y % 1));
}

View File

@ -1,11 +1,3 @@
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
cbuffer cbuffer_uniforms : register(b0, space0) { cbuffer cbuffer_uniforms : register(b0, space0) {
uint4 uniforms[3]; uint4 uniforms[3];
}; };
@ -32,6 +24,14 @@ uint toIndex1D(uint gridSize, float3 voxelPos) {
return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z));
} }
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
uint3 toIndex3D(uint gridSize, uint index) { uint3 toIndex3D(uint gridSize, uint index) {
uint z_1 = tint_div(index, (gridSize * gridSize)); uint z_1 = tint_div(index, (gridSize * gridSize));
uint y_1 = tint_div((index - ((gridSize * gridSize) * z_1)), gridSize); uint y_1 = tint_div((index - ((gridSize * gridSize) * z_1)), gridSize);

View File

@ -1,11 +1,3 @@
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
cbuffer cbuffer_uniforms : register(b0, space0) { cbuffer cbuffer_uniforms : register(b0, space0) {
uint4 uniforms[3]; uint4 uniforms[3];
}; };
@ -32,6 +24,14 @@ uint toIndex1D(uint gridSize, float3 voxelPos) {
return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z));
} }
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
uint3 toIndex3D(uint gridSize, uint index) { uint3 toIndex3D(uint gridSize, uint index) {
uint z_1 = tint_div(index, (gridSize * gridSize)); uint z_1 = tint_div(index, (gridSize * gridSize));
uint y_1 = tint_div((index - ((gridSize * gridSize) * z_1)), gridSize); uint y_1 = tint_div((index - ((gridSize * gridSize) * z_1)), gridSize);

View File

@ -14,14 +14,6 @@ struct tint_array {
T elements[N]; T elements[N];
}; };
uint tint_div(uint lhs, uint rhs) {
return (lhs / select(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % select(rhs, 1u, (rhs == 0u)));
}
struct Uniforms { struct Uniforms {
/* 0x0000 */ uint numTriangles; /* 0x0000 */ uint numTriangles;
/* 0x0004 */ uint gridSize; /* 0x0004 */ uint gridSize;
@ -85,6 +77,14 @@ uint toIndex1D(uint gridSize, float3 voxelPos) {
return ((icoord[0] + (gridSize * icoord[1])) + ((gridSize * gridSize) * icoord[2])); return ((icoord[0] + (gridSize * icoord[1])) + ((gridSize * gridSize) * icoord[2]));
} }
uint tint_div(uint lhs, uint rhs) {
return (lhs / select(rhs, 1u, (rhs == 0u)));
}
uint tint_mod(uint lhs, uint rhs) {
return (lhs % select(rhs, 1u, (rhs == 0u)));
}
uint3 toIndex3D(uint gridSize, uint index) { uint3 toIndex3D(uint gridSize, uint index) {
uint z_1 = tint_div(index, (gridSize * gridSize)); uint z_1 = tint_div(index, (gridSize * gridSize));
uint y_1 = tint_div((index - ((gridSize * gridSize) * z_1)), gridSize); uint y_1 = tint_div((index - ((gridSize * gridSize) * z_1)), gridSize);

View File

@ -4,7 +4,7 @@
; Bound: 419 ; Bound: 419
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%84 = OpExtInstImport "GLSL.std.450" %67 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1 OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1
OpEntryPoint GLCompute %main_create_lut "main_create_lut" %GlobalInvocationID_2 OpEntryPoint GLCompute %main_create_lut "main_create_lut" %GlobalInvocationID_2
@ -53,12 +53,6 @@
OpMemberName %Dbg 10 "value_f32_2" OpMemberName %Dbg 10 "value_f32_2"
OpMemberName %Dbg 11 "value_f32_3" OpMemberName %Dbg 11 "value_f32_3"
OpName %dbg "dbg" OpName %dbg "dbg"
OpName %tint_div "tint_div"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %tint_mod "tint_mod"
OpName %lhs_0 "lhs"
OpName %rhs_0 "rhs"
OpName %toVoxelPos "toVoxelPos" OpName %toVoxelPos "toVoxelPos"
OpName %position "position" OpName %position "position"
OpName %bbMin "bbMin" OpName %bbMin "bbMin"
@ -73,6 +67,12 @@
OpName %gridSize_0 "gridSize" OpName %gridSize_0 "gridSize"
OpName %voxelPos "voxelPos" OpName %voxelPos "voxelPos"
OpName %icoord "icoord" OpName %icoord "icoord"
OpName %tint_div "tint_div"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %tint_mod "tint_mod"
OpName %lhs_0 "lhs"
OpName %rhs_0 "rhs"
OpName %toIndex3D "toIndex3D" OpName %toIndex3D "toIndex3D"
OpName %gridSize_1 "gridSize" OpName %gridSize_1 "gridSize"
OpName %index "index" OpName %index "index"
@ -207,25 +207,25 @@
%dbg_block = OpTypeStruct %Dbg %dbg_block = OpTypeStruct %Dbg
%_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block %_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block
%dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer %dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer
%34 = OpTypeFunction %uint %uint %uint %34 = OpTypeFunction %v3float %v3float
%40 = OpConstantNull %uint
%bool = OpTypeBool
%uint_1 = OpConstant %uint 1
%52 = OpTypeFunction %v3float %v3float
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%uint_4 = OpConstant %uint 4 %uint_4 = OpConstant %uint 4
%_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%69 = OpConstantNull %v3float %52 = OpConstantNull %v3float
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%94 = OpConstantNull %float %77 = OpConstantNull %float
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%131 = OpTypeFunction %uint %uint %v3float %114 = OpTypeFunction %uint %uint %v3float
%_ptr_Function_v3uint = OpTypePointer Function %v3uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint
%139 = OpConstantNull %v3uint %122 = OpConstantNull %v3uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%135 = OpTypeFunction %uint %uint %uint
%141 = OpConstantNull %uint
%bool = OpTypeBool
%152 = OpTypeFunction %v3uint %uint %uint %152 = OpTypeFunction %v3uint %uint %uint
%172 = OpTypeFunction %v3float %uint %172 = OpTypeFunction %v3float %uint
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
@ -244,128 +244,128 @@
%uint_10 = OpConstant %uint 10 %uint_10 = OpConstant %uint 10
%int_n1 = OpConstant %int -1 %int_n1 = OpConstant %int -1
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%tint_div = OpFunction %uint None %34 %toVoxelPos = OpFunction %v3float None %34
%lhs = OpFunctionParameter %uint
%rhs = OpFunctionParameter %uint
%38 = OpLabel
%41 = OpIEqual %bool %rhs %40
%39 = OpSelect %uint %41 %uint_1 %rhs
%44 = OpUDiv %uint %lhs %39
OpReturnValue %44
OpFunctionEnd
%tint_mod = OpFunction %uint None %34
%lhs_0 = OpFunctionParameter %uint
%rhs_0 = OpFunctionParameter %uint
%48 = OpLabel
%50 = OpIEqual %bool %rhs_0 %40
%49 = OpSelect %uint %50 %uint_1 %rhs_0
%51 = OpUMod %uint %lhs_0 %49
OpReturnValue %51
OpFunctionEnd
%toVoxelPos = OpFunction %v3float None %52
%position = OpFunctionParameter %v3float %position = OpFunctionParameter %v3float
%55 = OpLabel %37 = OpLabel
%bbMin = OpVariable %_ptr_Function_v3float Function %69 %bbMin = OpVariable %_ptr_Function_v3float Function %52
%bbMax = OpVariable %_ptr_Function_v3float Function %69 %bbMax = OpVariable %_ptr_Function_v3float Function %52
%bbSize = OpVariable %_ptr_Function_v3float Function %69 %bbSize = OpVariable %_ptr_Function_v3float Function %52
%cubeSize = OpVariable %_ptr_Function_float Function %94 %cubeSize = OpVariable %_ptr_Function_float Function %77
%gridSize = OpVariable %_ptr_Function_float Function %94 %gridSize = OpVariable %_ptr_Function_float Function %77
%gx = OpVariable %_ptr_Function_float Function %94 %gx = OpVariable %_ptr_Function_float Function %77
%gy = OpVariable %_ptr_Function_float Function %94 %gy = OpVariable %_ptr_Function_float Function %77
%gz = OpVariable %_ptr_Function_float Function %94 %gz = OpVariable %_ptr_Function_float Function %77
%59 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0 %41 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%60 = OpLoad %float %59 %42 = OpLoad %float %41
%61 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1 %44 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%62 = OpLoad %float %61 %45 = OpLoad %float %44
%64 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2 %47 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%65 = OpLoad %float %64 %48 = OpLoad %float %47
%66 = OpCompositeConstruct %v3float %60 %62 %65 %49 = OpCompositeConstruct %v3float %42 %45 %48
OpStore %bbMin %66 OpStore %bbMin %49
%71 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0 %54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0
%72 = OpLoad %float %71 %55 = OpLoad %float %54
%73 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1 %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1
%74 = OpLoad %float %73 %57 = OpLoad %float %56
%75 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2 %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2
%76 = OpLoad %float %75 %59 = OpLoad %float %58
%77 = OpCompositeConstruct %v3float %72 %74 %76 %60 = OpCompositeConstruct %v3float %55 %57 %59
OpStore %bbMax %77 OpStore %bbMax %60
%79 = OpLoad %v3float %bbMax %62 = OpLoad %v3float %bbMax
%80 = OpLoad %v3float %bbMin %63 = OpLoad %v3float %bbMin
%81 = OpFSub %v3float %79 %80 %64 = OpFSub %v3float %62 %63
OpStore %bbSize %81 OpStore %bbSize %64
%87 = OpAccessChain %_ptr_Function_float %bbSize %uint_0 %70 = OpAccessChain %_ptr_Function_float %bbSize %uint_0
%88 = OpLoad %float %87 %71 = OpLoad %float %70
%89 = OpAccessChain %_ptr_Function_float %bbSize %uint_1 %72 = OpAccessChain %_ptr_Function_float %bbSize %uint_1
%90 = OpLoad %float %89 %73 = OpLoad %float %72
%85 = OpExtInst %float %84 NMax %88 %90 %68 = OpExtInst %float %67 NMax %71 %73
%91 = OpAccessChain %_ptr_Function_float %bbSize %uint_2 %74 = OpAccessChain %_ptr_Function_float %bbSize %uint_2
%92 = OpLoad %float %91 %75 = OpLoad %float %74
%83 = OpExtInst %float %84 NMax %85 %92 %66 = OpExtInst %float %67 NMax %68 %75
OpStore %cubeSize %83 OpStore %cubeSize %66
%97 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 %80 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%98 = OpLoad %uint %97 %81 = OpLoad %uint %80
%95 = OpConvertUToF %float %98 %78 = OpConvertUToF %float %81
OpStore %gridSize %95 OpStore %gridSize %78
%100 = OpLoad %float %gridSize %83 = OpLoad %float %gridSize
%101 = OpCompositeExtract %float %position 0 %84 = OpCompositeExtract %float %position 0
%102 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0 %85 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%103 = OpLoad %float %102 %86 = OpLoad %float %85
%104 = OpFSub %float %101 %103 %87 = OpFSub %float %84 %86
%105 = OpFMul %float %100 %104 %88 = OpFMul %float %83 %87
%106 = OpLoad %float %cubeSize %89 = OpLoad %float %cubeSize
%107 = OpFDiv %float %105 %106 %90 = OpFDiv %float %88 %89
OpStore %gx %107 OpStore %gx %90
%109 = OpLoad %float %gridSize %92 = OpLoad %float %gridSize
%110 = OpCompositeExtract %float %position 1 %93 = OpCompositeExtract %float %position 1
%111 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1 %94 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%112 = OpLoad %float %111 %95 = OpLoad %float %94
%113 = OpFSub %float %110 %112 %96 = OpFSub %float %93 %95
%114 = OpFMul %float %109 %113 %97 = OpFMul %float %92 %96
%115 = OpLoad %float %cubeSize %98 = OpLoad %float %cubeSize
%116 = OpFDiv %float %114 %115 %99 = OpFDiv %float %97 %98
OpStore %gy %116 OpStore %gy %99
%118 = OpLoad %float %gridSize %101 = OpLoad %float %gridSize
%119 = OpCompositeExtract %float %position 2 %102 = OpCompositeExtract %float %position 2
%120 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2 %103 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%121 = OpLoad %float %120 %104 = OpLoad %float %103
%122 = OpFSub %float %119 %121 %105 = OpFSub %float %102 %104
%123 = OpFMul %float %118 %122 %106 = OpFMul %float %101 %105
%124 = OpLoad %float %cubeSize %107 = OpLoad %float %cubeSize
%125 = OpFDiv %float %123 %124 %108 = OpFDiv %float %106 %107
OpStore %gz %125 OpStore %gz %108
%127 = OpLoad %float %gx %110 = OpLoad %float %gx
%128 = OpLoad %float %gy %111 = OpLoad %float %gy
%129 = OpLoad %float %gz %112 = OpLoad %float %gz
%130 = OpCompositeConstruct %v3float %127 %128 %129 %113 = OpCompositeConstruct %v3float %110 %111 %112
OpReturnValue %130 OpReturnValue %113
OpFunctionEnd OpFunctionEnd
%toIndex1D = OpFunction %uint None %131 %toIndex1D = OpFunction %uint None %114
%gridSize_0 = OpFunctionParameter %uint %gridSize_0 = OpFunctionParameter %uint
%voxelPos = OpFunctionParameter %v3float %voxelPos = OpFunctionParameter %v3float
%135 = OpLabel %118 = OpLabel
%icoord = OpVariable %_ptr_Function_v3uint Function %139 %icoord = OpVariable %_ptr_Function_v3uint Function %122
%136 = OpConvertFToU %v3uint %voxelPos %119 = OpConvertFToU %v3uint %voxelPos
OpStore %icoord %136 OpStore %icoord %119
%141 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 %124 = OpAccessChain %_ptr_Function_uint %icoord %uint_0
%142 = OpLoad %uint %141 %125 = OpLoad %uint %124
%143 = OpAccessChain %_ptr_Function_uint %icoord %uint_1 %126 = OpAccessChain %_ptr_Function_uint %icoord %uint_1
%144 = OpLoad %uint %143 %127 = OpLoad %uint %126
%145 = OpIMul %uint %gridSize_0 %144 %128 = OpIMul %uint %gridSize_0 %127
%146 = OpIAdd %uint %142 %145 %129 = OpIAdd %uint %125 %128
%147 = OpIMul %uint %gridSize_0 %gridSize_0 %130 = OpIMul %uint %gridSize_0 %gridSize_0
%148 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 %131 = OpAccessChain %_ptr_Function_uint %icoord %uint_2
%149 = OpLoad %uint %148 %132 = OpLoad %uint %131
%150 = OpIMul %uint %147 %149 %133 = OpIMul %uint %130 %132
%151 = OpIAdd %uint %146 %150 %134 = OpIAdd %uint %129 %133
OpReturnValue %134
OpFunctionEnd
%tint_div = OpFunction %uint None %135
%lhs = OpFunctionParameter %uint
%rhs = OpFunctionParameter %uint
%139 = OpLabel
%142 = OpIEqual %bool %rhs %141
%140 = OpSelect %uint %142 %uint_1 %rhs
%144 = OpUDiv %uint %lhs %140
OpReturnValue %144
OpFunctionEnd
%tint_mod = OpFunction %uint None %135
%lhs_0 = OpFunctionParameter %uint
%rhs_0 = OpFunctionParameter %uint
%148 = OpLabel
%150 = OpIEqual %bool %rhs_0 %141
%149 = OpSelect %uint %150 %uint_1 %rhs_0
%151 = OpUMod %uint %lhs_0 %149
OpReturnValue %151 OpReturnValue %151
OpFunctionEnd OpFunctionEnd
%toIndex3D = OpFunction %v3uint None %152 %toIndex3D = OpFunction %v3uint None %152
%gridSize_1 = OpFunctionParameter %uint %gridSize_1 = OpFunctionParameter %uint
%index = OpFunctionParameter %uint %index = OpFunctionParameter %uint
%156 = OpLabel %156 = OpLabel
%z = OpVariable %_ptr_Function_uint Function %40 %z = OpVariable %_ptr_Function_uint Function %141
%y = OpVariable %_ptr_Function_uint Function %40 %y = OpVariable %_ptr_Function_uint Function %141
%x = OpVariable %_ptr_Function_uint Function %40 %x = OpVariable %_ptr_Function_uint Function %141
%158 = OpIMul %uint %gridSize_1 %gridSize_1 %158 = OpIMul %uint %gridSize_1 %gridSize_1
%157 = OpFunctionCall %uint %tint_div %index %158 %157 = OpFunctionCall %uint %tint_div %index %158
OpStore %z %157 OpStore %z %157
@ -386,9 +386,9 @@
%loadPosition = OpFunction %v3float None %172 %loadPosition = OpFunction %v3float None %172
%vertexIndex = OpFunctionParameter %uint %vertexIndex = OpFunctionParameter %uint
%175 = OpLabel %175 = OpLabel
%position_0 = OpVariable %_ptr_Function_v3float Function %69 %position_0 = OpVariable %_ptr_Function_v3float Function %52
%177 = OpIMul %uint %uint_3 %vertexIndex %177 = OpIMul %uint %uint_3 %vertexIndex
%178 = OpIAdd %uint %177 %40 %178 = OpIAdd %uint %177 %141
%180 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %178 %180 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %178
%181 = OpLoad %float %180 %181 = OpLoad %float %180
%182 = OpIMul %uint %uint_3 %vertexIndex %182 = OpIMul %uint %uint_3 %vertexIndex
@ -406,11 +406,11 @@
OpFunctionEnd OpFunctionEnd
%doIgnore = OpFunction %void None %193 %doIgnore = OpFunction %void None %193
%196 = OpLabel %196 = OpLabel
%g42 = OpVariable %_ptr_Function_uint Function %40 %g42 = OpVariable %_ptr_Function_uint Function %141
%kj6 = OpVariable %_ptr_Function_uint Function %40 %kj6 = OpVariable %_ptr_Function_uint Function %141
%b53 = OpVariable %_ptr_Function_uint Function %40 %b53 = OpVariable %_ptr_Function_uint Function %141
%rwg = OpVariable %_ptr_Function_uint Function %40 %rwg = OpVariable %_ptr_Function_uint Function %141
%rb5 = OpVariable %_ptr_Function_float Function %94 %rb5 = OpVariable %_ptr_Function_float Function %77
%g55 = OpVariable %_ptr_Function_int Function %206 %g55 = OpVariable %_ptr_Function_int Function %206
%197 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 %197 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%198 = OpLoad %uint %197 %198 = OpLoad %uint %197
@ -435,18 +435,18 @@
%main_count_inner = OpFunction %void None %222 %main_count_inner = OpFunction %void None %222
%GlobalInvocationID = OpFunctionParameter %v3uint %GlobalInvocationID = OpFunctionParameter %v3uint
%225 = OpLabel %225 = OpLabel
%triangleIndex = OpVariable %_ptr_Function_uint Function %40 %triangleIndex = OpVariable %_ptr_Function_uint Function %141
%i0 = OpVariable %_ptr_Function_uint Function %40 %i0 = OpVariable %_ptr_Function_uint Function %141
%i1 = OpVariable %_ptr_Function_uint Function %40 %i1 = OpVariable %_ptr_Function_uint Function %141
%i2 = OpVariable %_ptr_Function_uint Function %40 %i2 = OpVariable %_ptr_Function_uint Function %141
%p0 = OpVariable %_ptr_Function_v3float Function %69 %p0 = OpVariable %_ptr_Function_v3float Function %52
%p1 = OpVariable %_ptr_Function_v3float Function %69 %p1 = OpVariable %_ptr_Function_v3float Function %52
%p2 = OpVariable %_ptr_Function_v3float Function %69 %p2 = OpVariable %_ptr_Function_v3float Function %52
%269 = OpVariable %_ptr_Function_v3float Function %69 %269 = OpVariable %_ptr_Function_v3float Function %52
%center = OpVariable %_ptr_Function_v3float Function %69 %center = OpVariable %_ptr_Function_v3float Function %52
%voxelPos_0 = OpVariable %_ptr_Function_v3float Function %69 %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %52
%voxelIndex = OpVariable %_ptr_Function_uint Function %40 %voxelIndex = OpVariable %_ptr_Function_uint Function %141
%acefg = OpVariable %_ptr_Function_uint Function %40 %acefg = OpVariable %_ptr_Function_uint Function %141
%226 = OpCompositeExtract %uint %GlobalInvocationID 0 %226 = OpCompositeExtract %uint %GlobalInvocationID 0
OpStore %triangleIndex %226 OpStore %triangleIndex %226
%228 = OpLoad %uint %triangleIndex %228 = OpLoad %uint %triangleIndex
@ -461,7 +461,7 @@
%234 = OpFunctionCall %void %doIgnore %234 = OpFunctionCall %void %doIgnore
%235 = OpLoad %uint %triangleIndex %235 = OpLoad %uint %triangleIndex
%236 = OpIMul %uint %uint_3 %235 %236 = OpIMul %uint %uint_3 %235
%237 = OpIAdd %uint %236 %40 %237 = OpIAdd %uint %236 %141
%238 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %237 %238 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %237
%239 = OpLoad %uint %238 %239 = OpLoad %uint %238
OpStore %i0 %239 OpStore %i0 %239
@ -507,7 +507,7 @@
%280 = OpAtomicIAdd %uint %283 %uint_1 %uint_0 %uint_1 %280 = OpAtomicIAdd %uint %283 %uint_1 %uint_0 %uint_1
OpStore %acefg %280 OpStore %acefg %280
%285 = OpLoad %uint %triangleIndex %285 = OpLoad %uint %triangleIndex
%286 = OpIEqual %bool %285 %40 %286 = OpIEqual %bool %285 %141
OpSelectionMerge %287 None OpSelectionMerge %287 None
OpBranchConditional %286 %288 %287 OpBranchConditional %286 %288 %287
%288 = OpLabel %288 = OpLabel
@ -540,9 +540,9 @@
%main_create_lut_inner = OpFunction %void None %222 %main_create_lut_inner = OpFunction %void None %222
%GlobalInvocationID_0 = OpFunctionParameter %v3uint %GlobalInvocationID_0 = OpFunctionParameter %v3uint
%310 = OpLabel %310 = OpLabel
%voxelIndex_0 = OpVariable %_ptr_Function_uint Function %40 %voxelIndex_0 = OpVariable %_ptr_Function_uint Function %141
%maxVoxels = OpVariable %_ptr_Function_uint Function %40 %maxVoxels = OpVariable %_ptr_Function_uint Function %141
%numTriangles = OpVariable %_ptr_Function_uint Function %40 %numTriangles = OpVariable %_ptr_Function_uint Function %141
%offset = OpVariable %_ptr_Function_int Function %206 %offset = OpVariable %_ptr_Function_int Function %206
%311 = OpCompositeExtract %uint %GlobalInvocationID_0 0 %311 = OpCompositeExtract %uint %GlobalInvocationID_0 0
OpStore %voxelIndex_0 %311 OpStore %voxelIndex_0 %311
@ -570,7 +570,7 @@
OpStore %numTriangles %328 OpStore %numTriangles %328
OpStore %offset %int_n1 OpStore %offset %int_n1
%335 = OpLoad %uint %numTriangles %335 = OpLoad %uint %numTriangles
%336 = OpUGreaterThan %bool %335 %40 %336 = OpUGreaterThan %bool %335 %141
OpSelectionMerge %337 None OpSelectionMerge %337 None
OpBranchConditional %336 %338 %337 OpBranchConditional %336 %338 %337
%338 = OpLabel %338 = OpLabel
@ -596,17 +596,17 @@
%main_sort_triangles_inner = OpFunction %void None %222 %main_sort_triangles_inner = OpFunction %void None %222
%GlobalInvocationID_4 = OpFunctionParameter %v3uint %GlobalInvocationID_4 = OpFunctionParameter %v3uint
%355 = OpLabel %355 = OpLabel
%triangleIndex_0 = OpVariable %_ptr_Function_uint Function %40 %triangleIndex_0 = OpVariable %_ptr_Function_uint Function %141
%i0_0 = OpVariable %_ptr_Function_uint Function %40 %i0_0 = OpVariable %_ptr_Function_uint Function %141
%i1_0 = OpVariable %_ptr_Function_uint Function %40 %i1_0 = OpVariable %_ptr_Function_uint Function %141
%i2_0 = OpVariable %_ptr_Function_uint Function %40 %i2_0 = OpVariable %_ptr_Function_uint Function %141
%p0_0 = OpVariable %_ptr_Function_v3float Function %69 %p0_0 = OpVariable %_ptr_Function_v3float Function %52
%p1_0 = OpVariable %_ptr_Function_v3float Function %69 %p1_0 = OpVariable %_ptr_Function_v3float Function %52
%p2_0 = OpVariable %_ptr_Function_v3float Function %69 %p2_0 = OpVariable %_ptr_Function_v3float Function %52
%398 = OpVariable %_ptr_Function_v3float Function %69 %398 = OpVariable %_ptr_Function_v3float Function %52
%center_0 = OpVariable %_ptr_Function_v3float Function %69 %center_0 = OpVariable %_ptr_Function_v3float Function %52
%voxelPos_1 = OpVariable %_ptr_Function_v3float Function %69 %voxelPos_1 = OpVariable %_ptr_Function_v3float Function %52
%voxelIndex_1 = OpVariable %_ptr_Function_uint Function %40 %voxelIndex_1 = OpVariable %_ptr_Function_uint Function %141
%triangleOffset = OpVariable %_ptr_Function_int Function %206 %triangleOffset = OpVariable %_ptr_Function_int Function %206
%356 = OpCompositeExtract %uint %GlobalInvocationID_4 0 %356 = OpCompositeExtract %uint %GlobalInvocationID_4 0
OpStore %triangleIndex_0 %356 OpStore %triangleIndex_0 %356
@ -622,7 +622,7 @@
%363 = OpLabel %363 = OpLabel
%365 = OpLoad %uint %triangleIndex_0 %365 = OpLoad %uint %triangleIndex_0
%366 = OpIMul %uint %uint_3 %365 %366 = OpIMul %uint %uint_3 %365
%367 = OpIAdd %uint %366 %40 %367 = OpIAdd %uint %366 %141
%368 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %367 %368 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %367
%369 = OpLoad %uint %368 %369 = OpLoad %uint %368
OpStore %i0_0 %369 OpStore %i0_0 %369

View File

@ -1,7 +1,3 @@
int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs));
}
cbuffer cbuffer_x_4 : register(b0, space0) { cbuffer cbuffer_x_4 : register(b0, space0) {
uint4 x_4[7]; uint4 x_4[7];
}; };
@ -9,6 +5,10 @@ static float4 sk_FragColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
static bool sk_Clockwise = false; static bool sk_Clockwise = false;
static float4 vcolor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f); static float4 vcolor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f);
int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs));
}
bool test_int_S1_c0_b() { bool test_int_S1_c0_b() {
int unknown = 0; int unknown = 0;
bool ok = false; bool ok = false;

View File

@ -1,7 +1,3 @@
int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs));
}
cbuffer cbuffer_x_4 : register(b0, space0) { cbuffer cbuffer_x_4 : register(b0, space0) {
uint4 x_4[7]; uint4 x_4[7];
}; };
@ -9,6 +5,10 @@ static float4 sk_FragColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
static bool sk_Clockwise = false; static bool sk_Clockwise = false;
static float4 vcolor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f); static float4 vcolor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f);
int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs));
}
bool test_int_S1_c0_b() { bool test_int_S1_c0_b() {
int unknown = 0; int unknown = 0;
bool ok = false; bool ok = false;

View File

@ -3,10 +3,6 @@ precision mediump float;
layout(location = 0) in vec4 vcolor_S0_param_1; layout(location = 0) in vec4 vcolor_S0_param_1;
layout(location = 0) out vec4 sk_FragColor_1_1; layout(location = 0) out vec4 sk_FragColor_1_1;
ivec4 tint_div(ivec4 lhs, ivec4 rhs) {
return (lhs / mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4(-2147483648))) & uvec4(equal(rhs, ivec4(-1))))))));
}
struct UniformBuffer { struct UniformBuffer {
uint pad; uint pad;
uint pad_1; uint pad_1;
@ -28,6 +24,10 @@ layout(binding = 0, std140) uniform x_4_block_ubo {
vec4 sk_FragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); vec4 sk_FragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
bool sk_Clockwise = false; bool sk_Clockwise = false;
vec4 vcolor_S0 = vec4(0.0f, 0.0f, 0.0f, 0.0f); vec4 vcolor_S0 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
ivec4 tint_div(ivec4 lhs, ivec4 rhs) {
return (lhs / mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4(-2147483648))) & uvec4(equal(rhs, ivec4(-1))))))));
}
bool test_int_S1_c0_b() { bool test_int_S1_c0_b() {
int unknown = 0; int unknown = 0;
bool ok = false; bool ok = false;

View File

@ -14,10 +14,6 @@ struct tint_array {
T elements[N]; T elements[N];
}; };
int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / select(rhs, int4(1), ((rhs == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (rhs == int4(-1))))));
}
struct UniformBuffer { struct UniformBuffer {
/* 0x0000 */ tint_array<int8_t, 16> tint_pad; /* 0x0000 */ tint_array<int8_t, 16> tint_pad;
/* 0x0010 */ float unknownInput_S1_c0; /* 0x0010 */ float unknownInput_S1_c0;
@ -27,6 +23,10 @@ struct UniformBuffer {
/* 0x0040 */ float3x3 umatrix_S1; /* 0x0040 */ float3x3 umatrix_S1;
}; };
int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / select(rhs, int4(1), ((rhs == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (rhs == int4(-1))))));
}
bool test_int_S1_c0_b(const constant UniformBuffer* const tint_symbol_6) { bool test_int_S1_c0_b(const constant UniformBuffer* const tint_symbol_6) {
int unknown = 0; int unknown = 0;
bool ok = false; bool ok = false;

View File

@ -1,9 +1,9 @@
RWByteAddressBuffer b : register(u0, space0);
uint tint_mod(uint lhs, uint rhs) { uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs)); return (lhs % ((rhs == 0u) ? 1u : rhs));
} }
RWByteAddressBuffer b : register(u0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
uint i = 0u; uint i = 0u;

View File

@ -1,9 +1,9 @@
RWByteAddressBuffer b : register(u0, space0);
uint tint_mod(uint lhs, uint rhs) { uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs)); return (lhs % ((rhs == 0u) ? 1u : rhs));
} }
RWByteAddressBuffer b : register(u0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
uint i = 0u; uint i = 0u;

View File

@ -1,9 +1,5 @@
#version 310 es #version 310 es
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
struct Buf { struct Buf {
uint count; uint count;
uint data[50]; uint data[50];
@ -13,6 +9,10 @@ layout(binding = 0, std430) buffer b_block_ssbo {
Buf inner; Buf inner;
} b; } b;
uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs));
}
void tint_symbol() { void tint_symbol() {
uint i = 0u; uint i = 0u;
while (true) { while (true) {

View File

@ -14,15 +14,15 @@ struct tint_array {
T elements[N]; T elements[N];
}; };
uint tint_mod(uint lhs, uint rhs) {
return (lhs % select(rhs, 1u, (rhs == 0u)));
}
struct Buf { struct Buf {
/* 0x0000 */ uint count; /* 0x0000 */ uint count;
/* 0x0004 */ tint_array<uint, 50> data; /* 0x0004 */ tint_array<uint, 50> data;
}; };
uint tint_mod(uint lhs, uint rhs) {
return (lhs % select(rhs, 1u, (rhs == 0u)));
}
kernel void tint_symbol(device Buf* tint_symbol_2 [[buffer(0)]]) { kernel void tint_symbol(device Buf* tint_symbol_2 [[buffer(0)]]) {
uint i = 0u; uint i = 0u;
while (true) { while (true) {

View File

@ -1,7 +1,3 @@
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
ByteAddressBuffer firstMatrix : register(t0, space0); ByteAddressBuffer firstMatrix : register(t0, space0);
ByteAddressBuffer secondMatrix : register(t1, space0); ByteAddressBuffer secondMatrix : register(t1, space0);
RWByteAddressBuffer resultMatrix : register(u2, space0); RWByteAddressBuffer resultMatrix : register(u2, space0);
@ -47,6 +43,10 @@ void mm_write(uint row, uint col, float value) {
groupshared float mm_Asub[64][64]; groupshared float mm_Asub[64][64];
groupshared float mm_Bsub[64][64]; groupshared float mm_Bsub[64][64];
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
struct tint_symbol_1 { struct tint_symbol_1 {
uint3 local_id : SV_GroupThreadID; uint3 local_id : SV_GroupThreadID;
uint local_invocation_index : SV_GroupIndex; uint local_invocation_index : SV_GroupIndex;

View File

@ -1,7 +1,3 @@
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
ByteAddressBuffer firstMatrix : register(t0, space0); ByteAddressBuffer firstMatrix : register(t0, space0);
ByteAddressBuffer secondMatrix : register(t1, space0); ByteAddressBuffer secondMatrix : register(t1, space0);
RWByteAddressBuffer resultMatrix : register(u2, space0); RWByteAddressBuffer resultMatrix : register(u2, space0);
@ -47,6 +43,10 @@ void mm_write(uint row, uint col, float value) {
groupshared float mm_Asub[64][64]; groupshared float mm_Asub[64][64];
groupshared float mm_Bsub[64][64]; groupshared float mm_Bsub[64][64];
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
struct tint_symbol_1 { struct tint_symbol_1 {
uint3 local_id : SV_GroupThreadID; uint3 local_id : SV_GroupThreadID;
uint local_invocation_index : SV_GroupIndex; uint local_invocation_index : SV_GroupIndex;

View File

@ -1,9 +1,5 @@
#version 310 es #version 310 es
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
struct Uniforms { struct Uniforms {
uint dimAOuter; uint dimAOuter;
uint dimInner; uint dimInner;
@ -64,6 +60,10 @@ void mm_write(uint row, uint col, float value) {
shared float mm_Asub[64][64]; shared float mm_Asub[64][64];
shared float mm_Bsub[64][64]; shared float mm_Bsub[64][64];
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) {
{ {
for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) { for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) {

View File

@ -14,10 +14,6 @@ struct tint_array {
T elements[N]; T elements[N];
}; };
uint tint_div(uint lhs, uint rhs) {
return (lhs / select(rhs, 1u, (rhs == 0u)));
}
struct Uniforms { struct Uniforms {
/* 0x0000 */ uint dimAOuter; /* 0x0000 */ uint dimAOuter;
/* 0x0004 */ uint dimInner; /* 0x0004 */ uint dimInner;
@ -51,6 +47,10 @@ void mm_write(uint row, uint col, float value, const constant Uniforms* const ti
} }
} }
uint tint_div(uint lhs, uint rhs) {
return (lhs / select(rhs, 1u, (rhs == 0u)));
}
void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_index, threadgroup tint_array<tint_array<float, 64>, 64>* const tint_symbol_10, threadgroup tint_array<tint_array<float, 64>, 64>* const tint_symbol_11, const constant Uniforms* const tint_symbol_12, const device Matrix* const tint_symbol_13, const device Matrix* const tint_symbol_14, device Matrix* const tint_symbol_15) { void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_index, threadgroup tint_array<tint_array<float, 64>, 64>* const tint_symbol_10, threadgroup tint_array<tint_array<float, 64>, 64>* const tint_symbol_11, const constant Uniforms* const tint_symbol_12, const device Matrix* const tint_symbol_13, const device Matrix* const tint_symbol_14, device Matrix* const tint_symbol_15) {
for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) { for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) {
uint const i = (idx / 64u); uint const i = (idx / 64u);

View File

@ -24,9 +24,6 @@
OpName %uniforms "uniforms" OpName %uniforms "uniforms"
OpName %mm_Asub "mm_Asub" OpName %mm_Asub "mm_Asub"
OpName %mm_Bsub "mm_Bsub" OpName %mm_Bsub "mm_Bsub"
OpName %tint_div "tint_div"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %mm_readA "mm_readA" OpName %mm_readA "mm_readA"
OpName %row "row" OpName %row "row"
OpName %col "col" OpName %col "col"
@ -41,6 +38,9 @@
OpName %row_1 "row" OpName %row_1 "row"
OpName %col_1 "col" OpName %col_1 "col"
OpName %value "value" OpName %value "value"
OpName %tint_div "tint_div"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpName %main_inner "main_inner" OpName %main_inner "main_inner"
OpName %local_id "local_id" OpName %local_id "local_id"
OpName %global_id "global_id" OpName %global_id "global_id"
@ -112,22 +112,22 @@
%_ptr_Workgroup__arr__arr_float_uint_64_uint_64 = OpTypePointer Workgroup %_arr__arr_float_uint_64_uint_64 %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 = OpTypePointer Workgroup %_arr__arr_float_uint_64_uint_64
%mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup %mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup
%mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup %mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup
%25 = OpTypeFunction %uint %uint %uint %25 = OpTypeFunction %float %uint %uint
%31 = OpConstantNull %uint
%bool = OpTypeBool %bool = OpTypeBool
%uint_1 = OpConstant %uint 1
%36 = OpTypeFunction %float %uint %uint
%_ptr_Function_bool = OpTypePointer Function %bool %_ptr_Function_bool = OpTypePointer Function %bool
%43 = OpConstantNull %bool %33 = OpConstantNull %bool
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%46 = OpConstantNull %float %36 = OpConstantNull %float
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%true = OpConstantTrue %bool %true = OpConstantTrue %bool
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%void = OpTypeVoid %void = OpTypeVoid
%102 = OpTypeFunction %void %uint %uint %float %93 = OpTypeFunction %void %uint %uint %float
%116 = OpTypeFunction %uint %uint %uint
%122 = OpConstantNull %uint
%125 = OpTypeFunction %void %v3uint %v3uint %uint %125 = OpTypeFunction %void %v3uint %v3uint %uint
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%uint_4096 = OpConstant %uint 4096 %uint_4096 = OpConstant %uint 4096
@ -143,152 +143,152 @@
%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 %_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4
%178 = OpConstantNull %_arr_float_uint_4 %178 = OpConstantNull %_arr_float_uint_4
%390 = OpTypeFunction %void %390 = OpTypeFunction %void
%tint_div = OpFunction %uint None %25 %mm_readA = OpFunction %float None %25
%lhs = OpFunctionParameter %uint
%rhs = OpFunctionParameter %uint
%29 = OpLabel
%32 = OpIEqual %bool %rhs %31
%30 = OpSelect %uint %32 %uint_1 %rhs
%35 = OpUDiv %uint %lhs %30
OpReturnValue %35
OpFunctionEnd
%mm_readA = OpFunction %float None %36
%row = OpFunctionParameter %uint %row = OpFunctionParameter %uint
%col = OpFunctionParameter %uint %col = OpFunctionParameter %uint
%40 = OpLabel %29 = OpLabel
%tint_return_flag = OpVariable %_ptr_Function_bool Function %43 %tint_return_flag = OpVariable %_ptr_Function_bool Function %33
%tint_return_value = OpVariable %_ptr_Function_float Function %46 %tint_return_value = OpVariable %_ptr_Function_float Function %36
%49 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 %39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%50 = OpLoad %uint %49 %40 = OpLoad %uint %39
%51 = OpULessThan %bool %row %50 %41 = OpULessThan %bool %row %40
OpSelectionMerge %52 None OpSelectionMerge %42 None
OpBranchConditional %51 %53 %52 OpBranchConditional %41 %43 %42
%53 = OpLabel %43 = OpLabel
%54 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 %45 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%55 = OpLoad %uint %54 %46 = OpLoad %uint %45
%56 = OpULessThan %bool %col %55 %47 = OpULessThan %bool %col %46
OpBranch %52 OpBranch %42
%52 = OpLabel %42 = OpLabel
%57 = OpPhi %bool %51 %40 %56 %53 %48 = OpPhi %bool %41 %29 %47 %43
OpSelectionMerge %58 None OpSelectionMerge %49 None
OpBranchConditional %57 %59 %58 OpBranchConditional %48 %50 %49
%59 = OpLabel %50 = OpLabel
%60 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 %51 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%61 = OpLoad %uint %60 %52 = OpLoad %uint %51
%62 = OpIMul %uint %row %61 %53 = OpIMul %uint %row %52
%63 = OpIAdd %uint %62 %col %54 = OpIAdd %uint %53 %col
%65 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %63 %56 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %54
%66 = OpLoad %float %65 %57 = OpLoad %float %56
OpStore %tint_return_flag %true OpStore %tint_return_flag %true
OpStore %tint_return_value %66 OpStore %tint_return_value %57
OpBranch %58 OpBranch %49
%58 = OpLabel %49 = OpLabel
%69 = OpLoad %bool %tint_return_flag %60 = OpLoad %bool %tint_return_flag
%68 = OpLogicalNot %bool %69 %59 = OpLogicalNot %bool %60
OpSelectionMerge %70 None OpSelectionMerge %61 None
OpBranchConditional %68 %71 %70 OpBranchConditional %59 %62 %61
%71 = OpLabel %62 = OpLabel
OpStore %tint_return_flag %true OpStore %tint_return_flag %true
OpStore %tint_return_value %46 OpStore %tint_return_value %36
OpBranch %70 OpBranch %61
%70 = OpLabel %61 = OpLabel
%72 = OpLoad %float %tint_return_value %63 = OpLoad %float %tint_return_value
OpReturnValue %72 OpReturnValue %63
OpFunctionEnd OpFunctionEnd
%mm_readB = OpFunction %float None %36 %mm_readB = OpFunction %float None %25
%row_0 = OpFunctionParameter %uint %row_0 = OpFunctionParameter %uint
%col_0 = OpFunctionParameter %uint %col_0 = OpFunctionParameter %uint
%76 = OpLabel %67 = OpLabel
%tint_return_flag_1 = OpVariable %_ptr_Function_bool Function %43 %tint_return_flag_1 = OpVariable %_ptr_Function_bool Function %33
%tint_return_value_1 = OpVariable %_ptr_Function_float Function %46 %tint_return_value_1 = OpVariable %_ptr_Function_float Function %36
%79 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 %70 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%80 = OpLoad %uint %79 %71 = OpLoad %uint %70
%81 = OpULessThan %bool %row_0 %80 %72 = OpULessThan %bool %row_0 %71
OpSelectionMerge %82 None OpSelectionMerge %73 None
OpBranchConditional %81 %83 %82 OpBranchConditional %72 %74 %73
%83 = OpLabel %74 = OpLabel
%85 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 %76 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2
%86 = OpLoad %uint %85 %77 = OpLoad %uint %76
%87 = OpULessThan %bool %col_0 %86 %78 = OpULessThan %bool %col_0 %77
OpBranch %82 OpBranch %73
%82 = OpLabel %73 = OpLabel
%88 = OpPhi %bool %81 %76 %87 %83 %79 = OpPhi %bool %72 %67 %78 %74
OpSelectionMerge %89 None OpSelectionMerge %80 None
OpBranchConditional %88 %90 %89 OpBranchConditional %79 %81 %80
%81 = OpLabel
%82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2
%83 = OpLoad %uint %82
%84 = OpIMul %uint %row_0 %83
%85 = OpIAdd %uint %84 %col_0
%86 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %85
%87 = OpLoad %float %86
OpStore %tint_return_flag_1 %true
OpStore %tint_return_value_1 %87
OpBranch %80
%80 = OpLabel
%89 = OpLoad %bool %tint_return_flag_1
%88 = OpLogicalNot %bool %89
OpSelectionMerge %90 None
OpBranchConditional %88 %91 %90
%91 = OpLabel
OpStore %tint_return_flag_1 %true
OpStore %tint_return_value_1 %36
OpBranch %90
%90 = OpLabel %90 = OpLabel
%91 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 %92 = OpLoad %float %tint_return_value_1
%92 = OpLoad %uint %91 OpReturnValue %92
%93 = OpIMul %uint %row_0 %92
%94 = OpIAdd %uint %93 %col_0
%95 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %94
%96 = OpLoad %float %95
OpStore %tint_return_flag_1 %true
OpStore %tint_return_value_1 %96
OpBranch %89
%89 = OpLabel
%98 = OpLoad %bool %tint_return_flag_1
%97 = OpLogicalNot %bool %98
OpSelectionMerge %99 None
OpBranchConditional %97 %100 %99
%100 = OpLabel
OpStore %tint_return_flag_1 %true
OpStore %tint_return_value_1 %46
OpBranch %99
%99 = OpLabel
%101 = OpLoad %float %tint_return_value_1
OpReturnValue %101
OpFunctionEnd OpFunctionEnd
%mm_write = OpFunction %void None %102 %mm_write = OpFunction %void None %93
%row_1 = OpFunctionParameter %uint %row_1 = OpFunctionParameter %uint
%col_1 = OpFunctionParameter %uint %col_1 = OpFunctionParameter %uint
%value = OpFunctionParameter %float %value = OpFunctionParameter %float
%108 = OpLabel %99 = OpLabel
%109 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 %100 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%110 = OpLoad %uint %109 %101 = OpLoad %uint %100
%111 = OpULessThan %bool %row_1 %110 %102 = OpULessThan %bool %row_1 %101
OpSelectionMerge %112 None OpSelectionMerge %103 None
OpBranchConditional %111 %113 %112 OpBranchConditional %102 %104 %103
%113 = OpLabel %104 = OpLabel
%114 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 %105 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2
%115 = OpLoad %uint %114 %106 = OpLoad %uint %105
%116 = OpULessThan %bool %col_1 %115 %107 = OpULessThan %bool %col_1 %106
OpBranch %112 OpBranch %103
%112 = OpLabel %103 = OpLabel
%117 = OpPhi %bool %111 %108 %116 %113 %108 = OpPhi %bool %102 %99 %107 %104
OpSelectionMerge %118 None OpSelectionMerge %109 None
OpBranchConditional %117 %119 %118 OpBranchConditional %108 %110 %109
%119 = OpLabel %110 = OpLabel
%120 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 %111 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2
%121 = OpLoad %uint %120 %112 = OpLoad %uint %111
%122 = OpIMul %uint %row_1 %121 %113 = OpIMul %uint %row_1 %112
%123 = OpIAdd %uint %col_1 %122 %114 = OpIAdd %uint %col_1 %113
%124 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %123 %115 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %114
OpStore %124 %value OpStore %115 %value
OpBranch %118 OpBranch %109
%118 = OpLabel %109 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%tint_div = OpFunction %uint None %116
%lhs = OpFunctionParameter %uint
%rhs = OpFunctionParameter %uint
%120 = OpLabel
%123 = OpIEqual %bool %rhs %122
%121 = OpSelect %uint %123 %uint_1 %rhs
%124 = OpUDiv %uint %lhs %121
OpReturnValue %124
OpFunctionEnd
%main_inner = OpFunction %void None %125 %main_inner = OpFunction %void None %125
%local_id = OpFunctionParameter %v3uint %local_id = OpFunctionParameter %v3uint
%global_id = OpFunctionParameter %v3uint %global_id = OpFunctionParameter %v3uint
%local_invocation_index = OpFunctionParameter %uint %local_invocation_index = OpFunctionParameter %uint
%130 = OpLabel %130 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %31 %idx = OpVariable %_ptr_Function_uint Function %122
%acc = OpVariable %_ptr_Function__arr_float_uint_16 Function %173 %acc = OpVariable %_ptr_Function__arr_float_uint_16 Function %173
%ACached = OpVariable %_ptr_Function_float Function %46 %ACached = OpVariable %_ptr_Function_float Function %36
%BCached = OpVariable %_ptr_Function__arr_float_uint_4 Function %178 %BCached = OpVariable %_ptr_Function__arr_float_uint_4 Function %178
%index = OpVariable %_ptr_Function_uint Function %31 %index = OpVariable %_ptr_Function_uint Function %122
%t = OpVariable %_ptr_Function_uint Function %31 %t = OpVariable %_ptr_Function_uint Function %122
%innerRow = OpVariable %_ptr_Function_uint Function %31 %innerRow = OpVariable %_ptr_Function_uint Function %122
%innerCol = OpVariable %_ptr_Function_uint Function %31 %innerCol = OpVariable %_ptr_Function_uint Function %122
%innerRow_0 = OpVariable %_ptr_Function_uint Function %31 %innerRow_0 = OpVariable %_ptr_Function_uint Function %122
%innerCol_0 = OpVariable %_ptr_Function_uint Function %31 %innerCol_0 = OpVariable %_ptr_Function_uint Function %122
%k = OpVariable %_ptr_Function_uint Function %31 %k = OpVariable %_ptr_Function_uint Function %122
%inner = OpVariable %_ptr_Function_uint Function %31 %inner = OpVariable %_ptr_Function_uint Function %122
%innerRow_1 = OpVariable %_ptr_Function_uint Function %31 %innerRow_1 = OpVariable %_ptr_Function_uint Function %122
%innerCol_1 = OpVariable %_ptr_Function_uint Function %31 %innerCol_1 = OpVariable %_ptr_Function_uint Function %122
%innerRow_2 = OpVariable %_ptr_Function_uint Function %31 %innerRow_2 = OpVariable %_ptr_Function_uint Function %122
%innerCol_2 = OpVariable %_ptr_Function_uint Function %31 %innerCol_2 = OpVariable %_ptr_Function_uint Function %122
OpStore %idx %local_invocation_index OpStore %idx %local_invocation_index
OpBranch %133 OpBranch %133
%133 = OpLabel %133 = OpLabel
@ -308,9 +308,9 @@
%145 = OpLoad %uint %idx %145 = OpLoad %uint %idx
%146 = OpUMod %uint %145 %uint_64 %146 = OpUMod %uint %145 %uint_64
%148 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %144 %146 %148 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %144 %146
OpStore %148 %46 OpStore %148 %36
%149 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %144 %146 %149 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %144 %146
OpStore %149 %46 OpStore %149 %36
OpBranch %135 OpBranch %135
%135 = OpLabel %135 = OpLabel
%150 = OpLoad %uint %idx %150 = OpLoad %uint %idx
@ -332,7 +332,7 @@
%167 = OpISub %uint %166 %uint_1 %167 = OpISub %uint %166 %uint_1
%164 = OpFunctionCall %uint %tint_div %167 %uint_64 %164 = OpFunctionCall %uint %tint_div %167 %uint_64
%168 = OpIAdd %uint %164 %uint_1 %168 = OpIAdd %uint %164 %uint_1
OpStore %index %31 OpStore %index %122
OpBranch %180 OpBranch %180
%180 = OpLabel %180 = OpLabel
OpLoopMerge %181 %182 None OpLoopMerge %181 %182 None
@ -348,7 +348,7 @@
%187 = OpLabel %187 = OpLabel
%189 = OpLoad %uint %index %189 = OpLoad %uint %index
%190 = OpAccessChain %_ptr_Function_float %acc %189 %190 = OpAccessChain %_ptr_Function_float %acc %189
OpStore %190 %46 OpStore %190 %36
OpBranch %182 OpBranch %182
%182 = OpLabel %182 = OpLabel
%191 = OpLoad %uint %index %191 = OpLoad %uint %index
@ -360,7 +360,7 @@
%194 = OpIMul %uint %193 %uint_4 %194 = OpIMul %uint %193 %uint_4
%195 = OpCompositeExtract %uint %local_id 1 %195 = OpCompositeExtract %uint %local_id 1
%196 = OpIMul %uint %195 %uint_4 %196 = OpIMul %uint %195 %uint_4
OpStore %t %31 OpStore %t %122
OpBranch %198 OpBranch %198
%198 = OpLabel %198 = OpLabel
OpLoopMerge %199 %200 None OpLoopMerge %199 %200 None
@ -374,7 +374,7 @@
%206 = OpLabel %206 = OpLabel
OpBranch %199 OpBranch %199
%205 = OpLabel %205 = OpLabel
OpStore %innerRow %31 OpStore %innerRow %122
OpBranch %208 OpBranch %208
%208 = OpLabel %208 = OpLabel
OpLoopMerge %209 %210 None OpLoopMerge %209 %210 None
@ -388,7 +388,7 @@
%216 = OpLabel %216 = OpLabel
OpBranch %209 OpBranch %209
%215 = OpLabel %215 = OpLabel
OpStore %innerCol %31 OpStore %innerCol %122
OpBranch %218 OpBranch %218
%218 = OpLabel %218 = OpLabel
OpLoopMerge %219 %220 None OpLoopMerge %219 %220 None
@ -428,7 +428,7 @@
OpStore %innerRow %241 OpStore %innerRow %241
OpBranch %208 OpBranch %208
%209 = OpLabel %209 = OpLabel
OpStore %innerRow_0 %31 OpStore %innerRow_0 %122
OpBranch %243 OpBranch %243
%243 = OpLabel %243 = OpLabel
OpLoopMerge %244 %245 None OpLoopMerge %244 %245 None
@ -442,7 +442,7 @@
%251 = OpLabel %251 = OpLabel
OpBranch %244 OpBranch %244
%250 = OpLabel %250 = OpLabel
OpStore %innerCol_0 %31 OpStore %innerCol_0 %122
OpBranch %253 OpBranch %253
%253 = OpLabel %253 = OpLabel
OpLoopMerge %254 %255 None OpLoopMerge %254 %255 None
@ -484,7 +484,7 @@
OpBranch %243 OpBranch %243
%244 = OpLabel %244 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264 OpControlBarrier %uint_2 %uint_2 %uint_264
OpStore %k %31 OpStore %k %122
OpBranch %280 OpBranch %280
%280 = OpLabel %280 = OpLabel
OpLoopMerge %281 %282 None OpLoopMerge %281 %282 None
@ -498,7 +498,7 @@
%288 = OpLabel %288 = OpLabel
OpBranch %281 OpBranch %281
%287 = OpLabel %287 = OpLabel
OpStore %inner %31 OpStore %inner %122
OpBranch %290 OpBranch %290
%290 = OpLabel %290 = OpLabel
OpLoopMerge %291 %292 None OpLoopMerge %291 %292 None
@ -527,7 +527,7 @@
OpStore %inner %307 OpStore %inner %307
OpBranch %290 OpBranch %290
%291 = OpLabel %291 = OpLabel
OpStore %innerRow_1 %31 OpStore %innerRow_1 %122
OpBranch %309 OpBranch %309
%309 = OpLabel %309 = OpLabel
OpLoopMerge %310 %311 None OpLoopMerge %310 %311 None
@ -547,7 +547,7 @@
%321 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %319 %320 %321 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %319 %320
%322 = OpLoad %float %321 %322 = OpLoad %float %321
OpStore %ACached %322 OpStore %ACached %322
OpStore %innerCol_1 %31 OpStore %innerCol_1 %122
OpBranch %324 OpBranch %324
%324 = OpLabel %324 = OpLabel
OpLoopMerge %325 %326 None OpLoopMerge %325 %326 None
@ -604,7 +604,7 @@
OpStore %t %354 OpStore %t %354
OpBranch %198 OpBranch %198
%199 = OpLabel %199 = OpLabel
OpStore %innerRow_2 %31 OpStore %innerRow_2 %122
OpBranch %356 OpBranch %356
%356 = OpLabel %356 = OpLabel
OpLoopMerge %357 %358 None OpLoopMerge %357 %358 None
@ -618,7 +618,7 @@
%364 = OpLabel %364 = OpLabel
OpBranch %357 OpBranch %357
%363 = OpLabel %363 = OpLabel
OpStore %innerCol_2 %31 OpStore %innerCol_2 %122
OpBranch %366 OpBranch %366
%366 = OpLabel %366 = OpLabel
OpLoopMerge %367 %368 None OpLoopMerge %367 %368 None

View File

@ -1,7 +1,3 @@
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
SamplerState samp : register(s0, space0); SamplerState samp : register(s0, space0);
cbuffer cbuffer_params : register(b1, space0) { cbuffer cbuffer_params : register(b1, space0) {
uint4 params[1]; uint4 params[1];
@ -14,6 +10,10 @@ cbuffer cbuffer_flip : register(b3, space1) {
}; };
groupshared float3 tile[4][256]; groupshared float3 tile[4][256];
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
struct tint_symbol_1 { struct tint_symbol_1 {
uint3 LocalInvocationID : SV_GroupThreadID; uint3 LocalInvocationID : SV_GroupThreadID;
uint local_invocation_index : SV_GroupIndex; uint local_invocation_index : SV_GroupIndex;

View File

@ -1,7 +1,3 @@
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
SamplerState samp : register(s0, space0); SamplerState samp : register(s0, space0);
cbuffer cbuffer_params : register(b1, space0) { cbuffer cbuffer_params : register(b1, space0) {
uint4 params[1]; uint4 params[1];
@ -14,6 +10,10 @@ cbuffer cbuffer_flip : register(b3, space1) {
}; };
groupshared float3 tile[4][256]; groupshared float3 tile[4][256];
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
struct tint_symbol_1 { struct tint_symbol_1 {
uint3 LocalInvocationID : SV_GroupThreadID; uint3 LocalInvocationID : SV_GroupThreadID;
uint local_invocation_index : SV_GroupIndex; uint local_invocation_index : SV_GroupIndex;

View File

@ -1,9 +1,5 @@
#version 310 es #version 310 es
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
struct Params { struct Params {
uint filterDim; uint filterDim;
uint blockDim; uint blockDim;
@ -28,6 +24,10 @@ layout(binding = 3, std140) uniform flip_block_ubo {
} flip; } flip;
shared vec3 tile[4][256]; shared vec3 tile[4][256];
uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs));
}
uniform highp sampler2D inputTex_1; uniform highp sampler2D inputTex_1;
uniform highp sampler2D inputTex_samp; uniform highp sampler2D inputTex_samp;

View File

@ -14,10 +14,6 @@ struct tint_array {
T elements[N]; T elements[N];
}; };
uint tint_div(uint lhs, uint rhs) {
return (lhs / select(rhs, 1u, (rhs == 0u)));
}
struct Params { struct Params {
/* 0x0000 */ uint filterDim; /* 0x0000 */ uint filterDim;
/* 0x0004 */ uint blockDim; /* 0x0004 */ uint blockDim;
@ -27,6 +23,10 @@ struct Flip {
/* 0x0000 */ uint value; /* 0x0000 */ uint value;
}; };
uint tint_div(uint lhs, uint rhs) {
return (lhs / select(rhs, 1u, (rhs == 0u)));
}
void tint_symbol_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index, threadgroup tint_array<tint_array<float3, 256>, 4>* const tint_symbol_1, const constant Params* const tint_symbol_2, texture2d<float, access::sample> tint_symbol_3, const constant Flip* const tint_symbol_4, sampler tint_symbol_5, texture2d<float, access::write> tint_symbol_6) { void tint_symbol_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index, threadgroup tint_array<tint_array<float3, 256>, 4>* const tint_symbol_1, const constant Params* const tint_symbol_2, texture2d<float, access::sample> tint_symbol_3, const constant Flip* const tint_symbol_4, sampler tint_symbol_5, texture2d<float, access::write> tint_symbol_6) {
for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) { for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) {
uint const i_1 = (idx / 256u); uint const i_1 = (idx / 256u);

View File

@ -1,3 +1,6 @@
static uint local_invocation_index_1 = 0u;
groupshared uint wg[3][2][1];
uint tint_div(uint lhs, uint rhs) { uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs)); return (lhs / ((rhs == 0u) ? 1u : rhs));
} }
@ -6,9 +9,6 @@ uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs)); return (lhs % ((rhs == 0u) ? 1u : rhs));
} }
static uint local_invocation_index_1 = 0u;
groupshared uint wg[3][2][1];
void compute_main_inner(uint local_invocation_index) { void compute_main_inner(uint local_invocation_index) {
uint idx = 0u; uint idx = 0u;
idx = local_invocation_index; idx = local_invocation_index;

View File

@ -1,3 +1,6 @@
static uint local_invocation_index_1 = 0u;
groupshared uint wg[3][2][1];
uint tint_div(uint lhs, uint rhs) { uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs)); return (lhs / ((rhs == 0u) ? 1u : rhs));
} }
@ -6,9 +9,6 @@ uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs)); return (lhs % ((rhs == 0u) ? 1u : rhs));
} }
static uint local_invocation_index_1 = 0u;
groupshared uint wg[3][2][1];
void compute_main_inner(uint local_invocation_index) { void compute_main_inner(uint local_invocation_index) {
uint idx = 0u; uint idx = 0u;
idx = local_invocation_index; idx = local_invocation_index;

View File

@ -1,5 +1,7 @@
#version 310 es #version 310 es
uint local_invocation_index_1 = 0u;
shared uint wg[3][2][1];
uint tint_div(uint lhs, uint rhs) { uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs)); return (lhs / ((rhs == 0u) ? 1u : rhs));
} }
@ -8,8 +10,6 @@ uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs)); return (lhs % ((rhs == 0u) ? 1u : rhs));
} }
uint local_invocation_index_1 = 0u;
shared uint wg[3][2][1];
void compute_main_inner(uint local_invocation_index) { void compute_main_inner(uint local_invocation_index) {
uint idx = 0u; uint idx = 0u;
idx = local_invocation_index; idx = local_invocation_index;

View File

@ -1,3 +1,6 @@
static uint local_invocation_index_1 = 0u;
groupshared uint wg[3][2][1];
uint tint_div(uint lhs, uint rhs) { uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs)); return (lhs / ((rhs == 0u) ? 1u : rhs));
} }
@ -6,9 +9,6 @@ uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs)); return (lhs % ((rhs == 0u) ? 1u : rhs));
} }
static uint local_invocation_index_1 = 0u;
groupshared uint wg[3][2][1];
void compute_main_inner(uint local_invocation_index) { void compute_main_inner(uint local_invocation_index) {
uint idx = 0u; uint idx = 0u;
idx = local_invocation_index; idx = local_invocation_index;

View File

@ -1,3 +1,6 @@
static uint local_invocation_index_1 = 0u;
groupshared uint wg[3][2][1];
uint tint_div(uint lhs, uint rhs) { uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs)); return (lhs / ((rhs == 0u) ? 1u : rhs));
} }
@ -6,9 +9,6 @@ uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs)); return (lhs % ((rhs == 0u) ? 1u : rhs));
} }
static uint local_invocation_index_1 = 0u;
groupshared uint wg[3][2][1];
void compute_main_inner(uint local_invocation_index) { void compute_main_inner(uint local_invocation_index) {
uint idx = 0u; uint idx = 0u;
idx = local_invocation_index; idx = local_invocation_index;

View File

@ -1,5 +1,7 @@
#version 310 es #version 310 es
uint local_invocation_index_1 = 0u;
shared uint wg[3][2][1];
uint tint_div(uint lhs, uint rhs) { uint tint_div(uint lhs, uint rhs) {
return (lhs / ((rhs == 0u) ? 1u : rhs)); return (lhs / ((rhs == 0u) ? 1u : rhs));
} }
@ -8,8 +10,6 @@ uint tint_mod(uint lhs, uint rhs) {
return (lhs % ((rhs == 0u) ? 1u : rhs)); return (lhs % ((rhs == 0u) ? 1u : rhs));
} }
uint local_invocation_index_1 = 0u;
shared uint wg[3][2][1];
void compute_main_inner(uint local_invocation_index) { void compute_main_inner(uint local_invocation_index) {
uint idx = 0u; uint idx = 0u;
idx = local_invocation_index; idx = local_invocation_index;

View File

@ -3,6 +3,9 @@ void unused_entry_point() {
return; return;
} }
static int a = 0;
static float b = 0.0f;
int tint_div(int lhs, int rhs) { int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs)); return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
} }
@ -11,9 +14,6 @@ int tint_mod(int lhs, int rhs) {
return (lhs % (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs)); return (lhs % (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
} }
static int a = 0;
static float b = 0.0f;
void foo(int maybe_zero) { void foo(int maybe_zero) {
a = tint_div(a, 0); a = tint_div(a, 0);
a = tint_mod(a, 0); a = tint_mod(a, 0);

View File

@ -3,6 +3,9 @@ void unused_entry_point() {
return; return;
} }
static int a = 0;
static float b = 0.0f;
int tint_div(int lhs, int rhs) { int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs)); return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
} }
@ -11,9 +14,6 @@ int tint_mod(int lhs, int rhs) {
return (lhs % (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs)); return (lhs % (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
} }
static int a = 0;
static float b = 0.0f;
void foo(int maybe_zero) { void foo(int maybe_zero) {
a = tint_div(a, 0); a = tint_div(a, 0);
a = tint_mod(a, 0); a = tint_mod(a, 0);

View File

@ -9,6 +9,8 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
int a = 0;
float b = 0.0f;
int tint_div(int lhs, int rhs) { int tint_div(int lhs, int rhs) {
return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs)); return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs));
} }
@ -17,8 +19,6 @@ int tint_mod(int lhs, int rhs) {
return (lhs % (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs)); return (lhs % (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs));
} }
int a = 0;
float b = 0.0f;
void foo(int maybe_zero) { void foo(int maybe_zero) {
a = tint_div(a, 0); a = tint_div(a, 0);
a = tint_mod(a, 0); a = tint_mod(a, 0);

View File

@ -3,14 +3,14 @@ void unused_entry_point() {
return; return;
} }
int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
}
static int a = 0; static int a = 0;
static float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f); static float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f); static float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
}
void foo() { void foo() {
a = tint_div(a, 2); a = tint_div(a, 2);
b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b);

View File

@ -3,14 +3,14 @@ void unused_entry_point() {
return; return;
} }
int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
}
static int a = 0; static int a = 0;
static float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f); static float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f); static float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
}
void foo() { void foo() {
a = tint_div(a, 2); a = tint_div(a, 2);
b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b);

View File

@ -4,13 +4,13 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
int a = 0;
vec4 b = vec4(0.0f, 0.0f, 0.0f, 0.0f);
mat2 c = mat2(0.0f, 0.0f, 0.0f, 0.0f);
int tint_div(int lhs, int rhs) { int tint_div(int lhs, int rhs) {
return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs)); return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs));
} }
int a = 0;
vec4 b = vec4(0.0f, 0.0f, 0.0f, 0.0f);
mat2 c = mat2(0.0f, 0.0f, 0.0f, 0.0f);
void foo() { void foo() {
a = tint_div(a, 2); a = tint_div(a, 2);
b = (b * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); b = (b * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)));

View File

@ -3,12 +3,12 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int tint_div(int lhs, int rhs) { int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs)); return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int tint_symbol = tint_div(asint(v.Load(0u)), 2); const int tint_symbol = tint_div(asint(v.Load(0u)), 2);
v.Store(0u, asuint(tint_symbol)); v.Store(0u, asuint(tint_symbol));

View File

@ -3,12 +3,12 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int tint_div(int lhs, int rhs) { int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs)); return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int tint_symbol = tint_div(asint(v.Load(0u)), 2); const int tint_symbol = tint_div(asint(v.Load(0u)), 2);
v.Store(0u, asuint(tint_symbol)); v.Store(0u, asuint(tint_symbol));

View File

@ -4,10 +4,6 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
int tint_div(int lhs, int rhs) {
return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs));
}
struct S { struct S {
int a; int a;
}; };
@ -16,6 +12,10 @@ layout(binding = 0, std430) buffer v_block_ssbo {
S inner; S inner;
} v; } v;
int tint_div(int lhs, int rhs) {
return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs));
}
void foo() { void foo() {
int tint_symbol = tint_div(v.inner.a, 2); int tint_symbol = tint_div(v.inner.a, 2);
v.inner.a = tint_symbol; v.inner.a = tint_symbol;

View File

@ -1,14 +1,14 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
int tint_div(int lhs, int rhs) {
return (lhs / select(rhs, 1, bool((rhs == 0) | bool((lhs == (-2147483647 - 1)) & (rhs == -1)))));
}
struct S { struct S {
/* 0x0000 */ int a; /* 0x0000 */ int a;
}; };
int tint_div(int lhs, int rhs) {
return (lhs / select(rhs, 1, bool((rhs == 0) | bool((lhs == (-2147483647 - 1)) & (rhs == -1)))));
}
void foo(device S* const tint_symbol_1) { void foo(device S* const tint_symbol_1) {
int const tint_symbol = tint_div((*(tint_symbol_1)).a, 2); int const tint_symbol = tint_div((*(tint_symbol_1)).a, 2);
(*(tint_symbol_1)).a = tint_symbol; (*(tint_symbol_1)).a = tint_symbol;

View File

@ -3,12 +3,12 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int tint_mod(int lhs, int rhs) { int tint_mod(int lhs, int rhs) {
return (lhs % (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs)); return (lhs % (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int tint_symbol = tint_mod(asint(v.Load(0u)), 2); const int tint_symbol = tint_mod(asint(v.Load(0u)), 2);
v.Store(0u, asuint(tint_symbol)); v.Store(0u, asuint(tint_symbol));

View File

@ -3,12 +3,12 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int tint_mod(int lhs, int rhs) { int tint_mod(int lhs, int rhs) {
return (lhs % (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs)); return (lhs % (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int tint_symbol = tint_mod(asint(v.Load(0u)), 2); const int tint_symbol = tint_mod(asint(v.Load(0u)), 2);
v.Store(0u, asuint(tint_symbol)); v.Store(0u, asuint(tint_symbol));

View File

@ -4,10 +4,6 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
int tint_mod(int lhs, int rhs) {
return (lhs % (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs));
}
struct S { struct S {
int a; int a;
}; };
@ -16,6 +12,10 @@ layout(binding = 0, std430) buffer v_block_ssbo {
S inner; S inner;
} v; } v;
int tint_mod(int lhs, int rhs) {
return (lhs % (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs));
}
void foo() { void foo() {
int tint_symbol = tint_mod(v.inner.a, 2); int tint_symbol = tint_mod(v.inner.a, 2);
v.inner.a = tint_symbol; v.inner.a = tint_symbol;

View File

@ -1,14 +1,14 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
int tint_mod(int lhs, int rhs) {
return (lhs % select(rhs, 1, bool((rhs == 0) | bool((lhs == (-2147483647 - 1)) & (rhs == -1)))));
}
struct S { struct S {
/* 0x0000 */ int a; /* 0x0000 */ int a;
}; };
int tint_mod(int lhs, int rhs) {
return (lhs % select(rhs, 1, bool((rhs == 0) | bool((lhs == (-2147483647 - 1)) & (rhs == -1)))));
}
void foo(device S* const tint_symbol_1) { void foo(device S* const tint_symbol_1) {
int const tint_symbol = tint_mod((*(tint_symbol_1)).a, 2); int const tint_symbol = tint_mod((*(tint_symbol_1)).a, 2);
(*(tint_symbol_1)).a = tint_symbol; (*(tint_symbol_1)).a = tint_symbol;

View File

@ -3,12 +3,12 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int4 tint_div(int4 lhs, int4 rhs) { int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs)); return (lhs / (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int4 tint_symbol = tint_div(asint(v.Load4(0u)), (2).xxxx); const int4 tint_symbol = tint_div(asint(v.Load4(0u)), (2).xxxx);
v.Store4(0u, asuint(tint_symbol)); v.Store4(0u, asuint(tint_symbol));

View File

@ -3,12 +3,12 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int4 tint_div(int4 lhs, int4 rhs) { int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs)); return (lhs / (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int4 tint_symbol = tint_div(asint(v.Load4(0u)), (2).xxxx); const int4 tint_symbol = tint_div(asint(v.Load4(0u)), (2).xxxx);
v.Store4(0u, asuint(tint_symbol)); v.Store4(0u, asuint(tint_symbol));

View File

@ -4,10 +4,6 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
ivec4 tint_div(ivec4 lhs, ivec4 rhs) {
return (lhs / mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4(-2147483648))) & uvec4(equal(rhs, ivec4(-1))))))));
}
struct S { struct S {
ivec4 a; ivec4 a;
}; };
@ -16,6 +12,10 @@ layout(binding = 0, std430) buffer v_block_ssbo {
S inner; S inner;
} v; } v;
ivec4 tint_div(ivec4 lhs, ivec4 rhs) {
return (lhs / mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4(-2147483648))) & uvec4(equal(rhs, ivec4(-1))))))));
}
void foo() { void foo() {
ivec4 tint_symbol = tint_div(v.inner.a, ivec4(2)); ivec4 tint_symbol = tint_div(v.inner.a, ivec4(2));
v.inner.a = tint_symbol; v.inner.a = tint_symbol;

View File

@ -1,14 +1,14 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / select(rhs, int4(1), ((rhs == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (rhs == int4(-1))))));
}
struct S { struct S {
/* 0x0000 */ int4 a; /* 0x0000 */ int4 a;
}; };
int4 tint_div(int4 lhs, int4 rhs) {
return (lhs / select(rhs, int4(1), ((rhs == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (rhs == int4(-1))))));
}
void foo(device S* const tint_symbol_1) { void foo(device S* const tint_symbol_1) {
int4 const tint_symbol = tint_div((*(tint_symbol_1)).a, int4(2)); int4 const tint_symbol = tint_div((*(tint_symbol_1)).a, int4(2));
(*(tint_symbol_1)).a = tint_symbol; (*(tint_symbol_1)).a = tint_symbol;

View File

@ -3,13 +3,13 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int4 tint_mod(int4 lhs, int rhs) { int4 tint_mod(int4 lhs, int rhs) {
const int4 r = int4((rhs).xxxx); const int4 r = int4((rhs).xxxx);
return (lhs % (((r == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (r == (-1).xxxx))) ? (1).xxxx : r)); return (lhs % (((r == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (r == (-1).xxxx))) ? (1).xxxx : r));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), 2); const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), 2);
v.Store4(0u, asuint(tint_symbol)); v.Store4(0u, asuint(tint_symbol));

View File

@ -3,13 +3,13 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int4 tint_mod(int4 lhs, int rhs) { int4 tint_mod(int4 lhs, int rhs) {
const int4 r = int4((rhs).xxxx); const int4 r = int4((rhs).xxxx);
return (lhs % (((r == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (r == (-1).xxxx))) ? (1).xxxx : r)); return (lhs % (((r == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (r == (-1).xxxx))) ? (1).xxxx : r));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), 2); const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), 2);
v.Store4(0u, asuint(tint_symbol)); v.Store4(0u, asuint(tint_symbol));

View File

@ -4,11 +4,6 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
ivec4 tint_mod(ivec4 lhs, int rhs) {
ivec4 r = ivec4(rhs);
return (lhs % mix(r, ivec4(1), bvec4(uvec4(equal(r, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4(-2147483648))) & uvec4(equal(r, ivec4(-1))))))));
}
struct S { struct S {
ivec4 a; ivec4 a;
}; };
@ -17,6 +12,11 @@ layout(binding = 0, std430) buffer v_block_ssbo {
S inner; S inner;
} v; } v;
ivec4 tint_mod(ivec4 lhs, int rhs) {
ivec4 r = ivec4(rhs);
return (lhs % mix(r, ivec4(1), bvec4(uvec4(equal(r, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4(-2147483648))) & uvec4(equal(r, ivec4(-1))))))));
}
void foo() { void foo() {
ivec4 tint_symbol = tint_mod(v.inner.a, 2); ivec4 tint_symbol = tint_mod(v.inner.a, 2);
v.inner.a = tint_symbol; v.inner.a = tint_symbol;

View File

@ -1,15 +1,15 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
struct S {
/* 0x0000 */ int4 a;
};
int4 tint_mod(int4 lhs, int rhs) { int4 tint_mod(int4 lhs, int rhs) {
int4 const r = int4(rhs); int4 const r = int4(rhs);
return (lhs % select(r, int4(1), ((r == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (r == int4(-1)))))); return (lhs % select(r, int4(1), ((r == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (r == int4(-1))))));
} }
struct S {
/* 0x0000 */ int4 a;
};
void foo(device S* const tint_symbol_1) { void foo(device S* const tint_symbol_1) {
int4 const tint_symbol = tint_mod((*(tint_symbol_1)).a, 2); int4 const tint_symbol = tint_mod((*(tint_symbol_1)).a, 2);
(*(tint_symbol_1)).a = tint_symbol; (*(tint_symbol_1)).a = tint_symbol;

View File

@ -3,12 +3,12 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int4 tint_mod(int4 lhs, int4 rhs) { int4 tint_mod(int4 lhs, int4 rhs) {
return (lhs % (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs)); return (lhs % (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), (2).xxxx); const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), (2).xxxx);
v.Store4(0u, asuint(tint_symbol)); v.Store4(0u, asuint(tint_symbol));

View File

@ -3,12 +3,12 @@ void unused_entry_point() {
return; return;
} }
RWByteAddressBuffer v : register(u0, space0);
int4 tint_mod(int4 lhs, int4 rhs) { int4 tint_mod(int4 lhs, int4 rhs) {
return (lhs % (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs)); return (lhs % (((rhs == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (rhs == (-1).xxxx))) ? (1).xxxx : rhs));
} }
RWByteAddressBuffer v : register(u0, space0);
void foo() { void foo() {
const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), (2).xxxx); const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), (2).xxxx);
v.Store4(0u, asuint(tint_symbol)); v.Store4(0u, asuint(tint_symbol));

View File

@ -4,10 +4,6 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
ivec4 tint_mod(ivec4 lhs, ivec4 rhs) {
return (lhs % mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4(-2147483648))) & uvec4(equal(rhs, ivec4(-1))))))));
}
struct S { struct S {
ivec4 a; ivec4 a;
}; };
@ -16,6 +12,10 @@ layout(binding = 0, std430) buffer v_block_ssbo {
S inner; S inner;
} v; } v;
ivec4 tint_mod(ivec4 lhs, ivec4 rhs) {
return (lhs % mix(rhs, ivec4(1), bvec4(uvec4(equal(rhs, ivec4(0))) | uvec4(bvec4(uvec4(equal(lhs, ivec4(-2147483648))) & uvec4(equal(rhs, ivec4(-1))))))));
}
void foo() { void foo() {
ivec4 tint_symbol = tint_mod(v.inner.a, ivec4(2)); ivec4 tint_symbol = tint_mod(v.inner.a, ivec4(2));
v.inner.a = tint_symbol; v.inner.a = tint_symbol;

View File

@ -1,14 +1,14 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
int4 tint_mod(int4 lhs, int4 rhs) {
return (lhs % select(rhs, int4(1), ((rhs == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (rhs == int4(-1))))));
}
struct S { struct S {
/* 0x0000 */ int4 a; /* 0x0000 */ int4 a;
}; };
int4 tint_mod(int4 lhs, int4 rhs) {
return (lhs % select(rhs, int4(1), ((rhs == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (rhs == int4(-1))))));
}
void foo(device S* const tint_symbol_1) { void foo(device S* const tint_symbol_1) {
int4 const tint_symbol = tint_mod((*(tint_symbol_1)).a, int4(2)); int4 const tint_symbol = tint_mod((*(tint_symbol_1)).a, int4(2));
(*(tint_symbol_1)).a = tint_symbol; (*(tint_symbol_1)).a = tint_symbol;

View File

@ -3,14 +3,14 @@ void unused_entry_point() {
return; return;
} }
int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
}
groupshared int a; groupshared int a;
groupshared float4 b; groupshared float4 b;
groupshared float2x2 c; groupshared float2x2 c;
int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
}
void foo() { void foo() {
a = tint_div(a, 2); a = tint_div(a, 2);
b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b);

View File

@ -3,14 +3,14 @@ void unused_entry_point() {
return; return;
} }
int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
}
groupshared int a; groupshared int a;
groupshared float4 b; groupshared float4 b;
groupshared float2x2 c; groupshared float2x2 c;
int tint_div(int lhs, int rhs) {
return (lhs / (((rhs == 0) | ((lhs == -2147483648) & (rhs == -1))) ? 1 : rhs));
}
void foo() { void foo() {
a = tint_div(a, 2); a = tint_div(a, 2);
b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b);

View File

@ -4,13 +4,13 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
shared int a;
shared vec4 b;
shared mat2 c;
int tint_div(int lhs, int rhs) { int tint_div(int lhs, int rhs) {
return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs)); return (lhs / (bool(uint((rhs == 0)) | uint(bool(uint((lhs == -2147483648)) & uint((rhs == -1))))) ? 1 : rhs));
} }
shared int a;
shared vec4 b;
shared mat2 c;
void foo() { void foo() {
a = tint_div(a, 2); a = tint_div(a, 2);
b = (b * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); b = (b * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)));