diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-18 00:00:55 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-18 04:43:52 +0300 |
commit | 4c28b1c74ec2a96055fcc393920f3967666dd735 (patch) | |
tree | b85643f0b470eb092c0c3706cb10f56dddc2cade /source/blender/gpu | |
parent | 59975b0adf42cfbc51a90c02caaed49085abafa2 (diff) |
Cleanup: GPU: Encapsulate clipDistances
This also remove some non functionnal state changes that were left
from legacy code.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_state.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_state.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index 0f0a8a5dd6e..8d50330ac93 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -86,6 +86,7 @@ void GPU_depth_mask(bool depth); bool GPU_depth_mask_get(void); void GPU_stencil_mask(uint stencil); void GPU_unpack_row_length_set(uint len); +void GPU_clip_distances(int enabled_len); void GPU_flush(void); void GPU_finish(void); diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c index f1b842403f9..bd7aff9772b 100644 --- a/source/blender/gpu/intern/gpu_state.c +++ b/source/blender/gpu/intern/gpu_state.c @@ -256,6 +256,18 @@ void GPU_stencil_mask(uint stencil) glStencilMask(stencil); } +void GPU_clip_distances(int distances_new) +{ + static int distances_enabled = 0; + for (int i = 0; i < distances_new; i++) { + glEnable(GL_CLIP_DISTANCE0 + i); + } + for (int i = distances_new; i < distances_enabled; i++) { + glDisable(GL_CLIP_DISTANCE0 + i); + } + distances_enabled = distances_new; +} + /** \name GPU Push/Pop State * \{ */ |