Commit Graph

23 Commits

Author SHA1 Message Date
Alexander Larsson
1001995d49 Correctly upload textures for GLES
GLES doesn't support the GL_BGRA +  GL_UNSIGNED_INT_24_8 hack that
we use on desktop OpenGL to upload textures directly in the cairo
pixel format. This adds the required conversions to all the places
that currently need it.

We also add a data_format to the internal gdk_gl_context_upload_texture()
function to make it clearer what the format are. Currently it is always
the cairo image surface format, but eventually we want to support other
formats so that we can avoid some of the unnecessary conversions we do.

Also, the current gdk_gl_context_upload_texture() code always converts
to a cairo format and uploads that like we did before. Later commits
will allow this to use other upload formats that gl supports to avoid
conversions.
2020-09-25 09:31:43 +02:00
Timm Bäder
f07397f4dd gl renderer: Upload GL_RGBA texture data in GLES
Colored icons are still broken this way, but at least they show up and
text works.
2020-01-07 17:27:16 +01:00
Matthias Clasen
5b508ea94a Revert "gl: Speed up icon cache lookups"
This reverts commit dd5ee87b5b.
2019-10-22 07:16:41 -04:00
Matthias Clasen
dd5ee87b5b gl: Speed up icon cache lookups
Use gdk_texture_set_render_data to avoid
hash table lookups when we can.
2019-10-15 19:44:26 -04:00
Matthias Clasen
e34d1b8a26 gl: Slightly rework the icon cache api
Return a pointer to the IconData struct. This is
closer to the glyph cache api, and will allow us
to add similar shortcuts. For now, just store
texture coords in the form we need, avoiding
converting them over and over.
2019-10-15 19:44:26 -04:00
Matthias Clasen
e9ba7eda47 gl: Increate the cache check frequency
Otherwise, we spread the cache over more atlases
than necessary, increasing the amount of texture
changes in each frame.
2019-10-12 12:37:11 -04:00
Matthias Clasen
60d63bbada gl: Improve debug spew for caches
Dump similar information for both caches,
and correct the unused percentage for
the atlases.
2019-10-12 12:37:11 -04:00
Matthias Clasen
123cbd42bb gl: Make icon cache work like glyph cache
Replace timestamp tracking with an accessed bit
here too, to keep the glyph and icon cache code
similar.
2019-10-12 11:46:10 -04:00
Timm Bäder
bcdc3b706c iconcache: Fix icon padding 2019-10-12 09:17:24 +02:00
Matthias Clasen
1c17316f9c gl: Handle row stride for icon cache upload
Same as the previous commit: Downloading a texture
may in theory give us data with a stride, so handle
that.
2019-10-11 21:17:30 -04:00
Matthias Clasen
8839e10d44 gl: Do less work to maintain caches
Remember which atlases were removed, and only
check those when looking for icons or glyphs
to remove. For most frames, we don't have to
check at all since no atlases were removed.
2019-10-11 20:42:24 -04:00
Matthias Clasen
9b61bfb3c8 gl: Speed up icon caching
Avoid expensive padding, and just upload the
image in several slices.
2019-10-11 19:36:26 -04:00
Timm Bäder
251bf45cf2 iconcache: ref textures
We can't just assume that the pointer we'se using as a cache key will
stay unique forever. The texture might be freed, and a later allocated
texture might have the same addres now, causing the cache to return
incorrect results.
2019-08-11 09:05:31 +02:00
Timm Bäder
13c0a9e27b iconcache: Replace broken debugging code 2019-08-11 09:05:31 +02:00
Elias Aebi
ea6d3f589f use glTexSubImage2D instead of glTextureSubImage2D 2019-07-06 16:23:21 +02:00
Matthias Clasen
259bbdcb09 Share glyph and icon caches
Use the same texture atlases to back both
the glyph and icon caches, and unify their
sizes and management. Store big glyphs
in separate textures, so all atlases have
the same size. Tweak some of the eviction
parameters.

We share the caches across all GL contexts
on a display, unless the GSK_NO_SHARED_CACHES
env var is set.
2019-06-04 23:00:02 +00:00
Matthias Clasen
c9cea36b37 gl: Use pad-extend for icon cache
Repeat the border pixels to avoid artifacts from
linear scaling.
2019-06-04 23:00:02 +00:00
Matthias Clasen
4020399439 gl: Use linear scaling for atlases 2019-06-04 23:00:01 +00:00
Matthias Clasen
efc31161f0 gl: Allow setting min/mag filter on textures
This will be used in the future.
Adapt all callers to pass GL_NEAREST for now.
2019-06-04 23:00:01 +00:00
Matthias Clasen
102cc1c8d3 gl: Add 1 pixel of padding in the icon cache 2019-06-04 23:00:01 +00:00
Matthias Clasen
f37274dbb0 gl: Don't leak texture atlases
We need to free the texture atlases, and the
textures backing them.
2019-06-04 23:00:01 +00:00
Matthias Clasen
a3757936c1 gl: Free icon data 2019-06-04 23:00:01 +00:00
Timm Bäder
cf4ff56ca5 gl renderer: Add & use icon cache
Upload small icons all to the same texture atlas.
2019-06-04 23:00:01 +00:00