Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias Clasen
805f3bb123 vulkan: Give up on VkResult
This enumeration is not managed in a sane way.
Just report the numbers.
2020-12-28 19:04:35 -05:00
22 changed files with 58 additions and 205 deletions

View File

@@ -787,8 +787,6 @@ gtk_gears_realize (GtkWidget *widget)
glLinkProgram(program);
glGetProgramInfoLog(program, sizeof msg, NULL, msg);
g_debug ("program info: %s\n", msg);
glDetachShader (program, v);
glDetachShader (program, f);
glDeleteShader (v);
glDeleteShader (f);

View File

@@ -12,7 +12,7 @@
GType
@enum_name@_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{

View File

@@ -210,7 +210,7 @@ gdk_event_init (GdkEvent *self)
GType
gdk_event_get_type (void)
{
static gsize event_type__volatile;
static volatile gsize event_type__volatile;
if (g_once_init_enter (&event_type__volatile))
{
@@ -374,7 +374,7 @@ static GType gdk_event_types[GDK_EVENT_LAST];
GType \
type_name ## _get_type (void) \
{ \
static gsize gdk_define_event_type_id__volatile; \
static volatile gsize gdk_define_event_type_id__volatile; \
if (g_once_init_enter (&gdk_define_event_type_id__volatile)) \
{ \
GType gdk_define_event_type_id = \
@@ -452,7 +452,7 @@ gdk_event_init_types_once (void)
void
gdk_event_init_types (void)
{
static gsize event_types__volatile;
static volatile gsize event_types__volatile;
if (g_once_init_enter (&event_types__volatile))
{

View File

@@ -107,9 +107,6 @@ make_program (GdkGLContextProgram *program,
glLinkProgram (program->program);
glDetachShader (program->program, vertex_shader);
glDetachShader (program->program, fragment_shader);
glDeleteShader (vertex_shader);
glDeleteShader (fragment_shader);

View File

@@ -95,143 +95,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkVulkanContext, gdk_vulkan_context, GDK_TYPE
const char *
gdk_vulkan_strerror (VkResult result)
{
/* If your compiler brought you here with a warning about missing
* enumeration values, you're running a newer Vulkan version than
* the GTK developers (or you are a GTK developer) and have
* encountered a newly added Vulkan error message.
* You want to add it to this enum now.
*
* Because the Vulkan people don't make adding this too easy, here's
* the process to manage it:
* 1. go to
* https://github.com/KhronosGroup/Vulkan-Headers/blob/master/include/vulkan/vulkan_core.h
* 2. Find the line where this enum value was added.
* 3. Click the commit that added this line.
* 4. The commit you're looking at now should also change
* VK_HEADER_VERSION, find that number.
* 5. Use that number in the #ifdef when adding the enum value to
* this enum.
* 6. For the error message, look at the specification (the one
* that includes all extensions) at
* https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkResult
* 7. If this value has not been added to the specification yet,
* search for the error message in the text of specification.
* Often it will have a description that can be used as an error
* message.
* 8. If that didn't lead to one (or you are lazy), just use the
* literal string of the enum value as the error message. A
* GTK developer will add the correct one once it's added to the
* specification.
*/
switch (result)
{
case VK_SUCCESS:
return "Command successfully completed.";
case VK_NOT_READY:
return "A fence or query has not yet completed.";
case VK_TIMEOUT:
return "A wait operation has not completed in the specified time.";
case VK_EVENT_SET:
return "An event is signaled.";
case VK_EVENT_RESET:
return "An event is unsignaled.";
case VK_INCOMPLETE:
return "A return array was too small for the result.";
case VK_SUBOPTIMAL_KHR:
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully.";
case VK_ERROR_OUT_OF_HOST_MEMORY:
return "A host memory allocation has failed.";
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
return "A device memory allocation has failed.";
case VK_ERROR_INITIALIZATION_FAILED:
return "Initialization of an object could not be completed for implementation-specific reasons.";
case VK_ERROR_DEVICE_LOST:
return "The logical or physical device has been lost.";
case VK_ERROR_MEMORY_MAP_FAILED:
return "Mapping of a memory object has failed.";
case VK_ERROR_LAYER_NOT_PRESENT:
return "A requested layer is not present or could not be loaded.";
case VK_ERROR_EXTENSION_NOT_PRESENT:
return "A requested extension is not supported.";
case VK_ERROR_FEATURE_NOT_PRESENT:
return "A requested feature is not supported.";
case VK_ERROR_INCOMPATIBLE_DRIVER:
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons.";
case VK_ERROR_TOO_MANY_OBJECTS:
return "Too many objects of the type have already been created.";
case VK_ERROR_FORMAT_NOT_SUPPORTED:
return "A requested format is not supported on this device.";
#if VK_HEADER_VERSION >= 24
case VK_ERROR_FRAGMENTED_POOL:
return "A requested pool allocation has failed due to fragmentation of the pools memory.";
#endif
case VK_ERROR_SURFACE_LOST_KHR:
return "A surface is no longer available.";
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
return "The requested window is already in use by Vulkan or another API in a manner which prevents it from being used again.";
case VK_ERROR_OUT_OF_DATE_KHR:
return "A surface has changed in such a way that it is no longer compatible with the swapchain.";
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image.";
case VK_ERROR_VALIDATION_FAILED_EXT:
return "The application caused the validation layer to fail.";
case VK_ERROR_INVALID_SHADER_NV:
return "One or more shaders failed to compile or link.";
#if VK_HEADER_VERSION >= 39
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
return "A pool memory allocation has failed.";
#endif
#if VK_HEADER_VERSION >= 54
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR:
return "An external handle is not a valid handle of the specified type.";
#endif
#if VK_HEADER_VERSION >= 64
case VK_ERROR_NOT_PERMITTED_EXT:
return "The caller does not have sufficient privileges.";
#endif
#if VK_HEADER_VERSION >= 72
case VK_ERROR_FRAGMENTATION_EXT:
return "A descriptor pool creation has failed due to fragmentation";
#endif
#if VK_HEADER_VERSION >= 89
case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT:
return "Invalid DRM format modifier plane layout";
#endif
#if VK_HEADER_VERSION >= 97
case VK_ERROR_INVALID_DEVICE_ADDRESS_EXT:
return "Invalid device address";
#endif
#if VK_HEADER_VERSION >= 105
case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exclusive full-screen access.";
#endif
#if VK_HEADER_VERSION >= 131
case VK_ERROR_UNKNOWN:
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
#endif
#if VK_HEADER_VERSION >= 135
#if VK_HEADER_VERSION < 162
case VK_ERROR_INCOMPATIBLE_VERSION_KHR:
return "This error was removed by the Vulkan gods.";
#endif
case VK_THREAD_IDLE_KHR:
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call.";
case VK_THREAD_DONE_KHR:
return "A deferred operation is not complete but there is no work remaining to assign to additional threads.";
case VK_OPERATION_DEFERRED_KHR:
return "A deferred operation was requested and at least some of the work was deferred.";
case VK_OPERATION_NOT_DEFERRED_KHR:
return "A deferred operation was requested and no operations were deferred.";
case VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT:
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed.";
#endif
#if VK_HEADER_VERSION < 140
case VK_RESULT_RANGE_SIZE:
#endif
case VK_RESULT_MAX_ENUM:
default:
return "Unknown Vulkan error.";
}
return "Unknown Vulkan error.";
}
static void
@@ -306,7 +170,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
if (res != VK_SUCCESS)
{
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
"Could not query surface capabilities: %s", gdk_vulkan_strerror (res));
"Could not query surface capabilities: %d", res);
return FALSE;
}
@@ -403,7 +267,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
else
{
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
"Could not create swapchain for this surface: %s", gdk_vulkan_strerror (res));
"Could not create swapchain for this surface: %d", res);
priv->swapchain = VK_NULL_HANDLE;
return FALSE;
}
@@ -579,7 +443,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
if (res != VK_SUCCESS)
{
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
"Could not create surface for this surface: %s", gdk_vulkan_strerror (res));
"Could not create surface for this surface: %d", res);
return FALSE;
}
@@ -590,7 +454,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
if (res != VK_SUCCESS)
{
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
"Could not check if queue family supports this surface: %s", gdk_vulkan_strerror (res));
"Could not check if queue family supports this surface: %d", res);
}
else if (!supported)
{
@@ -1118,7 +982,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
if (res != VK_SUCCESS)
{
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
"Could not create a Vulkan instance: %s", gdk_vulkan_strerror (res));
"Could not create a Vulkan instance: %d", res);
return FALSE;
}

