Commit 15d74fce authored by Jamie Nicol's avatar Jamie Nicol
Browse files

Bug 1728064 - Add test to ensure shaders don't contain flat scalar varyings on...

Bug 1728064 - Add test to ensure shaders don't contain flat scalar varyings on android. r=gfx-reviewers,kvark

There is a driver bug on Adreno 3xx devices causing incorrect
rendering when flat scalar varyings are used in fragment shaders. This
has occured several times in different shaders, so this patch finally
adds a test to ensure it does not occur again.

We have used the glsl crate to parse and validate the shaders rather
than angle, as exposing the required bindings to mozangle is messy. We
must therefore use the pre-optimized shaders as the glsl crate does
not handle preprocessor directives correctly.

This has been implemented as a wrench test rather than a unit test as
running unit tests on android is difficult. Additionally we want to
use the shaders specific to the platform the tests are ran on, the bug
only affects (some) android devices, and shaders on other platforms
may differ.

Differential Revision: https://phabricator.services.mozilla.com/D124205
parent 4a11f7cb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1848,6 +1848,7 @@ dependencies = [
 "env_logger",
 "font-loader",
 "gleam 0.13.1",
 "glsl",
 "glutin",
 "image",
 "log",
+2 −1
Original line number Diff line number Diff line
@@ -16,9 +16,10 @@ set -o xtrace
CARGOFLAGS=${CARGOFLAGS:-""}  # default to empty if not set

pushd wrench
# Test that all shaders compile successfully.
# Test that all shaders compile successfully and pass tests.
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
+2 −1
Original line number Diff line number Diff line
@@ -20,9 +20,10 @@ WRENCH_BINARY=${WRENCH_BINARY:-""}

pushd wrench

# Test that all shaders compile successfully.
# Test that all shaders compile successfully and pass tests.
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
+5 −2
Original line number Diff line number Diff line
@@ -21,12 +21,15 @@ popd
pushd wrench
cargo test --verbose
if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
:: Test that all shaders compile successfully. --precache compiles all shaders
:: during initialization, therefore if init is successful then the shaders compile.
:: Test that all shaders compile successfully and pass tests.
:: --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%
+1 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ pub mod intern;
///
pub mod render_api;

mod shader_source {
pub mod shader_source {
    include!(concat!(env!("OUT_DIR"), "/shaders.rs"));
}

Loading