Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved compressed blitting into its own class for readability & easier…
… maintenance.
- Loading branch information
Showing
12 changed files
with
1,939 additions
and
1,551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
|
||
#ifndef SL_BLIT_COMPRESSED_PROCESSOR_HPP | ||
#define SL_BLIT_COMPRESSED_PROCESSOR_HPP | ||
|
||
#include <cstdint> | ||
|
||
|
||
|
||
/*----------------------------------------------------------------------------- | ||
* Forward Declarations | ||
-----------------------------------------------------------------------------*/ | ||
class SL_Texture; | ||
|
||
|
||
|
||
/**---------------------------------------------------------------------------- | ||
* @brief The Blit Processor helps to perform texture blitting to the native | ||
* window backbuffer on another thread. | ||
* | ||
* Much of the blitting routines are templated to support conversion between | ||
* possible texture types and the backbuffer (which is an 8-bit RGBA buffer). | ||
* | ||
* Texture blitting uses nearest-neighbor filtering to increase or decrease the | ||
* resolution and fit the backbuffer. Fixed-point calculation is used to avoid | ||
* precision errors and increase ALU throughput. Benchmarks on x86 and ARM has | ||
* shown that floating-point logic performs worse in this area. | ||
-----------------------------------------------------------------------------*/ | ||
struct SL_BlitCompressedProcessor | ||
{ | ||
enum : uint_fast32_t | ||
{ | ||
NUM_FIXED_BITS = 16u | ||
}; | ||
|
||
// 32 bits | ||
uint16_t mThreadId; | ||
uint16_t mNumThreads; | ||
|
||
// 64-bits | ||
uint16_t srcX0; | ||
uint16_t srcY0; | ||
uint16_t srcX1; | ||
uint16_t srcY1; | ||
|
||
// 64-bits | ||
uint16_t dstX0; | ||
uint16_t dstY0; | ||
uint16_t dstX1; | ||
uint16_t dstY1; | ||
|
||
// 64-128 bits | ||
const SL_Texture* mTexture; | ||
SL_Texture* mBackBuffer; | ||
|
||
// 224-288 bits total, 28-36 bytes | ||
|
||
// Blit a single R channel | ||
template<typename inColor_type> | ||
void blit_src_r() noexcept; | ||
|
||
// Blit a texture with only RG color channels | ||
template<typename inColor_type> | ||
void blit_src_rg() noexcept; | ||
|
||
// Blit an RGB texture | ||
template<typename inColor_type> | ||
void blit_src_rgb() noexcept; | ||
|
||
// Blit all 4 color components | ||
template<typename inColor_type> | ||
void blit_src_rgba() noexcept; | ||
|
||
// Blit compressed color components | ||
template<typename inColor_type> | ||
void blit_src_compressed() noexcept; | ||
|
||
// Blit all 4 color components | ||
template<class BlitOp> | ||
void blit_nearest() noexcept; | ||
|
||
void execute() noexcept; | ||
}; | ||
|
||
|
||
|
||
#endif /* SL_BLIT_COMPRESSED_PROCESSOR_HPP */ |
Oops, something went wrong.