Commit Graph

72 Commits

Author SHA1 Message Date
Matthias Clasen
bddf9f9ca3 docs: Cosmetics
Do a round of "the the" removal.
2021-10-18 08:35:54 -04:00
Benjamin Otte
dc6e831524 gdk: hdr => high depth
The term "hdr" is so overloaded, we shouldn't use them anywhere, except
from maybe describing all of this work in blog posts and other marketing
materials.

So do renames:
* hdr => high_depth
* request_hdr => prefers_high_depth

This more accurately describes what is going on.
2021-10-06 22:50:07 +02:00
Benjamin Otte
7ede468849 gdk: Add a request_hdr argument to begin_frame()
It's not used by anyone, it's just there.

gdk_draw_context_begin_frame_full() has been added so renderers can
make use of it.
2021-10-06 03:44:58 +02:00
Benjamin Otte
a29474567a gdk: Remove gdkinternals.h 2021-09-24 22:50:29 +02:00
Benjamin Otte
27cad85247 gdk: Include Vulkan error code in vulkan_strerror() 2021-08-12 14:19:30 +02:00
Matthias Clasen
fff2b3c710 gdk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
9132f1831c docs: Rework the gdk docs
Convert links, make things more concise.
2021-03-11 16:37:31 +00:00
Emmanuele Bassi
f22ec063a1 Fix the Vulkan header check for VK_RESULT_RANGE_SIZE
The VK_RESULT_RANGE_SIZE enumeration value was removed in 1.2.140, not
1.2.142.

Fixes: #3522
2020-12-28 18:41:18 +00:00
Matthias Clasen
4310f24a4e Fix warnings with Vulkan < 162
Tiring to watch the Vulkan people stumble through
ABI and API compat, but what can you do.
2020-12-21 20:00:16 -05:00
Timm Bäder
3c2484142d vulkancontext: Remove usage of VK_ERROR_INCOMPATIBLE_VERSION_KHR
According to
https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/chap46.html
this has been removed. It also breaks the build on my system
2020-12-16 08:26:46 +01:00
Matthias Clasen
b9d4654fca vulkan: Fix swapchain creation
We end up with a surface that has size 0x0 at the
time we create the Vulkan context, and that is a
size that Vulkan doesn't like, so ensure we request
at least 1x1.

Fixes: #3147
2020-09-10 13:55:16 -04:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Adrian Perez de Castro
5c4ca1424d
Fix build issue due to missing VK_RESULT_RANGE_SIZE
Conditionally check whether the Vulkan headers version defines
VK_RESULT_RANGE_SIZE, and avoid using it for version >=140. The
following comming in Vulkan-Headers has removed the enum value:

  0c5351f5e9 (diff-4febd94c0666d59030d8b1dd20c72403)
2020-05-11 10:07:41 +03:00
Matthias Clasen
7ca8efa0f5 vulkan: Update error codes enum
Do the silly update exercise.
2020-04-26 14:08:40 -04:00
Emmanuele Bassi
c69595a3a9 vulkan: Handle VK_ERROR_UNKNOWN
A newly added Vulkan 1.2 error.
2020-02-11 14:47:22 +00:00
Jonas Ådahl
ba74f41a70 wayland/vulkancontext: Fix present region on HiDPI
VkPresentRegionsKHR is expected to operate in buffer coordinates, but
the region we get passed is in surface coordinates, so it must be scaled.
2019-12-03 16:45:37 +01:00
Benjamin Otte
41beae1956 vulkan: Add missing enum value
Also update comment to point to new header after Vulkan reorganized
their repositories.
2019-11-01 14:52:36 +01:00
Georges Basile Stavracas Neto
a795d6635b vulkan/context: Implement VK_KHR_incremental_present
This is the Vulkan version of eglSwapBuffersWithDamage(), and
it's always a good idea to limit the number of pixels we're
pushing to the GPU and/or swapping into the display.
2019-10-05 12:13:22 -03:00
Christian Hergert
f507a79056 marshallers: ensure g_cclosure_marshal_VOID__VOIDv is used
If we set c_marshaller manually, then g_signal_newv() will not setup a
va_marshaller for us. However, if we provide c_marshaller as NULL, it will
setup both the c_marshaller (to g_cclosure_marshal_VOID__VOID) and
va_marshaller (to g_cclosure_marshal_VOID__VOIDv) for us.
2019-05-29 13:22:31 -07:00
Emmanuele Bassi
f25832455f vulkan: Add missing enumeration value
Vulkan 1.1.97 added VK_ERROR_INVALID_DEVICE_ADDRESS_EXT, and we now must
handle it.
2019-04-12 18:03:22 +01:00
Matthias Clasen
77c0e68b57 gdk: Rename our vulkan context to GTK
Not sure it shows up anywhere, but just for completeness.
2019-02-24 10:53:23 -05:00
Benjamin Otte
359bc7695c build: Reintroduce warning flags from autotools
Some of the flags got lost in the meson transition or were demoted from
error flags to warning flags.
This commit reintroduces them.

