Commit f567bac0 by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: Add fallback for D32_UNORM for Swiftshader

Swiftshader does not have support for D24_S8 (typical fallback for 32bit DEPTH_COMPONENTS) but does have D32_FLOAT, so add fallback to that format. This then allows ANGLE to support OES_depth_texture extension when using Swiftshader which is needed to allow Vulkan swiftshader to replace GL swiftshader. Bug: angleproject:4232 Change-Id: Iaf04fcf0bea8d9cca0b9e7a18e3351ce8c704355 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1986413 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarTobin Ehlis <tobine@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 0253940d
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"src/libANGLE/renderer/gen_load_functions_table.py": "src/libANGLE/renderer/gen_load_functions_table.py":
"9b4ea6bcb4eb4c43f48a097a9ec920f1", "9b4ea6bcb4eb4c43f48a097a9ec920f1",
"src/libANGLE/renderer/load_functions_data.json": "src/libANGLE/renderer/load_functions_data.json":
"5e9a50b1eeda3b5bca68aac4bc379437", "e3e6e908bdaa6e125c9a48069446eb84",
"src/libANGLE/renderer/load_functions_table_autogen.cpp": "src/libANGLE/renderer/load_functions_table_autogen.cpp":
"a5dc01dc05a08f7c674f9241d36b095c" "ee0793c71b3fdc14b40d6ccc4295d2a5"
} }
\ No newline at end of file
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
"src/libANGLE/renderer/angle_format_map.json": "src/libANGLE/renderer/angle_format_map.json":
"bca5e686001f6dd0af306af234a36677", "bca5e686001f6dd0af306af234a36677",
"src/libANGLE/renderer/vulkan/gen_vk_format_table.py": "src/libANGLE/renderer/vulkan/gen_vk_format_table.py":
"fae056a92c84cfd35594836cd5c14ab8", "7c0c4f309f9d4864651510efb4c948cf",
"src/libANGLE/renderer/vulkan/vk_format_map.json": "src/libANGLE/renderer/vulkan/vk_format_map.json":
"ef0c23a6620215cfacfc690e9995ba31", "00337a5ee252cf90a903dcb090f48ad8",
"src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp": "src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp":
"ca21d0ab4ea9908b76b73f446606a79f" "3f9f2ab5393d77a061e7dda701e9f015"
} }
\ No newline at end of file
...@@ -653,6 +653,9 @@ ...@@ -653,6 +653,9 @@
} }
}, },
"GL_DEPTH_COMPONENT32_OES": { "GL_DEPTH_COMPONENT32_OES": {
"D32_FLOAT": {
"GL_UNSIGNED_INT": "LoadD32ToD32F"
},
"NONE": { "NONE": {
"GL_UNSIGNED_INT": "LoadR32ToR24G8" "GL_UNSIGNED_INT": "LoadR32ToR24G8"
} }
......
// GENERATED FILE - DO NOT EDIT. // GENERATED FILE - DO NOT EDIT.
// Generated by gen_load_functions_table.py using data from load_functions_data.json // Generated by gen_load_functions_table.py using data from load_functions_data.json
// //
// Copyright 2019 The ANGLE Project Authors. All rights reserved. // Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -1464,6 +1464,18 @@ LoadImageFunctionInfo DEPTH_COMPONENT32F_to_D32_FLOAT(GLenum type) ...@@ -1464,6 +1464,18 @@ LoadImageFunctionInfo DEPTH_COMPONENT32F_to_D32_FLOAT(GLenum type)
} }
} }
LoadImageFunctionInfo DEPTH_COMPONENT32_OES_to_D32_FLOAT(GLenum type)
{
switch (type)
{
case GL_UNSIGNED_INT:
return LoadImageFunctionInfo(LoadD32ToD32F, true);
default:
UNREACHABLE();
return LoadImageFunctionInfo(UnreachableLoadFunction, true);
}
}
LoadImageFunctionInfo DEPTH_COMPONENT32_OES_to_default(GLenum type) LoadImageFunctionInfo DEPTH_COMPONENT32_OES_to_default(GLenum type)
{ {
switch (type) switch (type)
...@@ -3460,7 +3472,15 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat) ...@@ -3460,7 +3472,15 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat)
break; break;
} }
case GL_DEPTH_COMPONENT32_OES: case GL_DEPTH_COMPONENT32_OES:
{
switch (angleFormat)
{
case FormatID::D32_FLOAT:
return DEPTH_COMPONENT32_OES_to_D32_FLOAT;
default:
return DEPTH_COMPONENT32_OES_to_default; return DEPTH_COMPONENT32_OES_to_default;
}
}
case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE: case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
{ {
switch (angleFormat) switch (angleFormat)
......
...@@ -149,13 +149,17 @@ def gen_format_case(angle, internal_format, vk_json_data): ...@@ -149,13 +149,17 @@ def gen_format_case(angle, internal_format, vk_json_data):
(angle not in vk_fallbacks)) or angle == 'NONE': (angle not in vk_fallbacks)) or angle == 'NONE':
return empty_format_entry_template.format(**args) return empty_format_entry_template.format(**args)
# get_formats returns override format (if any) + fallbacks
# this was necessary to support D32_UNORM. There is no appropriate override that allows
# us to fallback to D32_FLOAT, so now we leave the image override empty and function will
# give us the fallbacks.
def get_formats(format, type): def get_formats(format, type):
format = vk_overrides.get(format, {}).get(type, format) format = vk_overrides.get(format, {}).get(type, format)
if format not in vk_map:
return []
fallbacks = vk_fallbacks.get(format, {}).get(type, []) fallbacks = vk_fallbacks.get(format, {}).get(type, [])
if not isinstance(fallbacks, list): if not isinstance(fallbacks, list):
fallbacks = [fallbacks] fallbacks = [fallbacks]
if format not in vk_map:
return fallbacks
return [format] + fallbacks return [format] + fallbacks
def image_args(format): def image_args(format):
......
...@@ -214,8 +214,7 @@ ...@@ -214,8 +214,7 @@
"image": "D24_UNORM_S8_UINT" "image": "D24_UNORM_S8_UINT"
}, },
"D32_UNORM": { "D32_UNORM": {
"buffer": "NONE", "buffer": "NONE"
"image": "D24_UNORM_S8_UINT"
}, },
"ETC1_R8G8B8_UNORM_BLOCK": { "ETC1_R8G8B8_UNORM_BLOCK": {
"buffer": "NONE", "buffer": "NONE",
...@@ -335,6 +334,9 @@ ...@@ -335,6 +334,9 @@
} }
}, },
"fallbacks": { "fallbacks": {
"D32_UNORM": {
"image": ["D24_UNORM_S8_UINT", "D32_FLOAT"]
},
"D32_FLOAT_S8X24_UINT": { "D32_FLOAT_S8X24_UINT": {
"image": ["D24_UNORM_S8_UINT", "D32_FLOAT_S8X24_UINT"] "image": ["D24_UNORM_S8_UINT", "D32_FLOAT_S8X24_UINT"]
}, },
......
// GENERATED FILE - DO NOT EDIT. // GENERATED FILE - DO NOT EDIT.
// Generated by gen_vk_format_table.py using data from vk_format_map.json // Generated by gen_vk_format_table.py using data from vk_format_map.json
// //
// Copyright 2019 The ANGLE Project Authors. All rights reserved. // Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -851,8 +851,7 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat) ...@@ -851,8 +851,7 @@ void Format::initialize(RendererVk *renderer, const angle::Format &angleFormat)
{ {
static constexpr ImageFormatInitInfo kInfo[] = { static constexpr ImageFormatInitInfo kInfo[] = {
{angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr}, {angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr},
{angle::FormatID::D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, nullptr}, {angle::FormatID::D32_FLOAT, VK_FORMAT_D32_SFLOAT, nullptr}};
{angle::FormatID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, nullptr}};
initImageFallback(renderer, kInfo, ArraySize(kInfo)); initImageFallback(renderer, kInfo, ArraySize(kInfo));
} }
actualBufferFormatID = angle::FormatID::NONE; actualBufferFormatID = angle::FormatID::NONE;
......
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