Commit Graph

418 Commits

Author SHA1 Message Date
Matthias Clasen
fe6e80fdde vulkan: Fix repeat node coordinates
We were not treating non-trivial child bounds right at all.
This was visible in the css blendmode cmyk example in gtk4-demo,
for the normal blendmode.
2017-10-08 09:02:35 -04:00
Umang Jain
a933c7c4bd gsk: Move gsk_cairo_node_new_for_surface into public API
https://bugzilla.gnome.org/show_bug.cgi?id=788534
2017-10-08 18:22:34 +05:30
Umang Jain
74f8fc80d3 gsk: Fix serialization of cairo node
https://bugzilla.gnome.org/show_bug.cgi?id=788534
2017-10-08 18:22:34 +05:30
Matthias Clasen
b9b03cf570 gskrenderer: Make the window property not construct
We never set this, since it is assigned as a side-effect
of realizing the renderer. Make this a plain readonly property.
2017-10-06 19:29:42 -04:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Benjamin Otte
c1e9869329 build: Don't turn off critical warnings
-Wint-conversion is important because it checks casts from ints to
pointers.

-Wdiscarded-qualifiers is important to catch cases where we don't
strings when we should.
2017-10-06 16:03:08 +02:00
Matthias Clasen
3aaea0ef40 Clip intermediate textures
In some cases, we were creating gigantic intermediate textures
only to clip out a small section afterwards (e.g. in the listbox
example in gtk4-demo). This is wasteful if we apply effects on
the texture, such as blur or color-matrix. So, clip the dimensions
of the intermediate texture with the current clip. To make this
feasible, we move the texture coordinate computation out of the
pipeline setup functions into the node_as_texture function where
this clipping happens.

One extra complication we encounter is that the node might get
clipped away completely. Since Vulkan does not allow to create
empty images, we bail out in this case and not draw anything.

With these changes, the listbox example in gtk4-demo goes from
32M pixels of intermediate texture to 320000.
2017-10-01 19:22:04 -04:00
Matthias Clasen
4e33be124d Add a forgotten rename
When I renamed blend to texture, I overlooked that the color
text pipeline also uses this shader. Fix it.
2017-09-30 17:58:23 -04:00
Matthias Clasen
50bea37320 Reshuffle things a little bit
Instead of having a function with lots of arguments in
GskVulkanRender that we call from GskVulkanRenderPass which
then just calls back into GskVulkanRenderPass, just create
the new render pass object locally, and an api to add it
to the list that GskVulkanRender keeps. This makes it
a lot easier to preserve all the relevant parameters from
the parent render pass.
2017-09-30 17:58:23 -04:00
Matthias Clasen
983e0b7956 Small simplification
Just keep the viewport as a graphene_rect_t, we don't need
to use the Vulkan type here.
2017-09-30 17:58:23 -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
3a37440be6 Cosmetics
Factor out a helper function.
2017-09-30 17:58:23 -04:00
Matthias Clasen
52afccb6a3 Fix a doc comment
It was missing a return.
2017-09-30 17:58:23 -04:00
Matthias Clasen
836e18cc96 Support repeat nodes in vulkan
We can use the texture pipeline for this, with a repeating sampler.
2017-09-29 23:08:14 -04:00
Matthias Clasen
31d8fe3a6a vulkan: Add a repeating sampler
None of the render ops use it, yet.
2017-09-29 23:08:14 -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
5577fde990 vulkan: Rename blend pipeline to texture
This is what it does, and the name blend is easily
confused with blend-mode.
2017-09-29 23:08:09 -04:00
Matthias Clasen
538e7c7982 vulkan: Allow to control scaling in the blend pipeline
Pass in a second rect that defines the size of the texture.
Update the sole caller to pass in the same rect, for unchanged
behavior.
2017-09-29 22:12:25 -04:00
Matthias Clasen
e91051a562 vulkan: Fix setup for dependent render passes
We were not correctly preserving the modelview transform.
2017-09-29 15:58:16 -04:00
Matthias Clasen
9e2e6c1115 gsk: Fix a typo
Repeating linear gradient nodes share most of the implementation
with linear gradient nodes, but they shouldn't share the class name.
2017-09-28 21:06:52 -04:00
Matthias Clasen
e45ab76664 gsk: remove gsk_blend_node_get_blend_mode from public api
We don't have any other such getters in the public api at
this point, so leave this one out as well.
2017-09-28 19:39:16 -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
72d043d51f gsk: Change the profiler setup
Move away from the idea of intra-frame sampling, since we only
push samples once per frame, anyway. Instead, make the profiler
keep a rolling average of the last n frames.
2017-09-28 10:26:01 -04:00
Matthias Clasen
767966933d gsk: Redo the sampling in the profiler
Reset the min/max/average counters before calculating,
and only print the values if we have samples. In addition,
print the number of samples.
2017-09-28 10:25:49 -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
cbf897ab22 Add an api to get the vertex data for a render pass 2017-09-28 08:39:22 -04:00
Matthias Clasen
85e4e0672a Add semaphores to the command buffer submit api
Allow to pass in semaphores to wait for before executing
and to signal after executing the command buffer. This
just exposes the capabilities of the underlying Vulkan
api. Update all callers to pass no semaphores, for now.