It also includes fixes for the code that had warnings with those flags.
The big one being -Wshadow.
2019-01-22 04:33:12 +01:00
Abderrahim Kitouni
e0833e492c vulkancontext: fix typos in documentation 2018-11-17 19:35:47 +01:00
Timm Bäder
ce3d5fcb0a vulkancontext: Add missing error switch 2018-11-13 15:28:46 +01:00
Benjamin Otte
83ea0b3714 drawcontext: Only pass the region that matters
We used to pass 2 regions to GdkDrawCotnext.end_frame() but code was
confusing what they meant. So we now don't do that anymore and only pass
the region that matters: The frame region.
2018-04-24 23:16:58 +02:00
Benjamin Otte
fd686afeb2 drawcontext: Add gdk_draw_context_in_frame() API
This makes the previous gdk_draw_context_is_drawing() function public
under a new name.

I decided against the old name because we use the term "frame" for a
drawing operation, so I wanted to have this boolean flag reuse the term.
2018-04-24 23:16:58 +02:00
Benjamin Otte
a865621519 gdk: Move begin/end_frame() functions
As they require a draw context and the draw context is already bound to
the surface, it makes much more sense and reduces abiguity by moving
these APIs to the draw context.

As a side effect, we simplify GdkSurface APIs to a point where
GdkSurface now does not concern itself with drawing anymore at all,
apart from being the object that creates draw contexts.
2018-04-24 23:16:58 +02:00
Timm Bäder
f24d0725ca vulkancontext: Add new error enum 2018-04-10 09:53:48 +02:00
Benjamin Otte
c8e38c6065 vulkan: Use new resize vfunc to recreate swapchain
... instead of checking sizes for every frame.
2018-04-09 01:00:31 +02:00
Benjamin Otte
7ee4bfd9d6 vulkan: Reserve 4 images in the swapchain by default
With the previous approach we would spend most of the time waiting for
the swapchain to be filled again because it seems the compositor takes
care of 2 images at once from time to time.

This is not visible in profiles because waiting for a frame is a
read/poll/whatever operation that does not take CPU. It's only
noticeable because the app becomes less responsive.
2018-03-29 05:02:15 +02:00
Alexander Larsson
3dce0dcca7 GdkSurface: Rename lots of stuff from window->surface
Mostly these are internal things, but the major public change is
that event.window is now event.surface.
2018-03-20 15:14:10 +01:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Benjamin Otte
7f0ef81e11 vulkan: Our data is premultiplied, don't pretend it isn't
If the backend can't do premultiplied alpha, better make the backend treat
2018-03-16 06:04:43 +01:00
Benjamin Otte
45603f70a8 vulkan: Don't quiet the compiler
This reverts 76461a8004.

We don't want to quiet the compiler here because new warnings should be
added to the enum the moment they become available.
2018-02-23 14:12:47 +01:00
Benjamin Otte
4cfaee99e7 vulkan: Add error strings for missing VkResults
Also, guard newer error returns with proper #if, so they don't trip up
older Vulkan versions.
2018-02-23 14:12:47 +01:00
Matthias Clasen
e151058dff Make gdk logging per-display
As far as possible, use per-display debug flags.

This will minimize the debug spew that we get from
the inspector if it is running on a separate display.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c5fc841285 gdk: Reorganize env vars
Drop GDK_GL, GDK_VULKAN and GDK_RENDERING_MODE.
Merge the useful bits into GDK_DEBUG.
Drop unused debug flags (CURSOR).
2018-01-14 17:05:04 -05:00
Matthias Clasen
76461a8004 Quiet a compiler warning
Avoid this warning the other way, without bumping the libvulkan
dependency.
2018-01-10 07:35:46 -05:00
Matthias Clasen
5009c691ac Revert "Quiet a compiler warning"
This reverts commit 888f289114.
2018-01-10 07:34:36 -05:00
Matthias Clasen
ccdeaab1f9 vulkan: Add a way to specify a device
We should be smarter in picking a good device eventually,
but for now, we just allow to explicitly choose one. To
see a list of all devices, use GDK_VULKAN_DEVICE=list

To specify which device to use, use GDK_VULKAN_DEVICE=<number>
2018-01-09 20:33:04 -05:00
Matthias Clasen
888f289114 Quiet a compiler warning
Vulkan grew a new error code.
2018-01-09 17:20:44 -05:00
Matthias Clasen
5ba5f2c0c0 gdk: Cosmetic rewording of draw context docs
Avoid draw context <> drawing context confusion,
as far as possible.
2017-12-26 14:39:49 -05:00
Matthias Clasen
6f82ba5e5e gdk: Document GdkVulkanContext
New API needs documentation.
2017-12-26 13:00:27 -05:00
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