diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-05-11 15:15:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-05-11 15:16:23 +0300 |
commit | f129e48993df81c55e0b4ec68708588e4e178e7d (patch) | |
tree | 7f33d32e1b11e2fefd2303f3d992bd82b3ecaf39 | |
parent | 4e7eafb86fd321b9684c782b32457d67e3d049bd (diff) | |
parent | 15038975a3fb9f2232a53745ea7ed08a2145479f (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 64 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_bmesh.c | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl | 2 | ||||
-rw-r--r-- | source/blender/gpu/GPU_buffers.h | 43 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 22 |
5 files changed, 68 insertions, 65 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 02b4479df4f..69028a0c96c 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -621,7 +621,7 @@ void BKE_pbvh_free(PBVH *bvh) if (node->flag & PBVH_Leaf) { if (node->draw_buffers) - GPU_free_pbvh_buffers(node->draw_buffers); + GPU_pbvh_buffers_free(node->draw_buffers); if (node->vert_indices) MEM_freeN((void *)node->vert_indices); if (node->face_vert_indices) @@ -636,7 +636,7 @@ void BKE_pbvh_free(PBVH *bvh) BLI_gset_free(node->bm_other_verts, NULL); } } - GPU_free_pbvh_buffer_multires(&bvh->grid_common_gpu_buffer); + GPU_pbvh_multires_buffers_free(&bvh->grid_common_gpu_buffer); if (bvh->deformed) { if (bvh->verts) { @@ -1091,11 +1091,11 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode) PBVHNode *node = nodes[n]; if (node->flag & PBVH_RebuildDrawBuffers) { - GPU_free_pbvh_buffers(node->draw_buffers); + GPU_pbvh_buffers_free(node->draw_buffers); switch (bvh->type) { case PBVH_GRIDS: node->draw_buffers = - GPU_build_grid_pbvh_buffers(node->prim_indices, + GPU_pbvh_grid_buffers_build(node->prim_indices, node->totprim, bvh->grid_hidden, bvh->gridkey.grid_size, @@ -1103,7 +1103,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode) break; case PBVH_FACES: node->draw_buffers = - GPU_build_mesh_pbvh_buffers(node->face_vert_indices, + GPU_pbvh_mesh_buffers_build(node->face_vert_indices, bvh->mpoly, bvh->mloop, bvh->looptri, bvh->verts, node->prim_indices, @@ -1111,7 +1111,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode) break; case PBVH_BMESH: node->draw_buffers = - GPU_build_bmesh_pbvh_buffers(bvh->flags & PBVH_DYNTOPO_SMOOTH_SHADING); + GPU_pbvh_bmesh_buffers_build(bvh->flags & PBVH_DYNTOPO_SMOOTH_SHADING); break; } @@ -1121,32 +1121,34 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode) if (node->flag & PBVH_UpdateDrawBuffers) { switch (bvh->type) { case PBVH_GRIDS: - GPU_update_grid_pbvh_buffers(node->draw_buffers, - bvh->grids, - bvh->grid_flag_mats, - node->prim_indices, - node->totprim, - &bvh->gridkey, - bvh->show_diffuse_color); + GPU_pbvh_grid_buffers_update( + node->draw_buffers, + bvh->grids, + bvh->grid_flag_mats, + node->prim_indices, + node->totprim, + &bvh->gridkey, + bvh->show_diffuse_color); break; case PBVH_FACES: - GPU_update_mesh_pbvh_buffers(node->draw_buffers, - bvh->verts, - node->vert_indices, - node->uniq_verts + - node->face_verts, - CustomData_get_layer(bvh->vdata, - CD_PAINT_MASK), - node->face_vert_indices, - bvh->show_diffuse_color); + GPU_pbvh_mesh_buffers_update( + node->draw_buffers, + bvh->verts, + node->vert_indices, + node->uniq_verts + + node->face_verts, + CustomData_get_layer(bvh->vdata, CD_PAINT_MASK), + node->face_vert_indices, + bvh->show_diffuse_color); break; case PBVH_BMESH: - GPU_update_bmesh_pbvh_buffers(node->draw_buffers, - bvh->bm, - node->bm_faces, - node->bm_unique_verts, - node->bm_other_verts, - bvh->show_diffuse_color); + GPU_pbvh_bmesh_buffers_update( + node->draw_buffers, + bvh->bm, + node->bm_faces, + node->bm_unique_verts, + node->bm_other_verts, + bvh->show_diffuse_color); break; } @@ -1163,7 +1165,7 @@ static void pbvh_draw_BB(PBVH *bvh) for (int a = 0; a < bvh->totnode; a++) { PBVHNode *node = &bvh->nodes[a]; - GPU_draw_pbvh_BB(node->vb.bmin, node->vb.bmax, ((node->flag & PBVH_Leaf) != 0), pos); + GPU_pbvh_BB_draw(node->vb.bmin, node->vb.bmax, ((node->flag & PBVH_Leaf) != 0), pos); } immUnbindProgram(); @@ -1740,7 +1742,7 @@ void BKE_pbvh_node_draw(PBVHNode *node, void *data_v) PBVHNodeDrawData *data = data_v; if (!(node->flag & PBVH_FullyHidden)) { - GPU_draw_pbvh_buffers(node->draw_buffers, + GPU_pbvh_buffers_draw(node->draw_buffers, data->setMaterial, data->wireframe, data->fast); @@ -1857,7 +1859,7 @@ static void pbvh_node_draw_cb(PBVHNode *node, void *data_v) struct PBVHNodeDrawCallbackData *data = data_v; if (!(node->flag & PBVH_FullyHidden)) { - Batch *triangles = GPU_draw_pbvh_buffers_get_batch(node->draw_buffers, data->fast); + Batch *triangles = GPU_pbvh_buffers_batch_get(node->draw_buffers, data->fast); if (triangles != NULL) { data->draw_fn(data->user_data, triangles); } diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index a821578db1a..c5e49883dc6 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -352,7 +352,7 @@ static void pbvh_bmesh_node_split(PBVH *bvh, const BBC *bbc_array, int node_inde n->layer_disp = NULL; if (n->draw_buffers) { - GPU_free_pbvh_buffers(n->draw_buffers); + GPU_pbvh_buffers_free(n->draw_buffers); n->draw_buffers = NULL; } n->flag &= ~PBVH_Leaf; diff --git a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl index 1505e02bfb7..8960b339a61 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl @@ -56,8 +56,6 @@ void main() float inc = 2.0 * inv_samples; float i = -1.0 + noise; - - FragColor = vec4(0.0); for (int j = 0; j < samples && j < MAX_SAMPLE; j++) { FragColor += texture(colorBuffer, uvcoordsvar.xy + motion * i) * inv_samples; i += inc; diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 661562e2e4c..b4d271ed3b9 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -223,49 +223,52 @@ void GPU_interleaved_attrib_unbind(void); typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers; /* build */ -GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers( +GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build( const int (*face_vert_indices)[3], const struct MPoly *mpoly, const struct MLoop *mloop, const struct MLoopTri *looptri, const struct MVert *verts, const int *face_indices, const int face_indices_len); -GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers( +GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build( int *grid_indices, int totgrid, unsigned int **grid_hidden, int gridsize, const struct CCGKey *key, struct GridCommonGPUBuffer **grid_common_gpu_buffer); -GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(bool smooth_shading); +GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading); /* update */ -void GPU_update_mesh_pbvh_buffers( +void GPU_pbvh_mesh_buffers_update( GPU_PBVH_Buffers *buffers, const struct MVert *mvert, const int *vert_indices, int totvert, const float *vmask, const int (*face_vert_indices)[3], bool show_diffuse_color); -void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers, - struct BMesh *bm, - struct GSet *bm_faces, - struct GSet *bm_unique_verts, - struct GSet *bm_other_verts, - bool show_diffuse_color); +void GPU_pbvh_bmesh_buffers_update( + GPU_PBVH_Buffers *buffers, + struct BMesh *bm, + struct GSet *bm_faces, + struct GSet *bm_unique_verts, + struct GSet *bm_other_verts, + bool show_diffuse_color); -void GPU_update_grid_pbvh_buffers(GPU_PBVH_Buffers *buffers, struct CCGElem **grids, - const struct DMFlagMat *grid_flag_mats, - int *grid_indices, int totgrid, const struct CCGKey *key, - bool show_diffuse_color); +void GPU_pbvh_grid_buffers_update( + GPU_PBVH_Buffers *buffers, struct CCGElem **grids, + const struct DMFlagMat *grid_flag_mats, + int *grid_indices, int totgrid, const struct CCGKey *key, + bool show_diffuse_color); /* draw */ -void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial, - bool wireframe, bool fast); -struct Batch *GPU_draw_pbvh_buffers_get_batch(GPU_PBVH_Buffers *buffers, bool fast); +void GPU_pbvh_buffers_draw( + GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial, + bool wireframe, bool fast); +struct Batch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast); /* debug PBVH draw */ -void GPU_draw_pbvh_BB(float min[3], float max[3], bool leaf, unsigned int pos); +void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf, unsigned int pos); bool GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, struct GSet *bm_faces, bool show_diffuse_color); -void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers); -void GPU_free_pbvh_buffer_multires(struct GridCommonGPUBuffer **grid_common_gpu_buffer); +void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers); +void GPU_pbvh_multires_buffers_free(struct GridCommonGPUBuffer **grid_common_gpu_buffer); #endif diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 8a3c0c91b65..81466d156ee 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1068,7 +1068,7 @@ static void gpu_color_from_mask_quad_copy(const CCGKey *key, out[2] = diffuse_color[2] * mask_color; } -void GPU_update_mesh_pbvh_buffers( +void GPU_pbvh_mesh_buffers_update( GPU_PBVH_Buffers *buffers, const MVert *mvert, const int *vert_indices, int totvert, const float *vmask, const int (*face_vert_indices)[3], bool show_diffuse_color) @@ -1190,7 +1190,7 @@ void GPU_update_mesh_pbvh_buffers( buffers->mvert = mvert; } -GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers( +GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build( const int (*face_vert_indices)[3], const MPoly *mpoly, const MLoop *mloop, const MLoopTri *looptri, const MVert *mvert, @@ -1272,7 +1272,7 @@ GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers( return buffers; } -void GPU_update_grid_pbvh_buffers( +void GPU_pbvh_grid_buffers_update( GPU_PBVH_Buffers *buffers, CCGElem **grids, const DMFlagMat *grid_flag_mats, int *grid_indices, int totgrid, const CCGKey *key, bool show_diffuse_color) @@ -1488,7 +1488,7 @@ static ElementList *gpu_get_grid_buffer( buffers->index_buf_fast = ElementList_build(&elb); \ } (void)0 -GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers( +GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build( int *grid_indices, int totgrid, BLI_bitmap **grid_hidden, int gridsize, const CCGKey *UNUSED(key), GridCommonGPUBuffer **grid_common_gpu_buffer) { @@ -1632,7 +1632,7 @@ static int gpu_bmesh_face_visible_count(GSet *bm_faces) /* Creates a vertex buffer (coordinate, normal, color) and, if smooth * shading, an element index buffer. */ -void GPU_update_bmesh_pbvh_buffers( +void GPU_pbvh_bmesh_buffers_update( GPU_PBVH_Buffers *buffers, BMesh *bm, GSet *bm_faces, @@ -1806,7 +1806,7 @@ void GPU_update_bmesh_pbvh_buffers( gpu_pbvh_batch_init(buffers); } -GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(bool smooth_shading) +GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading) { GPU_PBVH_Buffers *buffers; @@ -1819,7 +1819,7 @@ GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(bool smooth_shading) return buffers; } -void GPU_draw_pbvh_buffers( +void GPU_pbvh_buffers_draw( GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial, bool wireframe, bool fast) { @@ -1841,7 +1841,7 @@ void GPU_draw_pbvh_buffers( } } -Batch *GPU_draw_pbvh_buffers_get_batch(GPU_PBVH_Buffers *buffers, bool fast) +Batch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast) { return (fast && buffers->triangles_fast) ? buffers->triangles_fast : buffers->triangles; @@ -1890,7 +1890,7 @@ bool GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, GSet *bm_faces, return !equals_v3v3(diffuse_color, buffers->diffuse_color); } -void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers) +void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers) { if (buffers) { BATCH_DISCARD_SAFE(buffers->triangles); @@ -1912,7 +1912,7 @@ void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers) } } -void GPU_free_pbvh_buffer_multires(GridCommonGPUBuffer **grid_common_gpu_buffer) +void GPU_pbvh_multires_buffers_free(GridCommonGPUBuffer **grid_common_gpu_buffer) { GridCommonGPUBuffer *gridbuff = *grid_common_gpu_buffer; @@ -1928,7 +1928,7 @@ void GPU_free_pbvh_buffer_multires(GridCommonGPUBuffer **grid_common_gpu_buffer) } /* debug function, draws the pbvh BB */ -void GPU_draw_pbvh_BB(float min[3], float max[3], bool leaf, unsigned int pos) +void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf, unsigned int pos) { if (leaf) immUniformColor4f(0.0, 1.0, 0.0, 0.5); |