mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-06 02:09:55 +03:00
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:
@@ -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;
|
||||
}}
|
||||
}}
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user