Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable property functions for more symbol paint properties #4226

Merged
merged 8 commits into from
Feb 8, 2017

Conversation

anandthakker
Copy link
Contributor

Add property function support for

  • icon-opacity
  • text-opacity
  • icon-halo-blur
  • text-halo-blur
  • icon-halo-width
  • text-halo-width
  • briefly describe the changes in this PR
  • write tests for all new functionality
  • post benchmark scores
  • manually test the debug page
benchmark master 8f58879 dds-symbol-paint-2 05bb0a2
map-load 142 ms 117 ms
style-load 69 ms 158 ms
buffer 1,030 ms 1,020 ms
fps 60 fps 60 fps
frame-duration 4.9 ms, 0% > 16ms 4.9 ms, 0% > 16ms
query-point 0.80 ms 0.79 ms
query-box 61.43 ms 66.78 ms
geojson-setdata-small 6 ms 5 ms
geojson-setdata-large 147 ms 183 ms

@anandthakker
Copy link
Contributor Author

Ready for 👀

Copy link
Contributor

@lucaswoj lucaswoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks @anandthakker. One very quick revision and one code style opinion comment. Feel free to :shipit: once those are taken care of.

const fragmentSource = configuration.applyPragmas(definesSource + shaders.prelude.fragmentSource + definition.fragmentSource, 'fragment');
const vertexSource = configuration.applyPragmas(definesSource + shaders.prelude.vertexSource + definition.vertexSource, 'vertex');

// console.log(fragmentSource.split('\n').map((l, i) => `${i}: ${l}`).join('\n'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidental //?

#define SDF_PX 8.0
#define BLUR_OFFSET 1.19
#define HALO_OFFSET 6.0
#define GAMMA 0.105/DEVICE_PIXEL_RATIO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinion Below 👇

I find some of these constant names cryptic:

  • What's the difference between GAMMA and gamma?
  • What's meant by SDF_PX? SDF pixels?
  • Why is halp_blur multiplied by BLUR_OFFSET?
  • What's a buff? Is it a buffer?

I prefer a very clear constant name (ideally googleable) to a magic number, and a magic number to a cryptic constant name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL, I totally agree with you that these names are cryptic. And here I must confess, I just did a lazy/dumb transcription from draw_symbol.js (where these constants / calculations lived before this), without actually discerning what they meant. Lemme see if I can decipher them into more meaningful names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🙇. If you can't come up with a meaningful name, feel free to inline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucaswoj I inlined a couple of them, but chose to leave SDF_PX and EDGE_GAMMA (my weak attempt at renaming GAMMA), because they are used in more than one place -- I did not want to inline them and then later lose track of the fact that both "8.0"s are supposed to mean the same thing. Filed a follow up ticket though: #4229

@anandthakker anandthakker merged commit 3314017 into master Feb 8, 2017
@anandthakker anandthakker deleted the dds-symbol-paint-2 branch February 8, 2017 00:46
mapsam pushed a commit that referenced this pull request Feb 8, 2017
* Enable property functions for {text,icon}-opacity

* Add property-function tests for {text,icon}-opacity

* Enable property functions for *-halo-{width,blur}

* Add render tests for {text,icon}-halo-{blur,width}

* Skip halo-blur/width tests on native

* Remove stray debugging statement

* Very slightly demistify a couple of constants

* Revert unchanged render test images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants