mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #72404 from clayjohn/RD-sky-crash
Fix various crashes relating to low roughness_layers
This commit is contained in:
commit
97de7f39e1
@ -574,7 +574,7 @@ RID SkyRD::Sky::get_textures(SkyTextureSetVersion p_version, RID p_default_shade
|
||||
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
|
||||
u.binding = 1; // half res
|
||||
if (p_version >= SKY_TEXTURE_SET_CUBEMAP) {
|
||||
if (reflection.layers[0].views[1].is_valid() && p_version != SKY_TEXTURE_SET_CUBEMAP_HALF_RES) {
|
||||
if (reflection.layers.size() && reflection.layers[0].views.size() >= 2 && reflection.layers[0].views[1].is_valid() && p_version != SKY_TEXTURE_SET_CUBEMAP_HALF_RES) {
|
||||
u.append_id(reflection.layers[0].views[1]);
|
||||
} else {
|
||||
u.append_id(texture_storage->texture_rd_get_default(RendererRD::TextureStorage::DEFAULT_RD_TEXTURE_CUBEMAP_BLACK));
|
||||
@ -594,7 +594,7 @@ RID SkyRD::Sky::get_textures(SkyTextureSetVersion p_version, RID p_default_shade
|
||||
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
|
||||
u.binding = 2; // quarter res
|
||||
if (p_version >= SKY_TEXTURE_SET_CUBEMAP) {
|
||||
if (reflection.layers[0].views[2].is_valid() && p_version != SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES) {
|
||||
if (reflection.layers.size() && reflection.layers[0].views.size() >= 3 && reflection.layers[0].views[2].is_valid() && p_version != SKY_TEXTURE_SET_CUBEMAP_QUARTER_RES) {
|
||||
u.append_id(reflection.layers[0].views[2]);
|
||||
} else {
|
||||
u.append_id(texture_storage->texture_rd_get_default(RendererRD::TextureStorage::DEFAULT_RD_TEXTURE_CUBEMAP_BLACK));
|
||||
@ -1323,7 +1323,7 @@ void SkyRD::update_radiance_buffers(Ref<RenderSceneBuffersRD> p_render_buffers,
|
||||
|
||||
// Note, we ignore environment_get_sky_orientation here as this is applied when we do our lookup in our scene shader.
|
||||
|
||||
if (shader_data->uses_quarter_res) {
|
||||
if (shader_data->uses_quarter_res && roughness_layers >= 3) {
|
||||
RD::get_singleton()->draw_command_begin_label("Render Sky to Quarter Res Cubemap");
|
||||
PipelineCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_CUBEMAP_QUARTER_RES];
|
||||
|
||||
@ -1340,9 +1340,11 @@ void SkyRD::update_radiance_buffers(Ref<RenderSceneBuffersRD> p_render_buffers,
|
||||
RD::get_singleton()->draw_list_end();
|
||||
}
|
||||
RD::get_singleton()->draw_command_end_label();
|
||||
} else if (shader_data->uses_quarter_res && roughness_layers < 3) {
|
||||
ERR_PRINT_ED("Cannot use quarter res buffer in sky shader when roughness layers is less than 3. Please increase rendering/reflections/sky_reflections/roughness_layers.");
|
||||
}
|
||||
|
||||
if (shader_data->uses_half_res) {
|
||||
if (shader_data->uses_half_res && roughness_layers >= 2) {
|
||||
RD::get_singleton()->draw_command_begin_label("Render Sky to Half Res Cubemap");
|
||||
PipelineCacheRD *pipeline = &shader_data->pipelines[SKY_VERSION_CUBEMAP_HALF_RES];
|
||||
|
||||
@ -1359,6 +1361,8 @@ void SkyRD::update_radiance_buffers(Ref<RenderSceneBuffersRD> p_render_buffers,
|
||||
RD::get_singleton()->draw_list_end();
|
||||
}
|
||||
RD::get_singleton()->draw_command_end_label();
|
||||
} else if (shader_data->uses_half_res && roughness_layers < 2) {
|
||||
ERR_PRINT_ED("Cannot use half res buffer in sky shader when roughness layers is less than 2. Please increase rendering/reflections/sky_reflections/roughness_layers.");
|
||||
}
|
||||
|
||||
RD::DrawListID cubemap_draw_list;
|
||||
|
@ -1554,6 +1554,11 @@ bool LightStorage::reflection_probe_instance_postprocess_step(RID p_instance) {
|
||||
if (rpi->processing_side == 6) {
|
||||
rpi->processing_side = 0;
|
||||
rpi->processing_layer++;
|
||||
if (rpi->processing_layer == atlas->reflections[rpi->atlas_index].data.layers[0].mipmaps.size()) {
|
||||
rpi->rendering = false;
|
||||
rpi->processing_layer = 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user