This commit is contained in:
Branimir Karadžić 2014-04-15 22:59:40 -07:00
parent bc36c29f2a
commit 903b186110
2 changed files with 33 additions and 19 deletions

View file

@ -918,7 +918,7 @@ namespace bgfx
/// sampling. /// sampling.
/// ///
/// @param _skip Skip top level mips when parsing texture. /// @param _skip Skip top level mips when parsing texture.
/// @param _info Returns parsed DDS texture information. /// @param _info Returns parsed texture information.
/// @returns Texture handle. /// @returns Texture handle.
/// ///
TextureHandle createTexture(const Memory* _mem, uint32_t _flags = BGFX_TEXTURE_NONE, uint8_t _skip = 0, TextureInfo* _info = NULL); TextureHandle createTexture(const Memory* _mem, uint32_t _flags = BGFX_TEXTURE_NONE, uint8_t _skip = 0, TextureInfo* _info = NULL);

View file

@ -317,7 +317,9 @@ namespace bgfx
OES_vertex_half_float, OES_vertex_half_float,
OES_vertex_type_10_10_10_2, OES_vertex_type_10_10_10_2,
WEBGL_compressed_texture_etc1,
WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_s3tc,
WEBGL_compressed_texture_pvrtc,
WEBGL_depth_texture, WEBGL_depth_texture,
WEBKIT_EXT_texture_filter_anisotropic, WEBKIT_EXT_texture_filter_anisotropic,
@ -448,7 +450,9 @@ namespace bgfx
{ "OES_vertex_half_float", false, true }, { "OES_vertex_half_float", false, true },
{ "OES_vertex_type_10_10_10_2", false, true }, { "OES_vertex_type_10_10_10_2", false, true },
{ "WEBGL_compressed_texture_etc1", false, true },
{ "WEBGL_compressed_texture_s3tc", false, true }, { "WEBGL_compressed_texture_s3tc", false, true },
{ "WEBGL_compressed_texture_pvrtc", false, true },
{ "WEBGL_depth_texture", false, true }, { "WEBGL_depth_texture", false, true },
{ "WEBKIT_EXT_texture_filter_anisotropic", false, true }, { "WEBKIT_EXT_texture_filter_anisotropic", false, true },
@ -1183,8 +1187,7 @@ namespace bgfx
{ {
if (GL_COMPRESSED_RGB_S3TC_DXT1_EXT == cmpFormat[ii]) if (GL_COMPRESSED_RGB_S3TC_DXT1_EXT == cmpFormat[ii])
{ {
s_textureFormat[TextureFormat::BC1].m_internalFmt = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; setTextureFormat(TextureFormat::BC1, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
s_textureFormat[TextureFormat::BC1].m_fmt = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
s_textureFormat[TextureFormat::BC1].m_supported = true; s_textureFormat[TextureFormat::BC1].m_supported = true;
break; break;
} }
@ -1214,7 +1217,10 @@ namespace bgfx
setTextureFormat(TextureFormat::BC5, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RG_RGTC2); setTextureFormat(TextureFormat::BC5, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RG_RGTC2);
} }
bool etc1Supported = s_extension[Extension::OES_compressed_ETC1_RGB8_texture].m_supported; bool etc1Supported = 0
|| s_extension[Extension::OES_compressed_ETC1_RGB8_texture].m_supported
|| s_extension[Extension::WEBGL_compressed_texture_etc1 ].m_supported
;
s_textureFormat[TextureFormat::ETC1].m_supported |= etc1Supported; s_textureFormat[TextureFormat::ETC1].m_supported |= etc1Supported;
bool etc2Supported = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) bool etc2Supported = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
@ -1233,7 +1239,10 @@ namespace bgfx
s_textureFormat[TextureFormat::ETC1].m_supported = true; s_textureFormat[TextureFormat::ETC1].m_supported = true;
} }
bool ptc1Supported = s_extension[Extension::IMG_texture_compression_pvrtc ].m_supported; bool ptc1Supported = 0
|| s_extension[Extension::IMG_texture_compression_pvrtc ].m_supported
|| s_extension[Extension::WEBGL_compressed_texture_pvrtc].m_supported
;
s_textureFormat[TextureFormat::PTC12 ].m_supported |= ptc1Supported; s_textureFormat[TextureFormat::PTC12 ].m_supported |= ptc1Supported;
s_textureFormat[TextureFormat::PTC14 ].m_supported |= ptc1Supported; s_textureFormat[TextureFormat::PTC14 ].m_supported |= ptc1Supported;
s_textureFormat[TextureFormat::PTC12A].m_supported |= ptc1Supported; s_textureFormat[TextureFormat::PTC12A].m_supported |= ptc1Supported;
@ -1245,19 +1254,24 @@ namespace bgfx
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) )
{ {
setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT); setTextureFormat(TextureFormat::D32, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
{ {
setTextureFormat(TextureFormat::R16, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT); setTextureFormat(TextureFormat::R16, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT);
setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT); setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT);
} }
else if (BX_ENABLED(BX_PLATFORM_IOS) ) else
{
setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT);
if (BX_ENABLED(BX_PLATFORM_IOS) )
{ {
setTextureFormat(TextureFormat::D16, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT); setTextureFormat(TextureFormat::D16, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT);
setTextureFormat(TextureFormat::D24S8, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8); setTextureFormat(TextureFormat::D24S8, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
} }
} }
}
if (s_extension[Extension::EXT_texture_format_BGRA8888 ].m_supported if (s_extension[Extension::EXT_texture_format_BGRA8888 ].m_supported
|| s_extension[Extension::EXT_bgra ].m_supported || s_extension[Extension::EXT_bgra ].m_supported