[WIP] renderdiff: enable vulkan

This commit is contained in:
Powei Feng
2025-08-14 16:19:17 -07:00
parent 37f4d0d1fa
commit 2c154be0b3
6 changed files with 229 additions and 161 deletions

View File

@@ -55,7 +55,8 @@ function end_render_() {
start_render_ && \
python3 ${RENDERDIFF_TEST_DIR}/src/render.py \
--gltf_viewer="$(pwd)/out/cmake-debug/samples/gltf_viewer" \
--test=${RENDERDIFF_TEST_DIR}/tests/presubmit.json \
--output_dir=${RENDER_OUTPUT_DIR} \
--opengl_lib=${MESA_LIB_DIR} && \
--test="${RENDERDIFF_TEST_DIR}/tests/presubmit.json" \
--output_dir="${RENDER_OUTPUT_DIR}" \
--opengl_lib="${MESA_LIB_DIR}" \
--vk_icd="${MESA_VK_ICD_PATH}" && \
end_render_

View File

@@ -29,6 +29,7 @@ if [[ "$os_name" == "Linux" ]]; then
MESA_LIB_DIR="${MESA_DIR}lib/x86_64-linux-gnu"
elif [[ "$os_name" == "Darwin" ]]; then
MESA_LIB_DIR="${MESA_DIR}lib"
MESA_VK_ICD_PATH="${MESA_DIR}share/vulkan/icd.d/lvp_icd.aarch64.json"
else
echo "Unsupported platform for renderdiff tests"
exit 1

View File

@@ -26,15 +26,21 @@ from golden_manager import GoldenManager
from image_diff import same_image
from results import RESULT_OK, RESULT_FAILED
def _render_single_model(gltf_viewer, test_json_path, named_output_dir, test_name, backend, model, model_path, opengl_lib):
env = None
def _render_single_model(gltf_viewer, test_json_path, named_output_dir,
test_name, backend, model, model_path, opengl_lib, vk_icd):
env = {}
if backend == 'opengl' and opengl_lib and os.path.isdir(opengl_lib):
env = {
env |= {
'LD_LIBRARY_PATH': opengl_lib,
# for macOS
'DYLD_LIBRARY_PATH': opengl_lib,
}
if backend == 'vulkan' and os.path.exists(vk_icd):
env |= {
'VK_ICD_FILENAMES': vk_icd,
}
out_name = f'{test_name}.{backend}.{model}'
test_desc = out_name
@@ -91,13 +97,15 @@ def _render_test_config(gltf_viewer,
f.write(f'[{test.to_filament_format()}]')
for backend in test_config.backends:
if backend == 'vulkan':
assert vk_icd, "VK ICD must be specified when testing vulkan backend"
for model in test.models:
model_path = os.path.abspath(test_config.models[model])
futures.append(
executor.submit(_render_single_model, gltf_viewer_abs,
test_json_path, named_output_dir,
test.name, backend, model, model_path,
opengl_lib))
opengl_lib, vk_icd))
for future in concurrent.futures.as_completed(futures):
results.append(future.result())

View File

@@ -1,6 +1,6 @@
{
"name": "presubmit",
"backends": ["opengl"],
"backends": ["opengl", "vulkan"],
"model_search_paths": ["third_party/models"],
"presets": [
{