mesa: Fix FramebufferTextureMultiviewOVR num_views check

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: 328c29d600 ("mesa,glsl,gallium: add GL_OVR_multiview")
Signed-off-by: James Hogan <james@albanarts.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33346>
This commit is contained in:
James Hogan 2025-01-24 21:17:01 +00:00 committed by Marge Bot
parent 39491da1b6
commit 7f493b45ae

View file

@ -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);
}