mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
Merge branch 'wip/otte/for-main' into 'main'
gpu: Don't run long loops in shaders See merge request GNOME/gtk!7495
This commit is contained in:
commit
efc6d15dde
@ -1779,7 +1779,7 @@ static const GdkDrmFormatInfo supported_formats[] = {
|
||||
.download = NULL,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk = {
|
||||
.format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16,
|
||||
.format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16,
|
||||
.swizzle = VULKAN_DEFAULT_SWIZZLE,
|
||||
},
|
||||
#endif
|
||||
@ -1791,7 +1791,7 @@ static const GdkDrmFormatInfo supported_formats[] = {
|
||||
.download = download_p010,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk = {
|
||||
.format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16,
|
||||
.format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16,
|
||||
.swizzle = VULKAN_DEFAULT_SWIZZLE,
|
||||
},
|
||||
#endif
|
||||
@ -1803,7 +1803,7 @@ static const GdkDrmFormatInfo supported_formats[] = {
|
||||
.download = download_p010,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk = {
|
||||
.format = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16,
|
||||
.format = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16,
|
||||
.swizzle = VULKAN_DEFAULT_SWIZZLE,
|
||||
},
|
||||
#endif
|
||||
@ -1815,7 +1815,7 @@ static const GdkDrmFormatInfo supported_formats[] = {
|
||||
.download = download_p010,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk = {
|
||||
.format = VK_FORMAT_G16_B16R16_2PLANE_422_UNORM,
|
||||
.format = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM,
|
||||
.swizzle = VULKAN_DEFAULT_SWIZZLE,
|
||||
},
|
||||
#endif
|
||||
|
@ -534,7 +534,7 @@ gdk_registry_handle_global (void *data,
|
||||
&wp_presentation_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
else if (strcmp (interface, "xx_color_manager_v2") == 0)
|
||||
else if (strcmp (interface, "xx_color_manager_v4") == 0)
|
||||
{
|
||||
display_wayland->color = gdk_wayland_color_new (registry, id, version);
|
||||
}
|
||||
|
@ -643,7 +643,8 @@ gdk_wayland_color_get_image_description (GdkWaylandColor *color,
|
||||
for (int i = 0; i < color->image_descs->len; i++)
|
||||
{
|
||||
ImageDescEntry *e = &g_array_index (color->image_descs, ImageDescEntry, i);
|
||||
if (e->cp == normalized.color_primaries && e->tf == normalized.transfer_function)
|
||||
if (wl_to_cicp_primaries (e->cp) == normalized.color_primaries &&
|
||||
wl_to_cicp_transfer (e->tf) == normalized.transfer_function)
|
||||
return e->desc;
|
||||
}
|
||||
|
||||
|
@ -302,8 +302,9 @@ prepend_line_numbers (char *code)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gsk_gl_device_check_shader_error (int shader_id,
|
||||
GError **error)
|
||||
gsk_gl_device_check_shader_error (const char *name,
|
||||
int shader_id,
|
||||
GError **error)
|
||||
{
|
||||
GLint status;
|
||||
GLint log_len;
|
||||
@ -329,13 +330,14 @@ gsk_gl_device_check_shader_error (int shader_id,
|
||||
g_set_error (error,
|
||||
GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_COMPILATION_FAILED,
|
||||
"Compilation failure in shader.\n"
|
||||
"Compilation failure in shader %s.\n"
|
||||
"Source Code:\n"
|
||||
"%s\n"
|
||||
"\n"
|
||||
"Error Message:\n"
|
||||
"%s\n"
|
||||
"\n",
|
||||
name,
|
||||
code,
|
||||
log);
|
||||
|
||||
@ -454,7 +456,7 @@ gsk_gl_device_load_shader (GskGLDevice *self,
|
||||
|
||||
print_shader_info (shader_type == GL_FRAGMENT_SHADER ? "fragment" : "vertex", shader_id, program_name);
|
||||
|
||||
if (!gsk_gl_device_check_shader_error (shader_id, error))
|
||||
if (!gsk_gl_device_check_shader_error (program_name, shader_id, error))
|
||||
{
|
||||
glDeleteShader (shader_id);
|
||||
return 0;
|
||||
|
@ -35,6 +35,7 @@ uniform PushConstants
|
||||
|
||||
#ifdef GSK_TEXTURE0_IS_EXTERNAL
|
||||
uniform samplerExternalOES GSK_TEXTURE0;
|
||||
#define HAS_EXTERNAL_TEXTURES
|
||||
#else
|
||||
uniform sampler2D GSK_TEXTURE0;
|
||||
#endif
|
||||
@ -43,6 +44,9 @@ uniform sampler2D GSK_TEXTURE0;
|
||||
|
||||
#ifdef GSK_TEXTURE1_IS_EXTERNAL
|
||||
uniform samplerExternalOES GSK_TEXTURE1;
|
||||
#ifndef HAS_EXTERNAL_TEXTURES
|
||||
#define HAS_EXTERNAL_TEXTURES
|
||||
#endif
|
||||
#else
|
||||
uniform sampler2D GSK_TEXTURE1;
|
||||
#endif
|
||||
@ -50,6 +54,30 @@ uniform sampler2D GSK_TEXTURE1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAS_EXTERNAL_TEXTURES
|
||||
vec4
|
||||
gsk_texture_straight_alpha (samplerExternalOES tex,
|
||||
vec2 pos)
|
||||
{
|
||||
vec2 size = vec2 (textureSize (tex, 0));
|
||||
pos *= size;
|
||||
size -= vec2 (1.0);
|
||||
/* GL_CLAMP_TO_EDGE */
|
||||
pos = clamp (pos - 0.5, vec2 (0.0), size);
|
||||
ivec2 ipos = ivec2 (pos);
|
||||
pos = fract (pos);
|
||||
vec4 tl = texelFetch (tex, ipos, 0);
|
||||
tl.rgb *= tl.a;
|
||||
vec4 tr = texelFetch (tex, ipos + ivec2(1, 0), 0);
|
||||
tr.rgb *= tr.a;
|
||||
vec4 bl = texelFetch (tex, ipos + ivec2(0, 1), 0);
|
||||
bl.rgb *= bl.a;
|
||||
vec4 br = texelFetch (tex, ipos + ivec2(1, 1), 0);
|
||||
br.rgb *= br.a;
|
||||
return mix (mix (tl, tr, pos.x), mix (bl, br, pos.x), pos.y);
|
||||
}
|
||||
#endif
|
||||
|
||||
layout(location = 0) out vec4 out_color;
|
||||
void
|
||||
gsk_set_output_color (vec4 color)
|
||||
|
@ -7,9 +7,13 @@ void main_clip_rounded (void);
|
||||
|
||||
#include "enums.glsl"
|
||||
|
||||
/* Needs to be exactly like this and not use #else
|
||||
* because our include script is too dumb
|
||||
*/
|
||||
#ifdef VULKAN
|
||||
#include "common-vulkan.glsl"
|
||||
#else
|
||||
#endif /* VULKAN */
|
||||
#ifndef VULKAN
|
||||
#include "common-gl.glsl"
|
||||
#endif
|
||||
|
||||
|
@ -112,7 +112,7 @@ blur_corner (vec2 p,
|
||||
return 0.0;
|
||||
|
||||
float result = 0.0;
|
||||
float step = 1.0;
|
||||
float step = max (1.0, r.y / 8.0);
|
||||
for (float y = 0.5 * step; y <= r.y; y += step)
|
||||
{
|
||||
float x = r.x - ellipse_x (r, r.y - y);
|
||||
|
@ -6,17 +6,37 @@ import os
|
||||
|
||||
loaded_files = []
|
||||
|
||||
check_defines = [ 'VULKAN' ]
|
||||
|
||||
def load (path):
|
||||
if (path in loaded_files):
|
||||
return
|
||||
|
||||
loaded_files.append (path)
|
||||
skipping = ''
|
||||
|
||||
with open(path) as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
if skipping:
|
||||
match = re.search (r"^#endif /\* (.*) \*/$", line)
|
||||
if match and match.group(1) == skipping:
|
||||
skipping = ''
|
||||
continue
|
||||
|
||||
match = re.search (r"^#define (.*)$", line)
|
||||
if match and match.group(1) in check_defines:
|
||||
check_defines.remove (match.group(1))
|
||||
print (line, end="")
|
||||
continue
|
||||
|
||||
match = re.search (r"^#ifdef (.*)$", line)
|
||||
if match and match.group(1) in check_defines:
|
||||
skipping = match.group(1)
|
||||
continue
|
||||
|
||||
match = re.search (r"^#include \"(.*)\"$", line)
|
||||
if (match):
|
||||
if match:
|
||||
load (os.path.join (os.path.dirname(path), match.group(1)))
|
||||
else:
|
||||
print (line, end="")
|
||||
|
@ -179,7 +179,10 @@ gtk_gst_color_state_from_colorimetry (GtkGstSink *self,
|
||||
gdk_cicp_params_set_transfer_function (params, gst_video_transfer_function_to_iso (colorimetry->transfer));
|
||||
#if 0
|
||||
gdk_cicp_params_set_matrix_coefficients (params, gst_video_color_matrix_to_iso (colorimetry->matrix));
|
||||
gdk_cicp_params_set_full_range (params, colorimetry->range == GST_VIDEO_COLOR_RANGE_0_255);
|
||||
gdk_cicp_params_set_range (params, colorimetry->range == GST_VIDEO_COLOR_RANGE_0_255 ? GDK_CICP_RANGE_FULL : GDK_CICP_RANGE_NARROW);
|
||||
#else
|
||||
gdk_cicp_params_set_matrix_coefficients (params, 0);
|
||||
gdk_cicp_params_set_range (params, GDK_CICP_RANGE_FULL);
|
||||
#endif
|
||||
color_state = gdk_cicp_params_build_color_state (params, &error);
|
||||
g_object_unref (params);
|
||||
|
Loading…
Reference in New Issue
Block a user