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:
authorCampbell Barton <ideasman42@gmail.com>2019-01-21 15:51:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-21 15:55:53 +0300
commit9bc47ed0f6d0db9e43af30c741a7e5ac347cbecd (patch)
treeca8dbd6ce37e3529a3c5fe8c0bc944c535128ec3 /source/blender/draw/intern
parent0c829e8240eebd7ce4ed9d61f8682c0d6bf534f4 (diff)
Fix clipping shaders with some AMD/Intel drivers
Caused: error: unsized array index must be constant Use hard coded number of clipping planes, copying the 4th to 5 & 6 when only 4 are used.
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/DRW_render.h1
-rw-r--r--source/blender/draw/intern/draw_common.c1
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c13
3 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 96525a47c77..cb5b8074f4b 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -533,6 +533,7 @@ void DRW_state_invert_facing(void);
void DRW_state_clip_planes_len_set(uint plane_len);
void DRW_state_clip_planes_reset(void);
+void DRW_state_clip_planes_set_from_rv3d(struct RegionView3D *rv3d);
/* Culling, return true if object is inside view frustum. */
bool DRW_culling_sphere_test(BoundSphere *bsphere);
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index 250b0a1f1ab..bb247832d44 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -302,7 +302,6 @@ void DRW_shgroup_world_clip_planes_from_rv3d(DRWShadingGroup *shgrp, const Regio
{
int world_clip_planes_len = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
DRW_shgroup_uniform_vec4(shgrp, "WorldClipPlanes", rv3d->clip[0], world_clip_planes_len);
- DRW_shgroup_uniform_int_copy(shgrp, "WorldClipPlanesLen", world_clip_planes_len);
DRW_shgroup_state_enable(shgrp, DRW_STATE_CLIP_PLANES);
}
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index e5654ab2a64..21647d54eea 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -447,6 +447,19 @@ void DRW_state_clip_planes_reset(void)
DST.clip_planes_len = 0;
}
+void DRW_state_clip_planes_set_from_rv3d(RegionView3D *rv3d)
+{
+ int max_len = 6;
+ int real_len = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : max_len;
+ while (real_len < max_len) {
+ /* Fill in dummy values that wont change results (6 is hard coded in shaders). */
+ copy_v4_v4(rv3d->clip[real_len], rv3d->clip[3]);
+ real_len++;
+ }
+
+ DRW_state_clip_planes_len_set(max_len);
+}
+
/** \} */
/* -------------------------------------------------------------------- */