image and view binding
height.out_img = sg.make_image({
usage = { storage_image = true },
width = OFFSCREEN_WIDTH,
height = OFFSCREEN_WIDTH,
pixel_format = .R32UI,
type = .ARRAY,
//type = ._3D,
num_slices = mip_levels
})
height.clear.bind.views[VIEW_out_clear] = sg.make_view({
storage_image = { image = height.out_img }
})
height.mipmap.bind.views[VIEW_out_height_map] = sg.make_view({
storage_image = { image = height.out_img }
})
shader
layout(binding=1, r32ui) uniform uimage2DArray out_height_map;
void main() {
ivec3 pos = ivec3(gl_GlobalInvocationID.xyz);
uvec4 height = texelFetch(usampler2D(in_height_draw, cs_smp), pos.xy, 0);
if (pos.x >= resolution.x || pos.y >= resolution.y || pos.z >= mip_levels) {
return;
}
int mip = pos.z;
float mult = pow(2., float(mip));
ivec2 mip_pos = pos.xy >> mip;
imageAtomicMax(out_height_map, ivec3(mip_pos, mip), height.r);
return;
}
Hi im pretty new to graphics programming so im not sure if this is a limit of one of the backends or a bug or im using the API wrong.
I'm using the Odin bindings for SOKOL and im trying to write to multiple slices of a image2dArray in a single dispatch of a compute shader, using the Z to switch 2DArray slices, However, only the first slice is being written to.
I can change which slice is being written to using the slice parameter in the storage image Image_View_desc, but it seems like I don't have access to the entire 3rd dimension
I've tried using the _3D type instead, but it still only writes to the slice Z=0, and I can't specify a slice in the storage image Image_View_desc for a 3D image.
Is this a bug? or a limitation I just have to work around by using multiple dispatches and binding each slice to separate views
image and view binding
shader
Hi im pretty new to graphics programming so im not sure if this is a limit of one of the backends or a bug or im using the API wrong.
I'm using the Odin bindings for SOKOL and im trying to write to multiple slices of a image2dArray in a single dispatch of a compute shader, using the Z to switch 2DArray slices, However, only the first slice is being written to.
I can change which slice is being written to using the slice parameter in the storage image Image_View_desc, but it seems like I don't have access to the entire 3rd dimension
I've tried using the _3D type instead, but it still only writes to the slice Z=0, and I can't specify a slice in the storage image Image_View_desc for a 3D image.
Is this a bug? or a limitation I just have to work around by using multiple dispatches and binding each slice to separate views