Skip to content

Commit

Permalink
Capture/Replay: Correct a few GLenum replay issues.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
null77 authored and Commit Bot committed Nov 1, 2019
1 parent ba65c15 commit e960392
Show file tree
Hide file tree
Showing 44 changed files with 371 additions and 357 deletions.
5 changes: 4 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
}
}

Expand Down
6 changes: 5 additions & 1 deletion samples/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ template("angle_sample") {
angle_executable(target_name) {
forward_variables_from(invoker,
[
"sources",
"cflags",
"defines",
"sources",
])
deps = [
":sample_util",
Expand Down Expand Up @@ -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" ]
}
}
Expand Down
14 changes: 12 additions & 2 deletions samples/capture_replay/CaptureReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 32 additions & 32 deletions scripts/code_generation_hashes/GL_EGL_entry_points.json
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -150,107 +150,107 @@
"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":
"9dafbdb3d31700b4505f312a91b147fc",
"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":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"scripts/gen_gl_enum_utils.py":
"a9b5da824adad3e9f8f586a6a53708c6",
"43712e01cc1c0ae60b4eccef659fe328",
"scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708",
"scripts/gl_angle_ext.xml":
"7ae7214df3151267943d34b2b3fb9d2b",
"scripts/registry_xml.py":
"b24096dba06cad5f97b07edbd5f0c132",
"src/libANGLE/gl_enum_utils_autogen.cpp":
"2561a68fa7582e248c7d9feb400723d3",
"1d8757468215b824bf6a1c0bd077909d",
"src/libANGLE/gl_enum_utils_autogen.h":
"b6b36e2bbb676ed3b744e883b0d101e1"
"fb0bb7f506f6082ea3b2c3fa384d2739"
}
71 changes: 12 additions & 59 deletions scripts/gen_gl_enum_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,13 @@
# 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_
"""
Expand All @@ -66,57 +50,27 @@
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/gl_enum_utils.h"
#include <sstream>
#include "common/bitset_utils.h"
namespace gl
{{
namespace
{{
constexpr char kEnumUnknown[] = "EnumUnknown";
}} // anonymous namespace
void OutputGLenumString(std::ostream &out, GLenumGroup enumGroup, unsigned int value)
const char *GLenumToString(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);
Expand All @@ -135,16 +89,15 @@
return st.str();
}}
}}
}} // namespace gl
"""

template_enum_group_case = """case GLenumGroup::{group_name}: {{
switch (value) {{
{inner_group_cases}
default:
return kEnumUnknown;
return kUnknownGLenumString;
}}
}}
"""
Expand Down
6 changes: 3 additions & 3 deletions scripts/generate_entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class Context;
#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;
Expand Down Expand Up @@ -447,7 +447,7 @@ class Context;
#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"
Expand All @@ -462,7 +462,7 @@ class Context;
#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"
Expand Down
Loading

0 comments on commit e960392

Please sign in to comment.