From 8d50d425145d0cb902a177e7cecf38824baca863 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Fri, 24 Jan 2025 21:17:01 +0000 Subject: [PATCH] mesa: Fix FramebufferTextureMultiviewOVR num_views check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check in check_multiview_texture_target() whether numViews <= 0 (as required by the OVR_multiview spec) is never triggered since it is only called by frame_buffer_texture() when numviews > 1, as numviews of 0 is passed in by non multiview FramebufferTexture functions. Such cases are incorrectly treated as non-multiview attachments. Tweak frame_buffer_texture() to take an extra bool argument "multiview" to distinguish between a multiview call with numviews=0, and a non-multiview call. Fixes: 328c29d6007 ("mesa,glsl,gallium: add GL_OVR_multiview") Signed-off-by: James Hogan Reviewed-By: Mike Blumenkrantz Reviewed-by: Zoltán Böszörményi Part-of: (cherry picked from commit 7f493b45ae8e0c671fb52214a011fa2f0322a728) --- .pick_status.json | 2 +- src/mesa/main/fbobject.c | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a21e207019c..463b2b50cd3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -64,7 +64,7 @@ "description": "mesa: Fix FramebufferTextureMultiviewOVR num_views check", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "328c29d6007ed7677d5c5307bd6997d84a32104a", "notes": null diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 4b549cfa7c0..dc805f1cee9 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -4223,7 +4223,8 @@ static ALWAYS_INLINE void frame_buffer_texture(GLuint framebuffer, GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint layer, const char *func, - bool dsa, bool no_error, bool check_layered, GLsizei numviews) + bool dsa, bool no_error, bool check_layered, bool multiview, + GLsizei numviews) { GET_CURRENT_CONTEXT(ctx); GLboolean layered = GL_FALSE; @@ -4284,7 +4285,7 @@ frame_buffer_texture(GLuint framebuffer, GLenum target, return; } - if (numviews > 1) { + if (multiview) { /* We do this regardless of no_error because this sets multiviews */ if (!check_multiview_texture_target(ctx, texture, texObj->Target, level, layer, numviews, func)) { @@ -4344,7 +4345,7 @@ _mesa_FramebufferTextureLayer_no_error(GLenum target, GLenum attachment, GLint layer) { frame_buffer_texture(0, target, attachment, texture, level, 0, layer, - "glFramebufferTextureLayer", false, true, false, 0); + "glFramebufferTextureLayer", false, true, false, false, 0); } @@ -4353,7 +4354,7 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) { frame_buffer_texture(0, target, attachment, texture, level, 0, layer, - "glFramebufferTextureLayer", false, false, false, 0); + "glFramebufferTextureLayer", false, false, false, false, 0); } @@ -4364,7 +4365,7 @@ _mesa_NamedFramebufferTextureLayer_no_error(GLuint framebuffer, GLint layer) { frame_buffer_texture(framebuffer, 0, attachment, texture, level, 0, layer, - "glNamedFramebufferTextureLayer", true, true, false, 0); + "glNamedFramebufferTextureLayer", true, true, false, false, 0); } @@ -4373,7 +4374,7 @@ _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer) { frame_buffer_texture(framebuffer, 0, attachment, texture, level, 0, layer, - "glNamedFramebufferTextureLayer", true, false, false, 0); + "glNamedFramebufferTextureLayer", true, false, false, false, 0); } @@ -4383,7 +4384,7 @@ _mesa_FramebufferTextureMultiviewOVR_no_error(GLenum target, GLenum attachment, GLint baseViewIndex, GLsizei numViews) { frame_buffer_texture(0, target, attachment, texture, level, 0, baseViewIndex, - "glFramebufferTexture", false, true, false, numViews); + "glFramebufferTexture", false, true, false, true, numViews); } @@ -4393,7 +4394,7 @@ _mesa_FramebufferTextureMultiviewOVR(GLenum target, GLenum attachment, GLint baseViewIndex, GLsizei numViews) { frame_buffer_texture(0, target, attachment, texture, level, 0, baseViewIndex, - "glFramebufferTexture", false, false, false, numViews); + "glFramebufferTexture", false, false, false, true, numViews); } @@ -4403,7 +4404,7 @@ _mesa_FramebufferTextureMultisampleMultiviewOVR_no_error(GLenum target, GLenum a GLint baseViewIndex, GLsizei numViews) { frame_buffer_texture(0, target, attachment, texture, level, samples, baseViewIndex, - "FramebufferTextureMultisampleMultiviewOVR", false, true, false, numViews); + "FramebufferTextureMultisampleMultiviewOVR", false, true, false, true, numViews); } @@ -4413,7 +4414,7 @@ _mesa_FramebufferTextureMultisampleMultiviewOVR(GLenum target, GLenum attachment GLint baseViewIndex, GLsizei numViews) { frame_buffer_texture(0, target, attachment, texture, level, samples, baseViewIndex, - "FramebufferTextureMultisampleMultiviewOVR", false, false, false, numViews); + "FramebufferTextureMultisampleMultiviewOVR", false, false, false, true, numViews); } @@ -4423,7 +4424,7 @@ _mesa_NamedFramebufferTextureMultiviewOVR_no_error(GLuint framebuffer, GLenum at GLint baseViewIndex, GLsizei numViews) { frame_buffer_texture(framebuffer, 0, attachment, texture, level, 0, baseViewIndex, - "glFramebufferTexture", true, true, false, numViews); + "glFramebufferTexture", true, true, false, true, numViews); } @@ -4433,7 +4434,7 @@ _mesa_NamedFramebufferTextureMultiviewOVR(GLuint framebuffer, GLenum attachment, GLint baseViewIndex, GLsizei numViews) { frame_buffer_texture(framebuffer, 0, attachment, texture, level, 0, baseViewIndex, - "glFramebufferTexture", true, false, false, numViews); + "glFramebufferTexture", true, false, false, true, numViews); } @@ -4442,7 +4443,7 @@ _mesa_FramebufferTexture_no_error(GLenum target, GLenum attachment, GLuint texture, GLint level) { frame_buffer_texture(0, target, attachment, texture, level, 0, 0, - "glFramebufferTexture", false, true, true, 0); + "glFramebufferTexture", false, true, true, false, 0); } @@ -4451,7 +4452,7 @@ _mesa_FramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level) { frame_buffer_texture(0, target, attachment, texture, level, 0, 0, - "glFramebufferTexture", false, false, true, 0); + "glFramebufferTexture", false, false, true, false, 0); } void GLAPIENTRY @@ -4459,7 +4460,7 @@ _mesa_NamedFramebufferTexture_no_error(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) { frame_buffer_texture(framebuffer, 0, attachment, texture, level, 0, 0, - "glNamedFramebufferTexture", true, true, true, 0); + "glNamedFramebufferTexture", true, true, true, false, 0); } @@ -4468,7 +4469,7 @@ _mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level) { frame_buffer_texture(framebuffer, 0, attachment, texture, level, 0, 0, - "glNamedFramebufferTexture", true, false, true, 0); + "glNamedFramebufferTexture", true, false, true, false, 0); }