summaryrefslogtreecommitdiff
path: root/gsk/resources/vulkan/clip.frag.glsl
blob: 472dc6f58c9ef3e3780cbedaf3aee427ba646dd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "constants.glsl"
#include "rounded-rect.glsl"

#ifndef _CLIP_
#define _CLIP_

#ifdef CLIP_ROUNDED_RECT
vec4 clip(vec2 pos, vec4 color)
{
  RoundedRect r = RoundedRect(vec4(push.clip_bounds.xy, push.clip_bounds.xy + push.clip_bounds.zw), push.clip_widths, push.clip_heights);

  return color * rounded_rect_coverage (r, pos);
}
#elif defined(CLIP_RECT)
vec4 clip(vec2 pos, vec4 color)
{
  /* clipped in vertex shader already */
  return color;
}
#elif defined(CLIP_NONE)
vec4 clip(vec2 pos, vec4 color)
{
  return color;
}
#else
#error "No clipping define given. Need CLIP_NONE, CLIP_RECT or CLIP_ROUNDED_RECT"
#endif

#endif