Advertisement

Indexing a 3D texture

Started by January 12, 2021 01:45 AM
1 comment, last by MJP 4 years ago

Dear all,

I'd like to find the index of a 3D texture from a compute shader.

But it crashes probably because it runs out of bounds

[code]

uint index = x + y x 128 + z x 128 x 128

[/code]

I've got 768 compute units on my GPU

context→Dispatch (128,128,128);

thanks

How big is your thread group? 128x128x128 is a lot of thread groups…2M in fact! So if you have 64 threads in your thread group, that will dispatch 128 million threads. I suspect this is not what you want.

If your 3D texture is 128x128x128 and you want 1 thread per texel, then you probably want a thread group size of something like 4x4x4 or 8x8x8, and then you want to divide your texture dimensions by the thread group size. So for a thread group of 4x4x4 your parameters would be Dispatch(32,32,32), and for 8x8x8 it would be (16,16,16).

This topic is closed to new replies.

Advertisement