Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py1
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c11
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c9
-rw-r--r--source/blender/editors/interface/resources.c4
-rw-r--r--source/blender/gpu/GPU_buffers.h4
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c327
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c26
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp7
9 files changed, 99 insertions, 292 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 1259e743152..bee9d849bad 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -461,7 +461,6 @@ class USERPREF_PT_system(Panel):
col.label(text="Anisotropic Filtering")
col.prop(system, "anisotropic_filter", text="")
- col.prop(system, "use_vertex_buffer_objects")
col.separator()
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index be4f0011e97..b925094d392 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -665,7 +665,7 @@ static void cdDM_drawMappedFaces(
else
me = userData;
- findex_buffer = GPU_buffer_alloc(dm->drawObject->tot_loop_verts * sizeof(int), false);
+ findex_buffer = GPU_buffer_alloc(dm->drawObject->tot_loop_verts * sizeof(int));
fi_map = GPU_buffer_lock(findex_buffer, GPU_BINDING_ARRAY);
if (fi_map) {
@@ -898,9 +898,7 @@ static void cdDM_drawMappedFacesGLSL(
glShadeModel(GL_SMOOTH);
- /* workaround for NVIDIA GPUs on Mac not supporting vertex arrays + interleaved formats, see T43342 */
- if ((GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_MAC, GPU_DRIVER_ANY) && (U.gameflags & USER_DISABLE_VBO)) ||
- setDrawOptions != NULL)
+ if (setDrawOptions != NULL)
{
DMVertexAttribs attribs;
DEBUG_VBO("Using legacy code. cdDM_drawMappedFacesGLSL\n");
@@ -1037,11 +1035,8 @@ static void cdDM_drawMappedFacesGLSL(
/* part two, generate and fill the arrays with the data */
if (max_element_size > 0) {
- buffer = GPU_buffer_alloc(max_element_size * dm->drawObject->tot_loop_verts, false);
+ buffer = GPU_buffer_alloc(max_element_size * dm->drawObject->tot_loop_verts);
- if (buffer == NULL) {
- buffer = GPU_buffer_alloc(max_element_size * dm->drawObject->tot_loop_verts, true);
- }
varray = GPU_buffer_lock_stream(buffer, GPU_BINDING_ARRAY);
if (varray == NULL) {
GPU_buffers_unbind();
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 5814a06bb9f..b7742d82991 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2808,9 +2808,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
CCG_key_top_level(&key, ss);
ccgdm_pbvh_update(ccgdm);
- /* workaround for NVIDIA GPUs on Mac not supporting vertex arrays + interleaved formats, see T43342 */
- if ((GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_MAC, GPU_DRIVER_ANY) && (U.gameflags & USER_DISABLE_VBO)) ||
- setDrawOptions != NULL)
+ if (setDrawOptions != NULL)
{
const float (*lnors)[3] = dm->getLoopDataArray(dm, CD_NORMAL);
DMVertexAttribs attribs = {{{NULL}}};
@@ -3029,11 +3027,8 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
/* part two, generate and fill the arrays with the data */
if (max_element_size > 0) {
- buffer = GPU_buffer_alloc(max_element_size * dm->drawObject->tot_loop_verts, false);
+ buffer = GPU_buffer_alloc(max_element_size * dm->drawObject->tot_loop_verts);
- if (buffer == NULL) {
- buffer = GPU_buffer_alloc(max_element_size * dm->drawObject->tot_loop_verts, true);
- }
varray = GPU_buffer_lock_stream(buffer, GPU_BINDING_ARRAY);
if (varray == NULL) {
GPU_buffers_unbind();
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 92ef0d0ab37..294aa6ce2ac 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1939,10 +1939,6 @@ void init_userdef_do_versions(void)
if (U.audiorate == 0)
U.audiorate = 44100;
}
-
- if (!USER_VERSION_ATLEAST(250, 3)) {
- U.gameflags |= USER_DISABLE_VBO;
- }
if (!USER_VERSION_ATLEAST(250, 8)) {
wmKeyMap *km;
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index e653af0c7ec..9c67f404a12 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -54,9 +54,7 @@ struct MVert;
typedef struct GPUBuffer {
size_t size; /* in bytes */
- void *pointer; /* used with vertex arrays */
unsigned int id; /* used with vertex buffer objects */
- bool use_vbo; /* true for VBOs, false for vertex arrays */
} GPUBuffer;
typedef struct GPUBufferMaterial {
@@ -156,7 +154,7 @@ typedef struct GPUAttrib {
void GPU_global_buffer_pool_free(void);
void GPU_global_buffer_pool_free_unused(void);
-GPUBuffer *GPU_buffer_alloc(size_t size, bool force_vertex_arrays);
+GPUBuffer *GPU_buffer_alloc(size_t size);
void GPU_buffer_free(GPUBuffer *buffer);
void GPU_drawobject_free(struct DerivedMesh *dm);
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index eeefa92dc78..69aca31e21a 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -209,10 +209,7 @@ static void gpu_buffer_pool_delete_last(GPUBufferPool *pool)
return;
/* delete the buffer's data */
- if (last->use_vbo)
- glDeleteBuffers(1, &last->id);
- else
- MEM_freeN(last->pointer);
+ glDeleteBuffers(1, &last->id);
/* delete the buffer and remove from pool */
MEM_freeN(last);
@@ -273,7 +270,7 @@ void GPU_global_buffer_pool_free_unused(void)
*
* Thread-unsafe version for internal usage only.
*/
-static GPUBuffer *gpu_buffer_alloc_intern(size_t size, bool use_VBO)
+static GPUBuffer *gpu_buffer_alloc_intern(size_t size)
{
GPUBufferPool *pool;
GPUBuffer *buf;
@@ -298,11 +295,6 @@ static GPUBuffer *gpu_buffer_alloc_intern(size_t size, bool use_VBO)
* twice as big */
for (i = 0; i < pool->totbuf; i++) {
bufsize = pool->buffers[i]->size;
-
- /* only return a buffer that matches the VBO preference */
- if (pool->buffers[i]->use_vbo != use_VBO) {
- continue;
- }
/* check for an exact size match */
if (bufsize == size) {
@@ -332,45 +324,19 @@ static GPUBuffer *gpu_buffer_alloc_intern(size_t size, bool use_VBO)
/* no acceptable buffer found in the pool, create a new one */
buf = MEM_callocN(sizeof(GPUBuffer), "GPUBuffer");
buf->size = size;
- buf->use_vbo = use_VBO;
-
- if (use_VBO) {
- /* create a new VBO and initialize it to the requested
- * size */
- glGenBuffers(1, &buf->id);
- glBindBuffer(GL_ARRAY_BUFFER, buf->id);
- glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- }
- else {
- static int time = 0;
-
- buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer");
- time++;
- /* purpose of this seems to be dealing with
- * out-of-memory errors? looks a bit iffy to me
- * though, at least on Linux I expect malloc() would
- * just overcommit. --nicholas */
- while (!buf->pointer && pool->totbuf > 0) {
- gpu_buffer_pool_delete_last(pool);
- buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer");
- }
- if (!buf->pointer) {
- MEM_freeN(buf);
- return NULL;
- }
- }
+ glGenBuffers(1, &buf->id);
+ glBindBuffer(GL_ARRAY_BUFFER, buf->id);
+ glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
return buf;
}
/* Same as above, but safe for threading. */
-GPUBuffer *GPU_buffer_alloc(size_t size, bool force_vertex_arrays)
+GPUBuffer *GPU_buffer_alloc(size_t size)
{
GPUBuffer *buffer;
- bool use_VBOs = !(U.gameflags & USER_DISABLE_VBO) && !force_vertex_arrays;
- /* TODO: remove USER_DISABLE_VBO from user prefs */
if (size == 0) {
/* Early out, no lock needed in this case. */
@@ -378,7 +344,7 @@ GPUBuffer *GPU_buffer_alloc(size_t size, bool force_vertex_arrays)
}
BLI_mutex_lock(&buffer_mutex);
- buffer = gpu_buffer_alloc_intern(size, use_VBOs);
+ buffer = gpu_buffer_alloc_intern(size);
BLI_mutex_unlock(&buffer_mutex);
return buffer;
@@ -453,8 +419,6 @@ void GPU_buffer_multires_free(bool force)
if (mres_glob_buffer) {
if (mres_glob_buffer->id)
glDeleteBuffers(1, &mres_glob_buffer->id);
- else if (mres_glob_buffer->pointer)
- MEM_freeN(mres_glob_buffer->pointer);
MEM_freeN(mres_glob_buffer);
}
}
@@ -503,7 +467,7 @@ void GPU_drawobject_free(DerivedMesh *dm)
dm->drawObject = NULL;
}
-static GPUBuffer *gpu_try_realloc(GPUBufferPool *pool, GPUBuffer *buffer, size_t size, bool use_VBOs)
+static GPUBuffer *gpu_try_realloc(GPUBufferPool *pool, GPUBuffer *buffer, size_t size)
{
/* try freeing an entry from the pool
* and reallocating the buffer */
@@ -513,7 +477,7 @@ static GPUBuffer *gpu_try_realloc(GPUBufferPool *pool, GPUBuffer *buffer, size_t
while (pool->totbuf && !buffer) {
gpu_buffer_pool_delete_last(pool);
- buffer = gpu_buffer_alloc_intern(size, use_VBOs);
+ buffer = gpu_buffer_alloc_intern(size);
}
return buffer;
@@ -530,8 +494,6 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
const GPUBufferTypeSettings *ts = &gpu_buffer_type_settings[type];
GLenum target = ts->gl_buffer_type;
size_t size = gpu_buffer_size_from_type(dm, type);
- bool use_VBOs = !(U.gameflags & USER_DISABLE_VBO);
- /* TODO: remove USER_DISABLE_VBO from user prefs */
GLboolean uploaded;
pool = gpu_get_global_buffer_pool();
@@ -539,7 +501,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
BLI_mutex_lock(&buffer_mutex);
/* alloc a GPUBuffer; fall back to legacy mode on failure */
- if (!(buffer = gpu_buffer_alloc_intern(size, use_VBOs))) {
+ if (!(buffer = gpu_buffer_alloc_intern(size))) {
BLI_mutex_unlock(&buffer_mutex);
return NULL;
}
@@ -552,56 +514,34 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
mat_orig_to_new[object->materials[i].mat_nr] = i;
}
- if (use_VBOs) {
- bool success = false;
+ /* bind the buffer and discard previous data,
+ * avoids stalling gpu */
+ glBindBuffer(target, buffer->id);
+ glBufferData(target, buffer->size, NULL, GL_STATIC_DRAW);
- while (!success) {
- /* bind the buffer and discard previous data,
- * avoids stalling gpu */
- glBindBuffer(target, buffer->id);
- glBufferData(target, buffer->size, NULL, GL_STATIC_DRAW);
+ /* attempt to map the buffer */
+ if (!(varray = glMapBuffer(target, GL_WRITE_ONLY))) {
+ buffer = gpu_try_realloc(pool, buffer, size);
- /* attempt to map the buffer */
- if (!(varray = glMapBuffer(target, GL_WRITE_ONLY))) {
- buffer = gpu_try_realloc(pool, buffer, size, true);
-
- /* allocation still failed; fall back
- * to legacy mode */
- if (!(buffer && (varray = glMapBuffer(target, GL_WRITE_ONLY)))) {
- use_VBOs = false;
- success = true;
- }
- }
- else {
- success = true;
- }
- }
-
- /* check legacy fallback didn't happen */
- if (use_VBOs) {
- uploaded = GL_FALSE;
- /* attempt to upload the data to the VBO */
- while (uploaded == GL_FALSE) {
- dm->copy_gpu_data(dm, type, varray, mat_orig_to_new, user);
- /* glUnmapBuffer returns GL_FALSE if
- * the data store is corrupted; retry
- * in that case */
- uploaded = glUnmapBuffer(target);
- }
+ /* allocation still failed; unfortunately we need to exit */
+ if (!(buffer && (varray = glMapBuffer(target, GL_WRITE_ONLY)))) {
+ if (buffer)
+ gpu_buffer_free_intern(buffer);
+ return NULL;
}
- glBindBuffer(target, 0);
}
- if (!use_VBOs) {
- /* VBO not supported, use vertex array fallback */
- if (!buffer || !buffer->pointer) {
- buffer = gpu_try_realloc(pool, buffer, size, false);
- }
-
- if (buffer) {
- varray = buffer->pointer;
- dm->copy_gpu_data(dm, type, varray, mat_orig_to_new, user);
- }
+
+ uploaded = GL_FALSE;
+
+ /* attempt to upload the data to the VBO */
+ while (uploaded == GL_FALSE) {
+ dm->copy_gpu_data(dm, type, varray, mat_orig_to_new, user);
+ /* glUnmapBuffer returns GL_FALSE if
+ * the data store is corrupted; retry
+ * in that case */
+ uploaded = glUnmapBuffer(target);
}
+ glBindBuffer(target, 0);
MEM_freeN(mat_orig_to_new);
@@ -703,13 +643,8 @@ void GPU_vertex_setup(DerivedMesh *dm)
return;
glEnableClientState(GL_VERTEX_ARRAY);
- if (dm->drawObject->points->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->points->id);
- glVertexPointer(3, GL_FLOAT, 0, 0);
- }
- else {
- glVertexPointer(3, GL_FLOAT, 0, dm->drawObject->points->pointer);
- }
+ glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->points->id);
+ glVertexPointer(3, GL_FLOAT, 0, 0);
GLStates |= GPU_BUFFER_VERTEX_STATE;
}
@@ -720,13 +655,8 @@ void GPU_normal_setup(DerivedMesh *dm)
return;
glEnableClientState(GL_NORMAL_ARRAY);
- if (dm->drawObject->normals->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->normals->id);
- glNormalPointer(GL_SHORT, 4 * sizeof(short), 0);
- }
- else {
- glNormalPointer(GL_SHORT, 4 * sizeof(short), dm->drawObject->normals->pointer);
- }
+ glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->normals->id);
+ glNormalPointer(GL_SHORT, 4 * sizeof(short), 0);
GLStates |= GPU_BUFFER_NORMAL_STATE;
}
@@ -737,13 +667,8 @@ void GPU_uv_setup(DerivedMesh *dm)
return;
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- if (dm->drawObject->uv->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->uv->id);
- glTexCoordPointer(2, GL_FLOAT, 0, 0);
- }
- else {
- glTexCoordPointer(2, GL_FLOAT, 0, dm->drawObject->uv->pointer);
- }
+ glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->uv->id);
+ glTexCoordPointer(2, GL_FLOAT, 0, 0);
GLStates |= GPU_BUFFER_TEXCOORD_UNIT_0_STATE;
}
@@ -754,21 +679,12 @@ void GPU_texpaint_uv_setup(DerivedMesh *dm)
return;
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- if (dm->drawObject->uv_tex->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->uv_tex->id);
- glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), 0);
- glClientActiveTexture(GL_TEXTURE2);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), BUFFER_OFFSET(2 * sizeof(float)));
- glClientActiveTexture(GL_TEXTURE0);
- }
- else {
- glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), dm->drawObject->uv_tex->pointer);
- glClientActiveTexture(GL_TEXTURE2);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), (char *)dm->drawObject->uv_tex->pointer + 2 * sizeof(float));
- glClientActiveTexture(GL_TEXTURE0);
- }
+ glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->uv_tex->id);
+ glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), 0);
+ glClientActiveTexture(GL_TEXTURE2);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), BUFFER_OFFSET(2 * sizeof(float)));
+ glClientActiveTexture(GL_TEXTURE0);
GLStates |= GPU_BUFFER_TEXCOORD_UNIT_0_STATE | GPU_BUFFER_TEXCOORD_UNIT_2_STATE;
}
@@ -800,13 +716,8 @@ void GPU_color_setup(DerivedMesh *dm, int colType)
return;
glEnableClientState(GL_COLOR_ARRAY);
- if (dm->drawObject->colors->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->colors->id);
- glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0);
- }
- else {
- glColorPointer(3, GL_UNSIGNED_BYTE, 0, dm->drawObject->colors->pointer);
- }
+ glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->colors->id);
+ glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0);
GLStates |= GPU_BUFFER_COLOR_STATE;
}
@@ -814,13 +725,8 @@ void GPU_color_setup(DerivedMesh *dm, int colType)
void GPU_buffer_bind_as_color(GPUBuffer *buffer)
{
glEnableClientState(GL_COLOR_ARRAY);
- if (buffer->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, buffer->id);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);
- }
- else {
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, buffer->pointer);
- }
+ glBindBuffer(GL_ARRAY_BUFFER, buffer->id);
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);
GLStates |= GPU_BUFFER_COLOR_STATE;
}
@@ -835,20 +741,12 @@ void GPU_edge_setup(DerivedMesh *dm)
return;
glEnableClientState(GL_VERTEX_ARRAY);
- if (dm->drawObject->points->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->points->id);
- glVertexPointer(3, GL_FLOAT, 0, 0);
- }
- else {
- glVertexPointer(3, GL_FLOAT, 0, dm->drawObject->points->pointer);
- }
+ glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->points->id);
+ glVertexPointer(3, GL_FLOAT, 0, 0);
- GLStates |= GPU_BUFFER_VERTEX_STATE;
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, dm->drawObject->edges->id);
- if (dm->drawObject->edges->use_vbo)
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, dm->drawObject->edges->id);
-
- GLStates |= GPU_BUFFER_ELEMENT_STATE;
+ GLStates |= (GPU_BUFFER_VERTEX_STATE | GPU_BUFFER_ELEMENT_STATE);
}
void GPU_uvedge_setup(DerivedMesh *dm)
@@ -857,13 +755,8 @@ void GPU_uvedge_setup(DerivedMesh *dm)
return;
glEnableClientState(GL_VERTEX_ARRAY);
- if (dm->drawObject->uvedges->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->uvedges->id);
- glVertexPointer(2, GL_FLOAT, 0, 0);
- }
- else {
- glVertexPointer(2, GL_FLOAT, 0, dm->drawObject->uvedges->pointer);
- }
+ glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->uvedges->id);
+ glVertexPointer(2, GL_FLOAT, 0, 0);
GLStates |= GPU_BUFFER_VERTEX_STATE;
}
@@ -873,10 +766,7 @@ void GPU_triangle_setup(struct DerivedMesh *dm)
if (!gpu_buffer_setup_common(dm, GPU_BUFFER_TRIANGLES))
return;
- if (dm->drawObject->triangles->use_vbo) {
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, dm->drawObject->triangles->id);
- }
-
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, dm->drawObject->triangles->id);
GLStates |= GPU_BUFFER_ELEMENT_STATE;
}
@@ -914,8 +804,7 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
{
int i;
int elementsize;
- intptr_t offset = 0;
- char *basep;
+ size_t offset = 0;
for (i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
if (attribData[i].index != -1) {
@@ -929,18 +818,12 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
else
elementsize = element_size;
- if (buffer->use_vbo) {
- glBindBuffer(GL_ARRAY_BUFFER, buffer->id);
- basep = NULL;
- }
- else {
- basep = buffer->pointer;
- }
+ glBindBuffer(GL_ARRAY_BUFFER, buffer->id);
for (i = 0; i < numdata; i++) {
glEnableVertexAttribArray(data[i].index);
glVertexAttribPointer(data[i].index, data[i].size, data[i].type,
- GL_FALSE, elementsize, (void *)(basep + offset));
+ GL_FALSE, elementsize, BUFFER_OFFSET(offset));
offset += data[i].size * GPU_typesize(data[i].type);
attribData[i].index = data[i].index;
@@ -1025,75 +908,58 @@ static int gpu_binding_type_gl[] =
void *GPU_buffer_lock(GPUBuffer *buffer, GPUBindingType binding)
{
float *varray;
+ int bindtypegl;
if (!buffer)
return 0;
- if (buffer->use_vbo) {
- int bindtypegl = gpu_binding_type_gl[binding];
- glBindBuffer(bindtypegl, buffer->id);
- varray = glMapBuffer(bindtypegl, GL_WRITE_ONLY);
- return varray;
- }
- else {
- return buffer->pointer;
- }
+ bindtypegl = gpu_binding_type_gl[binding];
+ glBindBuffer(bindtypegl, buffer->id);
+ varray = glMapBuffer(bindtypegl, GL_WRITE_ONLY);
+ return varray;
}
void *GPU_buffer_lock_stream(GPUBuffer *buffer, GPUBindingType binding)
{
float *varray;
+ int bindtypegl;
if (!buffer)
return 0;
- if (buffer->use_vbo) {
- int bindtypegl = gpu_binding_type_gl[binding];
- glBindBuffer(bindtypegl, buffer->id);
- /* discard previous data, avoid stalling gpu */
- glBufferData(bindtypegl, buffer->size, 0, GL_STREAM_DRAW);
- varray = glMapBuffer(bindtypegl, GL_WRITE_ONLY);
- return varray;
- }
- else {
- return buffer->pointer;
- }
+ bindtypegl = gpu_binding_type_gl[binding];
+ glBindBuffer(bindtypegl, buffer->id);
+ /* discard previous data, avoid stalling gpu */
+ glBufferData(bindtypegl, buffer->size, 0, GL_STREAM_DRAW);
+ varray = glMapBuffer(bindtypegl, GL_WRITE_ONLY);
+ return varray;
}
-void GPU_buffer_unlock(GPUBuffer *buffer, GPUBindingType binding)
+void GPU_buffer_unlock(GPUBuffer *UNUSED(buffer), GPUBindingType binding)
{
- if (buffer->use_vbo) {
- int bindtypegl = gpu_binding_type_gl[binding];
- /* note: this operation can fail, could return
+ int bindtypegl = gpu_binding_type_gl[binding];
+ /* note: this operation can fail, could return
* an error code from this function? */
- glUnmapBuffer(bindtypegl);
- glBindBuffer(bindtypegl, 0);
- }
+ glUnmapBuffer(bindtypegl);
+ glBindBuffer(bindtypegl, 0);
}
void GPU_buffer_bind(GPUBuffer *buffer, GPUBindingType binding)
{
- if (buffer->use_vbo) {
- int bindtypegl = gpu_binding_type_gl[binding];
- glBindBuffer(bindtypegl, buffer->id);
- }
+ int bindtypegl = gpu_binding_type_gl[binding];
+ glBindBuffer(bindtypegl, buffer->id);
}
-void GPU_buffer_unbind(GPUBuffer *buffer, GPUBindingType binding)
+void GPU_buffer_unbind(GPUBuffer *UNUSED(buffer), GPUBindingType binding)
{
- if (buffer->use_vbo) {
- int bindtypegl = gpu_binding_type_gl[binding];
- glBindBuffer(bindtypegl, 0);
- }
+ int bindtypegl = gpu_binding_type_gl[binding];
+ glBindBuffer(bindtypegl, 0);
}
/* used for drawing edges */
-void GPU_buffer_draw_elements(GPUBuffer *elements, unsigned int mode, int start, int count)
+void GPU_buffer_draw_elements(GPUBuffer *UNUSED(elements), unsigned int mode, int start, int count)
{
- glDrawElements(mode, count, GL_UNSIGNED_INT,
- (elements->use_vbo ?
- (void *)(start * sizeof(unsigned int)) :
- ((int *)elements->pointer) + start));
+ glDrawElements(mode, count, GL_UNSIGNED_INT, BUFFER_OFFSET(start * sizeof(unsigned int)));
}
@@ -1236,7 +1102,7 @@ void GPU_update_mesh_pbvh_buffers(
/* Build VBO */
if (buffers->vert_buf)
GPU_buffer_free(buffers->vert_buf);
- buffers->vert_buf = GPU_buffer_alloc(sizeof(VertexBufferFormat) * totelem, false);
+ buffers->vert_buf = GPU_buffer_alloc(sizeof(VertexBufferFormat) * totelem);
vert_data = GPU_buffer_lock(buffers->vert_buf, GPU_BINDING_ARRAY);
if (vert_data) {
@@ -1377,7 +1243,7 @@ GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers(
* shading requires separate vertex normals so an index buffer is
* can't be used there. */
if (buffers->smooth)
- buffers->index_buf = GPU_buffer_alloc(sizeof(unsigned short) * tottri * 3, false);
+ buffers->index_buf = GPU_buffer_alloc(sizeof(unsigned short) * tottri * 3);
if (buffers->index_buf) {
/* Fill the triangle buffer */
@@ -1529,8 +1395,7 @@ void GPU_update_grid_pbvh_buffers(GPU_PBVH_Buffers *buffers, CCGElem **grids,
type_ *tri_data; \
int offset = 0; \
int i, j, k; \
- buffer_ = GPU_buffer_alloc(sizeof(type_) * (tot_quad_) * 6, \
- false); \
+ buffer_ = GPU_buffer_alloc(sizeof(type_) * (tot_quad_) * 6); \
\
/* Fill the buffer */ \
tri_data = GPU_buffer_lock(buffer_, GPU_BINDING_INDEX); \
@@ -1608,7 +1473,7 @@ static GPUBuffer *gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned
#define FILL_FAST_BUFFER(type_) \
{ \
type_ *buffer; \
- buffers->index_buf_fast = GPU_buffer_alloc(sizeof(type_) * 6 * totgrid, false); \
+ buffers->index_buf_fast = GPU_buffer_alloc(sizeof(type_) * 6 * totgrid); \
buffer = GPU_buffer_lock(buffers->index_buf_fast, GPU_BINDING_INDEX); \
if (buffer) { \
int i; \
@@ -1679,7 +1544,7 @@ GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(int *grid_indices, int totgrid,
/* Build coord/normal VBO */
if (buffers->index_buf)
- buffers->vert_buf = GPU_buffer_alloc(sizeof(VertexBufferFormat) * totgrid * key->grid_area, false);
+ buffers->vert_buf = GPU_buffer_alloc(sizeof(VertexBufferFormat) * totgrid * key->grid_area);
if (GLEW_ARB_draw_elements_base_vertex /* 3.2 */) {
int i;
@@ -1688,8 +1553,7 @@ GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(int *grid_indices, int totgrid,
for (i = 0; i < totgrid; i++) {
buffers->baseelemarray[i] = buffers->tot_quad * 6;
buffers->baseelemarray[i + totgrid] = i * key->grid_area;
- buffers->baseindex[i] = buffers->index_buf && !buffers->index_buf->use_vbo ?
- buffers->index_buf->pointer : NULL;
+ buffers->baseindex[i] = NULL;
}
}
@@ -1821,7 +1685,7 @@ void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers,
/* Initialize vertex buffer */
if (buffers->vert_buf)
GPU_buffer_free(buffers->vert_buf);
- buffers->vert_buf = GPU_buffer_alloc(sizeof(VertexBufferFormat) * totvert, false);
+ buffers->vert_buf = GPU_buffer_alloc(sizeof(VertexBufferFormat) * totvert);
/* Fill vertex buffer */
vert_data = GPU_buffer_lock(buffers->vert_buf, GPU_BINDING_ARRAY);
@@ -1904,7 +1768,7 @@ void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers,
GPU_buffer_free(buffers->index_buf);
buffers->index_buf = GPU_buffer_alloc((use_short ?
sizeof(unsigned short) :
- sizeof(unsigned int)) * 3 * tottri, false);
+ sizeof(unsigned int)) * 3 * tottri);
/* Fill triangle index buffer */
tri_data = GPU_buffer_lock(buffers->index_buf, GPU_BINDING_INDEX);
@@ -2005,18 +1869,11 @@ void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
GPU_buffer_bind(buffers->vert_buf, GPU_BINDING_ARRAY);
- if (!buffers->vert_buf->use_vbo)
- base = (char *)buffers->vert_buf->pointer;
-
if (do_fast) {
GPU_buffer_bind(buffers->index_buf_fast, GPU_BINDING_INDEX);
- if (!buffers->index_buf_fast->use_vbo)
- index_base = buffers->index_buf_fast->pointer;
}
else if (buffers->index_buf) {
GPU_buffer_bind(buffers->index_buf, GPU_BINDING_INDEX);
- if (!buffers->index_buf->use_vbo)
- index_base = buffers->index_buf->pointer;
}
if (wireframe)
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 5b540e654cf..2662f368c32 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -754,7 +754,7 @@ typedef enum eOpenGL_RenderingOptions {
/* USER_DISABLE_SOUND = (1 << 1), */ /* deprecated, don't use without checking for */
/* backwards compatibilty in do_versions! */
USER_DISABLE_MIPMAP = (1 << 2),
- USER_DISABLE_VBO = (1 << 3),
+ /* USER_DISABLE_VBO = (1 << 3), */ /* DEPRECATED we always use vertex buffers now */
/* USER_DISABLE_AA = (1 << 4), */ /* DEPRECATED */
} eOpenGL_RenderingOptions;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 4831edf0016..11fb87fe68d 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -161,25 +161,6 @@ static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene
UI_reinit_font();
}
-static void update_cb(PBVHNode *node, void *UNUSED(rebuild))
-{
- BKE_pbvh_node_mark_rebuild_draw(node);
-}
-
-static void rna_userdef_vbo_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
-{
- Object *ob;
-
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
- GPU_drawobject_free(ob->derivedFinal);
-
- if (ob->sculpt && ob->sculpt->pbvh) {
- BKE_pbvh_search_callback(ob->sculpt->pbvh, NULL, NULL, update_cb, NULL);
- }
- }
- GPU_buffer_multires_free(false);
-}
-
static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
UserDef *userdef = (UserDef *)ptr->data;
@@ -4162,13 +4143,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Image Draw Method", "Method used for displaying images on the screen");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- prop = RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO);
- RNA_def_property_ui_text(prop, "VBOs",
- "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering");
- /* this isn't essential but nice to check if VBO draws any differently */
- RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_vbo_update");
-
prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
RNA_def_property_enum_items(prop, anisotropic_items);
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index e3c8c894033..6832b4191f5 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -253,10 +253,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
bgl::InitExtensions(true);
- // VBO code for derived mesh is not compatible with BGE (couldn't find why), so disable
- int disableVBO = (U.gameflags & USER_DISABLE_VBO);
- U.gameflags |= USER_DISABLE_VBO;
-
// Globals to be carried on over blender files
GlobalSettings gs;
gs.matmode= startscene->gm.matmode;
@@ -676,9 +672,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
} while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
- if (!disableVBO)
- U.gameflags &= ~USER_DISABLE_VBO;
-
if (bfd) BLO_blendfiledata_free(bfd);
BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name));