Fix: GPU test errors importing gpu module

Pull Request: https://projects.blender.org/blender/blender/pulls/119721
This commit is contained in:
Brecht Van Lommel 2024-03-26 20:16:02 +01:00 committed by Brecht Van Lommel
parent 8b6a21c122
commit 2fb4efc905

@ -8,7 +8,6 @@ Prints GPU back-end information to the console and exits.
Use this script as `blender --background --python gpu_info.py`.
"""
import bpy
import gpu
import sys
# Render with workbench to initialize the GPU backend otherwise it would fail when running in
@ -19,6 +18,8 @@ scene.render.resolution_y = 1
scene.render.engine = "BLENDER_WORKBENCH"
bpy.ops.render.render(animation=False, write_still=False)
# Import GPU module only after GPU backend has been initialized.
import gpu
print('GPU_VENDOR:' + gpu.platform.vendor_get())
print('GPU_RENDERER:' + gpu.platform.renderer_get())