From Johannes Baeuerele, "I have extended the pvr reader plugin to support etc1 compression(GL_ETC1_RGB8_OES). The changes attached to this submission are based on today's trunk.

The pvr format which can be used as a wrapper for different compressed and uncompressed formats supports this compression algorithm. The original pvr compression uses the pvrtc format. The handling of pvrtc is already implemented in the pvr plugin. PVR provides wrapper functionality for some formats, e.g. etc or even dxt/dds.

Our target system (gles2) is able to use the etc compression format. With minor changes in the submitted files, there is no need to write a separate plugin. However the original pvr texture compression formats are not supported on our target, which is the reason for this extension.

The changes mainly consist in the definition on new enum values in the classes and headers of ReaderWriterPVR,Image and Texture. I also found some locations where the handling of the original pvr textures was not implemented. These are also part of this submission."
This commit is contained in:
Robert Osfield
2011-04-21 17:04:50 +00:00
parent 634344aef5
commit a793958836
4 changed files with 89 additions and 6 deletions

View File

@@ -311,6 +311,7 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat)
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG): return 3;
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG): return 4;
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG): return 4;
case(GL_ETC1_RGB8_OES): return 3;
case(GL_COLOR_INDEX): return 1;
case(GL_STENCIL_INDEX): return 1;
case(GL_DEPTH_COMPONENT): return 1;
@@ -415,17 +416,15 @@ unsigned int Image::computePixelSizeInBits(GLenum format,GLenum type)
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return 4;
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 8;
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 8;
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): return 4;
case(GL_COMPRESSED_RED_RGTC1_EXT): return 4;
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT): return 8;
case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT): return 8;
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG): return 4;
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG): return 2;
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG): return 4;
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG): return 2;
case(GL_ETC1_RGB8_OES): return 4;
default: break;
}
@@ -564,6 +563,7 @@ bool Image::isCompressed() const
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG):
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG):
case(GL_ETC1_RGB8_OES):
return true;
default:
return false;
@@ -604,6 +604,11 @@ unsigned int Image::getTotalSizeInBytesIncludingMipmaps() const
break;
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG):
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG):
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG):
case(GL_ETC1_RGB8_OES):
sizeOfLastMipMap = maximum(sizeOfLastMipMap, 16u); // block size of 16
break;
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT):