mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 23:30:13 +01:00
mesa: Fix discard_framebuffer for fbo vs winsys
GL is annoying when it comes to having different enums for winsys vs fbo. Note that the issue this closes was only accidentially exposed by a change the resulted in sysmem vs GMEM path taken. Fixes:db2ae51121("mesa: Skip partial InvalidateFramebuffer of packed depth/stencil.") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6103 Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15308> (cherry picked from commitf4ec900953)
This commit is contained in:
parent
e16f7f458a
commit
e3ff6df798
2 changed files with 15 additions and 5 deletions
|
|
@ -364,7 +364,7 @@
|
|||
"description": "mesa: Fix discard_framebuffer for fbo vs winsys",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "db2ae51121067b66d4ee8313ba7f74cecb201a03"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5192,9 +5192,19 @@ static void
|
|||
discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
GLsizei numAttachments, const GLenum *attachments)
|
||||
{
|
||||
GLenum depth_att, stencil_att;
|
||||
|
||||
if (!ctx->Driver.DiscardFramebuffer)
|
||||
return;
|
||||
|
||||
if (_mesa_is_user_fbo(fb)) {
|
||||
depth_att = GL_DEPTH_ATTACHMENT;
|
||||
stencil_att = GL_STENCIL_ATTACHMENT;
|
||||
} else {
|
||||
depth_att = GL_DEPTH;
|
||||
stencil_att = GL_STENCIL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < numAttachments; i++) {
|
||||
struct gl_renderbuffer_attachment *att =
|
||||
get_fb_attachment(ctx, fb, attachments[i]);
|
||||
|
|
@ -5207,12 +5217,12 @@ discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
|||
* Driver.DiscardFramebuffer if the attachments list includes both depth
|
||||
* and stencil and they both point at the same renderbuffer.
|
||||
*/
|
||||
if ((attachments[i] == GL_DEPTH_ATTACHMENT ||
|
||||
attachments[i] == GL_STENCIL_ATTACHMENT) &&
|
||||
if ((attachments[i] == depth_att ||
|
||||
attachments[i] == stencil_att) &&
|
||||
(!att->Renderbuffer ||
|
||||
att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL)) {
|
||||
GLenum other_format = (attachments[i] == GL_DEPTH_ATTACHMENT ?
|
||||
GL_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT);
|
||||
GLenum other_format = (attachments[i] == depth_att ?
|
||||
stencil_att : depth_att);
|
||||
bool has_both = false;
|
||||
for (int j = 0; j < numAttachments; j++) {
|
||||
if (attachments[j] == other_format) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue