[core] update native for line property function shaders changes (#6658)

* [core] update shaders for line property functions

update deps, define device pixel ratio for all shaders

[core] create ShaderParameter struct to store pixel ratio and overdraw param

repair rebase errs

update shaders to include pixel ratio

make sure collision_box never overdraws

update test suite, move shaders to Painter::render so the correct pixel ratio is applied

move shader compiling back to the Painter constructor

rebase from shader --> program refactor

re-factor parameters for collisionBox and debug programs

remove unused vars from line-program, move blur math to shader

update core files

remove unecessary files

update shaders PR, remove comments

bump test suite sha

fix formatting, incorporate feedback

refactor program.hpp

* [core] remove line transformations that were moved to the shaders, bump shader sha

* [core] shorten ProgramParameter instantiation

* [core] bump shader+test suite shas
This commit is contained in:
Molly Lloyd
2016-11-16 17:34:33 -08:00
committed by GitHub
parent a5ac643166
commit 3380f0803a
13 changed files with 75 additions and 68 deletions

View File

@@ -12,13 +12,9 @@ static_assert(sizeof(LineAttributes::Vertex) == 8, "expected LineVertex size");
template <class Values, class...Args>
Values makeValues(const style::LinePaintProperties& properties,
float pixelRatio,
const RenderTile& tile,
const TransformState& state,
Args&&... args) {
// the distance over which the line edge fades out.
// Retina devices need a smaller distance to avoid aliasing.
float antialiasing = 1.0 / pixelRatio;
mat2 antialiasingMatrix;
matrix::identity(antialiasingMatrix);
@@ -35,11 +31,10 @@ Values makeValues(const style::LinePaintProperties& properties,
properties.lineTranslateAnchor.value,
state) },
uniforms::u_opacity::Value{ properties.lineOpacity.value },
uniforms::u_linewidth::Value{ properties.lineWidth.value / 2 },
uniforms::u_gapwidth::Value{ properties.lineGapWidth.value / 2 },
uniforms::u_blur::Value{ properties.lineBlur.value + antialiasing },
uniforms::u_offset::Value{ -properties.lineOffset.value },
uniforms::u_antialiasing::Value{ antialiasing / 2 },
uniforms::u_width::Value{ properties.lineWidth.value },
uniforms::u_gapwidth::Value{ properties.lineGapWidth.value },
uniforms::u_blur::Value{ properties.lineBlur.value },
uniforms::u_offset::Value{ properties.lineOffset.value },
uniforms::u_antialiasingmatrix::Value{ antialiasingMatrix },
uniforms::u_ratio::Value{ 1.0f / tile.id.pixelsToTileUnits(1.0, state.getZoom()) },
uniforms::u_extra::Value{ (topedgelength + x) / topedgelength - 1.0f },
@@ -49,12 +44,10 @@ Values makeValues(const style::LinePaintProperties& properties,
LineProgram::UniformValues
LineProgram::uniformValues(const style::LinePaintProperties& properties,
float pixelRatio,
const RenderTile& tile,
const TransformState& state) {
return makeValues<LineProgram::UniformValues>(
properties,
pixelRatio,
tile,
state,
uniforms::u_color::Value{ properties.lineColor.value }
@@ -85,7 +78,6 @@ LineSDFProgram::uniformValues(const style::LinePaintProperties& properties,
return makeValues<LineSDFProgram::UniformValues>(
properties,
pixelRatio,
tile,
state,
uniforms::u_color::Value{ properties.lineColor.value },
@@ -101,7 +93,6 @@ LineSDFProgram::uniformValues(const style::LinePaintProperties& properties,
LinePatternProgram::UniformValues
LinePatternProgram::uniformValues(const style::LinePaintProperties& properties,
float pixelRatio,
const RenderTile& tile,
const TransformState& state,
const SpriteAtlasPosition& posA,
@@ -118,7 +109,6 @@ LinePatternProgram::uniformValues(const style::LinePaintProperties& properties,
return makeValues<LinePatternProgram::UniformValues>(
properties,
pixelRatio,
tile,
state,
uniforms::u_pattern_tl_a::Value{ posA.tl },