break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "gl%s(target)", str);
- break;
+ return NULL;
}
if (bufObj->Name == 0)
return NULL;
}
- if ( (offset + size) > bufObj->Size ) {
+ if ( (GLuint)(offset + size) > bufObj->Size ) {
_mesa_error(ctx, GL_INVALID_VALUE,
"%s(size + offset > buffer size)", str);
return NULL;
new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
if ( new_data != NULL ) {
- bufObj->Data = new_data;
+ bufObj->Data = (GLubyte *) new_data;
bufObj->Size = size;
bufObj->Usage = usage;
struct gl_buffer_object * bufObj )
{
if ( (bufObj->Data != NULL)
- && ((size + offset) <= bufObj->Size) ) {
+ && ((GLuint)(size + offset) <= bufObj->Size) ) {
_mesa_memcpy( (GLubyte *) bufObj->Data + offset, data, size );
}
}
struct gl_buffer_object * bufObj )
{
if ( (bufObj->Data != NULL)
- && ((size + offset) <= bufObj->Size) ) {
+ && ((GLuint)(size + offset) <= bufObj->Size) ) {
_mesa_memcpy( data, (GLubyte *) bufObj->Data + offset, size );
}
}
/* API Functions */
/**********************************************************************/
-void
+void GLAPIENTRY
_mesa_BindBufferARB(GLenum target, GLuint buffer)
{
GET_CURRENT_CONTEXT(ctx);
* \param n Number of buffer objects to delete.
* \param buffer Array of \c n buffer object IDs.
*/
-void
+void GLAPIENTRY
_mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
{
GET_CURRENT_CONTEXT(ctx);
- unsigned i;
+ GLsizei i;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
* \param n Number of IDs to generate.
* \param buffer Array of \c n locations to store the IDs.
*/
-void
+void GLAPIENTRY
_mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
{
GET_CURRENT_CONTEXT(ctx);
* \return \c GL_TRUE if \c id is the name of a buffer object,
* \c GL_FALSE otherwise.
*/
-GLboolean
+GLboolean GLAPIENTRY
_mesa_IsBufferARB(GLuint id)
{
struct gl_buffer_object * bufObj;
}
-void
+void GLAPIENTRY
_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
const GLvoid * data, GLenum usage)
{
}
if (bufObj->Pointer) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB(buffer is mapped)" );
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" );
return;
}
}
-void
+void GLAPIENTRY
_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid * data)
{
ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
- "glBufferSubDataARB" );
+ "BufferSubDataARB" );
if (!bufObj) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB" );
return;
}
-void
+void GLAPIENTRY
_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset,
GLsizeiptrARB size, void * data)
{
ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
- "glGetBufferSubDataARB" );
+ "GetBufferSubDataARB" );
if (!bufObj) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferSubDataARB" );
return;
}
-void *
+void * GLAPIENTRY
_mesa_MapBufferARB(GLenum target, GLenum access)
{
GET_CURRENT_CONTEXT(ctx);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)");
}
+ bufObj->Access = access;
+
return bufObj->Pointer;
}
-GLboolean
+GLboolean GLAPIENTRY
_mesa_UnmapBufferARB(GLenum target)
{
GET_CURRENT_CONTEXT(ctx);
GLboolean status = GL_TRUE;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
bufObj = buffer_object_get_target( ctx, target, "UnmapBufferARB" );
if ( bufObj == NULL ) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB" );
status = (*ctx->Driver.UnmapBuffer)( ctx, target, bufObj );
}
+ bufObj->Access = GL_READ_WRITE_ARB; /* initial value, OK? */
bufObj->Pointer = NULL;
return status;
}
-void
+void GLAPIENTRY
_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
}
-void
+void GLAPIENTRY
_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
{
GET_CURRENT_CONTEXT(ctx);