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
Should textures be cleared #235
Comments
/agenda should we update the spec so texture are always cleared when calling getSubImage/getViewSubImage |
So, the issue is that there is no obvious moment of time when the textures could be cleared or even invalidated. The current frame flow is as follows:
Note, the layer's color textures got detached from FBO after the frame is finished. Thus, the question is: where exactly the clear should occur (if at all)? We can't clear it till the texture is attached to an FBO, but do we change the behavior of framebufferTexture2D? |
@jdashg what do you think? |
Spec that the textures returned by getViewSubImage are cleared/uninitialized (like other uninitialized webgl resources), which allows the implementations to do lazy clearing on draw, as we already do for all other webgl resources. Don't worry about clearColor, as our implementations already handle this for textures, ensuring that textures are cleared to proper zero values regardless of the userland clearColor state. |
@jdashg when EXACTLY do you clear / uninit the texture? At the first rendering attempt (i.e. the same as what happens when invalidateFramebuffer is called)? |
Yes: It's an implementation detail, but generally just-in-time before the first draw to the resource. It's analogous architecturally to VK_ATTACHMENT_LOAD_OP_CLEAR. |
got it |
It seems we are all in agreement that textures should be cleared. I'll close this issue. |
The spec doesn't call out that opaque textures should be cleared by the author prior to their use.
We recently updated our code so opaque textures follow the spec language but are now wondering if that is the correct behavior.
According to @Artyom17, this might be tricky because a texture needs to be bound for it to clear.
The text was updated successfully, but these errors were encountered: