瀏覽代碼

Fix compressed DDS texture loading issues (#3483)

pull/3484/head
JaanDev 1 年之前
committed by GitHub
父節點
當前提交
1fd61a00e4
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. +3
    -5
      src/external/rl_gputex.h

+ 3
- 5
src/external/rl_gputex.h 查看文件

@ -261,11 +261,9 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
}
else if (((header->ddspf.flags == 0x04) || (header->ddspf.flags == 0x05)) && (header->ddspf.fourcc > 0)) // Compressed
{
int data_size = 0;
// Calculate data size, including all mipmaps
if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size*2;
else data_size = header->pitch_or_linear_size;
// NOTE: This forces only 1 mipmap to be loaded which is not really correct but it works
int data_size = (header->pitch_or_linear_size < file_size - 0x80) ? header->pitch_or_linear_size : file_size - 0x80;
*mips = 1;
image_data = RL_MALLOC(data_size*sizeof(unsigned char));

Loading…
取消
儲存