Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRefactor and small optimization of batching code. #1600
Conversation
|
|
|
Rebased |
| } | ||
| } | ||
|
|
||
| pub struct OpaqueBatchList { |
This comment has been minimized.
This comment has been minimized.
kvark
Aug 24, 2017
Member
hmm, there appears to be quite a bit of duplicated code, on both the API and the implementation side.
Might be worth uniting those structs:
trait PrimitiveBatch: Sized {
type Bound;
fn new(&AlphaBatchKey) -> Self;
fn check_intersections(&self, &Self::Bound) -> bool;
fn add_bound(&mut self, &Self::Bound) -> &mut Vec<PrimitiveInstance>;
}
struct BatchList<B> {
pub batches: Vec<B>,
}
impl<B: PrimitiveBatch> for BatchList<B> {
...
}
This comment has been minimized.
This comment has been minimized.
glennw
Aug 24, 2017
Author
Member
Although the code is mostly duplicated right now, I'm planning to experiment with changing the batching strategies for opaque and alpha - I think they'll end up being quite different.
In particular, while the alpha batcher would stay quite similar, the opaque batcher would ensure very large primitives get rendered first (even if a batch break is involved), while smaller primitives could get added to a per-batch-type list, without having to search for an appropriate batch.
So I think it makes sense to leave the code duplicated for now - does that seem reasonable?
|
Sorry about the late review! |
|
Ok, looking forward to see the next steps ;) |
|
|
|
|
|
|
This is prep work for some upcoming changes to support different vertex formats per batch type. This will allow: 1) Much smaller vertex format for glyph instances. 2) Different vertex attribute types per batch type (e.g. using 2x u16 for GPU cache addresses). There's also a small optimization - we no longer store the bounding rects for items in the opaque batch lists, since we don't need to check for overlap there.
|
Rebased. @bors-servo r=kvark |
|
|
Refactor and small optimization of batching code. This is prep work for some upcoming changes to support different vertex formats per batch type. This will allow: 1) Much smaller vertex format for glyph instances. 2) Different vertex attribute types per batch type (e.g. using 2x u16 for GPU cache addresses). There's also a small optimization - we no longer store the bounding rects for items in the opaque batch lists, since we don't need to check for overlap there. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1600) <!-- Reviewable:end -->
|
|
glennw commentedAug 23, 2017
•
edited by larsbergstrom
This is prep work for some upcoming changes to support
different vertex formats per batch type. This will allow:
There's also a small optimization - we no longer store the bounding
rects for items in the opaque batch lists, since we don't need
to check for overlap there.
This change is