Commit e167f76b by Jamie Madill Committed by Commit Bot

Capture/Replay: Pass gl::State to capture functions.

This replaces passing gl::Context. Using a gl::State directly will more easily let the mid-execution replay code pass a mocked gl::State instead of having to modify the real underlying Context state. For example when capturing pixel pack and unpack parameters the states could not be overridden without changing the gl::Context itself. Similarly when capturing client side data. Also moves a query parameter info function into queryutils so it can be accessible to the State-based capture. Refactoring change only. Bug: angleproject:3611 Change-Id: I3c064001cfa83ebbb67a2b8fc8b6180491edd215 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1899728Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 075cc4c3
...@@ -18,4 +18,10 @@ ...@@ -18,4 +18,10 @@
#include "GLES3/gl31.h" #include "GLES3/gl31.h"
#include "GLES3/gl32.h" #include "GLES3/gl32.h"
// TODO(http://anglebug.com/3730): Autogenerate these enums from gl.xml
// HACK: Defines for queries that are not in GLES
#define GL_CONTEXT_PROFILE_MASK 0x9126
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
#endif // ANGLEGL_H_ #endif // ANGLEGL_H_
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"scripts/entry_point_packed_gl_enums.json": "scripts/entry_point_packed_gl_enums.json":
"3b72a1d43df45cf53784b2a0002b93e5", "3b72a1d43df45cf53784b2a0002b93e5",
"scripts/generate_entry_points.py": "scripts/generate_entry_points.py":
"fef06e2feec72f9e4bf4f2b8c9c76c17", "36f89f5514fff27ecb4baeded89ae64d",
"scripts/gl.xml": "scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708", "b470cb06b06cbbe7adb2c8129ec85708",
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
...@@ -66,29 +66,29 @@ ...@@ -66,29 +66,29 @@
"src/libANGLE/Context_gles_ext_autogen.h": "src/libANGLE/Context_gles_ext_autogen.h":
"4a24e91315986187921051585d04f66f", "4a24e91315986187921051585d04f66f",
"src/libANGLE/capture_gles_1_0_autogen.cpp": "src/libANGLE/capture_gles_1_0_autogen.cpp":
"cdf61f5bb245ec4b7976922ad3c983b4", "01eb0a76c176e5cdba3102cae58334af",
"src/libANGLE/capture_gles_1_0_autogen.h": "src/libANGLE/capture_gles_1_0_autogen.h":
"942cece5d16510b77529dd549fc8ffb6", "d5ecca8738a27e2b35fd61889fb4a017",
"src/libANGLE/capture_gles_2_0_autogen.cpp": "src/libANGLE/capture_gles_2_0_autogen.cpp":
"6abbbf043ab061141516ec0a78d83414", "c2b906c8ea8eca4d4791d124bd7135ad",
"src/libANGLE/capture_gles_2_0_autogen.h": "src/libANGLE/capture_gles_2_0_autogen.h":
"1d7c76f7dfcb666161bc4675932511c5", "af53b8ded1e0d85db9e53c4997c6e995",
"src/libANGLE/capture_gles_3_0_autogen.cpp": "src/libANGLE/capture_gles_3_0_autogen.cpp":
"8c29bbcc49be5d9792b65a98dde38c81", "0cbaed1327ba5f361e04ceb0537e3948",
"src/libANGLE/capture_gles_3_0_autogen.h": "src/libANGLE/capture_gles_3_0_autogen.h":
"47530c15422e03b9cc224533eed1f2f7", "c76e9098943e28c0e9b68ac76b22d5a1",
"src/libANGLE/capture_gles_3_1_autogen.cpp": "src/libANGLE/capture_gles_3_1_autogen.cpp":
"2a941ced0f0721fb0256accbf07fc4c3", "6d1662f483cee2d166c4ead3824b8d4c",
"src/libANGLE/capture_gles_3_1_autogen.h": "src/libANGLE/capture_gles_3_1_autogen.h":
"389c0212c9d2da8bdc159aecee243551", "1739a558c3e77bef37d9fa710eb78932",
"src/libANGLE/capture_gles_3_2_autogen.cpp": "src/libANGLE/capture_gles_3_2_autogen.cpp":
"105d24635bacbd3e464da5056c328987", "f74e229e52cc19b0678207e6204b563d",
"src/libANGLE/capture_gles_3_2_autogen.h": "src/libANGLE/capture_gles_3_2_autogen.h":
"670fe346f46607380fc7cf8234657123", "8d96d227765ee9b0d7b532edcc9f3bf1",
"src/libANGLE/capture_gles_ext_autogen.cpp": "src/libANGLE/capture_gles_ext_autogen.cpp":
"b3e07e16ed33b55ca00e06167d361efa", "3bd6fcda980f381cbbad2956b896afd9",
"src/libANGLE/capture_gles_ext_autogen.h": "src/libANGLE/capture_gles_ext_autogen.h":
"072f50469f77d3ecb9fa2145e9f100f6", "2626f039751578bd51c1cbbc1e233f5d",
"src/libANGLE/entry_points_enum_autogen.cpp": "src/libANGLE/entry_points_enum_autogen.cpp":
"6f259507f339880bf81920738e82e688", "6f259507f339880bf81920738e82e688",
"src/libANGLE/entry_points_enum_autogen.h": "src/libANGLE/entry_points_enum_autogen.h":
......
...@@ -276,8 +276,6 @@ template_capture_header = """// GENERATED FILE - DO NOT EDIT. ...@@ -276,8 +276,6 @@ template_capture_header = """// GENERATED FILE - DO NOT EDIT.
namespace gl namespace gl
{{ {{
class Context;
{prototypes} {prototypes}
}} // namespace gl }} // namespace gl
...@@ -898,9 +896,9 @@ def format_capture_method(command, cmd_name, proto, params, all_param_types, cap ...@@ -898,9 +896,9 @@ def format_capture_method(command, cmd_name, proto, params, all_param_types, cap
packed_gl_enums = get_packed_enums(cmd_packed_gl_enums, cmd_name) packed_gl_enums = get_packed_enums(cmd_packed_gl_enums, cmd_name)
params_with_type = get_internal_params( params_with_type = get_internal_params(
cmd_name, ["const Context *context", "bool isCallValid"] + params, cmd_packed_gl_enums) cmd_name, ["const State &glState", "bool isCallValid"] + params, cmd_packed_gl_enums)
params_just_name = ", ".join( params_just_name = ", ".join(
["context", "isCallValid"] + ["glState", "isCallValid"] +
[just_the_name_packed(param, packed_gl_enums) for param in params]) [just_the_name_packed(param, packed_gl_enums) for param in params])
parameter_captures = [] parameter_captures = []
...@@ -995,7 +993,7 @@ def format_validation_proto(cmd_name, params, cmd_packed_gl_enums): ...@@ -995,7 +993,7 @@ def format_validation_proto(cmd_name, params, cmd_packed_gl_enums):
def format_capture_proto(cmd_name, proto, params, cmd_packed_gl_enums): def format_capture_proto(cmd_name, proto, params, cmd_packed_gl_enums):
internal_params = get_internal_params( internal_params = get_internal_params(
cmd_name, ["const Context *context", "bool isCallValid"] + params, cmd_packed_gl_enums) cmd_name, ["const State &glState", "bool isCallValid"] + params, cmd_packed_gl_enums)
return_type = proto[:-len(cmd_name)].strip() return_type = proto[:-len(cmd_name)].strip()
if return_type != "void": if return_type != "void":
internal_params += ", %s returnValue" % return_type internal_params += ", %s returnValue" % return_type
......
...@@ -732,7 +732,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -732,7 +732,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
OverlayType mOverlay; OverlayType mOverlay;
}; };
} // namespace gl } // namespace gl
#endif // LIBANGLE_CONTEXT_H_ #endif // LIBANGLE_CONTEXT_H_
...@@ -224,7 +224,7 @@ void CaptureCallToFrameCapture(CaptureFuncT captureFunc, ...@@ -224,7 +224,7 @@ void CaptureCallToFrameCapture(CaptureFuncT captureFunc,
if (!frameCapture->enabled()) if (!frameCapture->enabled())
return; return;
CallCapture call = captureFunc(context, isCallValid, captureParams...); CallCapture call = captureFunc(context->getState(), isCallValid, captureParams...);
frameCapture->captureCall(context, std::move(call)); frameCapture->captureCall(context, std::move(call));
} }
...@@ -254,8 +254,10 @@ std::ostream &operator<<(std::ostream &os, const ParamCapture &capture); ...@@ -254,8 +254,10 @@ std::ostream &operator<<(std::ostream &os, const ParamCapture &capture);
void CaptureMemory(const void *source, size_t size, ParamCapture *paramCapture); void CaptureMemory(const void *source, size_t size, ParamCapture *paramCapture);
void CaptureString(const GLchar *str, ParamCapture *paramCapture); void CaptureString(const GLchar *str, ParamCapture *paramCapture);
gl::Program *GetLinkedProgramForCapture(const gl::State &glState, gl::ShaderProgramID handle);
// For GetIntegerv, GetFloatv, etc. // For GetIntegerv, GetFloatv, etc.
void CaptureGetParameter(const gl::Context *context, void CaptureGetParameter(const gl::State &glState,
GLenum pname, GLenum pname,
size_t typeSize, size_t typeSize,
ParamCapture *paramCapture); ParamCapture *paramCapture);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -27,6 +27,7 @@ class Program; ...@@ -27,6 +27,7 @@ class Program;
class Renderbuffer; class Renderbuffer;
class Sampler; class Sampler;
class Shader; class Shader;
class State;
class Texture; class Texture;
struct TextureCaps; struct TextureCaps;
struct UniformBlock; struct UniformBlock;
...@@ -238,6 +239,10 @@ void GetPointSize(GLES1State *state, GLfloat *sizeOut); ...@@ -238,6 +239,10 @@ void GetPointSize(GLES1State *state, GLfloat *sizeOut);
unsigned int GetTexParameterCount(GLenum pname); unsigned int GetTexParameterCount(GLenum pname);
bool GetQueryParameterInfo(const State &glState,
GLenum pname,
GLenum *type,
unsigned int *numParams);
} // namespace gl } // namespace gl
namespace egl namespace egl
......
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