diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-09 15:01:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 15:01:34 +0200 |
commit | 64c5b5175b0172bd8462d196fc21c06e074444ed (patch) | |
tree | c626209e5e5aad2a46dbdd2fc27a4c2a2b98001d /servers | |
parent | e8f3fa6b8772b4014bc23815bc421787ba5eed3a (diff) | |
parent | 71c5d73b5e15c679d8bcf3fa5b84293acff8444b (diff) |
Merge pull request #47696 from BastiaanOlij/remove_low_end
Remove low_end option from renderer
Diffstat (limited to 'servers')
8 files changed, 22 insertions, 69 deletions
diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index cdff3139eb..bcdefea567 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -941,7 +941,7 @@ void RenderForwardClustered::_fill_render_list(RenderListType p_render_list, con uses_lightmap = true; } - } else if (!low_end) { + } else { if (p_using_opaque_gi) { flags |= INSTANCE_DATA_FLAG_USE_GI_BUFFERS; } @@ -1133,7 +1133,7 @@ void RenderForwardClustered::_render_scene(RID p_render_buffer, const Transform opaque_framebuffer = render_buffer->color_fb; - if (!low_end && p_gi_probes.size() > 0) { + if (p_gi_probes.size() > 0) { using_giprobe = true; } @@ -1212,7 +1212,7 @@ void RenderForwardClustered::_render_scene(RID p_render_buffer, const Transform RD::get_singleton()->draw_command_end_label(); - bool using_sss = !low_end && render_buffer && scene_state.used_sss && sub_surface_scattering_get_quality() != RS::SUB_SURFACE_SCATTERING_QUALITY_DISABLED; + bool using_sss = render_buffer && scene_state.used_sss && sub_surface_scattering_get_quality() != RS::SUB_SURFACE_SCATTERING_QUALITY_DISABLED; if (using_sss) { using_separate_specular = true; @@ -1296,7 +1296,7 @@ void RenderForwardClustered::_render_scene(RID p_render_buffer, const Transform bool debug_giprobes = get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_ALBEDO || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_LIGHTING || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_EMISSION; bool debug_sdfgi_probes = get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_SDFGI_PROBES; - bool depth_pre_pass = !low_end && depth_framebuffer.is_valid(); + bool depth_pre_pass = depth_framebuffer.is_valid(); bool using_ssao = depth_pre_pass && p_render_buffer.is_valid() && p_environment.is_valid() && environment_is_ssao_enabled(p_environment); bool continue_depth = false; @@ -1903,7 +1903,7 @@ void RenderForwardClustered::_update_render_base_uniform_set() { uniforms.push_back(u); } - if (!low_end) { + { RD::Uniform u; u.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; u.binding = 13; @@ -2065,7 +2065,7 @@ RID RenderForwardClustered::_setup_render_pass_uniform_set(RenderListType p_rend uniforms.push_back(u); } - if (!low_end) { + { { RD::Uniform u; u.binding = 11; @@ -2616,7 +2616,7 @@ void RenderForwardClustered::_geometry_instance_update(GeometryInstance *p_geome ginstance->store_transform_cache = store_transform; ginstance->can_sdfgi = false; - if (!lightmap_instance_is_valid(ginstance->lightmap_instance) && !low_end) { + if (!lightmap_instance_is_valid(ginstance->lightmap_instance)) { if (ginstance->gi_probes[0].is_null() && (ginstance->data->use_baked_light || ginstance->data->use_dynamic_gi)) { ginstance->can_sdfgi = true; } @@ -2843,10 +2843,6 @@ RenderForwardClustered::RenderForwardClustered(RendererStorageRD *p_storage) : { String defines; - if (low_end) { - defines += "\n#define LOW_END_MODE \n"; - } - defines += "\n#define MAX_ROUGHNESS_LOD " + itos(get_roughness_layers() - 1) + ".0\n"; if (is_using_radiance_cubemap_array()) { defines += "\n#define USE_RADIANCE_CUBEMAP_ARRAY \n"; @@ -2856,7 +2852,7 @@ RenderForwardClustered::RenderForwardClustered(RendererStorageRD *p_storage) : { //lightmaps - scene_state.max_lightmaps = low_end ? 2 : MAX_LIGHTMAPS; + scene_state.max_lightmaps = MAX_LIGHTMAPS; defines += "\n#define MAX_LIGHTMAP_TEXTURES " + itos(scene_state.max_lightmaps) + "\n"; defines += "\n#define MAX_LIGHTMAPS " + itos(scene_state.max_lightmaps) + "\n"; @@ -2872,7 +2868,7 @@ RenderForwardClustered::RenderForwardClustered(RendererStorageRD *p_storage) : defines += "\n#define MATERIAL_UNIFORM_SET " + itos(MATERIAL_UNIFORM_SET) + "\n"; } - scene_shader.init(p_storage, defines, low_end); + scene_shader.init(p_storage, defines); } render_list_thread_threshold = GLOBAL_GET("rendering/limits/forward_renderer/threaded_render_minimum_instances"); diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp index cb8c6e0cf3..45f6384b5e 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp @@ -544,7 +544,7 @@ SceneShaderForwardClustered::~SceneShaderForwardClustered() { storage->free(default_material); } -void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const String p_defines, bool p_is_low_end) { +void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const String p_defines) { storage = p_storage; { @@ -562,6 +562,7 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n#define USE_LIGHTMAP\n"); shader.initialize(shader_versions, p_defines); + /* if (p_is_low_end) { //disable the high end versions shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS, false); @@ -571,6 +572,7 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR, false); shader.set_variant_enabled(SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR, false); } + */ } storage->shader_set_data_request_function(RendererStorageRD::SHADER_TYPE_3D, _create_shader_funcs); @@ -764,9 +766,7 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin MaterialData *md = (MaterialData *)storage->material_get_data(default_material, RendererStorageRD::SHADER_TYPE_3D); default_shader_rd = shader.version_get_shader(md->shader_data->version, SHADER_VERSION_COLOR_PASS); - if (!p_is_low_end) { - default_shader_sdfgi_rd = shader.version_get_shader(md->shader_data->version, SHADER_VERSION_DEPTH_PASS_WITH_SDF); - } + default_shader_sdfgi_rd = shader.version_get_shader(md->shader_data->version, SHADER_VERSION_DEPTH_PASS_WITH_SDF); } { diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h index 368340e258..953a5291c8 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h @@ -203,7 +203,7 @@ public: SceneShaderForwardClustered(); ~SceneShaderForwardClustered(); - void init(RendererStorageRD *p_storage, const String p_defines, bool p_is_low_end); + void init(RendererStorageRD *p_storage, const String p_defines); }; } // namespace RendererSceneRenderImplementation diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 4c5bded2ff..ca9e014c95 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -317,7 +317,7 @@ void RendererSceneRenderRD::environment_set_sdfgi(RID p_env, bool p_enable, RS:: RendererSceneEnvironmentRD *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (low_end) { + if (!is_dynamic_gi_supported()) { return; } @@ -379,7 +379,7 @@ void RendererSceneRenderRD::environment_set_volumetric_fog(RID p_env, bool p_ena RendererSceneEnvironmentRD *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (low_end) { + if (!is_volumetric_supported()) { return; } @@ -410,10 +410,6 @@ void RendererSceneRenderRD::environment_set_ssr(RID p_env, bool p_enable, int p_ RendererSceneEnvironmentRD *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (low_end) { - return; - } - env->set_ssr(p_enable, p_max_steps, p_fade_int, p_fade_out, p_depth_tolerance); } @@ -429,10 +425,6 @@ void RendererSceneRenderRD::environment_set_ssao(RID p_env, bool p_enable, float RendererSceneEnvironmentRD *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (low_end) { - return; - } - env->set_ssao(p_enable, p_radius, p_intensity, p_power, p_detail, p_horizon, p_sharpness, p_light_affect, p_ao_channel_affect); } @@ -1347,7 +1339,7 @@ void RendererSceneRenderRD::gi_probe_instance_set_transform_to_data(RID p_probe, } bool RendererSceneRenderRD::gi_probe_needs_update(RID p_probe) const { - if (low_end) { + if (!is_dynamic_gi_supported()) { return false; } @@ -1355,7 +1347,7 @@ bool RendererSceneRenderRD::gi_probe_needs_update(RID p_probe) const { } void RendererSceneRenderRD::gi_probe_update(RID p_probe, bool p_update_light_instances, const Vector<RID> &p_light_instances, const PagedArray<GeometryInstance *> &p_dynamic_objects) { - if (low_end) { + if (!is_dynamic_gi_supported()) { return; } @@ -4091,11 +4083,6 @@ int RendererSceneRenderRD::get_max_directional_lights() const { return cluster.max_directional_lights; } -bool RendererSceneRenderRD::is_low_end() const { - // by default we switch this on this (may be ignored in some implementations) - return GLOBAL_GET("rendering/driver/rd_renderer/use_low_end_renderer"); -} - bool RendererSceneRenderRD::is_dynamic_gi_supported() const { // usable by default (unless low end = true) return true; @@ -4120,21 +4107,13 @@ RendererSceneRenderRD::RendererSceneRenderRD(RendererStorageRD *p_storage) { directional_shadow.size = GLOBAL_GET("rendering/shadows/directional_shadow/size"); directional_shadow.use_16_bits = GLOBAL_GET("rendering/shadows/directional_shadow/16_bits"); - uint32_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE); - - low_end = is_low_end(); - - if (textures_per_stage < 48) { - low_end = true; - } - /* SKY SHADER */ sky.init(storage); /* GI */ - if (!low_end && is_dynamic_gi_supported()) { + if (is_dynamic_gi_supported()) { gi.init(storage, &sky); } @@ -4172,7 +4151,7 @@ RendererSceneRenderRD::RendererSceneRenderRD(RendererStorageRD *p_storage) { cluster.directional_light_buffer = RD::get_singleton()->uniform_buffer_create(directional_light_buffer_size); } - if (!low_end && is_volumetric_supported()) { + if (is_volumetric_supported()) { String defines = "\n#define MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS " + itos(cluster.max_directional_lights) + "\n"; Vector<String> volumetric_fog_modes; volumetric_fog_modes.push_back("\n#define MODE_DENSITY\n"); @@ -4230,7 +4209,7 @@ RendererSceneRenderRD::~RendererSceneRenderRD() { RD::get_singleton()->free(sky.sky_scene_state.uniform_set); } - if (!low_end) { + if (is_dynamic_gi_supported()) { gi.free(); volumetric_fog.shader.version_free(volumetric_fog.shader_version); diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.h b/servers/rendering/renderer_rd/renderer_scene_render_rd.h index 264c0e4276..884bf2a744 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.h +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.h @@ -51,7 +51,6 @@ protected: RendererStorageRD *storage; double time; double time_step = 0; - bool low_end = false; // If true GI and Volumetric fog are disabled struct RenderBufferData { virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa) = 0; @@ -1190,8 +1189,6 @@ public: void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir); - virtual bool is_low_end() const; - virtual bool is_dynamic_gi_supported() const; virtual bool is_clustered_enabled() const; virtual bool is_volumetric_supported() const; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl index 7b86dac143..76edec1cb6 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl @@ -1735,8 +1735,6 @@ void sdfgi_process(uint cascade, vec3 cascade_pos, vec3 cam_pos, vec3 cam_normal #ifndef MODE_RENDER_DEPTH -#ifndef LOW_END_MODE - vec4 volumetric_fog_process(vec2 screen_uv, float z) { vec3 fog_pos = vec3(screen_uv, z * scene_data.volumetric_fog_inv_length); if (fog_pos.z < 0.0) { @@ -1747,7 +1745,6 @@ vec4 volumetric_fog_process(vec2 screen_uv, float z) { return texture(sampler3D(volumetric_fog_texture, material_samplers[SAMPLER_LINEAR_CLAMP]), fog_pos); } -#endif vec4 fog_process(vec3 vertex) { vec3 fog_color = scene_data.fog_light_color; @@ -2019,7 +2016,6 @@ FRAGMENT_SHADER_CODE fog = fog_process(vertex); } -#ifndef LOW_END_MODE if (scene_data.volumetric_fog_enabled) { vec4 volumetric_fog = volumetric_fog_process(screen_uv, -vertex.z); if (scene_data.fog_enabled) { @@ -2037,7 +2033,6 @@ FRAGMENT_SHADER_CODE fog = volumetric_fog; } } -#endif //!LOW_END_MODE #endif //!CUSTOM_FOG_USED uint fog_rg = packHalf2x16(fog.rg); @@ -2377,7 +2372,7 @@ FRAGMENT_SHADER_CODE specular_light = spec_accum.rgb; ambient_light = amb_accum.rgb; } -#elif !defined(LOW_END_MODE) +#else if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_GI_BUFFERS)) { //use GI buffers @@ -2412,13 +2407,11 @@ FRAGMENT_SHADER_CODE } #endif -#ifndef LOW_END_MODE if (scene_data.ssao_enabled) { float ssao = texture(sampler2D(ao_buffer, material_samplers[SAMPLER_LINEAR_CLAMP]), screen_uv).r; ao = min(ao, ssao); ao_light_affect = mix(ao_light_affect, max(ao_light_affect, scene_data.ssao_light_affect), scene_data.ssao_ao_affect); } -#endif //LOW_END_MODE { // process reflections diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl index 4ea05c9ccc..e064a90ae0 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl @@ -122,8 +122,6 @@ layout(set = 0, binding = 12, std430) restrict readonly buffer GlobalVariableDat } global_variables; -#ifndef LOW_END_MODE - struct SDFGIProbeCascadeData { vec3 position; float to_probe; @@ -159,8 +157,6 @@ layout(set = 0, binding = 13, std140) uniform SDFGI { } sdfgi; -#endif //LOW_END_MODE - /* Set 2: Render Pass (changes per render pass) */ layout(set = 1, binding = 0, std140) uniform SceneData { @@ -280,9 +276,7 @@ layout(set = 1, binding = 5) uniform texture2D directional_shadow_atlas; layout(set = 1, binding = 6) uniform texture2DArray lightmap_textures[MAX_LIGHTMAP_TEXTURES]; -#ifndef LOW_END_MOD layout(set = 1, binding = 7) uniform texture3D gi_probe_textures[MAX_GI_PROBES]; -#endif layout(set = 1, binding = 8, std430) buffer restrict readonly ClusterBuffer { uint data[]; @@ -306,8 +300,6 @@ layout(r32ui, set = 1, binding = 12) uniform restrict uimage3D geom_facing_grid; layout(set = 1, binding = 9) uniform texture2D depth_buffer; layout(set = 1, binding = 10) uniform texture2D color_buffer; -#ifndef LOW_END_MODE - layout(set = 1, binding = 11) uniform texture2D normal_roughness_buffer; layout(set = 1, binding = 12) uniform texture2D ao_buffer; layout(set = 1, binding = 13) uniform texture2D ambient_buffer; @@ -338,8 +330,6 @@ gi_probes; layout(set = 1, binding = 18) uniform texture3D volumetric_fog_texture; -#endif // LOW_END_MODE - #endif /* Set 2 Skeleton & Instancing (can change per item) */ diff --git a/servers/rendering/renderer_scene_render.h b/servers/rendering/renderer_scene_render.h index 1dea3580b6..9ca9574f6f 100644 --- a/servers/rendering/renderer_scene_render.h +++ b/servers/rendering/renderer_scene_render.h @@ -241,8 +241,6 @@ public: virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) = 0; - virtual bool is_low_end() const = 0; - virtual void update() = 0; virtual ~RendererSceneRender() {} }; |