Cleanup: EEVEE-Next: Remove unused mip level in remap shader

This commit is contained in:
Clément Foucault
2024-02-14 18:45:34 +01:00
parent da72cdee5e
commit 7b328390f4
4 changed files with 3 additions and 11 deletions

View File

@@ -46,7 +46,6 @@ void SphereProbeModule::begin_sync()
pass.push_constant("probe_coord_packed", reinterpret_cast<int4 *>(&probe_sampling_coord_));
pass.push_constant("write_coord_packed", reinterpret_cast<int4 *>(&probe_write_coord_));
pass.push_constant("world_coord_packed", reinterpret_cast<int4 *>(&world_data.atlas_coord));
pass.push_constant("mip_level", &probe_mip_level_);
pass.push_constant("probe_brightness_clamp", probe_brightness_clamp);
pass.dispatch(&dispatch_probe_pack_);
}
@@ -134,11 +133,8 @@ void SphereProbeModule::end_sync()
void SphereProbeModule::ensure_cubemap_render_target(int resolution)
{
if (cubemap_tx_.ensure_cube(
GPU_RGBA16F, resolution, GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ))
{
GPU_texture_mipmap_mode(cubemap_tx_, false, true);
}
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
cubemap_tx_.ensure_cube(GPU_RGBA16F, resolution, usage);
/* TODO(fclem): deallocate it. */
}
@@ -197,7 +193,6 @@ void SphereProbeModule::remap_to_octahedral_projection(const SphereProbeAtlasCoo
/* Update shader parameters that change per dispatch. */
probe_sampling_coord_ = atlas_coord.as_sampling_coord(max_resolution_);
probe_write_coord_ = atlas_coord.as_write_coord(max_resolution_, 0);
probe_mip_level_ = atlas_coord.subdivision_lvl;
dispatch_probe_pack_ = int3(int2(ceil_division(resolution, SPHERE_PROBE_GROUP_SIZE)), 1);
instance_.manager->submit(remap_ps_);

View File

@@ -74,8 +74,6 @@ class SphereProbeModule {
Texture cubemap_tx_ = {"Probe.Cubemap"};
/** Index of the probe being updated. */
int probe_index_ = 0;
/** Mip level being sampled for remapping. */
int probe_mip_level_ = 0;
/** Updated Probe coordinates in the atlas. */
SphereProbeUvArea probe_sampling_coord_;
SphereProbePixelArea probe_write_coord_;

View File

@@ -61,7 +61,7 @@ void main()
vec2 wrapped_uv = mirror_repeat_uv(sampling_uv);
/* Direction in world space. */
vec3 direction = octahedral_uv_to_direction(wrapped_uv);
vec4 radiance_and_transmittance = textureLod(cubemap_tx, direction, float(mip_level));
vec4 radiance_and_transmittance = texture(cubemap_tx, direction);
vec3 radiance = radiance_and_transmittance.xyz;
float opacity = 1.0 - radiance_and_transmittance.a;

View File

@@ -22,7 +22,6 @@ GPU_SHADER_CREATE_INFO(eevee_reflection_probe_remap)
.push_constant(Type::IVEC4, "probe_coord_packed")
.push_constant(Type::IVEC4, "write_coord_packed")
.push_constant(Type::IVEC4, "world_coord_packed")
.push_constant(Type::INT, "mip_level")
.push_constant(Type::FLOAT, "probe_brightness_clamp")
.sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx")
.sampler(1, ImageType::FLOAT_2D_ARRAY, "atlas_tx")