vulkan and instanceindex

Started by
0 comments, last by sirpalee 7 years, 3 months ago
hello.
I would create an instanced boxes drawing in vulkan.
I have 2 variables that change during the time and are selected and visible .
I seen in documentation and examples that use instanceindex and an ubo and every change the ubo is remapped.
i have 3 questions:
1)i must choose from an texture and an ubo for changing variables(selected and visible)
and for example if a piking on a box is executed i must remap the data variables to the new value selected in the texture or ubo , but i must change only 3 byte in the entire buffer or texture,
then in the shader when i get the value from the texture or the ubo i must get the selected color.
2)i'm using instancing drawing and i have 300000 objects
3)is better to use ubo or a 1d texture?
thanks.
Advertisement

1, no, you don't have to remap all the buffer. You can just update the parts that have changed. Also, don't forget, you have to align your data properly. So be careful with single byte reads.

2, what is the question here?

3, use UBOs. Less limitations on size, and less code is spent on unpacking data. But, as always, benchmark it yourself. There might be differences between different architectures, and you might have to maintain both approaches.

shaken, not stirred

This topic is closed to new replies.

Advertisement