Source code

Revision control

Copy as Markdown

Other Tools

/* 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 gpu_buffer↩
#define SEGMENT_TOP_LEFT 0↩
#define SEGMENT_TOP_RIGHT 1↩
#define SEGMENT_BOTTOM_RIGHT 2↩
#define SEGMENT_BOTTOM_LEFT 3↩
#define SEGMENT_LEFT 4↩
#define SEGMENT_TOP 5↩
#define SEGMENT_RIGHT 6↩
#define SEGMENT_BOTTOM 7↩
#ifdef WR_VERTEX_SHADER↩
PER_INSTANCE in vec2 aTaskOrigin;↩
PER_INSTANCE in int aFlags;↩
PER_INSTANCE in int aGpuDataAddress;↩
PER_INSTANCE in vec4 aClipParams1;↩
PER_INSTANCE in vec4 aClipParams2;↩
#endif↩
struct BorderInstanceGpuData {↩
vec4 rect;↩
vec4 color0;↩
vec4 color1;↩
vec2 widths;↩
vec2 radii;↩
#ifdef WR_FEATURE_SUPERELLIPSE↩
float shape;↩
vec2 shape_offset;↩
vec2 inset;↩
#endif↩
};↩
BorderInstanceGpuData fetch_gpu_data(int index) {↩
BorderInstanceGpuData data;↩
#ifdef WR_FEATURE_SUPERELLIPSE↩
vec4 texels[6] = fetch_from_gpu_buffer_6f(index);↩
#else↩
vec4 texels[4] = fetch_from_gpu_buffer_4f(index);↩
#endif↩
data.rect = texels[0];↩
data.color0 = texels[1];↩
data.color1 = texels[2];↩
data.widths = texels[3].xy;↩
data.radii = texels[3].zw;↩
#ifdef WR_FEATURE_SUPERELLIPSE↩
data.shape = texels[4].x;↩
data.shape_offset = texels[4].yz;↩
data.inset = texels[5].xy;↩
#endif↩
return data;↩
}↩