简体   繁体   中英

Most efficient way to texture splat opengl?

I have to combine up to 17 textures and then render it to a quad (well, 2 triangles) using openGL. I have to render a great deal of these quads - perhaps 500.

I was wondering what the fastest/best method to doing so:

A. render in many passes B. combine textures in FBO and render once C. use opengl multitexture and render in a few passes D. combine textures with CPU, upload to opengl texture, then render E. other?

Multiple passes means multiple pixel shader execution as well as multiple ROP/blending operations, which can easily become a bottleneck both on last generation and current generation hardware. As such, stuffing it all into one pass or few passes (C) should be advantageous.

I'm not sure about the "combine in a FBO" thing, although I cannot provide hard evidence for that, it "feels" like it would likely be slower (since you will have at least 2 FBO rebinds and at least one pipeline stall). Though of course it depends... if you combine the same 17 textures once and draw the single combined texture a thousand times, it may very well be faster. If you have a dozen or so different combinations of how those 17 textures are combined, it will likely look different.

Modern GPUs should have no issue sampling up to 17 textures in a fragment shader (GL 3.x hardware has a minimum of 48), and it is straightforward.

A, B and C should be the same performance wise.

It all comes to how powerful your GPU and CPU are. That would decide whether to use one of a,b or c, or d.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM