mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
This updates webrender to include the webgl related changes needed for this patch. There was an additional commit in webrender before these landed, so also copy the shaders for that change across. There is an interface change to webrender push_image. For now, just pass zero, which is a no-op to this function. A follow up commit will introduce the servo specific changes to use this new interface.
38 lines
1.2 KiB
GLSL
38 lines
1.2 KiB
GLSL
#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) {
|
|
Image image = fetch_image(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_and_tile_spacing.xy;
|
|
#else
|
|
VertexInfo vi = write_vertex(image.info);
|
|
vStretchSize = image.stretch_size_and_tile_spacing.xy;
|
|
vLocalPos = vi.local_clamped_pos - vi.local_rect.p0;
|
|
#endif
|
|
|
|
// vUv will contain how many times this image has wrapped around the image size.
|
|
vec2 st0 = image.st_rect.xy;
|
|
vec2 st1 = image.st_rect.zw;
|
|
|
|
switch (uint(image.uvkind.x)) {
|
|
case UV_NORMALIZED:
|
|
break;
|
|
case UV_PIXEL: {
|
|
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
|
|
st0 /= texture_size;
|
|
st1 /= texture_size;
|
|
}
|
|
break;
|
|
}
|
|
|
|
vTextureSize = st1 - st0;
|
|
vTextureOffset = st0;
|
|
vTileSpacing = image.stretch_size_and_tile_spacing.zw;
|
|
}
|