/**************************************************************************
*
- * 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
**************************************************************************/
-#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"
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 );
if (st_obj->buffer)
pipe->buffer_unreference(pipe, &st_obj->buffer);
- FREE(st_obj);
+ free(st_obj);
}
*/
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);
}
-
/**
* 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);
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;
* 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);