Added support for GL_R11F_G11F_B10F textures.

TRAC #23052 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2371 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent b1dc1b6a
...@@ -110,6 +110,16 @@ inline bool supportsSSE2() ...@@ -110,6 +110,16 @@ inline bool supportsSSE2()
return supports; return supports;
} }
template <typename destType, typename sourceType>
destType bitCast(const sourceType &source)
{
META_ASSERT(sizeof(destType) >= sizeof(sourceType));
destType output;
memcpy(&output, &source, sizeof(sourceType));
return output;
}
inline unsigned short float32ToFloat16(float fp32) inline unsigned short float32ToFloat16(float fp32)
{ {
unsigned int fp32i = (unsigned int&)fp32; unsigned int fp32i = (unsigned int&)fp32;
...@@ -147,6 +157,222 @@ float float16ToFloat32(unsigned short h); ...@@ -147,6 +157,222 @@ float float16ToFloat32(unsigned short h);
unsigned int convertRGBFloatsTo999E5(float red, float green, float blue); unsigned int convertRGBFloatsTo999E5(float red, float green, float blue);
void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float *blue); void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float *blue);
inline unsigned short float32ToFloat11(float fp32)
{
const unsigned int float32MantissaMask = 0x7FFFFF;
const unsigned int float32ExponentMask = 0x7F800000;
const unsigned int float32SignMask = 0x80000000;
const unsigned int float32ValueMask = ~float32SignMask;
const unsigned int float32ExponentFirstBit = 23;
const unsigned int float32ExponentBias = 127;
const unsigned short float11Max = 0x7BF;
const unsigned short float11MantissaMask = 0x3F;
const unsigned short float11ExponentMask = 0x7C0;
const unsigned short float11BitMask = 0x7FF;
const unsigned int float11ExponentBias = 14;
const unsigned int float32Maxfloat11 = 0x477E0000;
const unsigned int float32Minfloat11 = 0x38800000;
const unsigned int float32Bits = bitCast<unsigned int>(fp32);
const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask;
unsigned int float32Val = float32Bits & float32ValueMask;
if ((float32Val & float32ExponentMask) == float32ExponentMask)
{
// INF or NAN
if ((float32Val & float32MantissaMask) != 0)
{
return float11ExponentMask | (((float32Val >> 17) | (float32Val >> 11) | (float32Val >> 6) | (float32Val)) & float11MantissaMask);
}
else if (float32Sign)
{
// -INF is clamped to 0 since float11 is positive only
return 0;
}
else
{
return float11ExponentMask;
}
}
else if (float32Sign)
{
// float11 is positive only, so clamp to zero
return 0;
}
else if (float32Val > float32Maxfloat11)
{
// The number is too large to be represented as a float11, set to max
return float11Max;
}
else
{
if (float32Val < float32Minfloat11)
{
// The number is too small to be represented as a normalized float11
// Convert it to a denormalized value.
const unsigned int shift = (float32ExponentBias - float11ExponentBias) - (float32Val >> float32ExponentFirstBit);
float32Val = ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift;
}
else
{
// Rebias the exponent to represent the value as a normalized float11
float32Val += 0xC8000000;
}
return ((float32Val + 0xFFFF + ((float32Val >> 17) & 1)) >> 17) & float11BitMask;
}
}
inline unsigned short float32ToFloat10(float fp32)
{
const unsigned int float32MantissaMask = 0x7FFFFF;
const unsigned int float32ExponentMask = 0x7F800000;
const unsigned int float32SignMask = 0x80000000;
const unsigned int float32ValueMask = ~float32SignMask;
const unsigned int float32ExponentFirstBit = 23;
const unsigned int float32ExponentBias = 127;
const unsigned short float10Max = 0x3DF;
const unsigned short float10MantissaMask = 0x1F;
const unsigned short float10ExponentMask = 0x3E0;
const unsigned short float10BitMask = 0x3FF;
const unsigned int float10ExponentBias = 14;
const unsigned int float32Maxfloat10 = 0x477C0000;
const unsigned int float32Minfloat10 = 0x38800000;
const unsigned int float32Bits = bitCast<unsigned int>(fp32);
const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask;
unsigned int float32Val = float32Bits & float32ValueMask;
if ((float32Val & float32ExponentMask) == float32ExponentMask)
{
// INF or NAN
if ((float32Val & float32MantissaMask) != 0)
{
return float10ExponentMask | (((float32Val >> 18) | (float32Val >> 13) | (float32Val >> 3) | (float32Val)) & float10MantissaMask);
}
else if (float32Sign)
{
// -INF is clamped to 0 since float11 is positive only
return 0;
}
else
{
return float10ExponentMask;
}
}
else if (float32Sign)
{
// float10 is positive only, so clamp to zero
return 0;
}
else if (float32Val > float32Maxfloat10)
{
// The number is too large to be represented as a float11, set to max
return float10Max;
}
else
{
if (float32Val < float32Minfloat10)
{
// The number is too small to be represented as a normalized float11
// Convert it to a denormalized value.
const unsigned int shift = (float32ExponentBias - float10ExponentBias) - (float32Val >> float32ExponentFirstBit);
float32Val = ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift;
}
else
{
// Rebias the exponent to represent the value as a normalized float11
float32Val += 0xC8000000;
}
return ((float32Val + 0x1FFFF + ((float32Val >> 18) & 1)) >> 18) & float10BitMask;
}
}
inline float float11ToFloat32(unsigned short fp11)
{
unsigned short exponent = (fp11 >> 6) & 0x1F;
unsigned short mantissa = fp11 & 0x3F;
if (exponent == 0x1F)
{
// INF or NAN
return bitCast<float>(0x7f800000 | (mantissa << 17));
}
else
{
if (exponent != 0)
{
// normalized
}
else if (mantissa != 0)
{
// The value is denormalized
exponent = 1;
do
{
exponent--;
mantissa <<= 1;
}
while ((mantissa & 0x40) == 0);
mantissa = mantissa & 0x3F;
}
else // The value is zero
{
exponent = -112;
}
return bitCast<float>(((exponent + 112) << 23) | (mantissa << 17));
}
}
inline float float10ToFloat32(unsigned short fp11)
{
unsigned short exponent = (fp11 >> 5) & 0x1F;
unsigned short mantissa = fp11 & 0x1F;
if (exponent == 0x1F)
{
// INF or NAN
return bitCast<float>(0x7f800000 | (mantissa << 17));
}
else
{
if (exponent != 0)
{
// normalized
}
else if (mantissa != 0)
{
// The value is denormalized
exponent = 1;
do
{
exponent--;
mantissa <<= 1;
}
while ((mantissa & 0x20) == 0);
mantissa = mantissa & 0x1F;
}
else // The value is zero
{
exponent = -112;
}
return bitCast<float>(((exponent + 112) << 23) | (mantissa << 18));
}
}
} }
namespace rx namespace rx
......
...@@ -575,7 +575,7 @@ static InternalFormatInfoMap buildES3InternalFormatInfoMap() ...@@ -575,7 +575,7 @@ static InternalFormatInfoMap buildES3InternalFormatInfoMap()
map.insert(InternalFormatInfoPair(GL_RGB10_A2UI, InternalFormatInfo::RGBAFormat(10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, AlwaysSupported, NeverSupported, UnimplementedSupport))); map.insert(InternalFormatInfoPair(GL_RGB10_A2UI, InternalFormatInfo::RGBAFormat(10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, AlwaysSupported, NeverSupported, UnimplementedSupport)));
map.insert(InternalFormatInfoPair(GL_SRGB8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, NeverSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_SRGB8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_SRGB8_ALPHA8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_SRGB8_ALPHA8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_R11F_G11F_B10F, InternalFormatInfo::RGBAFormat(11, 11, 10, 0, 0, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, NeverSupported, AlwaysSupported, UnimplementedSupport))); map.insert(InternalFormatInfoPair(GL_R11F_G11F_B10F, InternalFormatInfo::RGBAFormat(11, 11, 10, 0, 0, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGB9_E5, InternalFormatInfo::RGBAFormat( 9, 9, 9, 0, 5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, NeverSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_RGB9_E5, InternalFormatInfo::RGBAFormat( 9, 9, 9, 0, 5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_R8I, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, AlwaysSupported, NeverSupported, UnimplementedSupport))); map.insert(InternalFormatInfoPair(GL_R8I, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, AlwaysSupported, NeverSupported, UnimplementedSupport)));
map.insert(InternalFormatInfoPair(GL_R8UI, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, AlwaysSupported, NeverSupported, UnimplementedSupport))); map.insert(InternalFormatInfoPair(GL_R8UI, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, AlwaysSupported, NeverSupported, UnimplementedSupport)));
......
...@@ -66,7 +66,7 @@ static D3D11ES3FormatMap buildD3D11ES3FormatMap() ...@@ -66,7 +66,7 @@ static D3D11ES3FormatMap buildD3D11ES3FormatMap()
map.insert(D3D11ES3FormatPair(GL_RG32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RG32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGB32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGB32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGBA32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGBA32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_R11F_G11F_B10F, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_R11F_G11F_B10F, D3D11ES3FormatInfo(DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGB9_E5, D3D11ES3FormatInfo(DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGB9_E5, D3D11ES3FormatInfo(DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_R8I, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_R8I, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_R8UI, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_R8UI, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
...@@ -221,14 +221,14 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap() ...@@ -221,14 +221,14 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap()
insertLoadFunction(&map, GL_SRGB8, GL_UNSIGNED_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_SRGB8, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_RGB8_SNORM, GL_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGB8_SNORM, GL_BYTE, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_RGB565, GL_UNSIGNED_SHORT_5_6_5, loadRGB565DataToRGBA ); insertLoadFunction(&map, GL_RGB565, GL_UNSIGNED_SHORT_5_6_5, loadRGB565DataToRGBA );
insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_UNSIGNED_INT_10F_11F_11F_REV, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_UNSIGNED_INT_10F_11F_11F_REV, loadToNative<GLuint, 1> );
insertLoadFunction(&map, GL_RGB9_E5, GL_UNSIGNED_INT_5_9_9_9_REV, loadToNative<GLuint, 1> ); insertLoadFunction(&map, GL_RGB9_E5, GL_UNSIGNED_INT_5_9_9_9_REV, loadToNative<GLuint, 1> );
insertLoadFunction(&map, GL_RGB16F, GL_HALF_FLOAT, loadRGBHalfFloatDataToRGBA ); insertLoadFunction(&map, GL_RGB16F, GL_HALF_FLOAT, loadRGBHalfFloatDataToRGBA );
insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_HALF_FLOAT, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_HALF_FLOAT, loadRGBHalfFloatDataTo111110Float );
insertLoadFunction(&map, GL_RGB9_E5, GL_HALF_FLOAT, loadRGBHalfFloatDataTo999E5 ); insertLoadFunction(&map, GL_RGB9_E5, GL_HALF_FLOAT, loadRGBHalfFloatDataTo999E5 );
insertLoadFunction(&map, GL_RGB32F, GL_FLOAT, loadToNative<GLfloat, 3> ); insertLoadFunction(&map, GL_RGB32F, GL_FLOAT, loadToNative<GLfloat, 3> );
insertLoadFunction(&map, GL_RGB16F, GL_FLOAT, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGB16F, GL_FLOAT, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_FLOAT, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_FLOAT, loadRGBFloatDataTo111110Float );
insertLoadFunction(&map, GL_RGB9_E5, GL_FLOAT, loadRGBFloatDataTo999E5 ); insertLoadFunction(&map, GL_RGB9_E5, GL_FLOAT, loadRGBFloatDataTo999E5 );
insertLoadFunction(&map, GL_RGB8UI, GL_UNSIGNED_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGB8UI, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_RGB8I, GL_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGB8I, GL_BYTE, UnimplementedLoadFunction );
...@@ -467,6 +467,7 @@ static DXGIFormatInfoMap buildDXGIFormatInfoMap() ...@@ -467,6 +467,7 @@ static DXGIFormatInfoMap buildDXGIFormatInfoMap()
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGIFormatInfo(128, 1, 1, GL_RGBA32F, GenerateMip<R32G32B32A32F>))); map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGIFormatInfo(128, 1, 1, GL_RGBA32F, GenerateMip<R32G32B32A32F>)));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGIFormatInfo( 32, 1, 1, GL_RGB9_E5, GenerateMip<R9G9B9E5> ))); map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGIFormatInfo( 32, 1, 1, GL_RGB9_E5, GenerateMip<R9G9B9E5> )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R11G11B10_FLOAT, DXGIFormatInfo( 32, 1, 1, GL_R11F_G11F_B10F, GenerateMip<R11G11B10F> )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R16_TYPELESS, DXGIFormatInfo( 16, 1, 1, GL_DEPTH_COMPONENT16, NULL ))); map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R16_TYPELESS, DXGIFormatInfo( 16, 1, 1, GL_DEPTH_COMPONENT16, NULL )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_D16_UNORM, DXGIFormatInfo( 16, 1, 1, GL_DEPTH_COMPONENT16, NULL ))); map.insert(DXGIFormatInfoPair(DXGI_FORMAT_D16_UNORM, DXGIFormatInfo( 16, 1, 1, GL_DEPTH_COMPONENT16, NULL )));
......
...@@ -185,6 +185,20 @@ struct R9G9B9E5 ...@@ -185,6 +185,20 @@ struct R9G9B9E5
} }
}; };
struct R11G11B10F
{
unsigned int R : 11;
unsigned int G : 11;
unsigned int B : 10;
static void average(R11G11B10F *dst, const R11G11B10F *src1, const R11G11B10F *src2)
{
dst->R = gl::float32ToFloat11((gl::float11ToFloat32(src1->R) + gl::float11ToFloat32(src2->R)) * 0.5f);
dst->G = gl::float32ToFloat11((gl::float11ToFloat32(src1->G) + gl::float11ToFloat32(src2->G)) * 0.5f);
dst->B = gl::float32ToFloat10((gl::float10ToFloat32(src1->B) + gl::float10ToFloat32(src2->B)) * 0.5f);
}
};
namespace priv namespace priv
{ {
......
...@@ -756,4 +756,52 @@ void loadRGBFloatDataTo999E5(int width, int height, int depth, ...@@ -756,4 +756,52 @@ void loadRGBFloatDataTo999E5(int width, int height, int depth,
} }
} }
void loadRGBHalfFloatDataTo111110Float(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
{
const unsigned short *source = NULL;
unsigned int *dest = NULL;
for (int z = 0; z < depth; z++)
{
for (int y = 0; y < height; y++)
{
source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
for (int x = 0; x < width; x++)
{
dest[x] = (gl::float32ToFloat11(gl::float16ToFloat32(source[x * 3 + 0])) << 0) |
(gl::float32ToFloat11(gl::float16ToFloat32(source[x * 3 + 1])) << 11) |
(gl::float32ToFloat10(gl::float16ToFloat32(source[x * 3 + 2])) << 22);
}
}
}
}
void loadRGBFloatDataTo111110Float(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
{
const float *source = NULL;
unsigned int *dest = NULL;
for (int z = 0; z < depth; z++)
{
for (int y = 0; y < height; y++)
{
source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
for (int x = 0; x < width; x++)
{
dest[x] = (gl::float32ToFloat11(source[x * 3 + 0]) << 0) |
(gl::float32ToFloat11(source[x * 3 + 1]) << 11) |
(gl::float32ToFloat10(source[x * 3 + 2]) << 22);
}
}
}
}
} }
...@@ -166,6 +166,14 @@ void loadRGBFloatDataTo999E5(int width, int height, int depth, ...@@ -166,6 +166,14 @@ void loadRGBFloatDataTo999E5(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch); void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
void loadRGBHalfFloatDataTo111110Float(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
void loadRGBFloatDataTo111110Float(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
template <typename type, unsigned int componentCount> template <typename type, unsigned int componentCount>
void loadToNative(int width, int height, int depth, void loadToNative(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment