Commit 79d4ac9a by Alexis Hetu Committed by Alexis Hétu

Add vulkan unit tests to Chromium

Notes: - INSTANTIATE_TEST_CASE_P is now deprecated, so changed it to INSTANTIATE_TEST_SUITE_P. This requires and update to third_party/googletest. - Updated Driver's loadSwiftShader() function to include the non standalone path, in order to run the tests in Chromium - Added Vulkan unit tests to swiftshader_tests - Added a new GN file for Vulkan unit tests. Note that it relies on Chromium's version of SPIR-V Tools, not on SwiftShader's version, in order to avoid build conflicts Change-Id: I87727f6a858a720d0f5fb8f262ac290818945ac4 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/32349 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 75841d73
......@@ -186,5 +186,6 @@ group("swiftshader_tests") {
data_deps = [
"tests/GLESUnitTests:swiftshader_unittests",
"tests/VulkanUnitTests:swiftshader_vulkan_unittests",
]
}
......@@ -1248,7 +1248,7 @@ using CToReactorCastTestTypes = ::testing::Types
std::pair<float, Float>
>;
TYPED_TEST_CASE(CToReactorCastTest, CToReactorCastTestTypes);
TYPED_TEST_SUITE(CToReactorCastTest, CToReactorCastTestTypes);
TYPED_TEST(CToReactorCastTest, Casts)
{
......@@ -1320,7 +1320,7 @@ using GEPTestTypes = ::testing::Types
std::pair<float[4], Float4>
>;
TYPED_TEST_CASE(GEPTest, GEPTestTypes);
TYPED_TEST_SUITE(GEPTest, GEPTestTypes);
TYPED_TEST(GEPTest, PtrOffsets)
{
......
# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//testing/test.gni")
test("swiftshader_vulkan_unittests") {
deps = [
"//base",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/SPIRV-Tools/src:SPIRV-Tools",
"//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
]
sources = [
"//gpu/swiftshader_tests_main.cc",
"Device.cpp",
"Driver.cpp",
"unittests.cpp",
]
include_dirs = [
"//third_party/SPIRV-Tools/src/include",
"../../include", # Khronos headers
]
if (is_win) {
ldflags = [
"/DELAYLOAD:libvulkan.dll",
]
} else if (is_mac) {
ldflags = [
"-rpath",
"@executable_path/",
]
} else {
ldflags = [ "-Wl,-rpath=\$ORIGIN/swiftshader" ]
}
}
......@@ -49,15 +49,29 @@ Driver::~Driver()
bool Driver::loadSwiftShader()
{
#if OS_WINDOWS
# if defined(NDEBUG)
return load("./build/Release/libvk_swiftshader.dll");
# else
return load("./build/Debug/libvk_swiftshader.dll");
# endif
#if !defined(STANDALONE)
// The DLL is delay loaded (see BUILD.gn), so we can load
// the correct ones from Chrome's swiftshader subdirectory.
HMODULE libvulkan = LoadLibraryA("swiftshader\\libvulkan.dll");
EXPECT_NE((HMODULE)NULL, libvulkan);
return true;
#elif defined(NDEBUG)
return load("./build/Release/libvk_swiftshader.dll");
#else
return load("./build/Debug/libvk_swiftshader.dll");
#endif
#elif OS_MAC
return load("./build/Darwin/libvk_swiftshader.dylib");
#if defined(STANDALONE)
return load("./build/Darwin/libvk_swiftshader.dylib");
#else
return load("libvulkan.dylib");
#endif
#elif OS_LINUX
return load("./build/Linux/libvk_swiftshader.so");
#if defined(STANDALONE)
return load("./build/Linux/libvk_swiftshader.so");
#else
return load("libvulkan.so");
#endif
#elif OS_ANDROID
return load("libvk_swiftshader.so");
#else
......
......@@ -374,7 +374,7 @@ void SwiftShaderVulkanBufferToBufferComputeTest::test(
driver.vkDestroyInstance(instance, nullptr);
}
INSTANTIATE_TEST_CASE_P(ComputeParams, SwiftShaderVulkanBufferToBufferComputeTest, testing::Values(
INSTANTIATE_TEST_SUITE_P(ComputeParams, SwiftShaderVulkanBufferToBufferComputeTest, testing::Values(
ComputeParams{512, 1, 1, 1},
ComputeParams{512, 2, 1, 1},
ComputeParams{512, 4, 1, 1},
......
Subproject commit 02a8ca87735601466d8c564344f9be493da84708
Subproject commit 8ffb7e5c88b20a297a2e786c480556467496463b
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment