Commit Graph

43 Commits

Author SHA1 Message Date
Benjamin Otte
ca3c23662c GskTexture => GdkTexture
We want this thing to replace GdkPixbuf, so it has to live in GDK.
2017-11-04 00:07:13 +01:00
Matthias Clasen
a0bbd14325 gsk: Scale glyphs in the glyph cache
Pass a scale factor when caching glyphs or looking them
up in the cache. The glyphs in the cache are rendered
with subpixel precision determined by the scale. Update
all callers to pass a scale factor according to the window
scale. This lets us render crisp glyphs on hidpi systems.
2017-10-28 13:13:31 -04:00
Matthias Clasen
4c29102753 vulkan: Add a counter for intermediate textures
Count how many pixels of intermediate textures we create.
If we can count it, we can optimize it.
2017-09-30 17:58:23 -04:00
Matthias Clasen
e382f956f3 vulkan: Move sampler creation down
This is in preparation of allowing multiple samplers.
2017-09-29 23:08:14 -04:00
Matthias Clasen
535529ca98 vulkan: Measure gpu time
Since this value is only meaningful if we wait for the rendering
to end, we only keep this timer if GSK_RENDERING_MODE=sync is
enabled.
2017-09-28 10:29:16 -04:00
Matthias Clasen
4d8e7d71ca gsk: Add a profile counter for vulkan render passes
This is interesting now that we have multiple render passes.
2017-09-28 08:39:22 -04:00
Matthias Clasen
d61a715909 vulkan: Implement multiple render passes
Whenever we need a node as a texture, we now start a new render
pass that renders the node into a new intermediate texture, and
set up a semaphore to make the current render pass wait for it.

As part of this reorganization, much of the setup and drawing
code moved from gskvulkanrender.c to gskvulkanrenderpass.c.
2017-09-28 08:39:22 -04:00
Matthias Clasen
ae2c645a2a gsk: report fallback pixels as a profile counter
This makes the value show up in the inspector without
any extra work. We report the number per-frame, since
that makes the most sense.
2017-09-25 21:02:21 -04:00
Matthias Clasen
b1e98d106d vulkan: add a frame counter to the profiler
This is just to match the gl renderer and to learn how
counters work.
2017-09-25 18:37:22 -04:00
Lionel Landwerlin
28bd26ca06 gsk: vulkan: silence anisotropy validation warning 2017-09-20 23:26:14 -04:00
Matthias Clasen
7bbd4d41e0 vulkan: pass the context when creating a glyph cache 2017-09-20 23:26:14 -04:00
Matthias Clasen
cead00757d vulkan: Move glyph cache to a separate file
Otherwise things will get too messy.
2017-09-20 23:26:14 -04:00
Matthias Clasen
4d4a0212fb vulkan: Better glyph cache api
Move the glyph caching api to something that can support using
multiple textures. We now split the text render ops into multiple
ops for different textures, and make each op render just a substring
of the text node's glyph string.
2017-09-20 23:26:14 -04:00
Matthias Clasen
ff45a86a1c Fix rendering glyphs from the cache
We were not quite using all the right dimensions.
2017-09-11 14:45:36 -04:00
Matthias Clasen
b0d108291b Some fixes for the glyph cache
Copy the way cogl does its glyph caching some more.
At the minimum, this fixes problems where we were getting
wrong-sized Emoji inserted.
2017-09-11 14:02:44 -04:00
Matthias Clasen
40031930b2 Cosmetic changes
Make sure the cache size does not get out of sync with the
actual surface size.
2017-09-11 11:22:59 -04:00
Matthias Clasen
781821bae4 rate-limit the glyph cache dumping
Writing the file out every frame really isn't necessary.
Do it once per second.
2017-09-11 11:15:00 -04:00
Matthias Clasen
47cf17c70c vulkan: Add a primitive glyph cache
This is just a proof of concept - we use a single 1024x1024 surface,
and just give up when we run out of space. The cache is populated
incrementally, and items are never removed.
2017-09-10 21:56:37 -04:00
Matthias Clasen
b0e8d8483d More work on text nodes
This commit takes several steps towards rendering text
like we want to.

The creation of the cairo surface and texture is moved
to the backend (in GskVulkanRenderer). We add a mask
shader that is used in the next text pipeline to use
the texture as a mask, like cairo_mask_surface does.
There is a separate color text pipeline that uses the
already existing blend shaders to use the texture as
a source, like cairo_paint does.

The text node api is simplified to have just a single
offset, which determines the left end of the text baseline,
like all our other text drawing APIs.
2017-09-10 14:36:26 -04:00
Benjamin Otte
a5f8a74ec1 vulkan: Only render minimal region
It's faster to render once for every rectangle in the clip region than
rendering the outline of the clip region.
Especially because this reduces the time necessary to build up the frame
data.

