called by pack2x16unorm to convert to u32. var v: vec2; v[0] = textureLoadGeneral(src_tex, coord0, params.mipLevel).r; let coord1 = coord0 + vec3u(1, 0, 0); if (coord1.x < srcBoundary.x) { // Make sure coord1 is still within the copy boundary. v[1] = textureLoadGeneral(src_tex, coord1, params.mipLevel).r; result = pack2x16unorm(v); } else { // Otherwise, srcExtent.x is not a multiple of 2 and this thread is at right edge of the texture // To preserve the original buffer content, we need to read from the buffer and pack it together with other values. // TODO(dawn:1782): profiling against making a separate pass for this edge case // as it requires reading from dst_buf. let original: u32 = dst_buf[dstOffset]; const mask = 0xffff0000u; result = (original & mask) | (pack2x16unorm(v) & ~mask); }