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

Store vertex attribs data in DOM and optimise GetVertexAttrib #21118

Merged
merged 8 commits into from Jul 5, 2018
Merged

Conversation

@nox
Copy link
Member

nox commented Jul 3, 2018

This is not an extremely useful change on its own but those things need to be stored on the DOM side to implement some draw checks anyway.


This change is Reviewable

@highfive
Copy link

highfive commented Jul 3, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs, components/script/dom/webglvertexarrayobjectoes.rs, components/script/dom/webglrenderingcontext.rs
  • @KiChjang: components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs, components/script/dom/webglvertexarrayobjectoes.rs, components/script/dom/webglrenderingcontext.rs
@highfive
Copy link

highfive commented Jul 3, 2018

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@nox
Copy link
Member Author

nox commented Jul 3, 2018

bors-servo added a commit that referenced this pull request Jul 3, 2018
 Store vertex attribs data in DOM and optimise GetVertexAttrib

This is not an extremely useful change on its own but those things need to be stored on the DOM side to implement some draw checks anyway.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21118)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2018

Trying commit 6d5a7d9 with merge aaa1945...

@nox
Copy link
Member Author

nox commented Jul 3, 2018

r? @emilio

@highfive highfive assigned emilio and unassigned mbrubeck Jul 3, 2018
@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2018

💔 Test failed - linux-rel-wpt

@nox nox force-pushed the webgl branch from 6d5a7d9 to 5a1b342 Jul 3, 2018
@highfive highfive removed the S-tests-failed label Jul 3, 2018
@nox
Copy link
Member Author

nox commented Jul 3, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2018

Trying commit 5a1b342 with merge 838f70f...

bors-servo added a commit that referenced this pull request Jul 3, 2018
 Store vertex attribs data in DOM and optimise GetVertexAttrib

This is not an extremely useful change on its own but those things need to be stored on the DOM side to implement some draw checks anyway.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21118)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2018

@nox
Copy link
Member Author

nox commented Jul 4, 2018

@highfive highfive assigned MortimerGoro and unassigned emilio Jul 4, 2018
@emilio
emilio approved these changes Jul 5, 2018
Copy link
Member

emilio left a comment

Looks great, sorry so much for the lag with this.

impl BoundAttribBuffers {
impl VertexAttribs {
pub fn new(max: u32) -> Self {
Self { attribs: DomRefCell::new(vec![Default::default(); max as usize].into()) }

This comment has been minimized.

Copy link
@emilio

emilio Jul 5, 2018

Member

How big can max_vertex_attribs be vs. what it's used? May it be worth it to grow it lazily or something?

})
fn delete_buffer(&self, buffer: &WebGLBuffer) {
for attrib in &mut **self.attribs.borrow_mut() {
if attrib.1.as_ref().map_or(false, |b| b.id() == buffer.id()) {

This comment has been minimized.

Copy link
@emilio

emilio Jul 5, 2018

Member

Is there a find_mut or something of the sort?

if attrib.1.as_ref().map_or(false, |b| b.id() == buffer.id()) {
attrib.1 = None;
}
}
}

fn get(&self, index: u32) -> Option<Ref<WebGLBuffer>> {

This comment has been minimized.

Copy link
@emilio

emilio Jul 5, 2018

Member

A bunch of these should probably debug_assert!(index as usize < self.elements.borrow().len(), "Someone forgot to validate properly") or something of the sort, wdyt?

pub struct BoundAttribBuffers {
elements: DomRefCell<FnvHashMap<u32, (bool, Option<Dom<WebGLBuffer>>)>>,
pub struct VertexAttribs {
attribs: DomRefCell<Box<[(bool, Option<Dom<WebGLBuffer>>)]>>,

This comment has been minimized.

Copy link
@emilio

emilio Jul 5, 2018

Member

It may be worth a comment here mentioning that the slice contains as many attribute buffers as possible, that the bool represents whether it's enabled as an array (should it be converted to a binary enum?), and that the buffer can be None when removed.

@nox nox force-pushed the webgl branch from b2f7ac4 to 1538958 Jul 5, 2018
@nox
Copy link
Member Author

nox commented Jul 5, 2018

I added a comment about the small number of vertex attributes in high-end GPUs.

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

bors-servo commented Jul 5, 2018

📌 Commit 1538958 has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Jul 5, 2018

Testing commit 1538958 with merge c90737e...

bors-servo added a commit that referenced this pull request Jul 5, 2018
 Store vertex attribs data in DOM and optimise GetVertexAttrib

This is not an extremely useful change on its own but those things need to be stored on the DOM side to implement some draw checks anyway.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21118)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 5, 2018

💔 Test failed - mac-rel-wpt2

@nox
Copy link
Member Author

nox commented Jul 5, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jul 5, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jul 5, 2018

@bors-servo bors-servo merged commit 1538958 into master Jul 5, 2018
4 of 5 checks passed
4 of 5 checks passed
Taskcluster (pull_request) TaskGroup: Exception
Details
Tidelift Dependencies checked
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.