ioquake / ioq3

The ioquake3 community effort to continue supporting/developing id's Quake III Arena
https://ioquake3.org/
GNU General Public License v2.0
2.43k stars 530 forks source link

[Oversight] [Rend2] DDS textures are not loaded if automatic texture compression is disabled #583

Open SirYodaJedi opened 1 year ago

SirYodaJedi commented 1 year ago

I was reading the source code for the renderers to see which image formats are supported for textures (no transparency for 8bpp images, bummer), when I noticed that although Rend2 has prototype support for loading DDS textures, such textures are only loaded when r_ext_compressed_textures is enabled (there's a clause in R_LoadImage that searches for DDS files before other files if r_ext_compressed_textures is enabled).

I think the most logical thing to do when r_ext_compressed_textures is disabled would be to still try load the DDS after trying all the other formats, and upload it to the GPU using the already-compressed form (if supported). It may also be necessary to add code to decompress the texture to 32-bit, to be used if the GPU lacks support for the given compression format. This way, a large texture (ex: 8192px) can be stored in a PK3 as DDS only, and not need a PNG/JPG duplicate for uncompressed texture support. People disable r_ext_compressed_textures for improved texture quality, but modern best practices dictate that high-res textures should be pre-compressed in a GPU-friendly format (no need for exponential VRAM bloat on minuscule texels).

(DDS file support will also need to be added to the original renderer if the mod author doesn't want to require Rend2, but that's a separate bridge to burn when DDS support isn't a prototype anymore)