[gtk/wip/matthiasc/shared-glyph-cache: 35/41] gl: Allow setting min/mag filter on textures
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/shared-glyph-cache: 35/41] gl: Allow setting min/mag filter on textures
- Date: Tue, 4 Jun 2019 23:07:08 +0000 (UTC)
commit efc31161f0a8eefb6685f35a73454ebed5bcf351
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 2 16:47:57 2019 +0000
gl: Allow setting min/mag filter on textures
This will be used in the future.
Adapt all callers to pass GL_NEAREST for now.
gsk/gl/gskgldriver.c | 9 +++++++--
gsk/gl/gskgldriverprivate.h | 4 +++-
gsk/gl/gskglglyphcache.c | 2 +-
gsk/gl/gskgliconcache.c | 4 +++-
gsk/gl/gskglimage.c | 6 ++++--
gsk/gl/gskglimageprivate.h | 4 +++-
6 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index 276f01fc6c..321681d507 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -669,7 +669,7 @@ gsk_gl_driver_create_render_target (GskGLDriver *self,
texture_id = gsk_gl_driver_create_texture (self, width, height);
gsk_gl_driver_bind_source_texture (self, texture_id);
- gsk_gl_driver_init_texture_empty (self, texture_id);
+ gsk_gl_driver_init_texture_empty (self, texture_id, GL_NEAREST, GL_NEAREST);
render_target = create_render_target (self, texture_id, FALSE, FALSE);
@@ -727,7 +727,9 @@ gsk_gl_driver_destroy_texture (GskGLDriver *self,
void
gsk_gl_driver_init_texture_empty (GskGLDriver *self,
- int texture_id)
+ int texture_id,
+ int min_filter,
+ int mag_filter)
{
Texture *t;
@@ -746,6 +748,9 @@ gsk_gl_driver_init_texture_empty (GskGLDriver *self,
return;
}
+ t->min_filter = min_filter;
+ t->mag_filter = mag_filter;
+
gsk_gl_driver_set_texture_parameters (self, t->min_filter, t->mag_filter);
if (gdk_gl_context_get_use_es (self->gl_context))
diff --git a/gsk/gl/gskgldriverprivate.h b/gsk/gl/gskgldriverprivate.h
index 1e57a855f1..83d0c46af9 100644
--- a/gsk/gl/gskgldriverprivate.h
+++ b/gsk/gl/gskgldriverprivate.h
@@ -53,7 +53,9 @@ void gsk_gl_driver_bind_source_texture (GskGLDriver *driver
int texture_id);
void gsk_gl_driver_init_texture_empty (GskGLDriver *driver,
- int texture_id);
+ int texture_id,
+ int min_filter,
+ int max_filter);
void gsk_gl_driver_init_texture_with_surface (GskGLDriver *driver,
int texture_id,
cairo_surface_t *surface,
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c
index 0f39df607b..697d266185 100644
--- a/gsk/gl/gskglglyphcache.c
+++ b/gsk/gl/gskglglyphcache.c
@@ -366,7 +366,7 @@ gsk_gl_glyph_cache_get_glyph_image (GskGLGlyphCache *self,
if (atlas->image.texture_id == 0)
{
- gsk_gl_image_create (&atlas->image, self->gl_driver, atlas->width, atlas->height);
+ gsk_gl_image_create (&atlas->image, self->gl_driver, atlas->width, atlas->height, GL_NEAREST,
GL_NEAREST);
gdk_gl_context_label_object_printf (gsk_gl_driver_get_gl_context (self->gl_driver),
GL_TEXTURE, atlas->image.texture_id,
"Glyph atlas %d", atlas->image.texture_id);
diff --git a/gsk/gl/gskgliconcache.c b/gsk/gl/gskgliconcache.c
index 267ac7c637..424ee9102a 100644
--- a/gsk/gl/gskgliconcache.c
+++ b/gsk/gl/gskgliconcache.c
@@ -2,6 +2,8 @@
#include "gskgltextureatlasprivate.h"
#include "gdk/gdktextureprivate.h"
+#include <epoxy/gl.h>
+
#define ATLAS_SIZE (1024)
#define MAX_FRAME_AGE (5 * 60)
#define MAX_UNUSED_RATIO 0.8
@@ -179,7 +181,7 @@ gsk_gl_icon_cache_lookup_or_add (GskGLIconCache *self,
/* No atlas has enough space, so create a new one... */
atlas = g_malloc (sizeof (GskGLTextureAtlas));
gsk_gl_texture_atlas_init (atlas, ATLAS_SIZE, ATLAS_SIZE);
- gsk_gl_image_create (&atlas->image, self->gl_driver, atlas->width, atlas->height);
+ gsk_gl_image_create (&atlas->image, self->gl_driver, atlas->width, atlas->height, GL_NEAREST,
GL_NEAREST);
/* Pack it onto that one, which surely has enought space... */
gsk_gl_texture_atlas_pack (atlas, twidth + 2, theight + 2, &packed_x, &packed_y);
packed_x += 1;
diff --git a/gsk/gl/gskglimage.c b/gsk/gl/gskglimage.c
index 86e6c0de9d..71d7bce2a3 100644
--- a/gsk/gl/gskglimage.c
+++ b/gsk/gl/gskglimage.c
@@ -6,14 +6,16 @@ void
gsk_gl_image_create (GskGLImage *self,
GskGLDriver *gl_driver,
int width,
- int height)
+ int height,
+ int min_filter,
+ int mag_filter)
{
self->texture_id = gsk_gl_driver_create_texture (gl_driver, width, height);
self->width = width;
self->height = height;
gsk_gl_driver_bind_source_texture (gl_driver, self->texture_id);
- gsk_gl_driver_init_texture_empty (gl_driver, self->texture_id);
+ gsk_gl_driver_init_texture_empty (gl_driver, self->texture_id, min_filter, mag_filter);
gsk_gl_driver_mark_texture_permanent (gl_driver, self->texture_id);
}
diff --git a/gsk/gl/gskglimageprivate.h b/gsk/gl/gskglimageprivate.h
index d9da860df3..3d706723b8 100644
--- a/gsk/gl/gskglimageprivate.h
+++ b/gsk/gl/gskglimageprivate.h
@@ -24,7 +24,9 @@ typedef struct
void gsk_gl_image_create (GskGLImage *self,
GskGLDriver *gl_driver,
int width,
- int height);
+ int height,
+ int min_filter,
+ int mag_filter);
void gsk_gl_image_destroy (GskGLImage *self,
GskGLDriver *gl_driver);
void gsk_gl_image_write_to_png (const GskGLImage *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]