-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Add DDS support for {text,icon}-size #8593
Conversation
a85307b
to
545ca67
Compare
src/mbgl/programs/symbol_program.hpp
Outdated
: sizePropertyValue(size), | ||
layoutZoom(tileZoom + 1), | ||
defaultSize(defaultSize_) { | ||
size.match( |
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.
Some pathways don't initialize layoutSize
. Should it have a default value or be typed as optional<float>
?
src/mbgl/programs/symbol_program.hpp
Outdated
struct SymbolSizeAttributes : gl::Attributes<attributes::a_size> { | ||
using SourceFunctionVertex = gl::detail::Vertex<gl::Attribute<uint16_t, 1>>; | ||
struct monostate {}; | ||
using VertexVector = variant< |
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.
Instead of having parallel VertexVector
and VertexBuffer
variants, and three different match
statements (in attributeBindings
, SymbolSizeData
, and upload
), what about following a model like PaintPropertyBinder
, where an initial match
statement then transfers control to a polymorphic object, whose derived types each hold both VertexVector
and VertexBuffer
of the appropriate matching types?
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.
Ah, yeah! I started out thinking that duplicating a PaintPropertyBinder hierarchy like that would be overkill, but actually it could be pretty minimal/scoped and, like you say, cleaner than having all these different match
es. 🙇
545ca67
to
c85262f
Compare
This fixes a bug where, for a zoom value greater than that of the highest zoom stop, composite function interpolation would return nan. (Blocking a render test over in #8593) * Add failing tests for composite function edge case The failing cases here are: - Should interpolate before the first stop - Should interpolate past the last stop * Fix edge case in composite function interpolation * Hold functions constant outside stop-defined domain
f89b3e8
to
7cfa1f2
Compare
@jfirebaugh refactored to a paintpropertybinders-like polymorphic approach f219d8c, as you suggested. It's a few more LOC, but it does feel like a cleaner design. The repetition of the PaintPropertyBinders hierarchy makes me itch to refactor the redundancy, but it would probably be premature abstraction to do it just yet; I think we should wait till we need a third copy. |
I think the main issue here is to dedupe the identical constructors of |
src/mbgl/gl/program.hpp
Outdated
@@ -37,6 +41,57 @@ class Program { | |||
attributeLocations(Attributes::loadNamedLocations(binaryProgram)), | |||
uniformsState(Uniforms::loadNamedLocations(binaryProgram)) { | |||
} | |||
|
|||
template <class Shaders> |
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.
To reduce binary size, pass vertexSource
, fragmentSource
, and name
as parameters rather than templating on Shaders
.
src/mbgl/programs/attributes.hpp
Outdated
// Layout attributes | ||
|
||
MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_pos); | ||
MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_extrude); | ||
MBGL_DEFINE_ATTRIBUTE(int16_t, 4, a_pos_offset); | ||
MBGL_DEFINE_ATTRIBUTE(uint16_t, 2, a_texture_pos); | ||
|
||
template <std::size_t N> | ||
template <std::size_t N, typename T> |
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.
Flip the order of T
and N
, so that it matches gl::Attribute
.
66b27fb
to
8af6500
Compare
@jfirebaugh updated to address your comments and also rebased + cleaned up the history a bit. Should be ready for a full review now. |
bb0463d
to
24f10e8
Compare
24f10e8
to
10e1fc1
Compare
SymbolSizeData
/SymbolSizeAttributes
design ( @jfirebaugh could I get your take on this? Main place to look/start is probably top of symbol_program.cpp, SymbolLayout::addSymbol, and maybe makeValues())SymbolProgram
, currently just copy-pasted fromProgram
to make for easier initial hacking.