Capture/Replay: Correct a few GLenum replay issues.

This change refactors the GLenum utils into a non-autogenerated and an
autogenerated portion. That makes it easier to modify the non-auto-
generated bits to properly output GLenums even when the gl.xml data
isn't totally correct. For instance, the "GetPName" group was missing
a bunch of queries. Instead of trying to fix the GL we can simply fall
back to querying the "Default" group when we return invalid enum.

Also corrects a missing "0x" on hex output.

Also allows the capture/replay sample to specify the correct binary
data directory when testing a replay.

Bug: angleproject:3611
Change-Id: I8e4c690b2850bb157a8cde8b057b20603e4b177d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1891008
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2019-10-31 14:33:26 -04:00 коммит произвёл Commit Bot
Родитель ba65c156cf
Коммит e96039218e
44 изменённых файлов: 371 добавлений и 357 удалений

Просмотреть файл

@ -772,7 +772,10 @@ angle_source_set("libANGLE") {
# gl_enum_utils defaults included in with_capture build
if (angle_enable_trace || is_debug) {
sources += [ "src/libANGLE/gl_enum_utils_autogen.cpp" ]
sources += [
"src/libANGLE/gl_enum_utils.cpp",
"src/libANGLE/gl_enum_utils_autogen.cpp",
]
}
}

Просмотреть файл

