ISPCTextureCompressor
ISPCTextureCompressor copied to clipboard
if programCount==1 then ASTC compression fails (PURPLE color)
I'm porting the code to use in regular C++, so it can be compiled on other platforms without ISPC compiler. And I've noticed that ASTC compression always fails if programCount==1 (PURPLE color) programCount>=2 work OK. Looks like your codes have some assumption that programCount>=2, and in other cases they don't work. Could you please check?
The simplest solution was to do:
#define programIndex 0
#define programCount 1
But that didn't work (PURPLE color), so I had to do for example this, with programCount>=2 :
for(int programIndex=0; programIndex<programCount; programIndex++)
ispc::astc_encode_ispc((ispc::rgba_surface*)src, block_scores, dst, list, &list_context, (ispc::astc_enc_settings*)settings, programIndex);
Then it worked.
Maybe this code has something to do with it:
if (*mode_list < programCount - 1)
{
int index = int(mode_list[0] + 1);
mode_list[0] = index;
mode_list[index] = (uint64_t(offset) << 32) + mode;
}
else
{
mode_list[0] = (uint64_t(offset) << 32) + mode;
astc_encode(src, block_scores.data(), dst, mode_list, settings);
memset(mode_list, 0, list_size * sizeof(uint64_t));
}