πŸ‡¨πŸ‡¦ Kyle Halladay
Follow

I had a bunch of trouble figuring out how to set up an array of textures in a vulkan shader, so even though the reality of it is very easy, I made a quick blog post in case anyone else gets stuck

kylehalladay.com/blog/tutorial

@khalladay Thanks, your Vulkan posts are very useful, they helped me out quite a bit :)

I was wondering why you went with an array of textures instead of a texture array though?

@Gohla Something like a sampler2Darray (or the like)? It's my understanding that you need all your images to be the same size with those (let me know if I'm wrong),

with an array of textures, each texture can be whatever size it wants to be

@khalladay Ah, that makes sense. I'm indeed using sampler2DArray with images of equal size for a 2D grid renderer. I didn't try to use images of different sizes (but I assume that doesn't work).

Now I wonder what the pros/cons of both approaches are.

@Gohla Would be interesting to see a perf comparison between the two (both using a uniformly sized texture set).

For a "bind all the textures at once" approach, the need for all textures to be the same size is rather inconvenient. Although probably do-able if the performance gains are sizeable enough.

@khalladay I expect a small/no difference in performance, but you can never be sure with this stuff, so an actual comparison would be interesting indeed :)

Currently working on the functionality of my game though, optimization comes later when rendering becomes a bottleneck.

@Gohla would be interesting to test it on NVidia, AMD, Android hardware. I'm sure there's at least one platform where the performance difference is large enough to care.

I have...one of those three platforms haha... shit maybe I need to buy an android phone.

@khalladay true! I only have one as well (NVidia), so I'm kind of scared about optimization for other platforms. Luckily, I'm doing 2D and PC only for now. Android is probably a whole different ballpark.

Sign in to participate in the conversation
Gamedev Mastodon

Game development! Discussions about game development and related fields, and/or by game developers and related professions.