gecko-dev/gfx/webrender/res/ps_rectangle.glsl
Kartikaya Gupta 0be4e0f156 Bug 1399630 - Update webrender to commit 878914aaf4d230fa449ff7800b529fe9023fc3c5. r=jrmuizel
MozReview-Commit-ID: IuNfqTZ57Tb

--HG--
extra : rebase_source : 68d6e941c164e08e0393b335414d6fb9ca65320e
2017-09-15 08:07:24 -04:00

55 lines
1.6 KiB
GLSL

/* 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/. */
#include shared,prim_shared
varying vec4 vColor;
#ifdef WR_FEATURE_TRANSFORM
varying vec3 vLocalPos;
#endif
#ifdef WR_VERTEX_SHADER
void main(void) {
Primitive prim = load_primitive();
Rectangle rect = fetch_rectangle(prim.specific_prim_address);
vColor = rect.color;
#ifdef WR_FEATURE_TRANSFORM
TransformVertexInfo vi = write_transform_vertex(prim.local_rect,
prim.local_clip_rect,
prim.z,
prim.layer,
prim.task,
prim.local_rect);
vLocalPos = vi.local_pos;
#else
VertexInfo vi = write_vertex(prim.local_rect,
prim.local_clip_rect,
prim.z,
prim.layer,
prim.task,
prim.local_rect);
#endif
#ifdef WR_FEATURE_CLIP
write_clip(vi.screen_pos, prim.clip_area);
#endif
}
#endif
#ifdef WR_FRAGMENT_SHADER
void main(void) {
float alpha = 1.0;
#ifdef WR_FEATURE_TRANSFORM
alpha = 0.0;
init_transform_fs(vLocalPos, alpha);
#endif
#ifdef WR_FEATURE_CLIP
alpha = min(alpha, do_clip());
#endif
oFragColor = vColor * vec4(1.0, 1.0, 1.0, alpha);
}
#endif