1layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in; 2 3layout (webgpu, rgba8, set=1, binding=0) writeonly texture2D texRGBA; 4layout (webgpu, r32f, set=1, binding=1) readonly texture2D texRed; 5 6noinline void fill_texture(layout(rgba8) writeonly texture2D passedInTexRGBA, 7 layout(r32f) readonly texture2D passedInTexRed) { 8 half4 red = textureRead(passedInTexRed, uint2(0)); 9 10 uint sizeX = textureWidth(passedInTexRGBA); 11 uint sizeY = textureHeight(passedInTexRGBA); 12 13 uint2 coords; 14 for (coords.y = 0; coords.y < sizeY; ++coords.y) { 15 for (coords.x = 0; coords.x < sizeX; ++coords.x) { 16 textureWrite(passedInTexRGBA, coords, red); 17 } 18 } 19} 20 21void main() { 22 fill_texture(texRGBA, texRed); 23} 24