Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WR version, add latest shaders to resources. #13256

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -8,7 +8,12 @@ void main(void) {
#ifdef WR_FEATURE_TRANSFORM
float alpha = 0;
vec2 pos = init_transform_fs(vLocalPos, vLocalRect, alpha);
vec2 uv = (pos - vLocalRect.xy) / vStretchSize;

// We clamp the texture coordinate calculation here to the local rectangle boundaries,
// which makes the edge of the texture stretch instead of repeat.
vec2 uv = clamp(pos, vLocalRect.xy, vLocalRect.xy + vLocalRect.zw);

uv = (uv - vLocalRect.xy) / vStretchSize;
#else
vec2 uv = vUv;
#endif
@@ -1,9 +1,27 @@
#line 1

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

void main(void) {
float alpha = do_clip(vPos, vClipRect, vClipRadius);
vec2 st = vTextureOffset + vTextureSize * fract(vUv);
#ifdef WR_FEATURE_TRANSFORM
float alpha = 1;
vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha);

// We clamp the texture coordinate calculation here to the local rectangle boundaries,
// which makes the edge of the texture stretch instead of repeat.
vec2 uv = clamp(local_pos.xy, vLocalRect.xy, vLocalRect.xy + vLocalRect.zw);

uv = (uv - vLocalRect.xy) / vStretchSize;
#else
float alpha = 1;
vec2 local_pos = vLocalPos;
vec2 uv = vUv;
#endif

vec2 st = vTextureOffset + vTextureSize * fract(uv);

alpha = min(alpha, do_clip(local_pos, vClipRect, vClipRadius));
oFragColor = texture(sDiffuse, st) * vec4(1, 1, 1, alpha);
}
@@ -2,9 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

varying vec2 vUv; // Location within the CSS box to draw.
varying vec2 vPos;
flat varying vec2 vTextureOffset; // Offset of this image into the texture atlas.
flat varying vec2 vTextureSize; // Size of the image in the texture atlas.
flat varying vec4 vClipRect;
flat varying vec4 vClipRadius;

#ifdef WR_FEATURE_TRANSFORM
varying vec3 vLocalPos;
flat varying vec4 vLocalRect;
flat varying vec2 vStretchSize;
#else
varying vec2 vLocalPos;
varying vec2 vUv; // Location within the CSS box to draw.
#endif
@@ -5,17 +5,23 @@

void main(void) {
ImageClip image = fetch_image_clip(gl_InstanceID);

#ifdef WR_FEATURE_TRANSFORM
TransformVertexInfo vi = write_transform_vertex(image.info);
vLocalRect = vi.clipped_local_rect;
vLocalPos = vi.local_pos;
vStretchSize = image.stretch_size_uvkind.xy;
#else
VertexInfo vi = write_vertex(image.info);
vUv = (vi.local_clamped_pos - vi.local_rect.p0) / image.stretch_size_uvkind.xy;
vLocalPos = vi.local_clamped_pos;
#endif

vClipRect = vec4(image.clip.rect.xy, image.clip.rect.xy + image.clip.rect.zw);
vClipRadius = vec4(image.clip.top_left.outer_inner_radius.x,
image.clip.top_right.outer_inner_radius.x,
image.clip.bottom_right.outer_inner_radius.x,
image.clip.bottom_left.outer_inner_radius.x);
vPos = vi.local_clamped_pos;

// vUv will contain how many times this image has wrapped around the image size.
vUv = (vi.local_clamped_pos - image.info.local_rect.xy) / image.stretch_size_uvkind.xy;

vec2 st0 = image.st_rect.xy;
vec2 st1 = image.st_rect.zw;
@@ -3,6 +3,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

void main(void) {
float alpha = do_clip(vPos, vClipRect, vClipRadius);
#ifdef WR_FEATURE_TRANSFORM
float alpha = 1;
vec2 local_pos = init_transform_fs(vPos, vLocalRect, alpha);
#else
float alpha = 1;
vec2 local_pos = vPos;
#endif

alpha = min(alpha, do_clip(local_pos, vClipRect, vClipRadius));
oFragColor = vColor * vec4(1, 1, 1, alpha);
}
@@ -5,6 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

varying vec4 vColor;
varying vec2 vPos;
flat varying vec4 vClipRect;
flat varying vec4 vClipRadius;

#ifdef WR_FEATURE_TRANSFORM
varying vec3 vPos;
flat varying vec4 vLocalRect;
#else
varying vec2 vPos;
#endif
@@ -5,14 +5,21 @@

void main(void) {
RectangleClip rect = fetch_rectangle_clip(gl_InstanceID);

#ifdef WR_FEATURE_TRANSFORM
TransformVertexInfo vi = write_transform_vertex(rect.info);
vPos = vi.local_pos;
vLocalRect = vi.clipped_local_rect;
#else
VertexInfo vi = write_vertex(rect.info);
vPos = vi.local_clamped_pos;
#endif

vClipRect = vec4(rect.clip.rect.xy, rect.clip.rect.xy + rect.clip.rect.zw);
vClipRadius = vec4(rect.clip.top_left.outer_inner_radius.x,
rect.clip.top_right.outer_inner_radius.x,
rect.clip.bottom_right.outer_inner_radius.x,
rect.clip.bottom_left.outer_inner_radius.x);
vPos = vi.local_clamped_pos;

vColor = rect.color;
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.