Skip to content

Conversation

@pmuetschard
Copy link
Member

Depth textures, and framebuffers backed by depth textures, that where created with an unsized internal format require special handling when read back from the GPU. For example, when blitting a FB, the source and target formats will have to match and thus have to both be created with a sized or unsized internal format.

Fixes #2584

A 32bit depth and 8bit stencil buffer has format GL_DEPTH32F_STENCIL8.
GLES does not actually have `GL_DEPTH_COMPONENT32`. Instead,
`GL_DEPTH_COMPONENT` with `GL_UNSIGNED_INT` is actually a
`GL_DEPTH_COMPONENT24` format.
Adds the internal format, as specified by the application, to the `Image`
struct. This field is only maintained for texture images and represents
the internal format as specified by the application and may thus be
unsized (GLES2) or sized (GLES3).

This is primarily required for reading the data back from the GPU, as
there are limitations when using GLES2 type texture specification.
Depth textures, and framebuffers backed by depth textures, that where
created with an unsized internal format require special handling when
read back from the GPU. For example, when blitting a FB, the source and
target formats will have to match and thus have to both be created with
a sized or unsized internal format.

Fixes google#2584
@pmuetschard
Copy link
Member Author

Note that the field added in 60bef28 is only used in one place in this PR, but will need to be used in other places as well. For example, my test app for this doesn't replay correctly in MEC, due to the fact that you can use GL_LINEAR for depth textures with an unsized internal format, while for sized internal format textures you are required to use GL_NEAREST. MEC replay, currently, always re-creates the textures using a sized internal format. See #2653

@pmuetschard pmuetschard merged commit 9c2c8bd into google:master Mar 7, 2019
@pmuetschard pmuetschard deleted the depth branch March 7, 2019 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants