Bug 1857841 - pt 3. Add a new page kind named "fresh" r=glandium
[gecko.git] / gfx / wr / webrender / res / brush_solid.glsl
blobd1028179c46bc15e2f33c495cfeff9d00cc1b4b2
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #define VECS_PER_SPECIFIC_BRUSH 1
7 #include shared,prim_shared,brush
9 flat varying mediump vec4 v_color;
11 #ifdef WR_VERTEX_SHADER
13 struct SolidBrush {
14     vec4 color;
17 SolidBrush fetch_solid_primitive(int address) {
18     vec4 data = fetch_from_gpu_cache_1(address);
19     return SolidBrush(data);
22 void brush_vs(
23     VertexInfo vi,
24     int prim_address,
25     RectWithEndpoint local_rect,
26     RectWithEndpoint segment_rect,
27     ivec4 prim_user_data,
28     int specific_resource_address,
29     mat4 transform,
30     PictureTask pic_task,
31     int brush_flags,
32     vec4 unused
33 ) {
34     SolidBrush prim = fetch_solid_primitive(prim_address);
36     float opacity = float(prim_user_data.x) / 65535.0;
37     v_color = prim.color * opacity;
39 #endif
41 #ifdef WR_FRAGMENT_SHADER
42 Fragment brush_fs() {
43     vec4 color = v_color;
44 #ifdef WR_FEATURE_ALPHA_PASS
45     color *= antialias_brush();
46 #endif
47     return Fragment(color);
50 #if defined(SWGL_DRAW_SPAN) && (!defined(WR_FEATURE_ALPHA_PASS) || !defined(WR_FEATURE_DUAL_SOURCE_BLENDING))
51 void swgl_drawSpanRGBA8() {
52     swgl_commitSolidRGBA8(v_color);
55 void swgl_drawSpanR8() {
56     swgl_commitSolidR8(v_color.x);
58 #endif
60 #endif