Go to the source code of this file.
|
static bool | useFixedPointStorage (bool forceFixed16Storage) |
|
void | sampleVectorComponent (String &code, const char *declaration, const char *variable, const char *uniform, const char *coordinate, int delta=-1) |
|
static void | declareGlsl16bitFixedPointFunctions (StringBuilder &code, const char *suffix, bool pack, bool unpackVec, bool unpackScalar, unsigned int packPrecision=8, unsigned int unpackPrecision=8) |
| Generates GLSL code of float to 16-bit fixed point packing/unpacking functions. More...
|
|
static float | unpackFloatFrom16bit (const uint8_t lsb, const int msb) |
| Converts 16-bit fixed-point number into a floating point number. More...
|
|
static void | packFloatTo16bit (const float value, uint8_t &lsb, uint8_t &msb) |
| Packs a floating point value into a 16-bit fixed-point value. More...
|
|
static void | findMinMax (const float *values, const int count, float &minVal, float &maxVal) |
|
◆ useFixedPointStorage()
static bool useFixedPointStorage |
( |
bool |
forceFixed16Storage | ) |
|
|
inlinestatic |
Definition at line 44 of file linear_mapping.cpp.
45 #ifdef BEATMUP_OPENGLVERSION_GLES20
48 return forceFixed16Storage;
◆ sampleVectorComponent()
void sampleVectorComponent |
( |
String & |
code, |
|
|
const char * |
declaration, |
|
|
const char * |
variable, |
|
|
const char * |
uniform, |
|
|
const char * |
coordinate, |
|
|
int |
delta = -1 |
|
) |
| |
Definition at line 62 of file linear_mapping.cpp.
StringBuilder & line(const std::string &append)
StringBuilder & printf(const char *format,...)
static const int VECTOR_MAIN_DIM
static const char * UNIFORM_DELTA
static const int VECTOR_TEXTURE_DIMS
◆ declareGlsl16bitFixedPointFunctions()
static void declareGlsl16bitFixedPointFunctions |
( |
StringBuilder & |
code, |
|
|
const char * |
suffix, |
|
|
bool |
pack, |
|
|
bool |
unpackVec, |
|
|
bool |
unpackScalar, |
|
|
unsigned int |
packPrecision = 8 , |
|
|
unsigned int |
unpackPrecision = 8 |
|
) |
| |
|
inlinestatic |
Generates GLSL code of float to 16-bit fixed point packing/unpacking functions.
- Parameters
-
[in,out] | code | String builder containing the shader source code |
[in] | suffix | A suffix to add to the function names |
[in] | pack | If true , the packing function code is added |
[in] | unpackVec | If true , the vector unpacking function code is added (producing a vec4 from two vec4) |
[in] | unpackScalar | If true , the scalar unpacking function code is added (producing a float from two floats) |
[in] | packPrecision | Number of bits storing the fractional part in the resulting packed value |
[in] | unpackPrecision | Number of bits storing the fractional part in the input value to unpack |
Definition at line 92 of file linear_mapping.cpp.
94 code.
printf(
"lowp vec2 pack%s(highp float v) {", suffix);
95 if (packPrecision != 8)
96 code.
printf(
"v *= %0.1f;", packPrecision > 8 ? (
float)(1 << (packPrecision - 8)) : 1.0f / (1 << (packPrecision - 8)));
98 " return vec2((256.0 / 255.0) * fract(v), (1.0 / 255.0) * floor(v) + (128.0 / 255.0));"
103 scaleMsb = unpackPrecision > 8 ? 1.0f / (1 << (unpackPrecision - 8)) : (float)(1 << (unpackPrecision - 8)),
104 scaleLsb = 255.0f * scaleMsb;
107 "highp vec4 unpack%s(lowp vec4 lsb, lowp vec4 msb) {"
108 " return lsb * (%0.5f / 256.0) + floor(255.0 * msb - 127.5) * %0.5f;"
110 suffix, scaleLsb, scaleMsb
114 "highp float unpack%s(lowp float lsb, lowp float msb) {"
115 " return lsb * (%0.5f / 256.0) + floor(255.0 * msb - 127.5) * %0.5f;"
117 suffix, scaleLsb, scaleMsb
◆ unpackFloatFrom16bit()
static float unpackFloatFrom16bit |
( |
const uint8_t |
lsb, |
|
|
const int |
msb |
|
) |
| |
|
inlinestatic |
Converts 16-bit fixed-point number into a floating point number.
- Parameters
-
[in] | lsb | The least significant byte of the input fixed-point value |
[in] | msb | The most significant byte of the input fixed-point value |
- Returns
- the floating-point value.
Definition at line 128 of file linear_mapping.cpp.
◆ packFloatTo16bit()
static void packFloatTo16bit |
( |
const float |
value, |
|
|
uint8_t & |
lsb, |
|
|
uint8_t & |
msb |
|
) |
| |
|
inlinestatic |
Packs a floating point value into a 16-bit fixed-point value.
The resulting representation matches the formulas in unpackFloatFrom16bit(..) and packFloatTo16bit(..) A biased clamping-friendly formulation is used: "0.0" on input produces the most significant channel value of "0.5".
- Parameters
-
[in] | value | The input value to pack |
[in] | lsb | The least significant byte in the output fixed-point value |
[in] | msb | The most significant byte in the output fixed-point value |
Definition at line 141 of file linear_mapping.cpp.
146 lsb = ptr.bytes & 0xff;
147 msb = (ptr.bytes >> 8) + 128;
return(jlong) new Beatmup jlong jstring jint val
◆ findMinMax()
static void findMinMax |
( |
const float * |
values, |
|
|
const int |
count, |
|
|
float & |
minVal, |
|
|
float & |
maxVal |
|
) |
| |
|
inlinestatic |
Definition at line 151 of file linear_mapping.cpp.
152 minVal = maxVal = values[0];
153 for (
int i = 1; i <
count; ++i) {
154 minVal =
std::min(minVal, values[i]);
155 maxVal =
std::max(maxVal, values[i]);
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
CustomPoint< numeric > max(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
JNIEnv jlong jint jint count
◆ UNIFORM_MATRIX
const char* UNIFORM_MATRIX = "mtrx" |
|
static |
◆ UNIFORM_INPUT
const char* UNIFORM_INPUT = "inp" |
|
static |
◆ UNIFORM_BIAS
const char* UNIFORM_BIAS = "bias" |
|
static |
◆ UNIFORM_DELTA
const char* UNIFORM_DELTA = "dt" |
|
static |
◆ VECTOR_TEXTURE_DIMS
const int VECTOR_TEXTURE_DIMS = 2 |
|
static |
◆ VECTOR_MAIN_DIM
const int VECTOR_MAIN_DIM = 1 |
|
static |