mesa: queries of non-existent FBO attachments should return INVALID_OPERATION
OpenGL 4.0 Compatibility, page 449: If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, no framebuffer is bound to target. In this case querying pname FRAMEBUFFER_- ATTACHMENT_OBJECT_NAME will return zero, and all other queries will generate an INVALID_OPERATION error. Reviewed-by: Chad Versace <chad@chad-versace.us>
This commit is contained in:
parent
d69dc2e203
commit
b9e9df78a0
|
@ -2161,6 +2161,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||||
if (att->Type == GL_TEXTURE) {
|
if (att->Type == GL_TEXTURE) {
|
||||||
*params = att->TextureLevel;
|
*params = att->TextureLevel;
|
||||||
}
|
}
|
||||||
|
else if (att->Type == GL_NONE) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
@ -2175,6 +2179,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||||
*params = 0;
|
*params = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (att->Type == GL_NONE) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
@ -2189,6 +2197,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||||
*params = 0;
|
*params = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (att->Type == GL_NONE) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
@ -2199,6 +2211,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
}
|
}
|
||||||
|
else if (att->Type == GL_NONE) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (ctx->Extensions.EXT_framebuffer_sRGB && ctx->Const.sRGBCapable) {
|
if (ctx->Extensions.EXT_framebuffer_sRGB && ctx->Const.sRGBCapable) {
|
||||||
*params = _mesa_get_format_color_encoding(att->Renderbuffer->Format);
|
*params = _mesa_get_format_color_encoding(att->Renderbuffer->Format);
|
||||||
|
@ -2216,6 +2232,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||||
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (att->Type == GL_NONE) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
gl_format format = att->Renderbuffer->Format;
|
gl_format format = att->Renderbuffer->Format;
|
||||||
if (format == MESA_FORMAT_CI8 || format == MESA_FORMAT_S8) {
|
if (format == MESA_FORMAT_CI8 || format == MESA_FORMAT_S8) {
|
||||||
|
@ -2237,6 +2257,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
}
|
}
|
||||||
|
else if (att->Type == GL_NONE) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
|
"glGetFramebufferAttachmentParameterivEXT(pname)");
|
||||||
|
}
|
||||||
else if (att->Texture) {
|
else if (att->Texture) {
|
||||||
const struct gl_texture_image *texImage =
|
const struct gl_texture_image *texImage =
|
||||||
_mesa_select_tex_image(ctx, att->Texture, att->Texture->Target,
|
_mesa_select_tex_image(ctx, att->Texture, att->Texture->Target,
|
||||||
|
@ -2254,7 +2278,8 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||||
att->Renderbuffer->Format);
|
att->Renderbuffer->Format);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*params = 0;
|
_mesa_problem(ctx, "glGetFramebufferAttachmentParameterivEXT:"
|
||||||
|
" invalid FBO attachment structure");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue