Skip to content

BC3 alpha rounding behavior #33

@neptuwunium

Description

@neptuwunium

Following the discussion n the iOrange/bcdec#12: BC3 the alpha channel is interpolated as a floating point channel in modern implementations.

Seemingly, at some point BC3 split into two (likely with the introduction of BC3 into DXGI vs the DXT5 format.)
One that uses smooth_alpha_block to interpolate alpha, and a modern variant that uses bc4_block.

The resulting call would look like

  if modern_spec {
    bc4_block(
        compressed_block,
        &mut decompressed_block[3..],
        destination_pitch,
        4,
        false,
    );
  } else {
    smooth_alpha_block(
        compressed_block,
        &mut decompressed_block[3..],
        destination_pitch,
        4,
    );
  }

Additionally, smooth_alpha_block is implemented inaccurately as-is, see related commit: iOrange/bcdec@963c5e5#diff-a7d40b7cf11635d27584cfdad0351fef5fce1c22fe1ad20060b078ecbd175a1aL209

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions