Other problem is that with punchthrough:
"If punch-through mode is selected, and the modulation bits for a given pixel have a value of 0b10, the alpha value of the resulting color is 0x00. This is irrespective of the presence or values of any alpha channel in the input colors."
image decoder uses s_pvrtcWeights table for weights. Outputting 0 can be implemented by settings alpha weights to 0 when punchtrough is on and modulation is 0b10.
pipes.zip This image clearly shows the artifacts.
One problem seems to be the incorrect punchthrough flag. According to the specs (table 173) it is at bit 32. https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#_format_pvrtc1_4bpp
Current values are (bc[7]&1) which is bit 56. https://github.com/bkaradzic/bimg/blob/82738cde49fe39b4bb9d7265f4a262f2127aff7a/src/image.cpp#L3044 https://github.com/bkaradzic/bimg/blob/82738cde49fe39b4bb9d7265f4a262f2127aff7a/src/image.cpp#L3152
Other problem is that with punchthrough: "If punch-through mode is selected, and the modulation bits for a given pixel have a value of 0b10, the alpha value of the resulting color is 0x00. This is irrespective of the presence or values of any alpha channel in the input colors."
image decoder uses s_pvrtcWeights table for weights. Outputting 0 can be implemented by settings alpha weights to 0 when punchtrough is on and modulation is 0b10.
https://github.com/bkaradzic/bimg/blob/82738cde49fe39b4bb9d7265f4a262f2127aff7a/src/image.cpp#L2969 Alpha weights are the 3. and 4. values. So this should look like
{ 4, 4, 0, 0 },
https://github.com/bkaradzic/bgfx/issues/792