mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
mesa: check frambuffer complete status before rendering
This commit is contained in:
parent
8f8435637d
commit
fbf13bcb8a
1 changed files with 20 additions and 13 deletions
|
|
@ -78,6 +78,23 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type,
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GLboolean
|
||||||
|
check_valid_to_render(GLcontext *ctx, char *function)
|
||||||
|
{
|
||||||
|
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
|
||||||
|
"glDraw%s(incomplete framebuffer)", function);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Always need vertex positions, unless a vertex program is in use */
|
||||||
|
if (!ctx->VertexProgram._Current &&
|
||||||
|
!ctx->Array.ArrayObj->Vertex.Enabled &&
|
||||||
|
!ctx->Array.ArrayObj->VertexAttrib[0].Enabled)
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
GLboolean
|
GLboolean
|
||||||
_mesa_validate_DrawElements(GLcontext *ctx,
|
_mesa_validate_DrawElements(GLcontext *ctx,
|
||||||
|
|
@ -108,10 +125,7 @@ _mesa_validate_DrawElements(GLcontext *ctx,
|
||||||
if (ctx->NewState)
|
if (ctx->NewState)
|
||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
/* Always need vertex positions, unless a vertex program is in use */
|
if (!check_valid_to_render(ctx, "Elements"))
|
||||||
if (!ctx->VertexProgram._Current &&
|
|
||||||
!ctx->Array.ArrayObj->Vertex.Enabled &&
|
|
||||||
!ctx->Array.ArrayObj->VertexAttrib[0].Enabled)
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
/* Vertex buffer object tests */
|
/* Vertex buffer object tests */
|
||||||
|
|
@ -155,7 +169,6 @@ _mesa_validate_DrawElements(GLcontext *ctx,
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLboolean
|
GLboolean
|
||||||
_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
|
_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
|
||||||
GLuint start, GLuint end,
|
GLuint start, GLuint end,
|
||||||
|
|
@ -190,10 +203,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
|
||||||
if (ctx->NewState)
|
if (ctx->NewState)
|
||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
/* Always need vertex positions, unless a vertex program is in use */
|
if (!check_valid_to_render(ctx, "RangeElements"))
|
||||||
if (!ctx->VertexProgram._Current &&
|
|
||||||
!ctx->Array.ArrayObj->Vertex.Enabled &&
|
|
||||||
!ctx->Array.ArrayObj->VertexAttrib[0].Enabled)
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
/* Vertex buffer object tests */
|
/* Vertex buffer object tests */
|
||||||
|
|
@ -261,10 +271,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx,
|
||||||
if (ctx->NewState)
|
if (ctx->NewState)
|
||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
/* Always need vertex positions, unless a vertex program is in use */
|
if (!check_valid_to_render(ctx, "Arrays"))
|
||||||
if (!ctx->VertexProgram._Current &&
|
|
||||||
!ctx->Array.ArrayObj->Vertex.Enabled &&
|
|
||||||
!ctx->Array.ArrayObj->VertexAttrib[0].Enabled)
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
if (ctx->Const.CheckArrayBounds) {
|
if (ctx->Const.CheckArrayBounds) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue