123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #pragma once
- #ifndef __CVTT_CONVECTION_KERNELS__
- #define __CVTT_CONVECTION_KERNELS__
- #include <stdint.h>
- namespace cvtt
- {
- namespace Flags
- {
-
- const uint32_t BC7_EnablePartitioning = 0x001;
-
- const uint32_t BC7_Enable3Subsets = 0x002;
-
- const uint32_t BC7_EnableDualPlane = 0x004;
-
- const uint32_t BC7_FastIndexing = 0x008;
-
- const uint32_t BC7_TrySingleColor = 0x010;
-
- const uint32_t BC7_RespectPunchThrough = 0x020;
-
- const uint32_t BC6H_FastIndexing = 0x040;
-
- const uint32_t S3TC_Exhaustive = 0x080;
-
- const uint32_t S3TC_Paranoid = 0x100;
-
- const uint32_t Uniform = 0x200;
-
- const uint32_t Fastest = (BC6H_FastIndexing | S3TC_Paranoid);
- const uint32_t Faster = (BC7_EnableDualPlane | BC6H_FastIndexing | S3TC_Paranoid);
- const uint32_t Fast = (BC7_EnablePartitioning | BC7_EnableDualPlane | BC7_FastIndexing | S3TC_Paranoid);
- const uint32_t Default = (BC7_EnablePartitioning | BC7_EnableDualPlane | BC7_Enable3Subsets | BC7_FastIndexing | S3TC_Paranoid);
- const uint32_t Better = (BC7_EnablePartitioning | BC7_EnableDualPlane | BC7_Enable3Subsets | S3TC_Paranoid | S3TC_Exhaustive);
- const uint32_t Ultra = (BC7_EnablePartitioning | BC7_EnableDualPlane | BC7_Enable3Subsets | BC7_TrySingleColor | S3TC_Paranoid | S3TC_Exhaustive);
- }
- const unsigned int NumParallelBlocks = 8;
- struct Options
- {
- uint32_t flags;
- float threshold;
- float redWeight;
- float greenWeight;
- float blueWeight;
- float alphaWeight;
- int refineRoundsBC7;
- int refineRoundsBC6H;
- int refineRoundsIIC;
- int refineRoundsS3TC;
- int seedPoints;
- Options()
- : flags(Flags::Default)
- , threshold(0.5f)
- , redWeight(0.2125f / 0.7154f)
- , greenWeight(1.0f)
- , blueWeight(0.0721f / 0.7154f)
- , alphaWeight(1.0f)
- , refineRoundsBC7(2)
- , refineRoundsBC6H(3)
- , refineRoundsIIC(8)
- , refineRoundsS3TC(2)
- , seedPoints(4)
- {
- }
- };
-
- struct PixelBlockU8
- {
- uint8_t m_pixels[16][4];
- };
-
- struct PixelBlockS8
- {
- int8_t m_pixels[16][4];
- };
-
- struct PixelBlockF16
- {
- int16_t m_pixels[16][4];
- };
- namespace Kernels
- {
-
- void EncodeBC1(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
- void EncodeBC2(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
- void EncodeBC3(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
- void EncodeBC4U(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
- void EncodeBC4S(uint8_t *pBC, const PixelBlockS8 *pBlocks, const Options &options);
- void EncodeBC5U(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
- void EncodeBC5S(uint8_t *pBC, const PixelBlockS8 *pBlocks, const Options &options);
- void EncodeBC6HU(uint8_t *pBC, const PixelBlockF16 *pBlocks, const Options &options);
- void EncodeBC6HS(uint8_t *pBC, const PixelBlockF16 *pBlocks, const Options &options);
- void EncodeBC7(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
- void DecodeBC6HU(PixelBlockF16 *pBlocks, const uint8_t *pBC);
- void DecodeBC6HS(PixelBlockF16 *pBlocks, const uint8_t *pBC);
- void DecodeBC7(PixelBlockU8 *pBlocks, const uint8_t *pBC);
- }
- }
- #endif
|