EEVEE: Bypass lightprobe setup in tests without any lit materials

This significantly reduce the overhead of simple tests
like the image tests.

Before (warm run)
```
(.venv) $[build_linux] ctest -R eevee_opengl_image_
Test project /mnt/data/Blender/build_linux
    Start 257: eevee_opengl_image_colorspace
1/4 Test #257: eevee_opengl_image_colorspace ......   Passed    7.28 sec
    Start 258: eevee_opengl_image_data_types
2/4 Test #258: eevee_opengl_image_data_types ......   Passed   16.24 sec
    Start 259: eevee_opengl_image_mapping
3/4 Test #259: eevee_opengl_image_mapping .........   Passed   17.99 sec
    Start 260: eevee_opengl_image_texture_limit
4/4 Test #260: eevee_opengl_image_texture_limit ...   Passed   16.28 sec

100% tests passed, 0 tests failed out of 4

Total Test time (real) =  57.82 sec
```
After (warm run)
```
(.venv) $[build_linux] ctest -R eevee_opengl_image_
Test project /mnt/data/Blender/build_linux
    Start 257: eevee_opengl_image_colorspace
1/4 Test #257: eevee_opengl_image_colorspace ......   Passed    5.17 sec
    Start 258: eevee_opengl_image_data_types
2/4 Test #258: eevee_opengl_image_data_types ......   Passed   11.60 sec
    Start 259: eevee_opengl_image_mapping
3/4 Test #259: eevee_opengl_image_mapping .........   Passed   12.79 sec
    Start 260: eevee_opengl_image_texture_limit
4/4 Test #260: eevee_opengl_image_texture_limit ...   Passed   12.30 sec

100% tests passed, 0 tests failed out of 4

Total Test time (real) =  41.89 sec
```

Pull Request: https://projects.blender.org/blender/blender/pulls/160868
This commit is contained in:
Clément Foucault 2026-06-30 17:00:58 +02:00 • committed by Clément Foucault
parent da65f8748f
commit e40148276b

View file

@ -119,6 +119,53 @@ BLOCKLIST_NVIDIA_GL = [
]
def uses_any_lit_material(scene):
import bpy
# Define what we consider a "lit" BSDF node type in Blender
lit_node_types = {
"BSDF_PRINCIPLED",
"BSDF_DIFFUSE",
"BSDF_GLOSSY",
"BSDF_GLASS",
"BSDF_ANISOTROPIC",
"BSDF_VELVET",
"BSDF_HAIR",
"BSDF_TOON",
"BSDF_TRANSLUCENT",
"BSDF_HAIR_PRINCIPLED",
"SUBSURFACE_SCATTERING",
"BSDF_HAIR_PRINCIPLED",
"VOLUME_SCATTER",
"PRINCIPLED_VOLUME",
}
scene_materials = set()
# Gather all materials used by objects in the current scene
for obj in scene.objects:
# Check if the object type can hold materials (Meshes, Curves, etc.)
if hasattr(obj.data, "materials"):
if not obj.data.materials:
return True # No material slot, object uses the default material which is lit
for mat in obj.data.materials:
if mat is not None:
scene_materials.add(mat)
else:
return True # Empty material slot, object uses the default material which is lit
for mat in scene_materials:
# Check if the material uses the node system
if mat.node_tree:
for node in mat.node_tree.nodes:
if node.type in lit_node_types:
return True # We found one, no need to check the rest of the nodes
else:
return True # If use_nodes is False, Blender defaults to a basic lit surface
return False
def setup():
import bpy
@ -131,6 +178,9 @@ def setup():
skip_shadow_setup = scene.get("EEVEE_skip_shadow_setup", False)
skip_subsurface_setup = scene.get("EEVEE_skip_subsurface_setup", False)
if not uses_any_lit_material(scene):
skip_probes_setup = True
# Enable Eevee features
eevee = scene.eevee