Merge branch 'wip/otte/for-main' into 'main'

vulkan: Don't print errors on vkCreateInstance() failure

Closes #6947

See merge request GNOME/gtk!7643
This commit is contained in:
Benjamin Otte 2024-08-23 21:37:12 +00:00
commit 5369b07eb0
7 changed files with 60 additions and 75 deletions

View File

@ -1673,26 +1673,26 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME);
}
res = GDK_VK_CHECK (vkCreateInstance, &(VkInstanceCreateInfo) {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.pApplicationInfo = &(VkApplicationInfo) {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pNext = NULL,
.pApplicationName = g_get_application_name (),
.applicationVersion = 0,
.pEngineName = "GTK",
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
.apiVersion = VK_API_VERSION_1_3
},
.enabledLayerCount = 0,
.ppEnabledLayerNames = NULL,
.enabledExtensionCount = used_extensions->len,
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata,
},
NULL,
&display->vk_instance);
res = vkCreateInstance (&(VkInstanceCreateInfo) {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.pApplicationInfo = &(VkApplicationInfo) {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pNext = NULL,
.pApplicationName = g_get_application_name (),
.applicationVersion = 0,
.pEngineName = "GTK",
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
.apiVersion = VK_API_VERSION_1_3
},
.enabledLayerCount = 0,
.ppEnabledLayerNames = NULL,
.enabledExtensionCount = used_extensions->len,
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata,
},
NULL,
&display->vk_instance);
g_ptr_array_free (used_extensions, TRUE);
if (res != VK_SUCCESS)

View File

@ -53,37 +53,6 @@ static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
gsk_gpu_blur_setup_vao
};
static void
gsk_gpu_blur_op_full (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
const graphene_point_t *offset,
guint32 variation,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction,
const GdkColor *blur_color)
{
GskGpuBlurInstance *instance;
GdkColorState *alt;
alt = gsk_gpu_color_states_find (ccs, blur_color);
gsk_gpu_shader_op_alloc (frame,
&GSK_GPU_BLUR_OP_CLASS,
gsk_gpu_color_states_create (ccs, TRUE, alt, variation & VARIATION_COLORIZE ? FALSE : TRUE),
variation,
clip,
(GskGpuImage *[1]) { image->image },
(GskGpuSampler[1]) { image->sampler },
&instance);
gsk_gpu_rect_to_float (image->coverage, offset, instance->rect);
gsk_gpu_rect_to_float (image->bounds, offset, instance->tex_rect);
graphene_vec2_to_float (blur_direction, instance->blur_direction);
gsk_gpu_color_to_float (blur_color, alt, opacity, instance->blur_color);
}
void
gsk_gpu_blur_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
@ -93,19 +62,20 @@ gsk_gpu_blur_op (GskGpuFrame *frame,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction)
{
GdkColor blur_color;
GskGpuBlurInstance *instance;
gdk_color_init (&blur_color, ccs, (float[]) { 1, 1, 1, 1 });
gsk_gpu_blur_op_full (frame,
clip,
ccs,
opacity,
offset,
0,
image,
blur_direction,
&blur_color);
gdk_color_finish (&blur_color);
gsk_gpu_shader_op_alloc (frame,
&GSK_GPU_BLUR_OP_CLASS,
gsk_gpu_color_states_create_equal (TRUE, TRUE),
0,
clip,
(GskGpuImage *[1]) { image->image },
(GskGpuSampler[1]) { image->sampler },
&instance);
gsk_gpu_rect_to_float (image->coverage, offset, instance->rect);
gsk_gpu_rect_to_float (image->bounds, offset, instance->tex_rect);
graphene_vec2_to_float (blur_direction, instance->blur_direction);
}
void
@ -118,14 +88,23 @@ gsk_gpu_blur_shadow_op (GskGpuFrame *frame,
const graphene_vec2_t *blur_direction,
const GdkColor *shadow_color)
{
gsk_gpu_blur_op_full (frame,
clip,
ccs,
opacity,
offset,
VARIATION_COLORIZE,
image,
blur_direction,
shadow_color);
GskGpuBlurInstance *instance;
GdkColorState *alt;
alt = gsk_gpu_color_states_find (ccs, shadow_color);
gsk_gpu_shader_op_alloc (frame,
&GSK_GPU_BLUR_OP_CLASS,
gsk_gpu_color_states_create (ccs, TRUE, alt, FALSE),
VARIATION_COLORIZE,
clip,
(GskGpuImage *[1]) { image->image },
(GskGpuSampler[1]) { image->sampler },
&instance);
gsk_gpu_rect_to_float (image->coverage, offset, instance->rect);
gsk_gpu_rect_to_float (image->bounds, offset, instance->tex_rect);
graphene_vec2_to_float (blur_direction, instance->blur_direction);
gsk_gpu_color_to_float (shadow_color, alt, opacity, instance->blur_color);
}

View File

@ -15,6 +15,7 @@
#include <glib/gstdio.h>
#include "gdk/gdkdisplayprivate.h"
#include "gdk/gdkdmabuftexturebuilderprivate.h"
#include "gdk/gdkdmabuftextureprivate.h"
#include "gdk/gdkglcontextprivate.h"
@ -296,7 +297,9 @@ gsk_gpu_download_op_gl_command (GskGpuOp *op,
GdkGLContext *context;
guint texture_id;
context = GDK_GL_CONTEXT (gsk_gpu_frame_get_context (frame));
/* Don't use the renderer context, the texture might survive the frame
* and its surface */
context = gdk_display_get_gl_context (gsk_gpu_device_get_display (gsk_gpu_frame_get_device (frame)));
texture_id = gsk_gl_image_steal_texture (GSK_GL_IMAGE (self->image));
#ifdef HAVE_DMABUF

View File

@ -963,7 +963,6 @@ gsk_vulkan_image_new_for_dmabuf (GskVulkanDevice *device,
&self->vk_image);
if (res != VK_SUCCESS)
{
gsk_vulkan_handle_result (res, "vkCreateImage");
GDK_DEBUG (DMABUF, "vkCreateImage() failed: %s", gdk_vulkan_strerror (res));
return NULL;
}

View File

@ -72,7 +72,7 @@ run (out vec4 color,
}
if (VARIATION_COLORIZE)
color = _blur_color * sum.a / coefficient_sum;
color = output_color_alpha (_blur_color, sum.a / coefficient_sum);
else
color = sum / coefficient_sum;
position = _pos;

View File

@ -411,6 +411,7 @@ init_gl (GtkInspectorGeneral *gen)
append_egl_extension_row (gen, egl_display, "EGL_KHR_create_context");
append_egl_extension_row (gen, egl_display, "EGL_EXT_buffer_age");
append_egl_extension_row (gen, egl_display, "EGL_EXT_swap_buffers_with_damage");
append_egl_extension_row (gen, egl_display, "EGL_KHR_swap_buffers_with_damage");
append_egl_extension_row (gen, egl_display, "EGL_KHR_surfaceless_context");
append_egl_extension_row (gen, egl_display, "EGL_KHR_no_config_context");
append_egl_extension_row (gen, egl_display, "EGL_EXT_image_dma_buf_import_modifiers");

View File

@ -603,6 +603,9 @@ xfails = [
'border-image-url.ui',
'label-background.ui',
'label-wrap-justify.ui',
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/11773
'glarea-gl-only.ui',
]
flaky = [