diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-06-23 02:33:28 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-06-23 03:52:34 +0300 |
commit | fbffd6d3645af8364ede5b1b900eed10adb83ca3 (patch) | |
tree | 7634400ab3beaa41a67a7a6332e6ce654fe00537 /source/blender/draw/engines/eevee | |
parent | 221c7fdaf088fc209e8c51c07af9323ef807cb0a (diff) |
Eevee: Fix OpenGl errors.
Also assert if texture does not exists in draw manager. Keeping it sane.
Diffstat (limited to 'source/blender/draw/engines/eevee')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lightprobes.c | 15 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_materials.c | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 0d6f589f8a5..98f9c12b37e 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -135,12 +135,15 @@ static void planar_pool_ensure_alloc(EEVEE_Data *vedata, int num_planar_ref) int height = (int)(viewport_size[1] * screen_percentage); /* We need an Array texture so allocate it ourself */ - if (!txl->planar_pool && (num_planar_ref > 0)) { - txl->planar_pool = DRW_texture_create_2D_array(width, height, max_ff(1, num_planar_ref), - DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL); - } - else if (txl->planar_pool && (num_planar_ref == 0)) { - DRW_TEXTURE_FREE_SAFE(txl->planar_pool); + if (!txl->planar_pool) { + if (num_planar_ref > 0) { + txl->planar_pool = DRW_texture_create_2D_array(width, height, max_ff(1, num_planar_ref), + DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL); + } + else if (num_planar_ref == 0) { + /* Makes Opengl Happy : Create a placeholder texture that will never be sampled but still bound to shader. */ + txl->planar_pool = DRW_texture_create_2D_array(1, 1, 1, DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL); + } } if (num_planar_ref > 0) { diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 1043915c894..98f85f32910 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -217,7 +217,7 @@ static void add_standard_uniforms(DRWShadingGroup *shgrp, EEVEE_SceneLayerData * DRW_shgroup_uniform_buffer(shgrp, "shadowCubes", &sldata->shadow_depth_cube_pool); DRW_shgroup_uniform_buffer(shgrp, "shadowCascades", &sldata->shadow_depth_cascade_pool); if (vedata->stl->effects->use_ao) { - DRW_shgroup_uniform_vec4(shgrp, "viewvecs[0]", (float *)e_data.viewvecs, 3); + DRW_shgroup_uniform_vec4(shgrp, "viewvecs[0]", (float *)e_data.viewvecs, 2); DRW_shgroup_uniform_buffer(shgrp, "minMaxDepthTex", &vedata->stl->g_data->minmaxz); DRW_shgroup_uniform_float(shgrp, "aoDistance", &vedata->stl->effects->ao_dist, 1); DRW_shgroup_uniform_float(shgrp, "aoSamples", &vedata->stl->effects->ao_samples, 1); |