Fix: EEVEE-Next: Ensure volume property textures are cleared
Clear volume property textures when there's no valid world volume shader. Pull Request: https://projects.blender.org/blender/blender/pulls/112871
This commit is contained in:
parent
a469640861
commit
0dfcde3fde
@ -114,17 +114,18 @@ void WorldPipeline::render(View &view)
|
||||
|
||||
void WorldVolumePipeline::sync(GPUMaterial *gpumat)
|
||||
{
|
||||
is_valid_ = GPU_material_status(gpumat) == GPU_MAT_SUCCESS;
|
||||
if (!is_valid_) {
|
||||
/* Skip if the material has not compiled yet. */
|
||||
return;
|
||||
}
|
||||
|
||||
world_ps_.init();
|
||||
world_ps_.state_set(DRW_STATE_WRITE_COLOR);
|
||||
inst_.bind_uniform_data(&world_ps_);
|
||||
inst_.volume.bind_properties_buffers(world_ps_);
|
||||
inst_.sampling.bind_resources(&world_ps_);
|
||||
|
||||
if (GPU_material_status(gpumat) != GPU_MAT_SUCCESS) {
|
||||
/* Skip if the material has not compiled yet. */
|
||||
return;
|
||||
}
|
||||
|
||||
world_ps_.material_set(*inst_.manager, gpumat);
|
||||
volume_sub_pass(world_ps_, nullptr, nullptr, gpumat);
|
||||
|
||||
@ -135,6 +136,11 @@ void WorldVolumePipeline::sync(GPUMaterial *gpumat)
|
||||
|
||||
void WorldVolumePipeline::render(View &view)
|
||||
{
|
||||
if (!is_valid_) {
|
||||
/* Skip if the material has not compiled yet. */
|
||||
return;
|
||||
}
|
||||
|
||||
inst_.manager->submit(world_ps_, view);
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,7 @@ class WorldPipeline {
|
||||
class WorldVolumePipeline {
|
||||
private:
|
||||
Instance &inst_;
|
||||
bool is_valid_;
|
||||
|
||||
PassSimple world_ps_ = {"World.Volume"};
|
||||
|
||||
@ -88,6 +89,11 @@ class WorldVolumePipeline {
|
||||
|
||||
void sync(GPUMaterial *gpumat);
|
||||
void render(View &view);
|
||||
|
||||
bool is_valid()
|
||||
{
|
||||
return is_valid_;
|
||||
}
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
@ -241,6 +241,13 @@ void VolumeModule::end_sync()
|
||||
prop_emission_tx_.ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage);
|
||||
prop_phase_tx_.ensure_3d(GPU_RG16F, data_.tex_size, usage);
|
||||
|
||||
if (!inst_.pipelines.world_volume.is_valid()) {
|
||||
prop_scattering_tx_.clear(float4(0.0f));
|
||||
prop_extinction_tx_.clear(float4(0.0f));
|
||||
prop_emission_tx_.clear(float4(0.0f));
|
||||
prop_phase_tx_.clear(float4(0.0f));
|
||||
}
|
||||
|
||||
scatter_tx_.ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage);
|
||||
extinction_tx_.ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user