tor-browser

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

ps_copy.glsl (958B)


      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 #include base
      6 
      7 #ifdef WR_VERTEX_SHADER
      8 
      9 attribute vec2 aPosition;
     10 
     11 // See CopyInstance struct.
     12 attribute vec4 a_src_rect;
     13 attribute vec4 a_dst_rect;
     14 attribute vec2 a_dst_texture_size;
     15 
     16 varying highp vec2 v_uv;
     17 
     18 void main(void) {
     19     // We use texel fetch so v_uv is in unnormalized device space.
     20     v_uv = mix(a_src_rect.xy, a_src_rect.zw, aPosition.xy);
     21 
     22     // Transform into framebuffer [-1, 1] space.
     23     vec2 pos = mix(a_dst_rect.xy, a_dst_rect.zw, aPosition.xy);
     24     gl_Position = vec4(pos / (a_dst_texture_size  * 0.5) - vec2(1.0, 1.0), 0.0, 1.0);
     25 }
     26 #endif
     27 
     28 #ifdef WR_FRAGMENT_SHADER
     29 
     30 
     31 out vec4 oFragColor;
     32 
     33 varying highp vec2 v_uv;
     34 
     35 uniform sampler2D sColor0;
     36 
     37 void main(void) {
     38     oFragColor = texelFetch(sColor0, ivec2(v_uv), 0);
     39 }
     40 
     41 #endif