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/. */
6 #ifdef WR_VERTEX_SHADER
7 #define VECS_PER_RENDER_TASK 2U
9 uniform HIGHP_SAMPLER_FLOAT sampler2D sRenderTasks;
11 struct RenderTaskData {
12 RectWithEndpoint task_rect;
16 // See RenderTaskData in render_task.rs
17 RenderTaskData fetch_render_task_data(int index) {
18 ivec2 uv = get_fetch_uv(index, VECS_PER_RENDER_TASK);
20 vec4 texel0 = TEXEL_FETCH(sRenderTasks, uv, 0, ivec2(0, 0));
21 vec4 texel1 = TEXEL_FETCH(sRenderTasks, uv, 0, ivec2(1, 0));
23 RectWithEndpoint task_rect = RectWithEndpoint(
28 RenderTaskData data = RenderTaskData(
36 RectWithEndpoint fetch_render_task_rect(int index) {
37 ivec2 uv = get_fetch_uv(index, VECS_PER_RENDER_TASK);
39 vec4 texel0 = TEXEL_FETCH(sRenderTasks, uv, 0, ivec2(0, 0));
40 vec4 texel1 = TEXEL_FETCH(sRenderTasks, uv, 0, ivec2(1, 0));
42 RectWithEndpoint task_rect = RectWithEndpoint(
50 #define PIC_TYPE_IMAGE 1
51 #define PIC_TYPE_TEXT_SHADOW 2
54 The dynamic picture that this brush exists on. Right now, it
55 contains minimal information. In the future, it will describe
56 the transform mode of primitives on this picture, among other things.
59 RectWithEndpoint task_rect;
60 float device_pixel_scale;
64 PictureTask fetch_picture_task(int address) {
65 RenderTaskData task_data = fetch_render_task_data(address);
67 PictureTask task = PictureTask(
69 task_data.user_data.x,
70 task_data.user_data.yz
76 #define CLIP_TASK_EMPTY 0x7FFFFFFF
79 RectWithEndpoint task_rect;
80 float device_pixel_scale;
84 ClipArea fetch_clip_area(int index) {
85 RenderTaskData task_data;
86 if (index >= CLIP_TASK_EMPTY) {
87 // We deliberately create a dummy RenderTaskData here then convert to a
88 // ClipArea after this if-else statement, rather than initialize the
89 // ClipArea in separate branches, to avoid a miscompile in some Adreno
90 // drivers. See bug 1884791. Unfortunately the specific details of the bug
91 // are unknown, so please take extra care not to regress this when
93 task_data = RenderTaskData(RectWithEndpoint(vec2(0.0), vec2(0.0)),
96 task_data = fetch_render_task_data(index);
99 return ClipArea(task_data.task_rect, task_data.user_data.x,
100 task_data.user_data.yz);
103 #endif //WR_VERTEX_SHADER