View File

@@ -232,8 +232,6 @@ gsk_gl_shader_builder_create_program (GskGLShaderBuilder *self,
glBindAttribLocation (program_id, 0, "aPosition");
glBindAttribLocation (program_id, 1, "vUv");
glLinkProgram (program_id);
glDetachShader (program_id, vertex_id);
glDetachShader (program_id, fragment_id);
glGetProgramiv (program_id, GL_LINK_STATUS, &status);
if (status == GL_FALSE)
@@ -254,9 +252,14 @@ gsk_gl_shader_builder_create_program (GskGLShaderBuilder *self,
glDeleteProgram (program_id);
program_id = -1;
goto out;
}
glDetachShader (program_id, vertex_id);
glDeleteShader (vertex_id);
glDetachShader (program_id, fragment_id);
glDeleteShader (fragment_id);
out:

View File

@@ -22,7 +22,7 @@ static guint gsk_debug_flags;
static void
init_debug_flags (void)
{
static gsize gsk_debug_flags__set;
static volatile gsize gsk_debug_flags__set;
if (g_once_init_enter (&gsk_debug_flags__set))
{

View File

@@ -13,7 +13,7 @@
GType
@enum_name@_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{

View File

@@ -184,7 +184,7 @@ gsk_render_node_init (GskRenderNode *self)
GType
gsk_render_node_get_type (void)
{
static gsize render_node_type__volatile;
static volatile gsize render_node_type__volatile;
if (g_once_init_enter (&render_node_type__volatile))
{

View File

@@ -5649,7 +5649,7 @@ gsk_render_node_init_types_once (void)
void
gsk_render_node_init_types (void)
{
static gsize register_types__volatile;
static volatile gsize register_types__volatile;
if (g_once_init_enter (&register_types__volatile))
{

View File

@@ -13,7 +13,7 @@
GType
@enum_name@_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{

View File

@@ -249,7 +249,7 @@ struct _GtkExpressionWatch
GType \
type_name ## _get_type (void) \
{ \
static gsize gtk_define_expression_type_id__volatile; \
static volatile gsize gtk_define_expression_type_id__volatile; \
if (g_once_init_enter (&gtk_define_expression_type_id__volatile)) \
{ \
GType gtk_define_expression_type_id = \
@@ -490,7 +490,7 @@ param_expression_values_cmp (GParamSpec *pspec,
GType
gtk_param_expression_get_type (void)
{
static gsize param_expression_type__volatile;
static volatile gsize param_expression_type__volatile;
if (g_once_init_enter (&param_expression_type__volatile))
{
@@ -598,7 +598,7 @@ gtk_expression_init (GtkExpression *self)
GType
gtk_expression_get_type (void)
{
static gsize expression_type__volatile;
static volatile gsize expression_type__volatile;
if (g_once_init_enter (&expression_type__volatile))
{

View File

@@ -319,7 +319,6 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
widget = g_object_new (GTK_TYPE_MODEL_BUTTON,
"popover", submenu,
"indicator-size-group", box->indicators,
NULL);
g_object_bind_property (item, "label", widget, "text", G_BINDING_SYNC_CREATE);
g_object_bind_property (item, "icon", widget, "icon", G_BINDING_SYNC_CREATE);

View File

@@ -383,13 +383,11 @@ gtk_message_dialog_set_property (GObject *object,
if (txt)
{
priv->has_secondary_text = TRUE;
gtk_widget_add_css_class (priv->label, "title");
gtk_widget_show (priv->secondary_label);
}
else
{
priv->has_secondary_text = FALSE;
gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
}
@@ -623,7 +621,6 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
if (message_format)
{
priv->has_secondary_text = TRUE;
gtk_widget_add_css_class (priv->label, "title");
va_start (args, message_format);
msg = g_strdup_vprintf (message_format, args);
@@ -637,7 +634,6 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
else
{
priv->has_secondary_text = FALSE;
gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
}
@@ -681,7 +677,6 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
if (message_format)
{
priv->has_secondary_text = TRUE;
gtk_widget_add_css_class (priv->label, "title");
va_start (args, message_format);
msg = g_strdup_vprintf (message_format, args);
@@ -695,7 +690,6 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
else
{
priv->has_secondary_text = FALSE;
gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
}

View File

@@ -1713,7 +1713,7 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op,
GtkPrintOperationPrivate *priv;
IPrintDialogCallback *callback;
HPROPSHEETPAGE prop_page;
static gsize common_controls_initialized = 0;
static volatile gsize common_controls_initialized = 0;
if (g_once_init_enter (&common_controls_initialized))
{

View File

@@ -14,7 +14,7 @@
GType
_@enum_name@_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{

View File

@@ -25,7 +25,6 @@
#pragma once
#include <stdlib.h>
#include <glib.h>
/*
* Main functionality

View File

@@ -13,7 +13,7 @@
GType
@enum_name@_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{

View File

@@ -28,6 +28,9 @@
<property name="valign">start</property>
<property name="wrap">1</property>
<property name="max-width-chars">60</property>
<style>
<class name="title"/>
</style>
</object>
</child>
<child>

View File

@@ -217,7 +217,7 @@ gtk_ff_media_file_set_ffmpeg_error (GtkFfMediaFile *video,
return;
if (av_strerror (av_errnum, s, sizeof (s) != 0))
g_snprintf (s, sizeof (s), _("Unspecified error decoding video"));
snprintf (s, sizeof (s), _("Unspecified error decoding video"));
gtk_media_stream_error (GTK_MEDIA_STREAM (video),
G_IO_ERROR,

View File

@@ -787,8 +787,6 @@ gtk_gears_realize (GtkWidget *widget)
glLinkProgram(program);
glGetProgramInfoLog(program, sizeof msg, NULL, msg);
g_print ("program info: %s\n", msg);
glDetachShader (program, v);
glDetachShader (program, f);
glDeleteShader (v);
glDeleteShader (f);

View File

@@ -40,6 +40,7 @@ xfail = [
]
is_debug = get_option('buildtype').startswith('debug')
test_cargs = []
foreach flag: common_cflags
@@ -57,37 +58,34 @@ test_env.set('GIO_USE_VFS', 'local')
test_env.set('GSETTINGS_BACKEND', 'memory')
test_env.set('G_ENABLE_DIAGNOSTIC', '0')
# Visual Studio 2013 could not cope with '__value' for C sources
if cc.get_id() != 'msvc' or cc.version().version_compare('>=19')
foreach t : tests
test_name = t.get('name')
test_srcs = ['@0@.c'.format(test_name)] + t.get('sources', [])
test_extra_cargs = t.get('c_args', [])
test_extra_ldflags = t.get('link_args', [])
test_extra_suites = t.get('suites', [])
test_timeout = 60
foreach t : tests
test_name = t.get('name')
test_srcs = ['@0@.c'.format(test_name)] + t.get('sources', [])
test_extra_cargs = t.get('c_args', [])
test_extra_ldflags = t.get('link_args', [])
test_extra_suites = t.get('suites', [])
test_timeout = 60
test_exe = executable(test_name, test_srcs,
c_args: test_cargs + test_extra_cargs,
link_args: test_extra_ldflags,
dependencies: libgtk_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
test_exe = executable(test_name, test_srcs,
c_args: test_cargs + test_extra_cargs,
link_args: test_extra_ldflags,
dependencies: libgtk_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
expect_fail = xfail.contains(test_name)
expect_fail = xfail.contains(test_name)
if test_extra_suites.contains('slow')
test_timeout = 90
endif
if test_extra_suites.contains('slow')
test_timeout = 90
endif
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
timeout: test_timeout,
env: test_env,
suite: ['a11y'] + test_extra_suites,
should_fail: expect_fail,
)
endforeach
endif
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
timeout: test_timeout,
env: test_env,
suite: ['a11y'] + test_extra_suites,
should_fail: expect_fail,
)
endforeach