瀏覽代碼

Corrected issue on compressed textures data size

pull/945/head
raysan5 5 年之前
父節點
當前提交
c629b16ebc
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. +8
    -0
      src/rlgl.h

+ 8
- 0
src/rlgl.h 查看文件

@ -4623,6 +4623,14 @@ int GetPixelDataSize(int width, int height, int format)
} }
dataSize = width*height*bpp/8; // Total data size in bytes dataSize = width*height*bpp/8; // Total data size in bytes
// Most compressed formats works on 4x4 blocks,
// if texture is smaller, minimum dataSize is 8 or 16
if ((width < 4) && (height < 4))
{
if ((format >= COMPRESSED_DXT1_RGB) && (format < COMPRESSED_DXT3_RGBA)) dataSize = 8;
else if ((format >= COMPRESSED_DXT3_RGBA) && (format < COMPRESSED_ASTC_8x8_RGBA)) dataSize = 16;
}
return dataSize; return dataSize;
} }

Loading…
取消
儲存