In widget-factory (where we have 3 rectangles), this leads to a 5x
speedup in the rendering time rendering alone.
Snapshotting time goes from 10ms to ~1ms, which is another huge
improvement.
2016-12-27 00:31:33 +01:00
Benjamin Otte
786d3a013e vulkan: Implement gsk_renderer_render_texture() 2016-12-23 08:11:01 +01:00
Benjamin Otte
2d2209859e gsk: Rename to gsk_texture_download_surface()
I want to reuse the name gsk_texture_download() for downloading the
actual bytes.
2016-12-23 08:11:01 +01:00
Benjamin Otte
7b9ace488b vulkan: Add GskVulkanUploader
It's the thing that makes sure pixels end up on the GPU.
2016-12-20 18:01:11 +01:00
Benjamin Otte
85559d1fd9 vulkan: Split out command pool
This way we can pass the command pool around.
And that allows us to allocate and submitcustom buffers.
And that is necessary to make staging images work.
2016-12-20 18:01:11 +01:00
Benjamin Otte
f258af9cce gsk: Remove GskRenderNodeIter 2016-12-20 18:01:09 +01:00
Benjamin Otte
f52dd12569 vulkan: Implement texture caching
And with this change, the GPU looks bored again.
2016-12-09 18:35:52 +01:00
Benjamin Otte
6525fbe90f vulkan: Don't create more than one render object
By creating unlimited render objects, we would never wait on the GPU.

This would mean that if the GPU was the bottleneck, we would fill its
queue with render commands faster than it could process them.

And because the nvidia binary driver and my code work surprisingly well
and bugfree, this lead to exhaustion of RAM. I had 50GB of swap
configured and my hard disk was quicker as swap storage than my GPU was
at processing the commands, so stuff still filled up.

At that point my computer became rather unresponsive and I decided to
reboot it, so I that could write this patch.
2016-12-09 18:35:52 +01:00
Benjamin Otte
f4685e0291 vulkan: Move remaining structs to VulkanRender object
It now gets to maintain things.
2016-12-09 18:35:52 +01:00
Benjamin Otte
e989375c04 vulkan: Create framebuffers from GskVulkanRender object
Also create them on-demand, as they need to be created per-image and
per-framebuffer, so we don't want to create loads of them.
2016-12-09 18:35:52 +01:00
Benjamin Otte
8756deec58 vulkan: Turn swapchain image targets into GskVulkanImages
This gives us proper refcounting here, too. And there's no longer a
difference between the different types of images.
2016-12-09 18:35:52 +01:00
Benjamin Otte
ac9d48151b vulkan: Keep render objects around
That way we can reuse them. We only create a new one if the last render
operation hasn't finished executing.
2016-12-09 18:35:51 +01:00
Benjamin Otte
adff39953d vulkan: Move command pool and fence into render object 2016-12-09 18:35:51 +01:00
Benjamin Otte
eb94153a2c vulkan: Make the VulkanRender object allocated
That way, we can have multiple of those and keep them around for reuse.
2016-12-09 18:35:51 +01:00
Benjamin Otte
3c5b25b1d1 vulkan: Add GskVulkanRenderPass
And move the actual rendering code there.

A RenderPass is a collection of operations on the same target that
get executed one after another. It roughly targets VkRenderPass or
rather the subpasses of a VkRenderPass.

For now, only the infrastructure is there. No real stuff is happening.
2016-12-09 18:35:51 +01:00
Benjamin Otte
681554787b vulkan: Add GskVulkanRender object
This is refactoring work.

GskVulkanRender is supposed to be the global object for a render
operation, ie GskVulkanRenderer.render() will create this object for
what it does.

The object will be split into stages that perform the operations
necessary to create a drawing.
2016-12-09 18:35:51 +01:00
Benjamin Otte
583956266e vulkan: Make MVP matrix available to vertex shader
We use push constants for this.
2016-12-09 18:35:51 +01:00
Benjamin Otte
3c4b952256 vulkan: Make GskVulkanRenderer work
We now create a Cairo renderer, render to an image surface and upload
and retnder it with Vulkan.
2016-12-09 18:35:51 +01:00
Benjamin Otte
a7cbbaf8fc gsk: Pass texture coordinates to Vulkan renderer
We just render the coordinates as color, we don't do anything with them
yet.
2016-12-09 18:35:51 +01:00
Benjamin Otte
2a0e7f8829 gsk: Loads of work on Vulkan backend
We can now upload vertices.

And we use this to draw a yellow background. Which is clearly superior
to not drawing anything.

Also, we have shaders now. If you modify them, you need glslc installed
so they can be recompiled into Spir-V bytecode.
2016-12-09 18:35:51 +01:00
Benjamin Otte
8ba2898e08 vulkan: acquire/present images when drawing
Another step towards the final goal of actually showing something.
2016-12-09 18:35:51 +01:00
Benjamin Otte
06657fa23b gskvulkan: Create render pass and command pool 2016-12-09 18:35:51 +01:00
Benjamin Otte
3e59b11700 gskvulkanrenderer: Create imagevies and framebuffers 2016-12-09 18:35:51 +01:00
Benjamin Otte
a753f047df gsk: Add skeleton for Vulkan renderer
The renderer itself obviously doesn't do anything.
2016-12-09 18:35:51 +01:00