summaryrefslogtreecommitdiff
path: root/drivers/gles3/rasterizer_scene_gles3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/rasterizer_scene_gles3.cpp')
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp69
1 files changed, 39 insertions, 30 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index da6df7198d..7c053e8f60 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -4234,17 +4234,14 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
clear_color = env->bg_color.to_linear();
storage->frame.clear_request = false;
- } else if (env->bg_mode == VS::ENV_BG_SKY || env->bg_mode == VS::ENV_BG_COLOR_SKY) {
+ } else if (env->bg_mode == VS::ENV_BG_SKY) {
- sky = storage->sky_owner.getornull(env->sky);
+ storage->frame.clear_request = false;
- if (sky) {
- env_radiance_tex = sky->radiance;
- }
+ } else if (env->bg_mode == VS::ENV_BG_COLOR_SKY) {
+
+ clear_color = env->bg_color.to_linear();
storage->frame.clear_request = false;
- if (env->bg_mode == VS::ENV_BG_COLOR_SKY) {
- clear_color = env->bg_color.to_linear();
- }
} else {
storage->frame.clear_request = false;
@@ -4254,34 +4251,48 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glClearBufferfv(GL_COLOR, 0, clear_color.components); // specular
}
- if (env && env->bg_mode == VS::ENV_BG_CANVAS) {
- //copy canvas to 3d buffer and convert it to linear
+ if (env) {
+ switch (env->bg_mode) {
+ case VS::ENV_BG_COLOR_SKY:
+
+ case VS::ENV_BG_SKY:
- glDisable(GL_BLEND);
- glDepthMask(GL_FALSE);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
+ sky = storage->sky_owner.getornull(env->sky);
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
+ if (sky) {
+ env_radiance_tex = sky->radiance;
+ }
+ break;
+ case VS::ENV_BG_CANVAS:
+ //copy canvas to 3d buffer and convert it to linear
- storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, true);
+ glDisable(GL_BLEND);
+ glDepthMask(GL_FALSE);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
- storage->shaders.copy.set_conditional(CopyShaderGLES3::SRGB_TO_LINEAR, true);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
- storage->shaders.copy.bind();
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, true);
- _copy_screen(true, true);
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::SRGB_TO_LINEAR, true);
- //turn off everything used
- storage->shaders.copy.set_conditional(CopyShaderGLES3::SRGB_TO_LINEAR, false);
- storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, false);
+ storage->shaders.copy.bind();
- //restore
- glEnable(GL_BLEND);
- glDepthMask(GL_TRUE);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_CULL_FACE);
+ _copy_screen(true, true);
+
+ //turn off everything used
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::SRGB_TO_LINEAR, false);
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, false);
+
+ //restore
+ glEnable(GL_BLEND);
+ glDepthMask(GL_TRUE);
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ break;
+ }
}
state.texscreen_copied = false;
@@ -4916,7 +4927,6 @@ void RasterizerSceneGLES3::initialize() {
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);
- print_line("GLES3: max ubo light: " + itos(state.max_ubo_lights));
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);
@@ -4942,7 +4952,6 @@ void RasterizerSceneGLES3::initialize() {
state.scene_shader.add_custom_define("#define MAX_FORWARD_LIGHTS " + itos(state.max_forward_lights_per_object) + "\n");
state.max_ubo_reflections = MIN(RenderList::MAX_REFLECTIONS, max_ubo_size / sizeof(ReflectionProbeDataUBO));
- print_line("GLES3: max ubo reflections: " + itos(state.max_ubo_reflections) + ", ubo size: " + itos(sizeof(ReflectionProbeDataUBO)));
state.reflection_array_tmp = (uint8_t *)memalloc(sizeof(ReflectionProbeDataUBO) * state.max_ubo_reflections);