summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-10 12:24:38 -0600
committerBrian <[email protected]>2007-08-10 13:03:57 -0600
commit48f853f73f7bb46e8c977e551fd66a39e50935ee (patch)
tree89d3061ce65bdf1c6047992d78b7adb2c64ea73a
parent5c2c05600081f811e001a81a600778de0fcab85d (diff)
minor clean-ups
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 78fc18a49ad..9e407de34f6 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -1,6 +1,6 @@
/**************************************************************************
*
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -26,9 +26,9 @@
**************************************************************************/
-#include "imports.h"
-#include "mtypes.h"
-#include "bufferobj.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
+#include "main/bufferobj.h"
#include "st_context.h"
#include "st_cb_bufferobjects.h"
@@ -57,6 +57,9 @@ st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target)
struct st_context *st = st_context(ctx);
struct st_buffer_object *st_obj = CALLOC_STRUCT(st_buffer_object);
+ if (!st_obj)
+ return NULL;
+
_mesa_initialize_buffer_object(&st_obj->Base, name, target);
st_obj->buffer = st->pipe->create_buffer( st->pipe, 32, 0 );
@@ -79,7 +82,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
if (st_obj->buffer)
pipe->buffer_unreference(pipe, &st_obj->buffer);
- FREE(st_obj);
+ free(st_obj);
}
@@ -133,10 +136,10 @@ st_bufferobj_subdata(GLcontext *ctx,
*/
static void
st_bufferobj_get_subdata(GLcontext *ctx,
- GLenum target,
- GLintptrARB offset,
- GLsizeiptrARB size,
- GLvoid * data, struct gl_buffer_object *obj)
+ GLenum target,
+ GLintptrARB offset,
+ GLsizeiptrARB size,
+ GLvoid * data, struct gl_buffer_object *obj)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
@@ -145,14 +148,12 @@ st_bufferobj_get_subdata(GLcontext *ctx,
}
-
/**
* Called via glMapBufferARB().
*/
static void *
-st_bufferobj_map(GLcontext *ctx,
- GLenum target,
- GLenum access, struct gl_buffer_object *obj)
+st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
+ struct gl_buffer_object *obj)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
@@ -162,12 +163,11 @@ st_bufferobj_map(GLcontext *ctx,
case GL_WRITE_ONLY:
flags = PIPE_BUFFER_FLAG_WRITE;
break;
-
case GL_READ_ONLY:
flags = PIPE_BUFFER_FLAG_READ;
break;
-
case GL_READ_WRITE:
+ /* fall-through */
default:
flags = PIPE_BUFFER_FLAG_READ | PIPE_BUFFER_FLAG_WRITE;
break;
@@ -182,8 +182,7 @@ st_bufferobj_map(GLcontext *ctx,
* Called via glMapBufferARB().
*/
static GLboolean
-st_bufferobj_unmap(GLcontext *ctx,
- GLenum target, struct gl_buffer_object *obj)
+st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);