diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-07-29 16:01:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-29 16:01:53 +0200 |
commit | 639127de0967bf32b20dac9a54c4bba44d2786ad (patch) | |
tree | d6fc1777a74328610eda6d5a498172314724c464 /drivers/gles3 | |
parent | 5d172d5d9aaf05a247a517612def8fc719efa69f (diff) | |
parent | 1a981ef268149c0db0fc0a1267e8c73130661016 (diff) |
Merge pull request #30898 from clayjohn/max-lights-reflections
Add project setting for max lights and reflections in GLES3
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 12 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.h | 8 |
2 files changed, 14 insertions, 6 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index f3ba29a0e7..30ca07aa28 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2824,7 +2824,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c for (int i = 0; i < p_light_cull_count; i++) { - ERR_BREAK(i >= RenderList::MAX_LIGHTS); + ERR_BREAK(i >= render_list.max_lights); LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]); @@ -4189,7 +4189,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const for (int i = 0; i < p_light_cull_count; i++) { - ERR_BREAK(i >= RenderList::MAX_LIGHTS); + ERR_BREAK(i >= render_list.max_lights); LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]); if (li->light_ptr->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE] > CMP_EPSILON) { @@ -5064,6 +5064,10 @@ void RasterizerSceneGLES3::initialize() { render_list.max_elements = GLOBAL_DEF_RST("rendering/limits/rendering/max_renderable_elements", (int)RenderList::DEFAULT_MAX_ELEMENTS); ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/rendering/max_renderable_elements", PropertyInfo(Variant::INT, "rendering/limits/rendering/max_renderable_elements", PROPERTY_HINT_RANGE, "1024,1000000,1")); + render_list.max_lights = GLOBAL_DEF("rendering/limits/rendering/max_renderable_lights", (int)RenderList::DEFAULT_MAX_LIGHTS); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/rendering/max_renderable_lights", PropertyInfo(Variant::INT, "rendering/limits/rendering/max_renderable_lights", PROPERTY_HINT_RANGE, "16,4096,1")); + render_list.max_reflections = GLOBAL_DEF("rendering/limits/rendering/max_renderable_reflections", (int)RenderList::DEFAULT_MAX_REFLECTIONS); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/rendering/max_renderable_reflections", PropertyInfo(Variant::INT, "rendering/limits/rendering/max_renderable_reflections", PROPERTY_HINT_RANGE, "8,1024,1")); { //quad buffers @@ -5158,7 +5162,7 @@ void RasterizerSceneGLES3::initialize() { glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &max_ubo_size); const int ubo_light_size = 160; state.ubo_light_size = ubo_light_size; - state.max_ubo_lights = MIN(RenderList::MAX_LIGHTS, max_ubo_size / ubo_light_size); + state.max_ubo_lights = MIN(render_list.max_lights, max_ubo_size / ubo_light_size); state.spot_array_tmp = (uint8_t *)memalloc(ubo_light_size * state.max_ubo_lights); state.omni_array_tmp = (uint8_t *)memalloc(ubo_light_size * state.max_ubo_lights); @@ -5183,7 +5187,7 @@ void RasterizerSceneGLES3::initialize() { state.scene_shader.add_custom_define("#define MAX_LIGHT_DATA_STRUCTS " + itos(state.max_ubo_lights) + "\n"); state.scene_shader.add_custom_define("#define MAX_FORWARD_LIGHTS " + itos(state.max_forward_lights_per_object) + "\n"); - state.max_ubo_reflections = MIN((int)RenderList::MAX_REFLECTIONS, max_ubo_size / sizeof(ReflectionProbeDataUBO)); + state.max_ubo_reflections = MIN(render_list.max_reflections, max_ubo_size / (int)sizeof(ReflectionProbeDataUBO)); state.reflection_array_tmp = (uint8_t *)memalloc(sizeof(ReflectionProbeDataUBO) * state.max_ubo_reflections); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 910f90edc2..b5e64b6162 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -669,8 +669,8 @@ public: SORT_FLAG_SKELETON = 1, SORT_FLAG_INSTANCING = 2, MAX_DIRECTIONAL_LIGHTS = 16, - MAX_LIGHTS = 4096, - MAX_REFLECTIONS = 1024, + DEFAULT_MAX_LIGHTS = 4096, + DEFAULT_MAX_REFLECTIONS = 1024, SORT_KEY_PRIORITY_SHIFT = 56, SORT_KEY_PRIORITY_MASK = 0xFF, @@ -701,6 +701,8 @@ public: }; int max_elements; + int max_lights; + int max_reflections; struct Element { @@ -813,6 +815,8 @@ public: RenderList() { max_elements = DEFAULT_MAX_ELEMENTS; + max_lights = DEFAULT_MAX_LIGHTS; + max_reflections = DEFAULT_MAX_REFLECTIONS; } ~RenderList() { |