FastUIDraw
|
Utility provides simple utility classes, the most important and commonly used ones being reference_counted_ptr, vecN, and c_array. Part of the main library libFastUIDraw. More...
Namespaces | |
fastuidraw | |
all classes and functions of FastUIDraw are in the namespace fastuidraw. | |
Classes | |
class | fastuidraw::BlendMode |
Class to hold the blend mode as exposed by typical 3D APIs. More... | |
class | fastuidraw::c_array< T > |
A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provide an STL-like iterator interface. More... | |
class | fastuidraw::DataBuffer |
DataBuffer is an implementation of DataBufferBase where the data is directly backed by memory. More... | |
class | fastuidraw::DataBufferBackingStore |
Represents a buffer directly stored in memory. More... | |
class | fastuidraw::DataBufferBase |
Base class for passing around buffers of data; derived classes have the responsibility of maintaining storage cleanup at destruction. More... | |
class | fastuidraw::gpu_dirty_state |
class | fastuidraw::matrix3x3< T > |
A representation of a 3x3 matrix, that in addition to the NxN matrix functionality provides function for calculating the determinant. More... | |
class | fastuidraw::matrixNxM< N, M, T > |
A generic matrix class. The operator() is overloaded to access elements of the matrix as follows: More... | |
class | fastuidraw::Mutex |
class | fastuidraw::orthogonal_projection_params< T > |
An orthogonal_projection_params holds the data to describe an orthogonal projection matrix without perspective. More... | |
class | fastuidraw::projection_params< T > |
A projection_params holds the data to describe a projection matrix with perspective. More... | |
class | fastuidraw::reference_count_atomic |
Reference counter that is thread safe by having increment and decrement operations by atomic operations, this is usually faster (and much faster) than reference_count_mutex. More... | |
class | fastuidraw::reference_count_non_concurrent |
Reference counter that is NOT thread safe. More... | |
class | fastuidraw::reference_counted< T > |
Defines default reference counting base classes. More... | |
class | fastuidraw::reference_counted_base< T, Counter > |
Base class to use for reference counted objects, for using reference_counted_ptr. See also reference_counted. Object deletion (when the reference count goes to zero) is performed via FASTUIDRAWdelete. As a consequence of using FASTUIDRAWdelete, objects must be created with FASTUIDRAWnew. More... | |
class | fastuidraw::reference_counted_ptr< T > |
A wrapper over a pointer to implement reference counting. More... | |
class | fastuidraw::resource_base |
A common base class to use for resources that need to be saved opaquely. More... | |
class | fastuidraw::static_resource |
Provided as a conveniance. The ctor calls generate_static_resource(). More... | |
class | fastuidraw::unvecN< T > |
class | fastuidraw::vecN< T, N > |
vecN is a simple static array class with no virtual functions and no memory overhead. Supports runtim array index checking and STL style iterators via pointer iterators. More... | |
Macros | |
#define | FASTUIDRAW_MASK(BIT0, NUMBITS) (FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS(NUMBITS) << uint32_t(BIT0)) |
#define | FASTUIDRAW_MASK_U64(BIT0, NUMBITS) (FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64(NUMBITS) << uint64_t(BIT0)) |
#define | FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS(X) ( (uint32_t(1) << uint32_t(X)) - uint32_t(1) ) |
#define | FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64(X) ( (uint64_t(1) << uint64_t(X)) - uint64_t(1) ) |
#define | FASTUIDRAW_NUMBER_BLOCK4_NEEDED(X) (FASTUIDRAW_ROUND_UP_MULTIPLE_OF4(X) >> 2u) |
#define | FASTUIDRAW_PI 3.14159265358979323846f |
#define | FASTUIDRAW_ROUND_UP_MULTIPLE_OF4(X) (((X) + 3u) & ~3u) |
#define | FASTUIDRAWassert(X) |
#define | FASTUIDRAWcalloc(nmemb, size) fastuidraw::memory::calloc_implement(nmemb, size, __FILE__, __LINE__) |
#define | FASTUIDRAWdelete(ptr) |
#define | FASTUIDRAWfree(ptr) fastuidraw::memory::free_implement(ptr, __FILE__, __LINE__) |
#define | FASTUIDRAWmalloc(size) fastuidraw::memory::malloc_implement(size, __FILE__, __LINE__) |
#define | FASTUIDRAWmessaged_assert(X, Y) |
#define | FASTUIDRAWnew ::new(__FILE__, __LINE__) |
#define | FASTUIDRAWrealloc(ptr, size) fastuidraw::memory::realloc_implement(ptr, size, __FILE__, __LINE__) |
#define | FASTUIDRAWstatic_assert(X) static_assert(X, #X) |
#define | FASTUIDRAWunused(X) do { (void)(X); } while(0) |
Typedefs | |
typedef vecN< double, 1 > | fastuidraw::dvec1 |
typedef vecN< double, 2 > | fastuidraw::dvec2 |
typedef vecN< double, 3 > | fastuidraw::dvec3 |
typedef vecN< double, 4 > | fastuidraw::dvec4 |
typedef matrixNxM< 2, 2, float > | fastuidraw::float2x2 |
Convenience typedef to matrixNxM<2, float> | |
typedef matrix3x3< float > | fastuidraw::float3x3 |
Convenience typedef to matrix3x3<float> | |
typedef orthogonal_projection_params< float > | fastuidraw::float_orthogonal_projection_params |
Convenience typedef for orthogonal_projection_params<float> | |
typedef projection_params< float > | fastuidraw::float_projection_params |
Convenience typedef for projection_params<float> | |
typedef vecN< int16_t, 1 > | fastuidraw::i16vec1 |
typedef vecN< int16_t, 2 > | fastuidraw::i16vec2 |
typedef vecN< int16_t, 3 > | fastuidraw::i16vec3 |
typedef vecN< int16_t, 4 > | fastuidraw::i16vec4 |
typedef vecN< int32_t, 1 > | fastuidraw::i32vec1 |
typedef vecN< int32_t, 2 > | fastuidraw::i32vec2 |
typedef vecN< int32_t, 3 > | fastuidraw::i32vec3 |
typedef vecN< int32_t, 4 > | fastuidraw::i32vec4 |
typedef vecN< int64_t, 1 > | fastuidraw::i64vec1 |
typedef vecN< int64_t, 2 > | fastuidraw::i64vec2 |
typedef vecN< int64_t, 3 > | fastuidraw::i64vec3 |
typedef vecN< int64_t, 4 > | fastuidraw::i64vec4 |
typedef vecN< int8_t, 1 > | fastuidraw::i8vec1 |
typedef vecN< int8_t, 2 > | fastuidraw::i8vec2 |
typedef vecN< int8_t, 3 > | fastuidraw::i8vec3 |
typedef vecN< int8_t, 4 > | fastuidraw::i8vec4 |
typedef vecN< int32_t, 1 > | fastuidraw::ivec1 |
typedef vecN< int32_t, 2 > | fastuidraw::ivec2 |
typedef vecN< int32_t, 3 > | fastuidraw::ivec3 |
typedef vecN< int32_t, 4 > | fastuidraw::ivec4 |
typedef vecN< uint16_t, 1 > | fastuidraw::u16vec1 |
typedef vecN< uint16_t, 2 > | fastuidraw::u16vec2 |
typedef vecN< uint16_t, 3 > | fastuidraw::u16vec3 |
typedef vecN< uint16_t, 4 > | fastuidraw::u16vec4 |
typedef vecN< uint32_t, 1 > | fastuidraw::u32vec1 |
typedef vecN< uint32_t, 2 > | fastuidraw::u32vec2 |
typedef vecN< uint32_t, 3 > | fastuidraw::u32vec3 |
typedef vecN< uint32_t, 4 > | fastuidraw::u32vec4 |
typedef vecN< uint64_t, 1 > | fastuidraw::u64vec1 |
typedef vecN< uint64_t, 2 > | fastuidraw::u64vec2 |
typedef vecN< uint64_t, 3 > | fastuidraw::u64vec3 |
typedef vecN< uint64_t, 4 > | fastuidraw::u64vec4 |
typedef vecN< uint8_t, 1 > | fastuidraw::u8vec1 |
typedef vecN< uint8_t, 2 > | fastuidraw::u8vec2 |
typedef vecN< uint8_t, 3 > | fastuidraw::u8vec3 |
typedef vecN< uint8_t, 4 > | fastuidraw::u8vec4 |
typedef vecN< uint32_t, 1 > | fastuidraw::uvec1 |
typedef vecN< uint32_t, 2 > | fastuidraw::uvec2 |
typedef vecN< uint32_t, 3 > | fastuidraw::uvec3 |
typedef vecN< uint32_t, 4 > | fastuidraw::uvec4 |
typedef vecN< float, 1 > | fastuidraw::vec1 |
typedef vecN< float, 2 > | fastuidraw::vec2 |
typedef vecN< float, 3 > | fastuidraw::vec3 |
typedef vecN< float, 4 > | fastuidraw::vec4 |
Functions | |
void | fastuidraw::convert_to_fp16 (c_array< const float > src, c_array< uint16_t > dst) |
void | fastuidraw::convert_to_fp32 (c_array< const uint16_t > src, c_array< float > dst) |
template<typename T > | |
vecN< T, 3 > | fastuidraw::cross_product (const vecN< T, 3 > &a, const vecN< T, 3 > &b) |
template<typename T , size_t N> | |
T | fastuidraw::dot (const vecN< T, N > &a, const vecN< T, N > &b) |
c_array< const uint8_t > | fastuidraw::fetch_static_resource (c_string resource_label) |
void | fastuidraw::generate_static_resource (c_string resource_label, c_array< const uint8_t > value) |
void | fastuidraw::generate_static_resource (c_string resource_label, c_string value) |
float | fastuidraw::local_distance_from_pixel_distance (float distance, const vec2 &resolution, const float3x3 &transformation_matrix, const vec2 &point, const vec2 &direction) |
template<typename T , size_t N> | |
T | fastuidraw::magnitude (const vecN< T, N > &in) |
template<typename T , size_t N> | |
bool | fastuidraw::magnitude_compare (const vecN< T, N > &a, const vecN< T, N > &b) |
template<typename T , size_t N> | |
T | fastuidraw::magnitudeSq (const vecN< T, N > &in) |
template<typename T , typename S > | |
bool | fastuidraw::operator!= (T *lhs, const reference_counted_ptr< S > &rhs) |
template<typename T , typename S > | |
bool | fastuidraw::operator== (T *lhs, const reference_counted_ptr< S > &rhs) |
uint32_t | fastuidraw::pack_as_fp16 (vec2 src) |
uint32_t | fastuidraw::pack_as_fp16 (float x, float y) |
uvec4 | fastuidraw::pack_vec4 (float x, float y, float z, float w) |
uvec4 | fastuidraw::pack_vec4 (const vec4 &v) |
template<typename T > | |
void | fastuidraw::swap (reference_counted_ptr< T > &lhs, reference_counted_ptr< T > &rhs) |
int | fastuidraw::t_abs (int x) |
long | fastuidraw::t_abs (long x) |
long long | fastuidraw::t_abs (long long x) |
float | fastuidraw::t_abs (float x) |
double | fastuidraw::t_abs (double x) |
long double | fastuidraw::t_abs (long double x) |
float | fastuidraw::t_acos (float x) |
double | fastuidraw::t_acos (double x) |
long double | fastuidraw::t_acos (long double x) |
float | fastuidraw::t_asin (float x) |
double | fastuidraw::t_asin (double x) |
long double | fastuidraw::t_asin (long double x) |
float | fastuidraw::t_atan (float x) |
double | fastuidraw::t_atan (double x) |
long double | fastuidraw::t_atan (long double x) |
float | fastuidraw::t_atan2 (float y, float x) |
double | fastuidraw::t_atan2 (double y, double x) |
long double | fastuidraw::t_atan2 (long double y, long double x) |
float | fastuidraw::t_cos (float x) |
double | fastuidraw::t_cos (double x) |
long double | fastuidraw::t_cos (long double x) |
template<typename T > | |
const T & | fastuidraw::t_max (const T &a, const T &b) |
template<typename T > | |
const T & | fastuidraw::t_min (const T &a, const T &b) |
template<typename T > | |
T | fastuidraw::t_sign (const T &a) |
float | fastuidraw::t_sin (float x) |
double | fastuidraw::t_sin (double x) |
long double | fastuidraw::t_sin (long double x) |
float | fastuidraw::t_sqrt (float x) |
double | fastuidraw::t_sqrt (double x) |
long double | fastuidraw::t_sqrt (long double x) |
float | fastuidraw::t_tan (float x) |
double | fastuidraw::t_tan (double x) |
long double | fastuidraw::t_tan (long double x) |
template<typename T , size_t N> | |
T | fastuidraw::triangle_area (const vecN< T, N > &p0, const vecN< T, N > &p1, const vecN< T, N > &p2) |
Utility provides simple utility classes, the most important and commonly used ones being reference_counted_ptr, vecN, and c_array. Part of the main library libFastUIDraw.
#define FASTUIDRAW_MASK | ( | BIT0, | |
NUMBITS | |||
) | (FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS(NUMBITS) << uint32_t(BIT0)) |
#define FASTUIDRAW_MASK_U64 | ( | BIT0, | |
NUMBITS | |||
) | (FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64(NUMBITS) << uint64_t(BIT0)) |
#define FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS | ( | X | ) | ( (uint32_t(1) << uint32_t(X)) - uint32_t(1) ) |
#define FASTUIDRAW_MAX_VALUE_FROM_NUM_BITS_U64 | ( | X | ) | ( (uint64_t(1) << uint64_t(X)) - uint64_t(1) ) |
#define FASTUIDRAW_NUMBER_BLOCK4_NEEDED | ( | X | ) | (FASTUIDRAW_ROUND_UP_MULTIPLE_OF4(X) >> 2u) |
#define FASTUIDRAW_PI 3.14159265358979323846f |
#define FASTUIDRAW_ROUND_UP_MULTIPLE_OF4 | ( | X | ) | (((X) + 3u) & ~3u) |
#define FASTUIDRAWassert | ( | X | ) |
#define FASTUIDRAWcalloc | ( | nmemb, | |
size | |||
) | fastuidraw::memory::calloc_implement(nmemb, size, __FILE__, __LINE__) |
For debug build of FastUIDraw, allocations with FASTUIDRAWcalloc are tracked and at program exit a list of those objects not deleted by FASTUIDRAWfree are printed with the file and line number of the allocation. For release builds of FastUIDraw, maps to std::calloc.
nmemb | number of elements to allocate |
size | size of each element in bytes |
Definition at line 73 of file fastuidraw_memory.hpp.
#define FASTUIDRAWdelete | ( | ptr | ) |
Use FASTUIDRAWdelete to delete objects that were allocated with FASTUIDRAWnew. For debug builds of FastUIDraw, if the memory was not tracked an error message is emitted.
ptr | address of object to delete, value must be a return value from FASTUIDRAWnew |
Definition at line 49 of file fastuidraw_memory.hpp.
#define FASTUIDRAWfree | ( | ptr | ) | fastuidraw::memory::free_implement(ptr, __FILE__, __LINE__) |
Use FASTUIDRAWfree for objects allocated with FASTUIDRAWmalloc, FASTUIDRAWrealloc and FASTUIDRAWcalloc. For release builds of FastUIDraw, maps to std::free.
ptr | address of object to free |
Definition at line 93 of file fastuidraw_memory.hpp.
#define FASTUIDRAWmalloc | ( | size | ) | fastuidraw::memory::malloc_implement(size, __FILE__, __LINE__) |
For debug build of FastUIDraw, allocations with FASTUIDRAWmalloc are tracked and at program exit a list of those objects not deleted by FASTUIDRAWfree are printed with the file and line number of the allocation. For release builds of FastUIDraw, maps to std::malloc.
Definition at line 62 of file fastuidraw_memory.hpp.
#define FASTUIDRAWmessaged_assert | ( | X, | |
Y | |||
) |
Regardless FASTUIDRAW_DEBUG is defined or not, checks if the statement is true and if it is not true prints to std::cerr. If FASTUIDRAW_DEBUG is defined also aborts.
X | condition to check |
Y | string to print if condition is false |
#define FASTUIDRAWnew ::new(__FILE__, __LINE__) |
When creating FastUIDraw objects, one must use FASTUIDRAWnew instead of new to create objects. For debug build of FastUIDraw, allocations with FASTUIDRAWnew are tracked and at program exit a list of those objects not deleted by FASTUIDRAWdelete are printed with the file and line number of the allocation. For release builds of FastUIDraw, allocations are not tracked and std::malloc is used to allocate memory. Do NOT use FASTUIDRAWnew for creating arrays (i.e. p = new type[N]) as FASTUIDRAWdelete does not handle array deletion.
Definition at line 39 of file fastuidraw_memory.hpp.
#define FASTUIDRAWrealloc | ( | ptr, | |
size | |||
) | fastuidraw::memory::realloc_implement(ptr, size, __FILE__, __LINE__) |
For debug build of FastUIDraw, allocations with FASTUIDRAWrealloc are tracked and at program exit a list of those objects not deleted by FASTUIDRAWfree are printed with the file and line number of the allocation. For release builds of FastUIDraw, maps to std::realloc.
ptr | pointer at which to rellocate |
size | new size |
Definition at line 84 of file fastuidraw_memory.hpp.
#define FASTUIDRAWstatic_assert | ( | X | ) | static_assert(X, #X) |
#define FASTUIDRAWunused | ( | X | ) | do { (void)(X); } while(0) |
typedef vecN<double, 1> fastuidraw::dvec1 |
typedef vecN<double, 2> fastuidraw::dvec2 |
typedef vecN<double, 3> fastuidraw::dvec3 |
typedef vecN<double, 4> fastuidraw::dvec4 |
typedef vecN<int16_t, 1> fastuidraw::i16vec1 |
typedef vecN<int16_t, 2> fastuidraw::i16vec2 |
typedef vecN<int16_t, 3> fastuidraw::i16vec3 |
typedef vecN<int16_t, 4> fastuidraw::i16vec4 |
typedef vecN<int32_t, 1> fastuidraw::i32vec1 |
typedef vecN<int32_t, 2> fastuidraw::i32vec2 |
typedef vecN<int32_t, 3> fastuidraw::i32vec3 |
typedef vecN<int32_t, 4> fastuidraw::i32vec4 |
typedef vecN<int64_t, 1> fastuidraw::i64vec1 |
typedef vecN<int64_t, 2> fastuidraw::i64vec2 |
typedef vecN<int64_t, 3> fastuidraw::i64vec3 |
typedef vecN<int64_t, 4> fastuidraw::i64vec4 |
typedef vecN<int8_t, 1> fastuidraw::i8vec1 |
typedef vecN<int8_t, 2> fastuidraw::i8vec2 |
typedef vecN<int8_t, 3> fastuidraw::i8vec3 |
typedef vecN<int8_t, 4> fastuidraw::i8vec4 |
typedef vecN<int32_t, 1> fastuidraw::ivec1 |
typedef vecN<int32_t, 2> fastuidraw::ivec2 |
typedef vecN<int32_t, 3> fastuidraw::ivec3 |
typedef vecN<int32_t, 4> fastuidraw::ivec4 |
typedef vecN<uint16_t, 1> fastuidraw::u16vec1 |
typedef vecN<uint16_t, 2> fastuidraw::u16vec2 |
typedef vecN<uint16_t, 3> fastuidraw::u16vec3 |
typedef vecN<uint16_t, 4> fastuidraw::u16vec4 |
typedef vecN<uint32_t, 1> fastuidraw::u32vec1 |
typedef vecN<uint32_t, 2> fastuidraw::u32vec2 |
typedef vecN<uint32_t, 3> fastuidraw::u32vec3 |
typedef vecN<uint32_t, 4> fastuidraw::u32vec4 |
typedef vecN<uint64_t, 1> fastuidraw::u64vec1 |
typedef vecN<uint64_t, 2> fastuidraw::u64vec2 |
typedef vecN<uint64_t, 3> fastuidraw::u64vec3 |
typedef vecN<uint64_t, 4> fastuidraw::u64vec4 |
typedef vecN<uint8_t, 1> fastuidraw::u8vec1 |
typedef vecN<uint8_t, 2> fastuidraw::u8vec2 |
typedef vecN<uint8_t, 3> fastuidraw::u8vec3 |
typedef vecN<uint8_t, 4> fastuidraw::u8vec4 |
typedef vecN<uint32_t, 1> fastuidraw::uvec1 |
typedef vecN<uint32_t, 2> fastuidraw::uvec2 |
typedef vecN<uint32_t, 3> fastuidraw::uvec3 |
typedef vecN<uint32_t, 4> fastuidraw::uvec4 |
typedef vecN<float, 1> fastuidraw::vec1 |
typedef vecN<float, 2> fastuidraw::vec2 |
typedef vecN<float, 3> fastuidraw::vec3 |
typedef vecN<float, 4> fastuidraw::vec4 |
Convert an array of 32-bit floating point values to an array of 16-bit half values
src | fp32 value to convert |
dst | location to which to write fp16 values |
Convert an array of 16-bit floating point values to an array of 32-bit half values
src | fp16 value to convert |
dst | location to which to write fp32 values |
Returns the data behind a resource. If no resource is found, returns an empty const_c_array.
resource_label | label of resource as specified by generate_static_resource(). |
void fastuidraw::generate_static_resource | ( | c_string | resource_label, |
c_array< const uint8_t > | value | ||
) |
Generate and store a resource for use. Once a resource is added it cannot be removed.
resource_label | "name" of resource, the string is copied |
value | "value" of resource, the data behind value is copied |
Generate and store a resource for use. Once a resource is added it cannot be removed.
resource_label | "name" of resource, the string is copied |
value | "value" of resource, the data behind value is copied, the value is though of as a string and thus must be null-terminated. The created resource includes the end-of-string marker. |
float fastuidraw::local_distance_from_pixel_distance | ( | float | distance, |
const vec2 & | resolution, | ||
const float3x3 & | transformation_matrix, | ||
const vec2 & | point, | ||
const vec2 & | direction | ||
) |
Given a direction and location in LOCAL coordinates and a distance value in pixel coordinates, return that distance value in local coordinates.
distance | distance value in pixel coordinates |
resolution | resolution of viewport |
transformation_matrix | transformation matrix from local coordinates to clip-coordinates |
point | location in local coordinates |
direction | direction in local coordinates |
|
inline |
|
inline |
|
inline |
Inequality comparison operator
lhs | left hand side of operator |
rhs | right hand side of operator |
Definition at line 393 of file reference_counted.hpp.
|
inline |
Equality comparison operator
lhs | left hand side of operator |
rhs | right hand side of operator |
Definition at line 379 of file reference_counted.hpp.
|
inline |
Conveniance function to pack a single vec2 into an fp16-pair returned as a uint32_t.
src | float-pair to pack as an fp16-pair. |
Definition at line 474 of file c_array.hpp.
|
inline |
Provided as a conveniance, equivalent to
Definition at line 490 of file c_array.hpp.
|
inline |
Pack 4 float values into a uvec4 values via pack_float().
x | x-value |
y | y-value |
z | z-value |
w | w-value |
Pack a vec4 into a uvec4 values via pack_float().
v | value to pack |
|
inline |
swap() routine, equivalent to
lhs | object to swap |
rhs | object to swap |
Definition at line 410 of file reference_counted.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |