diff --git a/ci/builders/mac_unopt.json b/ci/builders/mac_unopt.json index dfae57a324ea1..d1f446ff65ecb 100644 --- a/ci/builders/mac_unopt.json +++ b/ci/builders/mac_unopt.json @@ -125,17 +125,20 @@ "use_rbe": true }, "gn": [ - "--runtime-mode", - "debug", - "--unoptimized", - "--no-lto", - "--prebuilt-dart-sdk", - "--force-mac-arm64", - "--mac-cpu", - "arm64", - "--rbe", - "--no-goma", - "--xcode-symlinks" + "--runtime-mode", + "debug", + "--unoptimized", + "--no-lto", + "--prebuilt-dart-sdk", + "--force-mac-arm64", + "--enable-impeller-vulkan", + "--enable-impeller-opengles", + "--use-glfw-swiftshader", + "--mac-cpu", + "arm64", + "--rbe", + "--no-goma", + "--xcode-symlinks" ], "name": "host_debug_unopt_arm64", "ninja": { @@ -157,7 +160,7 @@ "--variant", "host_debug_unopt_arm64", "--type", - "dart,dart-host,engine", + "dart,dart-host,engine,impeller-golden", "--engine-capture-core-dump" ] } diff --git a/testing/run_tests.py b/testing/run_tests.py index 3617937f9f33a..41e20540ed1d7 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -172,6 +172,30 @@ def find_executable_path(path): raise Exception('Executable %s does not exist!' % path) +def metal_validation_env(build_dir): + extra_env = { + # pylint: disable=line-too-long + # See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc + 'MTL_SHADER_VALIDATION': '1', # Enables all shader validation tests. + 'MTL_SHADER_VALIDATION_GLOBAL_MEMORY': + '1', # Validates accesses to device and constant memory. + 'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY': '1', # Validates accesses to threadgroup memory. + 'MTL_SHADER_VALIDATION_TEXTURE_USAGE': '1', # Validates that texture references are not nil. + # Note: built from //third_party/swiftshader + 'VK_ICD_FILENAMES': os.path.join(build_dir, 'vk_swiftshader_icd.json'), + # Note: built from //third_party/vulkan_validation_layers:vulkan_gen_json_files + # and //third_party/vulkan_validation_layers. + 'VK_LAYER_PATH': os.path.join(build_dir, 'vulkan-data'), + 'VK_INSTANCE_LAYERS': 'VK_LAYER_KHRONOS_validation', + } + if is_aarm64(): + extra_env.update({ + 'METAL_DEBUG_ERROR_MODE': '0', # Enables metal validation. + 'METAL_DEVICE_WRAPPER_TYPE': '1', # Enables metal validation. + }) + return extra_env + + def build_engine_executable_command( build_dir, executable_name, flags=None, coverage=False, gtest=False ): @@ -474,28 +498,7 @@ def make_test(name, flags=None, extra_env=None): shuffle_flags, coverage=coverage ) - extra_env = { - # pylint: disable=line-too-long - # See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc - 'MTL_SHADER_VALIDATION': '1', # Enables all shader validation tests. - 'MTL_SHADER_VALIDATION_GLOBAL_MEMORY': - '1', # Validates accesses to device and constant memory. - 'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY': - '1', # Validates accesses to threadgroup memory. - 'MTL_SHADER_VALIDATION_TEXTURE_USAGE': - '1', # Validates that texture references are not nil. - # Note: built from //third_party/swiftshader - 'VK_ICD_FILENAMES': os.path.join(build_dir, 'vk_swiftshader_icd.json'), - # Note: built from //third_party/vulkan_validation_layers:vulkan_gen_json_files - # and //third_party/vulkan_validation_layers. - 'VK_LAYER_PATH': os.path.join(build_dir, 'vulkan-data'), - 'VK_INSTANCE_LAYERS': 'VK_LAYER_KHRONOS_validation', - } - if is_aarm64(): - extra_env.update({ - 'METAL_DEBUG_ERROR_MODE': '0', # Enables metal validation. - 'METAL_DEVICE_WRAPPER_TYPE': '1', # Enables metal validation. - }) + extra_env = metal_validation_env(build_dir) mac_impeller_unittests_flags = shuffle_flags + [ '--enable_vulkan_validation', '--gtest_filter=-*OpenGLES' # These are covered in the golden tests. @@ -1036,7 +1039,8 @@ def run_impeller_golden_tests(build_dir: str): harvester_path: Path = Path(SCRIPT_DIR).parent.joinpath('tools' ).joinpath('golden_tests_harvester') with tempfile.TemporaryDirectory(prefix='impeller_golden') as temp_dir: - run_cmd([tests_path, f'--working_dir={temp_dir}'], cwd=build_dir) + extra_env = extra_env = metal_validation_env(build_dir) + run_cmd([tests_path, f'--working_dir={temp_dir}'], cwd=build_dir, env=extra_env) dart_bin = os.path.join(build_dir, 'dart-sdk', 'bin', 'dart') golden_path = os.path.join('testing', 'impeller_golden_tests_output.txt') script_path = os.path.join('tools', 'dir_contents_diff', 'bin', 'dir_contents_diff.dart')