diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-26 21:39:06 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-26 21:39:06 +0100 |
commit | 0cd148313213e2923004be65bafd6a3781c917ec (patch) | |
tree | 2d9524085097ea4530ac97f043937ebd069ff4db /servers | |
parent | 93b80f17dcaa4dc5fa5392c271e0d971b00ac669 (diff) | |
parent | c69b14e96e3191622c06aa1e98c7f15f1fc895d4 (diff) |
Merge pull request #73959 from clayjohn/GL-mobile-warnings
Add warnings for unsupported features in mobile and gl_compatibility backends
Diffstat (limited to 'servers')
3 files changed, 57 insertions, 3 deletions
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp index 0e992eb965..453cad5271 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp @@ -114,8 +114,8 @@ void SceneShaderForwardMobile::ShaderData::set_code(const String &p_code) { actions.usage_flag_pointers["ALPHA_TEXTURE_COORDINATE"] = &uses_alpha_antialiasing; actions.render_mode_flags["depth_prepass_alpha"] = &uses_depth_prepass_alpha; - // actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss; - // actions.usage_flag_pointers["SSS_TRANSMITTANCE_DEPTH"] = &uses_transmittance; + actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss; + actions.usage_flag_pointers["SSS_TRANSMITTANCE_DEPTH"] = &uses_transmittance; actions.usage_flag_pointers["DISCARD"] = &uses_discard; actions.usage_flag_pointers["TIME"] = &uses_time; @@ -150,6 +150,16 @@ void SceneShaderForwardMobile::ShaderData::set_code(const String &p_code) { uses_depth_texture = gen_code.uses_depth_texture; uses_normal_texture = gen_code.uses_normal_roughness_texture; +#ifdef DEBUG_ENABLED + if (uses_sss) { + WARN_PRINT_ONCE_ED("Sub-surface scattering is only available when using the Forward+ rendering backend."); + } + + if (uses_transmittance) { + WARN_PRINT_ONCE_ED("Transmittance is only available when using the Forward+ rendering backend."); + } +#endif + #if 0 print_line("**compiling shader:"); print_line("**defines:\n"); diff --git a/servers/rendering/storage/camera_attributes_storage.cpp b/servers/rendering/storage/camera_attributes_storage.cpp index 151ae4ccfe..d7f438a68c 100644 --- a/servers/rendering/storage/camera_attributes_storage.cpp +++ b/servers/rendering/storage/camera_attributes_storage.cpp @@ -65,7 +65,11 @@ void RendererCameraAttributes::camera_attributes_set_dof_blur_bokeh_shape(RS::DO void RendererCameraAttributes::camera_attributes_set_dof_blur(RID p_camera_attributes, bool p_far_enable, float p_far_distance, float p_far_transition, bool p_near_enable, float p_near_distance, float p_near_transition, float p_amount) { CameraAttributes *cam_attributes = camera_attributes_owner.get_or_null(p_camera_attributes); ERR_FAIL_COND(!cam_attributes); - +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" && (p_far_enable || p_near_enable)) { + WARN_PRINT_ONCE_ED("DoF blur is only available when using the Forward+ or Mobile rendering backends."); + } +#endif cam_attributes->dof_blur_far_enabled = p_far_enable; cam_attributes->dof_blur_far_distance = p_far_distance; cam_attributes->dof_blur_far_transition = p_far_transition; @@ -139,6 +143,11 @@ void RendererCameraAttributes::camera_attributes_set_auto_exposure(RID p_camera_ if (!cam_attributes->use_auto_exposure && p_enable) { cam_attributes->auto_exposure_version = ++auto_exposure_counter; } +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" && p_enable) { + WARN_PRINT_ONCE_ED("Auto exposure is only available when using the Forward+ or Mobile rendering backends."); + } +#endif cam_attributes->use_auto_exposure = p_enable; cam_attributes->auto_exposure_min_sensitivity = p_min_sensitivity; cam_attributes->auto_exposure_max_sensitivity = p_max_sensitivity; diff --git a/servers/rendering/storage/environment_storage.cpp b/servers/rendering/storage/environment_storage.cpp index 30a6a616bb..c07a5b6584 100644 --- a/servers/rendering/storage/environment_storage.cpp +++ b/servers/rendering/storage/environment_storage.cpp @@ -278,6 +278,11 @@ float RendererEnvironmentStorage::environment_get_fog_sky_affect(RID p_env) cons void RendererEnvironmentStorage::environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_albedo, const Color &p_emission, float p_emission_energy, float p_anisotropy, float p_length, float p_detail_spread, float p_gi_inject, bool p_temporal_reprojection, float p_temporal_reprojection_amount, float p_ambient_inject, float p_sky_affect) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("Volumetric fog can only be enabled when using the Forward+ rendering backend."); + } +#endif env->volumetric_fog_enabled = p_enable; env->volumetric_fog_density = p_density; env->volumetric_fog_scattering = p_albedo; @@ -377,6 +382,11 @@ void RendererEnvironmentStorage::environment_set_glow(RID p_env, bool p_enable, Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); ERR_FAIL_COND_MSG(p_levels.size() != 7, "Size of array of glow levels must be 7"); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" && p_enable) { + WARN_PRINT_ONCE_ED("Glow is not supported when using the GL Compatibility backend yet. Support will be added in a future release."); + } +#endif env->glow_enabled = p_enable; env->glow_levels = p_levels; env->glow_intensity = p_intensity; @@ -468,6 +478,11 @@ RID RendererEnvironmentStorage::environment_get_glow_map(RID p_env) const { void RendererEnvironmentStorage::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("Screen-space reflections (SSR) can only be enabled when using the Forward+ rendering backend."); + } +#endif env->ssr_enabled = p_enable; env->ssr_max_steps = p_max_steps; env->ssr_fade_in = p_fade_int; @@ -510,6 +525,11 @@ float RendererEnvironmentStorage::environment_get_ssr_depth_tolerance(RID p_env) void RendererEnvironmentStorage::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_power, float p_detail, float p_horizon, float p_sharpness, float p_light_affect, float p_ao_channel_affect) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("Screen-space ambient occlusion (SSAO) can only be enabled when using the Forward+ rendering backend."); + } +#endif env->ssao_enabled = p_enable; env->ssao_radius = p_radius; env->ssao_intensity = p_intensity; @@ -580,6 +600,11 @@ float RendererEnvironmentStorage::environment_get_ssao_ao_channel_affect(RID p_e void RendererEnvironmentStorage::environment_set_ssil(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_sharpness, float p_normal_rejection) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("Screen-space indirect lighting (SSIL) can only be enabled when using the Forward+ rendering backend."); + } +#endif env->ssil_enabled = p_enable; env->ssil_radius = p_radius; env->ssil_intensity = p_intensity; @@ -622,6 +647,11 @@ float RendererEnvironmentStorage::environment_get_ssil_normal_rejection(RID p_en void RendererEnvironmentStorage::environment_set_sdfgi(RID p_env, bool p_enable, int p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, float p_bounce_feedback, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("SDFGI can only be enabled when using the Forward+ rendering backend."); + } +#endif env->sdfgi_enabled = p_enable; env->sdfgi_cascades = p_cascades; env->sdfgi_min_cell_size = p_min_cell_size; @@ -699,6 +729,11 @@ RS::EnvironmentSDFGIYScale RendererEnvironmentStorage::environment_get_sdfgi_y_s void RendererEnvironmentStorage::environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, bool p_use_1d_color_correction, RID p_color_correction) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" && p_enable) { + WARN_PRINT_ONCE_ED("Adjustments are not supported when using the GL Compatibility backend yet. Support will be added in a future release."); + } +#endif env->adjustments_enabled = p_enable; env->adjustments_brightness = p_brightness; env->adjustments_contrast = p_contrast; |