GLES: Added workaround for broken emulator.

This commit is contained in:
Branimir Karadžić 2015-08-28 11:17:26 -07:00
parent 91c87e2149
commit 0cb21b8b83

View file

@ -1027,8 +1027,10 @@ namespace bgfx { namespace gl
GLuint id; GLuint id;
GL_CHECK(glGenTextures(1, &id) ); GL_CHECK(glGenTextures(1, &id) );
GL_CHECK(glBindTexture(GL_TEXTURE_2D, id) ); GL_CHECK(glBindTexture(GL_TEXTURE_2D, id) );
GL_CHECK(glTexStorage2D(GL_TEXTURE_2D, 1, s_imageFormat[_format], 16, 16) ); glTexStorage2D(GL_TEXTURE_2D, 1, s_imageFormat[_format], 16, 16);
GLenum err = glGetError();
if (0 == err)
{
glBindImageTexture(0 glBindImageTexture(0
, id , id
, 0 , 0
@ -1037,7 +1039,8 @@ namespace bgfx { namespace gl
, GL_READ_WRITE , GL_READ_WRITE
, s_imageFormat[_format] , s_imageFormat[_format]
); );
GLenum err = glGetError(); err = glGetError();
}
GL_CHECK(glDeleteTextures(1, &id) ); GL_CHECK(glDeleteTextures(1, &id) );
@ -1237,6 +1240,15 @@ namespace bgfx { namespace gl
^ (uint64_t(getGLStringHash(GL_VERSION ) )<<16) ^ (uint64_t(getGLStringHash(GL_VERSION ) )<<16)
; ;
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31)
&& 0 == strcmp(m_vendor, "Imagination Technologies")
&& NULL != strstr(m_version, "(SDK 3.5@3510720)") )
{
// Skip initializing extensions that are broken in emulator.
s_extension[Extension::ARB_program_interface_query ].m_initialize =
s_extension[Extension::ARB_shader_storage_buffer_object].m_initialize = false;
}
if (BX_ENABLED(BGFX_CONFIG_RENDERER_USE_EXTENSIONS) ) if (BX_ENABLED(BGFX_CONFIG_RENDERER_USE_EXTENSIONS) )
{ {
const char* extensions = (const char*)glGetString(GL_EXTENSIONS); const char* extensions = (const char*)glGetString(GL_EXTENSIONS);
@ -3213,10 +3225,10 @@ namespace bgfx { namespace gl
GL_CHECK(glBindFragDataLocation(m_id, 0, "bgfx_FragColor") ); GL_CHECK(glBindFragDataLocation(m_id, 0, "bgfx_FragColor") );
#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31 #endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
bool piqSupported = BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) || (true bool piqSupported = true
&& s_extension[Extension::ARB_program_interface_query].m_supported && s_extension[Extension::ARB_program_interface_query ].m_supported
&& s_extension[Extension::ARB_shader_storage_buffer_object].m_supported && s_extension[Extension::ARB_shader_storage_buffer_object].m_supported
); ;
if (piqSupported) if (piqSupported)
{ {
@ -5149,7 +5161,7 @@ namespace bgfx { namespace gl
uintptr_t args = compute.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE; uintptr_t args = compute.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE;
for (uint32_t ii = 0; ii < numDrawIndirect; ++ii) for (uint32_t ii = 0; ii < numDrawIndirect; ++ii)
{ {
GL_CHECK(glDispatchComputeIndirect(args) ); GL_CHECK(glDispatchComputeIndirect((GLintptr)args) );
args += BGFX_CONFIG_DRAW_INDIRECT_STRIDE; args += BGFX_CONFIG_DRAW_INDIRECT_STRIDE;
} }
} }