Commit f3dbf0a7 by Jiacheng Lu Committed by Commit Bot

FrameCapture dump GLenum to enum instead of value

Add functionality to capture GLenum and GLbitfield parameters as enum names instead of values. Bug: angleproject:3611 Change-Id: I7ddc21093d44d1480b205563f30d89f82779b1f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1724460 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent b8c0dc04
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"scripts/generate_loader.py": "scripts/generate_loader.py":
"48c60c668bec42a80378179aae2acc61", "48c60c668bec42a80378179aae2acc61",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"97cca309a0561f3bf54e0e2c1cf0708b", "40cac0341003ce27d09003ada7f367b4",
"scripts/wgl.xml": "scripts/wgl.xml":
"aa96419c582af2f6673430e2847693f4", "aa96419c582af2f6673430e2847693f4",
"src/libEGL/egl_loader_autogen.cpp": "src/libEGL/egl_loader_autogen.cpp":
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
"scripts/entry_point_packed_gl_enums.json": "scripts/entry_point_packed_gl_enums.json":
"e5282bdef690f0ec652fed0e0723d1e8", "e5282bdef690f0ec652fed0e0723d1e8",
"scripts/generate_entry_points.py": "scripts/generate_entry_points.py":
"72873c3806e749bf593bea823918e520", "c7ee7654f91562e2cb6ad9f336d08003",
"scripts/gl.xml": "scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708", "b470cb06b06cbbe7adb2c8129ec85708",
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"bed6b56a38621721e689ebc19601a556", "bed6b56a38621721e689ebc19601a556",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"97cca309a0561f3bf54e0e2c1cf0708b", "40cac0341003ce27d09003ada7f367b4",
"scripts/wgl.xml": "scripts/wgl.xml":
"aa96419c582af2f6673430e2847693f4", "aa96419c582af2f6673430e2847693f4",
"src/libANGLE/Context_gl_1_0_autogen.h": "src/libANGLE/Context_gl_1_0_autogen.h":
...@@ -64,23 +64,23 @@ ...@@ -64,23 +64,23 @@
"src/libANGLE/Context_gles_ext_autogen.h": "src/libANGLE/Context_gles_ext_autogen.h":
"d924200ebeb9fd0fae9effbc8489d3e1", "d924200ebeb9fd0fae9effbc8489d3e1",
"src/libANGLE/capture_gles_1_0_autogen.cpp": "src/libANGLE/capture_gles_1_0_autogen.cpp":
"bc6dbb7355d76c9ffff0d424b5ca9036", "f4e1335bebff584d2ac5198571b19972",
"src/libANGLE/capture_gles_1_0_autogen.h": "src/libANGLE/capture_gles_1_0_autogen.h":
"06471d4526e8d0b824f5afc8bc8766fa", "06471d4526e8d0b824f5afc8bc8766fa",
"src/libANGLE/capture_gles_2_0_autogen.cpp": "src/libANGLE/capture_gles_2_0_autogen.cpp":
"a7ccc51733f4c608ae79e30195ebe70f", "9d1b9bd6f71e2c0228e428ea84ea999e",
"src/libANGLE/capture_gles_2_0_autogen.h": "src/libANGLE/capture_gles_2_0_autogen.h":
"9876493671f3051054cb10524330c8b1", "9876493671f3051054cb10524330c8b1",
"src/libANGLE/capture_gles_3_0_autogen.cpp": "src/libANGLE/capture_gles_3_0_autogen.cpp":
"1af4126b8eac91fd7401caa9bf4e9a7c", "d6319fca11942f61679ae1b64cfd499c",
"src/libANGLE/capture_gles_3_0_autogen.h": "src/libANGLE/capture_gles_3_0_autogen.h":
"3b17c1843763678272281e1f2a59e254", "3b17c1843763678272281e1f2a59e254",
"src/libANGLE/capture_gles_3_1_autogen.cpp": "src/libANGLE/capture_gles_3_1_autogen.cpp":
"405717bc0d7a9c815fd81e119e69d219", "b7aee1b622dde5c9146fa9eaaf0e7331",
"src/libANGLE/capture_gles_3_1_autogen.h": "src/libANGLE/capture_gles_3_1_autogen.h":
"7f3ff3ade9045bae39ed372e0350454c", "7f3ff3ade9045bae39ed372e0350454c",
"src/libANGLE/capture_gles_ext_autogen.cpp": "src/libANGLE/capture_gles_ext_autogen.cpp":
"52f20a5a311c646510d31e6aa77b03cd", "e574230ccde2276d4e2e77a11a89c7fd",
"src/libANGLE/capture_gles_ext_autogen.h": "src/libANGLE/capture_gles_ext_autogen.h":
"2f2cfa1ee077c3b535138547db57e1af", "2f2cfa1ee077c3b535138547db57e1af",
"src/libANGLE/entry_points_enum_autogen.cpp": "src/libANGLE/entry_points_enum_autogen.cpp":
......
{
"scripts/gen_gl_enum_utils.py":
"b01e8fd8aaf03282f430d98cccc960e4",
"scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708",
"scripts/gl_angle_ext.xml":
"bed6b56a38621721e689ebc19601a556",
"src/libANGLE/gl_enum_utils_autogen.cpp":
"e1b0d3b84de3e2259961c4af2a1e7853",
"src/libANGLE/gl_enum_utils_autogen.h":
"c04076709a7f310bc313d2eae0713f1e"
}
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"bed6b56a38621721e689ebc19601a556", "bed6b56a38621721e689ebc19601a556",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"97cca309a0561f3bf54e0e2c1cf0708b", "40cac0341003ce27d09003ada7f367b4",
"scripts/wgl.xml": "scripts/wgl.xml":
"aa96419c582af2f6673430e2847693f4", "aa96419c582af2f6673430e2847693f4",
"src/libGL/proc_table_wgl_autogen.cpp": "src/libGL/proc_table_wgl_autogen.cpp":
......
#!/usr/bin/python
#
# 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.
#
# gen_gl_enum_utils.py:
# Generates GLenum value to string mapping for ANGLE
# NOTE: don't run this script directly. Run scripts/run_code_generation.py.
import sys
import os
import re
from datetime import date
from collections import namedtuple
import registry_xml
template_gl_enums_header = """// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {data_source_name}.
//
// Copyright {year} 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_autogen.h:
// mapping of GLenum value to string.
# ifndef LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
# define LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
#include <string>
namespace gl
{{
enum class GLenumGroup {{
{gl_enum_groups}
}};
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value);
std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value);
}}
# endif // LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
"""
template_gl_enums_source = """// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {data_source_name}.
//
// Copyright {year} 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_autogen.cpp:
// mapping of GLenum value to string.
#include "libANGLE/gl_enum_utils_autogen.h"
#include <sstream>
#include "common/debug.h"
#include "common/bitset_utils.h"
namespace gl
{{
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value) {{
switch (enumGroup) {{
{gl_enums_value_to_string_table}
default:
UNREACHABLE();
return "EnumUnknown";
}}
}}
std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value) {{
std::stringstream st;
const angle::BitSet<32> bitSet(value);
bool first = true;
for (const auto index : bitSet)
{{
if (!first)
{{
st << " | ";
}}
first = false;
unsigned int mask = 1u << index;
st << GLenumToString(enumGroup, mask);
}}
return st.str();
}}
}}
"""
template_enum_group_case = """case GLenumGroup::{group_name}: {{
switch (value) {{
{inner_group_cases}
default:
return "EnumUnknown";
}}
}}
"""
template_enum_value_to_string_case = """case {value}: return {name};"""
export_apis = ['gles2']
export_extensions = registry_xml.supported_extensions
trivial_gl_enums = {'GL_FALSE', 'GL_TRUE', 'GL_NO_ERROR', 'GL_TIMEOUT_IGNORED', 'GL_INVALID_INDEX'}
def dump_value_to_string_mapping(gl_enum_in_groups, exporting_enums):
exporting_groups = list()
for group_name, inner_mapping in gl_enum_in_groups.iteritems():
string_value_pairs = list(
filter(lambda x: x[0] in exporting_enums, inner_mapping.iteritems()))
if not string_value_pairs:
continue
# sort according values
string_value_pairs.sort(key=lambda x: (x[1], x[0]))
# remove all duplicate values from the pairs list
# some value may have more than one GLenum mapped to them, such as:
# GL_DRAW_FRAMEBUFFER_BINDING and GL_FRAMEBUFFER_BINDING
# GL_BLEND_EQUATION_RGB and GL_BLEND_EQUATION
# it is safe to output either one of them, for simplity here just
# choose the shorter one which comes first in the sorted list
exporting_string_value_pairs = list()
for index, pair in enumerate(string_value_pairs):
if index == 0 or pair[1] != string_value_pairs[index - 1][1]:
exporting_string_value_pairs.append(pair)
inner_code_block = "\n".join([
template_enum_value_to_string_case.format(
value=hex(value),
name='"%s"' % name,
) for name, value in exporting_string_value_pairs
])
exporting_groups.append((group_name, inner_code_block))
return "\n".join([
template_enum_group_case.format(
group_name=group_name,
inner_group_cases=inner_code_block,
) for group_name, inner_code_block in sorted(exporting_groups, key=lambda x: x[0])
])
def main(header_output_path, source_output_path):
xml = registry_xml.RegistryXML('gl.xml', 'gl_angle_ext.xml')
# build a map from GLenum name to its value
all_gl_enums = dict()
for enums_node in xml.root.findall('enums'):
for enum in enums_node.findall('enum'):
name = enum.attrib['name']
value = int(enum.attrib['value'], base=16)
all_gl_enums[name] = value
# Parse groups of GLenums to build a {group, name} -> value mapping.
gl_enum_in_groups = dict()
enums_has_group = set()
for enums_group_node in xml.root.findall('groups/group'):
group_name = enums_group_node.attrib['name']
if group_name not in gl_enum_in_groups:
gl_enum_in_groups[group_name] = dict()
for enum_node in enums_group_node.findall('enum'):
enum_name = enum_node.attrib['name']
enums_has_group.add(enum_name)
gl_enum_in_groups[group_name][enum_name] = all_gl_enums[enum_name]
# Find relevant GLenums according to enabled APIs and extensions.
exporting_enums = set()
for api in export_apis:
xpath = ".//feature[@api='%s']//require//enum" % api
for enum_tag in xml.root.findall(xpath):
enum_name = enum_tag.attrib['name']
exporting_enums.add(enum_name)
for extension in export_extensions:
xpath = ".//extensions//extension[@name='%s']//require//enum" % extension
for enum_tag in xml.root.findall(xpath):
enum_name = enum_tag.attrib['name']
exporting_enums.add(enum_name)
for enum in trivial_gl_enums:
if enum in exporting_enums:
exporting_enums.remove(enum)
# For enums that do not have a group, add them to a default group
default_group_name = registry_xml.default_enum_group_name
gl_enum_in_groups[default_group_name] = dict()
default_group = gl_enum_in_groups[default_group_name]
for enum_name in exporting_enums:
if enum_name not in enums_has_group:
default_group[enum_name] = all_gl_enums[enum_name]
# Write GLenum groups into the header file.
header_content = template_gl_enums_header.format(
script_name=os.path.basename(sys.argv[0]),
data_source_name="gl.xml and gl_angle_ext.xml",
year=date.today().year,
gl_enum_groups=',\n'.join(sorted(gl_enum_in_groups.iterkeys())))
with open(header_output_path, 'w') as f:
f.write(header_content)
# Write mapping to source file
gl_enums_value_to_string_table = dump_value_to_string_mapping(gl_enum_in_groups,
exporting_enums)
source_content = template_gl_enums_source.format(
script_name=os.path.basename(sys.argv[0]),
data_source_name="gl.xml and gl_angle_ext.xml",
year=date.today().year,
gl_enums_value_to_string_table=gl_enums_value_to_string_table,
)
source_output_path = registry_xml.script_relative(source_output_path)
with open(source_output_path, 'w') as f:
f.write(source_content)
return 0
if __name__ == '__main__':
inputs = [
'gl.xml',
'gl_angle_ext.xml',
]
gl_enum_utils_autogen_base_path = '../src/libANGLE/gl_enum_utils_autogen'
outputs = [
gl_enum_utils_autogen_base_path + '.h',
gl_enum_utils_autogen_base_path + '.cpp',
]
if len(sys.argv) > 1:
if sys.argv[1] == 'inputs':
print ','.join(inputs)
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
else:
sys.exit(
main(
registry_xml.script_relative(outputs[0]),
registry_xml.script_relative(outputs[1])))
...@@ -302,6 +302,7 @@ template_capture_source = """// GENERATED FILE - DO NOT EDIT. ...@@ -302,6 +302,7 @@ template_capture_source = """// GENERATED FILE - DO NOT EDIT.
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/FrameCapture.h" #include "libANGLE/FrameCapture.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include "libANGLE/validation{annotation_no_dash}.h" #include "libANGLE/validation{annotation_no_dash}.h"
using namespace angle; using namespace angle;
...@@ -340,6 +341,8 @@ CallCapture Capture{short_name}({params_with_type}) ...@@ -340,6 +341,8 @@ CallCapture Capture{short_name}({params_with_type})
template_parameter_capture_value = """paramBuffer.addValueParam("{name}", ParamType::T{type}, {name});""" template_parameter_capture_value = """paramBuffer.addValueParam("{name}", ParamType::T{type}, {name});"""
template_parameter_capture_gl_enum = """paramBuffer.addEnumParam("{name}", GLenumGroup::{group}, ParamType::T{type}, {name});"""
template_parameter_capture_pointer = """ template_parameter_capture_pointer = """
ParamCapture {name}Param("{name}", ParamType::T{type}); ParamCapture {name}Param("{name}", ParamType::T{type});
InitParamValue(ParamType::T{type}, {name}, &{name}Param.value); InitParamValue(ParamType::T{type}, {name}, &{name}Param.value);
...@@ -676,6 +679,19 @@ def strip_suffix(name): ...@@ -676,6 +679,19 @@ def strip_suffix(name):
return name return name
def find_gl_enum_group_in_command(command_node, param_name):
group_name = None
for param_node in command_node.findall('./param'):
if param_node.find('./name').text == param_name:
group_name = param_node.attrib.get('group', None)
break
if group_name is None or group_name in registry_xml.unsupported_enum_group_names:
group_name = registry_xml.default_enum_group_name
return group_name
def format_entry_point_def(cmd_name, proto, params, is_explicit_context): def format_entry_point_def(cmd_name, proto, params, is_explicit_context):
packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {}) packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {})
internal_params = [just_the_name_packed(param, packed_gl_enums) for param in params] internal_params = [just_the_name_packed(param, packed_gl_enums) for param in params]
...@@ -754,7 +770,8 @@ def get_capture_param_type_name(param_type): ...@@ -754,7 +770,8 @@ def get_capture_param_type_name(param_type):
return param_type return param_type
def format_capture_method(cmd_name, proto, params, all_param_types, capture_pointer_funcs): def format_capture_method(command, cmd_name, proto, params, all_param_types,
capture_pointer_funcs):
packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {}) packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {})
...@@ -782,6 +799,10 @@ def format_capture_method(cmd_name, proto, params, all_param_types, capture_poin ...@@ -782,6 +799,10 @@ def format_capture_method(cmd_name, proto, params, all_param_types, capture_poin
capture_pointer_func = template_parameter_capture_pointer_func.format( capture_pointer_func = template_parameter_capture_pointer_func.format(
name=capture_name, params=params_with_type + ", angle::ParamCapture *paramCapture") name=capture_name, params=params_with_type + ", angle::ParamCapture *paramCapture")
capture_pointer_funcs += [capture_pointer_func] capture_pointer_funcs += [capture_pointer_func]
elif param_type in ('GLenum', 'GLbitfield'):
gl_enum_group = find_gl_enum_group_in_command(command, param_name)
capture = template_parameter_capture_gl_enum.format(
name=param_name, type=param_type, group=gl_enum_group)
else: else:
capture = template_parameter_capture_value.format(name=param_name, type=param_type) capture = template_parameter_capture_value.format(name=param_name, type=param_type)
...@@ -893,7 +914,7 @@ def get_entry_points(all_commands, commands, is_explicit_context, is_wgl, all_pa ...@@ -893,7 +914,7 @@ def get_entry_points(all_commands, commands, is_explicit_context, is_wgl, all_pa
validation_protos.append(format_validation_proto(cmd_name, param_text)) validation_protos.append(format_validation_proto(cmd_name, param_text))
capture_protos.append(format_capture_proto(cmd_name, proto_text, param_text)) capture_protos.append(format_capture_proto(cmd_name, proto_text, param_text))
capture_methods.append( capture_methods.append(
format_capture_method(cmd_name, proto_text, param_text, all_param_types, format_capture_method(command, cmd_name, proto_text, param_text, all_param_types,
capture_pointer_funcs)) capture_pointer_funcs))
return decls, defs, export_defs, validation_protos, capture_protos, capture_methods, capture_pointer_funcs return decls, defs, export_defs, validation_protos, capture_protos, capture_methods, capture_pointer_funcs
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
# List of supported extensions. Add to this list to enable new extensions # List of supported extensions. Add to this list to enable new extensions
# available in gl.xml. # available in gl.xml.
import sys, os import sys
import os
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
xml_inputs = [ xml_inputs = [
...@@ -124,6 +125,22 @@ strip_suffixes = ["ANGLE", "EXT", "KHR", "OES", "CHROMIUM"] ...@@ -124,6 +125,22 @@ strip_suffixes = ["ANGLE", "EXT", "KHR", "OES", "CHROMIUM"]
# Toggle generation here. # Toggle generation here.
support_EGL_ANGLE_explicit_context = True support_EGL_ANGLE_explicit_context = True
# For ungrouped GLenum types
default_enum_group_name = "DefaultGroup"
# Group names that appear in command/param, but not present in groups/group
unsupported_enum_group_names = {
'GetMultisamplePNameNV',
'BufferPNameARB',
'BufferPointerNameARB',
'VertexAttribPointerPropertyARB',
'VertexAttribPropertyARB',
'FenceParameterNameNV',
'FenceConditionNV',
'BufferPointerNameARB',
'MatrixIndexPointerTypeARB',
}
def script_relative(path): def script_relative(path):
return os.path.join(os.path.dirname(sys.argv[0]), path) return os.path.join(os.path.dirname(sys.argv[0]), path)
......
...@@ -81,6 +81,8 @@ generators = { ...@@ -81,6 +81,8 @@ generators = {
'scripts/generate_loader.py', 'scripts/generate_loader.py',
'GL/EGL entry points': 'GL/EGL entry points':
'scripts/generate_entry_points.py', 'scripts/generate_entry_points.py',
'GLenum value to string map':
'scripts/gen_gl_enum_utils.py',
'GL format map': 'GL format map':
'src/libANGLE/gen_format_map.py', 'src/libANGLE/gen_format_map.py',
'uniform type': 'uniform type':
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
#include "libANGLE/gl_enum_utils_autogen.h"
namespace angle namespace angle
{ {
...@@ -60,13 +61,14 @@ void WriteInlineData(const std::vector<uint8_t> &vec, std::ostream &out) ...@@ -60,13 +61,14 @@ void WriteInlineData(const std::vector<uint8_t> &vec, std::ostream &out)
constexpr size_t kInlineDataThreshold = 128; constexpr size_t kInlineDataThreshold = 128;
} // anonymous namespace } // anonymous namespace
ParamCapture::ParamCapture() : type(ParamType::TGLenum) {} ParamCapture::ParamCapture() : type(ParamType::TGLenum), enumGroup(gl::GLenumGroup::DefaultGroup) {}
ParamCapture::ParamCapture(const char *nameIn, ParamType typeIn) : name(nameIn), type(typeIn) {} ParamCapture::ParamCapture(const char *nameIn, ParamType typeIn) : name(nameIn), type(typeIn) {}
ParamCapture::~ParamCapture() = default; ParamCapture::~ParamCapture() = default;
ParamCapture::ParamCapture(ParamCapture &&other) : type(ParamType::TGLenum) ParamCapture::ParamCapture(ParamCapture &&other)
: type(ParamType::TGLenum), enumGroup(gl::GLenumGroup::DefaultGroup)
{ {
*this = std::move(other); *this = std::move(other);
} }
...@@ -76,6 +78,7 @@ ParamCapture &ParamCapture::operator=(ParamCapture &&other) ...@@ -76,6 +78,7 @@ ParamCapture &ParamCapture::operator=(ParamCapture &&other)
std::swap(name, other.name); std::swap(name, other.name);
std::swap(type, other.type); std::swap(type, other.type);
std::swap(value, other.value); std::swap(value, other.value);
std::swap(enumGroup, other.enumGroup);
std::swap(data, other.data); std::swap(data, other.data);
std::swap(arrayClientPointerIndex, other.arrayClientPointerIndex); std::swap(arrayClientPointerIndex, other.arrayClientPointerIndex);
std::swap(readBufferSizeBytes, other.readBufferSizeBytes); std::swap(readBufferSizeBytes, other.readBufferSizeBytes);
...@@ -427,7 +430,18 @@ void FrameCapture::writeCallReplay(const CallCapture &call, ...@@ -427,7 +430,18 @@ void FrameCapture::writeCallReplay(const CallCapture &call,
} }
else if (param.data.empty()) else if (param.data.empty())
{ {
out << param; if (param.type == ParamType::TGLenum)
{
out << GLenumToString(param.enumGroup, param.value.GLenumVal);
}
else if (param.type == ParamType::TGLbitfield)
{
out << GLbitfieldToString(param.enumGroup, param.value.GLbitfieldVal);
}
else
{
out << param;
}
} }
else else
{ {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "libANGLE/angletypes.h" #include "libANGLE/angletypes.h"
#include "libANGLE/entry_points_utils.h" #include "libANGLE/entry_points_utils.h"
#include "libANGLE/frame_capture_utils_autogen.h" #include "libANGLE/frame_capture_utils_autogen.h"
#include "libANGLE/gl_enum_utils_autogen.h"
#include <tuple> #include <tuple>
...@@ -32,6 +33,7 @@ struct ParamCapture : angle::NonCopyable ...@@ -32,6 +33,7 @@ struct ParamCapture : angle::NonCopyable
std::string name; std::string name;
ParamType type; ParamType type;
ParamValue value; ParamValue value;
gl::GLenumGroup enumGroup; // only used for param type GLenum, GLboolean and GLbitfield
std::vector<std::vector<uint8_t>> data; std::vector<std::vector<uint8_t>> data;
int arrayClientPointerIndex = -1; int arrayClientPointerIndex = -1;
size_t readBufferSizeBytes = 0; size_t readBufferSizeBytes = 0;
...@@ -48,6 +50,11 @@ class ParamBuffer final : angle::NonCopyable ...@@ -48,6 +50,11 @@ class ParamBuffer final : angle::NonCopyable
template <typename T> template <typename T>
void addValueParam(const char *paramName, ParamType paramType, T paramValue); void addValueParam(const char *paramName, ParamType paramType, T paramValue);
template <typename T>
void addEnumParam(const char *paramName,
gl::GLenumGroup enumGroup,
ParamType paramType,
T paramValue);
ParamCapture &getParam(const char *paramName, ParamType paramType, int index); ParamCapture &getParam(const char *paramName, ParamType paramType, int index);
...@@ -139,6 +146,18 @@ void ParamBuffer::addValueParam(const char *paramName, ParamType paramType, T pa ...@@ -139,6 +146,18 @@ void ParamBuffer::addValueParam(const char *paramName, ParamType paramType, T pa
mParamCaptures.emplace_back(std::move(capture)); mParamCaptures.emplace_back(std::move(capture));
} }
template <typename T>
void ParamBuffer::addEnumParam(const char *paramName,
gl::GLenumGroup enumGroup,
ParamType paramType,
T paramValue)
{
ParamCapture capture(paramName, paramType);
InitParamValue(paramType, paramValue, &capture.value);
capture.enumGroup = enumGroup;
mParamCaptures.emplace_back(std::move(capture));
}
std::ostream &operator<<(std::ostream &os, const ParamCapture &capture); std::ostream &operator<<(std::ostream &os, const ParamCapture &capture);
// Pointer capture helpers. // Pointer capture helpers.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_gl_enum_utils.py using data from gl.xml and gl_angle_ext.xml.
//
// 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_autogen.h:
// mapping of GLenum value to string.
#ifndef LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
#define LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
#include <string>
namespace gl
{
enum class GLenumGroup
{
AccumOp,
AlphaFunction,
AtomicCounterBufferPName,
AttribMask,
AttributeType,
BindTransformFeedbackTarget,
BlendEquationModeEXT,
BlendingFactor,
BlitFramebufferFilter,
Boolean,
Buffer,
BufferAccessARB,
BufferAccessMask,
BufferBitQCOM,
BufferStorageTarget,
BufferTargetARB,
BufferUsageARB,
CheckFramebufferStatusTarget,
ClearBufferMask,
ClientAttribMask,
ClipControlDepth,
ClipControlOrigin,
ClipPlaneName,
ColorBuffer,
ColorMaterialFace,
ColorMaterialParameter,
ColorPointerType,
ColorTableParameterPNameSGI,
ColorTableTarget,
ColorTableTargetSGI,
ContextFlagMask,
ContextProfileMask,
ConvolutionBorderModeEXT,
ConvolutionParameterEXT,
ConvolutionTarget,
ConvolutionTargetEXT,
CopyBufferSubDataTarget,
CullFaceMode,
DataType,
DebugSeverity,
DebugSource,
DebugType,
DefaultGroup,
DepthFunction,
DrawBufferMode,
DrawElementsType,
EnableCap,
ErrorCode,
ExternalHandleType,
FeedBackToken,
FeedbackType,
FfdMaskSGIX,
FfdTargetSGIX,
FogCoordinatePointerType,
FogMode,
FogPName,
FogParameter,
FogPointerTypeEXT,
FogPointerTypeIBM,
FragmentLightModelParameterSGIX,
FragmentOpATI,
FramebufferAttachment,
FramebufferAttachmentParameterName,
FramebufferFetchNoncoherent,
FramebufferParameterName,
FramebufferStatus,
FramebufferTarget,
FrontFaceDirection,
GetColorTableParameterPNameSGI,
GetConvolutionParameter,
GetFramebufferParameter,
GetHistogramParameterPNameEXT,
GetMapQuery,
GetMinmaxParameterPNameEXT,
GetPName,
GetPixelMap,
GetPointervPName,
GetTextureParameter,
GraphicsResetStatus,
HintMode,
HintTarget,
HistogramTargetEXT,
IndexPointerType,
InterleavedArrayFormat,
InternalFormat,
InternalFormatPName,
LightEnvModeSGIX,
LightEnvParameterSGIX,
LightModelColorControl,
LightModelParameter,
LightName,
LightParameter,
ListMode,
ListNameType,
ListParameterName,
LogicOp,
MapBufferUsageMask,
MapQuery,
MapTarget,
MapTextureFormatINTEL,
MaterialFace,
MaterialParameter,
MatrixMode,
MemoryBarrierMask,
MemoryObjectParameterName,
MeshMode1,
MeshMode2,
MinmaxTargetEXT,
NormalPointerType,
ObjectIdentifier,
OcclusionQueryEventMaskAMD,
PatchParameterName,
PathColor,
PathCoverMode,
PathElementType,
PathFillMode,
PathFontStyle,
PathFontTarget,
PathGenMode,
PathHandleMissingGlyphs,
PathListMode,
PathMetricMask,
PathParameter,
PathStringFormat,
PathTransformType,
PipelineParameterName,
PixelCopyType,
PixelFormat,
PixelMap,
PixelStoreParameter,
PixelStoreResampleMode,
PixelStoreSubsampleRate,
PixelTexGenMode,
PixelTexGenParameterNameSGIS,
PixelTransferParameter,
PixelType,
PointParameterNameSGIS,
PolygonMode,
PrecisionType,
PrimitiveType,
ProgramInterface,
ProgramInterfacePName,
ProgramParameterPName,
ProgramPropertyARB,
ProgramStagePName,
QueryObjectParameterName,
QueryParameterName,
QueryTarget,
ReadBufferMode,
RenderbufferParameterName,
RenderbufferTarget,
RenderingMode,
SamplePatternSGIS,
SamplerParameterName,
SemaphoreParameterName,
SeparableTargetEXT,
ShaderParameterName,
ShaderType,
ShadingModel,
StencilFaceDirection,
StencilFunction,
StencilOp,
StringName,
SubroutineParameterName,
SyncCondition,
SyncObjectMask,
SyncParameterName,
SyncStatus,
TexCoordPointerType,
TextureCoordName,
TextureEnvMode,
TextureEnvParameter,
TextureEnvTarget,
TextureFilterFuncSGIS,
TextureGenMode,
TextureGenParameter,
TextureLayout,
TextureMagFilter,
TextureMinFilter,
TextureParameterName,
TextureStorageMaskAMD,
TextureTarget,
TextureUnit,
TextureWrapMode,
TransformFeedbackPName,
TypeEnum,
UniformBlockPName,
UniformPName,
UseProgramStageMask,
VertexArrayPName,
VertexAttribEnum,
VertexAttribPointerType,
VertexAttribType,
VertexBufferObjectParameter,
VertexBufferObjectUsage,
VertexPointerType,
VertexProvokingMode
};
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value);
std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value);
} // namespace gl
#endif // LIBANGLE_GL_ENUM_UTILS_AUTOGEN_H_
...@@ -920,6 +920,7 @@ libangle_sources += [ ...@@ -920,6 +920,7 @@ libangle_sources += [
"src/libANGLE/capture_gles_3_1_autogen.h", "src/libANGLE/capture_gles_3_1_autogen.h",
"src/libANGLE/capture_gles_ext_autogen.h", "src/libANGLE/capture_gles_ext_autogen.h",
"src/libANGLE/frame_capture_utils_autogen.h", "src/libANGLE/frame_capture_utils_autogen.h",
"src/libANGLE/gl_enum_utils_autogen.h",
] ]
libangle_capture_sources = [ libangle_capture_sources = [
...@@ -934,6 +935,7 @@ libangle_capture_sources = [ ...@@ -934,6 +935,7 @@ libangle_capture_sources = [
"src/libANGLE/capture_gles_3_1_params.cpp", "src/libANGLE/capture_gles_3_1_params.cpp",
"src/libANGLE/capture_gles_ext_autogen.cpp", "src/libANGLE/capture_gles_ext_autogen.cpp",
"src/libANGLE/capture_gles_ext_params.cpp", "src/libANGLE/capture_gles_ext_params.cpp",
"src/libANGLE/gl_enum_utils_autogen.cpp",
"src/libANGLE/frame_capture_utils_autogen.cpp", "src/libANGLE/frame_capture_utils_autogen.cpp",
] ]
......
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