summaryrefslogtreecommitdiff
path: root/gsk
Commit message (Collapse)AuthorAgeFilesLines
* texture: Refactor downloadingBenjamin Otte2021-10-121-15/+18
| | | | | | | | | | | Pass a format do GdkTextureClass::download(). That way we can download data in any format. Also replace gdk_texture_download_texture() with gdk_memory_texture_from_texture() which again takes a format. The old functionality is still there for code that wants it: Just pass gdk_texture_get_format (texture) as the format argument.
* Merge branch 'ngl-is-the-new-gl' into 'master'Matthias Clasen2021-10-1176-4888/+4941
|\ | | | | | | | | | | | | Rename ngl to gl Closes #4318 See merge request GNOME/gtk!4037
| * gsk: provide an ngl rendererMatthias Clasen2021-10-071-4/+32
| | | | | | | | | | | | Provide a minimal renderer implementation that fails in realize. This avoids reusing the same type, which might give bindings trouble.
| * Maintain abiMatthias Clasen2021-10-072-0/+25
| | | | | | | | | | | | | | | | Keep gsk_ngl_renderer_new and gsk_ngl_renderer_get_type, since they were part of the abi in 4.2, and in an installed header. Fixes: #4318
| * Rename ngl to glMatthias Clasen2021-10-0776-4888/+4888
| | | | | | | | | | We have only one gl renderer now, and it is a bit odd for it not be called gl.
* | ngl: Use the right valueBenjamin Otte2021-10-091-2/+2
| | | | | | | | It's GL_RGBA, not GL_BGRA, or GLES will complain.
* | ngl: Fix glTexImage2D() usage on GLESBenjamin Otte2021-10-081-4/+20
| | | | | | | | | | GLES is very adamant about the format and type matching the internal format, even if the data is NULL.
* | ngl: Compute correct renderformatBenjamin Otte2021-10-081-2/+2
| | | | | | | | We want to round up, not down.
* | ngl: fbo 0 has no color attachmentBenjamin Otte2021-10-081-1/+4
|/ | | | Query the backbuffer instead.
* ngl: Make render_texture high depth awareMatthias Clasen2021-10-061-1/+4
| | | | | | | | | Make a deep texture, if the render nodes have high depth content. For now, we use 32F here for the deep format, since using 16F causes small rounding errors that break the memorytexture roundtrip tests.
* ngl: Update framebuffer format for each frameMatthias Clasen2021-10-061-1/+6
| | | | | | Look at whether the render nodes are high depth and if so, request a high depth framebuffer. Whether we actually get one is up to the backend.
* ngl: Determine intermediate formatsMatthias Clasen2021-10-061-6/+38
| | | | | | | | | Look at the framebuffer and the rendernode to determine what format to use for intermediate textures. Our preference here is to use fp16, if we have it and it makes sense for the framebuffer we're given.
* ngl: Allow specifying texture formatsMatthias Clasen2021-10-069-5/+42
| | | | | | | Allow passing a format when creating textures or render targets. Update all callers to pass GL_RGBA8, which is the format we have always used so far.
* gsk: Add high depth rendernode apiMatthias Clasen2021-10-063-1/+39
| | | | | | | | | | | | | | Add private api to find out if the content of a render node should be considered 'deep'. The information is collected at creation time, so there is no tree-walking involved when we are using this information in the renderer. Currently, this comes down to whether there are any texture nodes with high depth textures in the subtree. In the future, we may want to allow marking gradient nodes in this way as well.
* texture: Make format a property of GdkTextureBenjamin Otte2021-10-071-1/+1
| | | | | | | | | | | For MemoryTexture, this is a simple change. For GLTexture, we need to query the format at texture creation. This sounds like a bad idea and extra work until one realizes that we'd need to do that anyway when using the texure the first time - either when downloading, or when trying to use it in a rendernode, where we will soon need that information to determine if the texture prefers high depth.
* memorytexture: Split out GdkMemoryFormat handlingBenjamin Otte2021-10-063-4/+5
| | | | | | | Also, now make gdk_memory_convert() the only conversion functions and allow conversions between any 2 formats by going via a float[4]. This could be optimized via fast-paths, but so far it isn't.
* ngl: Don't cache large glyphs foreverMatthias Clasen2021-10-031-3/+20
| | | | | | | | We never put large icons into the icon cache, so all its items are always atlased, but we do put large glyphs in to the glyph cache, and we were never freeing those items, even when they go unused. Fix that.
* ngl: Small docs updatesMatthias Clasen2021-10-031-3/+0
| | | | Don't refer to nonexisting functions.
* ngl: Plug a memory leakMatthias Clasen2021-10-031-2/+9
| | | | | | When creating a GdkTexture from the texture stored in the driver, we must free the GskNglTexture struct.
* ngl: Drop the texture pool objectMatthias Clasen2021-10-037-130/+48
| | | | This wasn't serving any clear purpose.
* ngl: CosmeticsMatthias Clasen2021-10-031-6/+5
| | | | Move _GskNglTextureState to the one place it is used.
* fp16.c: Fix float_to_half() function callChun-wei Fan2021-09-301-1/+1
| | | | Correct the function being called.
* Merge branch 'transform-work' into 'master'Matthias Clasen2021-09-182-36/+310
|\ | | | | | | | | transform: Add sections See merge request GNOME/gtk!3974
| * Add gsk_transform_to_2d_componentsMatthias Clasen2021-09-182-13/+114
| | | | | | | | | | | | | | This function decomposes a general 2D transform into skew, scale, rotation and translation. Tests included.
| * gsk: Add skew transformsMatthias Clasen2021-09-172-20/+179
| | | | | | | | | | | | Add gsk_transform_skew() to make our transform api more complete wrt to what you would expect for a graphics api.
| * transform: Add sectionsMatthias Clasen2021-09-171-8/+22
| | | | | | | | This makes the code easier to navigate (for me).
* | Revert "gsk: Stop enlarging text bounding boxes"Matthias Clasen2021-09-171-4/+4
| | | | | | | | | | | | | | | | | | This reverts commit 87af45403ace1047b91ddbab98d9d5a5e15b84eb. I've found that this change is needed to ensure that the bounding boxes of text nodes encompass all the glyphd drawing. Without it, we overdraw the widget boundaries and cut off glyphs.
* | ngl: Use exact device scales for glyphsMatthias Clasen2021-09-171-15/+12
|/ | | | | | | | | We are rendering the glyphs on a larger surface, and we should avoid introducing unnecessary rounding errors here. Also, I've found that we always need to enlarge the surface by one pixels in each direction to avoid cutting off the tops of large glyphs.
* Fix glyph cache entry sizingMatthias Clasen2021-09-171-2/+8
| | | | The subpixel-positioned glyph extends on both sides.
* gsk: Stop enlarging text bounding boxesMatthias Clasen2021-09-171-4/+4
| | | | | This should not be necessary and only serves to make the actual bugs harder to find.
* transform: Improve docsMatthias Clasen2021-09-171-0/+7
| | | | Add an example for reconstructing transforms.
* gsk: Handle 2D transforms betterMatthias Clasen2021-09-171-1/+12
| | | | | | | | | For 2D transforms, we can read the scale factors more directly off the matrix. This should eventually be moved out into a function to decompose a 2D transform into scale + rotation + skew + translation.
* rendernodeparser: Avoid gdk_texture_new_for_pixbufMatthias Clasen2021-09-171-12/+5
| | | | | | We can just use gdk_texture_new_from_bytes here now. Update affected test output.
* rendernodeparser: Use gdk_texture_save_to_png_bytesMatthias Clasen2021-09-171-8/+5
| | | | | | Avoid cairo, and use our own api for saving png data. Update affected test output.
* rendernodeparser: Handle is_color attribute for glyphsBenjamin Otte2021-09-161-1/+10
|
* ngl: Avoid offscreens in more casesMatthias Clasen2021-09-161-0/+3
| | | | | | | | | | | | | | | We avoid an offscreen if we know the child node can 'handle' the transform. Shadow nodes can if their child node does - either the child node is a text node in which case the shortcuts we take for shadow nodes will work fine with the transform (we just render the text node offset), or the child is not a text node, in which case we render the shadow to an offscreen anyway. This change makes the label-shadows reftest pass with the GL renderer, not by fixing the issue but by avoiding it.
* ngl: Improve shortcuts for shadow nodesMatthias Clasen2021-09-161-9/+12
| | | | | | | | For shadow nodes, we try pretty hard to avoid rendering shadows, and and we have a shortcut that just renders text offset, but we can try harder to do nothing - if the text is offset by zero, we don't need to draw it at all.
* ngl Fix bottom-right border render failureBenjamin Otte2021-09-161-1/+1
| | | | | | The wrong index was used for offsetting the bottom border rect. Test included.
* ngl: Fix opacity handlingMatthias Clasen2021-09-161-9/+64
| | | | | | | | We need to use an offscreen whenever there is overlapping children somewhere in the tree below, just checking the direct child of the opacity node is not enough. Fixes: #4261
* ngl: Avoid cairo_to_png in debug outputMatthias Clasen2021-09-153-32/+29
| | | | | Just use a GL texture and gdk_texture_save_to_png, it was made for this.
* Annotate gsk_cairo_blur_compute_pixels as constMatthias Clasen2021-09-141-1/+1
|
* Annotate gsk_ngl_uniform_state_align as pureMatthias Clasen2021-09-141-1/+1
|
* Annotate gsk_rounded_rect_is_circular as pureMatthias Clasen2021-09-141-2/+2
| | | | And also mark gsk_rounded_rect_to_string as malloc.
* Annotate pango_glyph_string_num_glyphs as pureMatthias Clasen2021-09-141-1/+1
|
* ngl: Simplify and unbug texture downloadBenjamin Otte2021-09-131-19/+8
| | | | | If we can't handle the texture, always just download_texture() it, that way we are sure it's a memory texture.
* texture: Add GdkMemoryConversion private enumBenjamin Otte2021-09-122-2/+2
| | | | | Now gdk_memory_convert() converts to one of these conversions instead of re(ab)using parts of the GdkMemoryFormat enum.
* Merge branch 'wip/otte/for-master' into 'master'Benjamin Otte2021-09-111-8/+12
|\ | | | | | | | | rendernode: Write the whole node See merge request GNOME/gtk!3938
| * rendernode: Write the whole nodeBenjamin Otte2021-09-111-8/+12
| | | | | | | | | | It turns out g_output_stream_write_bytes() does not write the bytes. It should be renamed to g_output_stream_write_some_of_the_bytes() maybe.
* | Add vectorized half-float conversionMatthias Clasen2021-09-103-11/+180
|/ | | | | | | | We can't make the -4 versions inline, since we use ifuncs for them, so make vectorized versions. Test included.
* Avoid hand-rolled color glyph informationMatthias Clasen2021-09-051-10/+1
| | | | | | Followup to b244f31337eea. Pango provides color glyph information for us now, so we don't need to steal a bit anymore.