Skip to content

Use texture layers for render target allocations, remove render phases. #478

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

Merged
merged 1 commit into from
Oct 26, 2016

Conversation

glennw
Copy link
Member

@glennw glennw commented Oct 25, 2016

Instead of splitting the scene into multiple phases, use texture
layers to allocate slices as needed for each pass of the render
frame. These are pooled and only allocated when the frame render
target configuration changes.

Previously, the code asserted if it was unable to fit the render
tasks into a single render target for a single tile. Now, this
(pathological) case is handled correctly.

This makes the upcoming dynamic primitive cache support a lot
simpler to add. It also means that we don't use a ping-pong
allocation style, which typically performs badly on mobile / tiled
rendering architectures.


This change is Reviewable

@glennw
Copy link
Member Author

glennw commented Oct 25, 2016

r? @pcwalton

@glennw
Copy link
Member Author

glennw commented Oct 25, 2016

@pcwalton btw I tested this on mac mini hardware, since I know we've had troubles with driver stalls around texture / fbo allocs before. It seemed to be working nicely on my mac mini (and also on linux + osmesa).

vec2 st1 = vec2(src.screen_origin_task_origin.zw + src.size.xy) / 2048.0;
vUv = mix(st0, st1, aPosition.xy);
vec2 texture_size = vec2(textureSize(sCache, 0));
vec2 st0 = vec2(src.screen_origin_task_origin.zw) / texture_size;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Do you need the vec2() cast here and below?

vUv0 = mix(st0, st1, aPosition.xy);
vec2 texture_size = vec2(textureSize(sCache, 0));
vec2 st0 = vec2(src0.screen_origin_task_origin.zw) / texture_size;
vec2 st1 = vec2(src0.screen_origin_task_origin.zw + src0.size_target_index.xy) / texture_size;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about vec2() as above

@pcwalton
Copy link
Contributor

r=me with a couple of nits

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #445) made this pull request unmergeable. Please resolve the merge conflicts.

Instead of splitting the scene into multiple phases, use texture
layers to allocate slices as needed for each pass of the render
frame. These are pooled and only allocated when the frame render
target configuration changes.

Previously, the code asserted if it was unable to fit the render
tasks into a single render target for a single tile. Now, this
(pathological) case is handled correctly.

This makes the upcoming dynamic primitive cache support a lot
simpler to add. It also means that we don't use a ping-pong
allocation style, which typically performs badly on mobile / tiled
rendering architectures.
@pcwalton
Copy link
Contributor

@bors-servo: r+

@bors-servo
Copy link
Contributor

📌 Commit 8928181 has been approved by pcwalton

@bors-servo
Copy link
Contributor

⌛ Testing commit 8928181 with merge dcdc4d8...

bors-servo pushed a commit that referenced this pull request Oct 26, 2016
Use texture layers for render target allocations, remove render phases.

Instead of splitting the scene into multiple phases, use texture
layers to allocate slices as needed for each pass of the render
frame. These are pooled and only allocated when the frame render
target configuration changes.

Previously, the code asserted if it was unable to fit the render
tasks into a single render target for a single tile. Now, this
(pathological) case is handled correctly.

This makes the upcoming dynamic primitive cache support a lot
simpler to add. It also means that we don't use a ping-pong
allocation style, which typically performs badly on mobile / tiled
rendering architectures.

<!-- 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/478)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit 8928181 into servo:master Oct 26, 2016
@glennw glennw deleted the texture-layers branch October 26, 2016 01:47
let (internal_format, gl_format) = gl_texture_formats_for_image_format(texture.format);
let type_ = gl_type_for_texture_format(texture.format);

gl::tex_image_3d(texture_id.target,
Copy link
Member

Choose a reason for hiding this comment

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

This is concerning. I don't see the previous implementation actually reallocating the texture, like this one. Neither does the method name imply that the texture is going to be changed (create_fbo_for_texture_if_necessary).

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.

5 participants