Basically how the texturing works currently is when a model references a texture, the new3d renderer cuts out that texture from the texture sheet and well makes a standard opengl texture from it.
This works nicely, but due to the way models reference overlapping textures, quite often we'll make say 8+ textures out of the 4 textures in the sheet.
It also makes invalidation quite expensive because we have to loop through memory and check for overlapping textures.
Basically instead of this we could simply pass the entire texture sheet to the shaders unmodified, and read the textures directly out of memory. Opengl 4+ can read unsigned16 bit textures, which is what the model3 uses. In opengl 4+ you can also do unsigned integer math in shaders, which is simply not possible in glsl 1.0 or 1.2. With unsigned integer math we can do code like this
- Code: Select all
texel = src[yi * 2048 + xi] & 0xFF;
c = ((texel >> 4) & 0xF) * 17;
scratch[i++] = c;
scratch[i++] = c;
scratch[i++] = c;
scratch[i++] = (c == 255 ? 0 : 255);
Anyway this might potentially (on decent gpus) give us a speed up. It would also simplify the code a lot.
But we would need opengl 4+, and I know there are people out there on OLD gpus.
But like with nvidia now releasing 8nm GPUs with totally insane performance, do we really want to be stuck in the past forever? :s
OpenGL 4.1 came out 10 years ago now.