We will use this in the future.
2017-09-28 08:39:22 -04:00
Matthias Clasen
ff188f6bf0 Add an api to create intermediate textures
The new function creates a vulkan image that is suitable for
use as a framebuffer to render to and as a texture to read from.
2017-09-28 08:39:22 -04:00
Matthias Clasen
485470511f vulkan: Update the outset-shadow fragment shaders
These were missing the blur-radius parameter that is written
by the vertex shader, causing Vulkan validation to complain.
2017-09-26 18:24:52 -04:00
Matthias Clasen
145e4fde92 gsk: Fix Vulkan validation errors for image upload
I've finally figured out the right combination of src and dest
stage and access flags to make all validation warnings go away.
This commit only fixes the direct upload code.
2017-09-26 18:18:31 -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
cfbd6b4b99 gsk: Add a way to reset profiler counters
It is often useful to count things per-frame, and reset
the counter afterwards.
2017-09-25 20:58:10 -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
Matthias Clasen
816b47d70d gsk: Make profiler counters more useful
Make it possible to have counters that get incremented
by values other than 1.
2017-09-25 17:03:06 -04:00
Matthias Clasen
4970404d33 gsk: count fallback pixels
Always helps to have some measure of progress.
2017-09-25 09:28:18 -04:00
Rico Tzschichholz
d09f695172 gsk: Some g-i annotation fixes 2017-09-25 11:15:14 +02:00
Matthias Clasen
f6626a9e0e gsk: Documentation additions
Document newly added apis, and ensure that all public apis
are listed in the docs.
2017-09-24 22:26:39 -04:00
Matthias Clasen
b5ac277654 Plug a memory leak
A function with ensure in the name would better check if the
thing it is supposed to ensure already exists.
2017-09-24 21:48:07 -04:00
Matthias Clasen
4a5ac93762 gsk: Fix a prefix mishap
There shouldn't be any gst_ functions in here...
2017-09-23 13:15:30 -04:00
Matthias Clasen
a7f077a3a9 Cosmetics
Go back to a single GskVulkanOpRender that can
handle 0, 1 or 2 sources.
2017-09-23 09:47:05 -04:00
Matthias Clasen
3c98b90fc6 vulkan: Implement nonseparable blendmodes
This is a directly-from-the-spec, unoptimized implementation.
2017-09-23 09:16:58 -04:00
Matthias Clasen
d61f6ff393 vulkan: Implement blend modes
This is another example for a 2-texture shader.
So far, only separable blend modes are implemented.
The implementation is not optimized, with an
if-else cascade in the shader.
2017-09-23 01:59:50 -04:00
Matthias Clasen
b192120f39 vulkan: fix a clip handling problem
We were looking at uninitialized memory here, instead
of the type of the source clip, as we should.

This showed up as mispositioned clip in the first frame
of a crossfade stack transition, and also as overdraw in
sliding stack transitions.
2017-09-22 22:16:10 -04:00
Matthias Clasen
a75d995bd4 vulkan: Implement crossfade
This is the first shader using two textures. It almost works.
2017-09-22 22:16:10 -04:00
Matthias Clasen
8ad0539cf7 vulkan: Drop GskVulkanPipelineLayout
We already move the descriptor set layout out of it,
so we can just as well keep the pipeline layouts in
the render object as well, and get rid of this extra
object. Update all callers.
2017-09-22 22:16:09 -04:00
Matthias Clasen
9b0ee4ac99 Allow different pipeline layouts
These are differentiated by the number of textures; currently
we have shaders with 0 and 1 textures.
2017-09-22 22:16:09 -04:00
Matthias Clasen
5ff6481310 Add a getter to the pipeline layout directly from the pipeline
This is a step towards allowing multiple pipeline layouts.
2017-09-22 22:16:09 -04:00
Matthias Clasen
4c7a51f88a vulkan: Move descriptor set layout to the render object
We want to maintain a single descriptor set layout while introducing
multiple pipeline layouts, so split this off.
2017-09-22 22:16:09 -04:00
Matthias Clasen
e97a78840f gsk: vulkan: Drop an unused api
We don't use the upload-single-region api anymore.
No need to keep it around.
2017-09-21 13:47:17 -04:00