Is there benefit (speed, memory, etc.) to using a 1D texture vs. using a 2D texture in OpenGL (or any other graphics library). I realize I will only be have to address the texture using 1 coordinate instead of 2 but I'm wondering if there is any kind of speed or memory benefit?
-
You mean as opposed to a 2D texture with 1 height? One advantage that comes to mind is that the GPU doesn't have to try to interpolate values on the Y axis with 1D textures. – Colonel Thirty Two Aug 04 '14 at 16:38
-
@ColonelThirtyTwo Yes, this is what I mean. – smack0007 Aug 04 '14 at 16:39
-
1As suggested in the answer below, benchmarking is always best to be sure. But I would be surprised if you could measure a difference. IHMO they're more of a legacy feature that would have been a good candidate for removal when the core profile was defined. – Reto Koradi Aug 04 '14 at 17:54
-
@RetoKoradi That is more of the reason behind my question. Is there something I can accomplish with better performance with a 1D texture vs. a 2D texture. I'm writing library code and just want to know if there any good reason to support a 1D and 2D textures. – smack0007 Aug 04 '14 at 18:08
3 Answers
I was looking for the info listed under the "Edit" of this question: Are 1D Textures Supported in WebGL yet?
1D textures are not moot, they exist because they not only have a purpose, but are intended to translate into optimizations on the GPU itself (as opposed to a 2D texture). Remember that each parameter takes time to load onto the call stack, and almost all GPU programming is an art of optimizing every possible operation.
Whether or not that would actually improve the performance of any application is still something that would need to be profiled. Regardless, I'm writing library code and that is enough for me to make the decision that I should support using 1D textures.
-
Removing one parameter as an optimization. Wow, you found the bottleneck! – Tara Dec 05 '18 at 03:01
It depends on target platform hardware and drivers mainly. Try to profile your application with different approaches used and you will get what's going on

- 65
- 1
- 6