Commit 5cfab195 by Brandon Schade Committed by Commit Bot

Vulkan: Add test that logs supported texture formats

Add a whitebox test to log all supported GLES formats for the active Vulkan ICD. The test object is dependent on libANGLE's gl_enum_util.* files as we need it to print out human readable values in the PrintAllFormatSupport test. Test: angle_white_box_tests --gtest_filter=*PrintAllSupportedFormats* Bug: angleproject:4093 Change-Id: I99d74935b705b2984f6320ed80a0e977c8fcd4be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1930607 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 9190f49c
...@@ -761,14 +761,22 @@ angle_source_set("libANGLE") { ...@@ -761,14 +761,22 @@ angle_source_set("libANGLE") {
] ]
# gl_enum_utils defaults included in with_capture build # gl_enum_utils defaults included in with_capture build
deps = []
if (angle_enable_trace || is_debug) { if (angle_enable_trace || is_debug) {
sources += [ deps += [ ":angle_gl_enum_utils" ]
"src/libANGLE/gl_enum_utils.cpp",
"src/libANGLE/gl_enum_utils_autogen.cpp",
]
} }
} }
angle_source_set("angle_gl_enum_utils") {
public_deps = [
":libANGLE_base",
]
sources = [
"src/libANGLE/gl_enum_utils.cpp",
"src/libANGLE/gl_enum_utils_autogen.cpp",
]
}
angle_source_set("libANGLE_with_capture") { angle_source_set("libANGLE_with_capture") {
public_deps = [ public_deps = [
":libANGLE_base", ":libANGLE_base",
......
...@@ -25,9 +25,6 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type); ...@@ -25,9 +25,6 @@ GLenum GetSizedFormatInternal(GLenum format, GLenum type);
namespace namespace
{ {
using InternalFormatInfoMap =
std::unordered_map<GLenum, std::unordered_map<GLenum, InternalFormat>>;
bool CheckedMathResult(const CheckedNumeric<GLuint> &value, GLuint *resultOut) bool CheckedMathResult(const CheckedNumeric<GLuint> &value, GLuint *resultOut)
{ {
if (!value.IsValid()) if (!value.IsValid())
...@@ -1081,7 +1078,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -1081,7 +1078,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
return map; return map;
} }
static const InternalFormatInfoMap &GetInternalFormatMap() const InternalFormatInfoMap &GetInternalFormatMap()
{ {
static const angle::base::NoDestructor<InternalFormatInfoMap> formatMap( static const angle::base::NoDestructor<InternalFormatInfoMap> formatMap(
BuildInternalFormatInfoMap()); BuildInternalFormatInfoMap());
......
...@@ -214,6 +214,10 @@ bool CompressedFormatRequiresWholeImage(GLenum internalFormat); ...@@ -214,6 +214,10 @@ bool CompressedFormatRequiresWholeImage(GLenum internalFormat);
typedef std::set<GLenum> FormatSet; typedef std::set<GLenum> FormatSet;
const FormatSet &GetAllSizedInternalFormats(); const FormatSet &GetAllSizedInternalFormats();
typedef std::unordered_map<GLenum, std::unordered_map<GLenum, InternalFormat>>
InternalFormatInfoMap;
const InternalFormatInfoMap &GetInternalFormatMap();
// From the ESSL 3.00.4 spec: // From the ESSL 3.00.4 spec:
// Vertex shader inputs can only be float, floating-point vectors, matrices, signed and unsigned // Vertex shader inputs can only be float, floating-point vectors, matrices, signed and unsigned
// integers and integer vectors. Vertex shader inputs cannot be arrays or structures. // integers and integer vectors. Vertex shader inputs cannot be arrays or structures.
......
...@@ -165,6 +165,8 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -165,6 +165,8 @@ if (is_win || is_linux || is_mac || is_android) {
"${angle_root}:translator", "${angle_root}:translator",
] ]
deps += [ "${angle_root}:angle_gl_enum_utils" ]
if (angle_enable_vulkan) { if (angle_enable_vulkan) {
sources += angle_white_box_tests_vulkan_sources sources += angle_white_box_tests_vulkan_sources
deps += [ deps += [
......
...@@ -12,6 +12,7 @@ angle_white_box_tests_sources = [ ...@@ -12,6 +12,7 @@ angle_white_box_tests_sources = [
"test_utils/ANGLETest.cpp", "test_utils/ANGLETest.cpp",
"test_utils/ANGLETest.h", "test_utils/ANGLETest.h",
"test_utils/gl_raii.h", "test_utils/gl_raii.h",
"gl_tests/FormatPrintTest.cpp",
] ]
angle_white_box_tests_win_sources = [ angle_white_box_tests_win_sources = [
"egl_tests/EGLDirectCompositionTest.cpp", "egl_tests/EGLDirectCompositionTest.cpp",
......
//
// 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.
//
// FormatPrintTest:
// Prints all format support info
//
#include "test_utils/ANGLETest.h"
#include "test_utils/angle_test_instantiate.h"
// 'None' is defined as 'struct None {};' in
// third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h.
// But 'None' is also defined as a numeric constant 0L in <X11/X.h>.
// So we need to include ANGLETest.h first to avoid this conflict.
#include "libANGLE/Context.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/gl_enum_utils.h"
#include "util/EGLWindow.h"
using namespace angle;
namespace
{
class FormatPrintTest : public ANGLETest
{};
// This test enumerates all sized and unsized GL formats and prints out support information
// This test omits unsupported formats
// The output is csv parseable and has a header and a new line.
// Each row consists of:
// (InternalFormat,Type,texturable,filterable,textureAttachmentSupported,renderBufferSupported)
TEST_P(FormatPrintTest, PrintAllSupportedFormats)
{
// Hack the angle!
gl::Context *context = static_cast<gl::Context *>(getEGLWindow()->getContext());
const gl::InternalFormatInfoMap &allSupportedFormats = gl::GetInternalFormatMap();
std::cout << std::endl
<< "InternalFormat,Type,Texturable,Filterable,Texture attachment,Renderbuffer"
<< std::endl
<< std::endl;
for (const auto &internalFormat : allSupportedFormats)
{
for (const auto &typeFormatPair : internalFormat.second)
{
bool textureSupport = typeFormatPair.second.textureSupport(context->getClientVersion(),
context->getExtensions());
bool filterSupport = typeFormatPair.second.filterSupport(context->getClientVersion(),
context->getExtensions());
bool textureAttachmentSupport = typeFormatPair.second.textureAttachmentSupport(
context->getClientVersion(), context->getExtensions());
bool renderbufferSupport = typeFormatPair.second.renderbufferSupport(
context->getClientVersion(), context->getExtensions());
// Skip if not supported
// A format is not supported if the only feature bit enabled is "filterSupport"
if (!(textureSupport || textureAttachmentSupport || renderbufferSupport))
{
continue;
}
// Lookup enum strings from enum
std::stringstream resultStringStream;
gl::OutputGLenumString(resultStringStream, gl::GLenumGroup::InternalFormat,
internalFormat.first);
resultStringStream << ",";
gl::OutputGLenumString(resultStringStream, gl::GLenumGroup::PixelType,
typeFormatPair.first);
resultStringStream << ",";
// able to be sampled from, see GLSL sampler variables
if (textureSupport)
{
resultStringStream << "texturable";
}
resultStringStream << ",";
// able to be linearly filtered (GL_LINEAR)
if (filterSupport)
{
resultStringStream << "filterable";
}
resultStringStream << ",";
// a texture with this can be used for glFramebufferTexture2D
if (textureAttachmentSupport)
{
resultStringStream << "textureAttachmentSupported";
}
resultStringStream << ",";
// usable with glFramebufferRenderbuffer, glRenderbufferStorage,
// glNamedRenderbufferStorage
if (renderbufferSupport)
{
resultStringStream << "renderbufferSupported";
}
std::cout << resultStringStream.str() << std::endl;
}
}
}
ANGLE_INSTANTIATE_TEST(FormatPrintTest, ES2_VULKAN(), ES3_VULKAN());
} // anonymous namespace
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