Hash :
3adace15
Author :
Date :
2022-01-10T22:53:19
Don't expose detailed driver version info to webGL WebGL's GL_RENDERER string now only includes basic version information on all backends. This is controlled through a bool passed through getBackendVersionString. Bug: angleproject:6777 Change-Id: Ie4e3d91d22c96f175a8139fac1c66e985ed9e1b7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3380263 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Sean Risser <srisser@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
//
// Copyright 2021 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.
//
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "tests/angle_unittests_utils.h"
namespace rx
{
extern std::string SanitizeRendererString(std::string rendererString);
extern std::string SanitizeVersionString(std::string versionString,
bool isES,
bool includeFullVersion);
namespace testing
{
namespace
{
TEST(DisplayGLTest, SanitizeRendererStringIntel)
{
std::string testString = "Mesa DRI Intel(R) HD Graphics 4000 (IVB GT2)";
std::string testExpectation = "Mesa DRI Intel(R) HD Graphics 4000 (IVB GT2)";
EXPECT_EQ(SanitizeRendererString(testString), testExpectation);
}
TEST(DisplayGLTest, SanitizeRendererStringLLVMPipe)
{
std::string testString = "llvmpipe (LLVM 11.0.0, 256 bits)";
std::string testExpectation = "llvmpipe (LLVM 11.0.0, 256 bits)";
EXPECT_EQ(SanitizeRendererString(testString), testExpectation);
}
TEST(DisplayGLTest, SanitizeRendererStringRadeonVega)
{
std::string testString = "Radeon RX Vega";
std::string testExpectation = "Radeon RX Vega";
EXPECT_EQ(SanitizeRendererString(testString), testExpectation);
}
TEST(DisplayGLTest, SanitizeRendererStringRadeonTM)
{
std::string testString =
"AMD Radeon (TM) RX 460 Graphics (POLARIS11, DRM 3.35.0, 5.4.0-65-generic, LLVM 11.0.0)";
std::string testExpectation = "AMD Radeon (TM) RX 460 Graphics (POLARIS11)";
EXPECT_EQ(SanitizeRendererString(testString), testExpectation);
}
TEST(DisplayGLTest, SanitizeRendererStringRadeonWithoutGeneration)
{
std::string testString = "AMD Radeon RX 5700 (DRM 3.35.0, 5.4.0-65-generic, LLVM 11.0.0)";
std::string testExpectation = "AMD Radeon RX 5700";
EXPECT_EQ(SanitizeRendererString(testString), testExpectation);
}
TEST(DisplayGLTest, SanitizeVersionStringOpenGLMissing)
{
std::string testString = "4.6.0 NVIDIA 391.76";
std::string testExpectation = "OpenGL 4.6.0 NVIDIA 391.76";
EXPECT_EQ(SanitizeVersionString(testString, false, true), testExpectation);
}
// Note: OpenGL renderers with this prefix don't actually seem to be present in the wild
TEST(DisplayGLTest, SanitizeVersionStringOpenGLPresent)
{
std::string testString = "OpenGL 4.5.0 - Build 22.20.16.4749";
std::string testExpectation = "OpenGL 4.5.0 - Build 22.20.16.4749";
EXPECT_EQ(SanitizeVersionString(testString, false, true), testExpectation);
}
TEST(DisplayGLTest, SanitizeVersionStringOpenGLESMissing)
{
std::string testString = "4.6.0 NVIDIA 419.67";
std::string testExpectation = "OpenGL ES 4.6.0 NVIDIA 419.67";
EXPECT_EQ(SanitizeVersionString(testString, true, true), testExpectation);
}
TEST(DisplayGLTest, SanitizeVersionStringOpenGLESPresent)
{
std::string testString = "OpenGL ES 3.2 v1.r12p0-04rel0.44f2946824bb8739781564bffe2110c9";
std::string testExpectation = "OpenGL ES 3.2 v1.r12p0-04rel0.44f2946824bb8739781564bffe2110c9";
EXPECT_EQ(SanitizeVersionString(testString, true, true), testExpectation);
}
TEST(DisplayGLTest, SanitizeVersionStringOpenGLMissingLimited)
{
std::string testString = "4.6.0 NVIDIA 391.76";
std::string testExpectation = "OpenGL 4.6.0";
EXPECT_EQ(SanitizeVersionString(testString, false, false), testExpectation);
}
// Note: OpenGL renderers with this prefix don't actually seem to be present in the wild
TEST(DisplayGLTest, SanitizeVersionStringOpenGLPresentLimited)
{
std::string testString = "OpenGL 4.5.0 - Build 22.20.16.4749";
std::string testExpectation = "OpenGL 4.5.0";
EXPECT_EQ(SanitizeVersionString(testString, false, false), testExpectation);
}
TEST(DisplayGLTest, SanitizeVersionStringOpenGLESMissingLimited)
{
std::string testString = "4.6.0 NVIDIA 419.67";
std::string testExpectation = "OpenGL ES 4.6.0";
EXPECT_EQ(SanitizeVersionString(testString, true, false), testExpectation);
}
TEST(DisplayGLTest, SanitizeVersionStringOpenGLESPresentLimited)
{
std::string testString = "OpenGL ES 3.2 v1.r12p0-04rel0.44f2946824bb8739781564bffe2110c9";
std::string testExpectation = "OpenGL ES 3.2";
EXPECT_EQ(SanitizeVersionString(testString, true, false), testExpectation);
}
} // anonymous namespace
} // namespace testing
} // namespace rx