| 655 | } |
| 656 | |
| 657 | void OverrideTextureBcFormat(ntc::ITextureMetadata* texture, ManifestEntry* manifestEntry) |
| 658 | { |
| 659 | // Override the BC format from command line, if specified. |
| 660 | // Overriding with 'none' is also an option here. |
| 661 | if (g_options.bcFormat.has_value()) |
| 662 | { |
| 663 | ntc::BlockCompressedFormat bcFormat = *g_options.bcFormat; |
| 664 | |
| 665 | // Automatic selection of BCn mode based on channel count and HDR-ness |
| 666 | if (bcFormat == BlockCompressedFormat_Auto) |
| 667 | { |
| 668 | ntc::ChannelFormat const channelFormat = texture->GetChannelFormat(); |
| 669 | if (channelFormat == ntc::ChannelFormat::FLOAT16 || channelFormat == ntc::ChannelFormat::FLOAT32) |
| 670 | { |
| 671 | // HDR textures use only BC6, no other options |
| 672 | bcFormat = ntc::BlockCompressedFormat::BC6; |
| 673 | } |
| 674 | else |
| 675 | { |
| 676 | // Best quality options. |
| 677 | // If you want more control, use a manifest. |
| 678 | int const channels = texture->GetNumChannels(); |
| 679 | switch(channels) |
| 680 | { |
| 681 | case 1: bcFormat = ntc::BlockCompressedFormat::BC4; break; |
| 682 | case 2: bcFormat = ntc::BlockCompressedFormat::BC5; break; |
| 683 | default: bcFormat = ntc::BlockCompressedFormat::BC7; break; |
| 684 | } |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | assert(bcFormat != BlockCompressedFormat_Auto); |
| 689 | |
| 690 | texture->SetBlockCompressedFormat(bcFormat); |
| 691 | |
| 692 | // Apply the same override to the manifest entry, if it's provided |
| 693 | // (in case the user wants to save the manifest) |
| 694 | if (manifestEntry) |
| 695 | { |
| 696 | manifestEntry->bcFormat = bcFormat; |
| 697 | } |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | ntc::ITextureSet* LoadImages(ntc::IContext* context, Manifest& manifest, bool manifestIsGenerated) |
| 702 | { |
no outgoing calls
no test coverage detected