Commit Graph

27 Commits

Author SHA1 Message Date
Matthias Clasen
77f0e678ec gdk: Fill in some blanks in the docs
This is just an initial cut; more work is needed.
2017-12-04 15:58:30 -08:00
Alexander Larsson
f5e0986230 vulkan: Don't crash if vkEnumeratePhysicalDevices fails 2017-11-30 21:57:42 +01:00
Matthias Clasen
6560961c59 vulkan: Handle changing window scale
The code that checks for the proper size of the our swapchain
was not taking window scale fully into account. With this change,
setting the window scale to 2 in the inspector causes the window
to grow and rendering to be scaled up as expected, with Vulkan,
in the same way it already is with cairo.
2017-10-28 11:57:53 -04:00
Matthias Clasen
10ec3e91f5 vulkan: Add some missing cases to switch 2017-10-06 18:29:00 -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
Matthias Clasen
d812fc8a94 gdk: Tone down Vulkan validation
Don't show informational messages by default, only warnings
and errors. This makes it much easier to see what is going
on.
2017-09-26 18:17:27 -04:00
Chun-wei Fan
77e1d0c0c9 gdk/gdkvulkancontext.c: Fix 32-bit Windows builds
The callback function that is used by VkDebugReportCallbackCreateInfoEXT
is decorated with VKAPI_CALL (which is __stdcall on Windows).  This is
not detected on x64 Windows as __stdcall is not really meaningful on x64
Windows, and VKAPI_CALL expands to nothing on non-Windows.

As __stdcall functions are treated differently on 32-bit Windows, the
32-bit compiler does require that the function be declared as __stdcall
so that things will compile, link and run properly.

https://bugzilla.gnome.org/show_bug.cgi?id-773299
2017-06-06 00:06:35 +08:00
Georges Basile Stavracas Neto
fc1cfd569a vulkancontext: Improve debug output 2017-01-06 02:02:08 -02:00
Georges Basile Stavracas Neto
ea952a6ec3 vulkancontext: Never abort on validation layer debug
Validation layers should never interfere on application
execution.
2017-01-06 02:01:58 -02:00
Benjamin Otte
f74490739f vulkan: Create required number of swapchain images
Wayland has minImageCount == 4, so us just creating 2 images is not very
nice. So we don't do that anymore.
2017-01-04 18:38:40 +01:00
Benjamin Otte
efc5f8dc47 gdkvulkan: Track if we reffed the display's vulkan data
When reffing the display fails in init, we were still trying to unref
it. Which obviously failed and spewed warnings to stderr.
2017-01-04 18:26:14 +01:00
Georges Basile Stavracas Neto
38d6e45b32 vulkancontext: Assume the window geometry when extents are bogus
When the current extent is -1, we should assume whatever size
the GdkWindow has.
2017-01-04 13:23:48 +01:00
Chun-wei Fan
9db5cc9a98 gdk/gdkvulkancontext.c: Avoid VLAs
During the drive to enable Vulkan context creation on Windows, some more
VLAs were found here.  Replace them with g_newa().

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2016-12-29 17:51:56 +08:00
Benjamin Otte
293248c1d3 gdkvulkan: Track changes per swapchain image
... and use those in begin_frame() to ensure all of the invalid area
gets invalidated.
2016-12-26 22:24:22 +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
2c0564a46e build: Make sure GTK compiles without Vulkan headers installed
Previously, code would work fine with --disable-vulkan if the Vulkan
headers were installed - code would happily just use them as they're
installed in /usr/include.
2016-12-09 20:23:06 +01:00
Matthias Clasen
3dd4f76703 Rename GDK_WINDOWING_VULKAN
The WINDOWING defines are only for GDK backends, really.
Define GDK_RENDERING_VULKAN instead.
2016-12-09 14:11:37 -05:00
Matthias Clasen
5b6a837b17 Only include vulkan.h if we have it 2016-12-09 14:05:26 -05:00
Benjamin Otte
747df7aa3c vulkan: Also wait on the draw semaphore when present()ing
That way we have a synchronization primitive at the start and at the
end.
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
325efe7078 vulkan: Expose the swapchain images in public API 2016-12-09 18:35:51 +01:00
Benjamin Otte
0c8e7d0ac0 vulkan: Register debug handler
We now hook Vulkan error reporting into glib's error reporting.

I'm not sure on the severity handling yet, but we can fix that as we go
along.
2016-12-09 18:35:51 +01:00
Benjamin Otte
b6227aa998 gdk: Add GDK_VULKAN env variable
Also add 2 flags:

GDK_VULKAN="disable" will disable Vulkan usage.

GDK_VULKAN="validate" will enable VK_LAYER_LUNARG_standard_validation.
2016-12-09 18:35:51 +01:00
Benjamin Otte
e22cb94e50 vulkan: More work on GdkVulkanContext
Code has now arrived at creation of swapchains.
2016-12-09 18:35:51 +01:00
Benjamin Otte
4ef8bf821e vulkan: Turn GdkVulkanContext into a GdkDrawContext 2016-12-09 18:35:51 +01:00
Benjamin Otte
6d1d6e6792 vulkan: Add more infrastructure
gdk_window_create_vulkan_context() now exists and will return a Vulkan
context for the given window. It even initializes the surface. But it
doesn't do anything useful yet.
2016-12-09 18:35:51 +01:00
Benjamin Otte
cca547e5bc vulkan: Initial support
Adds the gdk_display_ref_vulkan() and gdk_display_unref_vulkan()
functions which setup/tear down VUlkan support for the display.

Nothing is using those functions yet.
2016-12-09 18:35:51 +01:00