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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c18
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c6
-rw-r--r--source/blender/gpu/GPU_buffers.h3
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c25
4 files changed, 25 insertions, 27 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 5553de4ead7..9a41c7397ae 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -359,7 +359,7 @@ static void cdDM_drawVerts(DerivedMesh *dm)
glDrawArrays(GL_POINTS, 0, dm->drawObject->tot_loop_verts);
else
glDrawArrays(GL_POINTS, 0, dm->drawObject->tot_loose_point);
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
}
static void cdDM_drawUVEdges(DerivedMesh *dm)
@@ -389,7 +389,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
if (prevdraw && (curpos != prevstart)) {
glDrawArrays(GL_LINES, prevstart, curpos - prevstart);
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
}
static void cdDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdges)
@@ -418,7 +418,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdg
GPU_buffer_draw_elements(gdo->edges, GL_LINES, gdo->loose_edge_offset * 2, dm->drawObject->tot_loose_edge_drawn * 2);
}
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
}
static void cdDM_drawLooseEdges(DerivedMesh *dm)
@@ -435,7 +435,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm)
GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, start, count);
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
}
static void cdDM_drawFacesSolid(
@@ -469,7 +469,7 @@ static void cdDM_drawFacesSolid(
dm->drawObject->materials[a].start, dm->drawObject->materials[a].totelements);
}
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
glShadeModel(GL_FLAT);
}
@@ -611,7 +611,7 @@ static void cdDM_drawFacesTex_common(
}
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
glShadeModel(GL_FLAT);
}
@@ -790,7 +790,7 @@ static void cdDM_drawMappedFaces(
glShadeModel(GL_FLAT);
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
if (G.f & G_BACKBUFSEL)
GPU_buffer_free(findex_buffer);
@@ -1020,7 +1020,7 @@ static void cdDM_drawMappedFacesGLSL(
}
varray = GPU_buffer_lock_stream(buffer, GPU_BINDING_ARRAY);
if (varray == NULL) {
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
GPU_buffer_free(buffer);
MEM_freeN(mat_orig_to_new);
MEM_freeN(matconv);
@@ -1090,7 +1090,7 @@ static void cdDM_drawMappedFacesGLSL(
}
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
if (buffer)
GPU_buffer_free(buffer);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 60f553d88b5..d419fc70be9 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2312,7 +2312,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
dm->drawObject->materials[a].totelements);
}
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
}
/* Only used by non-editmesh types */
@@ -2781,7 +2781,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
}
static void ccgDM_drawFacesTex(DerivedMesh *dm,
@@ -2827,7 +2827,7 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm)
if (prevdraw && (curpos != prevstart)) {
glDrawArrays(GL_LINES, prevstart, curpos - prevstart);
}
- GPU_buffer_unbind();
+ GPU_buffers_unbind();
}
static void ccgDM_drawMappedFaces(DerivedMesh *dm,
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index 779521aa00c..fc8b3726b84 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -191,6 +191,7 @@ int GPU_attrib_element_size(GPUAttrib data[], int numdata);
void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numdata, int element_size);
void GPU_buffer_bind(GPUBuffer *buffer, GPUBindingType binding);
+void GPU_buffer_unbind(GPUBuffer *buffer, GPUBindingType binding);
/* can't lock more than one buffer at once */
void *GPU_buffer_lock(GPUBuffer *buffer, GPUBindingType binding);
@@ -204,7 +205,7 @@ void GPU_color_switch(int mode);
void GPU_buffer_draw_elements(GPUBuffer *elements, unsigned int mode, int start, int count);
/* called after drawing */
-void GPU_buffer_unbind(void);
+void GPU_buffers_unbind(void);
/* only unbind interleaved data */
void GPU_interleaved_attrib_unbind(void);
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index e86ca0fba94..478dfd9bef5 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -940,7 +940,7 @@ void GPU_interleaved_attrib_unbind(void)
attribData[0].index = -1;
}
-void GPU_buffer_unbind(void)
+void GPU_buffers_unbind(void)
{
int i;
@@ -1058,6 +1058,14 @@ void GPU_buffer_bind(GPUBuffer *buffer, GPUBindingType binding)
}
}
+void GPU_buffer_unbind(GPUBuffer *buffer, GPUBindingType binding)
+{
+ if (buffer->use_vbo) {
+ int bindtypegl = gpu_binding_type_gl[binding];
+ glBindBufferARB(bindtypegl, 0);
+ }
+}
+
/* used for drawing edges */
void GPU_buffer_draw_elements(GPUBuffer *elements, unsigned int mode, int start, int count)
{
@@ -1294,8 +1302,6 @@ void GPU_update_mesh_pbvh_buffers(
GPU_buffer_free(buffers->vert_buf);
buffers->vert_buf = NULL;
}
-
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
buffers->mvert = mvert;
@@ -1366,8 +1372,6 @@ GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers(
GPU_buffer_free(buffers->index_buf);
buffers->index_buf = NULL;
}
-
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
buffers->tot_tri = tottri;
@@ -1476,7 +1480,6 @@ void GPU_update_grid_pbvh_buffers(GPU_PBVH_Buffers *buffers, CCGElem **grids,
GPU_buffer_free(buffers->vert_buf);
buffers->vert_buf = NULL;
}
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
buffers->grids = grids;
@@ -1567,8 +1570,6 @@ static GPUBuffer *gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned
FILL_QUAD_BUFFER(unsigned int, *totquad, mres_glob_buffer);
}
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
-
mres_prev_gridsize = gridsize;
mres_prev_index_type = *index_type;
mres_prev_totquad = *totquad;
@@ -1628,8 +1629,6 @@ GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(int *grid_indices, int totgrid,
FILL_FAST_BUFFER(unsigned int);
}
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
-
if (totquad == fully_visible_totquad) {
buffers->index_buf = gpu_get_grid_buffer(gridsize, &buffers->index_type, &buffers->tot_quad);
buffers->has_hidden = 0;
@@ -1646,7 +1645,6 @@ GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(int *grid_indices, int totgrid,
FILL_QUAD_BUFFER(unsigned int, totquad, buffers->index_buf);
}
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
buffers->has_hidden = 1;
}
@@ -2021,9 +2019,9 @@ void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
if (wireframe)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+ GPU_buffer_unbind(buffers->vert_buf, GPU_BINDING_ARRAY);
if (buffers->index_buf || do_fast)
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+ GPU_buffer_unbind(do_fast ? buffers->index_buf_fast : buffers->index_buf, GPU_BINDING_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
if (!wireframe) {
@@ -2143,7 +2141,6 @@ void GPU_init_draw_pbvh_BB(void)
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
glEnable(GL_BLEND);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
void GPU_end_draw_pbvh_BB(void)