summaryrefslogtreecommitdiff
path: root/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp')
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp121
1 files changed, 0 insertions, 121 deletions
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
index 02221d1536..3ea89d643f 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -49,7 +49,6 @@ void get_vogel_disk(float *r_kernel, int p_sample_count) {
}
void RasterizerSceneRD::_clear_reflection_data(ReflectionData &rd) {
-
rd.layers.clear();
rd.radiance_base_cubemap = RID();
if (rd.downsampled_radiance_cubemap.is_valid()) {
@@ -152,7 +151,6 @@ void RasterizerSceneRD::_update_reflection_data(ReflectionData &rd, int p_size,
}
void RasterizerSceneRD::_create_reflection_fast_filter(ReflectionData &rd, bool p_use_arrays) {
-
storage->get_effects()->cubemap_downsample(rd.radiance_base_cubemap, rd.downsampled_layer.mipmaps[0].view, rd.downsampled_layer.mipmaps[0].size);
for (int i = 1; i < rd.downsampled_layer.mipmaps.size(); i++) {
@@ -174,21 +172,16 @@ void RasterizerSceneRD::_create_reflection_fast_filter(ReflectionData &rd, bool
}
void RasterizerSceneRD::_create_reflection_importance_sample(ReflectionData &rd, bool p_use_arrays, int p_cube_side, int p_base_layer) {
-
if (p_use_arrays) {
-
//render directly to the layers
storage->get_effects()->cubemap_roughness(rd.radiance_base_cubemap, rd.layers[p_base_layer].views[0], p_cube_side, sky_ggx_samples_quality, float(p_base_layer) / (rd.layers.size() - 1.0), rd.layers[p_base_layer].mipmaps[0].size.x);
} else {
-
storage->get_effects()->cubemap_roughness(rd.layers[0].views[p_base_layer - 1], rd.layers[0].views[p_base_layer], p_cube_side, sky_ggx_samples_quality, float(p_base_layer) / (rd.layers[0].mipmaps.size() - 1.0), rd.layers[0].mipmaps[p_base_layer].size.x);
}
}
void RasterizerSceneRD::_update_reflection_mipmaps(ReflectionData &rd) {
-
if (sky_use_cubemap_array) {
-
for (int i = 0; i < rd.layers.size(); i++) {
for (int j = 0; j < rd.layers[i].mipmaps.size() - 1; j++) {
for (int k = 0; k < 6; k++) {
@@ -267,14 +260,12 @@ void RasterizerSceneRD::sky_set_material(RID p_sky, RID p_material) {
}
Ref<Image> RasterizerSceneRD::sky_bake_panorama(RID p_sky, float p_energy, bool p_bake_irradiance, const Size2i &p_size) {
-
Sky *sky = sky_owner.getornull(p_sky);
ERR_FAIL_COND_V(!sky, Ref<Image>());
_update_dirty_skys();
if (sky->radiance.is_valid()) {
-
RD::TextureFormat tf;
tf.format = RD::DATA_FORMAT_R32G32B32A32_SFLOAT;
tf.width = p_size.width;
@@ -305,11 +296,9 @@ Ref<Image> RasterizerSceneRD::sky_bake_panorama(RID p_sky, float p_energy, bool
}
void RasterizerSceneRD::_update_dirty_skys() {
-
Sky *sky = dirty_sky_list;
while (sky) {
-
bool texture_set_dirty = false;
//update sky configuration if texture is missing
@@ -421,7 +410,6 @@ RID RasterizerSceneRD::sky_get_radiance_uniform_set_rd(RID p_sky, RID p_shader,
ERR_FAIL_COND_V(!sky, RID());
if (sky->uniform_set.is_null() || !RD::get_singleton()->uniform_set_is_valid(sky->uniform_set)) {
-
sky->uniform_set = RID();
if (sky->radiance.is_valid()) {
Vector<RD::Uniform> uniforms;
@@ -441,7 +429,6 @@ RID RasterizerSceneRD::sky_get_radiance_uniform_set_rd(RID p_sky, RID p_shader,
}
RID RasterizerSceneRD::_get_sky_textures(Sky *p_sky, SkyTextureSetVersion p_version) {
-
if (p_sky->texture_uniform_sets[p_version].is_valid() && RD::get_singleton()->uniform_set_is_valid(p_sky->texture_uniform_sets[p_version])) {
return p_sky->texture_uniform_sets[p_version];
}
@@ -508,7 +495,6 @@ RID RasterizerSceneRD::sky_get_material(RID p_sky) const {
}
void RasterizerSceneRD::_draw_sky(bool p_can_continue_color, bool p_can_continue_depth, RID p_fb, RID p_environment, const CameraMatrix &p_projection, const Transform &p_transform) {
-
ERR_FAIL_COND(!is_environment(p_environment));
Sky *sky = sky_owner.getornull(environment_get_sky(p_environment));
@@ -545,7 +531,6 @@ void RasterizerSceneRD::_draw_sky(bool p_can_continue_color, bool p_can_continue
CameraMatrix camera;
if (custom_fov) {
-
float near_plane = p_projection.get_z_near();
float far_plane = p_projection.get_z_far();
float aspect = p_projection.get_aspect();
@@ -594,7 +579,6 @@ void RasterizerSceneRD::_draw_sky(bool p_can_continue_color, bool p_can_continue
}
void RasterizerSceneRD::_setup_sky(RID p_environment, const Vector3 &p_position, const Size2i p_screen_size) {
-
ERR_FAIL_COND(!is_environment(p_environment));
Sky *sky = sky_owner.getornull(environment_get_sky(p_environment));
@@ -652,26 +636,22 @@ void RasterizerSceneRD::_setup_sky(RID p_environment, const Vector3 &p_position,
}
if (shader_data->uses_time && time - sky->prev_time > 0.00001) {
-
sky->prev_time = time;
sky->reflection.dirty = true;
RenderingServerRaster::redraw_request();
}
if (material != sky->prev_material) {
-
sky->prev_material = material;
sky->reflection.dirty = true;
}
if (material->uniform_set_updated) {
-
material->uniform_set_updated = false;
sky->reflection.dirty = true;
}
if (!p_position.is_equal_approx(sky->prev_position) && shader_data->uses_position) {
-
sky->prev_position = p_position;
sky->reflection.dirty = true;
}
@@ -704,7 +684,6 @@ void RasterizerSceneRD::_setup_sky(RID p_environment, const Vector3 &p_position,
}
if (light_data_dirty || sky_scene_state.light_uniform_set.is_null()) {
-
RD::get_singleton()->buffer_update(sky_scene_state.directional_light_buffer, 0, sizeof(SkyDirectionalLightData) * sky_scene_state.max_directional_lights, sky_scene_state.directional_lights, true);
if (sky_scene_state.light_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(sky_scene_state.light_uniform_set)) {
@@ -732,7 +711,6 @@ void RasterizerSceneRD::_setup_sky(RID p_environment, const Vector3 &p_position,
}
void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_projection, const Transform &p_transform) {
-
ERR_FAIL_COND(!is_environment(p_environment));
Sky *sky = sky_owner.getornull(environment_get_sky(p_environment));
@@ -764,7 +742,6 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
// Update radiance cubemap
if (sky->reflection.dirty) {
-
static const Vector3 view_normals[6] = {
Vector3(+1, 0, 0),
Vector3(-1, 0, 0),
@@ -945,7 +922,6 @@ void RasterizerSceneRD::SkyShaderData::set_code(const String &p_code) {
//update pipelines
for (int i = 0; i < SKY_VERSION_MAX; i++) {
-
RD::PipelineDepthStencilState depth_stencil_state;
depth_stencil_state.enable_depth_test = true;
depth_stencil_state.depth_compare_operator = RD::COMPARE_OP_LESS_OR_EQUAL;
@@ -966,11 +942,9 @@ void RasterizerSceneRD::SkyShaderData::set_default_texture_param(const StringNam
}
void RasterizerSceneRD::SkyShaderData::get_param_list(List<PropertyInfo> *p_param_list) const {
-
Map<int, StringName> order;
for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = uniforms.front(); E; E = E->next()) {
-
if (E->get().scope == ShaderLanguage::ShaderNode::Uniform::SCOPE_GLOBAL || E->get().scope == ShaderLanguage::ShaderNode::Uniform::SCOPE_INSTANCE) {
continue;
}
@@ -983,7 +957,6 @@ void RasterizerSceneRD::SkyShaderData::get_param_list(List<PropertyInfo> *p_para
}
for (Map<int, StringName>::Element *E = order.front(); E; E = E->next()) {
-
PropertyInfo pi = ShaderLanguage::uniform_to_property_info(uniforms[E->get()]);
pi.name = E->get();
p_param_list->push_back(pi);
@@ -991,9 +964,7 @@ void RasterizerSceneRD::SkyShaderData::get_param_list(List<PropertyInfo> *p_para
}
void RasterizerSceneRD::SkyShaderData::get_instance_param_list(List<RasterizerStorage::InstanceShaderParam> *p_param_list) const {
-
for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = uniforms.front(); E; E = E->next()) {
-
if (E->get().scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_INSTANCE) {
continue;
}
@@ -1051,7 +1022,6 @@ RasterizerStorageRD::ShaderData *RasterizerSceneRD::_create_sky_shader_func() {
}
void RasterizerSceneRD::SkyMaterialData::update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {
-
RasterizerSceneRD *scene_singleton = (RasterizerSceneRD *)RasterizerSceneRD::singleton;
uniform_set_updated = true;
@@ -1078,7 +1048,6 @@ void RasterizerSceneRD::SkyMaterialData::update_parameters(const Map<StringName,
//check whether buffer changed
if (p_uniform_dirty && ubo_data.size()) {
-
update_uniform_buffer(shader_data->uniforms, shader_data->ubo_offsets.ptr(), p_parameters, ubo_data.ptrw(), ubo_data.size(), false);
RD::get_singleton()->buffer_update(uniform_buffer, 0, ubo_data.size(), ubo_data.ptrw());
}
@@ -1097,7 +1066,6 @@ void RasterizerSceneRD::SkyMaterialData::update_parameters(const Map<StringName,
}
if (p_textures_dirty && tex_uniform_count) {
-
update_textures(p_parameters, shader_data->default_texture_params, shader_data->texture_uniforms, texture_cache.ptrw(), true);
}
@@ -1114,7 +1082,6 @@ void RasterizerSceneRD::SkyMaterialData::update_parameters(const Map<StringName,
Vector<RD::Uniform> uniforms;
{
-
if (shader_data->ubo_size) {
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_UNIFORM_BUFFER;
@@ -1155,7 +1122,6 @@ RasterizerStorageRD::MaterialData *RasterizerSceneRD::_create_sky_material_func(
}
RID RasterizerSceneRD::environment_create() {
-
return environment_owner.make_rid(Environent());
}
@@ -1289,7 +1255,6 @@ void RasterizerSceneRD::environment_set_tonemap(RID p_env, RS::EnvironmentToneMa
}
void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) {
-
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
env->glow_enabled = p_enable;
@@ -1309,7 +1274,6 @@ void RasterizerSceneRD::environment_glow_set_use_bicubic_upscale(bool p_enable)
}
void RasterizerSceneRD::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) {
-
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -1329,7 +1293,6 @@ RS::EnvironmentSSRRoughnessQuality RasterizerSceneRD::environment_get_ssr_roughn
}
void RasterizerSceneRD::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
-
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -1348,7 +1311,6 @@ void RasterizerSceneRD::environment_set_ssao_quality(RS::EnvironmentSSAOQuality
}
bool RasterizerSceneRD::environment_is_ssao_enabled(RID p_env) const {
-
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND_V(!env, false);
return env->ssao_enabled;
@@ -1366,7 +1328,6 @@ float RasterizerSceneRD::environment_get_ssao_light_affect(RID p_env) const {
}
bool RasterizerSceneRD::environment_is_ssr_enabled(RID p_env) const {
-
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND_V(!env, false);
return env->ssr_enabled;
@@ -1416,7 +1377,6 @@ Ref<Image> RasterizerSceneRD::environment_bake_panorama(RID p_env, bool p_bake_i
////////////////////////////////////////////////////////////
RID RasterizerSceneRD::reflection_atlas_create() {
-
ReflectionAtlas ra;
ra.count = GLOBAL_GET("rendering/quality/reflection_atlas/reflection_count");
ra.size = GLOBAL_GET("rendering/quality/reflection_atlas/reflection_size");
@@ -1425,7 +1385,6 @@ RID RasterizerSceneRD::reflection_atlas_create() {
}
void RasterizerSceneRD::reflection_atlas_set_size(RID p_ref_atlas, int p_reflection_size, int p_reflection_count) {
-
ReflectionAtlas *ra = reflection_atlas_owner.getornull(p_ref_atlas);
ERR_FAIL_COND(!ra);
@@ -1472,7 +1431,6 @@ void RasterizerSceneRD::reflection_probe_instance_set_transform(RID p_instance,
}
void RasterizerSceneRD::reflection_probe_release_atlas_index(RID p_instance) {
-
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance);
ERR_FAIL_COND(!rpi);
@@ -1488,7 +1446,6 @@ void RasterizerSceneRD::reflection_probe_release_atlas_index(RID p_instance) {
}
bool RasterizerSceneRD::reflection_probe_instance_needs_redraw(RID p_instance) {
-
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance);
ERR_FAIL_COND_V(!rpi, false);
@@ -1508,7 +1465,6 @@ bool RasterizerSceneRD::reflection_probe_instance_needs_redraw(RID p_instance) {
}
bool RasterizerSceneRD::reflection_probe_instance_has_reflection(RID p_instance) {
-
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance);
ERR_FAIL_COND_V(!rpi, false);
@@ -1516,7 +1472,6 @@ bool RasterizerSceneRD::reflection_probe_instance_has_reflection(RID p_instance)
}
bool RasterizerSceneRD::reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas) {
-
ReflectionAtlas *atlas = reflection_atlas_owner.getornull(p_reflection_atlas);
ERR_FAIL_COND_V(!atlas, false);
@@ -1561,7 +1516,6 @@ bool RasterizerSceneRD::reflection_probe_instance_begin_render(RID p_instance, R
atlas->reflection = RD::get_singleton()->texture_create(tf, RD::TextureView());
}
{
-
RD::TextureFormat tf;
tf.format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D32_SFLOAT, RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ? RD::DATA_FORMAT_D32_SFLOAT : RD::DATA_FORMAT_X8_D24_UNORM_PACK32;
tf.width = atlas->size;
@@ -1617,7 +1571,6 @@ bool RasterizerSceneRD::reflection_probe_instance_begin_render(RID p_instance, R
}
bool RasterizerSceneRD::reflection_probe_instance_postprocess_step(RID p_instance) {
-
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance);
ERR_FAIL_COND_V(!rpi, false);
ERR_FAIL_COND_V(!rpi->rendering, false);
@@ -1695,12 +1648,10 @@ RID RasterizerSceneRD::reflection_probe_instance_get_depth_framebuffer(RID p_ins
///////////////////////////////////////////////////////////
RID RasterizerSceneRD::shadow_atlas_create() {
-
return shadow_atlas_owner.make_rid(ShadowAtlas());
}
void RasterizerSceneRD::shadow_atlas_set_size(RID p_atlas, int p_size) {
-
ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_atlas);
ERR_FAIL_COND(!shadow_atlas);
ERR_FAIL_COND(p_size < 0);
@@ -1733,7 +1684,6 @@ void RasterizerSceneRD::shadow_atlas_set_size(RID p_atlas, int p_size) {
shadow_atlas->size = p_size;
if (shadow_atlas->size) {
-
RD::TextureFormat tf;
tf.format = RD::DATA_FORMAT_R32_SFLOAT;
tf.width = shadow_atlas->size;
@@ -1745,7 +1695,6 @@ void RasterizerSceneRD::shadow_atlas_set_size(RID p_atlas, int p_size) {
}
void RasterizerSceneRD::shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision) {
-
ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_atlas);
ERR_FAIL_COND(!shadow_atlas);
ERR_FAIL_INDEX(p_quadrant, 4);
@@ -1765,7 +1714,6 @@ void RasterizerSceneRD::shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p
//erase all data from quadrant
for (int i = 0; i < shadow_atlas->quadrants[p_quadrant].shadows.size(); i++) {
-
if (shadow_atlas->quadrants[p_quadrant].shadows[i].owner.is_valid()) {
shadow_atlas->shadow_owners.erase(shadow_atlas->quadrants[p_quadrant].shadows[i].owner);
LightInstance *li = light_instance_owner.getornull(shadow_atlas->quadrants[p_quadrant].shadows[i].owner);
@@ -1808,9 +1756,7 @@ void RasterizerSceneRD::shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p
}
bool RasterizerSceneRD::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow) {
-
for (int i = p_quadrant_count - 1; i >= 0; i--) {
-
int qidx = p_in_quadrants[i];
if (shadow_atlas->quadrants[qidx].subdivision == (uint32_t)p_current_subdiv) {
@@ -1835,7 +1781,6 @@ bool RasterizerSceneRD::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int
ERR_CONTINUE(!sli);
if (sli->last_scene_pass != scene_pass) {
-
//was just allocated, don't kill it so soon, wait a bit..
if (p_tick - sarr[j].alloc_tick < shadow_atlas_realloc_tolerance_msec)
continue;
@@ -1864,7 +1809,6 @@ bool RasterizerSceneRD::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int
}
bool RasterizerSceneRD::shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version) {
-
ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_atlas);
ERR_FAIL_COND_V(!shadow_atlas, false);
@@ -1998,7 +1942,6 @@ bool RasterizerSceneRD::shadow_atlas_update_light(RID p_atlas, RID p_light_intan
}
void RasterizerSceneRD::directional_shadow_atlas_set_size(int p_size) {
-
p_size = nearest_power_of_2_templated(p_size);
if (directional_shadow.size == p_size) {
@@ -2013,7 +1956,6 @@ void RasterizerSceneRD::directional_shadow_atlas_set_size(int p_size) {
}
if (p_size > 0) {
-
RD::TextureFormat tf;
tf.format = RD::DATA_FORMAT_R32_SFLOAT;
tf.width = p_size;
@@ -2027,13 +1969,11 @@ void RasterizerSceneRD::directional_shadow_atlas_set_size(int p_size) {
}
void RasterizerSceneRD::set_directional_shadow_count(int p_count) {
-
directional_shadow.light_count = p_count;
directional_shadow.current_light = 0;
}
static Rect2i _get_directional_shadow_rect(int p_size, int p_shadow_count, int p_shadow_index) {
-
int split_h = 1;
int split_v = 1;
@@ -2056,7 +1996,6 @@ static Rect2i _get_directional_shadow_rect(int p_size, int p_shadow_count, int p
}
int RasterizerSceneRD::get_directional_light_shadow_size(RID p_light_intance) {
-
ERR_FAIL_COND_V(directional_shadow.light_count == 0, 0);
Rect2i r = _get_directional_shadow_rect(directional_shadow.size, directional_shadow.light_count, 0);
@@ -2081,18 +2020,15 @@ int RasterizerSceneRD::get_directional_light_shadow_size(RID p_light_intance) {
//////////////////////////////////////////////////
RID RasterizerSceneRD::camera_effects_create() {
-
return camera_effects_owner.make_rid(CameraEffects());
}
void RasterizerSceneRD::camera_effects_set_dof_blur_quality(RS::DOFBlurQuality p_quality, bool p_use_jitter) {
-
dof_blur_quality = p_quality;
dof_blur_use_jitter = p_use_jitter;
}
void RasterizerSceneRD::camera_effects_set_dof_blur_bokeh_shape(RS::DOFBokehShape p_shape) {
-
dof_blur_bokeh_shape = p_shape;
}
@@ -2112,7 +2048,6 @@ void RasterizerSceneRD::camera_effects_set_dof_blur(RID p_camera_effects, bool p
}
void RasterizerSceneRD::camera_effects_set_custom_exposure(RID p_camera_effects, bool p_enable, float p_exposure) {
-
CameraEffects *camfx = camera_effects_owner.getornull(p_camera_effects);
ERR_FAIL_COND(!camfx);
@@ -2121,7 +2056,6 @@ void RasterizerSceneRD::camera_effects_set_custom_exposure(RID p_camera_effects,
}
RID RasterizerSceneRD::light_instance_create(RID p_light) {
-
RID li = light_instance_owner.make_rid(LightInstance());
LightInstance *light_instance = light_instance_owner.getornull(li);
@@ -2134,7 +2068,6 @@ RID RasterizerSceneRD::light_instance_create(RID p_light) {
}
void RasterizerSceneRD::light_instance_set_transform(RID p_light_instance, const Transform &p_transform) {
-
LightInstance *light_instance = light_instance_owner.getornull(p_light_instance);
ERR_FAIL_COND(!light_instance);
@@ -2142,7 +2075,6 @@ void RasterizerSceneRD::light_instance_set_transform(RID p_light_instance, const
}
void RasterizerSceneRD::light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_shadow_texel_size, float p_bias_scale, float p_range_begin, const Vector2 &p_uv_scale) {
-
LightInstance *light_instance = light_instance_owner.getornull(p_light_instance);
ERR_FAIL_COND(!light_instance);
@@ -2163,7 +2095,6 @@ void RasterizerSceneRD::light_instance_set_shadow_transform(RID p_light_instance
}
void RasterizerSceneRD::light_instance_mark_visible(RID p_light_instance) {
-
LightInstance *light_instance = light_instance_owner.getornull(p_light_instance);
ERR_FAIL_COND(!light_instance);
@@ -2171,9 +2102,7 @@ void RasterizerSceneRD::light_instance_mark_visible(RID p_light_instance) {
}
RasterizerSceneRD::ShadowCubemap *RasterizerSceneRD::_get_shadow_cubemap(int p_size) {
-
if (!shadow_cubemaps.has(p_size)) {
-
ShadowCubemap sc;
{
RD::TextureFormat tf;
@@ -2200,9 +2129,7 @@ RasterizerSceneRD::ShadowCubemap *RasterizerSceneRD::_get_shadow_cubemap(int p_s
}
RasterizerSceneRD::ShadowMap *RasterizerSceneRD::_get_shadow_map(const Size2i &p_size) {
-
if (!shadow_maps.has(p_size)) {
-
ShadowMap sm;
{
RD::TextureFormat tf;
@@ -2262,7 +2189,6 @@ RID RasterizerSceneRD::gi_probe_instance_create(RID p_base) {
}
void RasterizerSceneRD::gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) {
-
GIProbeInstance *gi_probe = gi_probe_instance_owner.getornull(p_probe);
ERR_FAIL_COND(!gi_probe);
@@ -2278,7 +2204,6 @@ bool RasterizerSceneRD::gi_probe_needs_update(RID p_probe) const {
}
void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instances, const Vector<RID> &p_light_instances, int p_dynamic_object_count, InstanceBase **p_dynamic_objects) {
-
GIProbeInstance *gi_probe = gi_probe_instance_owner.getornull(p_probe);
ERR_FAIL_COND(!gi_probe);
@@ -2530,7 +2455,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
dmap.depth = RD::get_singleton()->texture_create(dtf, RD::TextureView());
if (gi_probe->dynamic_maps.size() == 0) {
-
dtf.format = RD::DATA_FORMAT_R8G8B8A8_UNORM;
dtf.usage_bits = RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
dmap.albedo = RD::get_singleton()->texture_create(dtf, RD::TextureView());
@@ -2638,7 +2562,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
}
if (write) {
-
{
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_IMAGE;
@@ -2671,7 +2594,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
}
if (plot) {
-
{
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_IMAGE;
@@ -2725,7 +2647,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
uint32_t light_count = 0;
if (p_update_light_instances || p_dynamic_object_count > 0) {
-
light_count = MIN(gi_probe_max_lights, (uint32_t)p_light_instances.size());
{
@@ -2805,9 +2726,7 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
int wg_limit_x = RD::get_singleton()->limit_get(RD::LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_X);
for (int pass = 0; pass < passes; pass++) {
-
if (p_update_light_instances) {
-
for (int i = 0; i < gi_probe->mipmaps.size(); i++) {
if (i == 0) {
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, giprobe_lighting_shader_version_pipelines[pass == 0 ? GI_PROBE_SHADER_VERSION_COMPUTE_LIGHT : GI_PROBE_SHADER_VERSION_COMPUTE_SECOND_BOUNCE]);
@@ -2843,7 +2762,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, giprobe_lighting_shader_version_pipelines[GI_PROBE_SHADER_VERSION_WRITE_TEXTURE]);
for (int i = 0; i < gi_probe->mipmaps.size(); i++) {
-
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, gi_probe->mipmaps[i].write_uniform_set, 0);
push_constant.cell_offset = gi_probe->mipmaps[i].cell_offset;
@@ -2867,7 +2785,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
gi_probe->has_dynamic_object_data = false; //clear until dynamic object data is used again
if (p_dynamic_object_count && gi_probe->dynamic_maps.size()) {
-
Vector3i octree_size = storage->gi_probe_get_octree_size(gi_probe->probe);
int multiplier = gi_probe->dynamic_maps[0].size / MAX(MAX(octree_size.x, octree_size.y), octree_size.z);
@@ -2882,7 +2799,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
//this could probably be better parallelized in compute..
for (int i = 0; i < p_dynamic_object_count; i++) {
-
InstanceBase *instance = p_dynamic_objects[i];
//not used, so clear
instance->depth_layer = 0;
@@ -2911,7 +2827,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
//print_line("aabb: " + aabb);
for (int j = 0; j < 6; j++) {
-
//if (j != 0 && j != 3) {
// continue;
//}
@@ -3000,7 +2915,6 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
//print_line("rect: " + itos(i) + ": " + rect);
for (int k = 1; k < gi_probe->dynamic_maps.size(); k++) {
-
// enlarge the rect if needed so all pixels fit when downscaled,
// this ensures downsampling is smooth and optimal because no pixels are left behind
@@ -3098,7 +3012,6 @@ void RasterizerSceneRD::_debug_giprobe(RID p_gi_probe, RD::DrawListID p_draw_lis
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
-
push_constant.projection[i * 4 + j] = transform.matrix[i][j];
}
}
@@ -3161,7 +3074,6 @@ void RasterizerSceneRD::_debug_giprobe(RID p_gi_probe, RD::DrawListID p_draw_lis
}
const Vector<RID> &RasterizerSceneRD::gi_probe_get_slots() const {
-
return gi_probe_slots;
}
@@ -3200,7 +3112,6 @@ void RasterizerSceneRD::_allocate_blur_textures(RenderBuffers *rb) {
int base_height = rb->height;
for (uint32_t i = 0; i < mipmaps_required; i++) {
-
RenderBuffers::Blur::Mipmap mm;
mm.texture = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb->blur[0].texture, 0, i);
@@ -3210,7 +3121,6 @@ void RasterizerSceneRD::_allocate_blur_textures(RenderBuffers *rb) {
rb->blur[0].mipmaps.push_back(mm);
if (i > 0) {
-
mm.texture = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb->blur[1].texture, 0, i - 1);
rb->blur[1].mipmaps.push_back(mm);
@@ -3255,7 +3165,6 @@ void RasterizerSceneRD::_allocate_luminance_textures(RenderBuffers *rb) {
}
void RasterizerSceneRD::_free_render_buffer_data(RenderBuffers *rb) {
-
if (rb->texture.is_valid()) {
RD::get_singleton()->free(rb->texture);
rb->texture = RID();
@@ -3321,7 +3230,6 @@ void RasterizerSceneRD::_free_render_buffer_data(RenderBuffers *rb) {
}
void RasterizerSceneRD::_process_sss(RID p_render_buffers, const CameraMatrix &p_camera) {
-
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
ERR_FAIL_COND(!rb);
@@ -3341,7 +3249,6 @@ void RasterizerSceneRD::_process_sss(RID p_render_buffers, const CameraMatrix &p
}
void RasterizerSceneRD::_process_ssr(RID p_render_buffers, RID p_dest_framebuffer, RID p_normal_buffer, RID p_roughness_buffer, RID p_specular_buffer, RID p_metallic, const Color &p_metallic_mask, RID p_environment, const CameraMatrix &p_projection, bool p_use_additive) {
-
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
ERR_FAIL_COND(!rb);
@@ -3395,7 +3302,6 @@ void RasterizerSceneRD::_process_ssr(RID p_render_buffers, RID p_dest_framebuffe
}
void RasterizerSceneRD::_process_ssao(RID p_render_buffers, RID p_environment, RID p_normal_buffer, const CameraMatrix &p_projection) {
-
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
ERR_FAIL_COND(!rb);
@@ -3463,7 +3369,6 @@ void RasterizerSceneRD::_process_ssao(RID p_render_buffers, RID p_environment, R
}
void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_buffers, RID p_environment, RID p_camera_effects, const CameraMatrix &p_projection) {
-
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
ERR_FAIL_COND(!rb);
@@ -3474,7 +3379,6 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
bool can_use_effects = rb->width >= 8 && rb->height >= 8;
if (can_use_effects && camfx && (camfx->dof_blur_near_enabled || camfx->dof_blur_far_enabled) && camfx->dof_blur_amount > 0.0) {
-
if (rb->blur[0].texture.is_null()) {
_allocate_blur_textures(rb);
_render_buffers_uniform_set_changed(p_render_buffers);
@@ -3485,7 +3389,6 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
}
if (can_use_effects && env && env->auto_exposure) {
-
if (rb->luminance.current.is_null()) {
_allocate_luminance_textures(rb);
_render_buffers_uniform_set_changed(p_render_buffers);
@@ -3506,7 +3409,6 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
int glow_mask = 0;
if (can_use_effects && env && env->glow_enabled) {
-
/* see that blur textures are allocated */
if (rb->blur[0].texture.is_null()) {
@@ -3516,7 +3418,6 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
for (int i = 0; i < RS::MAX_GLOW_LEVELS; i++) {
if (env->glow_levels & (1 << i)) {
-
if (i >= rb->blur[1].mipmaps.size()) {
max_glow_level = rb->blur[1].mipmaps.size() - 1;
glow_mask |= 1 << max_glow_level;
@@ -3529,7 +3430,6 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
}
for (int i = 0; i < (max_glow_level + 1); i++) {
-
int vp_w = rb->blur[1].mipmaps[i].width;
int vp_h = rb->blur[1].mipmaps[i].height;
@@ -3556,7 +3456,6 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
tonemap.exposure_texture = rb->luminance.current;
tonemap.auto_exposure_grey = env->auto_exp_scale;
} else {
-
tonemap.exposure_texture = storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE);
}
@@ -3651,7 +3550,6 @@ void RasterizerSceneRD::_render_buffers_debug_draw(RID p_render_buffers, RID p_s
}
RID RasterizerSceneRD::render_buffers_get_back_buffer_texture(RID p_render_buffers) {
-
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
ERR_FAIL_COND_V(!rb, RID());
if (!rb->blur[0].texture.is_valid()) {
@@ -3668,7 +3566,6 @@ RID RasterizerSceneRD::render_buffers_get_ao_texture(RID p_render_buffers) {
}
void RasterizerSceneRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa) {
-
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
rb->width = p_width;
rb->height = p_height;
@@ -3723,7 +3620,6 @@ void RasterizerSceneRD::sub_surface_scattering_set_scale(float p_scale, float p_
}
void RasterizerSceneRD::shadows_quality_set(RS::ShadowQuality p_quality) {
-
ERR_FAIL_INDEX_MSG(p_quality, RS::SHADOW_QUALITY_MAX, "Shadow quality too high, please see RenderingServer's ShadowQuality enum");
if (shadows_quality != p_quality) {
@@ -3764,7 +3660,6 @@ void RasterizerSceneRD::shadows_quality_set(RS::ShadowQuality p_quality) {
}
void RasterizerSceneRD::directional_shadow_quality_set(RS::ShadowQuality p_quality) {
-
ERR_FAIL_INDEX_MSG(p_quality, RS::SHADOW_QUALITY_MAX, "Shadow quality too high, please see RenderingServer's ShadowQuality enum");
if (directional_shadow_quality != p_quality) {
@@ -3819,7 +3714,6 @@ RasterizerSceneRD::RenderBufferData *RasterizerSceneRD::render_buffers_get_data(
}
void RasterizerSceneRD::render_scene(RID p_render_buffers, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID *p_gi_probe_cull_result, int p_gi_probe_cull_count, RID *p_decal_cull_result, int p_decal_cull_count, InstanceBase **p_lightmap_cull_result, int p_lightmap_cull_count, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {
-
Color clear_color;
if (p_render_buffers.is_valid()) {
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
@@ -3840,7 +3734,6 @@ void RasterizerSceneRD::render_scene(RID p_render_buffers, const Transform &p_ca
}
void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) {
-
LightInstance *light_instance = light_instance_owner.getornull(p_light);
ERR_FAIL_COND(!light_instance);
@@ -3882,7 +3775,6 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
atlas_rect.size.height = light_instance->directional_rect.size.y;
if (storage->light_directional_get_shadow_mode(light_instance->light) == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
-
atlas_rect.size.width /= 2;
atlas_rect.size.height /= 2;
@@ -3896,11 +3788,9 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
}
} else if (storage->light_directional_get_shadow_mode(light_instance->light) == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
-
atlas_rect.size.height /= 2;
if (p_pass == 0) {
-
} else {
atlas_rect.position.y += atlas_rect.size.height;
}
@@ -3953,9 +3843,7 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
normal_bias = storage->light_get_param(light_instance->light, RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS);
if (storage->light_get_type(light_instance->light) == RS::LIGHT_OMNI) {
-
if (storage->light_omni_get_shadow_mode(light_instance->light) == RS::LIGHT_OMNI_SHADOW_CUBE) {
-
ShadowCubemap *cubemap = _get_shadow_cubemap(shadow_size / 2);
render_fb = cubemap->side_fb[p_pass];
@@ -3967,7 +3855,6 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
finalize_cubemap = p_pass == 5;
} else {
-
light_projection = light_instance->shadow_transform[0].camera;
light_transform = light_instance->shadow_transform[0].transform;
@@ -3983,7 +3870,6 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
}
} else if (storage->light_get_type(light_instance->light) == RS::LIGHT_SPOT) {
-
light_projection = light_instance->shadow_transform[0].camera;
light_transform = light_instance->shadow_transform[0].transform;
@@ -4024,12 +3910,10 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
}
void RasterizerSceneRD::render_material(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID p_framebuffer, const Rect2i &p_region) {
-
_render_material(p_cam_transform, p_cam_projection, p_cam_ortogonal, p_cull_result, p_cull_count, p_framebuffer, p_region);
}
bool RasterizerSceneRD::free(RID p_rid) {
-
if (render_buffers_owner.owns(p_rid)) {
RenderBuffers *rb = render_buffers_owner.getornull(p_rid);
_free_render_buffer_data(rb);
@@ -4101,7 +3985,6 @@ bool RasterizerSceneRD::free(RID p_rid) {
sky_owner.free(p_rid);
} else if (light_instance_owner.owns(p_rid)) {
-
LightInstance *light_instance = light_instance_owner.getornull(p_rid);
//remove from shadow atlases..
@@ -4119,7 +4002,6 @@ bool RasterizerSceneRD::free(RID p_rid) {
light_instance_owner.free(p_rid);
} else if (shadow_atlas_owner.owns(p_rid)) {
-
shadow_atlas_set_size(p_rid, 0);
shadow_atlas_owner.free(p_rid);
@@ -4157,7 +4039,6 @@ float RasterizerSceneRD::screen_space_roughness_limiter_get_curve() const {
}
TypedArray<Image> RasterizerSceneRD::bake_render_uv2(RID p_base, const Vector<RID> &p_material_overrides, const Size2i &p_image_size) {
-
RD::TextureFormat tf;
tf.format = RD::DATA_FORMAT_R8G8B8A8_UNORM;
tf.width = p_image_size.width; // Always 64x64
@@ -4262,7 +4143,6 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
uint32_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE);
{
-
//kinda complicated to compute the amount of slots, we try to use as many as we can
gi_probe_max_lights = 32;
@@ -4317,7 +4197,6 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
}
{
-
String defines;
if (gi_probe_use_anisotropy) {
defines += "\n#define USE_ANISOTROPY\n";