зеркало из https://github.com/AvaloniaUI/angle.git
Re-land "Vulkan: SwiftShader integration."
Re-land fixes Win7 configs and placement of the SwiftShader module for ASAN/TSAN configs. Adds a new EGL extension for picking SwiftShader when using the Vulkan back-end. Also cleans up ICD enabling code RendererVk. Also includes a change to a buffer size necessary to support SwiftShader's minimum limits. Bug: angleproject:3876 Bug: b/140251624 Change-Id: I5e16057ac4de07bbdbbd248542b1b9103133294f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1810065 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Родитель
341482072a
Коммит
8be7a4c7f7
|
@ -44,6 +44,7 @@
|
|||
/third_party/rapidjson/src
|
||||
/third_party/spirv-headers/src
|
||||
/third_party/spirv-tools/src
|
||||
/third_party/SwiftShader
|
||||
/third_party/vulkan-headers/src
|
||||
/third_party/vulkan-loader/src
|
||||
/third_party/vulkan-tools/src
|
||||
|
|
70
BUILD.gn
70
BUILD.gn
|
@ -29,6 +29,9 @@ declare_args() {
|
|||
# Don't build extra (test, samples etc) for Windows UWP. We don't have
|
||||
# infrastructure (e.g. windowing helper functions) in place to run them.
|
||||
angle_build_all = !angle_is_winuwp
|
||||
|
||||
# Currently SwiftShader's Vulkan front-end doesn't build on Android.
|
||||
angle_swiftshader = !is_android
|
||||
}
|
||||
|
||||
if (!build_with_chromium && angle_build_all) {
|
||||
|
@ -548,23 +551,73 @@ if (angle_enable_vulkan) {
|
|||
defines = [
|
||||
"ANGLE_VK_LAYERS_DIR=\"$angle_data_dir\"",
|
||||
"ANGLE_VK_MOCK_ICD_JSON=\"$angle_data_dir/VkICD_mock_icd.json\"",
|
||||
"ANGLE_VK_SWIFTSHADER_ICD_JSON=\"swiftshader/libvk_swiftshader_icd.json\"",
|
||||
]
|
||||
if (is_android) {
|
||||
libs = [ "vulkan" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (angle_swiftshader) {
|
||||
copy("angle_swiftshader_icd_rename") {
|
||||
sources = [
|
||||
"$swiftshader_dir/src/Vulkan/vk_swiftshader_icd.json",
|
||||
]
|
||||
outputs = [
|
||||
"$root_gen_dir/angle/libvk_swiftshader_icd.json",
|
||||
]
|
||||
}
|
||||
|
||||
action("angle_swiftshader_icd") {
|
||||
deps = [
|
||||
":angle_swiftshader_icd_rename",
|
||||
]
|
||||
script = "scripts/generate_vulkan_layers_json.py"
|
||||
sources = [
|
||||
"third_party/vulkan-headers/src/include/vulkan/vulkan_core.h",
|
||||
]
|
||||
|
||||
# Must be listed after vulkan_core.h. git cl format sorts them if they
|
||||
# are in one list. So split up the sources manually.
|
||||
sources += [ "$root_gen_dir/angle/libvk_swiftshader_icd.json" ]
|
||||
|
||||
outputs = [
|
||||
"$root_out_dir/swiftshader/libvk_swiftshader_icd.json",
|
||||
]
|
||||
data = outputs
|
||||
|
||||
_raw_sws_in = rebase_path("$root_gen_dir/angle", root_build_dir)
|
||||
_raw_sws_out = rebase_path("$root_out_dir/swiftshader", root_build_dir)
|
||||
|
||||
_sws_output = ""
|
||||
if (is_win) {
|
||||
_sws_output += "vk_swiftshader.dll"
|
||||
} else if (is_mac) {
|
||||
_sws_output += "libvk_swiftshader.dylib"
|
||||
} else {
|
||||
_sws_output += "libvk_swiftshader.so"
|
||||
}
|
||||
|
||||
args = [
|
||||
"--icd",
|
||||
"--replacement",
|
||||
_sws_output,
|
||||
_raw_sws_in,
|
||||
_raw_sws_out,
|
||||
] + rebase_path(sources, root_build_dir)
|
||||
}
|
||||
}
|
||||
|
||||
# Use this target to include everything ANGLE needs for Vulkan.
|
||||
group("angle_vulkan") {
|
||||
public_deps = [
|
||||
"$angle_root/third_party/vulkan-headers:vulkan_headers",
|
||||
]
|
||||
public_configs = [ ":vulkan_config" ]
|
||||
deps = []
|
||||
data_deps = []
|
||||
if (!is_android && !is_fuchsia) {
|
||||
deps = [
|
||||
"$angle_root/third_party/vulkan-loader:libvulkan",
|
||||
]
|
||||
deps += [ "$angle_root/third_party/vulkan-loader:libvulkan" ]
|
||||
data_deps += [ "$angle_root/third_party/vulkan-tools:VkICD_mock_icd" ]
|
||||
public_configs +=
|
||||
[ "$angle_root/third_party/vulkan-loader:vulkan_loader_config" ]
|
||||
|
@ -579,9 +632,7 @@ if (angle_enable_vulkan) {
|
|||
|
||||
if (angle_enable_vulkan_validation_layers) {
|
||||
if (is_fuchsia) {
|
||||
deps = [
|
||||
"//third_party/fuchsia-sdk:vulkan_validation",
|
||||
]
|
||||
deps += [ "//third_party/fuchsia-sdk:vulkan_validation" ]
|
||||
} else {
|
||||
data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_validation_layers" ]
|
||||
if (!is_android) {
|
||||
|
@ -589,6 +640,13 @@ if (angle_enable_vulkan) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (angle_swiftshader) {
|
||||
deps += [
|
||||
":angle_swiftshader_icd",
|
||||
"$swiftshader_dir/src/Vulkan:swiftshader_libvulkan",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
6
DEPS
6
DEPS
|
@ -5,6 +5,7 @@
|
|||
vars = {
|
||||
'android_git': 'https://android.googlesource.com',
|
||||
'chromium_git': 'https://chromium.googlesource.com',
|
||||
'swiftshader_git': 'https://swiftshader.googlesource.com',
|
||||
|
||||
# This variable is set on the Chrome infra for compatiblity with gclient.
|
||||
'angle_root': '.',
|
||||
|
@ -160,6 +161,11 @@ deps = {
|
|||
'condition': 'not build_with_chromium',
|
||||
},
|
||||
|
||||
'{angle_root}/third_party/SwiftShader': {
|
||||
'url': '{swiftshader_git}/SwiftShader@2ef66b69cea535329784f437c3780e473e6a4e29',
|
||||
'condition': 'not build_with_chromium',
|
||||
},
|
||||
|
||||
'{angle_root}/third_party/vulkan-headers/src': {
|
||||
'url': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-Headers@{vulkan_headers_revision}',
|
||||
},
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# We are building SwiftShader in ANGLE
|
||||
swiftshader_standalone = false
|
||||
|
||||
# Path to SwiftShader
|
||||
swiftshader_dir = "//third_party/SwiftShader"
|
||||
|
||||
# Paths to SwiftShader dependencies
|
||||
swiftshader_spirv_tools_dir = "//third_party/spirv-tools/src"
|
|
@ -0,0 +1,82 @@
|
|||
Name
|
||||
|
||||
ANGLE_platform_angle_device_type_swiftshader
|
||||
|
||||
Name Strings
|
||||
|
||||
EGL_ANGLE_platform_angle_device_type_swiftshader
|
||||
|
||||
Contributors
|
||||
|
||||
Jamie Madill, Google
|
||||
|
||||
Contacts
|
||||
|
||||
Jamie Madill, Google (jmadill 'at' google 'dot' com)
|
||||
|
||||
Status
|
||||
|
||||
Draft
|
||||
|
||||
Version
|
||||
|
||||
Version 1, 2019-08-24
|
||||
|
||||
Number
|
||||
|
||||
EGL Extension XXX
|
||||
|
||||
Extension Type
|
||||
|
||||
EGL client extension
|
||||
|
||||
Dependencies
|
||||
|
||||
Requires EGL_ANGLE_platform_angle_vulkan.
|
||||
|
||||
Overview
|
||||
|
||||
This extension enables choosing the SwiftShader Vulkan implementation
|
||||
when it is available.
|
||||
|
||||
New Types
|
||||
|
||||
None
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
None
|
||||
|
||||
New Tokens
|
||||
|
||||
Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute:
|
||||
|
||||
EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE 0x3487
|
||||
|
||||
Additions to the EGL Specification
|
||||
|
||||
None.
|
||||
|
||||
New Behavior
|
||||
|
||||
When calling eglGetPlatformDisplay:
|
||||
|
||||
To request a SwiftShader-backed Vulkan implementation with ANGLE, the value
|
||||
of EGL_PLATFORM_ANGLE_TYPE_ANGLE should be EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE
|
||||
and the value of EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE should be
|
||||
EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE.
|
||||
|
||||
If EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE is
|
||||
EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE and
|
||||
EGL_PLATFORM_ANGLE_TYPE_ANGLE is not
|
||||
EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE then an EGL_BAD_ATTRIBUTE
|
||||
error is generated and EGL_NO_DISPLAY is returned.
|
||||
|
||||
Issues
|
||||
|
||||
None
|
||||
|
||||
Revision History
|
||||
|
||||
Version 1, 2019-08-29 (Jamie Madill)
|
||||
- Initial draft
|
|
@ -7,6 +7,7 @@ import("//build/config/sanitizers/sanitizers.gni")
|
|||
import("//build/config/ui.gni") # import the use_x11 variable
|
||||
import("//build_overrides/angle.gni")
|
||||
import("//build_overrides/build.gni")
|
||||
import("//build_overrides/swiftshader.gni")
|
||||
import("//testing/test.gni")
|
||||
if (is_android) {
|
||||
import("//build/config/android/config.gni")
|
||||
|
|
|
@ -82,6 +82,11 @@
|
|||
#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450
|
||||
#endif /* EGL_ANGLE_platform_angle_vulkan */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_device_type_swiftshader
|
||||
#define EGL_ANGLE_platform_angle_device_type_swiftshader
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE 0x3487
|
||||
#endif /* EGL_ANGLE_platform_angle_device_type_swiftshader */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_context_virtualization
|
||||
#define EGL_ANGLE_platform_angle_context_virtualization 1
|
||||
#define EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_ANGLE 0x3481
|
||||
|
|
|
@ -28,6 +28,7 @@ def main():
|
|||
parser.add_argument('target_dir')
|
||||
parser.add_argument('version_header', help='path to vulkan_core.h')
|
||||
parser.add_argument('json_files', nargs='*')
|
||||
parser.add_argument('--replacement', help='replacement for the library', default=None)
|
||||
args = parser.parse_args()
|
||||
|
||||
source_dir = args.source_dir
|
||||
|
@ -46,7 +47,8 @@ def main():
|
|||
os.makedirs(target_dir)
|
||||
|
||||
# Copy the *.json files from source dir to target dir
|
||||
if (set(glob_slash(os.path.join(source_dir, '*.json'))) != set(json_files)):
|
||||
if (set(glob_slash(os.path.join(source_dir, '*.json'))) !=
|
||||
set(json_files)) and data_key != 'ICD':
|
||||
print(glob.glob(os.path.join(source_dir, '*.json')))
|
||||
print('.json list in gn file is out-of-date', file=sys.stderr)
|
||||
return 1
|
||||
|
@ -64,7 +66,10 @@ def main():
|
|||
# The standard validation layer has no library path.
|
||||
if 'library_path' in data[data_key]:
|
||||
prev_name = os.path.basename(data[data_key]['library_path'])
|
||||
data[data_key]['library_path'] = prev_name
|
||||
if args.replacement:
|
||||
data[data_key]['library_path'] = args.replacement
|
||||
else:
|
||||
data[data_key]['library_path'] = prev_name
|
||||
|
||||
target_fname = os.path.join(target_dir, os.path.basename(json_fname))
|
||||
with open(target_fname, 'wb') as outfile:
|
||||
|
@ -73,14 +78,15 @@ def main():
|
|||
# Get the Vulkan version from the vulkan_core.h file
|
||||
vk_header_filename = args.version_header
|
||||
vk_version = None
|
||||
with open(vk_header_filename) as vk_header_file:
|
||||
for line in vk_header_file:
|
||||
if line.startswith('#define VK_HEADER_VERSION'):
|
||||
vk_version = line.split()[-1]
|
||||
break
|
||||
if not vk_version:
|
||||
print('failed to extract vk_version', file=sys.stderr)
|
||||
return 1
|
||||
if data_key != 'ICD':
|
||||
with open(vk_header_filename) as vk_header_file:
|
||||
for line in vk_header_file:
|
||||
if line.startswith('#define VK_HEADER_VERSION'):
|
||||
vk_version = line.split()[-1]
|
||||
break
|
||||
if not vk_version:
|
||||
print('failed to extract vk_version', file=sys.stderr)
|
||||
return 1
|
||||
|
||||
# Set json file prefix and suffix for generating files, default to Linux.
|
||||
relative_path_prefix = '../lib'
|
||||
|
|
|
@ -1247,24 +1247,25 @@ std::vector<std::string> ClientExtensions::getStrings() const
|
|||
std::vector<std::string> extensionStrings;
|
||||
|
||||
// clang-format off
|
||||
// | Extension name | Supported flag | Output vector |
|
||||
InsertExtensionString("EGL_EXT_client_extensions", clientExtensions, &extensionStrings);
|
||||
InsertExtensionString("EGL_EXT_platform_base", platformBase, &extensionStrings);
|
||||
InsertExtensionString("EGL_EXT_platform_device", platformDevice, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle", platformANGLE, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_d3d", platformANGLED3D, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_opengl", platformANGLEOpenGL, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_null", platformANGLENULL, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_vulkan", platformANGLEVulkan, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_context_virtualization", platformANGLEContextVirtualization, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_device_creation", deviceCreation, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_device_creation_d3d11", deviceCreationD3D11, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_x11_visual", x11Visual, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_experimental_present_path", experimentalPresentPath, &extensionStrings);
|
||||
InsertExtensionString("EGL_KHR_client_get_all_proc_addresses", clientGetAllProcAddresses, &extensionStrings);
|
||||
InsertExtensionString("EGL_KHR_debug", debug, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_explicit_context", explicitContext, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_feature_control", featureControlANGLE, &extensionStrings);
|
||||
// | Extension name | Supported flag | Output vector |
|
||||
InsertExtensionString("EGL_EXT_client_extensions", clientExtensions, &extensionStrings);
|
||||
InsertExtensionString("EGL_EXT_platform_base", platformBase, &extensionStrings);
|
||||
InsertExtensionString("EGL_EXT_platform_device", platformDevice, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle", platformANGLE, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_d3d", platformANGLED3D, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_device_type_swiftshader", platformANGLEDeviceTypeSwiftShader, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_opengl", platformANGLEOpenGL, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_null", platformANGLENULL, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_vulkan", platformANGLEVulkan, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_platform_angle_context_virtualization", platformANGLEContextVirtualization, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_device_creation", deviceCreation, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_device_creation_d3d11", deviceCreationD3D11, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_x11_visual", x11Visual, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_experimental_present_path", experimentalPresentPath, &extensionStrings);
|
||||
InsertExtensionString("EGL_KHR_client_get_all_proc_addresses", clientGetAllProcAddresses, &extensionStrings);
|
||||
InsertExtensionString("EGL_KHR_debug", debug, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_explicit_context", explicitContext, &extensionStrings);
|
||||
InsertExtensionString("EGL_ANGLE_feature_control", featureControlANGLE, &extensionStrings);
|
||||
// clang-format on
|
||||
|
||||
return extensionStrings;
|
||||
|
|
|
@ -1002,6 +1002,9 @@ struct ClientExtensions
|
|||
|
||||
// EGL_ANGLE_feature_control
|
||||
bool featureControlANGLE = false;
|
||||
|
||||
// EGL_ANGLE_platform_angle_device_type_swiftshader
|
||||
bool platformANGLEDeviceTypeSwiftShader = false;
|
||||
};
|
||||
|
||||
} // namespace egl
|
||||
|
|
|
@ -1241,7 +1241,8 @@ static ClientExtensions GenerateClientExtensions()
|
|||
#endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_VULKAN)
|
||||
extensions.platformANGLEVulkan = true;
|
||||
extensions.platformANGLEVulkan = true;
|
||||
extensions.platformANGLEDeviceTypeSwiftShader = true;
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_USE_X11)
|
||||
|
|
|
@ -1534,7 +1534,7 @@ angle::Result ProgramVk::updateTransformFeedbackDescriptorSet(ContextVk *context
|
|||
|
||||
void ProgramVk::updateTransformFeedbackDescriptorSetImpl(ContextVk *contextVk)
|
||||
{
|
||||
const gl::State &glState = contextVk->getState();
|
||||
const gl::State &glState = contextVk->getState();
|
||||
gl::TransformFeedback *transformFeedback = glState.getCurrentTransformFeedback();
|
||||
|
||||
if (!hasTransformFeedbackOutput())
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace
|
|||
const uint32_t kMockVendorID = 0xba5eba11;
|
||||
const uint32_t kMockDeviceID = 0xf005ba11;
|
||||
constexpr char kMockDeviceName[] = "Vulkan Mock Device";
|
||||
const uint32_t kSwiftShaderDeviceID = 0xC0DE;
|
||||
constexpr char kSwiftShaderDeviceName[] = "SwiftShader Device";
|
||||
constexpr VkFormatFeatureFlags kInvalidFormatFeatureFlags = static_cast<VkFormatFeatureFlags>(-1);
|
||||
} // anonymous namespace
|
||||
|
||||
|
@ -69,6 +71,8 @@ vk::ICD ChooseICDFromAttribs(const egl::AttributeMap &attribs)
|
|||
break;
|
||||
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
|
||||
return vk::ICD::Mock;
|
||||
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE:
|
||||
return vk::ICD::SwiftShader;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
|
@ -363,6 +367,13 @@ class ScopedVkLoaderEnvironment : angle::NonCopyable
|
|||
ERR() << "Error setting environment for Mock/Null Driver.";
|
||||
}
|
||||
}
|
||||
else if (icd == vk::ICD::SwiftShader)
|
||||
{
|
||||
if (!setICDEnvironment(ANGLE_VK_SWIFTSHADER_ICD_JSON))
|
||||
{
|
||||
ERR() << "Error setting environment for SwiftShader.";
|
||||
}
|
||||
}
|
||||
if (mEnableValidationLayers || icd != vk::ICD::Default)
|
||||
{
|
||||
const auto &cwd = angle::GetCWD();
|
||||
|
@ -447,28 +458,48 @@ class ScopedVkLoaderEnvironment : angle::NonCopyable
|
|||
Optional<std::string> mPreviousICDEnv;
|
||||
};
|
||||
|
||||
using ICDFilterFunc = std::function<bool(const VkPhysicalDeviceProperties &)>;
|
||||
|
||||
ICDFilterFunc GetFilterForICD(vk::ICD preferredICD)
|
||||
{
|
||||
switch (preferredICD)
|
||||
{
|
||||
case vk::ICD::Mock:
|
||||
return [](const VkPhysicalDeviceProperties &deviceProperties) {
|
||||
return ((deviceProperties.vendorID == kMockVendorID) &&
|
||||
(deviceProperties.deviceID == kMockDeviceID) &&
|
||||
(strcmp(deviceProperties.deviceName, kMockDeviceName) == 0));
|
||||
};
|
||||
case vk::ICD::SwiftShader:
|
||||
return [](const VkPhysicalDeviceProperties &deviceProperties) {
|
||||
return ((deviceProperties.vendorID == VENDOR_ID_GOOGLE) &&
|
||||
(deviceProperties.deviceID == kSwiftShaderDeviceID) &&
|
||||
(strcmp(deviceProperties.deviceName, kSwiftShaderDeviceName) == 0));
|
||||
};
|
||||
default:
|
||||
return [](const VkPhysicalDeviceProperties &deviceProperties) { return true; };
|
||||
}
|
||||
}
|
||||
|
||||
void ChoosePhysicalDevice(const std::vector<VkPhysicalDevice> &physicalDevices,
|
||||
vk::ICD preferredICD,
|
||||
VkPhysicalDevice *physicalDeviceOut,
|
||||
VkPhysicalDeviceProperties *physicalDevicePropertiesOut)
|
||||
{
|
||||
ASSERT(!physicalDevices.empty());
|
||||
if (preferredICD == vk::ICD::Mock)
|
||||
|
||||
ICDFilterFunc filter = GetFilterForICD(preferredICD);
|
||||
|
||||
for (const VkPhysicalDevice &physicalDevice : physicalDevices)
|
||||
{
|
||||
for (const VkPhysicalDevice &physicalDevice : physicalDevices)
|
||||
vkGetPhysicalDeviceProperties(physicalDevice, physicalDevicePropertiesOut);
|
||||
if (filter(*physicalDevicePropertiesOut))
|
||||
{
|
||||
vkGetPhysicalDeviceProperties(physicalDevice, physicalDevicePropertiesOut);
|
||||
if ((kMockVendorID == physicalDevicePropertiesOut->vendorID) &&
|
||||
(kMockDeviceID == physicalDevicePropertiesOut->deviceID) &&
|
||||
(strcmp(kMockDeviceName, physicalDevicePropertiesOut->deviceName) == 0))
|
||||
{
|
||||
*physicalDeviceOut = physicalDevice;
|
||||
return;
|
||||
}
|
||||
*physicalDeviceOut = physicalDevice;
|
||||
return;
|
||||
}
|
||||
WARN() << "Vulkan Mock Driver was requested but Mock Device was not found. Using default "
|
||||
"physicalDevice instead.";
|
||||
}
|
||||
WARN() << "Preferred device ICD not found. Using default physicalDevice instead.";
|
||||
|
||||
// Fall back to first device.
|
||||
*physicalDeviceOut = physicalDevices[0];
|
||||
|
@ -481,8 +512,8 @@ angle::Result WaitFences(vk::Context *context,
|
|||
{
|
||||
uint64_t timeout = block ? context->getRenderer()->getMaxFenceWaitTimeNs() : 0;
|
||||
|
||||
// Iterate backwards over the fences, removing them from the list in constant time when they are
|
||||
// complete.
|
||||
// Iterate backwards over the fences, removing them from the list in constant time when they
|
||||
// are complete.
|
||||
while (!fences->empty())
|
||||
{
|
||||
VkResult result = fences->back().get().wait(context->getDevice(), timeout);
|
||||
|
@ -499,7 +530,7 @@ angle::Result WaitFences(vk::Context *context,
|
|||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace
|
||||
|
||||
// RendererVk implementation.
|
||||
RendererVk::RendererVk()
|
||||
|
|
|
@ -39,7 +39,7 @@ class FramebufferVk;
|
|||
namespace vk
|
||||
{
|
||||
struct Format;
|
||||
}
|
||||
} // namespace vk
|
||||
|
||||
// Supports one semaphore from current surface, and one semaphore passed to
|
||||
// glSignalSemaphoreEXT.
|
||||
|
|
|
@ -108,6 +108,7 @@ enum class ICD
|
|||
{
|
||||
Default,
|
||||
Mock,
|
||||
SwiftShader,
|
||||
};
|
||||
|
||||
// Abstracts error handling. Implemented by both ContextVk for GL and DisplayVk for EGL errors.
|
||||
|
|
|
@ -468,6 +468,14 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
|
|||
}
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE:
|
||||
if (!clientExtensions.platformANGLEDeviceTypeSwiftShader)
|
||||
{
|
||||
return EglBadAttribute() << "EGL_ANGLE_platform_angle_device_type_"
|
||||
"swiftshader is not supported";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return EglBadAttribute() << "Invalid value for "
|
||||
"EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE "
|
||||
|
@ -563,6 +571,16 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
|
|||
"EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE.";
|
||||
}
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE:
|
||||
if (platformType != EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE)
|
||||
{
|
||||
return EglBadAttribute()
|
||||
<< "This device type requires a "
|
||||
"platform type of EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE.";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1094,6 +1094,7 @@ ANGLE_INSTANTIATE_TEST(SimpleOperationTest,
|
|||
ES3_OPENGL(),
|
||||
ES2_OPENGLES(),
|
||||
ES3_OPENGLES(),
|
||||
ES2_VULKAN());
|
||||
ES2_VULKAN(),
|
||||
ES2_VULKAN_SWIFTSHADER());
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -141,6 +141,10 @@ std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp)
|
|||
stream << "_Warp";
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE:
|
||||
stream << "_SwiftShader";
|
||||
break;
|
||||
|
||||
default:
|
||||
stream << "_Error";
|
||||
break;
|
||||
|
@ -394,6 +398,11 @@ EGLPlatformParameters VULKAN_NULL()
|
|||
EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE);
|
||||
}
|
||||
|
||||
EGLPlatformParameters VULKAN_SWIFTSHADER()
|
||||
{
|
||||
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE,
|
||||
EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE);
|
||||
}
|
||||
} // namespace egl_platform
|
||||
|
||||
// ANGLE tests platforms
|
||||
|
@ -657,6 +666,11 @@ PlatformParameters ES2_VULKAN_NULL()
|
|||
return PlatformParameters(2, 0, egl_platform::VULKAN_NULL());
|
||||
}
|
||||
|
||||
PlatformParameters ES2_VULKAN_SWIFTSHADER()
|
||||
{
|
||||
return PlatformParameters(2, 0, egl_platform::VULKAN_SWIFTSHADER());
|
||||
}
|
||||
|
||||
PlatformParameters ES3_VULKAN()
|
||||
{
|
||||
return PlatformParameters(3, 0, egl_platform::VULKAN());
|
||||
|
|
|
@ -111,6 +111,7 @@ EGLPlatformParameters OPENGL_OR_GLES_NULL();
|
|||
|
||||
EGLPlatformParameters VULKAN();
|
||||
EGLPlatformParameters VULKAN_NULL();
|
||||
EGLPlatformParameters VULKAN_SWIFTSHADER();
|
||||
|
||||
} // namespace egl_platform
|
||||
|
||||
|
@ -176,6 +177,7 @@ PlatformParameters ES1_VULKAN();
|
|||
PlatformParameters ES1_VULKAN_NULL();
|
||||
PlatformParameters ES2_VULKAN();
|
||||
PlatformParameters ES2_VULKAN_NULL();
|
||||
PlatformParameters ES2_VULKAN_SWIFTSHADER();
|
||||
PlatformParameters ES3_VULKAN();
|
||||
PlatformParameters ES3_VULKAN_NULL();
|
||||
PlatformParameters ES31_VULKAN();
|
||||
|
|
Загрузка…
Ссылка в новой задаче