Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions backends/vulkan/runtime/graph/ops/glsl/binary_op.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ void main() {
}

ivec4 in_coord = out_coord_to_in_coord(coord, in_sizes.data);
vec4 in_texel = texelFetch(
${VEC4_T[DTYPE]} in_texel = ${VEC4_T[DTYPE]}(texelFetch(
image_in,
COORD_TO_POS_${PACKING}(in_coord, in_sizes.data),
0);
0));

ivec4 other_coord = out_coord_to_in_coord(coord, other_sizes.data);
vec4 other_texel = texelFetch(
${VEC4_T[DTYPE]} other_texel = ${VEC4_T[DTYPE]}(texelFetch(
image_other,
COORD_TO_POS_${PACKING}(other_coord, other_sizes.data),
0);
0));

// Detect broadcasting
if (PACKED_DIM_${PACKING}(other_sizes.data) < PACKED_DIM_${PACKING}(in_sizes.data)) {
other_texel = other_texel.xxxx;
}

imageStore(image_out, pos, OP(in_texel, other_texel, alpha.data));
imageStore(image_out, pos, ${VEC4_T[DTYPE]}(OP(in_texel, other_texel, alpha.data)));
}
2 changes: 2 additions & 0 deletions backends/vulkan/runtime/graph/ops/glsl/binary_op.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ binary_op:
SUFFIX: half
- VALUE: float
SUFFIX: float
- VALUE: int
SUFFIX: int
shader_variants:
- NAME: binary_add
- NAME: binary_sub
Expand Down