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 upUse an intermediate renderbuffer when blitting between texture arrays… #3327
Conversation
leeoniya
commented
Nov 19, 2018
|
good candidate for https://github.com/servo/webrender/wiki/Driver-issues ? |
|
@leeoniya Yep, definitely. |
|
Compile errors on CI (I didn't check the platforms / features causing it):
|
|
Texture.width/height got changed to Texture.size recently, but that hadn't made it to gecko yet. |
… on adreno devices When the texture cache is grown we allocate a larger texture array then copy each layer of the old array in to the new one. To perform this copy we use use glBlitFramebuffer, with the read and draw framebuffers bound to the correct layer in the old and new textures. Unfortunately on Adreno devices this does not work. glBlitFramebuffer always writes to the 0th layer of the texture bound to the draw framebuffer. glCopyTexSubImage3D also does not work correctly - it always reads from the 0th layer of the texture bound to the read framebuffer. As a workaround, we use glBlitFramebuffer to blit from the old texture in to a temporary renderbuffer, then use glCopyTexSubImage3D to copy from that renderbuffer to the new texture.
5be55f7
to
5b8be07
|
I have updated the wiki page to include this bug |
| let rbo = RBOId(self.gl.gen_renderbuffers(1)[0]); | ||
| let fbo = FBOId(self.gl.gen_framebuffers(1)[0]); | ||
| self.gl.bind_renderbuffer(gl::RENDERBUFFER, rbo.0); | ||
| self.gl.renderbuffer_storage(gl::RENDERBUFFER, gl::RGBA8, |
This comment has been minimized.
This comment has been minimized.
kvark
Nov 20, 2018
Member
how are we sure gl::RGBA8 is compatible with whatever texture we are blitting?
| self.bind_read_target_impl(*read_fbo); | ||
| self.bind_draw_target_impl(*draw_fbo); | ||
| self.bind_draw_target_impl(match &temp_buffer { |
This comment has been minimized.
This comment has been minimized.
| self.blit_render_target(rect, rect); | ||
|
|
||
| // Copy from the intermediate buffer to the dst texture if necessary | ||
| if let Some((_, fbo)) = &temp_buffer { |
This comment has been minimized.
This comment has been minimized.
kvark
Nov 20, 2018
Member
here and below: when matching we don't need the reference, instead we can avoid the fields moved out by marking them as Some((_, ref fbo)). IIRC, recent Rust inserts some of those ref automatically, but I'm not a big fan of that
| if let Some((_, fbo)) = &temp_buffer { | ||
| self.bind_read_target_impl(*fbo); | ||
| self.bind_texture(DEFAULT_TEXTURE, dst); | ||
| self.gl.copy_tex_sub_image_3d(dst.target, 0, 0, 0, i as _, |
This comment has been minimized.
This comment has been minimized.
kvark
Nov 20, 2018
Member
note that we have 2 bugs here covered by the same flag: inability to blit to layer != 0 and inability to copy from layer != 0. The flag name itself only reflects the first bug, which is a bit unclear.
|
For posterity: this patch fixes the issues on my Xperia XZ1 Compact (which has an Adreno 540) but doesn't fix the problems on my Xperia Z3 Compact (which has an Adreno 330). |
|
@staktrace do we know what other issues Adreno 330 has in addition to these? |
|
It's a little hard to tell which of the visible artifacts are caused by this issue and which are caused by other issues. Certainly fixing this issue on Adreno 540 results in much better behaviour, so either all the visible artifacts on the 330 are caused by this problem, or there's multiple problems that only affect the 330. I don't have a good sense for how likely that is. |
|
servo/servo#22232 is also fixed by this |
|
@kvark any progress on this being merged? it fixes a rather annoying Servo bug too. |
|
@Manishearth see #3338. |
|
|
|
If I understand correctly, this can be closed in favor of #3338. Please feel free to reopen otherwise! |
Update webrender Fixes #22232 , once servo/webrender#3327 lands and I update this PR to include it All the integer casts are due to servo/webrender#3291 <!-- 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/22237) <!-- Reviewable:end -->
Update webrender Fixes #22232 , once servo/webrender#3327 lands and I update this PR to include it All the integer casts are due to servo/webrender#3291 <!-- 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/22237) <!-- Reviewable:end -->
Update webrender Fixes #22232 , once servo/webrender#3327 lands and I update this PR to include it All the integer casts are due to servo/webrender#3291 <!-- 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/22237) <!-- Reviewable:end -->
Update webrender Fixes #22232 , once servo/webrender#3327 lands and I update this PR to include it All the integer casts are due to servo/webrender#3291 <!-- 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/22237) <!-- Reviewable:end -->
Update webrender Fixes #22232 , once servo/webrender#3327 lands and I update this PR to include it All the integer casts are due to servo/webrender#3291 <!-- 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/22237) <!-- Reviewable:end -->
Update webrender Fixes #22232 , once servo/webrender#3327 lands and I update this PR to include it All the integer casts are due to servo/webrender#3291 <!-- 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/22237) <!-- Reviewable:end -->
Update webrender Fixes #22232 , once servo/webrender#3327 lands and I update this PR to include it All the integer casts are due to servo/webrender#3291 <!-- 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/22237) <!-- Reviewable:end -->
jamienicol commentedNov 19, 2018
•
edited by larsbergstrom
… on adreno devices
When the texture cache is grown we allocate a larger texture array
then copy each layer of the old array in to the new one. To perform
this copy we use use glBlitFramebuffer, with the read and draw
framebuffers bound to the correct layer in the old and new textures.
Unfortunately on Adreno devices this does not work. glBlitFramebuffer
always writes to the 0th layer of the texture bound to the draw
framebuffer. glCopyTexSubImage3D also does not work correctly - it
always reads from the 0th layer of the texture bound to the read
framebuffer.
As a workaround, we use glBlitFramebuffer to blit from the old texture
in to a temporary renderbuffer, then use glCopyTexSubImage3D to copy
from that renderbuffer to the new texture.
This change is