1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Move roughness limiter and sort into their own classes

This commit is contained in:
Bastiaan Olij
2023-02-27 14:03:41 +11:00
parent 0cd1483132
commit a8ec72cf94
12 changed files with 310 additions and 344 deletions

View File

@@ -276,9 +276,7 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
int mipmaps = p_mipmaps;
uint32_t w = p_size, h = p_size;
EffectsRD *effects = RendererCompositorRD::get_singleton()->get_effects();
ERR_FAIL_NULL_MSG(effects, "Effects haven't been initialized");
bool prefer_raster_effects = effects->get_prefer_raster_effects();
bool render_buffers_can_be_storage = RendererSceneRenderRD::get_singleton()->_render_buffers_can_be_storage();
if (p_use_array) {
int num_layers = p_low_quality ? 8 : p_roughness_layers;
@@ -348,7 +346,7 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
tf.array_layers = 6;
tf.mipmaps = p_low_quality ? 7 : mipmaps - 1;
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
if (RendererSceneRenderRD::get_singleton()->_render_buffers_can_be_storage()) {
if (render_buffers_can_be_storage) {
tf.usage_bits |= RD::TEXTURE_USAGE_STORAGE_BIT;
}
@@ -364,7 +362,7 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
mm.size.height = mmh;
mm.view = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), downsampled_radiance_cubemap, 0, j, 1, RD::TEXTURE_SLICE_CUBEMAP);
RD::get_singleton()->set_resource_name(mm.view, "Downsampled Radiance Cubemap Mip " + itos(j) + " ");
if (prefer_raster_effects) {
if (render_buffers_can_be_storage) {
// we need a framebuffer for each side of our cubemap
for (int k = 0; k < 6; k++) {