Skip to content

Commit

Permalink
[skip ci] glsl raw_mod fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate committed Feb 25, 2020
1 parent 44c392a commit c7575fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions taichi/backends/codegen_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@ int _rand_i32()\n\
emit("{} {} = {}(floor((float({}) * (1 + sign({} * {}) * 1e-6)) / float({})));",
dt_name, bin_name, dt_name, lhs_name, lhs_name, rhs_name, rhs_name);
return;
} else if (bin->op_type == BinaryOpType::mod) {
// NOTE: the GLSL built-in function `mod()` is a pythonic mod: x - y * floor(x / y)
emit("{} {} = {} - {} * int({} / {});", dt_name, bin_name, lhs_name, rhs_name,
lhs_name, rhs_name);
return;
}
const auto binop = binary_op_type_symbol(bin->op_type);
if (is_opengl_binary_op_infix(bin->op_type)) {
Expand Down

0 comments on commit c7575fc

Please sign in to comment.