0

I have read that compressed textures are not readable and are not color render-able. Though I have some idea of why its not allowed, can some one explain in little detail.

What exactly does it mean its not readable. I can not read from them in shader using say image Load etc? Or I cant even sample from them?

What does it mean its not render-able to? Is it because user is going to see all garbage anyway, so its not allowed.

I have not tried using compressed textures.

viktorzeid
  • 1,521
  • 1
  • 22
  • 35

2 Answers2

2

Compressed textures are "readable", by most useful definitions of that term. You can read from them via samplers. However, you can't use imageLoad operations on them. Why? Because reading such memory is not a simple memory fetch. It involves fetching lots of memory and doing a decompression operation.

Compressed images are not color-renderable, which means they cannot be attached to an FBO and used as a render target. One might think the reason for this was obvious, but if you need it spelled out. Writing to a compressed image requires doing image compression on the fly. And most texture compression formats (or compressed formats of any kind) are not designed to easily deal with changing a few values. Not to mention, most compressed texture formats are lossy, so every time you do a decompress/write/recompress operation, you lose image fidelity.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
1

From the OpenGL Wiki:

Despite being color formats, compressed images are not color-renderable, for obvious reasons. Therefore, attaching a compressed image to a framebuffer object will cause that FBO to be incomplete and thus unusable. For similar reasons, no compressed formats can be used as the internal format of renderbuffers.

So "not color render-able" means that they can't be used in FBOs.

I'm not sure what "not readable" means; it may mean that you can't bind them to an FBO and read from the FBO (since you can't bind them to an FBO in the first place).

Colonel Thirty Two
  • 23,953
  • 8
  • 45
  • 85
  • Yes, buy my question is why. – viktorzeid Aug 09 '14 at 00:06
  • Probably because compressing them on the fly would be difficult, and may modify several pixels near each rendered primitive, which may break what you're trying to do with them. – Colonel Thirty Two Aug 09 '14 at 00:17
  • I was thinking more on the lines like its possible, but the user will read/see all garbage texels, because its not a single RBBA texel anymore, instead compressed data of 1 or more texels. And since this leads to undesired results it is not supported. – viktorzeid Aug 09 '14 at 00:19
  • So the question is "why did the spec explicitly disallow it rather than allowing it but making it completely useless?" – Colonel Thirty Two Aug 09 '14 at 00:22
  • "Readable" might refer to reading them with `glGetTexImage()`. – Reto Koradi Aug 09 '14 at 02:44