mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:08:00 +02:00
Merge pull request #10559 from jherico/fix_compressed_ktx_loading
Fix compressed KTX loading
This commit is contained in:
commit
952d3629ec
2 changed files with 4 additions and 3 deletions
|
@ -212,10 +212,11 @@ namespace khronos {
|
||||||
template <uint32_t ALIGNMENT>
|
template <uint32_t ALIGNMENT>
|
||||||
inline uint32_t evalAlignedCompressedBlockCount(uint32_t value) {
|
inline uint32_t evalAlignedCompressedBlockCount(uint32_t value) {
|
||||||
// FIXME add static assert that ALIGNMENT is a power of 2
|
// FIXME add static assert that ALIGNMENT is a power of 2
|
||||||
return (value + (ALIGNMENT - 1) / ALIGNMENT);
|
static uint32_t ALIGNMENT_REMAINDER = ALIGNMENT - 1;
|
||||||
|
return (value + ALIGNMENT_REMAINDER) / ALIGNMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t evalBlockAlignemnt(InternalFormat format, uint32_t value) {
|
inline uint32_t evalCompressedBlockCount(InternalFormat format, uint32_t value) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case InternalFormat::COMPRESSED_SRGB_S3TC_DXT1_EXT: // BC1
|
case InternalFormat::COMPRESSED_SRGB_S3TC_DXT1_EXT: // BC1
|
||||||
case InternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: // BC1A
|
case InternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: // BC1A
|
||||||
|
|
|
@ -30,7 +30,7 @@ uint32_t Header::evalMaxDimension() const {
|
||||||
|
|
||||||
uint32_t Header::evalPixelOrBlockDimension(uint32_t pixelDimension) const {
|
uint32_t Header::evalPixelOrBlockDimension(uint32_t pixelDimension) const {
|
||||||
if (isCompressed()) {
|
if (isCompressed()) {
|
||||||
return khronos::gl::texture::evalBlockAlignemnt(getGLInternaFormat(), pixelDimension);
|
return khronos::gl::texture::evalCompressedBlockCount(getGLInternaFormat(), pixelDimension);
|
||||||
}
|
}
|
||||||
return pixelDimension;
|
return pixelDimension;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue