Compare commits

..

No commits in common. "d45e663e166238ae8f0ef91fbf8fa736827a1b2a" and "2f0c021e65bd3d07ee2848512dad3e882a8d13bc" have entirely different histories.

View File

@ -40,7 +40,7 @@ void AsyncTextureWait(CTexture* texture) {
uint32_t CalcLevelCount(uint32_t width, uint32_t height) { uint32_t CalcLevelCount(uint32_t width, uint32_t height) {
uint32_t v2 = width; uint32_t v2 = width;
uint32_t v3 = height; uint32_t v3 = height;
uint32_t levels = 1; uint32_t v4 = 1;
uint32_t v5; uint32_t v5;
uint32_t v6; uint32_t v6;
@ -51,7 +51,7 @@ uint32_t CalcLevelCount(uint32_t width, uint32_t height) {
while (v2 > 1 || v3 > 1) { while (v2 > 1 || v3 > 1) {
v5 = v2 >> 1; v5 = v2 >> 1;
++levels; ++v4;
v6 = v2 >> 1 < 1; v6 = v2 >> 1 < 1;
v2 = 1; v2 = 1;
@ -67,7 +67,7 @@ uint32_t CalcLevelCount(uint32_t width, uint32_t height) {
} }
} }
return levels; return v4;
} }
uint32_t CalcLevelOffset(uint32_t level, uint32_t width, uint32_t height, uint32_t fourCC) { uint32_t CalcLevelOffset(uint32_t level, uint32_t width, uint32_t height, uint32_t fourCC) {
@ -84,7 +84,7 @@ uint32_t CalcLevelSize(uint32_t level, uint32_t width, uint32_t height, uint32_t
uint32_t v4 = std::max(width >> level, 1u); uint32_t v4 = std::max(width >> level, 1u);
uint32_t v5 = std::max(height >> level, 1u); uint32_t v5 = std::max(height >> level, 1u);
if (fourCC == PIXEL_DXT1 || fourCC == PIXEL_DXT3 || fourCC == PIXEL_DXT5) { if (fourCC == 0 || fourCC == 1 || fourCC == 7) {
if (v4 == 6 * v5) { if (v4 == 6 * v5) {
if (v5 <= 4) { if (v5 <= 4) {
v5 = 4; v5 = 4;
@ -104,7 +104,7 @@ uint32_t CalcLevelSize(uint32_t level, uint32_t width, uint32_t height, uint32_t
uint32_t size; uint32_t size;
if (fourCC == PIXEL_ARGB2565) { if (fourCC == 9) {
uint32_t v6 = v5 * v4; uint32_t v6 = v5 * v4;
uint32_t v7 = v5 * v4 >> 2; uint32_t v7 = v5 * v4 >> 2;
@ -159,34 +159,23 @@ void FillInSolidTexture(const CImVector& color, CTexture* texture) {
uint32_t GetBitDepth(uint32_t fourCC) { uint32_t GetBitDepth(uint32_t fourCC) {
switch (fourCC) { switch (fourCC) {
case PIXEL_DXT1: case 0:
return 4; return 4;
case PIXEL_DXT3: case 1:
case PIXEL_A8: case 6:
case PIXEL_DXT5: case 7:
return 8; return 8;
case PIXEL_ARGB8888: case 2:
return 32; return 32;
case PIXEL_ARGB1555: case 3:
case PIXEL_ARGB4444: case 4:
case PIXEL_RGB565: case 5:
return 16; return 16;
default: default:
#ifndef NDEBUG
SErrDisplayError(
0x85100000,
__FILE__,
__LINE__,
"!\"GetBitDepth(): unhandled format\"",
0,
1u,
1
);
#endif
return 0; return 0;
} }
} }