mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 09:40:10 +00:00
Merge branch 'wip/otte/for-main' into 'main'
gpu: Don't crash when there's no ops Closes #6992 See merge request GNOME/gtk!7710
This commit is contained in:
commit
bdee95c32c
@ -473,9 +473,8 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
res = GDK_VK_CHECK (vkCreateSwapchainKHR, device,
|
||||
&(VkSwapchainCreateInfoKHR) {
|
||||
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
||||
.flags =
|
||||
(gdk_vulkan_context_has_feature (context, GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE) ?
|
||||
VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT : 0),
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.surface = priv->surface,
|
||||
.minImageCount = CLAMP (4,
|
||||
capabilities.minImageCount,
|
||||
|
@ -309,13 +309,27 @@ gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
const graphene_rect_t *rect)
|
||||
{
|
||||
if (self->type == GSK_GPU_CLIP_NONE ||
|
||||
self->type == GSK_GPU_CLIP_CONTAINED ||
|
||||
gsk_gpu_clip_contains_rect (self, offset, rect))
|
||||
return GSK_GPU_SHADER_CLIP_NONE;
|
||||
else if (self->type == GSK_GPU_CLIP_RECT)
|
||||
return GSK_GPU_SHADER_CLIP_RECT;
|
||||
else
|
||||
return GSK_GPU_SHADER_CLIP_ROUNDED;
|
||||
switch (self->type)
|
||||
{
|
||||
case GSK_GPU_CLIP_NONE:
|
||||
case GSK_GPU_CLIP_CONTAINED:
|
||||
return GSK_GPU_SHADER_CLIP_NONE;
|
||||
|
||||
case GSK_GPU_CLIP_RECT:
|
||||
if (gsk_gpu_clip_contains_rect (self, offset, rect))
|
||||
return GSK_GPU_SHADER_CLIP_NONE;
|
||||
else
|
||||
return GSK_GPU_SHADER_CLIP_RECT;
|
||||
|
||||
case GSK_GPU_CLIP_ROUNDED:
|
||||
if (gsk_gpu_clip_contains_rect (self, offset, rect))
|
||||
return GSK_GPU_SHADER_CLIP_NONE;
|
||||
else
|
||||
return GSK_GPU_SHADER_CLIP_ROUNDED;
|
||||
|
||||
case GSK_GPU_CLIP_ALL_CLIPPED:
|
||||
default:
|
||||
g_return_val_if_reached (GSK_GPU_SHADER_CLIP_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,6 @@ typedef enum {
|
||||
GSK_GPU_CLIP_ROUNDED
|
||||
} GskGpuClipComplexity;
|
||||
|
||||
typedef struct _GskGpuClip GskGpuClip;
|
||||
|
||||
struct _GskGpuClip
|
||||
{
|
||||
GskGpuClipComplexity type;
|
||||
|
@ -74,6 +74,7 @@ gsk_gpu_frame_default_cleanup (GskGpuFrame *self)
|
||||
}
|
||||
gsk_gpu_ops_set_size (&priv->ops, 0);
|
||||
|
||||
priv->first_op = NULL;
|
||||
priv->last_op = NULL;
|
||||
}
|
||||
|
||||
@ -283,6 +284,9 @@ gsk_gpu_frame_seal_ops (GskGpuFrame *self)
|
||||
GskGpuOp *last, *op;
|
||||
gsize i;
|
||||
|
||||
if (gsk_gpu_ops_get_size (&priv->ops) == 0)
|
||||
return;
|
||||
|
||||
priv->first_op = (GskGpuOp *) gsk_gpu_ops_index (&priv->ops, 0);
|
||||
|
||||
last = priv->first_op;
|
||||
|
@ -15,14 +15,21 @@ gsk_gpu_print_indent (GString *string,
|
||||
|
||||
void
|
||||
gsk_gpu_print_shader_flags (GString *string,
|
||||
GskGpuShaderFlags flags)
|
||||
GskGpuShaderFlags flags,
|
||||
gboolean first)
|
||||
{
|
||||
GskGpuShaderClip clip = gsk_gpu_shader_flags_get_clip (flags);
|
||||
|
||||
g_string_append (string, first ? "+ " : "| ");
|
||||
#if 0
|
||||
g_string_append (string, first ? (last ? "⧫ " : "▲ ")
|
||||
: (last ? "▼ " : "▮ "));
|
||||
#endif
|
||||
|
||||
switch (clip)
|
||||
{
|
||||
case GSK_GPU_SHADER_CLIP_NONE:
|
||||
g_string_append (string, "🞨 ");
|
||||
g_string_append (string, "⬚ ");
|
||||
break;
|
||||
case GSK_GPU_SHADER_CLIP_RECT:
|
||||
g_string_append (string, "□ ");
|
||||
|
@ -18,7 +18,8 @@ void gsk_gpu_print_newline (GString
|
||||
void gsk_gpu_print_string (GString *string,
|
||||
const char *s);
|
||||
void gsk_gpu_print_shader_flags (GString *string,
|
||||
GskGpuShaderFlags flags);
|
||||
GskGpuShaderFlags flags,
|
||||
gboolean first);
|
||||
void gsk_gpu_print_color_states (GString *string,
|
||||
GskGpuColorStates color_states);
|
||||
void gsk_gpu_print_enum (GString *string,
|
||||
|
@ -52,7 +52,7 @@ gsk_gpu_shader_op_print (GskGpuOp *op,
|
||||
for (i = 0; i < self->n_ops; i++)
|
||||
{
|
||||
gsk_gpu_print_op (string, indent, shader_name);
|
||||
gsk_gpu_print_shader_flags (string, self->flags);
|
||||
gsk_gpu_print_shader_flags (string, self->flags, i == 0);
|
||||
gsk_gpu_print_color_states (string, self->color_states);
|
||||
shader_class->print_instance (self,
|
||||
instance + i * shader_class->vertex_size,
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
typedef struct _GskGpuBuffer GskGpuBuffer;
|
||||
typedef struct _GskGpuCache GskGpuCache;
|
||||
typedef struct _GskGpuClip GskGpuClip;
|
||||
typedef guint32 GskGpuColorStates;
|
||||
typedef struct _GskGpuDevice GskGpuDevice;
|
||||
typedef struct _GskGpuFrame GskGpuFrame;
|
||||
|
@ -792,7 +792,7 @@ gtk_single_selection_get_can_unselect (GtkSingleSelection *self)
|
||||
*
|
||||
* Note that setting [property@Gtk.SingleSelection:autoselect] will
|
||||
* cause unselecting to not work, so it practically makes no sense
|
||||
* to set both at the same time the same time.
|
||||
* to set both at the same time.
|
||||
*/
|
||||
void
|
||||
gtk_single_selection_set_can_unselect (GtkSingleSelection *self,
|
||||
|
Loading…
Reference in New Issue
Block a user