Swizzle< T, mapLength > Class Template Reference#include <swizzle.h>
Inheritance diagram for Swizzle< T, mapLength >: ![]() Detailed Description
This class will swizzle 'sizeof( T )' length chunks of memory into different patterns which are user described.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| Swizzle (const dsize_t *map) | |
| Construct a swizzle. | |
| virtual void | InPlace (void *memory, const dsize_t size) const |
| This method will, in the general case, use the ToBuffer method to swizzle the memory specified into a temporary buffer, allocated by FrameTemp, and then copy the temporary memory into the source memory. | |
| virtual void | ToBuffer (void *destination, const void *source, const dsize_t size) const |
| This method copies the data from source to destination while applying the re-ordering. | |
| template<> | |
| void | InPlace (void *memory, const dsize_t size) const |
| template<> | |
| void | ToBuffer (void *destination, const void *source, const dsize_t size) const |
| template<> | |
| void | InPlace (void *memory, const dsize_t size) const |
| template<> | |
| void | ToBuffer (void *destination, const void *source, const dsize_t size) const |
| template<> | |
| void | ToBuffer (void *__restrict destination, const void *__restrict source, const dsize_t size) const |
Private Attributes | |
| dsize_t | mMap [mapLength] |
| This is an array from 0. | |
| void Swizzle< T, mapLength >::InPlace | ( | void * | memory, | |
| const dsize_t | size | |||
| ) | const [inline, virtual] |
This method will, in the general case, use the ToBuffer method to swizzle the memory specified into a temporary buffer, allocated by FrameTemp, and then copy the temporary memory into the source memory.
| memory | Pointer to the start of the buffer to swizzle | |
| size | Size of the buffer |
Reimplemented in DXT5nmSwizzle, DXT5nmSwizzleUp24t32, and NullSwizzle< T, mapLength >.
| void Swizzle< T, mapLength >::ToBuffer | ( | void * | destination, | |
| const void * | source, | |||
| const dsize_t | size | |||
| ) | const [inline, virtual] |
This method copies the data from source to destination while applying the re-ordering.
This method is, in the non-specalized case, O(N^2) where N is sizeof( T ) / size; the number of instances of type 'T' in the buffer
| destination | The destination of the swizzled data | |
| source | The source data to be swizzled | |
| size | Size of the source and destination buffers. |
Reimplemented in DXT5nmSwizzle, DXT5nmSwizzleUp24t32, and NullSwizzle< T, mapLength >.
Reimplemented in DXT5nmSwizzle, DXT5nmSwizzleUp24t32, and NullSwizzle< T, mapLength >.
| void Swizzle< U8, 4 >::ToBuffer | ( | void * | destination, | |
| const void * | source, | |||
| const dsize_t | size | |||
| ) | const [inline] |
Reimplemented in DXT5nmSwizzle, DXT5nmSwizzleUp24t32, and NullSwizzle< T, mapLength >.
Reimplemented in DXT5nmSwizzle, DXT5nmSwizzleUp24t32, and NullSwizzle< T, mapLength >.
| void Swizzle< U8, 3 >::ToBuffer | ( | void * | destination, | |
| const void * | source, | |||
| const dsize_t | size | |||
| ) | const [inline] |
Reimplemented in DXT5nmSwizzle, DXT5nmSwizzleUp24t32, and NullSwizzle< T, mapLength >.
| void Swizzle< U8, 4 >::ToBuffer | ( | void *__restrict | destination, | |
| const void *__restrict | source, | |||
| const dsize_t | size | |||
| ) | const [inline] |
This is an array from 0.
.n. Each entry in the array is a dsize_t with values in the range 0..n. Each value in the range 0..n can occur any number of times.
For example: This is our data set, an array of characters with 4 elements { 'a', 'b', 'c', 'd' }
If the map { 3, 2, 1, 0 } was applied to this set, the result would be: { 'd', 'c', 'b', 'a' }
If the map { 3, 0, 2, 2 } was applied to the set, the result would be: { 'd', 'a', 'c', 'c' }