From 434ec3ada841915a00ffc23f699401eb3e7b37ee Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 12 Aug 2009 13:46:16 -0600 Subject: mesa: use _mesa_is_bufferobj() --- src/mesa/main/api_validate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mesa/main/api_validate.c') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index b2f11ffbfe..33f4dd152a 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -24,6 +24,7 @@ #include "glheader.h" #include "api_validate.h" +#include "bufferobj.h" #include "context.h" #include "imports.h" #include "mtypes.h" @@ -62,7 +63,7 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, GLuint max = 0; GLuint i; - if (elementBuf->Name) { + if (_mesa_is_bufferobj(elementBuf)) { /* elements are in a user-defined buffer object. need to map it */ map = ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY, elementBuf); @@ -164,7 +165,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, return GL_FALSE; /* Vertex buffer object tests */ - if (ctx->Array.ElementArrayBufferObj->Name) { + if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { @@ -237,7 +238,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, return GL_FALSE; /* Vertex buffer object tests */ - if (ctx->Array.ElementArrayBufferObj->Name) { + if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { -- cgit v1.2.3 From a48b0a5ce7fc17eab4daa375fb95768fa2f50825 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 14 Aug 2009 10:41:03 -0600 Subject: mesa: minor error string changes --- src/mesa/main/api_validate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa/main/api_validate.c') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 33f4dd152a..0c6d9af4a8 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -100,11 +100,11 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, * Check if OK to render by examining framebuffer status and vertex arrays. */ static GLboolean -check_valid_to_render(GLcontext *ctx, char *function) +check_valid_to_render(GLcontext *ctx, const char *function) { if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, - "glDraw%s(incomplete framebuffer)", function); + "%s(incomplete framebuffer)", function); return GL_FALSE; } @@ -161,7 +161,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, if (ctx->NewState) _mesa_update_state(ctx); - if (!check_valid_to_render(ctx, "Elements")) + if (!check_valid_to_render(ctx, "glDrawElements")) return GL_FALSE; /* Vertex buffer object tests */ @@ -234,7 +234,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, if (ctx->NewState) _mesa_update_state(ctx); - if (!check_valid_to_render(ctx, "RangeElements")) + if (!check_valid_to_render(ctx, "glDrawRangeElements")) return GL_FALSE; /* Vertex buffer object tests */ @@ -290,7 +290,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx, if (ctx->NewState) _mesa_update_state(ctx); - if (!check_valid_to_render(ctx, "Arrays")) + if (!check_valid_to_render(ctx, "glDrawArrays")) return GL_FALSE; if (ctx->Const.CheckArrayBounds) { -- cgit v1.2.3 From b6e5600bd460245afef605dbfbcf6650ff677dcb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 14 Aug 2009 10:48:31 -0600 Subject: mesa: call _mesa_valid_to_render() --- src/mesa/main/api_validate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/mesa/main/api_validate.c') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 0c6d9af4a8..2df4f17389 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -97,14 +97,12 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, /** - * Check if OK to render by examining framebuffer status and vertex arrays. + * Check if OK to draw arrays/elements. */ static GLboolean check_valid_to_render(GLcontext *ctx, const char *function) { - if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, - "%s(incomplete framebuffer)", function); + if (!_mesa_valid_to_render(ctx, function)) { return GL_FALSE; } -- cgit v1.2.3