mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 22:20:09 +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>
This commit is contained in:
parent
d5d8519cb5
commit
f4ec900953
1 changed files with 14 additions and 4 deletions
|
|
@ -5383,6 +5383,16 @@ static void
|
|||
discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
GLsizei numAttachments, const GLenum *attachments)
|
||||
{
|
||||
GLenum depth_att, stencil_att;
|
||||
|
||||
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]);
|
||||
|
|
@ -5395,12 +5405,12 @@ discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
|||
* 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