1/* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 9#version 450 core 10 11#define PRECISION ${PRECISION} 12 13layout(std430) buffer; 14 15${layout_declare_tensor(0, "rw", "t_in", "float", "texture3d")} 16${layout_declare_ubo(1, "ivec3", "extents")} 17${layout_declare_ubo(2, "int", "scalar")} 18 19layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in; 20 21void main() { 22 const ivec3 pos = ivec3(gl_GlobalInvocationID); 23 if (any(greaterThanEqual(pos, extents))) { 24 return; 25 } 26 27 vec4 in_tex = imageLoad(t_in, pos); 28 imageStore(t_in, pos, imageLoad(t_in, pos) + float(scalar)); 29} 30