summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gsk/gl/gskglcompiler.c14
-rw-r--r--gsk/gl/resources/preamble.fs.glsl4
-rw-r--r--gsk/gskdebug.c1
-rw-r--r--gsk/gskdebugprivate.h11
4 files changed, 21 insertions, 9 deletions
diff --git a/gsk/gl/gskglcompiler.c b/gsk/gl/gskglcompiler.c
index 3449dac50d..ce2074cb28 100644
--- a/gsk/gl/gskglcompiler.c
+++ b/gsk/gl/gskglcompiler.c
@@ -543,6 +543,7 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
const char *legacy = "";
const char *gl3 = "";
const char *gles = "";
+ const char *dither = "";
int program_id;
int vertex_id;
int fragment_id;
@@ -572,11 +573,14 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
if (self->gl3)
gl3 = "#define GSK_GL3 1\n";
+ if (GSK_DEBUG_CHECK (NO_DITHER))
+ dither = "#define GSK_NO_DITHER 1\n";
+
vertex_id = glCreateShader (GL_VERTEX_SHADER);
glShaderSource (vertex_id,
- 10,
+ 11,
(const char *[]) {
- version, debug, legacy, gl3, gles,
+ version, debug, legacy, gl3, gles, dither,
clip,
get_shader_string (self->all_preamble),
get_shader_string (self->vertex_preamble),
@@ -589,6 +593,7 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
strlen (legacy),
strlen (gl3),
strlen (gles),
+ strlen (dither),
strlen (clip),
g_bytes_get_size (self->all_preamble),
g_bytes_get_size (self->vertex_preamble),
@@ -607,9 +612,9 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
fragment_id = glCreateShader (GL_FRAGMENT_SHADER);
glShaderSource (fragment_id,
- 10,
+ 11,
(const char *[]) {
- version, debug, legacy, gl3, gles,
+ version, debug, legacy, gl3, gles, dither,
clip,
get_shader_string (self->all_preamble),
get_shader_string (self->fragment_preamble),
@@ -622,6 +627,7 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
strlen (legacy),
strlen (gl3),
strlen (gles),
+ strlen (dither),
strlen (clip),
g_bytes_get_size (self->all_preamble),
g_bytes_get_size (self->fragment_preamble),
diff --git a/gsk/gl/resources/preamble.fs.glsl b/gsk/gl/resources/preamble.fs.glsl
index 189da3aee2..734719adac 100644
--- a/gsk/gl/resources/preamble.fs.glsl
+++ b/gsk/gl/resources/preamble.fs.glsl
@@ -127,6 +127,9 @@ float gsk_interleaved_gradient_noise (vec2 p)
}
vec4 gskDither(vec4 color) {
+#if defined(GSK_NO_DITHER)
+ return color;
+#else
if (u_bit_depth > 10)
return color;
@@ -135,6 +138,7 @@ vec4 gskDither(vec4 color) {
noise = noise / (pow(2.0, u_bit_depth) - 1.0);
color = vec4(color.rgb + noise, color.a);
return color;
+#endif
}
vec4 gsk_get_output_color(vec4 color, float alpha) {
diff --git a/gsk/gskdebug.c b/gsk/gskdebug.c
index 83a3619fe7..f18c5a59ba 100644
--- a/gsk/gskdebug.c
+++ b/gsk/gskdebug.c
@@ -10,6 +10,7 @@ static const GdkDebugKey gsk_debug_keys[] = {
{ "surface", GSK_DEBUG_SURFACE, "Information about surfaces" },
{ "fallback", GSK_DEBUG_FALLBACK, "Information about fallbacks" },
{ "glyphcache", GSK_DEBUG_GLYPH_CACHE, "Information about glyph caching" },
+ { "no-dither", GSK_DEBUG_NO_DITHER, "Disable dithering" },
{ "geometry", GSK_DEBUG_GEOMETRY, "Show borders (when using cairo)" },
{ "full-redraw", GSK_DEBUG_FULL_REDRAW, "Force full redraws" },
{ "sync", GSK_DEBUG_SYNC, "Sync after each frame" },
diff --git a/gsk/gskdebugprivate.h b/gsk/gskdebugprivate.h
index 345c1555ab..9320a471a9 100644
--- a/gsk/gskdebugprivate.h
+++ b/gsk/gskdebugprivate.h
@@ -15,11 +15,12 @@ typedef enum {
GSK_DEBUG_FALLBACK = 1 << 6,
GSK_DEBUG_GLYPH_CACHE = 1 << 7,
/* flags below may affect behavior */
- GSK_DEBUG_GEOMETRY = 1 << 9,
- GSK_DEBUG_FULL_REDRAW = 1 << 10,
- GSK_DEBUG_SYNC = 1 << 11,
- GSK_DEBUG_VULKAN_STAGING_IMAGE = 1 << 12,
- GSK_DEBUG_VULKAN_STAGING_BUFFER = 1 << 13
+ GSK_DEBUG_NO_DITHER = 1 << 9,
+ GSK_DEBUG_GEOMETRY = 1 << 10,
+ GSK_DEBUG_FULL_REDRAW = 1 << 11,
+ GSK_DEBUG_SYNC = 1 << 12,
+ GSK_DEBUG_VULKAN_STAGING_IMAGE = 1 << 13,
+ GSK_DEBUG_VULKAN_STAGING_BUFFER = 1 << 14
} GskDebugFlags;
#define GSK_DEBUG_ANY ((1 << 13) - 1)