mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-22 15:33:48 +00:00
Fix some KTX IO bugs
This commit is contained in:
parent
865239542a
commit
a51e63f5c0
2 changed files with 3 additions and 2 deletions
|
@ -75,7 +75,7 @@ class ByteReader {
|
|||
{ }
|
||||
|
||||
bool Advance(uint32 nBytes) {
|
||||
if(nBytes < m_BytesLeft) {
|
||||
if(nBytes > m_BytesLeft) {
|
||||
assert(!"Cannot read any more, unexpected bytes!");
|
||||
return false;
|
||||
}
|
||||
|
@ -278,6 +278,7 @@ bool ImageLoaderKTX::ReadData() {
|
|||
switch(glInternalFormat) {
|
||||
case GL_COMPRESSED_RGBA_BPTC_UNORM:
|
||||
m_Format = FasTC::eCompressionFormat_BPTC;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "KTX loader - texture format (0x%x) unsupported!\n", glInternalFormat);
|
||||
return false;
|
||||
|
|
|
@ -123,7 +123,7 @@ bool ImageWriterKTX::WriteImage() {
|
|||
if(ci) {
|
||||
wtr.Write(0); // glType
|
||||
wtr.Write(1); // glTypeSize
|
||||
wtr.Write(GL_RGBA); // glFormat
|
||||
wtr.Write(0); // glFormat must be zero for compressed images...
|
||||
switch(ci->GetFormat()) {
|
||||
case FasTC::eCompressionFormat_BPTC:
|
||||
wtr.Write(GL_COMPRESSED_RGBA_BPTC_UNORM); // glInternalFormat
|
||||
|
|
Loading…
Reference in a new issue