Merge branch 'wip/otte/for-main' into 'main'
wayland: Create EGL window in make_current() if necessary Closes #6930 See merge request GNOME/gtk!7633
This commit is contained in:
@@ -1160,6 +1160,8 @@ gdk_surface_get_egl_surface (GdkSurface *self)
|
||||
{
|
||||
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
|
||||
|
||||
gdk_surface_ensure_egl_surface (self, priv->egl_surface_depth);
|
||||
|
||||
return priv->egl_surface;
|
||||
}
|
||||
|
||||
@@ -1172,6 +1174,14 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
|
||||
|
||||
g_return_val_if_fail (priv->egl_native_window != NULL, depth);
|
||||
|
||||
if (depth == GDK_MEMORY_NONE)
|
||||
{
|
||||
if (priv->egl_surface_depth == GDK_MEMORY_NONE)
|
||||
depth = GDK_MEMORY_U8;
|
||||
else
|
||||
depth = priv->egl_surface_depth;
|
||||
}
|
||||
|
||||
if (priv->egl_surface_depth != depth &&
|
||||
priv->egl_surface != NULL &&
|
||||
gdk_display_get_egl_config (display, priv->egl_surface_depth) != gdk_display_get_egl_config (display, depth))
|
||||
|
||||
@@ -46,16 +46,14 @@
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandGLContext, gdk_wayland_gl_context, GDK_TYPE_GL_CONTEXT)
|
||||
|
||||
static void
|
||||
gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
|
||||
GdkMemoryDepth depth,
|
||||
cairo_region_t *region,
|
||||
GdkColorState **out_color_state,
|
||||
GdkMemoryDepth *out_depth)
|
||||
static gboolean
|
||||
gdk_wayland_gl_context_make_current (GdkGLContext *context,
|
||||
gboolean surfaceless)
|
||||
{
|
||||
gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context));
|
||||
if (!surfaceless)
|
||||
gdk_wayland_surface_ensure_wl_egl_window (gdk_gl_context_get_surface (context));
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, depth, region, out_color_state, out_depth);
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->make_current (context, surfaceless);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -97,13 +95,13 @@ static void
|
||||
gdk_wayland_gl_context_class_init (GdkWaylandGLContextClass *klass)
|
||||
{
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
GdkGLContextClass *context_class = GDK_GL_CONTEXT_CLASS (klass);
|
||||
GdkGLContextClass *gl_context_class = GDK_GL_CONTEXT_CLASS (klass);
|
||||
|
||||
draw_context_class->begin_frame = gdk_wayland_gl_context_begin_frame;
|
||||
draw_context_class->end_frame = gdk_wayland_gl_context_end_frame;
|
||||
draw_context_class->empty_frame = gdk_wayland_gl_context_empty_frame;
|
||||
|
||||
context_class->backend_type = GDK_GL_EGL;
|
||||
gl_context_class->make_current = gdk_wayland_gl_context_make_current;
|
||||
gl_context_class->backend_type = GDK_GL_EGL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1842,14 +1842,14 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
|
||||
state = g_new0 (GskGLTextureState, 1);
|
||||
state->texture_id = texture_id;
|
||||
state->context = g_object_ref (self->command_queue->context);
|
||||
if (gdk_gl_context_has_feature (self->command_queue->context, GDK_GL_FEATURE_SYNC))
|
||||
state->context = g_object_ref (self->shared_command_queue->context);
|
||||
if (gdk_gl_context_has_feature (self->shared_command_queue->context, GDK_GL_FEATURE_SYNC))
|
||||
state->sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
g_hash_table_steal (self->textures, GUINT_TO_POINTER (texture_id));
|
||||
|
||||
builder = gdk_gl_texture_builder_new ();
|
||||
gdk_gl_texture_builder_set_context (builder, self->command_queue->context);
|
||||
gdk_gl_texture_builder_set_context (builder, self->shared_command_queue->context);
|
||||
gdk_gl_texture_builder_set_id (builder, texture_id);
|
||||
gdk_gl_texture_builder_set_format (builder, format);
|
||||
gdk_gl_texture_builder_set_width (builder, texture->width);
|
||||
|
||||
@@ -53,7 +53,6 @@ static const GskGpuShaderOpClass GSK_GPU_CROSS_FADE_OP_CLASS = {
|
||||
void
|
||||
gsk_gpu_cross_fade_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuColorStates color_states,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
float opacity,
|
||||
@@ -65,7 +64,7 @@ gsk_gpu_cross_fade_op (GskGpuFrame *frame,
|
||||
|
||||
gsk_gpu_shader_op_alloc (frame,
|
||||
&GSK_GPU_CROSS_FADE_OP_CLASS,
|
||||
color_states,
|
||||
gsk_gpu_color_states_create_equal (TRUE, TRUE),
|
||||
0,
|
||||
clip,
|
||||
(GskGpuImage *[2]) { start->image, end->image },
|
||||
|
||||
@@ -8,7 +8,6 @@ G_BEGIN_DECLS
|
||||
|
||||
void gsk_gpu_cross_fade_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuColorStates color_states,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
float opacity,
|
||||
|
||||
@@ -265,15 +265,6 @@ gsk_gpu_node_processor_color_states_explicit (GskGpuNodeProcessor *self,
|
||||
alt_premultiplied);
|
||||
}
|
||||
|
||||
static inline GskGpuColorStates
|
||||
gsk_gpu_node_processor_color_states_for_rgba (GskGpuNodeProcessor *self)
|
||||
{
|
||||
return gsk_gpu_color_states_create (self->ccs,
|
||||
TRUE,
|
||||
GDK_COLOR_STATE_SRGB,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
rect_round_to_pixels (const graphene_rect_t *src,
|
||||
const graphene_vec2_t *pixel_scale,
|
||||
@@ -2845,7 +2836,6 @@ gsk_gpu_node_processor_add_cross_fade_node (GskGpuNodeProcessor *self,
|
||||
|
||||
gsk_gpu_cross_fade_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
|
||||
gsk_gpu_node_processor_color_states_for_rgba (self),
|
||||
&node->bounds,
|
||||
&self->offset,
|
||||
self->opacity,
|
||||
|
||||
Reference in New Issue
Block a user