Skip to content

Commit

Permalink
Minor fix for JPEG module to not set alpha mode for no alpha formats
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Sep 3, 2024
1 parent 623d7c5 commit ef75f8a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Auxiliary/DirectXTexJPEG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,15 @@ namespace
metadata.arraySize = 1;
metadata.mipLevels = 1;
metadata.dimension = TEX_DIMENSION_TEXTURE2D;
metadata.miscFlags2 |= TEX_ALPHA_MODE_OPAQUE;

metadata.format = TranslateColor(dec.out_color_space);
if (metadata.format == DXGI_FORMAT_UNKNOWN)
{
throw std::runtime_error{ "unexpected out_color_space in jpeg_decompress_struct" };
}
if (metadata.format == DXGI_FORMAT_R8G8B8A8_UNORM)
{
metadata.miscFlags2 |= TEX_ALPHA_MODE_OPAQUE;
}
}

HRESULT GetHeader(TexMetadata& metadata) noexcept(false)
Expand Down

0 comments on commit ef75f8a

Please sign in to comment.