@ -57,8 +57,9 @@ template("angle_sample") {
angle_executable(target_name) {
forward_variables_from(invoker,
[
"sources",
"cflags",
"defines",
"sources",
])
deps = [
":sample_util",
@ -224,6 +225,9 @@ template("capture_replay") {
"capture_replay/angle_capture_context1.cpp",
"capture_replay/angle_capture_context1.h",
]
_data_path = rebase_path("capture_replay", root_out_dir)
defines = [ "ANGLE_CAPTURE_REPLAY_SAMPLE_DATA_DIR=\"${_data_path}\"" ]
suppressed_configs = [ "$angle_root:constructor_and_destructor_warnings" ]
}
}

Просмотреть файл

@ -13,10 +13,20 @@ class CaptureReplaySample : public SampleApplication
{
public:
CaptureReplaySample(int argc, char **argv)
: SampleApplication("CaptureReplaySample", argc, argv, 2, 0)
: SampleApplication("CaptureReplaySample", argc, argv, 3, 0)
{}
bool initialize() override { return true; }
bool initialize() override
{
// Set CWD to executable directory.
std::string exeDir = angle::GetExecutableDirectory();
if (!angle::SetCWD(exeDir.c_str()))
return false;
SetBinaryDataDir(ANGLE_CAPTURE_REPLAY_SAMPLE_DATA_DIR);
SetupContext1Replay();
return true;
}
void destroy() override {}
void draw() override

Просмотреть файл

@ -6,7 +6,7 @@
"scripts/entry_point_packed_gl_enums.json":
"3b72a1d43df45cf53784b2a0002b93e5",
"scripts/generate_entry_points.py":
"b6c3c544f603a6e37168c39581a86c3d",
"fef06e2feec72f9e4bf4f2b8c9c76c17",
"scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708",
"scripts/gl_angle_ext.xml":
@ -66,27 +66,27 @@
"src/libANGLE/Context_gles_ext_autogen.h":
"2b79ca4165cde1822bf3114e9be36ffe",
"src/libANGLE/capture_gles_1_0_autogen.cpp":
"b186bbd2b8e541208f58c68a7b7201d0",
"cdf61f5bb245ec4b7976922ad3c983b4",
"src/libANGLE/capture_gles_1_0_autogen.h":
"942cece5d16510b77529dd549fc8ffb6",
"src/libANGLE/capture_gles_2_0_autogen.cpp":
"928f64b38fefa6f69b1b9ddd3cb0a800",
"6abbbf043ab061141516ec0a78d83414",
"src/libANGLE/capture_gles_2_0_autogen.h":
"1d7c76f7dfcb666161bc4675932511c5",
"src/libANGLE/capture_gles_3_0_autogen.cpp":
"0ccdb5401c2630ecc2bbd0bcbc1559f0",
"8c29bbcc49be5d9792b65a98dde38c81",
"src/libANGLE/capture_gles_3_0_autogen.h":
"47530c15422e03b9cc224533eed1f2f7",
"src/libANGLE/capture_gles_3_1_autogen.cpp":
"1de6bb30272e7b4b29e508a64c7d2e63",
"2a941ced0f0721fb0256accbf07fc4c3",
"src/libANGLE/capture_gles_3_1_autogen.h":
"389c0212c9d2da8bdc159aecee243551",
"src/libANGLE/capture_gles_3_2_autogen.cpp":
"7cb1866e8c3d754187d25a7db272dded",
"105d24635bacbd3e464da5056c328987",
"src/libANGLE/capture_gles_3_2_autogen.h":
"670fe346f46607380fc7cf8234657123",
"src/libANGLE/capture_gles_ext_autogen.cpp":
"f28449f3234c31a499ca46636898ff34",
"3157fc72b59492ae13f2b4ddb17a4a7e",
"src/libANGLE/capture_gles_ext_autogen.h":
"50e37179609055eeee59807b631e33c9",
"src/libANGLE/entry_points_enum_autogen.cpp":
@ -150,79 +150,79 @@
"src/libANGLE/validationGL4_autogen.h":
"506d7f2976f38191e8124292d4b2381c",
"src/libGL/entry_points_gl_1_0_autogen.cpp":
"97af960a3ac3e09c7582ae5fd34ea00f",
"a4daa0cb63f70d3df36d82c62dadf4eb",
"src/libGL/entry_points_gl_1_0_autogen.h":
"a2372719bd7fbc4a6b070ecae7d9247a",
"src/libGL/entry_points_gl_1_1_autogen.cpp":
"ffb6c6ad66896c1fb6ae829943a8ab19",
"bda932e7b8c48c6f9d3e67986daa760f",
"src/libGL/entry_points_gl_1_1_autogen.h":
"29ff203c0d402f78d020525a5e5ee447",
"src/libGL/entry_points_gl_1_2_autogen.cpp":
"46a9ee44d1130a0edc6af15a7ba69cae",
"58cbcbd98a5b2a39f0399bc4cf877d72",
"src/libGL/entry_points_gl_1_2_autogen.h":
"db041e9b37eaaf1c31a4b4e2e4e987f4",
"src/libGL/entry_points_gl_1_3_autogen.cpp":
"6808f83f6917854166d327ae3fd65b06",
"084e837b6de7022a77189025778edf66",
"src/libGL/entry_points_gl_1_3_autogen.h":
"0c30cbdd3d5b10e9217a049cc2794317",
"src/libGL/entry_points_gl_1_4_autogen.cpp":
"3008406765111143f7fc03403ab1ae02",
"bdf0e58164be5874746c932a8b4a4ca9",
"src/libGL/entry_points_gl_1_4_autogen.h":
"6f3dcfd98c18cd53f32e61ee01eabad6",
"src/libGL/entry_points_gl_1_5_autogen.cpp":
"52cdf4ba872a2cb70d3da4a37550fe65",
"d1af528536223d6596de5f80eba8afa0",
"src/libGL/entry_points_gl_1_5_autogen.h":
"8caacff247caecb833b065afaf6e90ef",
"src/libGL/entry_points_gl_2_0_autogen.cpp":
"95a7a8632efad5246cd47f13e67a4f8f",
"5ca4096a4ef67886a0ab8833a1d78e38",
"src/libGL/entry_points_gl_2_0_autogen.h":
"f0f58f83717148d58b735af5c435f2ef",
"src/libGL/entry_points_gl_2_1_autogen.cpp":
"3bcd909ee2074e04bdd74cd5334a3314",
"de8220d247cf6f5c3fe6e53180f4e4e4",
"src/libGL/entry_points_gl_2_1_autogen.h":
"87cd6d513a5852c56eed9b58484fbe19",
"src/libGL/entry_points_gl_3_0_autogen.cpp":
"8c6e1637e876828f7a843bcd8ee343ad",
"ce58fb8f366180f4985c15525fd2d688",
"src/libGL/entry_points_gl_3_0_autogen.h":
"47396290a846f808e598acdbca56e9b3",
"src/libGL/entry_points_gl_3_1_autogen.cpp":
"ed491a5e2eb7db9737b7a7e637291f09",
"7580f570dc32617d92795f64acd2bcd2",
"src/libGL/entry_points_gl_3_1_autogen.h":
"6ee6613c0206d99c6afdcd3faddb52a3",
"src/libGL/entry_points_gl_3_2_autogen.cpp":
"629fe168acc316b1f2a370048e6f0ee4",
"85c8dad28022855d4b08189abd0c45f9",
"src/libGL/entry_points_gl_3_2_autogen.h":
"347e40b5c9fd08a693bf4ffe713c61e6",
"src/libGL/entry_points_gl_3_3_autogen.cpp":
"56cf84c3812e618cbe818a1f4e7e01ac",
"82a9a4afafd9d4aab5c549adcfb1615e",
"src/libGL/entry_points_gl_3_3_autogen.h":
"2151c64b03364111ad1455609243caba",
"src/libGL/entry_points_gl_4_0_autogen.cpp":
"5109dc62f6d5ae5a7e967d67289c27df",
"706e99bdf41e8b40770e30212d029aa7",
"src/libGL/entry_points_gl_4_0_autogen.h":
"c5a258322ee6de37ffdbb6f40d5703a2",
"src/libGL/entry_points_gl_4_1_autogen.cpp":
"74448960c2c6d1ade9e96914b13a71f6",
"e7030ef9c2eb8a060ff39f8290e08324",
"src/libGL/entry_points_gl_4_1_autogen.h":
"ea1e18bf5ed2bd1063c940bd793cb50c",
"src/libGL/entry_points_gl_4_2_autogen.cpp":
"9de6c0fb0299ed6ac582888391d88e70",
"b1398145a971caf304bfa04b763ef4c3",
"src/libGL/entry_points_gl_4_2_autogen.h":
"e6b93e1c3028230ebf5ba8a09f5f4aca",
"src/libGL/entry_points_gl_4_3_autogen.cpp":
"90385feca064cabc28380a66e82429d1",
"fdbad2524aa7da7fae958f63561b67ae",
"src/libGL/entry_points_gl_4_3_autogen.h":
"60bf8a8337129670875de694386a0a9d",
"src/libGL/entry_points_gl_4_4_autogen.cpp":
"c79d8b66a98a49b66f12ff6379ff8fb4",
"433442c50de217a592a9196b8459e4b0",
"src/libGL/entry_points_gl_4_4_autogen.h":
"d0a8c556ffb1c9d4519a66b2868c68b2",
"src/libGL/entry_points_gl_4_5_autogen.cpp":
"ddb5009c66a37741716cd508cf83c0c3",
"84025bdbd5390f84a30c2ea6c1412611",
"src/libGL/entry_points_gl_4_5_autogen.h":
"0cc66bfbe40b1120e38ba977c2c95cc1",
"src/libGL/entry_points_gl_4_6_autogen.cpp":
"17403d2322e09156e58dd97ef341ed4b",
"76e7e0bfa5550d77665f63c6f7a918a9",
"src/libGL/entry_points_gl_4_6_autogen.h":
"d659e18d8caffa8d0729fc1a8bdd79f2",
"src/libGL/libGL_autogen.cpp":
@ -230,27 +230,27 @@
"src/libGL/libGL_autogen.def":
"b372327de868ff8eaa4f837b7e434f72",
"src/libGLESv2/entry_points_gles_1_0_autogen.cpp":
"ca944f7d1a68a87f07acf51b4f6b11f6",
"09ad611acdd58e37aae27cbde7ec04a1",
"src/libGLESv2/entry_points_gles_1_0_autogen.h":
"bc93815cab91fe9b6f86d04ef4e8863f",
"src/libGLESv2/entry_points_gles_2_0_autogen.cpp":
"2a2a36cace079a1c836f9227811143e2",
"cb70d24eba01f14857514c2c95fe0fea",
"src/libGLESv2/entry_points_gles_2_0_autogen.h":
"3bbaf1cf42fba5d675e5b54cd1d14df7",
"src/libGLESv2/entry_points_gles_3_0_autogen.cpp":
"e0ec5aae2046f3cb7de9d51594024fe9",
"0268fdd48ffb3ae84a0f1dcd4064d45f",
"src/libGLESv2/entry_points_gles_3_0_autogen.h":
"395f6978219abd5182bbe80cc367e40c",
"src/libGLESv2/entry_points_gles_3_1_autogen.cpp":
"a5b1581c1f809b6f7b36b06688a95d7b",
"4fe124db0b5d238038358853f349b247",
"src/libGLESv2/entry_points_gles_3_1_autogen.h":
"043d09a964c740067bf4279e0b544aed",
"src/libGLESv2/entry_points_gles_3_2_autogen.cpp":
"83c4850e1c9be655bd342ef34a398012",
"09693d9b4cd5f015ee1b1bd46a2a0e0a",
"src/libGLESv2/entry_points_gles_3_2_autogen.h":
"e06eb4df7dc6fb29c5fd632a54b0b162",
"src/libGLESv2/entry_points_gles_ext_autogen.cpp":
"7dd5f8f00efe704691859723dc83f5ec",
"19f6e2b5b612f49f8a079c646112d1dd",
"src/libGLESv2/entry_points_gles_ext_autogen.h":
"ce40d2f260a855dd7f11cfb919db4b70",
"src/libGLESv2/libGLESv2_autogen.cpp":

Просмотреть файл

@ -1,6 +1,6 @@
{
"scripts/gen_gl_enum_utils.py":
"a9b5da824adad3e9f8f586a6a53708c6",
"43712e01cc1c0ae60b4eccef659fe328",
"scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708",
"scripts/gl_angle_ext.xml":
@ -8,7 +8,7 @@
"scripts/registry_xml.py":
"b24096dba06cad5f97b07edbd5f0c132",
"src/libANGLE/gl_enum_utils_autogen.cpp":
"2561a68fa7582e248c7d9feb400723d3",
"1d8757468215b824bf6a1c0bd077909d",
"src/libANGLE/gl_enum_utils_autogen.h":
"b6b36e2bbb676ed3b744e883b0d101e1"
"fb0bb7f506f6082ea3b2c3fa384d2739"
}

Просмотреть файл

@ -27,29 +27,13 @@ template_gl_enums_header = """// GENERATED FILE - DO NOT EDIT.
# ifndef LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
# define LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
#include <string>
#include <ostream>
#include "common/PackedGLEnums_autogen.h"
namespace gl
{{
enum class GLenumGroup {{
enum class GLenumGroup
{{
{gl_enum_groups}
}};
const char *GLbooleanToString(unsigned int value);
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value);
std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value);
void OutputGLenumString(std::ostream &out, GLenumGroup enumGroup, unsigned int value);
void OutputGLbitfieldString(std::ostream &out, GLenumGroup enumGroup, unsigned int value);
}}
}} // namespace gl
# endif // LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
"""
@ -66,57 +50,27 @@ template_gl_enums_source = """// GENERATED FILE - DO NOT EDIT.
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include <sstream>
#include "common/bitset_utils.h"
namespace gl
{{
namespace
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value)
{{
constexpr char kEnumUnknown[] = "EnumUnknown";
}} // anonymous namespace
void OutputGLenumString(std::ostream &out, GLenumGroup enumGroup, unsigned int value)
{{
const char *enumStr = GLenumToString(enumGroup, value);
if (enumStr != kEnumUnknown)
switch (enumGroup)
{{
out << enumStr;
}}
else
{{
out << std::hex << value << std::dec;
}}
}}
void OutputGLbitfieldString(std::ostream &out, GLenumGroup enumGroup, unsigned int value)
{{
out << GLbitfieldToString(enumGroup, value);
}}
const char *GLbooleanToString(unsigned int value) {{
switch (value) {{
case 0x0:
return "GL_FALSE";
case 0x1:
return "GL_TRUE";
default:
return kEnumUnknown;
}}
}}
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value) {{
switch (enumGroup) {{
{gl_enums_value_to_string_table}
default:
return kEnumUnknown;
return kUnknownGLenumString;
}}
}}
std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value) {{
std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value)
{{
std::stringstream st;
const angle::BitSet<32> bitSet(value);
@ -135,8 +89,7 @@ std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value) {{
return st.str();
}}
}}
}} // namespace gl
"""
@ -144,7 +97,7 @@ template_enum_group_case = """case GLenumGroup::{group_name}: {{
switch (value) {{
{inner_group_cases}
default:
return kEnumUnknown;
return kUnknownGLenumString;
}}
}}
"""

Просмотреть файл

@ -298,7 +298,7 @@ template_capture_source = """// GENERATED FILE - DO NOT EDIT.
#include "libANGLE/Context.h"
#include "libANGLE/FrameCapture.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validation{annotation_no_dash}.h"
using namespace angle;
@ -447,7 +447,7 @@ template_sources_includes = """#include "libGLESv2/entry_points_{header_version}
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/capture_{header_version}_autogen.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validation{validation_header_version}.h"
#include "libANGLE/entry_points_utils.h"
#include "libGLESv2/global_state.h"
@ -462,7 +462,7 @@ template_sources_includes_gl32 = """#include "libGL/entry_points_{}_autogen.h"
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -17,7 +17,7 @@
#include "common/system_utils.h"
#include "libANGLE/Context.h"
#include "libANGLE/VertexArray.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#if !ANGLE_CAPTURE_ENABLED
# error Frame capture must be enbled to include this file.
@ -448,29 +448,29 @@ void WriteCppReplay(const std::string &outDir,
out << "void " << FmtReplayFunction(contextId, frameIndex) << "\n";
out << "{\n";
std::stringstream callStream;
for (const CallCapture &call : calls)
{
callStream << " ";
WriteCppReplayForCall(call, &counters, callStream, header, &binaryData);
callStream << ";\n";
}
if (!binaryData.empty())
{
std::string binaryDataFileName = GetCaptureFileName(contextId, frameIndex, ".angledata");
out << " LoadBinaryData(\"" << binaryDataFileName << "\", "
<< static_cast<int>(binaryData.size()) << ");\n";
}
for (const CallCapture &call : calls)
{
out << " ";
WriteCppReplayForCall(call, &counters, out, header, &binaryData);
out << ";\n";
}
if (!binaryData.empty())
{
std::string dataFilepath = GetCaptureFilePath(outDir, contextId, frameIndex, ".angledata");
SaveFileHelper saveData(dataFilepath, std::ios::binary);
saveData.ofs.write(reinterpret_cast<const char *>(binaryData.data()), binaryData.size());
}
out << callStream.str();
out << "}\n";
header << "} // anonymous namespace\n";
@ -520,6 +520,7 @@ void WriteCppReplayIndexFiles(const std::string &outDir,
header << "void " << FmtReplayFunction(contextId, frameIndex) << ";\n";
}
header << "\n";
header << "void SetBinaryDataDir(const char *dataDir);\n";
header << "void LoadBinaryData(const char *fileName, size_t size);\n";
header << "\n";
header << "// Global state\n";
@ -539,6 +540,8 @@ void WriteCppReplayIndexFiles(const std::string &outDir,
source << " memcpy(&returnedID, &gReadBuffer[readBufferOffset], sizeof(GLuint));\n";
source << " (*resourceMap)[id] = returnedID;\n";
source << "}\n";
source << "\n";
source << "const char *gBinaryDataDir = \".\";\n";
source << "} // namespace\n";
source << "\n";
source << "uint8_t *gBinaryData = nullptr;\n";
@ -583,6 +586,11 @@ void WriteCppReplayIndexFiles(const std::string &outDir,
source << " }\n";
source << "}\n";
source << "\n";
source << "void SetBinaryDataDir(const char *dataDir)\n";
source << "{\n";
source << " gBinaryDataDir = dataDir;\n";
source << "}\n";
source << "\n";
source << "void LoadBinaryData(const char *fileName, size_t size)\n";
source << "{\n";
source << " if (gBinaryData != nullptr)\n";
@ -590,7 +598,9 @@ void WriteCppReplayIndexFiles(const std::string &outDir,
source << " delete [] gBinaryData;\n";
source << " }\n";
source << " gBinaryData = new uint8_t[size];\n";
source << " FILE *fp = fopen(fileName, \"rb\");\n";
source << " char pathBuffer[1000] = {};\n";
source << " sprintf(pathBuffer, \"%s/%s\", gBinaryDataDir, fileName);\n";
source << " FILE *fp = fopen(pathBuffer, \"rb\");\n";
source << " fread(gBinaryData, 1, size, fp);\n";
source << " fclose(fp);\n";
source << "}\n";

Просмотреть файл

@ -12,7 +12,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/FrameCapture.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES1.h"
using namespace angle;

Просмотреть файл

@ -12,7 +12,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/FrameCapture.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES2.h"
using namespace angle;

Просмотреть файл

@ -12,7 +12,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/FrameCapture.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES3.h"
using namespace angle;

Просмотреть файл

@ -12,7 +12,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/FrameCapture.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES31.h"
using namespace angle;

Просмотреть файл

@ -12,7 +12,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/FrameCapture.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES32.h"
using namespace angle;

Просмотреть файл

@ -12,7 +12,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/FrameCapture.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationESEXT.h"
using namespace angle;

Просмотреть файл

@ -0,0 +1,57 @@
//
// 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.
//
// gl_enum_utils.cpp:
// Utility functions for converting GLenums to string.
#include "libANGLE/gl_enum_utils.h"
#include <iomanip>
namespace gl
{
const char kUnknownGLenumString[] = "EnumUnknown";
void OutputGLenumString(std::ostream &out, GLenumGroup enumGroup, unsigned int value)
{
const char *enumStr = GLenumToString(enumGroup, value);
if (enumStr != kUnknownGLenumString)
{
out << enumStr;
return;
}
if (enumGroup != GLenumGroup::DefaultGroup)
{
// Retry with the "Default" group
enumStr = GLenumToString(GLenumGroup::DefaultGroup, value);
if (enumStr != kUnknownGLenumString)
{
out << enumStr;
return;
}
}
out << std::hex << "0x" << std::setfill('0') << std::setw(4) << value << std::dec;
}
void OutputGLbitfieldString(std::ostream &out, GLenumGroup enumGroup, unsigned int value)
{
out << GLbitfieldToString(enumGroup, value);
}
const char *GLbooleanToString(unsigned int value)
{
switch (value)
{
case 0x0:
return "GL_FALSE";
case 0x1:
return "GL_TRUE";
default:
return kUnknownGLenumString;
}
}
} // namespace gl

Просмотреть файл

@ -0,0 +1,28 @@
//
// 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.
//
// gl_enum_utils.h:
// Utility functions for converting GLenums to string.
#ifndef LIBANGLE_GL_ENUM_UTILS_H_
#define LIBANGLE_GL_ENUM_UTILS_H_
#include <ostream>
#include <string>
#include "libANGLE/gl_enum_utils_autogen.h"
namespace gl
{
const char *GLbooleanToString(unsigned int value);
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value);
std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value);
void OutputGLenumString(std::ostream &out, GLenumGroup enumGroup, unsigned int value);
void OutputGLbitfieldString(std::ostream &out, GLenumGroup enumGroup, unsigned int value);
extern const char kUnknownGLenumString[];
} // namespace gl
#endif // LIBANGLE_GL_ENUM_UTILS_H_

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -11,14 +11,8 @@
#ifndef LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
#define LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
#include <ostream>
#include <string>
#include "common/PackedGLEnums_autogen.h"
namespace gl
{
enum class GLenumGroup
{
AccumOp,
@ -219,17 +213,6 @@ enum class GLenumGroup
VertexPointerType,
VertexProvokingMode
};
const char *GLbooleanToString(unsigned int value);
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value);
std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value);
void OutputGLenumString(std::ostream &out, GLenumGroup enumGroup, unsigned int value);
void OutputGLbitfieldString(std::ostream &out, GLenumGroup enumGroup, unsigned int value);
} // namespace gl
#endif // LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -13,7 +13,7 @@
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES1.h"

Просмотреть файл

@ -874,6 +874,7 @@ libangle_sources += [
"src/libANGLE/capture_gles_3_2_autogen.h",
"src/libANGLE/capture_gles_ext_autogen.h",
"src/libANGLE/frame_capture_utils_autogen.h",
"src/libANGLE/gl_enum_utils.h",
"src/libANGLE/gl_enum_utils_autogen.h",
]
@ -893,6 +894,7 @@ libangle_capture_sources = [
"src/libANGLE/capture_gles_ext_params.cpp",
"src/libANGLE/frame_capture_replay_autogen.cpp",
"src/libANGLE/frame_capture_utils_autogen.cpp",
"src/libANGLE/gl_enum_utils.cpp",
"src/libANGLE/gl_enum_utils_autogen.cpp",
]

Просмотреть файл

@ -14,7 +14,7 @@
#include "libANGLE/Context.inl.h"
#include "libANGLE/capture_gles_1_0_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES1.h"
#include "libGLESv2/global_state.h"

Просмотреть файл

@ -14,7 +14,7 @@
#include "libANGLE/Context.inl.h"
#include "libANGLE/capture_gles_2_0_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES2.h"
#include "libGLESv2/global_state.h"

Просмотреть файл

@ -14,7 +14,7 @@
#include "libANGLE/Context.inl.h"
#include "libANGLE/capture_gles_3_0_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES3.h"
#include "libGLESv2/global_state.h"

Просмотреть файл

@ -14,7 +14,7 @@
#include "libANGLE/Context.inl.h"
#include "libANGLE/capture_gles_3_1_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES31.h"
#include "libGLESv2/global_state.h"

Просмотреть файл

@ -14,7 +14,7 @@
#include "libANGLE/Context.inl.h"
#include "libANGLE/capture_gles_3_2_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationES32.h"
#include "libGLESv2/global_state.h"

Просмотреть файл

@ -14,7 +14,7 @@
#include "libANGLE/Context.inl.h"
#include "libANGLE/capture_gles_ext_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include "libANGLE/validationESEXT.h"
#include "libGLESv2/global_state.h"