Commit 9b0911a0 by Jamie Madill Committed by Commit Bot

Add GL_ANGLE_get_serialized_context_string.

This will provide a front-door entry point where we can get a serialized string representing the context state. Previously we would have to call ANGLE internal directly. This will enable a refactor of the replays to work more like standalone plugin libraries. Bug: angleproject:5811 Change-Id: I5a97d7aa3cd70c49199264c2eb7ca953943ac3c3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2803391 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 7a699140
Name
ANGLE_get_serialized_context_string
Name Strings
GL_ANGLE_get_serialized_context_string
Contributors
Jamie Madill, Google
Contact
Jamie Madill, Google (jmadill 'at' google.com)
Status
Implemented in ANGLE.
Version
Last Modified Date: April 2, 2021
Revision: #1
Number
TBD
Dependencies
OpenGL ES 2.0 is required.
Overview
Adds a query for a serialized string representation of a context.
Useful for testing to easily compare two states.
New Tokens
Accepted by the <name> parameter of glGetString:
SERIALIZED_CONTEXT_STRING_ANGLE 0x96B0
Additions to Chapter 6 of the OpenGL ES 2.0 Specification (Querying GL State)
Update Section 6.1.5 "String Queries" to accept the new enum specified
above. The SERIALIZED_CONTEXT_STRING_ANGLE string is an implementation-
dependent representation of the current context state. Two contexts
with the same internal state are guaranteed to have the same value. Note
that the reverse is not true - two contexts with different states are
may also have the same serialized string.
New State
None.
Issues
1) Should two contexts with different states return different strings?
RESOLVED: We don't provide a guarantee that every state is serialized
into the string. This loose wording lets the extension provide
some additional extra validation without being overly strict and
making the implementation difficult. It also allow a no-op
implementation to satisfy the extension requirements.
Revision History
2021/04/02 jmadill Initial revision.
...@@ -570,6 +570,11 @@ GL_APICALL void GL_APIENTRY glImportSemaphoreZirconHandleANGLE(GLuint memory, ...@@ -570,6 +570,11 @@ GL_APICALL void GL_APIENTRY glImportSemaphoreZirconHandleANGLE(GLuint memory,
#define GL_PURGED_CONTEXT_RESET_NV 0x92BB #define GL_PURGED_CONTEXT_RESET_NV 0x92BB
#endif /* GL_NV_robustness_video_memory */ #endif /* GL_NV_robustness_video_memory */
#ifndef GL_ANGLE_get_serialized_context_string
#define GL_ANGLE_get_serialized_context_string
#define GL_SERIALIZED_CONTEXT_STRING_ANGLE 0x96B0
#endif /* GL_ANGLE_get_serialized_context_string */
// clang-format on // clang-format on
#endif // INCLUDE_GLES2_GL2EXT_ANGLE_H_ #endif // INCLUDE_GLES2_GL2EXT_ANGLE_H_
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"08f74b35d908b7c02b45fdf45572c434", "08f74b35d908b7c02b45fdf45572c434",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"7e9b9e8b735dadb417b2d10434f56a41", "2d623a8b4a8a49213e8d0c0a0c8c4dd8",
"scripts/wgl.xml": "scripts/wgl.xml":
"c36001431919e1c435f1215a85f7e1db", "c36001431919e1c435f1215a85f7e1db",
"src/libEGL/egl_loader_autogen.cpp": "src/libEGL/egl_loader_autogen.cpp":
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"08f74b35d908b7c02b45fdf45572c434", "08f74b35d908b7c02b45fdf45572c434",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"7e9b9e8b735dadb417b2d10434f56a41", "2d623a8b4a8a49213e8d0c0a0c8c4dd8",
"scripts/wgl.xml": "scripts/wgl.xml":
"c36001431919e1c435f1215a85f7e1db", "c36001431919e1c435f1215a85f7e1db",
"src/common/entry_points_enum_autogen.cpp": "src/common/entry_points_enum_autogen.cpp":
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
"src/libANGLE/Context_gles_3_2_autogen.h": "src/libANGLE/Context_gles_3_2_autogen.h":
"48567dca16fd881dfe6d61fee0e3106f", "48567dca16fd881dfe6d61fee0e3106f",
"src/libANGLE/Context_gles_ext_autogen.h": "src/libANGLE/Context_gles_ext_autogen.h":
"d6b07fcd1713e3eddf6156e9cf477ec9", "865ac7b504d009956f9de60fd00f7bb3",
"src/libANGLE/capture/capture_gles_1_0_autogen.cpp": "src/libANGLE/capture/capture_gles_1_0_autogen.cpp":
"7ec7ef8f779b809a45d74b97502c419b", "7ec7ef8f779b809a45d74b97502c419b",
"src/libANGLE/capture/capture_gles_1_0_autogen.h": "src/libANGLE/capture/capture_gles_1_0_autogen.h":
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"08f74b35d908b7c02b45fdf45572c434", "08f74b35d908b7c02b45fdf45572c434",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"7e9b9e8b735dadb417b2d10434f56a41", "2d623a8b4a8a49213e8d0c0a0c8c4dd8",
"src/libANGLE/capture/gl_enum_utils_autogen.cpp": "src/libANGLE/capture/gl_enum_utils_autogen.cpp":
"9517df43e12c9d27cdf40a0db05bc85b", "9517df43e12c9d27cdf40a0db05bc85b",
"src/libANGLE/capture/gl_enum_utils_autogen.h": "src/libANGLE/capture/gl_enum_utils_autogen.h":
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"08f74b35d908b7c02b45fdf45572c434", "08f74b35d908b7c02b45fdf45572c434",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"7e9b9e8b735dadb417b2d10434f56a41", "2d623a8b4a8a49213e8d0c0a0c8c4dd8",
"scripts/wgl.xml": "scripts/wgl.xml":
"c36001431919e1c435f1215a85f7e1db", "c36001431919e1c435f1215a85f7e1db",
"src/libGL/proc_table_wgl_autogen.cpp": "src/libGL/proc_table_wgl_autogen.cpp":
......
...@@ -36,6 +36,7 @@ angle_extensions = [ ...@@ -36,6 +36,7 @@ angle_extensions = [
"GL_CHROMIUM_lose_context", "GL_CHROMIUM_lose_context",
"GL_ANGLE_copy_texture_3d", "GL_ANGLE_copy_texture_3d",
"GL_ANGLE_get_image", "GL_ANGLE_get_image",
"GL_ANGLE_get_serialized_context_string",
"GL_ANGLE_get_tex_level_parameter", "GL_ANGLE_get_tex_level_parameter",
"GL_ANGLE_program_binary", "GL_ANGLE_program_binary",
"GL_ANGLE_request_extension", "GL_ANGLE_request_extension",
......
...@@ -1056,6 +1056,7 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -1056,6 +1056,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_OES_shader_io_blocks"] = enableableExtension(&Extensions::shaderIoBlocksOES); map["GL_OES_shader_io_blocks"] = enableableExtension(&Extensions::shaderIoBlocksOES);
map["GL_EXT_shader_io_blocks"] = enableableExtension(&Extensions::shaderIoBlocksEXT); map["GL_EXT_shader_io_blocks"] = enableableExtension(&Extensions::shaderIoBlocksEXT);
map["GL_EXT_clip_cull_distance"] = enableableExtension(&Extensions::clipCullDistanceEXT); map["GL_EXT_clip_cull_distance"] = enableableExtension(&Extensions::clipCullDistanceEXT);
map["GL_ANGLE_get_serialized_context_string"] = enableableExtension(&Extensions::getSerializedContextStringANGLE);
// GLES1 extensions // GLES1 extensions
map["GL_OES_point_size_array"] = enableableExtension(&Extensions::pointSizeArrayOES); map["GL_OES_point_size_array"] = enableableExtension(&Extensions::pointSizeArrayOES);
map["GL_OES_texture_cube_map"] = enableableExtension(&Extensions::textureCubeMapOES); map["GL_OES_texture_cube_map"] = enableableExtension(&Extensions::textureCubeMapOES);
......
...@@ -718,6 +718,9 @@ struct Extensions ...@@ -718,6 +718,9 @@ struct Extensions
// GL_EXT_clip_cull_distance // GL_EXT_clip_cull_distance
bool clipCullDistanceEXT = false; bool clipCullDistanceEXT = false;
// GL_ANGLE_get_serialized_context_string
bool getSerializedContextStringANGLE = false;
}; };
// Pointer to a boolean memeber of the Extensions struct // Pointer to a boolean memeber of the Extensions struct
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "libANGLE/TransformFeedback.h" #include "libANGLE/TransformFeedback.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
#include "libANGLE/capture/FrameCapture.h" #include "libANGLE/capture/FrameCapture.h"
#include "libANGLE/capture/frame_capture_utils.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/queryconversions.h" #include "libANGLE/queryconversions.h"
#include "libANGLE/queryutils.h" #include "libANGLE/queryutils.h"
...@@ -3215,6 +3216,17 @@ const GLubyte *Context::getString(GLenum name) const ...@@ -3215,6 +3216,17 @@ const GLubyte *Context::getString(GLenum name) const
case GL_REQUESTABLE_EXTENSIONS_ANGLE: case GL_REQUESTABLE_EXTENSIONS_ANGLE:
return reinterpret_cast<const GLubyte *>(mRequestableExtensionString); return reinterpret_cast<const GLubyte *>(mRequestableExtensionString);
case GL_SERIALIZED_CONTEXT_STRING_ANGLE:
if (angle::SerializeContextToString(this, &mCachedSerializedStateString) ==
angle::Result::Continue)
{
return reinterpret_cast<const GLubyte *>(mCachedSerializedStateString.c_str());
}
else
{
return nullptr;
}
default: default:
UNREACHABLE(); UNREACHABLE();
return nullptr; return nullptr;
...@@ -3535,6 +3547,9 @@ Extensions Context::generateSupportedExtensions() const ...@@ -3535,6 +3547,9 @@ Extensions Context::generateSupportedExtensions() const
// GL_ANGLE_get_tex_level_parameter is implemented in the frontend // GL_ANGLE_get_tex_level_parameter is implemented in the frontend
supportedExtensions.getTexLevelParameterANGLE = true; supportedExtensions.getTexLevelParameterANGLE = true;
// Always enabled. Will return a default string if capture is not enabled.
supportedExtensions.getSerializedContextStringANGLE = true;
return supportedExtensions; return supportedExtensions;
} }
......
...@@ -782,6 +782,9 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -782,6 +782,9 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
// Note: we use a raw pointer here so we can exclude frame capture sources from the build. // Note: we use a raw pointer here so we can exclude frame capture sources from the build.
std::unique_ptr<angle::FrameCapture> mFrameCapture; std::unique_ptr<angle::FrameCapture> mFrameCapture;
// Cache representation of the serialized context string.
mutable std::string mCachedSerializedStateString;
mutable size_t mRefCount; mutable size_t mRefCount;
OverlayType mOverlay; OverlayType mOverlay;
......
...@@ -276,6 +276,7 @@ ...@@ -276,6 +276,7 @@
void getTexImage(TextureTarget targetPacked, GLint level, GLenum format, GLenum type, \ void getTexImage(TextureTarget targetPacked, GLint level, GLenum format, GLenum type, \
void *pixels); \ void *pixels); \
void getRenderbufferImage(GLenum target, GLenum format, GLenum type, void *pixels); \ void getRenderbufferImage(GLenum target, GLenum format, GLenum type, void *pixels); \
/* GL_ANGLE_get_serialized_context_string */ \
/* GL_ANGLE_get_tex_level_parameter */ \ /* GL_ANGLE_get_tex_level_parameter */ \
/* GL_ANGLE_program_binary */ \ /* GL_ANGLE_program_binary */ \
/* GL_ANGLE_request_extension */ \ /* GL_ANGLE_request_extension */ \
......
...@@ -3903,6 +3903,14 @@ bool ValidateGetString(const Context *context, GLenum name) ...@@ -3903,6 +3903,14 @@ bool ValidateGetString(const Context *context, GLenum name)
} }
break; break;
case GL_SERIALIZED_CONTEXT_STRING_ANGLE:
if (!context->getExtensions().getSerializedContextStringANGLE)
{
context->validationError(GL_INVALID_ENUM, kInvalidName);
return false;
}
break;
default: default:
context->validationError(GL_INVALID_ENUM, kInvalidName); context->validationError(GL_INVALID_ENUM, kInvalidName);
return false; return false;
......
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