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:
authorClément Foucault <foucault.clem@gmail.com>2020-07-18 00:00:55 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-18 04:43:52 +0300
commit4c28b1c74ec2a96055fcc393920f3967666dd735 (patch)
treeb85643f0b470eb092c0c3706cb10f56dddc2cade /source/blender/draw
parent59975b0adf42cfbc51a90c02caaed49085abafa2 (diff)
Cleanup: GPU: Encapsulate clipDistances
This also remove some non functionnal state changes that were left from legacy code.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/intern/draw_manager.c12
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c8
-rw-r--r--source/blender/draw/intern/draw_manager_text.c6
3 files changed, 9 insertions, 17 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index fcedc6bf0c7..08fb80c11d2 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2469,12 +2469,6 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, cons
#endif
}
-/** See #DRW_shgroup_world_clip_planes_from_rv3d. */
-static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_clip_planes[6][4])
-{
- GPU_batch_uniform_4fv_array(batch, "WorldClipPlanes", 6, world_clip_planes[0]);
-}
-
/**
* Clears the Depth Buffer and draws only the specified object.
*/
@@ -2497,7 +2491,7 @@ void DRW_draw_depth_object(
const float(*world_clip_planes)[4] = NULL;
if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
- ED_view3d_clipping_set(rv3d);
+ GPU_clip_distances(6);
ED_view3d_clipping_local(rv3d, object->obmat);
world_clip_planes = rv3d->clip_local;
}
@@ -2525,7 +2519,7 @@ void DRW_draw_depth_object(
GPU_SHADER_CFG_DEFAULT;
GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_DEPTH_ONLY, sh_cfg);
if (world_clip_planes != NULL) {
- draw_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ GPU_batch_uniform_4fv_array(batch, "WorldClipPlanes", 6, world_clip_planes[0]);
}
GPU_batch_draw(batch);
@@ -2536,7 +2530,7 @@ void DRW_draw_depth_object(
}
if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
- ED_view3d_clipping_disable();
+ GPU_clip_distances(0);
}
GPU_matrix_set(rv3d->viewmat);
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index e0609533691..b6f51ada5a1 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -350,14 +350,10 @@ void drw_state_set(DRWState state)
int test;
if ((test = CHANGED_TO(DRW_STATE_CLIP_PLANES))) {
if (test == 1) {
- for (int i = 0; i < DST.view_active->clip_planes_len; i++) {
- glEnable(GL_CLIP_DISTANCE0 + i);
- }
+ GPU_clip_distances(DST.view_active->clip_planes_len);
}
else {
- for (int i = 0; i < MAX_CLIP_PLANES; i++) {
- glDisable(GL_CLIP_DISTANCE0 + i);
- }
+ GPU_clip_distances(0);
}
}
}
diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c
index f4601fe4f48..b3c4c97715e 100644
--- a/source/blender/draw/intern/draw_manager_text.c
+++ b/source/blender/draw/intern/draw_manager_text.c
@@ -38,6 +38,7 @@
#include "DNA_view3d_types.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@@ -149,8 +150,9 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, struct View3D *v3d)
if (tot) {
int col_pack_prev = 0;
+ /* Disable clipping for text */
if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
- ED_view3d_clipping_disable();
+ GPU_clip_distances(0);
}
float original_proj[4][4];
@@ -188,7 +190,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, struct View3D *v3d)
GPU_matrix_projection_set(original_proj);
if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
- ED_view3d_clipping_enable();
+ GPU_clip_distances(6);
}
}
}