Added support for SNORM texture formats.

TRAC #23051 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2372 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a43d829f
...@@ -561,16 +561,16 @@ static InternalFormatInfoMap buildES3InternalFormatInfoMap() ...@@ -561,16 +561,16 @@ static InternalFormatInfoMap buildES3InternalFormatInfoMap()
// | Internal format | | R | G | B | A |S | Format | Type | Color | Texture | Supported | // | Internal format | | R | G | B | A |S | Format | Type | Color | Texture | Supported |
// | | | | | | | | | | renderable | filterable | | // | | | | | | | | | | renderable | filterable | |
map.insert(InternalFormatInfoPair(GL_R8, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_R8, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_R8_SNORM, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED, GL_BYTE, NeverSupported, AlwaysSupported, UnimplementedSupport))); map.insert(InternalFormatInfoPair(GL_R8_SNORM, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED, GL_BYTE, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RG8, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_RG8, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RG8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG, GL_BYTE, NeverSupported, AlwaysSupported, UnimplementedSupport))); map.insert(InternalFormatInfoPair(GL_RG8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG, GL_BYTE, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGB8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_RGB8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGB8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, NeverSupported, AlwaysSupported, UnimplementedSupport))); map.insert(InternalFormatInfoPair(GL_RGB8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGB565, InternalFormatInfo::RGBAFormat( 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, NeverSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_RGB565, InternalFormatInfo::RGBAFormat( 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGBA4, InternalFormatInfo::RGBAFormat( 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, NeverSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_RGBA4, InternalFormatInfo::RGBAFormat( 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGB5_A1, InternalFormatInfo::RGBAFormat( 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, AlwaysSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_RGB5_A1, InternalFormatInfo::RGBAFormat( 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGBA8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_RGBA8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGBA8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, NeverSupported, AlwaysSupported, UnimplementedSupport))); map.insert(InternalFormatInfoPair(GL_RGBA8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, NeverSupported, AlwaysSupported, AlwaysSupported )));
map.insert(InternalFormatInfoPair(GL_RGB10_A2, InternalFormatInfo::RGBAFormat(10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, AlwaysSupported, AlwaysSupported, AlwaysSupported ))); map.insert(InternalFormatInfoPair(GL_RGB10_A2, InternalFormatInfo::RGBAFormat(10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
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 )));
......
...@@ -44,16 +44,16 @@ static D3D11ES3FormatMap buildD3D11ES3FormatMap() ...@@ -44,16 +44,16 @@ static D3D11ES3FormatMap buildD3D11ES3FormatMap()
// | GL internal format | | D3D11 texture format | D3D11 SRV format | D3D11 RTV format | D3D11 DSV format | // | GL internal format | | D3D11 texture format | D3D11 SRV format | D3D11 RTV format | D3D11 DSV format |
map.insert(D3D11ES3FormatPair(GL_NONE, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_NONE, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_R8, D3D11ES3FormatInfo(DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_R8, D3D11ES3FormatInfo(DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_R8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_R8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RG8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RG8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RG8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RG8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGB8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGB8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGB8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGB8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGB565, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGB565, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGBA4, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGBA4, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGB5_A1, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGB5_A1, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGBA8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGBA8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGBA8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGBA8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGB10_A2, D3D11ES3FormatInfo(DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGB10_A2, D3D11ES3FormatInfo(DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_RGB10_A2UI, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_RGB10_A2UI, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
map.insert(D3D11ES3FormatPair(GL_SRGB8, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN))); map.insert(D3D11ES3FormatPair(GL_SRGB8, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
...@@ -201,7 +201,7 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap() ...@@ -201,7 +201,7 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap()
insertLoadFunction(&map, GL_RGB5_A1, GL_UNSIGNED_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGB5_A1, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_RGBA4, GL_UNSIGNED_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGBA4, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_SRGB8_ALPHA8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> ); insertLoadFunction(&map, GL_SRGB8_ALPHA8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
insertLoadFunction(&map, GL_RGBA8_SNORM, GL_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGBA8_SNORM, GL_BYTE, loadToNative<GLbyte, 4> );
insertLoadFunction(&map, GL_RGBA4, GL_UNSIGNED_SHORT_4_4_4_4, loadRGBA4444DataToRGBA ); insertLoadFunction(&map, GL_RGBA4, GL_UNSIGNED_SHORT_4_4_4_4, loadRGBA4444DataToRGBA );
insertLoadFunction(&map, GL_RGB10_A2, GL_UNSIGNED_INT_2_10_10_10_REV, loadToNative<GLuint, 1> ); insertLoadFunction(&map, GL_RGB10_A2, GL_UNSIGNED_INT_2_10_10_10_REV, loadToNative<GLuint, 1> );
insertLoadFunction(&map, GL_RGB5_A1, GL_UNSIGNED_SHORT_5_5_5_1, loadRGBA5551DataToRGBA ); insertLoadFunction(&map, GL_RGB5_A1, GL_UNSIGNED_SHORT_5_5_5_1, loadRGBA5551DataToRGBA );
...@@ -219,7 +219,7 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap() ...@@ -219,7 +219,7 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap()
insertLoadFunction(&map, GL_RGB8, GL_UNSIGNED_BYTE, loadRGBUByteDataToRGBA ); insertLoadFunction(&map, GL_RGB8, GL_UNSIGNED_BYTE, loadRGBUByteDataToRGBA );
insertLoadFunction(&map, GL_RGB565, GL_UNSIGNED_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGB565, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
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, loadRGBSByteDataToRGBA );
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, loadToNative<GLuint, 1> ); 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> );
...@@ -237,7 +237,7 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap() ...@@ -237,7 +237,7 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap()
insertLoadFunction(&map, GL_RGB32UI, GL_UNSIGNED_INT, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGB32UI, GL_UNSIGNED_INT, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_RGB32I, GL_INT, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RGB32I, GL_INT, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_RG8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 2> ); insertLoadFunction(&map, GL_RG8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 2> );
insertLoadFunction(&map, GL_RG8_SNORM, GL_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RG8_SNORM, GL_BYTE, loadToNative<GLbyte, 2> );
insertLoadFunction(&map, GL_RG16F, GL_HALF_FLOAT, loadToNative<GLhalf, 2> ); insertLoadFunction(&map, GL_RG16F, GL_HALF_FLOAT, loadToNative<GLhalf, 2> );
insertLoadFunction(&map, GL_RG32F, GL_FLOAT, loadToNative<GLfloat, 2> ); insertLoadFunction(&map, GL_RG32F, GL_FLOAT, loadToNative<GLfloat, 2> );
insertLoadFunction(&map, GL_RG16F, GL_FLOAT, loadFloatDataToHalfFloat<2> ); insertLoadFunction(&map, GL_RG16F, GL_FLOAT, loadFloatDataToHalfFloat<2> );
...@@ -248,7 +248,7 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap() ...@@ -248,7 +248,7 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap()
insertLoadFunction(&map, GL_RG32UI, GL_UNSIGNED_INT, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RG32UI, GL_UNSIGNED_INT, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_RG32I, GL_INT, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_RG32I, GL_INT, UnimplementedLoadFunction );
insertLoadFunction(&map, GL_R8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 1> ); insertLoadFunction(&map, GL_R8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 1> );
insertLoadFunction(&map, GL_R8_SNORM, GL_BYTE, UnimplementedLoadFunction ); insertLoadFunction(&map, GL_R8_SNORM, GL_BYTE, loadToNative<GLbyte, 1> );
insertLoadFunction(&map, GL_R16F, GL_HALF_FLOAT, loadToNative<GLhalf, 1> ); insertLoadFunction(&map, GL_R16F, GL_HALF_FLOAT, loadToNative<GLhalf, 1> );
insertLoadFunction(&map, GL_R32F, GL_FLOAT, loadToNative<GLfloat, 1> ); insertLoadFunction(&map, GL_R32F, GL_FLOAT, loadToNative<GLfloat, 1> );
insertLoadFunction(&map, GL_R16F, GL_FLOAT, loadFloatDataToHalfFloat<1> ); insertLoadFunction(&map, GL_R16F, GL_FLOAT, loadFloatDataToHalfFloat<1> );
...@@ -455,6 +455,10 @@ static DXGIFormatInfoMap buildDXGIFormatInfoMap() ...@@ -455,6 +455,10 @@ static DXGIFormatInfoMap buildDXGIFormatInfoMap()
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGIFormatInfo( 32, 1, 1, GL_SRGB8_ALPHA8, NULL ))); map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGIFormatInfo( 32, 1, 1, GL_SRGB8_ALPHA8, NULL )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_B8G8R8A8_UNORM, DXGIFormatInfo( 32, 1, 1, GL_BGRA8_EXT, GenerateMip<B8G8R8A8> ))); map.insert(DXGIFormatInfoPair(DXGI_FORMAT_B8G8R8A8_UNORM, DXGIFormatInfo( 32, 1, 1, GL_BGRA8_EXT, GenerateMip<B8G8R8A8> )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R8_SNORM, DXGIFormatInfo( 8, 1, 1, GL_R8_SNORM, GenerateMip<R8S> )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R8G8_SNORM, DXGIFormatInfo( 16, 1, 1, GL_RG8_SNORM, GenerateMip<R8G8S> )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R8G8B8A8_SNORM, DXGIFormatInfo( 32, 1, 1, GL_RGBA8_SNORM, GenerateMip<R8G8B8A8S> )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R10G10B10A2_UNORM, DXGIFormatInfo( 32, 1, 1, GL_RGB10_A2, GenerateMip<R10G10B10A2> ))); map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R10G10B10A2_UNORM, DXGIFormatInfo( 32, 1, 1, GL_RGB10_A2, GenerateMip<R10G10B10A2> )));
map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R16_FLOAT, DXGIFormatInfo( 16, 1, 1, GL_R16F, GenerateMip<R16F> ))); map.insert(DXGIFormatInfoPair(DXGI_FORMAT_R16_FLOAT, DXGIFormatInfo( 16, 1, 1, GL_R16F, GenerateMip<R16F> )));
......
...@@ -56,6 +56,44 @@ struct A8R8G8B8 ...@@ -56,6 +56,44 @@ struct A8R8G8B8
typedef A8R8G8B8 R8G8B8A8; // R8G8B8A8 type is functionally equivalent for mip purposes typedef A8R8G8B8 R8G8B8A8; // R8G8B8A8 type is functionally equivalent for mip purposes
typedef A8R8G8B8 B8G8R8A8; // B8G8R8A8 type is functionally equivalent for mip purposes typedef A8R8G8B8 B8G8R8A8; // B8G8R8A8 type is functionally equivalent for mip purposes
struct R8S
{
char R;
static void average(R8S *dst, const R8S *src1, const R8S *src2)
{
dst->R = ((short)src1->R + (short)src2->R) / 2;
}
};
struct R8G8S
{
char R;
char G;
static void average(R8G8S *dst, const R8G8S *src1, const R8G8S *src2)
{
dst->R = ((short)src1->R + (short)src2->R) / 2;
dst->G = ((short)src1->G + (short)src2->G) / 2;
}
};
struct R8G8B8A8S
{
char R;
char G;
char B;
char A;
static void average(R8G8B8A8S *dst, const R8G8B8A8S *src1, const R8G8B8A8S *src2)
{
dst->R = ((short)src1->R + (short)src2->R) / 2;
dst->G = ((short)src1->G + (short)src2->G) / 2;
dst->B = ((short)src1->B + (short)src2->B) / 2;
dst->A = ((short)src1->A + (short)src2->A) / 2;
}
};
struct A16B16G16R16F struct A16B16G16R16F
{ {
unsigned short R; unsigned short R;
......
...@@ -355,6 +355,30 @@ void loadRGBUByteDataToRGBA(int width, int height, int depth, ...@@ -355,6 +355,30 @@ void loadRGBUByteDataToRGBA(int width, int height, int depth,
} }
} }
void loadRGBSByteDataToRGBA(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
{
const char *source = NULL;
char *dest = NULL;
for (int z = 0; z < depth; z++)
{
for (int y = 0; y < height; y++)
{
source = offsetDataPointer<char>(input, y, z, inputRowPitch, inputDepthPitch);
dest = offsetDataPointer<char>(output, y, z, outputRowPitch, outputDepthPitch);
for (int x = 0; x < width; x++)
{
dest[4 * x + 0] = source[x * 3 + 0];
dest[4 * x + 1] = source[x * 3 + 1];
dest[4 * x + 2] = source[x * 3 + 2];
dest[4 * x + 3] = 0x7F;
}
}
}
}
void loadRGB565DataToBGRA(int width, int height, int depth, void loadRGB565DataToBGRA(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)
......
...@@ -90,6 +90,10 @@ void loadRGBUByteDataToRGBA(int width, int height, int depth, ...@@ -90,6 +90,10 @@ void loadRGBUByteDataToRGBA(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 loadRGBSByteDataToRGBA(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
void loadRGB565DataToBGRA(int width, int height, int depth, void loadRGB565DataToBGRA(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);
......
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