diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-21 15:51:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-21 15:55:53 +0300 |
commit | 9bc47ed0f6d0db9e43af30c741a7e5ac347cbecd (patch) | |
tree | ca8dbd6ce37e3529a3c5fe8c0bc944c535128ec3 /source/blender/draw/engines/workbench/workbench_materials.c | |
parent | 0c829e8240eebd7ce4ed9d61f8682c0d6bf534f4 (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/engines/workbench/workbench_materials.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_materials.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index ce71189f344..d19f9293af9 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -110,7 +110,7 @@ char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool use_text if (is_hair) { BLI_dynstr_appendf(ds, "#define HAIR_SHADER\n"); } - if (wpd->world_clip_planes_len) { + if (wpd->world_clip_planes != NULL) { BLI_dynstr_appendf(ds, "#define USE_WORLD_CLIP_PLANES\n"); } @@ -171,7 +171,7 @@ int workbench_material_get_prepass_shader_index( SET_FLAG_FROM_TEST(index, NORMAL_VIEWPORT_PASS_ENABLED(wpd), 1 << 3); SET_FLAG_FROM_TEST(index, MATCAP_ENABLED(wpd), 1 << 4); SET_FLAG_FROM_TEST(index, use_textures, 1 << 5); - SET_FLAG_FROM_TEST(index, wpd->world_clip_planes_len != 0, 1 << 6); + SET_FLAG_FROM_TEST(index, wpd->world_clip_planes != NULL, 1 << 6); return index; } @@ -241,9 +241,8 @@ void workbench_material_shgroup_uniform( DRW_shgroup_uniform_float(grp, "materialRoughness", &material->roughness, 1); } - if (wpd->world_clip_planes_len) { - DRW_shgroup_uniform_vec4(grp, "WorldClipPlanes", wpd->world_clip_planes[0], wpd->world_clip_planes_len); - DRW_shgroup_uniform_int(grp, "WorldClipPlanesLen", &wpd->world_clip_planes_len, 1); + if (wpd->world_clip_planes != NULL) { + DRW_shgroup_uniform_vec4(grp, "WorldClipPlanes", wpd->world_clip_planes[0], 6); DRW_shgroup_state_enable(grp, DRW_STATE_CLIP_PLANES); } } |