Commit Graph

25 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
147a455171 vulkan: Destroy image before releasing associate memory
VkImage contains a reference to the VkDeviceMemory and, because
the current code frees the VkDeviceMemory before destroying the
VkImage that references it, a warning is triggered by the validation
layers.

This is not critical, since we release both resources at the same
place. But the warning triggered by the validation layers sums up
adding 1 MB per second of extra debug logging, making the debugging
process much more painful.

This commit simply swaps the destruction order, and destroys the
VkImage first, then the now unused VkDeviceMemory.
2017-12-13 22:49:16 -02:00
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
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
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
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
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
Matthias Clasen
64322a2c41 vulkan: Add an api to update multiple image regions
Instead of doing multiple copy commands with a tiny buffer
for each glyph, we can just batch them all together. This
also avoids the issue of creating multiple barriers for the
same image.
2017-09-21 13:42:57 -04:00
Lionel Landwerlin
b97fb75146 gsk: vulkan: rework image layout/access transitions
By tracking the last transition we can build the appropriate barriers.
Also use the most appropriate initial layout/access at creation :

for linear image : predefined (we prepare the content ourself through memcpy)
for everything else : undefined (we don't care about the content, will most likely be erase)
2017-09-20 23:26:14 -04:00
Matthias Clasen
5ee5af9bc8 vulkan: Add an upload_region api to GskVulkanImage
This will let us update larger textures incrementally.
Sadly, it does not work yet.
2017-09-20 23:26:14 -04:00
Lionel Landwerlin
48df19287b gsk: vulkan: fix image uploading
The memory alignment requirements are different from the image layout.
We want the rowPitch to know where to upload the lines.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786485
2017-08-18 19:41:36 -04:00
Emmanuele Bassi
fca3f93114 gsk: Mark finalize() implementation as static 2017-04-26 17:28:14 +01:00
Emmanuele Bassi
c71aeff9b2 gsk: Mark internal symbols as static
These symbols are not used anywhere outside of GskVulkanImage.
2017-04-26 17:25:24 +01:00
Benjamin Otte
b30225e67c vulkan: We use VK_FORMAT_B8G8R8A8_UNORM
... not SRGB. SRGB messes up alpha compositing, GdkRGBA and everything
else.
2016-12-25 06:23:12 +01:00
Benjamin Otte
786d3a013e vulkan: Implement gsk_renderer_render_texture() 2016-12-23 08:11:01 +01:00
Benjamin Otte
3e4fd32b54 vulkan: Batch upload image barriers together
Doesn't seem to help much though...
2016-12-20 18:01:11 +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
ba7ac637bc vulkan: Implement staging-buffer image upload
This is not enabled by default. Use GSK_RENDERING_MODE=staging-buffer to
use the code.
2016-12-20 18:01:11 +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
17c11dd97b vulkan: Store width/height of GskVulkanImage
This is to enable lazy framebuffer creation later.
2016-12-09 18:35:51 +01:00
Benjamin Otte
c160ef16c1 vulkan: Turn GskVulkanImage into a GObject
This way, we can do real refcounting on them.
2016-12-09 18:35:51 +01:00
Benjamin Otte
85bc9ff36b vulkan: Hook up image upload mechanism to env variables
Instead of having to decie at compile-time, check if
GSK_RENDERING=staging-image was given, and if so, select the staging
image upload mode.
2016-12-09 18:35:51 +01:00
Benjamin Otte
13b53656ea vulkan: Upload image data directly
Instead of using a staging iamge, we require the final image to be
linearly allocated and have host-visible memory.

This improves performance quite a bit.

The old code is still there and can be enabled with a simple change
to a #define in gskvulkanimage.h
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