CompressBlockBC6 from cmp_core\shaders\bc6_encode_kernel.cpp produces heavy artifacts:
While the the Compressonator GUI app does not:
GUI app uses, what looks to be, functionally identical implementation of the BC6 compression code, which is contained in BC6HBlockEncoder::CompressBlock (and lot of other functions) in cmp_compressonatorlib\bc6h\bc6h_encode.cpp, but, obviously, it's not completely identical, otherwise both approaches would produce a non-currupted image. I wasn't able to spot the deficiency, it's a massive codebase after all.
In order to reproduce this, one can add
unsigned short inputs[BC6H_MAX_SUBSET_SIZE][3];
for (int i = 0; i < BC6H_MAX_SUBSET_SIZE; i++)
{
inputs[i][0] = CMP_HALF(in[i][0]).bits();
inputs[i][1] = CMP_HALF(in[i][1]).bits();
inputs[i][2] = CMP_HALF(in[i][2]).bits();
}
CompressBlockBC6(&inputs[0][0], 3, out, nullptr);
return 0;
in the beginning of float BC6HBlockEncoder::CompressBlock(float in[MAX_SUBSET_SIZE][MAX_DIMENSION_BIG], BYTE out[COMPRESSED_BLOCK_SIZE]) in cmp_compressonatorlib\bc6h\bc6h_encode.cpp. Pretty much the same thing is performed under #ifdef USE_CMP_BC7_CORE in BC7BlockEncoder::CompressBlock in cmp_compressonatorlib\bc7\bc7_encode.cpp (just for reference).
This replaces the seemingly identical compression code with that from the core library. Generated image has heavy artifacts.
Note on = CMP_HALF(in[i][0]).bits();. I ommitted handling NaNs and such (skipped calling MapToF16). I made sure that it's not relevant to the problem.
Changing compression options, such as quality or mask, didn't change the outcome.
CompressBlockBC6
fromcmp_core\shaders\bc6_encode_kernel.cpp
produces heavy artifacts:While the the Compressonator GUI app does not:
GUI app uses, what looks to be, functionally identical implementation of the BC6 compression code, which is contained in
BC6HBlockEncoder::CompressBlock
(and lot of other functions) incmp_compressonatorlib\bc6h\bc6h_encode.cpp
, but, obviously, it's not completely identical, otherwise both approaches would produce a non-currupted image. I wasn't able to spot the deficiency, it's a massive codebase after all.In order to reproduce this, one can add
in the beginning of
float BC6HBlockEncoder::CompressBlock(float in[MAX_SUBSET_SIZE][MAX_DIMENSION_BIG], BYTE out[COMPRESSED_BLOCK_SIZE])
incmp_compressonatorlib\bc6h\bc6h_encode.cpp
. Pretty much the same thing is performed under#ifdef USE_CMP_BC7_CORE
inBC7BlockEncoder::CompressBlock
incmp_compressonatorlib\bc7\bc7_encode.cpp
(just for reference).This replaces the seemingly identical compression code with that from the core library. Generated image has heavy artifacts.
Note on
= CMP_HALF(in[i][0]).bits();
. I ommitted handling NaNs and such (skipped calling MapToF16). I made sure that it's not relevant to the problem.Changing compression options, such as quality or mask, didn't change the outcome.
Thanks in advance!