tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

brush_solid.glsl (1368B)


      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/. */
      4 
      5 #define VECS_PER_SPECIFIC_BRUSH 1
      6 
      7 #include shared,prim_shared,brush
      8 
      9 flat varying mediump vec4 v_color;
     10 
     11 #ifdef WR_VERTEX_SHADER
     12 
     13 struct SolidBrush {
     14     vec4 color;
     15 };
     16 
     17 SolidBrush fetch_solid_primitive(int address) {
     18     vec4 data = fetch_from_gpu_buffer_1f(address);
     19     return SolidBrush(data);
     20 }
     21 
     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);
     35 
     36     float opacity = float(prim_user_data.x) / 65535.0;
     37     v_color = prim.color * opacity;
     38 }
     39 #endif
     40 
     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);
     48 }
     49 
     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);
     53 }
     54 
     55 void swgl_drawSpanR8() {
     56     swgl_commitSolidR8(v_color.x);
     57 }
     58 #endif
     59 
     60 #endif