-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Rewrite ProgramConfiguration #4934
Conversation
Awesome! Do you know if there's a performance impact from the float type change? Would it cause more data to be uploaded? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍏 (notwithstanding two minor suggestions)
src/data/program_configuration.js
Outdated
@@ -76,6 +35,162 @@ export type Program = { | |||
[string]: any | |||
} | |||
|
|||
function packColor(color: [number, number, number, number]): Array<number> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the return type here should be [number, number]
.
src/shaders/index.js
Outdated
|
||
program.fragmentSource = program.fragmentSource.replace(re, (match, operation, precision, type, name) => { | ||
fragmentPragmas[name] = true; | ||
return operation === 'define' ? ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd favor the more explicit if (operation === 'define') ... else if (operation === 'initialize')
(or the equivalent switch
) here and below, so as to (re-)articulate how our custom #pragma
syntax works.
e71e771
to
18d5442
Compare
94914ce
to
f3bb3b3
Compare
f3bb3b3
to
8e61d8b
Compare
Yes, in some cases -- I believe the majority -- the buffers for data-driven properties will be larger. For source functions, non-color data-driven properties that were previously typed as Overall, I expect the space increase to have a minor impact, and I think it's worth it to simplify the implementation, make gl-js consistent with gl-native, and eliminate bugs like #3954 and #4438 where using a 16-bit integer results in truncation and limited range. |
* Expand #pragmas to #ifndefs early on. This is written in such a way that it can be reused by gl-native's generate-shaders.js. * Binder interface for paint properties, with a concrete implementation for each binding strategy. * Always use floats for paint property attributes, without a multiplication factor. (Fixes #4438) * When binding composite functions, interpolate between two stop values only: zoom and zoom + 1.
8e61d8b
to
a3b43f6
Compare
The previous value was due to using a 16-bit unsigned integer for the attribute. In #4934, we switched to floats, removing the limitation.
The previous value was due to using a 16-bit unsigned integer for the attribute. In #4934, we switched to floats, removing the limitation.
The previous value was due to using a 16-bit unsigned integer for the attribute. In #4934, we switched to floats, removing the limitation.
#pragma
s to#ifndef
s early on. This is written in such a way that it can be reused by gl-native's generate-shaders.js. It also avoids generating unnecessaryvarying
s (Reduce number of varyings for line_sdf shader #4542).Launch Checklist