Skip to content

Commit 048e9e1

Browse files
bwikbsbbrto21
authored andcommitted
Use OpenGL ES 2.1 mode forcely (#46)
* Use OpenGL ES 2.1 mode forcely Signed-off-by: MuHong Byun <[email protected]> * Use EvasGLSync for better performance Signed-off-by: MuHong Byun <[email protected]>
1 parent 18d5e82 commit 048e9e1

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

shell/platform/tizen/tizen_renderer.cc

+29-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#else
1111
#include <Evas_GL_GLES3_Helpers.h>
1212
Evas_GL* g_evas_gl = nullptr;
13+
EvasGLSync g_glSync = nullptr;
1314
EVAS_GL_GLOBAL_GLES3_DEFINE();
1415
#endif
1516

@@ -481,6 +482,16 @@ bool TizenRenderer::OnMakeCurrent() {
481482
if (evas_gl_make_current(evas_gl_, gl_surface_, gl_context_) != EINA_TRUE) {
482483
return false;
483484
}
485+
{
486+
if (g_glSync) {
487+
evasglClientWaitSync(evas_gl_, g_glSync,
488+
EVAS_GL_SYNC_PRIOR_COMMANDS_COMPLETE,
489+
EVAS_GL_FOREVER);
490+
evasglDestroySync(evas_gl_, g_glSync);
491+
g_glSync = nullptr;
492+
}
493+
}
494+
484495
return true;
485496
}
486497

@@ -517,6 +528,10 @@ bool TizenRenderer::OnPresent() {
517528
received_rotation = false;
518529
}
519530
evas_object_image_pixels_dirty_set((Evas_Object*)GetImageHandle(), EINA_TRUE);
531+
{
532+
int attr[] = {EVAS_GL_NONE};
533+
g_glSync = evasglCreateSync(evas_gl_, EVAS_GL_SYNC_FENCE, attr);
534+
}
520535
return true;
521536
}
522537

@@ -529,6 +544,16 @@ uint32_t TizenRenderer::OnGetFBO() {
529544
return 0;
530545
}
531546

547+
// There was a problem with gles support in a device that supports open gl
548+
// es 3.1, so it is forcibly used with 2.1
549+
const unsigned char gles_str[14] = "OpenGL ES 2.1";
550+
const GLubyte* CustomGlGetString(GLenum name) {
551+
if (name == GL_VERSION) {
552+
return gles_str;
553+
}
554+
return glGetString(name);
555+
}
556+
532557
#define GL_FUNC(FunctionName) \
533558
else if (strcmp(name, #FunctionName) == 0) { \
534559
return reinterpret_cast<void*>(FunctionName); \
@@ -595,7 +620,7 @@ void* TizenRenderer::OnProcResolver(const char* name) {
595620
GL_FUNC(glGetShaderInfoLog)
596621
GL_FUNC(glGetShaderiv)
597622
GL_FUNC(glGetShaderPrecisionFormat)
598-
GL_FUNC(glGetString)
623+
// GL_FUNC(glGetString)
599624
GL_FUNC(glGetUniformLocation)
600625
GL_FUNC(glIsTexture)
601626
GL_FUNC(glLineWidth)
@@ -644,6 +669,9 @@ void* TizenRenderer::OnProcResolver(const char* name) {
644669
GL_FUNC(glVertexAttribPointer)
645670
GL_FUNC(glViewport)
646671
GL_FUNC(glGetStringi)
672+
else if (strcmp(name, "glGetString") == 0) {
673+
return reinterpret_cast<void*>(CustomGlGetString);
674+
}
647675
FT_LOGD("Could not resolve: %s", name);
648676
return nullptr;
649677
}
@@ -674,7 +702,6 @@ bool TizenRenderer::SetupEvasGL(int32_t x, int32_t y, int32_t w, int32_t h) {
674702
}
675703

676704
g_evas_gl = evas_gl_;
677-
678705
gl_config_ = evas_gl_config_new();
679706
gl_config_->color_format = EVAS_GL_RGBA_8888;
680707
gl_config_->depth_bits = EVAS_GL_DEPTH_NONE;

0 commit comments

Comments
 (0)