mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
ec03357e88
This adds a buffer method to map a subregion of the buffer. This works using the GL_ARB_map_buffer_range extension. If the extension is not available then it will fallback to using glMapBuffer to map the entire buffer and then just add the offset to the returned pointer. cogl_buffer_map() is now just a wrapper which maps the entire range of the buffer. The driver backend functions have been renamed to map_range and they now all take the offset and size arguments. When the COGL_BUFFER_MAP_HINT_DISCARD hint is used and the map range extension is available instead of using glBufferData to invalidate the buffer it will instead pass the new GL_MAP_HINT_INVALIDATE_BUFFER flag. There is now additionally a COGL_BUFFER_MAP_HINT_DISCARD_REGION hint which can be used if the application only wants to discard the small region that is mapped. glMapBufferRange is always used if it is available even if the entire buffer is being mapped because it seems more robust to pass those flags then to call glBufferData. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 55ca02b5ca9cafc750251ec974e0d6a536cb80b8)
65 lines
1.8 KiB
C
65 lines
1.8 KiB
C
/*
|
|
* Cogl
|
|
*
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
*
|
|
* Copyright (C) 2012 Intel Corporation.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
*
|
|
* Authors:
|
|
* Robert Bragg <robert@linux.intel.com>
|
|
*/
|
|
|
|
#ifndef _COGL_BUFFER_GL_PRIVATE_H_
|
|
#define _COGL_BUFFER_GL_PRIVATE_H_
|
|
|
|
#include "cogl-types.h"
|
|
#include "cogl-context.h"
|
|
#include "cogl-buffer.h"
|
|
#include "cogl-buffer-private.h"
|
|
|
|
void
|
|
_cogl_buffer_gl_create (CoglBuffer *buffer);
|
|
|
|
void
|
|
_cogl_buffer_gl_destroy (CoglBuffer *buffer);
|
|
|
|
void *
|
|
_cogl_buffer_gl_map_range (CoglBuffer *buffer,
|
|
size_t offset,
|
|
size_t size,
|
|
CoglBufferAccess access,
|
|
CoglBufferMapHint hints);
|
|
|
|
void
|
|
_cogl_buffer_gl_unmap (CoglBuffer *buffer);
|
|
|
|
CoglBool
|
|
_cogl_buffer_gl_set_data (CoglBuffer *buffer,
|
|
unsigned int offset,
|
|
const void *data,
|
|
unsigned int size);
|
|
|
|
void *
|
|
_cogl_buffer_gl_bind (CoglBuffer *buffer, CoglBufferBindTarget target);
|
|
|
|
void
|
|
_cogl_buffer_gl_unbind (CoglBuffer *buffer);
|
|
|
|
#endif /* _COGL_BUFFER_GL_PRIVATE_H_ */
|