summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-04-02 23:28:38 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-04-02 23:28:38 +0100
commitbbf293240fbd6d3be94f1971ed779ce398e3ba3d (patch)
treeb6e9191c25f65819249a54f38a192d2c13606332 /src
parenta2680bb138acd0a64bcad1a6041a27b9c16f8b3a (diff)
evas gl - add env var to disable dither because some gl's are broken
this adds a EVAS_GL_RENDER_DISABLE_DITHER=1 env var (set it to anything) to disable dithered rendering.p this is an added cost, but normally not much at all, but it seems some gl implementations are broken, and they can't generate correct code for the dither shader, so this disables this if this env var above is set
Diffstat (limited to 'src')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_shader.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_shader.c b/src/modules/evas/engines/gl_common/evas_gl_shader.c
index 489ea3d8c5..b3802f2c70 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_shader.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_shader.c
@@ -84,6 +84,7 @@ static const char *_shader_flags[SHADER_FLAG_COUNT] = {
84}; 84};
85 85
86static Eina_Bool compiler_released = EINA_FALSE; 86static Eina_Bool compiler_released = EINA_FALSE;
87static Eina_Bool _do_dither = EINA_TRUE;
87 88
88static void 89static void
89gl_compile_link_error(GLuint target, const char *action, Eina_Bool is_shader) 90gl_compile_link_error(GLuint target, const char *action, Eina_Bool is_shader)
@@ -553,17 +554,18 @@ evas_gl_common_shader_precompile_list(Evas_GL_Shared *shared)
553{ 554{
554 int bgra, mask, sam, masksam, img, nomul, afill, yuv; 555 int bgra, mask, sam, masksam, img, nomul, afill, yuv;
555 Eina_List *li = NULL; 556 Eina_List *li = NULL;
557 unsigned int baseflags = 0;
556 558
557 if (!shared) return NULL; 559 if (!shared) return NULL;
558 560 if (_do_dither) baseflags |= BASEFLAG;
559 // rect 561 // rect
560 li = eina_list_append(li, P(BASEFLAG)); 562 li = eina_list_append(li, P(baseflags));
561 563
562 // text 564 // text
563 for (mask = 0; mask <= 1; mask++) 565 for (mask = 0; mask <= 1; mask++)
564 for (masksam = SHD_SAM11; masksam < (mask ? SHD_SAM_LAST : 1); masksam++) 566 for (masksam = SHD_SAM11; masksam < (mask ? SHD_SAM_LAST : 1); masksam++)
565 { 567 {
566 int flags = BASEFLAG | SHADER_FLAG_TEX | SHADER_FLAG_ALPHA; 568 int flags = baseflags | SHADER_FLAG_TEX | SHADER_FLAG_ALPHA;
567 if (mask) flags |= SHADER_FLAG_MASK; 569 if (mask) flags |= SHADER_FLAG_MASK;
568 if (masksam) flags |= (1 << (SHADER_FLAG_MASKSAM_BITSHIFT + masksam - 1)); 570 if (masksam) flags |= (1 << (SHADER_FLAG_MASKSAM_BITSHIFT + masksam - 1));
569 li = eina_list_append(li, P(flags)); 571 li = eina_list_append(li, P(flags));
@@ -578,7 +580,7 @@ evas_gl_common_shader_precompile_list(Evas_GL_Shared *shared)
578 for (nomul = 0; nomul <= 1; nomul++) 580 for (nomul = 0; nomul <= 1; nomul++)
579 for (afill = 0; afill <= (mask ? 0 : 1); afill++) 581 for (afill = 0; afill <= (mask ? 0 : 1); afill++)
580 { 582 {
581 int flags = BASEFLAG | SHADER_FLAG_TEX; 583 int flags = baseflags | SHADER_FLAG_TEX;
582 if (mask) flags |= SHADER_FLAG_MASK; 584 if (mask) flags |= SHADER_FLAG_MASK;
583 if (masksam) flags |= (1 << (SHADER_FLAG_MASKSAM_BITSHIFT + masksam - 1)); 585 if (masksam) flags |= (1 << (SHADER_FLAG_MASKSAM_BITSHIFT + masksam - 1));
584 if (sam) flags |= (1 << (SHADER_FLAG_SAM_BITSHIFT + sam - 1)); 586 if (sam) flags |= (1 << (SHADER_FLAG_SAM_BITSHIFT + sam - 1));
@@ -595,7 +597,7 @@ evas_gl_common_shader_precompile_list(Evas_GL_Shared *shared)
595 for (masksam = SHD_SAM11; masksam < (mask ? SHD_SAM_LAST : 1); masksam++) 597 for (masksam = SHD_SAM11; masksam < (mask ? SHD_SAM_LAST : 1); masksam++)
596 for (nomul = 0; nomul <= 1; nomul++) 598 for (nomul = 0; nomul <= 1; nomul++)
597 { 599 {
598 int flags = BASEFLAG | SHADER_FLAG_TEX | yuv; 600 int flags = baseflags | SHADER_FLAG_TEX | yuv;
599 if (mask) flags |= SHADER_FLAG_MASK; 601 if (mask) flags |= SHADER_FLAG_MASK;
600 if (masksam) flags |= (1 << (SHADER_FLAG_MASKSAM_BITSHIFT + masksam - 1)); 602 if (masksam) flags |= (1 << (SHADER_FLAG_MASKSAM_BITSHIFT + masksam - 1));
601 if (yuv == SHADER_FLAG_YUV_709) flags |= SHADER_FLAG_YUV; 603 if (yuv == SHADER_FLAG_YUV_709) flags |= SHADER_FLAG_YUV;
@@ -666,15 +668,25 @@ evas_gl_common_shader_program_init(Evas_GL_Shared *shared)
666{ 668{
667 /* most popular shaders */ 669 /* most popular shaders */
668 const int BGRA = (shared->info.bgra ? SHADER_FLAG_BGRA : 0); 670 const int BGRA = (shared->info.bgra ? SHADER_FLAG_BGRA : 0);
669 const int autoload[] = { 671 unsigned int autoload[] = {
670 /* rect */ BASEFLAG, 672 /* rect */ 0,
671 /* text */ BASEFLAG | SHADER_FLAG_TEX | SHADER_FLAG_ALPHA, 673 /* text */ 0 | SHADER_FLAG_TEX | SHADER_FLAG_ALPHA,
672 /* img1 */ BASEFLAG | SHADER_FLAG_TEX | SHADER_FLAG_IMG | BGRA, 674 /* img1 */ 0 | SHADER_FLAG_TEX | SHADER_FLAG_IMG | BGRA,
673 /* img2 */ BASEFLAG | SHADER_FLAG_TEX | SHADER_FLAG_IMG | SHADER_FLAG_NOMUL | BGRA, 675 /* img2 */ 0 | SHADER_FLAG_TEX | SHADER_FLAG_IMG | SHADER_FLAG_NOMUL | BGRA,
674 }; 676 };
675 Evas_GL_Program *p; 677 Evas_GL_Program *p;
676 unsigned i; 678 unsigned i;
677 679
680 if (getenv("EVAS_GL_RENDER_DISABLE_DITHER"))
681 _do_dither = EINA_FALSE;
682
683 if (_do_dither)
684 {
685 autoload[0] |= BASEFLAG;
686 autoload[1] |= BASEFLAG;
687 autoload[2] |= BASEFLAG;
688 autoload[3] |= BASEFLAG;
689 }
678 shared->shaders_hash = eina_hash_int32_new(_shaders_hash_free_cb); 690 shared->shaders_hash = eina_hash_int32_new(_shaders_hash_free_cb);
679 if (_evas_gl_common_shader_binary_init(shared)) 691 if (_evas_gl_common_shader_binary_init(shared))
680 { 692 {
@@ -770,8 +782,9 @@ evas_gl_common_shader_flags_get(Evas_GL_Shared *shared, Shader_Type type,
770{ 782{
771 Shader_Sampling sam = SHD_SAM11, masksam = SHD_SAM11; 783 Shader_Sampling sam = SHD_SAM11, masksam = SHD_SAM11;
772 int nomul = 1, bgra = 0, k; 784 int nomul = 1, bgra = 0, k;
773 unsigned int flags = BASEFLAG; 785 unsigned int flags = 0;
774 786
787 if (_do_dither) flags |= BASEFLAG;
775 // image downscale sampling 788 // image downscale sampling
776 if (smooth && ((type == SHD_IMAGE) || (type == SHD_IMAGENATIVE))) 789 if (smooth && ((type == SHD_IMAGE) || (type == SHD_IMAGENATIVE)))
777 { 790 {