mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
gpu: Remove straightalpha shader
As the new convert shader can do everything this shader could, use it instead.
This commit is contained in:
parent
a78796f22c
commit
eccdb594eb
@ -15,6 +15,7 @@
|
||||
#include "gskgpucolormatrixopprivate.h"
|
||||
#include "gskgpucoloropprivate.h"
|
||||
#include "gskgpuconicgradientopprivate.h"
|
||||
#include "gskgpuconvertopprivate.h"
|
||||
#include "gskgpucrossfadeopprivate.h"
|
||||
#include "gskgpudescriptorsprivate.h"
|
||||
#include "gskgpudeviceprivate.h"
|
||||
@ -28,7 +29,6 @@
|
||||
#include "gskgpurenderpassopprivate.h"
|
||||
#include "gskgpuroundedcoloropprivate.h"
|
||||
#include "gskgpuscissoropprivate.h"
|
||||
#include "gskgpustraightalphaopprivate.h"
|
||||
#include "gskgputextureopprivate.h"
|
||||
#include "gskgpuuploadopprivate.h"
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include "gsktransformprivate.h"
|
||||
#include "gskprivate.h"
|
||||
|
||||
#include "gdk/gdkcolorstateprivate.h"
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
#include "gdk/gdksubsurfaceprivate.h"
|
||||
|
||||
@ -557,14 +558,18 @@ gsk_gpu_node_processor_image_op (GskGpuNodeProcessor *self,
|
||||
|
||||
if (gsk_gpu_image_get_flags (image) & GSK_GPU_IMAGE_STRAIGHT_ALPHA)
|
||||
{
|
||||
gsk_gpu_straight_alpha_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, rect),
|
||||
self->opacity,
|
||||
self->desc,
|
||||
descriptor,
|
||||
rect,
|
||||
&self->offset,
|
||||
tex_rect);
|
||||
gsk_gpu_convert_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, rect),
|
||||
GDK_COLOR_STATE_SRGB,
|
||||
FALSE,
|
||||
GDK_COLOR_STATE_SRGB,
|
||||
TRUE,
|
||||
self->opacity,
|
||||
self->desc,
|
||||
descriptor,
|
||||
rect,
|
||||
&self->offset,
|
||||
tex_rect);
|
||||
}
|
||||
else if (self->opacity < 1.0)
|
||||
{
|
||||
|
@ -1,77 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskgpustraightalphaopprivate.h"
|
||||
|
||||
#include "gskgpuframeprivate.h"
|
||||
#include "gskgpuprintprivate.h"
|
||||
#include "gskrectprivate.h"
|
||||
|
||||
#include "gpu/shaders/gskgpustraightalphainstance.h"
|
||||
|
||||
#define VARIATION_OPACITY (1 << 0)
|
||||
#define VARIATION_STRAIGHT_ALPHA (1 << 1)
|
||||
|
||||
typedef struct _GskGpuStraightAlphaOp GskGpuStraightAlphaOp;
|
||||
|
||||
struct _GskGpuStraightAlphaOp
|
||||
{
|
||||
GskGpuShaderOp op;
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_gpu_straight_alpha_op_print_instance (GskGpuShaderOp *shader,
|
||||
gpointer instance_,
|
||||
GString *string)
|
||||
{
|
||||
GskGpuStraightalphaInstance *instance = (GskGpuStraightalphaInstance *) instance_;
|
||||
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
}
|
||||
|
||||
static const GskGpuShaderOpClass GSK_GPU_STRAIGHT_ALPHA_OP_CLASS = {
|
||||
{
|
||||
GSK_GPU_OP_SIZE (GskGpuStraightAlphaOp),
|
||||
GSK_GPU_STAGE_SHADER,
|
||||
gsk_gpu_shader_op_finish,
|
||||
gsk_gpu_shader_op_print,
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
gsk_gpu_shader_op_vk_command,
|
||||
#endif
|
||||
gsk_gpu_shader_op_gl_command
|
||||
},
|
||||
"gskgpustraightalpha",
|
||||
sizeof (GskGpuStraightalphaInstance),
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
&gsk_gpu_straightalpha_info,
|
||||
#endif
|
||||
gsk_gpu_straight_alpha_op_print_instance,
|
||||
gsk_gpu_straightalpha_setup_attrib_locations,
|
||||
gsk_gpu_straightalpha_setup_vao
|
||||
};
|
||||
|
||||
void
|
||||
gsk_gpu_straight_alpha_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
float opacity,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const graphene_rect_t *tex_rect)
|
||||
{
|
||||
GskGpuStraightalphaInstance *instance;
|
||||
|
||||
gsk_gpu_shader_op_alloc (frame,
|
||||
&GSK_GPU_STRAIGHT_ALPHA_OP_CLASS,
|
||||
(opacity < 1.0 ? VARIATION_OPACITY : 0) |
|
||||
VARIATION_STRAIGHT_ALPHA,
|
||||
clip,
|
||||
desc,
|
||||
&instance);
|
||||
|
||||
gsk_gpu_rect_to_float (rect, offset, instance->rect);
|
||||
gsk_gpu_rect_to_float (tex_rect, offset, instance->tex_rect);
|
||||
instance->tex_id = descriptor;
|
||||
instance->opacity = opacity;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "gskgpushaderopprivate.h"
|
||||
|
||||
#include <graphene.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gsk_gpu_straight_alpha_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
float opacity,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const graphene_rect_t *tex_rect);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -1,58 +0,0 @@
|
||||
#include "common.glsl"
|
||||
|
||||
#define VARIATION_OPACITY (1u << 0)
|
||||
#define VARIATION_STRAIGHT_ALPHA (1u << 1)
|
||||
|
||||
#define HAS_VARIATION(var) ((GSK_VARIATION & var) == var)
|
||||
|
||||
PASS(0) vec2 _pos;
|
||||
PASS_FLAT(1) Rect _rect;
|
||||
PASS(2) vec2 _tex_coord;
|
||||
PASS_FLAT(3) uint _tex_id;
|
||||
PASS_FLAT(4) float _opacity;
|
||||
|
||||
|
||||
#ifdef GSK_VERTEX_SHADER
|
||||
|
||||
IN(0) vec4 in_rect;
|
||||
IN(1) vec4 in_tex_rect;
|
||||
IN(2) uint in_tex_id;
|
||||
IN(3) float in_opacity;
|
||||
|
||||
void
|
||||
run (out vec2 pos)
|
||||
{
|
||||
Rect r = rect_from_gsk (in_rect);
|
||||
|
||||
pos = rect_get_position (r);
|
||||
|
||||
_pos = pos;
|
||||
_rect = r;
|
||||
_tex_coord = rect_get_coord (rect_from_gsk (in_tex_rect), pos);
|
||||
_tex_id = in_tex_id;
|
||||
_opacity = in_opacity;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef GSK_FRAGMENT_SHADER
|
||||
|
||||
void
|
||||
run (out vec4 color,
|
||||
out vec2 position)
|
||||
{
|
||||
float alpha = rect_coverage (_rect, _pos);
|
||||
if (HAS_VARIATION (VARIATION_OPACITY))
|
||||
alpha *= _opacity;
|
||||
|
||||
if (HAS_VARIATION (VARIATION_STRAIGHT_ALPHA))
|
||||
color = gsk_texture_straight_alpha (_tex_id, _tex_coord) * alpha;
|
||||
else
|
||||
color = gsk_texture (_tex_id, _tex_coord) * alpha;
|
||||
|
||||
position = _pos;
|
||||
}
|
||||
|
||||
#endif
|
@ -25,7 +25,6 @@ gsk_private_gpu_shaders = files([
|
||||
'gskgpumask.glsl',
|
||||
'gskgpuradialgradient.glsl',
|
||||
'gskgpuroundedcolor.glsl',
|
||||
'gskgpustraightalpha.glsl',
|
||||
'gskgputexture.glsl',
|
||||
])
|
||||
|
||||
|
@ -108,7 +108,6 @@ gsk_private_sources = files([
|
||||
'gpu/gskgpuroundedcolorop.c',
|
||||
'gpu/gskgpushaderop.c',
|
||||
'gpu/gskgpuscissorop.c',
|
||||
'gpu/gskgpustraightalphaop.c',
|
||||
'gpu/gskgputextureop.c',
|
||||
'gpu/gskgpuuploadop.c',
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user