зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1728064) for causing webrender bustages. CLOSED TREE
Backed out changeset 9c7077da42f2 (bug 1728064) Backed out changeset 4daf6a7a42f7 (bug 1728064)
This commit is contained in:
Родитель
dce6c97690
Коммит
c39298632e
|
@ -1848,7 +1848,6 @@ dependencies = [
|
|||
"env_logger",
|
||||
"font-loader",
|
||||
"gleam 0.13.1",
|
||||
"glsl",
|
||||
"glutin",
|
||||
"image",
|
||||
"log",
|
||||
|
|
|
@ -16,10 +16,9 @@ set -o xtrace
|
|||
CARGOFLAGS=${CARGOFLAGS:-""} # default to empty if not set
|
||||
|
||||
pushd wrench
|
||||
# Test that all shaders compile successfully and pass tests.
|
||||
# Test that all shaders compile successfully.
|
||||
python script/headless.py --precache test_init
|
||||
python script/headless.py --precache --use-unoptimized-shaders test_init
|
||||
python script/headless.py test_shaders
|
||||
|
||||
python script/headless.py reftest
|
||||
python script/headless.py rawtest
|
||||
|
|
|
@ -20,10 +20,9 @@ WRENCH_BINARY=${WRENCH_BINARY:-""}
|
|||
|
||||
pushd wrench
|
||||
|
||||
# Test that all shaders compile successfully and pass tests.
|
||||
# Test that all shaders compile successfully.
|
||||
python script/headless.py --precache test_init
|
||||
python script/headless.py --precache --use-unoptimized-shaders test_init
|
||||
python script/headless.py test_shaders
|
||||
|
||||
python script/headless.py reftest
|
||||
python script/headless.py test_invalidation
|
||||
|
|
|
@ -21,15 +21,12 @@ popd
|
|||
pushd wrench
|
||||
cargo test --verbose
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
|
||||
:: Test that all shaders compile successfully and pass tests.
|
||||
:: --precache compiles all shaders during initialization, therefore if init
|
||||
:: is successful then the shaders compile.
|
||||
:: Test that all shaders compile successfully. --precache compiles all shaders
|
||||
:: during initialization, therefore if init is successful then the shaders compile.
|
||||
cargo run --release -- --angle --precache test_init
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
|
||||
cargo run --release -- --angle --precache --use-unoptimized-shaders test_init
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
|
||||
cargo run --release -- --angle test_shaders
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
|
||||
|
||||
cargo run --release -- --angle reftest
|
||||
if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
|
||||
|
|
|
@ -16,17 +16,11 @@ flat varying vec4 v_uv_sample_bounds;
|
|||
|
||||
// x: Flag to allow perspective interpolation of UV.
|
||||
// y: Filter-dependent "amount" parameter.
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
// Please ensure that perspective remains packed in a vector. If refactoring,
|
||||
// see the v_perspective declaration in brush_image, and bug 1630356.
|
||||
flat varying vec2 v_perspective_amount;
|
||||
#define v_perspective v_perspective_amount.x
|
||||
#define v_amount v_perspective_amount.y
|
||||
|
||||
// x: Blend op, y: Lookup table GPU cache address.
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
flat varying ivec2 v_op_table_address_vec;
|
||||
#define v_op v_op_table_address_vec.x
|
||||
#define v_table_address v_op_table_address_vec.y
|
||||
|
||||
flat varying int v_op;
|
||||
flat varying int v_table_address;
|
||||
flat varying mat4 v_color_mat;
|
||||
flat varying ivec4 v_funcs;
|
||||
flat varying vec4 v_color_offset;
|
||||
|
@ -55,14 +49,14 @@ void brush_vs(
|
|||
float perspective_interpolate = (brush_flags & BRUSH_FLAG_PERSPECTIVE_INTERPOLATION) != 0 ? 1.0 : 0.0;
|
||||
|
||||
v_uv = uv * inv_texture_size * mix(vi.world_pos.w, 1.0, perspective_interpolate);
|
||||
v_perspective = perspective_interpolate;
|
||||
v_perspective_amount.x = perspective_interpolate;
|
||||
|
||||
v_uv_sample_bounds = vec4(uv0 + vec2(0.5), uv1 - vec2(0.5)) * inv_texture_size.xyxy;
|
||||
|
||||
float amount = float(prim_user_data.z) / 65536.0;
|
||||
|
||||
v_op = prim_user_data.y & 0xffff;
|
||||
v_amount = amount;
|
||||
v_perspective_amount.y = amount;
|
||||
|
||||
// This assignment is only used for component transfer filters but this
|
||||
// assignment has to be done here and not in the component transfer case
|
||||
|
@ -89,7 +83,7 @@ void brush_vs(
|
|||
|
||||
#ifdef WR_FRAGMENT_SHADER
|
||||
Fragment brush_fs() {
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, v_perspective);
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, v_perspective_amount.x);
|
||||
vec2 uv = v_uv * perspective_divisor;
|
||||
// Clamp the uvs to avoid sampling artifacts.
|
||||
uv = clamp(uv, v_uv_sample_bounds.xy, v_uv_sample_bounds.zw);
|
||||
|
@ -101,7 +95,7 @@ Fragment brush_fs() {
|
|||
CalculateFilter(
|
||||
Cs,
|
||||
v_op,
|
||||
v_amount,
|
||||
v_perspective_amount.y,
|
||||
v_table_address,
|
||||
v_color_offset,
|
||||
v_color_mat,
|
||||
|
|
|
@ -21,9 +21,19 @@ flat varying vec4 v_uv_bounds;
|
|||
// sampling artifacts.
|
||||
flat varying vec4 v_uv_sample_bounds;
|
||||
|
||||
#if defined(PLATFORM_ANDROID) && !defined(SWGL)
|
||||
// On Adreno 3xx devices we have observed that a flat scalar varying used to calculate
|
||||
// fragment shader output can result in the entire output being "flat". Here, for example,
|
||||
// v_perspective being flat results in the UV coordinate calculated for every fragment
|
||||
// being equal to the UV coordinate for the provoking vertex, which results in the entire
|
||||
// triangle being rendered a solid color.
|
||||
// Packing the varying in a vec2 works around this. See bug 1630356.
|
||||
flat varying vec2 v_perspective_vec;
|
||||
#define v_perspective v_perspective_vec.x
|
||||
#else
|
||||
// Flag to allow perspective interpolation of UV.
|
||||
// Packed in to vector to work around bug 1630356.
|
||||
flat varying vec2 v_perspective;
|
||||
flat varying float v_perspective;
|
||||
#endif
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
||||
|
@ -164,7 +174,7 @@ void brush_vs(
|
|||
}
|
||||
|
||||
float perspective_interpolate = (brush_flags & BRUSH_FLAG_PERSPECTIVE_INTERPOLATION) != 0 ? 1.0 : 0.0;
|
||||
v_perspective.x = perspective_interpolate;
|
||||
v_perspective = perspective_interpolate;
|
||||
|
||||
// Handle case where the UV coords are inverted (e.g. from an
|
||||
// external image).
|
||||
|
@ -313,7 +323,7 @@ vec2 compute_repeated_uvs(float perspective_divisor) {
|
|||
}
|
||||
|
||||
Fragment brush_fs() {
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, v_perspective.x);
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, v_perspective);
|
||||
vec2 repeated_uv = compute_repeated_uvs(perspective_divisor);
|
||||
|
||||
// Clamp the uvs to avoid sampling artifacts.
|
||||
|
@ -358,7 +368,7 @@ void swgl_drawSpanRGBA8() {
|
|||
}
|
||||
#endif
|
||||
|
||||
float perspective_divisor = mix(swgl_forceScalar(gl_FragCoord.w), 1.0, v_perspective.x);
|
||||
float perspective_divisor = mix(swgl_forceScalar(gl_FragCoord.w), 1.0, v_perspective);
|
||||
|
||||
#ifdef WR_FEATURE_REPETITION
|
||||
// Get the UVs before any repetition, scaling, or offsetting has occurred...
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
#include shared,prim_shared,brush,gradient_shared
|
||||
|
||||
// Start offset. Packed in to vector to work around bug 1630356.
|
||||
flat varying vec2 v_start_offset;
|
||||
|
||||
flat varying float v_start_offset;
|
||||
flat varying vec2 v_scale_dir;
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
@ -59,7 +57,7 @@ void brush_vs(
|
|||
|
||||
// Normalize UV and offsets to 0..1 scale.
|
||||
v_scale_dir = dir / dot(dir, dir);
|
||||
v_start_offset.x = dot(start_point, v_scale_dir);
|
||||
v_start_offset = dot(start_point, v_scale_dir);
|
||||
v_scale_dir *= v_repeated_size;
|
||||
}
|
||||
#endif
|
||||
|
@ -67,7 +65,7 @@ void brush_vs(
|
|||
#ifdef WR_FRAGMENT_SHADER
|
||||
float get_gradient_offset(vec2 pos) {
|
||||
// Project position onto a direction vector to compute offset.
|
||||
return dot(pos, v_scale_dir) - v_start_offset.x;
|
||||
return dot(pos, v_scale_dir) - v_start_offset;
|
||||
}
|
||||
|
||||
Fragment brush_fs() {
|
||||
|
@ -82,17 +80,17 @@ Fragment brush_fs() {
|
|||
|
||||
#ifdef SWGL_DRAW_SPAN
|
||||
void swgl_drawSpanRGBA8() {
|
||||
int address = swgl_validateGradient(sGpuCache, get_gpu_cache_uv(v_gradient_address.x), int(GRADIENT_ENTRIES + 2.0));
|
||||
int address = swgl_validateGradient(sGpuCache, get_gpu_cache_uv(v_gradient_address), int(GRADIENT_ENTRIES + 2.0));
|
||||
if (address < 0) {
|
||||
return;
|
||||
}
|
||||
#ifndef WR_FEATURE_ALPHA_PASS
|
||||
swgl_commitLinearGradientRGBA8(sGpuCache, address, GRADIENT_ENTRIES, v_gradient_repeat.x != 0.0,
|
||||
swgl_commitLinearGradientRGBA8(sGpuCache, address, GRADIENT_ENTRIES, v_gradient_repeat != 0.0,
|
||||
get_gradient_offset(v_pos));
|
||||
#else
|
||||
while (swgl_SpanLength > 0) {
|
||||
float offset = get_gradient_offset(compute_repeated_pos());
|
||||
if (v_gradient_repeat.x != 0.0) offset = fract(offset);
|
||||
if (v_gradient_repeat != 0.0) offset = fract(offset);
|
||||
float entry = clamp_gradient_entry(offset);
|
||||
swgl_commitGradientRGBA8(sGpuCache, address, entry);
|
||||
v_pos += swgl_interpStep(v_pos);
|
||||
|
|
|
@ -15,11 +15,19 @@ flat varying vec4 v_src_uv_sample_bounds;
|
|||
varying vec2 v_backdrop_uv;
|
||||
flat varying vec4 v_backdrop_uv_sample_bounds;
|
||||
|
||||
#if defined(PLATFORM_ANDROID) && !defined(SWGL)
|
||||
// Work around Adreno 3xx driver bug. See the v_perspective comment in
|
||||
// brush_image or bug 1630356 for details.
|
||||
flat varying vec2 v_perspective_vec;
|
||||
#define v_perspective v_perspective_vec.x
|
||||
flat varying ivec2 v_op_vec;
|
||||
#define v_op v_op_vec.x
|
||||
#else
|
||||
// Flag to allow perspective interpolation of UV.
|
||||
// Packed in to vector to work around bug 1630356.
|
||||
flat varying vec2 v_perspective;
|
||||
// mix-blend op. Packed in to vector to work around bug 1630356.
|
||||
flat varying ivec2 v_op;
|
||||
flat varying float v_perspective;
|
||||
// mix-blend op
|
||||
flat varying int v_op;
|
||||
#endif
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
||||
|
@ -58,8 +66,8 @@ void brush_vs(
|
|||
vec2 f = (vi.local_pos - local_rect.p0) / rect_size(local_rect);
|
||||
float perspective_interpolate = (brush_flags & BRUSH_FLAG_PERSPECTIVE_INTERPOLATION) != 0 ? 1.0 : 0.0;
|
||||
float perspective_f = mix(vi.world_pos.w, 1.0, perspective_interpolate);
|
||||
v_perspective.x = perspective_interpolate;
|
||||
v_op.x = prim_user_data.x;
|
||||
v_perspective = perspective_interpolate;
|
||||
v_op = prim_user_data.x;
|
||||
|
||||
get_uv(
|
||||
prim_user_data.y,
|
||||
|
@ -240,7 +248,7 @@ const int MixBlendMode_Color = 14;
|
|||
const int MixBlendMode_Luminosity = 15;
|
||||
|
||||
Fragment brush_fs() {
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, v_perspective.x);
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, v_perspective);
|
||||
|
||||
vec2 src_uv = v_src_uv * perspective_divisor;
|
||||
src_uv = clamp(src_uv, v_src_uv_sample_bounds.xy, v_src_uv_sample_bounds.zw);
|
||||
|
@ -269,7 +277,7 @@ Fragment brush_fs() {
|
|||
// gets optimized away by glslopt. Adding a bitwise AND prevents that.
|
||||
// See bug 1726755.
|
||||
// default: default: to appease angle_shader_validation
|
||||
switch (v_op.x & 0xFF) {
|
||||
switch (v_op & 0xFF) {
|
||||
case MixBlendMode_Multiply:
|
||||
result.rgb = Multiply(Cb.rgb, Cs.rgb);
|
||||
break;
|
||||
|
|
|
@ -14,10 +14,17 @@ varying vec2 v_uv;
|
|||
// sampling artifacts.
|
||||
flat varying vec4 v_uv_sample_bounds;
|
||||
|
||||
flat varying vec2 v_opacity_perspective_vec;
|
||||
#define v_opacity v_opacity_perspective_vec.x
|
||||
#if defined(PLATFORM_ANDROID) && !defined(SWGL)
|
||||
// Work around Adreno 3xx driver bug. See the v_perspective comment in
|
||||
// brush_image or bug 1630356 for details.
|
||||
flat varying vec2 v_perspective_vec;
|
||||
#define v_perspective v_perspective_vec.x
|
||||
#else
|
||||
// Flag to allow perspective interpolation of UV.
|
||||
#define v_perspective v_opacity_perspective_vec.y
|
||||
flat varying float v_perspective;
|
||||
#endif
|
||||
|
||||
flat varying float v_opacity;
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
void brush_vs(
|
||||
|
|
|
@ -17,9 +17,7 @@ flat varying vec4 vUvBounds_V;
|
|||
|
||||
YUV_PRECISION flat varying vec3 vYcbcrBias;
|
||||
YUV_PRECISION flat varying mat3 vRgbFromDebiasedYcbcr;
|
||||
|
||||
// YUV format. Packed in to vector to work around bug 1630356.
|
||||
flat varying ivec2 vFormat;
|
||||
flat varying int vFormat;
|
||||
|
||||
#ifdef SWGL_DRAW_SPAN
|
||||
flat varying int vRescaleFactor;
|
||||
|
@ -69,22 +67,22 @@ void brush_vs(
|
|||
vYcbcrBias = mat_info.ycbcr_bias;
|
||||
vRgbFromDebiasedYcbcr = mat_info.rgb_from_debiased_ycbrc;
|
||||
|
||||
vFormat.x = prim.yuv_format;
|
||||
vFormat = prim.yuv_format;
|
||||
|
||||
// The additional test for 99 works around a gen6 shader compiler bug: 1708937
|
||||
if (vFormat.x == YUV_FORMAT_PLANAR || vFormat.x == 99) {
|
||||
if (vFormat == YUV_FORMAT_PLANAR || vFormat == 99) {
|
||||
ImageSource res_y = fetch_image_source(prim_user_data.x);
|
||||
ImageSource res_u = fetch_image_source(prim_user_data.y);
|
||||
ImageSource res_v = fetch_image_source(prim_user_data.z);
|
||||
write_uv_rect(res_y.uv_rect.p0, res_y.uv_rect.p1, f, TEX_SIZE_YUV(sColor0), vUv_Y, vUvBounds_Y);
|
||||
write_uv_rect(res_u.uv_rect.p0, res_u.uv_rect.p1, f, TEX_SIZE_YUV(sColor1), vUv_U, vUvBounds_U);
|
||||
write_uv_rect(res_v.uv_rect.p0, res_v.uv_rect.p1, f, TEX_SIZE_YUV(sColor2), vUv_V, vUvBounds_V);
|
||||
} else if (vFormat.x == YUV_FORMAT_NV12) {
|
||||
} else if (vFormat == YUV_FORMAT_NV12) {
|
||||
ImageSource res_y = fetch_image_source(prim_user_data.x);
|
||||
ImageSource res_u = fetch_image_source(prim_user_data.y);
|
||||
write_uv_rect(res_y.uv_rect.p0, res_y.uv_rect.p1, f, TEX_SIZE_YUV(sColor0), vUv_Y, vUvBounds_Y);
|
||||
write_uv_rect(res_u.uv_rect.p0, res_u.uv_rect.p1, f, TEX_SIZE_YUV(sColor1), vUv_U, vUvBounds_U);
|
||||
} else if (vFormat.x == YUV_FORMAT_INTERLEAVED) {
|
||||
} else if (vFormat == YUV_FORMAT_INTERLEAVED) {
|
||||
ImageSource res_y = fetch_image_source(prim_user_data.x);
|
||||
write_uv_rect(res_y.uv_rect.p0, res_y.uv_rect.p1, f, TEX_SIZE_YUV(sColor0), vUv_Y, vUvBounds_Y);
|
||||
}
|
||||
|
@ -95,7 +93,7 @@ void brush_vs(
|
|||
|
||||
Fragment brush_fs() {
|
||||
vec4 color = sample_yuv(
|
||||
vFormat.x,
|
||||
vFormat,
|
||||
vYcbcrBias,
|
||||
vRgbFromDebiasedYcbcr,
|
||||
vUv_Y,
|
||||
|
@ -118,20 +116,20 @@ Fragment brush_fs() {
|
|||
|
||||
#ifdef SWGL_DRAW_SPAN
|
||||
void swgl_drawSpanRGBA8() {
|
||||
if (vFormat.x == YUV_FORMAT_PLANAR) {
|
||||
if (vFormat == YUV_FORMAT_PLANAR) {
|
||||
swgl_commitTextureLinearYUV(sColor0, vUv_Y, vUvBounds_Y,
|
||||
sColor1, vUv_U, vUvBounds_U,
|
||||
sColor2, vUv_V, vUvBounds_V,
|
||||
vYcbcrBias,
|
||||
vRgbFromDebiasedYcbcr,
|
||||
vRescaleFactor);
|
||||
} else if (vFormat.x == YUV_FORMAT_NV12) {
|
||||
} else if (vFormat == YUV_FORMAT_NV12) {
|
||||
swgl_commitTextureLinearYUV(sColor0, vUv_Y, vUvBounds_Y,
|
||||
sColor1, vUv_U, vUvBounds_U,
|
||||
vYcbcrBias,
|
||||
vRgbFromDebiasedYcbcr,
|
||||
vRescaleFactor);
|
||||
} else if (vFormat.x == YUV_FORMAT_INTERLEAVED) {
|
||||
} else if (vFormat == YUV_FORMAT_INTERLEAVED) {
|
||||
swgl_commitTextureLinearYUV(sColor0, vUv_Y, vUvBounds_Y,
|
||||
vYcbcrBias,
|
||||
vRgbFromDebiasedYcbcr,
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
#ifdef WR_FEATURE_YUV
|
||||
YUV_PRECISION flat varying vec3 vYcbcrBias;
|
||||
YUV_PRECISION flat varying mat3 vRgbFromDebiasedYcbcr;
|
||||
// YUV format. Packed in to vector to avoid bug 1630356.
|
||||
flat varying ivec2 vYuvFormat;
|
||||
flat varying int vYuvFormat;
|
||||
|
||||
#ifdef SWGL_DRAW_SPAN
|
||||
flat varying int vRescaleFactor;
|
||||
|
@ -106,7 +105,7 @@ void main(void) {
|
|||
vYcbcrBias = mat_info.ycbcr_bias;
|
||||
vRgbFromDebiasedYcbcr = mat_info.rgb_from_debiased_ycbrc;
|
||||
|
||||
vYuvFormat.x = prim.yuv_format;
|
||||
vYuvFormat = prim.yuv_format;
|
||||
|
||||
write_uv_rect(
|
||||
aUvRect0.xy,
|
||||
|
@ -170,7 +169,7 @@ void main(void) {
|
|||
void main(void) {
|
||||
#ifdef WR_FEATURE_YUV
|
||||
vec4 color = sample_yuv(
|
||||
vYuvFormat.x,
|
||||
vYuvFormat,
|
||||
vYcbcrBias,
|
||||
vRgbFromDebiasedYcbcr,
|
||||
vUV_y,
|
||||
|
@ -201,20 +200,20 @@ void main(void) {
|
|||
#ifdef SWGL_DRAW_SPAN
|
||||
void swgl_drawSpanRGBA8() {
|
||||
#ifdef WR_FEATURE_YUV
|
||||
if (vYuvFormat.x == YUV_FORMAT_PLANAR) {
|
||||
if (vYuvFormat == YUV_FORMAT_PLANAR) {
|
||||
swgl_commitTextureLinearYUV(sColor0, vUV_y, vUVBounds_y,
|
||||
sColor1, vUV_u, vUVBounds_u,
|
||||
sColor2, vUV_v, vUVBounds_v,
|
||||
vYcbcrBias,
|
||||
vRgbFromDebiasedYcbcr,
|
||||
vRescaleFactor);
|
||||
} else if (vYuvFormat.x == YUV_FORMAT_NV12) {
|
||||
} else if (vYuvFormat == YUV_FORMAT_NV12) {
|
||||
swgl_commitTextureLinearYUV(sColor0, vUV_y, vUVBounds_y,
|
||||
sColor1, vUV_u, vUVBounds_u,
|
||||
vYcbcrBias,
|
||||
vRgbFromDebiasedYcbcr,
|
||||
vRescaleFactor);
|
||||
} else if (vYuvFormat.x == YUV_FORMAT_INTERLEAVED) {
|
||||
} else if (vYuvFormat == YUV_FORMAT_INTERLEAVED) {
|
||||
swgl_commitTextureLinearYUV(sColor0, vUV_y, vUVBounds_y,
|
||||
vYcbcrBias,
|
||||
vRgbFromDebiasedYcbcr,
|
||||
|
|
|
@ -10,8 +10,7 @@ varying vec2 vUv;
|
|||
flat varying vec4 vUvRect;
|
||||
flat varying vec2 vOffsetScale;
|
||||
// The number of pixels on each end that we apply the blur filter over.
|
||||
// Packed in to vector to work around bug 1630356.
|
||||
flat varying ivec2 vSupport;
|
||||
flat varying int vSupport;
|
||||
flat varying vec2 vGaussCoefficients;
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
@ -54,7 +53,7 @@ void calculate_gauss_coefficients(float sigma) {
|
|||
vec3 gauss_coefficient = vec3(vGaussCoefficients,
|
||||
vGaussCoefficients.y * vGaussCoefficients.y);
|
||||
float gauss_coefficient_total = gauss_coefficient.x;
|
||||
for (int i = 1; i <= vSupport.x; i += 2) {
|
||||
for (int i = 1; i <= vSupport; i += 2) {
|
||||
gauss_coefficient.xy *= gauss_coefficient.yz;
|
||||
float gauss_coefficient_subtotal = gauss_coefficient.x;
|
||||
gauss_coefficient.xy *= gauss_coefficient.yz;
|
||||
|
@ -80,9 +79,9 @@ void main(void) {
|
|||
//
|
||||
// TODO(pcwalton): Actually make use of this fact and use the texture
|
||||
// hardware for linear filtering.
|
||||
vSupport.x = int(ceil(1.5 * blur_task.blur_radius)) * 2;
|
||||
vSupport = int(ceil(1.5 * blur_task.blur_radius)) * 2;
|
||||
|
||||
if (vSupport.x > 0) {
|
||||
if (vSupport > 0) {
|
||||
calculate_gauss_coefficients(blur_task.blur_radius);
|
||||
} else {
|
||||
// The gauss function gets NaNs when blur radius is zero.
|
||||
|
@ -159,7 +158,7 @@ void main(void) {
|
|||
// Clamp loop condition variable to a statically known value to workaround
|
||||
// driver bug on Adreno 3xx. vSupport should not exceed 300 anyway, due to
|
||||
// the max blur radius being 100. See bug 1720841 for details.
|
||||
int support = min(vSupport.x, 300);
|
||||
int support = min(vSupport, 300);
|
||||
for (int i = 1; i <= support; i += 2) {
|
||||
gauss_coefficient.xy *= gauss_coefficient.yz;
|
||||
|
||||
|
@ -183,12 +182,12 @@ void main(void) {
|
|||
#ifdef WR_FEATURE_COLOR_TARGET
|
||||
void swgl_drawSpanRGBA8() {
|
||||
swgl_commitGaussianBlurRGBA8(sColor0, vUv, vUvRect, vOffsetScale.x != 0.0,
|
||||
vSupport.x, vGaussCoefficients);
|
||||
vSupport, vGaussCoefficients);
|
||||
}
|
||||
#else
|
||||
void swgl_drawSpanR8() {
|
||||
swgl_commitGaussianBlurR8(sColor0, vUv, vUvRect, vOffsetScale.x != 0.0,
|
||||
vSupport.x, vGaussCoefficients);
|
||||
vSupport, vGaussCoefficients);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -17,9 +17,15 @@ flat varying vec4 vColor1;
|
|||
// transition occurs. Used for corners only.
|
||||
flat varying vec4 vColorLine;
|
||||
|
||||
#if defined(PLATFORM_ANDROID) && !defined(SWGL)
|
||||
// Work around Adreno 3xx driver bug. See the v_perspective comment in
|
||||
// brush_image or bug 1630356 for details.
|
||||
flat varying ivec2 vMixColorsVec;
|
||||
#define vMixColors vMixColorsVec.x
|
||||
#else
|
||||
// A boolean indicating that we should be mixing between edge colors.
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
flat varying ivec2 vMixColors;
|
||||
flat varying int vMixColors;
|
||||
#endif
|
||||
|
||||
// xy = Local space position of the clip center.
|
||||
// zw = Scale the rect origin by this to get the outer
|
||||
|
@ -104,7 +110,7 @@ void main(void) {
|
|||
break;
|
||||
}
|
||||
|
||||
vMixColors.x = mix_colors;
|
||||
vMixColors = mix_colors;
|
||||
vPos = size * aPosition.xy;
|
||||
|
||||
vColor0 = aColor0;
|
||||
|
@ -132,10 +138,10 @@ void main(void) {
|
|||
#ifdef WR_FRAGMENT_SHADER
|
||||
void main(void) {
|
||||
float aa_range = compute_aa_range(vPos);
|
||||
bool do_aa = vMixColors.x != MIX_NO_AA;
|
||||
bool do_aa = vMixColors != MIX_NO_AA;
|
||||
|
||||
float mix_factor = 0.0;
|
||||
if (vMixColors.x != DONT_MIX) {
|
||||
if (vMixColors != DONT_MIX) {
|
||||
float d_line = distance_to_line(vColorLine.xy, vColorLine.zw, vPos);
|
||||
if (do_aa) {
|
||||
mix_factor = distance_aa(aa_range, -d_line);
|
||||
|
|
|
@ -9,8 +9,14 @@ varying vec2 vUv;
|
|||
flat varying vec4 vUvBounds;
|
||||
flat varying vec4 vEdge;
|
||||
flat varying vec4 vUvBounds_NoClamp;
|
||||
// Clip mode. Packed in to a vector to avoid bug 1630356.
|
||||
flat varying vec2 vClipMode;
|
||||
#if defined(PLATFORM_ANDROID) && !defined(SWGL)
|
||||
// Work around Adreno 3xx driver bug. See the v_perspective comment in
|
||||
// brush_image or bug 1630356 for details.
|
||||
flat varying vec2 vClipModeVec;
|
||||
#define vClipMode vClipModeVec.x
|
||||
#else
|
||||
flat varying float vClipMode;
|
||||
#endif
|
||||
|
||||
#define MODE_STRETCH 0
|
||||
#define MODE_SIMPLE 1
|
||||
|
@ -74,7 +80,7 @@ void main(void) {
|
|||
cmi.base.screen_origin,
|
||||
cmi.base.device_pixel_scale
|
||||
);
|
||||
vClipMode.x = float(bs_data.clip_mode);
|
||||
vClipMode = float(bs_data.clip_mode);
|
||||
|
||||
vec2 texture_size = vec2(TEX_SIZE(sColor0));
|
||||
vec2 local_pos = vi.local_pos.xy / vi.local_pos.w;
|
||||
|
@ -131,8 +137,8 @@ void main(void) {
|
|||
|
||||
float texel = TEX_SAMPLE(sColor0, uv).r;
|
||||
|
||||
float alpha = mix(texel, 1.0 - texel, vClipMode.x);
|
||||
float result = vLocalPos.w > 0.0 ? mix(vClipMode.x, alpha, in_shadow_rect) : 0.0;
|
||||
float alpha = mix(texel, 1.0 - texel, vClipMode);
|
||||
float result = vLocalPos.w > 0.0 ? mix(vClipMode, alpha, in_shadow_rect) : 0.0;
|
||||
|
||||
oFragColor = vec4(result);
|
||||
}
|
||||
|
@ -218,7 +224,7 @@ void swgl_drawSpanR8() {
|
|||
// Fill any initial sections of the span that are clipped out based on clip mode.
|
||||
if (swgl_SpanLength > shadow_start_len) {
|
||||
int num_before = swgl_SpanLength - shadow_start_len;
|
||||
swgl_commitPartialSolidR8(num_before, vClipMode.x);
|
||||
swgl_commitPartialSolidR8(num_before, vClipMode);
|
||||
float steps_before = float(num_before / swgl_StepSize);
|
||||
uv_linear += steps_before * uv_linear_step;
|
||||
local_pos += steps_before * local_step;
|
||||
|
@ -243,8 +249,8 @@ void swgl_drawSpanR8() {
|
|||
|
||||
float texel = TEX_SAMPLE(sColor0, uv).r;
|
||||
|
||||
float alpha = mix(texel, 1.0 - texel, vClipMode.x);
|
||||
float result = mix(vClipMode.x, alpha, in_shadow_rect);
|
||||
float alpha = mix(texel, 1.0 - texel, vClipMode);
|
||||
float result = mix(vClipMode, alpha, in_shadow_rect);
|
||||
swgl_commitColorR8(result);
|
||||
|
||||
uv_linear += uv_linear_step;
|
||||
|
@ -296,9 +302,9 @@ void swgl_drawSpanR8() {
|
|||
if (uv_bounds.xy == uv_bounds.zw) {
|
||||
uv = clamp(uv, uv_bounds.xy, uv_bounds.zw);
|
||||
float texel = TEX_SAMPLE(sColor0, uv).r;
|
||||
float alpha = mix(texel, 1.0 - texel, vClipMode.x);
|
||||
float alpha = mix(texel, 1.0 - texel, vClipMode);
|
||||
swgl_commitPartialSolidR8(num_inside, alpha);
|
||||
} else if (vClipMode.x != 0.0) {
|
||||
} else if (vClipMode != 0.0) {
|
||||
swgl_commitPartialTextureLinearInvertR8(num_inside, sColor0, uv, uv_bounds);
|
||||
} else {
|
||||
swgl_commitPartialTextureLinearR8(num_inside, sColor0, uv, uv_bounds);
|
||||
|
@ -314,7 +320,7 @@ void swgl_drawSpanR8() {
|
|||
|
||||
// Fill any remaining sections of the span that are clipped out.
|
||||
if (swgl_SpanLength > 0) {
|
||||
swgl_commitPartialSolidR8(swgl_SpanLength, vClipMode.x);
|
||||
swgl_commitPartialSolidR8(swgl_SpanLength, vClipMode);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -19,8 +19,7 @@ flat varying vec4 vClipCenter_Radius_BR;
|
|||
flat varying vec4 vClipCorner_BR;
|
||||
#endif
|
||||
#endif
|
||||
// Clip mode. Packed in to a vector to work around bug 1630356.
|
||||
flat varying vec2 vClipMode;
|
||||
flat varying float vClipMode;
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
||||
|
@ -101,7 +100,7 @@ void main(void) {
|
|||
cmi.base.device_pixel_scale
|
||||
);
|
||||
|
||||
vClipMode.x = clip.rect.mode;
|
||||
vClipMode = clip.rect.mode;
|
||||
vLocalPos = vi.local_pos;
|
||||
|
||||
#ifdef WR_FEATURE_FAST_PATH
|
||||
|
@ -192,7 +191,7 @@ void main(void) {
|
|||
float alpha = distance_aa(aa_range, dist);
|
||||
|
||||
// Select alpha or inverse alpha depending on clip in/out.
|
||||
float final_alpha = mix(alpha, 1.0 - alpha, vClipMode.x);
|
||||
float final_alpha = mix(alpha, 1.0 - alpha, vClipMode);
|
||||
|
||||
float final_final_alpha = vLocalPos.w > 0.0 ? final_alpha : 0.0;
|
||||
oFragColor = vec4(final_final_alpha, 0.0, 0.0, 1.0);
|
||||
|
@ -421,7 +420,7 @@ void swgl_drawSpanR8() {
|
|||
// Output fully clear while we're outside the AA region.
|
||||
if (swgl_SpanLength > aa_start_len) {
|
||||
int num_aa = swgl_SpanLength - aa_start_len;
|
||||
swgl_commitPartialSolidR8(num_aa, vClipMode.x);
|
||||
swgl_commitPartialSolidR8(num_aa, vClipMode);
|
||||
local_pos += float(num_aa / swgl_StepSize) * local_step;
|
||||
}
|
||||
#ifdef AA_CORNER
|
||||
|
@ -436,7 +435,7 @@ void swgl_drawSpanR8() {
|
|||
dot(local_pos - start_plane.xy, start_plane.zw) > 0.0
|
||||
? AA_CORNER(local_pos, start_corner)
|
||||
: AA_RECT(local_pos));
|
||||
swgl_commitColorR8(mix(alpha, 1.0 - alpha, vClipMode.x));
|
||||
swgl_commitColorR8(mix(alpha, 1.0 - alpha, vClipMode));
|
||||
local_pos += local_step;
|
||||
}
|
||||
}
|
||||
|
@ -444,14 +443,14 @@ void swgl_drawSpanR8() {
|
|||
// If there's no start corner, just do rect AA until opaque.
|
||||
while (swgl_SpanLength > opaque_start_len) {
|
||||
float alpha = distance_aa(aa_range, AA_RECT(local_pos));
|
||||
swgl_commitColorR8(mix(alpha, 1.0 - alpha, vClipMode.x));
|
||||
swgl_commitColorR8(mix(alpha, 1.0 - alpha, vClipMode));
|
||||
local_pos += local_step;
|
||||
}
|
||||
// Now we're finally in the opaque inner octagon part of the span. Just
|
||||
// output a solid run.
|
||||
if (swgl_SpanLength > opaque_end_len) {
|
||||
int num_opaque = swgl_SpanLength - opaque_end_len;
|
||||
swgl_commitPartialSolidR8(num_opaque, 1.0 - vClipMode.x);
|
||||
swgl_commitPartialSolidR8(num_opaque, 1.0 - vClipMode);
|
||||
local_pos += float(num_opaque / swgl_StepSize) * local_step;
|
||||
}
|
||||
#ifdef AA_CORNER
|
||||
|
@ -467,7 +466,7 @@ void swgl_drawSpanR8() {
|
|||
dot(local_pos - end_plane.xy, end_plane.zw) > 0.0
|
||||
? AA_CORNER(local_pos, end_corner)
|
||||
: AA_RECT(local_pos));
|
||||
swgl_commitColorR8(mix(alpha, 1.0 - alpha, vClipMode.x));
|
||||
swgl_commitColorR8(mix(alpha, 1.0 - alpha, vClipMode));
|
||||
local_pos += local_step;
|
||||
}
|
||||
}
|
||||
|
@ -475,13 +474,13 @@ void swgl_drawSpanR8() {
|
|||
// If there's no end corner, just do rect AA until clear.
|
||||
while (swgl_SpanLength > aa_end_len) {
|
||||
float alpha = distance_aa(aa_range, AA_RECT(local_pos));
|
||||
swgl_commitColorR8(mix(alpha, 1.0 - alpha, vClipMode.x));
|
||||
swgl_commitColorR8(mix(alpha, 1.0 - alpha, vClipMode));
|
||||
local_pos += local_step;
|
||||
}
|
||||
// We're now outside the outer AA octagon on the other side. Just output
|
||||
// fully clear.
|
||||
if (swgl_SpanLength > 0) {
|
||||
swgl_commitPartialSolidR8(swgl_SpanLength, vClipMode.x);
|
||||
swgl_commitPartialSolidR8(swgl_SpanLength, vClipMode);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -9,13 +9,9 @@
|
|||
varying vec2 v_pos;
|
||||
|
||||
flat varying vec2 v_center;
|
||||
|
||||
// x: start offset, y: offset scale, z: angle
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
flat varying vec3 v_start_offset_offset_scale_angle_vec;
|
||||
#define v_start_offset v_start_offset_offset_scale_angle_vec.x
|
||||
#define v_offset_scale v_start_offset_offset_scale_angle_vec.y
|
||||
#define v_angle v_start_offset_offset_scale_angle_vec.z
|
||||
flat varying float v_start_offset;
|
||||
flat varying float v_offset_scale;
|
||||
flat varying float v_angle;
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
||||
|
@ -47,8 +43,8 @@ void main(void) {
|
|||
v_center = aCenter * v_offset_scale;
|
||||
v_pos = (aTaskRect.zw - aTaskRect.xy) * aPosition.xy * v_offset_scale * aScale;
|
||||
|
||||
v_gradient_repeat.x = float(aExtendMode == EXTEND_MODE_REPEAT);
|
||||
v_gradient_address.x = aGradientStopsAddress;
|
||||
v_gradient_repeat = float(aExtendMode == EXTEND_MODE_REPEAT);
|
||||
v_gradient_address = aGradientStopsAddress;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
// being decorated.
|
||||
varying vec2 vLocalPos;
|
||||
|
||||
// Line style. Packed in to a vector to work around bug 1630356.
|
||||
flat varying ivec2 vStyle;
|
||||
|
||||
flat varying int vStyle;
|
||||
flat varying vec4 vParams;
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
@ -42,9 +40,9 @@ PER_INSTANCE in float aWavyLineThickness;
|
|||
|
||||
void main(void) {
|
||||
vec2 size = mix(aLocalSize, aLocalSize.yx, aAxisSelect);
|
||||
vStyle.x = aStyle;
|
||||
vStyle = aStyle;
|
||||
|
||||
switch (vStyle.x) {
|
||||
switch (vStyle) {
|
||||
case LINE_STYLE_SOLID: {
|
||||
break;
|
||||
}
|
||||
|
@ -100,7 +98,7 @@ void main(void) {
|
|||
float aa_range = compute_aa_range(pos);
|
||||
float alpha = 1.0;
|
||||
|
||||
switch (vStyle.x) {
|
||||
switch (vStyle) {
|
||||
case LINE_STYLE_SOLID: {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
varying vec2 v_pos;
|
||||
|
||||
flat varying vec2 v_scale_dir;
|
||||
|
||||
// Start offset. Packed in to a vector to work around bug 1630356.
|
||||
flat varying vec2 v_start_offset;
|
||||
flat varying float v_start_offset;
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
||||
|
@ -32,12 +30,12 @@ void main(void) {
|
|||
|
||||
// Normalize UV and offsets to 0..1 scale.
|
||||
v_scale_dir = dir / dot(dir, dir);
|
||||
v_start_offset.x = dot(aStartPoint, v_scale_dir);
|
||||
v_start_offset = dot(aStartPoint, v_scale_dir);
|
||||
|
||||
v_scale_dir *= (aTaskRect.zw - aTaskRect.xy);
|
||||
|
||||
v_gradient_repeat.x = float(aExtendMode == EXTEND_MODE_REPEAT);
|
||||
v_gradient_address.x = aGradientStopsAddress;
|
||||
v_gradient_repeat = float(aExtendMode == EXTEND_MODE_REPEAT);
|
||||
v_gradient_address = aGradientStopsAddress;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -46,7 +44,7 @@ void main(void) {
|
|||
|
||||
void main(void) {
|
||||
// Project position onto a direction vector to compute offset.
|
||||
float offset = dot(v_pos, v_scale_dir) - v_start_offset.x;
|
||||
float offset = dot(v_pos, v_scale_dir) - v_start_offset;
|
||||
|
||||
oFragColor = sample_gradient(offset);
|
||||
}
|
||||
|
@ -54,13 +52,13 @@ void main(void) {
|
|||
|
||||
#ifdef SWGL_DRAW_SPAN
|
||||
void swgl_drawSpanRGBA8() {
|
||||
int address = swgl_validateGradient(sGpuCache, get_gpu_cache_uv(v_gradient_address.x), int(GRADIENT_ENTRIES + 2.0));
|
||||
int address = swgl_validateGradient(sGpuCache, get_gpu_cache_uv(v_gradient_address), int(GRADIENT_ENTRIES + 2.0));
|
||||
if (address < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
float offset = dot(v_pos, v_scale_dir) - v_start_offset.x;
|
||||
swgl_commitLinearGradientRGBA8(sGpuCache, address, GRADIENT_ENTRIES, v_gradient_repeat.x != 0.0,
|
||||
float offset = dot(v_pos, v_scale_dir) - v_start_offset;
|
||||
swgl_commitLinearGradientRGBA8(sGpuCache, address, GRADIENT_ENTRIES, v_gradient_repeat != 0.0,
|
||||
offset);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
varying vec2 v_pos;
|
||||
|
||||
// Start radius. Packed in to a vector to work around bug 1630356.
|
||||
flat varying vec2 v_start_radius;
|
||||
flat varying float v_start_radius;
|
||||
|
||||
#ifdef WR_VERTEX_SHADER
|
||||
|
||||
|
@ -31,7 +30,7 @@ void main(void) {
|
|||
vec2 pos = mix(aTaskRect.xy, aTaskRect.zw, aPosition.xy);
|
||||
gl_Position = uTransform * vec4(pos, 0.0, 1.0);
|
||||
|
||||
v_start_radius.x = aStartRadius * radius_scale;
|
||||
v_start_radius = aStartRadius * radius_scale;
|
||||
|
||||
// Transform all coordinates by the y scale so the
|
||||
// fragment shader can work with circles
|
||||
|
@ -41,8 +40,8 @@ void main(void) {
|
|||
v_pos = ((aTaskRect.zw - aTaskRect.xy) * aPosition.xy * aScale - aCenter) * radius_scale;
|
||||
v_pos.y *= aXYRatio;
|
||||
|
||||
v_gradient_repeat.x = float(aExtendMode == EXTEND_MODE_REPEAT);
|
||||
v_gradient_address.x = aGradientStopsAddress;
|
||||
v_gradient_repeat = float(aExtendMode == EXTEND_MODE_REPEAT);
|
||||
v_gradient_address = aGradientStopsAddress;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -51,20 +50,20 @@ void main(void) {
|
|||
|
||||
void main(void) {
|
||||
// Solve for t in length(pd) = v_start_radius + t * rd
|
||||
float offset = length(v_pos) - v_start_radius.x;
|
||||
float offset = length(v_pos) - v_start_radius;
|
||||
|
||||
oFragColor = sample_gradient(offset);
|
||||
}
|
||||
|
||||
#ifdef SWGL_DRAW_SPAN
|
||||
void swgl_drawSpanRGBA8() {
|
||||
int address = swgl_validateGradient(sGpuCache, get_gpu_cache_uv(v_gradient_address.x),
|
||||
int address = swgl_validateGradient(sGpuCache, get_gpu_cache_uv(v_gradient_address),
|
||||
int(GRADIENT_ENTRIES + 2.0));
|
||||
if (address < 0) {
|
||||
return;
|
||||
}
|
||||
swgl_commitRadialGradientRGBA8(sGpuCache, address, GRADIENT_ENTRIES, v_gradient_repeat.x != 0.0,
|
||||
v_pos, v_start_radius.x);
|
||||
swgl_commitRadialGradientRGBA8(sGpuCache, address, GRADIENT_ENTRIES, v_gradient_repeat != 0.0,
|
||||
v_pos, v_start_radius);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,18 +10,19 @@ varying vec2 vInput1Uv;
|
|||
varying vec2 vInput2Uv;
|
||||
flat varying vec4 vInput1UvRect;
|
||||
flat varying vec4 vInput2UvRect;
|
||||
flat varying int vFilterInputCount;
|
||||
flat varying int vFilterKind;
|
||||
flat varying ivec4 vData;
|
||||
flat varying vec4 vFilterData0;
|
||||
flat varying vec4 vFilterData1;
|
||||
|
||||
// x: Filter input count, y: Filter kind.
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
flat varying ivec2 vFilterInputCountFilterKindVec;
|
||||
#define vFilterInputCount vFilterInputCountFilterKindVec.x
|
||||
#define vFilterKind vFilterInputCountFilterKindVec.y
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
flat varying vec2 vFloat0;
|
||||
|
||||
#if defined(PLATFORM_ANDROID) && !defined(SWGL)
|
||||
// Work around Adreno 3xx driver bug. See the v_perspective comment in
|
||||
// brush_image or bug 1630356 for details.
|
||||
flat varying vec2 vFloat0Vec;
|
||||
#define vFloat0 vFloat0Vec.x
|
||||
#else
|
||||
flat varying float vFloat0;
|
||||
#endif
|
||||
flat varying mat4 vColorMat;
|
||||
flat varying ivec4 vFuncs;
|
||||
|
||||
|
@ -129,7 +130,7 @@ void main(void) {
|
|||
vFilterData0 = fetch_from_gpu_cache_1_direct(aFilterExtraDataAddress);
|
||||
break;
|
||||
case FILTER_OPACITY:
|
||||
vFloat0.x = filter_task.user_data.x;
|
||||
vFloat0 = filter_task.user_data.x;
|
||||
break;
|
||||
case FILTER_COLOR_MATRIX:
|
||||
vec4 mat_data[4] = fetch_from_gpu_cache_4_direct(aFilterExtraDataAddress);
|
||||
|
@ -554,7 +555,7 @@ void main(void) {
|
|||
break;
|
||||
case FILTER_OPACITY:
|
||||
result.rgb = Ca.rgb;
|
||||
result.a = Ca.a * vFloat0.x;
|
||||
result.a = Ca.a * vFloat0;
|
||||
break;
|
||||
case FILTER_COLOR_MATRIX:
|
||||
result = vColorMat * Ca + vFilterData0;
|
||||
|
|
|
@ -2,12 +2,17 @@
|
|||
* 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/. */
|
||||
|
||||
// Gradient GPU cache address.
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
flat varying HIGHP_FS_ADDRESS ivec2 v_gradient_address;
|
||||
flat varying HIGHP_FS_ADDRESS int v_gradient_address;
|
||||
|
||||
#if defined(PLATFORM_ANDROID) && !defined(SWGL)
|
||||
// Work around Adreno 3xx driver bug. See the v_perspective comment in
|
||||
// brush_image or bugs 1630356 and for details.
|
||||
flat varying vec2 v_gradient_repeat_vec;
|
||||
#define v_gradient_repeat v_gradient_repeat_vec.x
|
||||
#else
|
||||
// Repetition along the gradient stops.
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
flat varying vec2 v_gradient_repeat;
|
||||
flat varying float v_gradient_repeat;
|
||||
#endif
|
||||
|
||||
#ifdef WR_FRAGMENT_SHADER
|
||||
|
||||
|
@ -44,7 +49,7 @@ float clamp_gradient_entry(float offset) {
|
|||
|
||||
vec4 sample_gradient(float offset) {
|
||||
// Modulo the offset if the gradient repeats.
|
||||
offset -= floor(offset) * v_gradient_repeat.x;
|
||||
offset -= floor(offset) * v_gradient_repeat;
|
||||
|
||||
// Calculate the texel to index into the gradient color entries:
|
||||
// floor(x) is the gradient color entry index
|
||||
|
@ -54,7 +59,7 @@ vec4 sample_gradient(float offset) {
|
|||
float entry_fract = x - entry_index;
|
||||
|
||||
// Fetch the start and end color. There is a [start, end] color per entry.
|
||||
vec4 texels[2] = fetch_from_gpu_cache_2(v_gradient_address.x + 2 * int(entry_index));
|
||||
vec4 texels[2] = fetch_from_gpu_cache_2(v_gradient_address + 2 * int(entry_index));
|
||||
|
||||
// Finally interpolate and apply dithering
|
||||
return dither(texels[0] + texels[1] * entry_fract);
|
||||
|
|
|
@ -40,10 +40,10 @@ void write_gradient_vertex(
|
|||
// Normalize UV to 0..1 scale.
|
||||
v_pos /= v_repeated_size;
|
||||
|
||||
v_gradient_address.x = prim_user_data.x;
|
||||
v_gradient_address = prim_user_data.x;
|
||||
|
||||
// Whether to repeat the gradient along the line instead of clamping.
|
||||
v_gradient_repeat.x = float(extend_mode == EXTEND_MODE_REPEAT);
|
||||
v_gradient_repeat = float(extend_mode == EXTEND_MODE_REPEAT);
|
||||
|
||||
#ifdef WR_FEATURE_ALPHA_PASS
|
||||
v_tile_repeat = tile_repeat;
|
||||
|
|
|
@ -9,9 +9,15 @@
|
|||
// interpolated UV coordinates to sample.
|
||||
varying vec2 vUv;
|
||||
|
||||
#if defined(PLATFORM_ANDROID) && !defined(SWGL)
|
||||
// Work around Adreno 3xx driver bug. See the v_perspective comment in
|
||||
// brush_image or bug 1630356 for details.
|
||||
flat varying vec2 vPerspectiveVec;
|
||||
#define vPerspective vPerspectiveVec.x
|
||||
#else
|
||||
// Flag to allow perspective interpolation of UV.
|
||||
// Packed in to a vector to work around bug 1630356.
|
||||
flat varying vec2 vPerspective;
|
||||
flat varying float vPerspective;
|
||||
#endif
|
||||
|
||||
flat varying vec4 vUvSampleBounds;
|
||||
|
||||
|
@ -110,21 +116,21 @@ void main(void) {
|
|||
float perspective_interpolate = float(ph.user_data.y);
|
||||
|
||||
vUv = uv / texture_size * mix(gl_Position.w, 1.0, perspective_interpolate);
|
||||
vPerspective.x = perspective_interpolate;
|
||||
vPerspective = perspective_interpolate;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WR_FRAGMENT_SHADER
|
||||
void main(void) {
|
||||
float alpha = do_clip();
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, vPerspective.x);
|
||||
float perspective_divisor = mix(gl_FragCoord.w, 1.0, vPerspective);
|
||||
vec2 uv = clamp(vUv * perspective_divisor, vUvSampleBounds.xy, vUvSampleBounds.zw);
|
||||
write_output(alpha * texture(sColor0, uv));
|
||||
}
|
||||
|
||||
#ifdef SWGL_DRAW_SPAN
|
||||
void swgl_drawSpanRGBA8() {
|
||||
float perspective_divisor = mix(swgl_forceScalar(gl_FragCoord.w), 1.0, vPerspective.x);
|
||||
float perspective_divisor = mix(swgl_forceScalar(gl_FragCoord.w), 1.0, vPerspective);
|
||||
vec2 uv = vUv * perspective_divisor;
|
||||
|
||||
swgl_commitTextureRGBA8(sColor0, uv, vUvSampleBounds);
|
||||
|
|
|
@ -137,7 +137,7 @@ pub mod intern;
|
|||
///
|
||||
pub mod render_api;
|
||||
|
||||
pub mod shader_source {
|
||||
mod shader_source {
|
||||
include!(concat!(env!("OUT_DIR"), "/shaders.rs"));
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ env_logger = { version = "0.5", optional = true }
|
|||
gleam = "0.13"
|
||||
glutin = "0.21"
|
||||
clap = { version = "2", features = ["yaml"] }
|
||||
glsl = "4.0"
|
||||
log = "0.4"
|
||||
yaml-rust = "0.4"
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -184,5 +184,3 @@ subcommands:
|
|||
index: 2
|
||||
- test_init:
|
||||
about: Test for successful initialization then exit immediately
|
||||
- test_shaders:
|
||||
about: run shader tests
|
||||
|
|
|
@ -21,7 +21,6 @@ mod premultiply;
|
|||
mod rawtest;
|
||||
mod reftest;
|
||||
mod test_invalidation;
|
||||
mod test_shaders;
|
||||
mod wrench;
|
||||
mod yaml_frame_reader;
|
||||
mod yaml_helper;
|
||||
|
@ -758,8 +757,6 @@ fn main() {
|
|||
// Wrench::new() unwraps the Renderer initialization, so if
|
||||
// we reach this point then we have initialized successfully.
|
||||
println!("Initialization successful");
|
||||
} else if let Some(_) = args.subcommand_matches("test_shaders") {
|
||||
test_shaders::test_shaders();
|
||||
} else {
|
||||
panic!("Should never have gotten here! {:?}", args);
|
||||
};
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
/* 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/. */
|
||||
|
||||
use webrender::shader_source::OPTIMIZED_SHADERS;
|
||||
use glsl::parser::Parse as _;
|
||||
use glsl::syntax::{InterpolationQualifier, ShaderStage, SingleDeclaration};
|
||||
use glsl::syntax::{TypeSpecifierNonArray, TypeQualifierSpec};
|
||||
use glsl::visitor::{Host, Visit, Visitor};
|
||||
|
||||
/// Tests that a shader contains no flat scalar varyings.
|
||||
/// These must be avoided on Adreno 3xx devices due to bug 1630356.
|
||||
fn test_no_flat_scalar_varyings(name: &str, shader: &mut ShaderStage) {
|
||||
struct FlatScalarVaryingsVisitor {
|
||||
shader_name: String,
|
||||
}
|
||||
|
||||
impl Visitor for FlatScalarVaryingsVisitor {
|
||||
fn visit_single_declaration(&mut self, declaration: &mut SingleDeclaration) -> Visit {
|
||||
let is_scalar = match declaration.ty.ty.ty {
|
||||
TypeSpecifierNonArray::Bool
|
||||
| TypeSpecifierNonArray::Int
|
||||
| TypeSpecifierNonArray::UInt
|
||||
| TypeSpecifierNonArray::Float
|
||||
| TypeSpecifierNonArray::Double => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
let qualifiers = declaration
|
||||
.ty
|
||||
.qualifier
|
||||
.as_ref()
|
||||
.map(|q| q.qualifiers.0.as_slice())
|
||||
.unwrap_or(&[]);
|
||||
|
||||
let is_flat = qualifiers.contains(&TypeQualifierSpec::Interpolation(
|
||||
InterpolationQualifier::Flat,
|
||||
));
|
||||
|
||||
assert!(
|
||||
!(is_scalar && is_flat),
|
||||
"{}: {} is a flat scalar varying",
|
||||
self.shader_name,
|
||||
&declaration.name.as_ref().unwrap()
|
||||
);
|
||||
|
||||
Visit::Parent
|
||||
}
|
||||
}
|
||||
|
||||
let mut visitor = FlatScalarVaryingsVisitor {
|
||||
shader_name: name.to_string(),
|
||||
};
|
||||
shader.visit(&mut visitor);
|
||||
}
|
||||
|
||||
pub fn test_shaders() {
|
||||
for ((_version, name), shader) in OPTIMIZED_SHADERS.iter() {
|
||||
let mut vert = ShaderStage::parse(shader.vert_source).unwrap();
|
||||
let mut frag = ShaderStage::parse(shader.frag_source).unwrap();
|
||||
|
||||
if cfg!(target_os = "android") {
|
||||
test_no_flat_scalar_varyings(&format!("{}.vert", name), &mut vert);
|
||||
test_no_flat_scalar_varyings(&format!("{}.frag", name), &mut frag);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,8 +29,7 @@ from mozharness.mozilla.testing.testbase import TestingMixin
|
|||
class TestMode(enum.Enum):
|
||||
OPTIMIZED_SHADER_COMPILATION = 0
|
||||
UNOPTIMIZED_SHADER_COMPILATION = 1
|
||||
SHADER_TEST = 2
|
||||
REFTEST = 3
|
||||
REFTEST = 2
|
||||
|
||||
|
||||
class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin):
|
||||
|
@ -172,8 +171,6 @@ class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin):
|
|||
argfile.write("--precache test_init")
|
||||
elif test_mode == TestMode.UNOPTIMIZED_SHADER_COMPILATION:
|
||||
argfile.write("--precache --use-unoptimized-shaders test_init")
|
||||
elif test_mode == TestMode.SHADER_TEST:
|
||||
argfile.write("--precache test_shaders")
|
||||
elif test_mode == TestMode.REFTEST:
|
||||
argfile.write("reftest")
|
||||
self.device.push(args_file, "/sdcard/wrench/args")
|
||||
|
@ -275,12 +272,6 @@ class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin):
|
|||
self.info("Running unoptimized shader compilation tests...")
|
||||
self.run_tests(60)
|
||||
|
||||
if not self._errored:
|
||||
self.info("Setting up SD card...")
|
||||
self.setup_sdcard(TestMode.SHADER_TEST)
|
||||
self.info("Running shader tests...")
|
||||
self.run_tests(60)
|
||||
|
||||
if not self._errored:
|
||||
self.info("Setting up SD card...")
|
||||
self.setup_sdcard(TestMode.REFTEST)
|
||||
|
|
Загрузка…
Ссылка в новой задаче