Commit 3f564fc7 by Jamie Madill Committed by Commit Bot

EGL: Generate entry points.

This adds two final auto-generated files for the EGL and EXT extension entry points. It adds a new data file that stores a mapping between object types and entry points for associating labeled objects with certain methods. When we generate errors we record the associated object in the debug message output. This places the remainder of the hand-written code in "stub" files. Going forward the work for implementing new extension entry points for EGL will be to update the registry XML files and then implement the corresponding stub methods. Event logging, parameter packing, and validation are all handled by the auto-generated code. Bug: angleproject:2621 Change-Id: I28153432802c37b929ff2ea1e1a3e3ce9de91605 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2562680 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 db679caf
......@@ -4,11 +4,11 @@
"scripts/egl_angle_ext.xml":
"91f7718effe50d444f8d81ce285721db",
"scripts/entry_point_packed_egl_enums.json":
"7cb78d6bea4e0df9e74d3ce5faf824dc",
"0175304f39aec0f1816760c6460b6d62",
"scripts/entry_point_packed_gl_enums.json":
"846be5dc8cb36076207699b025633fcc",
"scripts/generate_entry_points.py":
"6e65c837b023f25f368edf0b91146951",
"95fc7635243122e679e82e1757816ab3",
"scripts/gl.xml":
"f66967f3f3d696b5d8306fd80bbd49a8",
"scripts/gl_angle_ext.xml":
......@@ -102,7 +102,7 @@
"src/libANGLE/frame_capture_utils_autogen.h":
"652b821a877d6eb2c62ba8d151157eea",
"src/libANGLE/validationEGL_autogen.h":
"ecdb1d2c7cd19d2a4faeafb19de4d77e",
"b3c0eae46748da68d6833cc40e4bb486",
"src/libANGLE/validationES1_autogen.h":
"c8edb0a5b26303bf7c4692b9d0b05c1f",
"src/libANGLE/validationES2_autogen.h":
......@@ -237,8 +237,18 @@
"a5e7b09116b1905ce029f2383cbe4f3a",
"src/libGL/libGL_autogen.def":
"2789d87b05eea9f53d52e2aff499b785",
"src/libGLESv2/egl_ext_stubs_autogen.h":
"03de6401c1695f8ca4acbde9c3ae1ba2",
"src/libGLESv2/egl_get_labeled_object_data.json":
"2f4148b2ddf34e62670e32c5e6da4937",
"src/libGLESv2/egl_stubs_autogen.h":
"1c9d160acb1ed9bf5e7c26918d4a039e",
"src/libGLESv2/entry_points_egl_autogen.cpp":
"9fd1b2d1e0dbab804e854e33e5bc9ef2",
"src/libGLESv2/entry_points_egl_autogen.h":
"3bc7a8df9deadd7cfd615d0cfad0c6a8",
"src/libGLESv2/entry_points_egl_ext_autogen.cpp":
"f52756d7a31ce136ea04a67e0ea1b447",
"src/libGLESv2/entry_points_egl_ext_autogen.h":
"9154781afd9bd6354ec6fc201b43c790",
"src/libGLESv2/entry_points_gles_1_0_autogen.cpp":
......
......@@ -31,11 +31,9 @@
"attrib_list": "const AttributeMap &"
},
"eglCreatePlatformPixmapSurface": {
"native_pixmap": "EGLNativePixmapType",
"attrib_list": "const AttributeMap &"
},
"eglCreatePlatformWindowSurface": {
"native_window": "EGLNativeWindowType",
"attrib_list": "const AttributeMap &"
},
"eglCreateStream": {
......
......@@ -15,6 +15,11 @@ import registry_xml
# API types
GL, GLES, WGL, EGL = ["GL", "GLES", "WGL", "EGL"]
# Paths
EGL_GET_LABELED_OBJECT_DATA_PATH = "../src/libGLESv2/egl_get_labeled_object_data.json"
EGL_STUBS_HEADER_PATH = "../src/libGLESv2/egl_stubs_autogen.h"
EGL_EXT_STUBS_HEADER_PATH = "../src/libGLESv2/egl_ext_stubs_autogen.h"
# List of GLES1 extensions for which we don't need to add Context.h decls.
GLES1_NO_CONTEXT_DECL_EXTENSIONS = [
"GL_OES_framebuffer_object",
......@@ -159,7 +164,7 @@ extern "C" {{
TEMPLATE_ENTRY_POINT_DECL = """ANGLE_EXPORT {return_type}{api}APIENTRY {name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params});"""
TEMPLATE_ENTRY_POINT_NO_RETURN = """\
TEMPLATE_GLES_ENTRY_POINT_NO_RETURN = """\
void GL_APIENTRY {name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params})
{{
Context *context = {context_getter};
......@@ -182,7 +187,7 @@ void GL_APIENTRY {name}{explicit_context_suffix}({explicit_context_param}{explic
}}
"""
TEMPLATE_ENTRY_POINT_WITH_RETURN = """\
TEMPLATE_GLES_ENTRY_POINT_WITH_RETURN = """\
{return_type}GL_APIENTRY {name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params})
{{
Context *context = {context_getter};
......@@ -212,6 +217,78 @@ TEMPLATE_ENTRY_POINT_WITH_RETURN = """\
}}
"""
TEMPLATE_EGL_ENTRY_POINT_NO_RETURN = """\
void EGLAPIENTRY EGL_{name}({params})
{{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT({name}, "{format_params}"{comma_if_needed}{pass_params});
Thread *thread = egl::GetCurrentThread();
{packed_gl_enum_conversions}
ANGLE_EGL_VALIDATE_VOID(thread, {name}, {labeled_object}, {internal_params});
{name}(thread{comma_if_needed}{internal_params});
}}
"""
TEMPLATE_EGL_ENTRY_POINT_WITH_RETURN = """\
{return_type}EGLAPIENTRY EGL_{name}({params})
{{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT({name}, "{format_params}"{comma_if_needed}{pass_params});
Thread *thread = egl::GetCurrentThread();
{packed_gl_enum_conversions}
ANGLE_EGL_VALIDATE(thread, {name}, {labeled_object}, {return_type}{comma_if_needed}{internal_params});
return {name}(thread{comma_if_needed}{internal_params});
}}
"""
TEMPLATE_EGL_STUBS_HEADER = """\
// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {data_source_name}.
//
// Copyright 2020 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.
//
// {annotation_lower}_stubs_autogen.h: Stubs for {title} entry points.
#ifndef LIBGLESV2_{annotation_upper}_STUBS_AUTOGEN_H_
#define LIBGLESV2_{annotation_upper}_STUBS_AUTOGEN_H_
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "common/PackedEGLEnums_autogen.h"
namespace gl
{{
class Context;
}} // namespace gl
namespace egl
{{
class AttributeMap;
class Device;
class Display;
class Image;
class Stream;
class Surface;
class Sync;
class Thread;
struct Config;
{stubs}
}} // namespace egl
#endif // LIBGLESV2_{annotation_upper}_STUBS_AUTOGEN_H_
"""
CONTEXT_HEADER = """\
// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {data_source_name}.
......@@ -461,80 +538,70 @@ void FrameCapture::ReplayCall(gl::Context *context,
TEMPLATE_CAPTURE_REPLAY_CALL_CASE = """case angle::EntryPoint::GL{entry_point}:
context->{context_call}({param_value_access});break;"""
STATIC_CAST_TO_DICT = {
"GLintptr": "unsigned long long",
"GLsizeiptr": "unsigned long long",
"GLuint64": "unsigned long long",
}
REINTERPRET_CAST_TO_DICT = {
"GLsync": "uintptr_t",
"GLDEBUGPROC": "uintptr_t",
"GLDEBUGPROCKHR": "uintptr_t",
"GLeglClientBufferEXT": "uintptr_t",
"GLeglImageOES": "uintptr_t",
}
POINTER_FORMAT = "0x%016\" PRIxPTR \""
UNSIGNED_LONG_LONG_FORMAT = "%llu"
HEX_LONG_LONG_FORMAT = "0x%llX"
FORMAT_DICT = {
"GLbitfield": "%s",
"GLboolean": "%s",
"GLbyte": "%d",
"GLclampx": "0x%X",
"GLDEBUGPROC": "0x%016\" PRIxPTR \"",
"GLDEBUGPROCKHR": "0x%016\" PRIxPTR \"",
"GLDEBUGPROC": POINTER_FORMAT,
"GLDEBUGPROCKHR": POINTER_FORMAT,
"GLdouble": "%f",
"GLeglClientBufferEXT": "0x%016\" PRIxPTR \"",
"GLeglImageOES": "0x%016\" PRIxPTR \"",
"GLeglClientBufferEXT": POINTER_FORMAT,
"GLeglImageOES": POINTER_FORMAT,
"GLenum": "%s",
"GLfixed": "0x%X",
"GLfloat": "%f",
"GLint": "%d",
"GLintptr": "%llu",
"GLintptr": UNSIGNED_LONG_LONG_FORMAT,
"GLshort": "%d",
"GLsizei": "%d",
"GLsizeiptr": "%llu",
"GLsync": "0x%016\" PRIxPTR \"",
"GLsizeiptr": UNSIGNED_LONG_LONG_FORMAT,
"GLsync": POINTER_FORMAT,
"GLubyte": "%d",
"GLuint": "%u",
"GLuint64": "%llu",
"GLuint64": UNSIGNED_LONG_LONG_FORMAT,
"GLushort": "%u",
"int": "%d",
# EGL-specific types
"EGLConfig": "0x%016\" PRIxPTR \"",
"EGLContext": "0x%016\" PRIxPTR \"",
"EGLDisplay": "0x%016\" PRIxPTR \"",
"EGLSurface": "0x%016\" PRIxPTR \"",
"EGLSync": "0x%016\" PRIxPTR \"",
"EGLNativeDisplayType": "0x%016\" PRIxPTR \"",
"EGLNativePixmapType": "0x%016\" PRIxPTR \"",
"EGLNativeWindowType": "0x%016\" PRIxPTR \"",
"EGLClientBuffer": "0x%016\" PRIxPTR \"",
"EGLConfig": POINTER_FORMAT,
"EGLContext": POINTER_FORMAT,
"EGLDisplay": POINTER_FORMAT,
"EGLSurface": POINTER_FORMAT,
"EGLSync": POINTER_FORMAT,
"EGLNativeDisplayType": POINTER_FORMAT,
"EGLNativePixmapType": POINTER_FORMAT,
"EGLNativeWindowType": POINTER_FORMAT,
"EGLClientBuffer": POINTER_FORMAT,
"EGLenum": "0x%X",
"EGLint": "%d",
"EGLImage": "0x%016\" PRIxPTR \"",
"EGLTime": "%llu",
"EGLGetBlobFuncANDROID": "0x%016\" PRIxPTR \"",
"EGLSetBlobFuncANDROID": "0x%016\" PRIxPTR \"",
"EGLuint64KHR": "%llu",
"EGLSyncKHR": "0x%016\" PRIxPTR \"",
"EGLnsecsANDROID": "%llu",
"EGLDeviceEXT": "0x%016\" PRIxPTR \"",
"EGLDEBUGPROCKHR": "0x%016\" PRIxPTR \"",
"EGLObjectKHR": "0x%016\" PRIxPTR \"",
"EGLLabelKHR": "0x%016\" PRIxPTR \"",
"EGLTimeKHR": "%llu",
"EGLImageKHR": "0x%016\" PRIxPTR \"",
"EGLStreamKHR": "0x%016\" PRIxPTR \"",
"EGLFrameTokenANGLE": "0x%llX",
"EGLImage": POINTER_FORMAT,
"EGLTime": UNSIGNED_LONG_LONG_FORMAT,
"EGLGetBlobFuncANDROID": POINTER_FORMAT,
"EGLSetBlobFuncANDROID": POINTER_FORMAT,
"EGLuint64KHR": UNSIGNED_LONG_LONG_FORMAT,
"EGLSyncKHR": POINTER_FORMAT,
"EGLnsecsANDROID": UNSIGNED_LONG_LONG_FORMAT,
"EGLDeviceEXT": POINTER_FORMAT,
"EGLDEBUGPROCKHR": POINTER_FORMAT,
"EGLObjectKHR": POINTER_FORMAT,
"EGLLabelKHR": POINTER_FORMAT,
"EGLTimeKHR": UNSIGNED_LONG_LONG_FORMAT,
"EGLImageKHR": POINTER_FORMAT,
"EGLStreamKHR": POINTER_FORMAT,
"EGLFrameTokenANGLE": HEX_LONG_LONG_FORMAT,
# WGL-specific types
"BOOL": "%u",
"DWORD": "0x%016\" PRIxPTR \"",
"DWORD": POINTER_FORMAT,
"FLOAT": "%f",
"HDC": "0x%016\" PRIxPTR \"",
"HENHMETAFILE": "0x%016\" PRIxPTR \"",
"HGLRC": "0x%016\" PRIxPTR \"",
"LPCSTR": "0x%016\" PRIxPTR \"",
"LPGLYPHMETRICSFLOAT": "0x%016\" PRIxPTR \"",
"HDC": POINTER_FORMAT,
"HENHMETAFILE": POINTER_FORMAT,
"HGLRC": POINTER_FORMAT,
"LPCSTR": POINTER_FORMAT,
"LPGLYPHMETRICSFLOAT": POINTER_FORMAT,
"UINT": "%u",
}
......@@ -606,12 +673,34 @@ EGL_HEADER_INCLUDES = """\
#include <export.h>
"""
EGL_SOURCE_INCLUDES = """\
#include "libGLESv2/entry_points_egl_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/validationEGL_autogen.h"
#include "libGLESv2/egl_stubs_autogen.h"
#include "libGLESv2/global_state.h"
using namespace egl;
"""
EGL_EXT_HEADER_INCLUDES = """\
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <export.h>
"""
EGL_EXT_SOURCE_INCLUDES = """\
#include "libGLESv2/entry_points_egl_ext_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/validationEGL_autogen.h"
#include "libGLESv2/egl_ext_stubs_autogen.h"
#include "libGLESv2/global_state.h"
using namespace egl;
"""
LIBGLESV2_EXPORT_INCLUDES = """
#include "angle_gl.h"
......@@ -993,21 +1082,22 @@ def just_the_name_packed(param, reserved_set):
return name
def is_unsigned_long_format(fmt):
return fmt == UNSIGNED_LONG_LONG_FORMAT or fmt == HEX_LONG_LONG_FORMAT
def param_print_argument(command_node, param):
name_only = just_the_name(param)
type_only = just_the_type(param)
if "*" in param:
return "(uintptr_t)" + name_only
if type_only in REINTERPRET_CAST_TO_DICT:
return "(" + REINTERPRET_CAST_TO_DICT[type_only] + ")" + name_only
if "*" in param or FORMAT_DICT[type_only] == POINTER_FORMAT:
return "(uintptr_t)%s" % name_only
if type_only in STATIC_CAST_TO_DICT:
return "static_cast<" + STATIC_CAST_TO_DICT[type_only] + ">(" + name_only + ")"
if is_unsigned_long_format(FORMAT_DICT[type_only]):
return "static_cast<unsigned long long>(%s)" % name_only
if type_only == "GLboolean":
return "GLbooleanToString(%s)" % (name_only,)
return "GLbooleanToString(%s)" % name_only
if type_only == "GLbitfield":
group_name = find_gl_enum_group_in_command(command_node, name_only)
......@@ -1119,17 +1209,29 @@ def get_packed_enums(api, cmd_packed_gl_enums, cmd_name, packed_param_types, par
return result
def get_def_template(api, return_type):
if return_type.strip() == "void":
if api == EGL:
return TEMPLATE_EGL_ENTRY_POINT_NO_RETURN
else:
return TEMPLATE_GLES_ENTRY_POINT_NO_RETURN
else:
if api == EGL:
return TEMPLATE_EGL_ENTRY_POINT_WITH_RETURN
else:
return TEMPLATE_GLES_ENTRY_POINT_WITH_RETURN
def format_entry_point_def(api, command_node, cmd_name, proto, params, is_explicit_context,
cmd_packed_gl_enums, packed_param_types):
packed_gl_enums = get_packed_enums(api, cmd_packed_gl_enums, cmd_name, packed_param_types,
params)
internal_params = [just_the_name_packed(param, packed_gl_enums) for param in params]
cmd_packed_enums, packed_param_types, egl_ep_to_object):
packed_enums = get_packed_enums(api, cmd_packed_enums, cmd_name, packed_param_types, params)
internal_params = [just_the_name_packed(param, packed_enums) for param in params]
packed_gl_enum_conversions = []
for param in params:
name = just_the_name(param)
if name in packed_gl_enums:
if name in packed_enums:
internal_name = name + "Packed"
internal_type = packed_gl_enums[name]
internal_type = packed_enums[name]
packed_gl_enum_conversions += [
"\n " + internal_type + " " + internal_name + " = PackParam<" +
internal_type + ">(" + name + ");"
......@@ -1178,13 +1280,13 @@ def format_entry_point_def(api, command_node, cmd_name, proto, params, is_explic
"explicit_context_comma":
", " if is_explicit_context and len(params) > 0 else "",
"assert_explicit_context":
"\nASSERT(context == GetValidGlobalContext());" if is_explicit_context else ""
"\nASSERT(context == GetValidGlobalContext());" if is_explicit_context else "",
"labeled_object":
get_egl_entry_point_labeled_object(egl_ep_to_object, cmd_name, params, packed_enums)
}
if return_type.strip() == "void":
return TEMPLATE_ENTRY_POINT_NO_RETURN.format(**format_params)
else:
return TEMPLATE_ENTRY_POINT_WITH_RETURN.format(**format_params)
template = get_def_template(api, return_type)
return template.format(**format_params)
def get_capture_param_type_name(param_type):
......@@ -1356,13 +1458,8 @@ def path_to(folder, file):
return os.path.join(script_relative(".."), "src", folder, file)
def get_entry_points(api,
all_commands,
commands,
is_explicit_context,
all_param_types,
cmd_packed_gl_enums,
packed_param_types=[]):
def get_entry_points(api, all_commands, commands, is_explicit_context, all_param_types,
cmd_packed_gl_enums, packed_param_types, egl_ep_to_object):
decls = []
defs = []
export_defs = []
......@@ -1387,7 +1484,8 @@ def get_entry_points(api,
format_entry_point_decl(api, cmd_name, proto_text, param_text, is_explicit_context))
defs.append(
format_entry_point_def(api, command, cmd_name, proto_text, param_text,
is_explicit_context, cmd_packed_gl_enums, packed_param_types))
is_explicit_context, cmd_packed_gl_enums, packed_param_types,
egl_ep_to_object))
export_template = TEMPLATE_EGL_ENTRY_POINT_EXPORT if api == "EGL" else TEMPLATE_GL_ENTRY_POINT_EXPORT
export_defs.append(
......@@ -1955,13 +2053,113 @@ def get_egl_exports():
return exports
def get_egl_object_category_map():
with open(EGL_GET_LABELED_OBJECT_DATA_PATH) as f:
try:
spec_json = json.loads(f.read())
except ValueError:
raise Exception("Could not decode JSON from %s" % EGL_GET_LABELED_OBJECT_DATA_PATH)
# Construct a mapping from EP to type. Fill in the gaps with Display/None.
ep_to_object = {}
for category, eps in spec_json.iteritems():
if category == 'description':
continue
for ep in eps:
ep_to_object[ep] = category
return ep_to_object
# Construct a mapping from an EGL EP to object function
def get_egl_entry_point_labeled_object(ep_to_object, cmd_stripped, params, packed_enums):
if not ep_to_object:
return ""
# Finds a packed parameter name in a list of params
def find_param(params, type_name, packed_enums):
for param in params:
if just_the_type_packed(param, packed_enums).split(' ')[0] == type_name:
return just_the_name_packed(param, packed_enums)
return None
display_param = find_param(params, "Display", packed_enums)
# For entry points not listed in the JSON file, they default to an EGLDisplay or nothing.
if cmd_stripped not in ep_to_object:
if display_param:
return "GetDisplayIfValid(%s)" % display_param
return "nullptr"
# We first handle a few special cases for certain type categories.
category = ep_to_object[cmd_stripped]
if category == "Thread":
return "GetThreadIfValid(thread)"
found_param = find_param(params, category, packed_enums)
if category == "Context" and not found_param:
return "GetContextIfValid(thread->getDisplay(), thread->getContext())"
assert found_param, "Did not find %s for %s: %s" % (category, cmd_stripped, str(params))
if category == "Device":
return "GetDeviceIfValid(%s)" % found_param
if category == "LabeledObject":
object_type_param = find_param(params, "ObjectType", packed_enums)
return "GetLabeledObjectIfValid(thread, %s, %s, %s)" % (display_param, object_type_param,
found_param)
# We then handle the general case which handles the rest of the type categories.
return "Get%sIfValid(%s, %s)" % (category, display_param, found_param)
def write_egl_stubs_header(annotation, title, data_source, out_file, all_commands, commands,
cmd_packed_egl_enums):
stubs = []
for command in all_commands:
proto = command.find('proto')
cmd_name = proto.find('name').text
if cmd_name not in commands:
continue
proto_text = "".join(proto.itertext())
params = ["".join(param.itertext()) for param in command.findall('param')]
return_type = proto_text[:-len(cmd_name)]
internal_params = get_internal_params(EGL, cmd_name, ["Thread *thread"] + params,
cmd_packed_egl_enums, EGL_PACKED_TYPES)
stubs.append("%s %s(%s);" % (return_type, strip_api_prefix(cmd_name), internal_params))
args = {
"annotation_lower": annotation.lower(),
"annotation_upper": annotation.upper(),
"data_source_name": data_source,
"return_type": proto[:-len(cmd_name)],
"script_name": os.path.basename(sys.argv[0]),
"stubs": "\n".join(stubs),
"title": title,
}
output = TEMPLATE_EGL_STUBS_HEADER.format(**args)
with open(out_file, "w") as f:
f.write(output)
def main():
# auto_script parameters.
if len(sys.argv) > 1:
inputs = ['entry_point_packed_egl_enums.json', 'entry_point_packed_gl_enums.json'
] + registry_xml.xml_inputs
inputs = [
'entry_point_packed_egl_enums.json', 'entry_point_packed_gl_enums.json',
EGL_GET_LABELED_OBJECT_DATA_PATH
] + registry_xml.xml_inputs
outputs = [
EGL_STUBS_HEADER_PATH,
EGL_EXT_STUBS_HEADER_PATH,
'../src/common/entry_points_enum_autogen.cpp',
'../src/common/entry_points_enum_autogen.h',
'../src/libANGLE/Context_gl_1_0_autogen.h',
......@@ -2032,7 +2230,9 @@ def main():
'../src/libANGLE/validationGL46_autogen.h',
'../src/libEGL/libEGL_autogen.cpp',
'../src/libEGL/libEGL_autogen.def',
'../src/libGLESv2/entry_points_egl_autogen.cpp',
'../src/libGLESv2/entry_points_egl_autogen.h',
'../src/libGLESv2/entry_points_egl_ext_autogen.cpp',
'../src/libGLESv2/entry_points_egl_ext_autogen.h',
'../src/libGLESv2/entry_points_gles_1_0_autogen.cpp',
'../src/libGLESv2/entry_points_gles_1_0_autogen.h',
......@@ -2144,7 +2344,8 @@ def main():
all_commands_with_suffix.extend(xml.commands[version])
decls, defs, libgles_defs, validation_protos, capture_protos, capture_methods, capture_pointer_funcs = get_entry_points(
GLES, all_commands, gles_commands, False, all_gles_param_types, cmd_packed_gl_enums)
GLES, all_commands, gles_commands, False, all_gles_param_types, cmd_packed_gl_enums,
[], {})
# Write the version as a comment before the first EP.
libgles_defs.insert(0, "\n// OpenGL ES %s" % comment)
......@@ -2209,7 +2410,7 @@ def main():
# Detect and filter duplicate extensions.
decls, defs, libgles_defs, validation_protos, capture_protos, capture_methods, capture_param_funcs = get_entry_points(
GLES, xml.all_commands, ext_cmd_names, False, all_gles_param_types,
cmd_packed_gl_enums)
cmd_packed_gl_enums, [], {})
# Avoid writing out entry points defined by a prior extension.
for dupe in xml.ext_dupes[extension_name]:
......@@ -2263,7 +2464,7 @@ def main():
# Get the explicit context entry points
decls, defs, libgles_defs, validation_protos, capture_protos, capture_methods, capture_param_funcs = get_entry_points(
GLES, xml.all_commands, cmds, True, all_gles_param_types, cmd_packed_gl_enums)
GLES, xml.all_commands, cmds, True, all_gles_param_types, cmd_packed_gl_enums, [], {})
# Append the explicit context entry points
extension_decls += decls
......@@ -2341,11 +2542,11 @@ def main():
_, _, _, validation_protos32, _, _, _ = get_entry_points(GL, all_commands32,
just_libgl_commands_suffix, False,
all_gles_param_types,
cmd_packed_gl_enums)
cmd_packed_gl_enums, [], {})
decls_gl, defs_gl, libgl_defs, _, _, _, _ = get_entry_points(GL, all_commands32,
all_libgl_commands, False,
all_gles_param_types,
cmd_packed_gl_enums)
cmd_packed_gl_enums, [], {})
# Write the version as a comment before the first EP.
libgl_defs.insert(0, "\n// GL %s" % comment)
......@@ -2388,6 +2589,8 @@ def main():
egl_defs = []
libegl_ep_defs = []
libegl_windows_def_exports = []
egl_ep_to_object = get_egl_object_category_map()
egl_commands = []
for major_version, minor_version in [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5]]:
version = "%d_%d" % (major_version, minor_version)
......@@ -2400,6 +2603,7 @@ def main():
eglxml.AddCommands(feature_name, version)
egl_version_commands = eglxml.commands[version]
egl_commands += egl_version_commands
# Spec revs may have no new commands.
if not egl_version_commands:
......@@ -2407,7 +2611,7 @@ def main():
decls, defs, export_defs, validation_protos, _, _, _ = get_entry_points(
EGL, eglxml.all_commands, egl_version_commands, False, egl_param_types,
cmd_packed_egl_enums, EGL_PACKED_TYPES)
cmd_packed_egl_enums, EGL_PACKED_TYPES, egl_ep_to_object)
comment = "\n// EGL %d.%d" % (major_version, minor_version)
win_def_comment = "\n ; EGL %d.%d" % (major_version, minor_version)
......@@ -2420,10 +2624,15 @@ def main():
write_file("egl", "EGL", TEMPLATE_ENTRY_POINT_HEADER, "\n".join(egl_decls), "h",
EGL_HEADER_INCLUDES, "libGLESv2", "egl.xml", "extern \"C\"")
write_file("egl", "EGL", TEMPLATE_ENTRY_POINT_SOURCE, "\n".join(egl_defs), "cpp",
EGL_SOURCE_INCLUDES, "libGLESv2", "egl.xml", "extern \"C\"")
write_egl_stubs_header("egl", "EGL", "egl.xml", EGL_STUBS_HEADER_PATH, eglxml.all_commands,
egl_commands, cmd_packed_egl_enums)
eglxml.AddExtensionCommands(registry_xml.supported_egl_extensions, ['egl'])
egl_ext_decls = []
egl_ext_defs = []
egl_ext_commands = []
for extension_name, ext_cmd_names in sorted(eglxml.ext_data.iteritems()):
......@@ -2434,7 +2643,7 @@ def main():
# Detect and filter duplicate extensions.
decls, defs, export_defs, validation_protos, _, _, _ = get_entry_points(
EGL, eglxml.all_commands, ext_cmd_names, False, egl_param_types, cmd_packed_egl_enums,
EGL_PACKED_TYPES)
EGL_PACKED_TYPES, egl_ep_to_object)
# Avoid writing out entry points defined by a prior extension.
for dupe in eglxml.ext_dupes[extension_name]:
......@@ -2444,6 +2653,8 @@ def main():
comment = "\n// %s" % extension_name
win_def_comment = "\n ; %s" % (extension_name)
egl_ext_commands += ext_cmd_names
egl_validation_protos += [comment] + validation_protos
egl_ext_decls += [comment] + decls
egl_ext_defs += [comment] + defs
......@@ -2453,8 +2664,14 @@ def main():
write_file("egl_ext", "EGL Extension", TEMPLATE_ENTRY_POINT_HEADER, "\n".join(egl_ext_decls),
"h", EGL_EXT_HEADER_INCLUDES, "libGLESv2", "egl.xml and egl_angle_ext.xml",
"extern \"C\"")
write_file("egl_ext", "EGL Extension", TEMPLATE_ENTRY_POINT_SOURCE, "\n".join(egl_ext_defs),
"cpp", EGL_EXT_SOURCE_INCLUDES, "libGLESv2", "egl.xml and egl_angle_ext.xml",
"extern \"C\"")
write_validation_header("EGL", "EGL", egl_validation_protos, "egl.xml and egl_angle_ext.xml",
TEMPLATE_EGL_VALIDATION_HEADER)
write_egl_stubs_header("egl_ext", "EXT extension", "egl.xml and egl_angle_ext.xml",
EGL_EXT_STUBS_HEADER_PATH, eglxml.all_commands, egl_ext_commands,
cmd_packed_egl_enums)
# WGL
wglxml = registry_xml.RegistryXML('wgl.xml')
......@@ -2471,7 +2688,7 @@ def main():
wgl_param_types = set()
decls_wgl, defs_wgl, wgl_defs, validation_protos_wgl, _, _, _ = get_entry_points(
WGL, all_commands32, wgl_commands, False, wgl_param_types, {})
WGL, all_commands32, wgl_commands, False, wgl_param_types, {}, [], {})
# Write the version as a comment before the first EP.
libgl_ep_exports.append("\n ; WGL %s" % comment)
......
......@@ -4516,7 +4516,7 @@ bool ValidateGetPlatformDisplayEXT(const ValidationContext *val,
bool ValidateCreatePlatformWindowSurfaceEXT(const ValidationContext *val,
const Display *display,
const Config *configuration,
EGLNativeWindowType nativeWindow,
const void *nativeWindow,
const AttributeMap &attributes)
{
if (!Display::GetClientExtensions().platformBase)
......@@ -4534,7 +4534,7 @@ bool ValidateCreatePlatformWindowSurfaceEXT(const ValidationContext *val,
bool ValidateCreatePlatformPixmapSurfaceEXT(const ValidationContext *val,
const Display *display,
const Config *configuration,
EGLNativePixmapType nativePixmap,
const void *nativePixmap,
const AttributeMap &attributes)
{
if (!Display::GetClientExtensions().platformBase)
......@@ -5296,6 +5296,12 @@ bool ValidateGetNativeClientBufferANDROID(const ValidationContext *val,
bool ValidateCreateNativeClientBufferANDROID(const ValidationContext *val,
const egl::AttributeMap &attribMap)
{
if (attribMap.isEmpty() || attribMap.begin()->second == EGL_NONE)
{
val->setError(EGL_BAD_PARAMETER, "invalid attribute list.");
return false;
}
int width = attribMap.getAsInt(EGL_WIDTH, 0);
int height = attribMap.getAsInt(EGL_HEIGHT, 0);
int redSize = attribMap.getAsInt(EGL_RED_SIZE, 0);
......@@ -5646,20 +5652,24 @@ bool ValidateGetCurrentContext(const ValidationContext *val)
bool ValidateCreatePlatformPixmapSurface(const ValidationContext *val,
const Display *dpyPacked,
const Config *configPacked,
EGLNativePixmapType native_pixmap,
const void *native_pixmap,
const AttributeMap &attrib_listPacked)
{
return ValidateCreatePixmapSurface(val, dpyPacked, configPacked, native_pixmap,
EGLNativePixmapType nativePixmap =
reinterpret_cast<EGLNativePixmapType>(const_cast<void *>(native_pixmap));
return ValidateCreatePixmapSurface(val, dpyPacked, configPacked, nativePixmap,
attrib_listPacked);
}
bool ValidateCreatePlatformWindowSurface(const ValidationContext *val,
const Display *dpyPacked,
const Config *configPacked,
EGLNativeWindowType native_window,
const void *native_window,
const AttributeMap &attrib_listPacked)
{
return ValidateCreateWindowSurface(val, dpyPacked, configPacked, native_window,
EGLNativeWindowType nativeWindow =
reinterpret_cast<EGLNativeWindowType>(const_cast<void *>(native_window));
return ValidateCreateWindowSurface(val, dpyPacked, configPacked, nativeWindow,
attrib_listPacked);
}
......
......@@ -11,7 +11,7 @@
#include "common/PackedEnums.h"
#include "libANGLE/Error.h"
#include "libANGLE/Texture.h"
#include "libANGLE/Thread.h"
#include <EGL/egl.h>
#include <EGL/eglext.h>
......@@ -76,18 +76,78 @@ LabeledObject *GetLabeledObjectIfValid(Thread *thread,
ObjectType objectType,
EGLObjectKHR object);
// A template struct for determining the default value to return for each entry point.
template <angle::EntryPoint EP, typename ReturnType>
struct DefaultReturnValue
{
static constexpr ReturnType kValue = static_cast<ReturnType>(0);
};
template <angle::EntryPoint EP, typename ReturnType>
ReturnType GetDefaultReturnValue(Thread *thread);
template <>
ANGLE_INLINE EGLint
GetDefaultReturnValue<angle::EntryPoint::EGLLabelObjectKHR, EGLint>(Thread *thread)
{
return thread->getError();
}
template <angle::EntryPoint EP, typename ReturnType>
ANGLE_INLINE ReturnType GetDefaultReturnValue(Thread *thread)
{
return DefaultReturnValue<EP, ReturnType>::kValue;
}
// First case: handling packed enums.
template <typename PackedT, typename FromT>
typename std::enable_if<std::is_enum<PackedT>::value, PackedT>::type PackParam(FromT from)
{
return FromEGLenum<PackedT>(from);
}
// Second case: handling other types.
template <typename PackedT, typename FromT>
typename std::enable_if<!std::is_enum<PackedT>::value,
typename std::remove_reference<PackedT>::type>::type
PackParam(FromT from);
template <>
inline const AttributeMap PackParam<const AttributeMap &, const EGLint *>(const EGLint *attribs)
{
return AttributeMap::CreateFromIntArray(attribs);
}
// In a 32-bit environment the EGLAttrib and EGLint types are the same. We need to mask out one of
// the two specializations to avoid having an override ambiguity.
#if defined(ANGLE_IS_64_BIT_CPU)
template <>
inline const AttributeMap PackParam<const AttributeMap &, const EGLAttrib *>(
const EGLAttrib *attribs)
{
return AttributeMap::CreateFromAttribArray(attribs);
}
#endif // defined(ANGLE_IS_64_BIT_CPU)
template <typename PackedT, typename FromT>
inline typename std::enable_if<!std::is_enum<PackedT>::value,
typename std::remove_reference<PackedT>::type>::type
PackParam(FromT from)
{
return static_cast<PackedT>(from);
}
} // namespace egl
#define ANGLE_EGL_VALIDATE(THREAD, EP, OBJ, RETVAL, ...) \
do \
{ \
const char *epname = "egl" #EP; \
ValidationContext vctx(THREAD, epname, OBJ); \
auto ANGLE_LOCAL_VAR = (Validate##EP(&vctx, ##__VA_ARGS__)); \
if (!ANGLE_LOCAL_VAR) \
{ \
return RETVAL; \
} \
#define ANGLE_EGL_VALIDATE(THREAD, EP, OBJ, RETURN_TYPE, ...) \
do \
{ \
const char *epname = "egl" #EP; \
ValidationContext vctx(THREAD, epname, OBJ); \
auto ANGLE_LOCAL_VAR = (Validate##EP(&vctx, ##__VA_ARGS__)); \
if (!ANGLE_LOCAL_VAR) \
{ \
return GetDefaultReturnValue<angle::EntryPoint::EGL##EP, RETURN_TYPE>(THREAD); \
} \
} while (0)
#define ANGLE_EGL_VALIDATE_VOID(THREAD, EP, OBJ, ...) \
......
......@@ -140,12 +140,12 @@ bool ValidateCreateImage(const ValidationContext *val,
bool ValidateCreatePlatformPixmapSurface(const ValidationContext *val,
const Display *dpyPacked,
const Config *configPacked,
EGLNativePixmapType native_pixmapPacked,
const void *native_pixmap,
const AttributeMap &attrib_listPacked);
bool ValidateCreatePlatformWindowSurface(const ValidationContext *val,
const Display *dpyPacked,
const Config *configPacked,
EGLNativeWindowType native_windowPacked,
const void *native_window,
const AttributeMap &attrib_listPacked);
bool ValidateCreateSync(const ValidationContext *val,
const Display *dpyPacked,
......@@ -327,12 +327,12 @@ bool ValidateQueryDisplayAttribEXT(const ValidationContext *val,
bool ValidateCreatePlatformPixmapSurfaceEXT(const ValidationContext *val,
const Display *dpyPacked,
const Config *configPacked,
EGLNativePixmapType native_pixmapPacked,
const void *native_pixmap,
const AttributeMap &attrib_listPacked);
bool ValidateCreatePlatformWindowSurfaceEXT(const ValidationContext *val,
const Display *dpyPacked,
const Config *configPacked,
EGLNativeWindowType native_windowPacked,
const void *native_window,
const AttributeMap &attrib_listPacked);
bool ValidateGetPlatformDisplayEXT(const ValidationContext *val,
EGLenum platform,
......
......@@ -558,9 +558,13 @@ if (is_win) {
}
libglesv2_sources = [
"src/libGLESv2/entry_points_egl.cpp",
"src/libGLESv2/egl_ext_stubs.cpp",
"src/libGLESv2/egl_ext_stubs_autogen.h",
"src/libGLESv2/egl_stubs.cpp",
"src/libGLESv2/egl_stubs_autogen.h",
"src/libGLESv2/entry_points_egl_autogen.cpp",
"src/libGLESv2/entry_points_egl_autogen.h",
"src/libGLESv2/entry_points_egl_ext.cpp",
"src/libGLESv2/entry_points_egl_ext_autogen.cpp",
"src/libGLESv2/entry_points_egl_ext_autogen.h",
"src/libGLESv2/entry_points_gles_1_0_autogen.cpp",
"src/libGLESv2/entry_points_gles_1_0_autogen.h",
......
//
// Copyright 2020 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.
//
// egl_ext_stubs.cpp: Stubs for EXT extension entry points.
//
#include "libGLESv2/egl_ext_stubs_autogen.h"
#include "libANGLE/Device.h"
#include "libANGLE/Display.h"
#include "libANGLE/EGLSync.h"
#include "libANGLE/Surface.h"
#include "libANGLE/Thread.h"
#include "libANGLE/queryutils.h"
#include "libANGLE/validationEGL.h"
#include "libGLESv2/global_state.h"
namespace egl
{
EGLint ClientWaitSyncKHR(Thread *thread,
Display *display,
Sync *syncObject,
EGLint flags,
EGLTimeKHR timeout)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglClientWaitSync",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
EGLint syncStatus = EGL_FALSE;
ANGLE_EGL_TRY_RETURN(
thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
"eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return syncStatus;
}
EGLImageKHR CreateImageKHR(Thread *thread,
Display *display,
gl::Context *context,
EGLenum target,
EGLClientBuffer buffer,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateImageKHR",
GetDisplayIfValid(display), EGL_NO_IMAGE);
Image *image = nullptr;
ANGLE_EGL_TRY_RETURN(thread, display->createImage(context, target, buffer, attributes, &image),
"", GetDisplayIfValid(display), EGL_NO_IMAGE);
thread->setSuccess();
return static_cast<EGLImage>(image);
}
EGLClientBuffer CreateNativeClientBufferANDROID(Thread *thread, const AttributeMap &attribMap)
{
EGLClientBuffer eglClientBuffer = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
egl::Display::CreateNativeClientBuffer(attribMap, &eglClientBuffer),
"eglCreateNativeClientBufferANDROID", nullptr, nullptr);
thread->setSuccess();
return eglClientBuffer;
}
EGLSurface CreatePlatformPixmapSurfaceEXT(Thread *thread,
Display *display,
Config *configPacked,
void *native_pixmap,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePlatformPixmapSurfaceEXT",
GetDisplayIfValid(display), EGL_NO_SURFACE);
thread->setError(EGL_BAD_DISPLAY, "eglCreatePlatformPixmapSurfaceEXT",
GetDisplayIfValid(display), "CreatePlatformPixmapSurfaceEXT unimplemented.");
return EGL_NO_SURFACE;
}
EGLSurface CreatePlatformWindowSurfaceEXT(Thread *thread,
Display *display,
Config *configPacked,
void *native_window,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePlatformWindowSurfaceEXT",
GetDisplayIfValid(display), EGL_NO_SURFACE);
thread->setError(EGL_BAD_DISPLAY, "eglCreatePlatformWindowSurfaceEXT",
GetDisplayIfValid(display), "CreatePlatformWindowSurfaceEXT unimplemented.");
return EGL_NO_SURFACE;
}
EGLStreamKHR CreateStreamKHR(Thread *thread, Display *display, const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateStreamKHR",
GetDisplayIfValid(display), EGL_NO_STREAM_KHR);
Stream *stream;
ANGLE_EGL_TRY_RETURN(thread, display->createStream(attributes, &stream), "eglCreateStreamKHR",
GetDisplayIfValid(display), EGL_NO_STREAM_KHR);
thread->setSuccess();
return static_cast<EGLStreamKHR>(stream);
}
EGLSyncKHR CreateSyncKHR(Thread *thread,
Display *display,
EGLenum type,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateSyncKHR",
GetDisplayIfValid(display), EGL_NO_SYNC);
egl::Sync *syncObject = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createSync(thread->getContext(), type, attributes, &syncObject),
"eglCreateSyncKHR", GetDisplayIfValid(display), EGL_NO_SYNC);
thread->setSuccess();
return static_cast<EGLSync>(syncObject);
}
EGLint DebugMessageControlKHR(Thread *thread,
EGLDEBUGPROCKHR callback,
const AttributeMap &attributes)
{
Debug *debug = GetDebug();
debug->setCallback(callback, attributes);
thread->setSuccess();
return EGL_SUCCESS;
}
EGLBoolean DestroyImageKHR(Thread *thread, Display *display, Image *img)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroyImageKHR",
GetDisplayIfValid(display), EGL_FALSE);
display->destroyImage(img);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean DestroyStreamKHR(Thread *thread, Display *display, Stream *streamObject)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroyStreamKHR",
GetDisplayIfValid(display), EGL_FALSE);
display->destroyStream(streamObject);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean DestroySyncKHR(Thread *thread, Display *display, Sync *syncObject)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroySync",
GetDisplayIfValid(display), EGL_FALSE);
display->destroySync(syncObject);
thread->setSuccess();
return EGL_TRUE;
}
EGLint DupNativeFenceFDANDROID(Thread *thread, Display *display, Sync *syncObject)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDupNativeFenceFDANDROID",
GetDisplayIfValid(display), EGL_NO_NATIVE_FENCE_FD_ANDROID);
EGLint result = EGL_NO_NATIVE_FENCE_FD_ANDROID;
ANGLE_EGL_TRY_RETURN(thread, syncObject->dupNativeFenceFD(display, &result),
"eglDupNativeFenceFDANDROID", GetSyncIfValid(display, syncObject),
EGL_NO_NATIVE_FENCE_FD_ANDROID);
thread->setSuccess();
return result;
}
EGLClientBuffer GetNativeClientBufferANDROID(Thread *thread, const struct AHardwareBuffer *buffer)
{
thread->setSuccess();
return egl::Display::GetNativeClientBuffer(buffer);
}
EGLDisplay GetPlatformDisplayEXT(Thread *thread,
EGLenum platform,
void *native_display,
const AttributeMap &attribMap)
{
if (platform == EGL_PLATFORM_ANGLE_ANGLE)
{
return egl::Display::GetDisplayFromNativeDisplay(
gl::bitCast<EGLNativeDisplayType>(native_display), attribMap);
}
else if (platform == EGL_PLATFORM_DEVICE_EXT)
{
Device *eglDevice = static_cast<Device *>(native_display);
return egl::Display::GetDisplayFromDevice(eglDevice, attribMap);
}
else
{
UNREACHABLE();
return EGL_NO_DISPLAY;
}
}
EGLBoolean GetSyncAttribKHR(Thread *thread,
Display *display,
Sync *syncObject,
EGLint attribute,
EGLint *value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetSyncAttrib",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, GetSyncAttrib(display, syncObject, attribute, value),
"eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLint LabelObjectKHR(Thread *thread,
Display *display,
ObjectType objectTypePacked,
EGLObjectKHR object,
EGLLabelKHR label)
{
LabeledObject *labeledObject =
GetLabeledObjectIfValid(thread, display, objectTypePacked, object);
ASSERT(labeledObject != nullptr);
labeledObject->setLabel(label);
thread->setSuccess();
return EGL_SUCCESS;
}
EGLBoolean PostSubBufferNV(Thread *thread,
Display *display,
Surface *eglSurface,
EGLint x,
EGLint y,
EGLint width,
EGLint height)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglPostSubBufferNV",
GetDisplayIfValid(display), EGL_FALSE);
Error error = eglSurface->postSubBuffer(thread->getContext(), x, y, width, height);
if (error.isError())
{
thread->setError(error, "eglPostSubBufferNV", GetSurfaceIfValid(display, eglSurface));
return EGL_FALSE;
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean PresentationTimeANDROID(Thread *thread,
Display *display,
Surface *eglSurface,
EGLnsecsANDROID time)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglPresentationTimeANDROID",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->setPresentationTime(time),
"eglPresentationTimeANDROID", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
return EGL_TRUE;
}
EGLBoolean GetCompositorTimingSupportedANDROID(Thread *thread,
Display *display,
Surface *eglSurface,
CompositorTiming nameInternal)
{
thread->setSuccess();
return eglSurface->getSupportedCompositorTimings().test(nameInternal);
}
EGLBoolean GetCompositorTimingANDROID(Thread *thread,
Display *display,
Surface *eglSurface,
EGLint numTimestamps,
const EGLint *names,
EGLnsecsANDROID *values)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetCompositorTimingANDROIDD",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getCompositorTiming(numTimestamps, names, values),
"eglGetCompositorTimingANDROIDD", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean GetNextFrameIdANDROID(Thread *thread,
Display *display,
Surface *eglSurface,
EGLuint64KHR *frameId)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetNextFrameIdANDROID",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getNextFrameId(frameId), "eglGetNextFrameIdANDROID",
GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean GetFrameTimestampSupportedANDROID(Thread *thread,
Display *display,
Surface *eglSurface,
Timestamp timestampInternal)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryTimestampSupportedANDROID",
GetDisplayIfValid(display), EGL_FALSE);
thread->setSuccess();
return eglSurface->getSupportedTimestamps().test(timestampInternal);
}
EGLBoolean GetFrameTimestampsANDROID(Thread *thread,
Display *display,
Surface *eglSurface,
EGLuint64KHR frameId,
EGLint numTimestamps,
const EGLint *timestamps,
EGLnsecsANDROID *values)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetFrameTimestampsANDROID",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(
thread, eglSurface->getFrameTimestamps(frameId, numTimestamps, timestamps, values),
"eglGetFrameTimestampsANDROID", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean QueryDebugKHR(Thread *thread, EGLint attribute, EGLAttrib *value)
{
Debug *debug = GetDebug();
switch (attribute)
{
case EGL_DEBUG_MSG_CRITICAL_KHR:
case EGL_DEBUG_MSG_ERROR_KHR:
case EGL_DEBUG_MSG_WARN_KHR:
case EGL_DEBUG_MSG_INFO_KHR:
*value = debug->isMessageTypeEnabled(FromEGLenum<MessageType>(attribute)) ? EGL_TRUE
: EGL_FALSE;
break;
case EGL_DEBUG_CALLBACK_KHR:
*value = reinterpret_cast<EGLAttrib>(debug->getCallback());
break;
default:
UNREACHABLE();
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean QueryDeviceAttribEXT(Thread *thread, Device *dev, EGLint attribute, EGLAttrib *value)
{
ANGLE_EGL_TRY_RETURN(thread, dev->getAttribute(attribute, value), "eglQueryDeviceAttribEXT",
GetDeviceIfValid(dev), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
const char *QueryDeviceStringEXT(Thread *thread, Device *dev, EGLint name)
{
egl::Display *owningDisplay = dev->getOwningDisplay();
ANGLE_EGL_TRY_RETURN(thread, owningDisplay->prepareForCall(), "eglQueryDeviceStringEXT",
GetDisplayIfValid(owningDisplay), EGL_FALSE);
const char *result;
switch (name)
{
case EGL_EXTENSIONS:
result = dev->getExtensionString().c_str();
break;
default:
thread->setError(EglBadDevice(), "eglQueryDeviceStringEXT", GetDeviceIfValid(dev));
return nullptr;
}
thread->setSuccess();
return result;
}
EGLBoolean QueryDisplayAttribEXT(Thread *thread,
Display *display,
EGLint attribute,
EGLAttrib *value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryDisplayAttribEXT",
GetDisplayIfValid(display), EGL_FALSE);
*value = display->queryAttrib(attribute);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean QueryStreamKHR(Thread *thread,
Display *display,
Stream *streamObject,
EGLenum attribute,
EGLint *value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryStreamKHR",
GetDisplayIfValid(display), EGL_FALSE);
switch (attribute)
{
case EGL_STREAM_STATE_KHR:
*value = streamObject->getState();
break;
case EGL_CONSUMER_LATENCY_USEC_KHR:
*value = streamObject->getConsumerLatency();
break;
case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR:
*value = streamObject->getConsumerAcquireTimeout();
break;
default:
UNREACHABLE();
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean QueryStreamu64KHR(Thread *thread,
Display *display,
Stream *streamObject,
EGLenum attribute,
EGLuint64KHR *value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryStreamu64KHR",
GetDisplayIfValid(display), EGL_FALSE);
switch (attribute)
{
case EGL_PRODUCER_FRAME_KHR:
*value = streamObject->getProducerFrame();
break;
case EGL_CONSUMER_FRAME_KHR:
*value = streamObject->getConsumerFrame();
break;
default:
UNREACHABLE();
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean QuerySurfacePointerANGLE(Thread *thread,
Display *display,
Surface *eglSurface,
EGLint attribute,
void **value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQuerySurfacePointerANGLE",
GetDisplayIfValid(display), EGL_FALSE);
Error error = eglSurface->querySurfacePointerANGLE(attribute, value);
if (error.isError())
{
thread->setError(error, "eglQuerySurfacePointerANGLE",
GetSurfaceIfValid(display, eglSurface));
return EGL_FALSE;
}
thread->setSuccess();
return EGL_TRUE;
}
void SetBlobCacheFuncsANDROID(Thread *thread,
Display *display,
EGLSetBlobFuncANDROID set,
EGLGetBlobFuncANDROID get)
{
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglSetBlobCacheFuncsANDROID",
GetDisplayIfValid(display));
thread->setSuccess();
display->setBlobCacheFuncs(set, get);
}
EGLBoolean SignalSyncKHR(Thread *thread, Display *display, Sync *syncObject, EGLenum mode)
{
gl::Context *currentContext = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, syncObject->signal(display, currentContext, mode),
"eglSignalSyncKHR", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean StreamAttribKHR(Thread *thread,
Display *display,
Stream *streamObject,
EGLenum attribute,
EGLint value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamAttribKHR",
GetDisplayIfValid(display), EGL_FALSE);
switch (attribute)
{
case EGL_CONSUMER_LATENCY_USEC_KHR:
streamObject->setConsumerLatency(value);
break;
case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR:
streamObject->setConsumerAcquireTimeout(value);
break;
default:
UNREACHABLE();
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean StreamConsumerAcquireKHR(Thread *thread, Display *display, Stream *streamObject)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamConsumerAcquireKHR",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, streamObject->consumerAcquire(thread->getContext()),
"eglStreamConsumerAcquireKHR", GetStreamIfValid(display, streamObject),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean StreamConsumerGLTextureExternalKHR(Thread *thread,
Display *display,
Stream *streamObject)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamConsumerGLTextureExternalKHR",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(
thread, streamObject->createConsumerGLTextureExternal(AttributeMap(), thread->getContext()),
"eglStreamConsumerGLTextureExternalKHR", GetStreamIfValid(display, streamObject),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean StreamConsumerGLTextureExternalAttribsNV(Thread *thread,
Display *display,
Stream *streamObject,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(),
"eglStreamConsumerGLTextureExternalAttribsNV", GetDisplayIfValid(display),
EGL_FALSE);
gl::Context *context = gl::GetValidGlobalContext();
ANGLE_EGL_TRY_RETURN(thread, streamObject->createConsumerGLTextureExternal(attributes, context),
"eglStreamConsumerGLTextureExternalAttribsNV",
GetStreamIfValid(display, streamObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean StreamConsumerReleaseKHR(Thread *thread, Display *display, Stream *streamObject)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamConsumerReleaseKHR",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *context = gl::GetValidGlobalContext();
ANGLE_EGL_TRY_RETURN(thread, streamObject->consumerRelease(context),
"eglStreamConsumerReleaseKHR", GetStreamIfValid(display, streamObject),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean SwapBuffersWithDamageKHR(Thread *thread,
Display *display,
Surface *eglSurface,
EGLint *rects,
EGLint n_rects)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSwapBuffersWithDamageEXT",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->swapWithDamage(thread->getContext(), rects, n_rects),
"eglSwapBuffersWithDamageEXT", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLint WaitSyncKHR(Thread *thread, Display *display, Sync *syncObject, EGLint flags)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitSync",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, syncObject->serverWait(display, currentContext, flags),
"eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLDeviceEXT CreateDeviceANGLE(Thread *thread,
EGLint device_type,
void *native_device,
const EGLAttrib *attrib_list)
{
Device *device = nullptr;
ANGLE_EGL_TRY_RETURN(thread, Device::CreateDevice(device_type, native_device, &device),
"eglCreateDeviceANGLE", GetThreadIfValid(thread), EGL_NO_DEVICE_EXT);
thread->setSuccess();
return device;
}
EGLBoolean ReleaseDeviceANGLE(Thread *thread, Device *dev)
{
SafeDelete(dev);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean CreateStreamProducerD3DTextureANGLE(Thread *thread,
Display *display,
Stream *streamObject,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(),
"eglCreateStreamProducerD3DTextureANGLE", GetDisplayIfValid(display),
EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, streamObject->createProducerD3D11Texture(attributes),
"eglCreateStreamProducerD3DTextureANGLE",
GetStreamIfValid(display, streamObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean StreamPostD3DTextureANGLE(Thread *thread,
Display *display,
Stream *streamObject,
void *texture,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamPostD3DTextureANGLE",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, streamObject->postD3D11Texture(texture, attributes),
"eglStreamPostD3DTextureANGLE", GetStreamIfValid(display, streamObject),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean GetMscRateANGLE(Thread *thread,
Display *display,
Surface *eglSurface,
EGLint *numerator,
EGLint *denominator)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetMscRateANGLE",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getMscRate(numerator, denominator),
"eglGetMscRateANGLE", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean GetSyncValuesCHROMIUM(Thread *thread,
Display *display,
Surface *eglSurface,
EGLuint64KHR *ust,
EGLuint64KHR *msc,
EGLuint64KHR *sbc)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetSyncValuesCHROMIUM",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getSyncValues(ust, msc, sbc),
"eglGetSyncValuesCHROMIUM", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLint ProgramCacheGetAttribANGLE(Thread *thread, Display *display, EGLenum attrib)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglProgramCacheGetAttribANGLE",
GetDisplayIfValid(display), 0);
thread->setSuccess();
return display->programCacheGetAttrib(attrib);
}
void ProgramCacheQueryANGLE(Thread *thread,
Display *display,
EGLint index,
void *key,
EGLint *keysize,
void *binary,
EGLint *binarysize)
{
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglProgramCacheQueryANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, display->programCacheQuery(index, key, keysize, binary, binarysize),
"eglProgramCacheQueryANGLE", GetDisplayIfValid(display));
thread->setSuccess();
}
void ProgramCachePopulateANGLE(Thread *thread,
Display *display,
const void *key,
EGLint keysize,
const void *binary,
EGLint binarysize)
{
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglProgramCachePopulateANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, display->programCachePopulate(key, keysize, binary, binarysize),
"eglProgramCachePopulateANGLE", GetDisplayIfValid(display));
thread->setSuccess();
}
EGLint ProgramCacheResizeANGLE(Thread *thread, Display *display, EGLint limit, EGLint mode)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglProgramCacheResizeANGLE",
GetDisplayIfValid(display), 0);
thread->setSuccess();
return display->programCacheResize(limit, mode);
}
const char *QueryStringiANGLE(Thread *thread, Display *display, EGLint name, EGLint index)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryStringiANGLE",
GetDisplayIfValid(display), nullptr);
thread->setSuccess();
return display->queryStringi(name, index);
}
EGLBoolean SwapBuffersWithFrameTokenANGLE(Thread *thread,
Display *display,
Surface *eglSurface,
EGLFrameTokenANGLE frametoken)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSwapBuffersWithFrameTokenANGLE",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->swapWithFrameToken(thread->getContext(), frametoken),
"eglSwapBuffersWithFrameTokenANGLE", GetDisplayIfValid(display),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
void ReleaseHighPowerGPUANGLE(Thread *thread, Display *display, gl::Context *context)
{
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglReleaseHighPowerGPUANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, context->releaseHighPowerGPU(), "eglReleaseHighPowerGPUANGLE",
GetDisplayIfValid(display));
thread->setSuccess();
}
void ReacquireHighPowerGPUANGLE(Thread *thread, Display *display, gl::Context *context)
{
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglReacquireHighPowerGPUANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, context->reacquireHighPowerGPU(), "eglReacquireHighPowerGPUANGLE",
GetDisplayIfValid(display));
thread->setSuccess();
}
void HandleGPUSwitchANGLE(Thread *thread, Display *display)
{
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglHandleGPUSwitchANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, display->handleGPUSwitch(), "eglHandleGPUSwitchANGLE",
GetDisplayIfValid(display));
thread->setSuccess();
}
EGLBoolean QueryDisplayAttribANGLE(Thread *thread,
Display *display,
EGLint attribute,
EGLAttrib *value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryDisplayAttribEXT",
GetDisplayIfValid(display), EGL_FALSE);
*value = display->queryAttrib(attribute);
thread->setSuccess();
return EGL_TRUE;
}
} // namespace egl
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_entry_points.py using data from egl.xml and egl_angle_ext.xml.
//
// Copyright 2020 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.
//
// egl_ext_stubs_autogen.h: Stubs for EXT extension entry points.
#ifndef LIBGLESV2_EGL_EXT_STUBS_AUTOGEN_H_
#define LIBGLESV2_EGL_EXT_STUBS_AUTOGEN_H_
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "common/PackedEGLEnums_autogen.h"
namespace gl
{
class Context;
} // namespace gl
namespace egl
{
class AttributeMap;
class Device;
class Display;
class Image;
class Stream;
class Surface;
class Sync;
class Thread;
struct Config;
EGLint ClientWaitSyncKHR(Thread *thread,
Display *dpyPacked,
Sync *syncPacked,
EGLint flags,
EGLTimeKHR timeout);
EGLImageKHR CreateImageKHR(Thread *thread,
Display *dpyPacked,
gl::Context *ctxPacked,
EGLenum target,
EGLClientBuffer buffer,
const AttributeMap &attrib_listPacked);
EGLClientBuffer CreateNativeClientBufferANDROID(Thread *thread,
const AttributeMap &attrib_listPacked);
EGLSurface CreatePlatformPixmapSurfaceEXT(Thread *thread,
Display *dpyPacked,
Config *configPacked,
void *native_pixmap,
const AttributeMap &attrib_listPacked);
EGLSurface CreatePlatformWindowSurfaceEXT(Thread *thread,
Display *dpyPacked,
Config *configPacked,
void *native_window,
const AttributeMap &attrib_listPacked);
EGLStreamKHR CreateStreamKHR(Thread *thread,
Display *dpyPacked,
const AttributeMap &attrib_listPacked);
EGLSyncKHR CreateSyncKHR(Thread *thread,
Display *dpyPacked,
EGLenum type,
const AttributeMap &attrib_listPacked);
EGLint DebugMessageControlKHR(Thread *thread,
EGLDEBUGPROCKHR callback,
const AttributeMap &attrib_listPacked);
EGLBoolean DestroyImageKHR(Thread *thread, Display *dpyPacked, Image *imagePacked);
EGLBoolean DestroyStreamKHR(Thread *thread, Display *dpyPacked, Stream *streamPacked);
EGLBoolean DestroySyncKHR(Thread *thread, Display *dpyPacked, Sync *syncPacked);
EGLint DupNativeFenceFDANDROID(Thread *thread, Display *dpyPacked, Sync *syncPacked);
EGLClientBuffer GetNativeClientBufferANDROID(Thread *thread, const struct AHardwareBuffer *buffer);
EGLDisplay GetPlatformDisplayEXT(Thread *thread,
EGLenum platform,
void *native_display,
const AttributeMap &attrib_listPacked);
EGLBoolean GetSyncAttribKHR(Thread *thread,
Display *dpyPacked,
Sync *syncPacked,
EGLint attribute,
EGLint *value);
EGLint LabelObjectKHR(Thread *thread,
Display *displayPacked,
ObjectType objectTypePacked,
EGLObjectKHR object,
EGLLabelKHR label);
EGLBoolean PostSubBufferNV(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLint x,
EGLint y,
EGLint width,
EGLint height);
EGLBoolean PresentationTimeANDROID(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLnsecsANDROID time);
EGLBoolean GetCompositorTimingSupportedANDROID(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
CompositorTiming namePacked);
EGLBoolean GetCompositorTimingANDROID(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLint numTimestamps,
const EGLint *names,
EGLnsecsANDROID *values);
EGLBoolean GetNextFrameIdANDROID(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLuint64KHR *frameId);
EGLBoolean GetFrameTimestampSupportedANDROID(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
Timestamp timestampPacked);
EGLBoolean GetFrameTimestampsANDROID(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLuint64KHR frameId,
EGLint numTimestamps,
const EGLint *timestamps,
EGLnsecsANDROID *values);
EGLBoolean QueryDebugKHR(Thread *thread, EGLint attribute, EGLAttrib *value);
EGLBoolean QueryDeviceAttribEXT(Thread *thread,
Device *devicePacked,
EGLint attribute,
EGLAttrib *value);
const char *QueryDeviceStringEXT(Thread *thread, Device *devicePacked, EGLint name);
EGLBoolean QueryDisplayAttribEXT(Thread *thread,
Display *dpyPacked,
EGLint attribute,
EGLAttrib *value);
EGLBoolean QueryStreamKHR(Thread *thread,
Display *dpyPacked,
Stream *streamPacked,
EGLenum attribute,
EGLint *value);
EGLBoolean QueryStreamu64KHR(Thread *thread,
Display *dpyPacked,
Stream *streamPacked,
EGLenum attribute,
EGLuint64KHR *value);
EGLBoolean QuerySurfacePointerANGLE(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLint attribute,
void **value);
void SetBlobCacheFuncsANDROID(Thread *thread,
Display *dpyPacked,
EGLSetBlobFuncANDROID set,
EGLGetBlobFuncANDROID get);
EGLBoolean SignalSyncKHR(Thread *thread, Display *dpyPacked, Sync *syncPacked, EGLenum mode);
EGLBoolean StreamAttribKHR(Thread *thread,
Display *dpyPacked,
Stream *streamPacked,
EGLenum attribute,
EGLint value);
EGLBoolean StreamConsumerAcquireKHR(Thread *thread, Display *dpyPacked, Stream *streamPacked);
EGLBoolean StreamConsumerGLTextureExternalKHR(Thread *thread,
Display *dpyPacked,
Stream *streamPacked);
EGLBoolean StreamConsumerGLTextureExternalAttribsNV(Thread *thread,
Display *dpyPacked,
Stream *streamPacked,
const AttributeMap &attrib_listPacked);
EGLBoolean StreamConsumerReleaseKHR(Thread *thread, Display *dpyPacked, Stream *streamPacked);
EGLBoolean SwapBuffersWithDamageKHR(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLint *rects,
EGLint n_rects);
EGLint WaitSyncKHR(Thread *thread, Display *dpyPacked, Sync *syncPacked, EGLint flags);
EGLDeviceEXT CreateDeviceANGLE(Thread *thread,
EGLint device_type,
void *native_device,
const EGLAttrib *attrib_list);
EGLBoolean ReleaseDeviceANGLE(Thread *thread, Device *devicePacked);
EGLBoolean CreateStreamProducerD3DTextureANGLE(Thread *thread,
Display *dpyPacked,
Stream *streamPacked,
const AttributeMap &attrib_listPacked);
EGLBoolean StreamPostD3DTextureANGLE(Thread *thread,
Display *dpyPacked,
Stream *streamPacked,
void *texture,
const AttributeMap &attrib_listPacked);
EGLBoolean GetMscRateANGLE(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLint *numerator,
EGLint *denominator);
EGLBoolean GetSyncValuesCHROMIUM(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLuint64KHR *ust,
EGLuint64KHR *msc,
EGLuint64KHR *sbc);
EGLint ProgramCacheGetAttribANGLE(Thread *thread, Display *dpyPacked, EGLenum attrib);
void ProgramCacheQueryANGLE(Thread *thread,
Display *dpyPacked,
EGLint index,
void *key,
EGLint *keysize,
void *binary,
EGLint *binarysize);
void ProgramCachePopulateANGLE(Thread *thread,
Display *dpyPacked,
const void *key,
EGLint keysize,
const void *binary,
EGLint binarysize);
EGLint ProgramCacheResizeANGLE(Thread *thread, Display *dpyPacked, EGLint limit, EGLint mode);
const char *QueryStringiANGLE(Thread *thread, Display *dpyPacked, EGLint name, EGLint index);
EGLBoolean SwapBuffersWithFrameTokenANGLE(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLFrameTokenANGLE frametoken);
void ReleaseHighPowerGPUANGLE(Thread *thread, Display *dpyPacked, gl::Context *ctxPacked);
void ReacquireHighPowerGPUANGLE(Thread *thread, Display *dpyPacked, gl::Context *ctxPacked);
void HandleGPUSwitchANGLE(Thread *thread, Display *dpyPacked);
EGLBoolean QueryDisplayAttribANGLE(Thread *thread,
Display *dpyPacked,
EGLint attribute,
EGLAttrib *value);
} // namespace egl
#endif // LIBGLESV2_EGL_EXT_STUBS_AUTOGEN_H_
{
"description": [
"Copyright 2020 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.",
"",
"egl_get_labeled_object_data.json: Associates entry points and labeled objects.",
"",
"If an entry point has no data in this list it is associated with an",
"EGLDisplay if the EGLDisplay is the first parameter the function.",
"Otherise missing entry points have no association.",
"",
"We omit extension suffixes in this file. The generator takes care of that."
],
"Context": [
"DestroyContext",
"MakeCurrent",
"QueryContext",
"WaitClient"
],
"Device": [
"QueryDeviceAttrib",
"QueryDeviceString",
"ReleaseDevice"
],
"Image": [
"DestroyImage"
],
"LabeledObject": [
"LabelObject"
],
"Stream": [
"CreateStreamProducerD3DTexture",
"DestroyStream",
"QueryStream",
"QueryStreamu64",
"StreamAttrib",
"StreamConsumerAcquire",
"StreamConsumerGLTextureExternal",
"StreamConsumerGLTextureExternalAttribsNV",
"StreamConsumerRelease",
"StreamPostD3DTexture"
],
"Surface": [
"BindTexImage",
"CopyBuffers",
"DestroySurface",
"GetCompositorTiming",
"GetCompositorTimingSupported",
"GetFrameTimestamps",
"GetFrameTimestampSupported",
"GetNextFrameId",
"GetMscRate",
"GetSyncValues",
"PresentationTime",
"QuerySuface",
"ReleaseTexImage",
"SurfaceAttrib",
"SwapBuffers",
"SwapBuffersWithDamage"
],
"Sync": [
"ClientWaitSync",
"DupNativeFenceFD",
"GetSyncAttrib",
"SignalSync",
"WaitSync"
],
"Thread": [
"BindAPI",
"CreateDevice",
"GetPlatformDisplay",
"WaitNative"
]
}
//
// Copyright 2020 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.
//
// egl_stubs.cpp: Stubs for EGL entry points.
//
#include "libGLESv2/egl_stubs_autogen.h"
#include "common/version.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/EGLSync.h"
#include "libANGLE/Surface.h"
#include "libANGLE/Thread.h"
#include "libANGLE/queryutils.h"
#include "libANGLE/validationEGL.h"
#include "libGLESv2/global_state.h"
#include "libGLESv2/proc_table_egl.h"
namespace egl
{
namespace
{
bool CompareProc(const ProcEntry &a, const char *b)
{
return strcmp(a.first, b) < 0;
}
void ClipConfigs(const std::vector<const Config *> &filteredConfigs,
EGLConfig *outputConfigs,
EGLint configSize,
EGLint *numConfigs)
{
EGLint resultSize = static_cast<EGLint>(filteredConfigs.size());
if (outputConfigs)
{
resultSize = std::max(std::min(resultSize, configSize), 0);
for (EGLint i = 0; i < resultSize; i++)
{
outputConfigs[i] = const_cast<Config *>(filteredConfigs[i]);
}
}
*numConfigs = resultSize;
}
} // anonymous namespace
EGLBoolean BindAPI(Thread *thread, EGLenum api)
{
thread->setAPI(api);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean BindTexImage(Thread *thread, Display *display, Surface *eglSurface, EGLint buffer)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglBindTexImage",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *context = thread->getContext();
if (context)
{
gl::TextureType type =
egl_gl::EGLTextureTargetToTextureType(eglSurface->getTextureTarget());
gl::Texture *textureObject = context->getTextureByType(type);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->bindTexImage(context, textureObject, buffer),
"eglBindTexImage", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean ChooseConfig(Thread *thread,
Display *display,
const AttributeMap &attribMap,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config)
{
ClipConfigs(display->chooseConfig(attribMap), configs, config_size, num_config);
thread->setSuccess();
return EGL_TRUE;
}
EGLint ClientWaitSync(Thread *thread,
Display *display,
Sync *syncObject,
EGLint flags,
EGLTime timeout)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglClientWaitSync",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
EGLint syncStatus = EGL_FALSE;
ANGLE_EGL_TRY_RETURN(
thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
"eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return syncStatus;
}
EGLBoolean CopyBuffers(Thread *thread,
Display *display,
Surface *eglSurface,
EGLNativePixmapType target)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCopyBuffers",
GetDisplayIfValid(display), EGL_FALSE);
UNIMPLEMENTED(); // FIXME
thread->setSuccess();
return 0;
}
EGLContext CreateContext(Thread *thread,
Display *display,
Config *configuration,
gl::Context *sharedGLContext,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateContext",
GetDisplayIfValid(display), EGL_NO_CONTEXT);
gl::Context *context = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createContext(configuration, sharedGLContext, thread->getAPI(),
attributes, &context),
"eglCreateContext", GetDisplayIfValid(display), EGL_NO_CONTEXT);
thread->setSuccess();
return static_cast<EGLContext>(context);
}
EGLImage CreateImage(Thread *thread,
Display *display,
gl::Context *context,
EGLenum target,
EGLClientBuffer buffer,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateImage",
GetDisplayIfValid(display), EGL_FALSE);
Image *image = nullptr;
Error error = display->createImage(context, target, buffer, attributes, &image);
if (error.isError())
{
thread->setError(error, "eglCreateImage", GetDisplayIfValid(display));
return EGL_NO_IMAGE;
}
thread->setSuccess();
return static_cast<EGLImage>(image);
}
EGLSurface CreatePbufferFromClientBuffer(Thread *thread,
Display *display,
EGLenum buftype,
EGLClientBuffer buffer,
Config *configuration,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePbufferFromClientBuffer",
GetDisplayIfValid(display), EGL_NO_SURFACE);
Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createPbufferFromClientBuffer(configuration, buftype, buffer,
attributes, &surface),
"eglCreatePbufferFromClientBuffer", GetDisplayIfValid(display),
EGL_NO_SURFACE);
return static_cast<EGLSurface>(surface);
}
EGLSurface CreatePbufferSurface(Thread *thread,
Display *display,
Config *configuration,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePbufferSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(thread, display->createPbufferSurface(configuration, attributes, &surface),
"eglCreatePbufferSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
return static_cast<EGLSurface>(surface);
}
EGLSurface CreatePixmapSurface(Thread *thread,
Display *display,
Config *configuration,
EGLNativePixmapType pixmap,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePixmapSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createPixmapSurface(configuration, pixmap, attributes, &surface),
"eglCreatePixmapSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
thread->setSuccess();
return static_cast<EGLSurface>(surface);
}
EGLSurface CreatePlatformPixmapSurface(Thread *thread,
Display *display,
Config *configuration,
void *pixmap,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePlatformPixmapSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
Surface *surface = nullptr;
EGLNativePixmapType nativePixmap = reinterpret_cast<EGLNativePixmapType>(pixmap);
ANGLE_EGL_TRY_RETURN(
thread, display->createPixmapSurface(configuration, nativePixmap, attributes, &surface),
"eglCreatePlatformPixmapSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
thread->setSuccess();
return static_cast<EGLSurface>(surface);
}
EGLSurface CreatePlatformWindowSurface(Thread *thread,
Display *display,
Config *configuration,
void *win,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePlatformWindowSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
Surface *surface = nullptr;
EGLNativeWindowType nativeWindow = reinterpret_cast<EGLNativeWindowType>(win);
ANGLE_EGL_TRY_RETURN(
thread, display->createWindowSurface(configuration, nativeWindow, attributes, &surface),
"eglPlatformCreateWindowSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
return static_cast<EGLSurface>(surface);
}
EGLSync CreateSync(Thread *thread, Display *display, EGLenum type, const AttributeMap &attributes)
{
gl::Context *currentContext = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateSync",
GetDisplayIfValid(display), EGL_FALSE);
Sync *syncObject = nullptr;
ANGLE_EGL_TRY_RETURN(thread, display->createSync(currentContext, type, attributes, &syncObject),
"eglCreateSync", GetDisplayIfValid(display), EGL_NO_SYNC);
thread->setSuccess();
return static_cast<EGLSync>(syncObject);
}
EGLSurface CreateWindowSurface(Thread *thread,
Display *display,
Config *configuration,
EGLNativeWindowType win,
const AttributeMap &attributes)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateWindowSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createWindowSurface(configuration, win, attributes, &surface),
"eglCreateWindowSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
return static_cast<EGLSurface>(surface);
}
EGLBoolean DestroyContext(Thread *thread, Display *display, gl::Context *context)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroyContext",
GetDisplayIfValid(display), EGL_FALSE);
bool contextWasCurrent = context == thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, display->destroyContext(thread, context), "eglDestroyContext",
GetContextIfValid(display, context), EGL_FALSE);
if (contextWasCurrent)
{
ANGLE_EGL_TRY_RETURN(thread, display->makeCurrent(context, nullptr, nullptr, nullptr),
"eglDestroyContext", GetContextIfValid(display, context), EGL_FALSE);
SetContextCurrent(thread, nullptr);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean DestroyImage(Thread *thread, Display *display, Image *img)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroyImage",
GetDisplayIfValid(display), EGL_FALSE);
display->destroyImage(img);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean DestroySurface(Thread *thread, Display *display, Surface *eglSurface)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroySurface",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, display->destroySurface(eglSurface), "eglDestroySurface",
GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean DestroySync(Thread *thread, Display *display, Sync *syncObject)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroySync",
GetDisplayIfValid(display), EGL_FALSE);
display->destroySync(syncObject);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean GetConfigAttrib(Thread *thread,
Display *display,
Config *configuration,
EGLint attribute,
EGLint *value)
{
QueryConfigAttrib(configuration, attribute, value);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean GetConfigs(Thread *thread,
Display *display,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config)
{
ClipConfigs(display->getConfigs(AttributeMap()), configs, config_size, num_config);
thread->setSuccess();
return EGL_TRUE;
}
EGLContext GetCurrentContext(Thread *thread)
{
gl::Context *context = thread->getContext();
thread->setSuccess();
return static_cast<EGLContext>(context);
}
EGLDisplay GetCurrentDisplay(Thread *thread)
{
thread->setSuccess();
if (thread->getContext() != nullptr)
{
return thread->getContext()->getDisplay();
}
return EGL_NO_DISPLAY;
}
EGLSurface GetCurrentSurface(Thread *thread, EGLint readdraw)
{
if (readdraw == EGL_READ)
{
thread->setSuccess();
return thread->getCurrentReadSurface();
}
else if (readdraw == EGL_DRAW)
{
thread->setSuccess();
return thread->getCurrentDrawSurface();
}
else
{
thread->setError(EglBadParameter(), "eglGetCurrentSurface", nullptr);
return EGL_NO_SURFACE;
}
}
EGLDisplay GetDisplay(Thread *thread, EGLNativeDisplayType display_id)
{
return Display::GetDisplayFromNativeDisplay(display_id, AttributeMap());
}
EGLint GetError(Thread *thread)
{
EGLint error = thread->getError();
thread->setSuccess();
return error;
}
EGLDisplay GetPlatformDisplay(Thread *thread,
EGLenum platform,
void *native_display,
const AttributeMap &attribMap)
{
if (platform == EGL_PLATFORM_ANGLE_ANGLE)
{
return Display::GetDisplayFromNativeDisplay(
gl::bitCast<EGLNativeDisplayType>(native_display), attribMap);
}
else if (platform == EGL_PLATFORM_DEVICE_EXT)
{
Device *eglDevice = static_cast<Device *>(native_display);
return Display::GetDisplayFromDevice(eglDevice, attribMap);
}
else
{
UNREACHABLE();
return EGL_NO_DISPLAY;
}
}
__eglMustCastToProperFunctionPointerType GetProcAddress(Thread *thread, const char *procname)
{
const ProcEntry *entry =
std::lower_bound(&g_procTable[0], &g_procTable[g_numProcs], procname, CompareProc);
thread->setSuccess();
if (entry == &g_procTable[g_numProcs] || strcmp(entry->first, procname) != 0)
{
return nullptr;
}
return entry->second;
}
EGLBoolean GetSyncAttrib(Thread *thread,
Display *display,
Sync *syncObject,
EGLint attribute,
EGLAttrib *value)
{
EGLint valueExt;
ANGLE_EGL_TRY_RETURN(thread, GetSyncAttrib(display, syncObject, attribute, &valueExt),
"eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
*value = valueExt;
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean Initialize(Thread *thread, Display *display, EGLint *major, EGLint *minor)
{
ANGLE_EGL_TRY_RETURN(thread, display->initialize(), "eglInitialize", GetDisplayIfValid(display),
EGL_FALSE);
if (major)
*major = 1;
if (minor)
*minor = 5;
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean MakeCurrent(Thread *thread,
Display *display,
Surface *drawSurface,
Surface *readSurface,
gl::Context *context)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglMakeCurrent",
GetDisplayIfValid(display), EGL_FALSE);
Surface *previousDraw = thread->getCurrentDrawSurface();
Surface *previousRead = thread->getCurrentReadSurface();
gl::Context *previousContext = thread->getContext();
// Only call makeCurrent if the context or surfaces have changed.
if (previousDraw != drawSurface || previousRead != readSurface || previousContext != context)
{
ANGLE_EGL_TRY_RETURN(
thread, display->makeCurrent(previousContext, drawSurface, readSurface, context),
"eglMakeCurrent", GetContextIfValid(display, context), EGL_FALSE);
SetContextCurrent(thread, context);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLenum QueryAPI(Thread *thread)
{
EGLenum API = thread->getAPI();
thread->setSuccess();
return API;
}
EGLBoolean QueryContext(Thread *thread,
Display *display,
gl::Context *context,
EGLint attribute,
EGLint *value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryContext",
GetDisplayIfValid(display), EGL_FALSE);
QueryContextAttrib(context, attribute, value);
thread->setSuccess();
return EGL_TRUE;
}
const char *QueryString(Thread *thread, Display *display, EGLint name)
{
if (display)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryString",
GetDisplayIfValid(display), nullptr);
}
const char *result = nullptr;
switch (name)
{
case EGL_CLIENT_APIS:
result = "OpenGL_ES";
break;
case EGL_EXTENSIONS:
if (display == EGL_NO_DISPLAY)
{
result = Display::GetClientExtensionString().c_str();
}
else
{
result = display->getExtensionString().c_str();
}
break;
case EGL_VENDOR:
result = display->getVendorString().c_str();
break;
case EGL_VERSION:
result = "1.5 (ANGLE " ANGLE_VERSION_STRING ")";
break;
default:
UNREACHABLE();
break;
}
thread->setSuccess();
return result;
}
EGLBoolean QuerySurface(Thread *thread,
Display *display,
Surface *eglSurface,
EGLint attribute,
EGLint *value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQuerySurface",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, QuerySurfaceAttrib(display, eglSurface, attribute, value),
"eglQuerySurface", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean ReleaseTexImage(Thread *thread, Display *display, Surface *eglSurface, EGLint buffer)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglReleaseTexImage",
GetDisplayIfValid(display), EGL_FALSE);
gl::Texture *texture = eglSurface->getBoundTexture();
if (texture)
{
ANGLE_EGL_TRY_RETURN(thread, eglSurface->releaseTexImage(thread->getContext(), buffer),
"eglReleaseTexImage", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean ReleaseThread(Thread *thread)
{
Surface *previousDraw = thread->getCurrentDrawSurface();
Surface *previousRead = thread->getCurrentReadSurface();
gl::Context *previousContext = thread->getContext();
Display *previousDisplay = thread->getDisplay();
if (previousDisplay != EGL_NO_DISPLAY)
{
ANGLE_EGL_TRY_RETURN(thread, previousDisplay->prepareForCall(), "eglReleaseThread",
GetDisplayIfValid(previousDisplay), EGL_FALSE);
// Only call makeCurrent if the context or surfaces have changed.
if (previousDraw != EGL_NO_SURFACE || previousRead != EGL_NO_SURFACE ||
previousContext != EGL_NO_CONTEXT)
{
ANGLE_EGL_TRY_RETURN(
thread, previousDisplay->makeCurrent(previousContext, nullptr, nullptr, nullptr),
"eglReleaseThread", nullptr, EGL_FALSE);
}
ANGLE_EGL_TRY_RETURN(thread, previousDisplay->releaseThread(), "eglReleaseThread",
GetDisplayIfValid(previousDisplay), EGL_FALSE);
SetContextCurrent(thread, nullptr);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean SurfaceAttrib(Thread *thread,
Display *display,
Surface *eglSurface,
EGLint attribute,
EGLint value)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSurfaceAttrib",
GetDisplayIfValid(display), EGL_FALSE);
SetSurfaceAttrib(eglSurface, attribute, value);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean SwapBuffers(Thread *thread, Display *display, Surface *eglSurface)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSwapBuffers",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->swap(thread->getContext()), "eglSwapBuffers",
GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean SwapInterval(Thread *thread, Display *display, EGLint interval)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSwapInterval",
GetDisplayIfValid(display), EGL_FALSE);
Surface *drawSurface = static_cast<Surface *>(thread->getCurrentDrawSurface());
const Config *surfaceConfig = drawSurface->getConfig();
EGLint clampedInterval = std::min(std::max(interval, surfaceConfig->minSwapInterval),
surfaceConfig->maxSwapInterval);
drawSurface->setSwapInterval(clampedInterval);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean Terminate(Thread *thread, Display *display)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglTerminate",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread,
display->makeCurrent(thread->getContext(), nullptr, nullptr, nullptr),
"eglTerminate", GetDisplayIfValid(display), EGL_FALSE);
SetContextCurrent(thread, nullptr);
ANGLE_EGL_TRY_RETURN(thread, display->terminate(thread), "eglTerminate",
GetDisplayIfValid(display), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean WaitClient(Thread *thread)
{
Display *display = thread->getDisplay();
gl::Context *context = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitClient",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, display->waitClient(context), "eglWaitClient",
GetContextIfValid(display, context), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean WaitGL(Thread *thread)
{
Display *display = thread->getDisplay();
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitGL", GetDisplayIfValid(display),
EGL_FALSE);
// eglWaitGL like calling eglWaitClient with the OpenGL ES API bound. Since we only implement
// OpenGL ES we can do the call directly.
ANGLE_EGL_TRY_RETURN(thread, display->waitClient(thread->getContext()), "eglWaitGL",
GetDisplayIfValid(display), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean WaitNative(Thread *thread, EGLint engine)
{
Display *display = thread->getDisplay();
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitNative",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, display->waitNative(thread->getContext(), engine), "eglWaitNative",
GetThreadIfValid(thread), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean WaitSync(Thread *thread, Display *display, Sync *syncObject, EGLint flags)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitSync",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, syncObject->serverWait(display, currentContext, flags),
"eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
} // namespace egl
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_entry_points.py using data from egl.xml.
//
// Copyright 2020 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.
//
// egl_stubs_autogen.h: Stubs for EGL entry points.
#ifndef LIBGLESV2_EGL_STUBS_AUTOGEN_H_
#define LIBGLESV2_EGL_STUBS_AUTOGEN_H_
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "common/PackedEGLEnums_autogen.h"
namespace gl
{
class Context;
} // namespace gl
namespace egl
{
class AttributeMap;
class Device;
class Display;
class Image;
class Stream;
class Surface;
class Sync;
class Thread;
struct Config;
EGLBoolean BindAPI(Thread *thread, EGLenum api);
EGLBoolean BindTexImage(Thread *thread, Display *dpyPacked, Surface *surfacePacked, EGLint buffer);
EGLBoolean ChooseConfig(Thread *thread,
Display *dpyPacked,
const AttributeMap &attrib_listPacked,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config);
EGLint ClientWaitSync(Thread *thread,
Display *dpyPacked,
Sync *syncPacked,
EGLint flags,
EGLTime timeout);
EGLBoolean CopyBuffers(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLNativePixmapType target);
EGLContext CreateContext(Thread *thread,
Display *dpyPacked,
Config *configPacked,
gl::Context *share_contextPacked,
const AttributeMap &attrib_listPacked);
EGLImage CreateImage(Thread *thread,
Display *dpyPacked,
gl::Context *ctxPacked,
EGLenum target,
EGLClientBuffer buffer,
const AttributeMap &attrib_listPacked);
EGLSurface CreatePbufferFromClientBuffer(Thread *thread,
Display *dpyPacked,
EGLenum buftype,
EGLClientBuffer buffer,
Config *configPacked,
const AttributeMap &attrib_listPacked);
EGLSurface CreatePbufferSurface(Thread *thread,
Display *dpyPacked,
Config *configPacked,
const AttributeMap &attrib_listPacked);
EGLSurface CreatePixmapSurface(Thread *thread,
Display *dpyPacked,
Config *configPacked,
EGLNativePixmapType pixmap,
const AttributeMap &attrib_listPacked);
EGLSurface CreatePlatformPixmapSurface(Thread *thread,
Display *dpyPacked,
Config *configPacked,
void *native_pixmap,
const AttributeMap &attrib_listPacked);
EGLSurface CreatePlatformWindowSurface(Thread *thread,
Display *dpyPacked,
Config *configPacked,
void *native_window,
const AttributeMap &attrib_listPacked);
EGLSync CreateSync(Thread *thread,
Display *dpyPacked,
EGLenum type,
const AttributeMap &attrib_listPacked);
EGLSurface CreateWindowSurface(Thread *thread,
Display *dpyPacked,
Config *configPacked,
EGLNativeWindowType win,
const AttributeMap &attrib_listPacked);
EGLBoolean DestroyContext(Thread *thread, Display *dpyPacked, gl::Context *ctxPacked);
EGLBoolean DestroyImage(Thread *thread, Display *dpyPacked, Image *imagePacked);
EGLBoolean DestroySurface(Thread *thread, Display *dpyPacked, Surface *surfacePacked);
EGLBoolean DestroySync(Thread *thread, Display *dpyPacked, Sync *syncPacked);
EGLBoolean GetConfigAttrib(Thread *thread,
Display *dpyPacked,
Config *configPacked,
EGLint attribute,
EGLint *value);
EGLBoolean GetConfigs(Thread *thread,
Display *dpyPacked,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config);
EGLContext GetCurrentContext(Thread *thread);
EGLDisplay GetCurrentDisplay(Thread *thread);
EGLSurface GetCurrentSurface(Thread *thread, EGLint readdraw);
EGLDisplay GetDisplay(Thread *thread, EGLNativeDisplayType display_id);
EGLint GetError(Thread *thread);
EGLDisplay GetPlatformDisplay(Thread *thread,
EGLenum platform,
void *native_display,
const AttributeMap &attrib_listPacked);
__eglMustCastToProperFunctionPointerType GetProcAddress(Thread *thread, const char *procname);
EGLBoolean GetSyncAttrib(Thread *thread,
Display *dpyPacked,
Sync *syncPacked,
EGLint attribute,
EGLAttrib *value);
EGLBoolean Initialize(Thread *thread, Display *dpyPacked, EGLint *major, EGLint *minor);
EGLBoolean MakeCurrent(Thread *thread,
Display *dpyPacked,
Surface *drawPacked,
Surface *readPacked,
gl::Context *ctxPacked);
EGLenum QueryAPI(Thread *thread);
EGLBoolean QueryContext(Thread *thread,
Display *dpyPacked,
gl::Context *ctxPacked,
EGLint attribute,
EGLint *value);
const char *QueryString(Thread *thread, Display *dpyPacked, EGLint name);
EGLBoolean QuerySurface(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLint attribute,
EGLint *value);
EGLBoolean ReleaseTexImage(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLint buffer);
EGLBoolean ReleaseThread(Thread *thread);
EGLBoolean SurfaceAttrib(Thread *thread,
Display *dpyPacked,
Surface *surfacePacked,
EGLint attribute,
EGLint value);
EGLBoolean SwapBuffers(Thread *thread, Display *dpyPacked, Surface *surfacePacked);
EGLBoolean SwapInterval(Thread *thread, Display *dpyPacked, EGLint interval);
EGLBoolean Terminate(Thread *thread, Display *dpyPacked);
EGLBoolean WaitClient(Thread *thread);
EGLBoolean WaitGL(Thread *thread);
EGLBoolean WaitNative(Thread *thread, EGLint engine);
EGLBoolean WaitSync(Thread *thread, Display *dpyPacked, Sync *syncPacked, EGLint flags);
} // namespace egl
#endif // LIBGLESV2_EGL_STUBS_AUTOGEN_H_
//
// Copyright 2014 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.
//
// entry_points_egl.cpp : Implements the EGL entry points.
#include "libGLESv2/entry_points_egl_autogen.h"
#include "common/angle_version.h"
#include "common/debug.h"
#include "common/utilities.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/EGLSync.h"
#include "libANGLE/Surface.h"
#include "libANGLE/Texture.h"
#include "libANGLE/Thread.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/queryutils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationEGL_autogen.h"
#include "libGLESv2/global_state.h"
#include "libGLESv2/proc_table_egl.h"
using namespace egl;
namespace
{
bool CompareProc(const ProcEntry &a, const char *b)
{
return strcmp(a.first, b) < 0;
}
void ClipConfigs(const std::vector<const Config *> &filteredConfigs,
EGLConfig *output_configs,
EGLint config_size,
EGLint *num_config)
{
EGLint result_size = static_cast<EGLint>(filteredConfigs.size());
if (output_configs)
{
result_size = std::max(std::min(result_size, config_size), 0);
for (EGLint i = 0; i < result_size; i++)
{
output_configs[i] = const_cast<Config *>(filteredConfigs[i]);
}
}
*num_config = result_size;
}
} // anonymous namespace
extern "C" {
// EGL 1.0
EGLint EGLAPIENTRY EGL_GetError(void)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetError, "");
Thread *thread = egl::GetCurrentThread();
EGLint error = thread->getError();
thread->setSuccess();
return error;
}
EGLDisplay EGLAPIENTRY EGL_GetDisplay(EGLNativeDisplayType display_id)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetDisplay, "EGLNativeDisplayType display_id = 0x%016" PRIxPTR,
(uintptr_t)display_id);
return egl::Display::GetDisplayFromNativeDisplay(display_id, AttributeMap());
}
EGLBoolean EGLAPIENTRY EGL_Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(Initialize,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint *major = 0x%016" PRIxPTR
", EGLint *minor = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)major, (uintptr_t)minor);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, Initialize, GetDisplayIfValid(display), EGL_FALSE, display, major,
minor);
ANGLE_EGL_TRY_RETURN(thread, display->initialize(), "eglInitialize", GetDisplayIfValid(display),
EGL_FALSE);
if (major)
*major = 1;
if (minor)
*minor = 5;
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_Terminate(EGLDisplay dpy)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(Terminate, "EGLDisplay dpy = 0x%016" PRIxPTR, (uintptr_t)dpy);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, Terminate, GetDisplayIfValid(display), EGL_FALSE, display);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglTerminate",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread,
display->makeCurrent(thread->getContext(), nullptr, nullptr, nullptr),
"eglTerminate", GetDisplayIfValid(display), EGL_FALSE);
SetContextCurrent(thread, nullptr);
ANGLE_EGL_TRY_RETURN(thread, display->terminate(thread), "eglTerminate",
GetDisplayIfValid(display), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
const char *EGLAPIENTRY EGL_QueryString(EGLDisplay dpy, EGLint name)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryString, "EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint name = %d", (uintptr_t)dpy,
name);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, QueryString, GetDisplayIfValid(display), nullptr, display, name);
if (display)
{
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryString",
GetDisplayIfValid(display), nullptr);
}
const char *result = nullptr;
switch (name)
{
case EGL_CLIENT_APIS:
result = "OpenGL_ES";
break;
case EGL_EXTENSIONS:
if (display == EGL_NO_DISPLAY)
{
result = egl::Display::GetClientExtensionString().c_str();
}
else
{
result = display->getExtensionString().c_str();
}
break;
case EGL_VENDOR:
result = display->getVendorString().c_str();
break;
case EGL_VERSION:
result = "1.5 (ANGLE " ANGLE_VERSION_STRING ")";
break;
default:
UNREACHABLE();
break;
}
thread->setSuccess();
return result;
}
EGLBoolean EGLAPIENTRY EGL_GetConfigs(EGLDisplay dpy,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetConfigs,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig *configs = 0x%016" PRIxPTR
", "
"EGLint config_size = %d, EGLint *num_config = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)configs, config_size, (uintptr_t)num_config);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, GetConfigs, GetDisplayIfValid(display), EGL_FALSE, display, configs,
config_size, num_config);
ClipConfigs(display->getConfigs(AttributeMap()), configs, config_size, num_config);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_ChooseConfig(EGLDisplay dpy,
const EGLint *attrib_list,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ChooseConfig,
"EGLDisplay dpy = 0x%016" PRIxPTR ", const EGLint *attrib_list = 0x%016" PRIxPTR
", "
"EGLConfig *configs = 0x%016" PRIxPTR
", EGLint config_size = %d, EGLint *num_config = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)attrib_list, (uintptr_t)configs, config_size,
(uintptr_t)num_config);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
AttributeMap attribMap = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, ChooseConfig, GetDisplayIfValid(display), EGL_FALSE, display,
attribMap, configs, config_size, num_config);
ClipConfigs(display->chooseConfig(attribMap), configs, config_size, num_config);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_GetConfigAttrib(EGLDisplay dpy,
EGLConfig config,
EGLint attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetConfigAttrib,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", EGLint attribute = %d, EGLint "
"*value = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
ANGLE_EGL_VALIDATE(thread, GetConfigAttrib, GetDisplayIfValid(display), EGL_FALSE, display,
configuration, attribute, value);
QueryConfigAttrib(configuration, attribute, value);
thread->setSuccess();
return EGL_TRUE;
}
EGLSurface EGLAPIENTRY EGL_CreateWindowSurface(EGLDisplay dpy,
EGLConfig config,
EGLNativeWindowType win,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateWindowSurface,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", EGLNativeWindowType win = 0x%016" PRIxPTR
", "
"const EGLint *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)win, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateWindowSurface, GetDisplayIfValid(display), EGL_NO_SURFACE,
display, configuration, win, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateWindowSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
egl::Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createWindowSurface(configuration, win, attributes, &surface),
"eglCreateWindowSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
return static_cast<EGLSurface>(surface);
}
EGLSurface EGLAPIENTRY EGL_CreatePbufferSurface(EGLDisplay dpy,
EGLConfig config,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePbufferSurface,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", const EGLint *attrib_list = "
"0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePbufferSurface, GetDisplayIfValid(display), EGL_NO_SURFACE,
display, configuration, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePbufferSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
egl::Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(thread, display->createPbufferSurface(configuration, attributes, &surface),
"eglCreatePbufferSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
return static_cast<EGLSurface>(surface);
}
EGLSurface EGLAPIENTRY EGL_CreatePixmapSurface(EGLDisplay dpy,
EGLConfig config,
EGLNativePixmapType pixmap,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePixmapSurface,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", EGLNativePixmapType pixmap = "
"0x%016" PRIxPTR
", "
"const EGLint *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)pixmap, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePixmapSurface, GetDisplayIfValid(display), EGL_NO_SURFACE,
display, configuration, pixmap, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePixmapSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
egl::Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createPixmapSurface(configuration, pixmap, attributes, &surface),
"eglCreatePixmapSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
thread->setSuccess();
return static_cast<EGLSurface>(surface);
}
EGLBoolean EGLAPIENTRY EGL_DestroySurface(EGLDisplay dpy, EGLSurface surface)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroySurface,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)surface);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, DestroySurface, GetSurfaceIfValid(display, eglSurface), EGL_FALSE,
display, eglSurface);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroySurface",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, display->destroySurface(eglSurface), "eglDestroySurface",
GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_QuerySurface(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QuerySurface,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint attribute = %d, EGLint "
"*value = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
const Surface *eglSurface = static_cast<const Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, QuerySurface, GetSurfaceIfValid(display, eglSurface), EGL_FALSE,
display, eglSurface, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQuerySurface",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, QuerySurfaceAttrib(display, eglSurface, attribute, value),
"eglQuerySurface", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLContext EGLAPIENTRY EGL_CreateContext(EGLDisplay dpy,
EGLConfig config,
EGLContext share_context,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateContext,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", EGLContext share_context = %d, "
"const EGLint *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, CID(dpy, share_context), (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
gl::Context *sharedGLContext = static_cast<gl::Context *>(share_context);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateContext, GetDisplayIfValid(display), EGL_NO_CONTEXT, display,
configuration, sharedGLContext, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateContext",
GetDisplayIfValid(display), EGL_NO_CONTEXT);
gl::Context *context = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createContext(configuration, sharedGLContext, thread->getAPI(),
attributes, &context),
"eglCreateContext", GetDisplayIfValid(display), EGL_NO_CONTEXT);
thread->setSuccess();
return static_cast<EGLContext>(context);
}
EGLBoolean EGLAPIENTRY EGL_DestroyContext(EGLDisplay dpy, EGLContext ctx)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroyContext, "EGLDisplay dpy = 0x%016" PRIxPTR ", EGLContext ctx = %d",
(uintptr_t)dpy, CID(dpy, ctx));
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
gl::Context *context = static_cast<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE(thread, DestroyContext, GetContextIfValid(display, context), EGL_FALSE,
display, context);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroyContext",
GetDisplayIfValid(display), EGL_FALSE);
bool contextWasCurrent = context == thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, display->destroyContext(thread, context), "eglDestroyContext",
GetContextIfValid(display, context), EGL_FALSE);
if (contextWasCurrent)
{
ANGLE_EGL_TRY_RETURN(thread, display->makeCurrent(context, nullptr, nullptr, nullptr),
"eglDestroyContext", GetContextIfValid(display, context), EGL_FALSE);
SetContextCurrent(thread, nullptr);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_MakeCurrent(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
EGLContext ctx)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(MakeCurrent,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface draw = 0x%016" PRIxPTR
", EGLSurface read = 0x%016" PRIxPTR
", "
"EGLContext ctx = %d",
(uintptr_t)dpy, (uintptr_t)draw, (uintptr_t)read, CID(dpy, ctx));
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *drawSurface = static_cast<Surface *>(draw);
Surface *readSurface = static_cast<Surface *>(read);
gl::Context *context = static_cast<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE(thread, MakeCurrent, GetContextIfValid(display, context), EGL_FALSE, display,
drawSurface, readSurface, context);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglMakeCurrent",
GetDisplayIfValid(display), EGL_FALSE);
Surface *previousDraw = thread->getCurrentDrawSurface();
Surface *previousRead = thread->getCurrentReadSurface();
gl::Context *previousContext = thread->getContext();
// Only call makeCurrent if the context or surfaces have changed.
if (previousDraw != drawSurface || previousRead != readSurface || previousContext != context)
{
ANGLE_EGL_TRY_RETURN(
thread, display->makeCurrent(previousContext, drawSurface, readSurface, context),
"eglMakeCurrent", GetContextIfValid(display, context), EGL_FALSE);
SetContextCurrent(thread, context);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCurrentSurface, "EGLint readdraw = %d", readdraw);
Thread *thread = egl::GetCurrentThread();
if (readdraw == EGL_READ)
{
thread->setSuccess();
return thread->getCurrentReadSurface();
}
else if (readdraw == EGL_DRAW)
{
thread->setSuccess();
return thread->getCurrentDrawSurface();
}
else
{
thread->setError(EglBadParameter(), "eglGetCurrentSurface", nullptr);
return EGL_NO_SURFACE;
}
}
EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay(void)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCurrentDisplay, "");
Thread *thread = egl::GetCurrentThread();
thread->setSuccess();
if (thread->getContext() != nullptr)
{
return thread->getContext()->getDisplay();
}
return EGL_NO_DISPLAY;
}
EGLBoolean EGLAPIENTRY EGL_QueryContext(EGLDisplay dpy,
EGLContext ctx,
EGLint attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryContext,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLContext ctx = %d"
", EGLint attribute = %d, EGLint *value "
"= 0x%016" PRIxPTR,
(uintptr_t)dpy, CID(dpy, ctx), attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
gl::Context *context = static_cast<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE(thread, QueryContext, GetContextIfValid(display, context), EGL_FALSE,
display, context, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryContext",
GetDisplayIfValid(display), EGL_FALSE);
QueryContextAttrib(context, attribute, value);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_WaitGL(void)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitGL, "");
Thread *thread = egl::GetCurrentThread();
egl::Display *display = thread->getDisplay();
ANGLE_EGL_VALIDATE(thread, WaitGL, GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitGL", GetDisplayIfValid(display),
EGL_FALSE);
// eglWaitGL like calling eglWaitClient with the OpenGL ES API bound. Since we only implement
// OpenGL ES we can do the call directly.
ANGLE_EGL_TRY_RETURN(thread, display->waitClient(thread->getContext()), "eglWaitGL",
GetDisplayIfValid(display), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitNative, "EGLint engine = %d", engine);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, WaitNative, GetThreadIfValid(thread), EGL_FALSE, engine);
egl::Display *display = thread->getDisplay();
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitNative",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, display->waitNative(thread->getContext(), engine), "eglWaitNative",
GetThreadIfValid(thread), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_SwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SwapBuffers,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)surface);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = (Surface *)surface;
ANGLE_EGL_VALIDATE(thread, SwapBuffers, GetSurfaceIfValid(display, eglSurface), EGL_FALSE,
display, eglSurface);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSwapBuffers",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->swap(thread->getContext()), "eglSwapBuffers",
GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_CopyBuffers(EGLDisplay dpy,
EGLSurface surface,
EGLNativePixmapType target)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CopyBuffers,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLNativePixmapType target = "
"0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)target);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, CopyBuffers, GetSurfaceIfValid(display, eglSurface), EGL_FALSE,
display, eglSurface, target);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCopyBuffers",
GetDisplayIfValid(display), EGL_FALSE);
UNIMPLEMENTED(); // FIXME
thread->setSuccess();
return 0;
}
// EGL 1.1
EGLBoolean EGLAPIENTRY EGL_BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(BindTexImage,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint buffer = %d",
(uintptr_t)dpy, (uintptr_t)surface, buffer);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
gl::Context *context = thread->getContext();
ANGLE_EGL_VALIDATE(thread, BindTexImage, GetSurfaceIfValid(display, eglSurface), EGL_FALSE,
display, eglSurface, buffer);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglBindTexImage",
GetDisplayIfValid(display), EGL_FALSE);
if (context)
{
gl::TextureType type =
egl_gl::EGLTextureTargetToTextureType(eglSurface->getTextureTarget());
gl::Texture *textureObject = context->getTextureByType(type);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->bindTexImage(context, textureObject, buffer),
"eglBindTexImage", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_SurfaceAttrib(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
EGLint value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SurfaceAttrib,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint attribute = %d, EGLint "
"value = %d",
(uintptr_t)dpy, (uintptr_t)surface, attribute, value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, SurfaceAttrib, GetSurfaceIfValid(display, eglSurface), EGL_FALSE,
display, eglSurface, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSurfaceAttrib",
GetDisplayIfValid(display), EGL_FALSE);
SetSurfaceAttrib(eglSurface, attribute, value);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReleaseTexImage,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint buffer = %d",
(uintptr_t)dpy, (uintptr_t)surface, buffer);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, ReleaseTexImage, GetSurfaceIfValid(display, eglSurface), EGL_FALSE,
display, eglSurface, buffer);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglReleaseTexImage",
GetDisplayIfValid(display), EGL_FALSE);
gl::Texture *texture = eglSurface->getBoundTexture();
if (texture)
{
ANGLE_EGL_TRY_RETURN(thread, eglSurface->releaseTexImage(thread->getContext(), buffer),
"eglReleaseTexImage", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_SwapInterval(EGLDisplay dpy, EGLint interval)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SwapInterval, "EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint interval = %d",
(uintptr_t)dpy, interval);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *draw_surface = static_cast<Surface *>(thread->getCurrentDrawSurface());
ANGLE_EGL_VALIDATE(thread, SwapInterval, GetDisplayIfValid(display), EGL_FALSE, display,
interval);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSwapInterval",
GetDisplayIfValid(display), EGL_FALSE);
const egl::Config *surfaceConfig = draw_surface->getConfig();
EGLint clampedInterval = std::min(std::max(interval, surfaceConfig->minSwapInterval),
surfaceConfig->maxSwapInterval);
draw_surface->setSwapInterval(clampedInterval);
thread->setSuccess();
return EGL_TRUE;
}
// EGL 1.2
EGLBoolean EGLAPIENTRY EGL_BindAPI(EGLenum api)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(BindAPI, "EGLenum api = 0x%X", api);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, BindAPI, GetThreadIfValid(thread), EGL_FALSE, api);
thread->setAPI(api);
thread->setSuccess();
return EGL_TRUE;
}
EGLenum EGLAPIENTRY EGL_QueryAPI(void)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryAPI, "");
Thread *thread = egl::GetCurrentThread();
EGLenum API = thread->getAPI();
thread->setSuccess();
return API;
}
EGLSurface EGLAPIENTRY EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,
EGLenum buftype,
EGLClientBuffer buffer,
EGLConfig config,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePbufferFromClientBuffer,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%016" PRIxPTR
", "
"EGLConfig config = 0x%016" PRIxPTR ", const EGLint *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, buftype, (uintptr_t)buffer, (uintptr_t)config,
(uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePbufferFromClientBuffer, GetDisplayIfValid(display),
EGL_NO_SURFACE, display, buftype, buffer, configuration, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePbufferFromClientBuffer",
GetDisplayIfValid(display), EGL_NO_SURFACE);
egl::Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createPbufferFromClientBuffer(configuration, buftype, buffer,
attributes, &surface),
"eglCreatePbufferFromClientBuffer", GetDisplayIfValid(display),
EGL_NO_SURFACE);
return static_cast<EGLSurface>(surface);
}
EGLBoolean EGLAPIENTRY EGL_ReleaseThread(void)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReleaseThread, "");
Thread *thread = egl::GetCurrentThread();
Surface *previousDraw = thread->getCurrentDrawSurface();
Surface *previousRead = thread->getCurrentReadSurface();
gl::Context *previousContext = thread->getContext();
egl::Display *previousDisplay = thread->getDisplay();
if (previousDisplay != EGL_NO_DISPLAY)
{
ANGLE_EGL_TRY_RETURN(thread, previousDisplay->prepareForCall(), "eglReleaseThread",
GetDisplayIfValid(previousDisplay), EGL_FALSE);
// Only call makeCurrent if the context or surfaces have changed.
if (previousDraw != EGL_NO_SURFACE || previousRead != EGL_NO_SURFACE ||
previousContext != EGL_NO_CONTEXT)
{
ANGLE_EGL_TRY_RETURN(
thread, previousDisplay->makeCurrent(previousContext, nullptr, nullptr, nullptr),
"eglReleaseThread", nullptr, EGL_FALSE);
}
ANGLE_EGL_TRY_RETURN(thread, previousDisplay->releaseThread(), "eglReleaseThread",
GetDisplayIfValid(previousDisplay), EGL_FALSE);
SetContextCurrent(thread, nullptr);
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_WaitClient(void)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitClient, "");
Thread *thread = egl::GetCurrentThread();
egl::Display *display = thread->getDisplay();
gl::Context *context = thread->getContext();
ANGLE_EGL_VALIDATE(thread, Display, GetContextIfValid(display, context), EGL_FALSE, display);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitClient",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, display->waitClient(context), "eglWaitClient",
GetContextIfValid(display, context), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
// EGL 1.4
EGLContext EGLAPIENTRY EGL_GetCurrentContext(void)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCurrentContext, "");
Thread *thread = egl::GetCurrentThread();
gl::Context *context = thread->getContext();
thread->setSuccess();
return static_cast<EGLContext>(context);
}
// EGL 1.5
EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateSync,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLenum type = 0x%X, const EGLint* attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, type, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
gl::Context *currentContext = thread->getContext();
ANGLE_EGL_VALIDATE(thread, CreateSync, GetDisplayIfValid(display), EGL_NO_SYNC, display, type,
attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateSync",
GetDisplayIfValid(display), EGL_FALSE);
egl::Sync *syncObject = nullptr;
ANGLE_EGL_TRY_RETURN(thread, display->createSync(currentContext, type, attributes, &syncObject),
"eglCreateSync", GetDisplayIfValid(display), EGL_NO_SYNC);
thread->setSuccess();
return static_cast<EGLSync>(syncObject);
}
EGLBoolean EGLAPIENTRY EGL_DestroySync(EGLDisplay dpy, EGLSync sync)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroySync, "EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)sync);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, DestroySync, GetDisplayIfValid(display), EGL_FALSE, display,
syncObject);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroySync",
GetDisplayIfValid(display), EGL_FALSE);
display->destroySync(syncObject);
thread->setSuccess();
return EGL_TRUE;
}
EGLint EGLAPIENTRY EGL_ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ClientWaitSync,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
", EGLint flags = 0x%X, EGLTime timeout = "
"%llu",
(uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, ClientWaitSync, GetSyncIfValid(display, syncObject), EGL_FALSE,
display, syncObject, flags, timeout);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglClientWaitSync",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
EGLint syncStatus = EGL_FALSE;
ANGLE_EGL_TRY_RETURN(
thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
"eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return syncStatus;
}
EGLBoolean EGLAPIENTRY EGL_GetSyncAttrib(EGLDisplay dpy,
EGLSync sync,
EGLint attribute,
EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetSyncAttrib,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
", EGLint attribute = 0x%X, EGLAttrib "
"*value = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, GetSyncAttrib, GetSyncIfValid(display, syncObject), EGL_FALSE,
display, syncObject, attribute, value);
EGLint valueExt;
ANGLE_EGL_TRY_RETURN(thread, GetSyncAttrib(display, syncObject, attribute, &valueExt),
"eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
*value = valueExt;
thread->setSuccess();
return EGL_TRUE;
}
EGLImage EGLAPIENTRY EGL_CreateImage(EGLDisplay dpy,
EGLContext ctx,
EGLenum target,
EGLClientBuffer buffer,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateImage,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLContext ctx = %d"
", EGLenum target = 0x%X, "
"EGLClientBuffer buffer = 0x%016" PRIxPTR
", const EGLAttrib *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, CID(dpy, ctx), target, (uintptr_t)buffer, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
gl::Context *context = static_cast<gl::Context *>(ctx);
AttributeMap attributes = AttributeMap::CreateFromIntArray((const EGLint *)attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateImage, GetDisplayIfValid(display), EGL_FALSE, display, context,
target, buffer, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateImage",
GetDisplayIfValid(display), EGL_FALSE);
Image *image = nullptr;
Error error = display->createImage(context, target, buffer, attributes, &image);
if (error.isError())
{
thread->setError(error, "eglCreateImage", GetDisplayIfValid(display));
return EGL_NO_IMAGE;
}
thread->setSuccess();
return static_cast<EGLImage>(image);
}
EGLBoolean EGLAPIENTRY EGL_DestroyImage(EGLDisplay dpy, EGLImage image)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroyImage, "EGLDisplay dpy = 0x%016" PRIxPTR ", EGLImage image = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)image);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Image *img = static_cast<Image *>(image);
ANGLE_EGL_VALIDATE(thread, DestroyImage, GetImageIfValid(display, img), EGL_FALSE, display,
img);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroyImage",
GetDisplayIfValid(display), EGL_FALSE);
display->destroyImage(img);
thread->setSuccess();
return EGL_TRUE;
}
EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplay(EGLenum platform,
void *native_display,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetPlatformDisplay,
"EGLenum platform = %d, void* native_display = 0x%016" PRIxPTR
", const EGLint* attrib_list = "
"0x%016" PRIxPTR,
platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
const egl::AttributeMap &attribMap = AttributeMap::CreateFromAttribArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, GetPlatformDisplay, GetThreadIfValid(thread), EGL_NO_DISPLAY,
platform, native_display, attribMap);
if (platform == EGL_PLATFORM_ANGLE_ANGLE)
{
return egl::Display::GetDisplayFromNativeDisplay(
gl::bitCast<EGLNativeDisplayType>(native_display), attribMap);
}
else if (platform == EGL_PLATFORM_DEVICE_EXT)
{
Device *eglDevice = static_cast<Device *>(native_display);
return egl::Display::GetDisplayFromDevice(eglDevice, attribMap);
}
else
{
UNREACHABLE();
return EGL_NO_DISPLAY;
}
}
EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurface(EGLDisplay dpy,
EGLConfig config,
void *native_window,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePlatformWindowSurface,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", void* native_window = 0x%016" PRIxPTR
", "
"const EGLint* attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
// Use reinterpret_cast since native_window could be a pointer or an actual value.
EGLNativeWindowType win = reinterpret_cast<EGLNativeWindowType>(native_window);
AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurface, GetDisplayIfValid(display),
EGL_NO_SURFACE, display, configuration, win, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateWindowSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
egl::Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(
thread, display->createWindowSurface(configuration, win, attributes, &surface),
"eglPlatformCreateWindowSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
return static_cast<EGLSurface>(surface);
}
EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,
EGLConfig config,
void *native_pixmap,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePlatformPixmapSurface,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", void* native_pixmap = 0x%016" PRIxPTR
", "
"const EGLint* attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
// Use reinterpret_cast since native_window could be a pointer or an actual value.
EGLNativePixmapType pixmap = reinterpret_cast<EGLNativePixmapType>(native_pixmap);
AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurface, GetDisplayIfValid(display),
EGL_NO_SURFACE, display, configuration, pixmap, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePlatformPixmapSurface",
GetDisplayIfValid(display), EGL_NO_SURFACE);
egl::Surface *surface = nullptr;
ANGLE_EGL_TRY_RETURN(
thread, display->createPixmapSurface(configuration, pixmap, attributes, &surface),
"eglCreatePlatformPixmapSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
thread->setSuccess();
return static_cast<EGLSurface>(surface);
}
EGLBoolean EGLAPIENTRY EGL_WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitSync,
"EGLDisplay dpy =0x%016" PRIxPTR "p, EGLSync sync = 0x%016" PRIxPTR
", EGLint flags = 0x%X",
(uintptr_t)dpy, (uintptr_t)sync, flags);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, WaitSync, GetSyncIfValid(display, syncObject), EGL_FALSE, display,
syncObject, flags);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitSync",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, syncObject->serverWait(display, currentContext, flags),
"eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
__eglMustCastToProperFunctionPointerType EGLAPIENTRY EGL_GetProcAddress(const char *procname)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetProcAddress, "const char *procname = \"%s\"", procname);
Thread *thread = egl::GetCurrentThread();
const ProcEntry *entry =
std::lower_bound(&g_procTable[0], &g_procTable[g_numProcs], procname, CompareProc);
thread->setSuccess();
if (entry == &g_procTable[g_numProcs] || strcmp(entry->first, procname) != 0)
{
return nullptr;
}
return entry->second;
}
} // extern "C"
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_entry_points.py using data from egl.xml.
//
// Copyright 2020 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.
//
// entry_points_egl_autogen.cpp:
// Defines the EGL entry points.
#include "libGLESv2/entry_points_egl_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/validationEGL_autogen.h"
#include "libGLESv2/egl_stubs_autogen.h"
#include "libGLESv2/global_state.h"
using namespace egl;
extern "C" {
// EGL 1.0
EGLBoolean EGLAPIENTRY EGL_ChooseConfig(EGLDisplay dpy,
const EGLint *attrib_list,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ChooseConfig,
"dpy = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR ", configs = 0x%016" PRIxPTR
", config_size = %d, num_config = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)attrib_list, (uintptr_t)configs, config_size,
(uintptr_t)num_config);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, ChooseConfig, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
attrib_listPacked, configs, config_size, num_config);
return ChooseConfig(thread, dpyPacked, attrib_listPacked, configs, config_size, num_config);
}
EGLBoolean EGLAPIENTRY EGL_CopyBuffers(EGLDisplay dpy,
EGLSurface surface,
EGLNativePixmapType target)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CopyBuffers,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", target = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)target);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, CopyBuffers, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked, target);
return CopyBuffers(thread, dpyPacked, surfacePacked, target);
}
EGLContext EGLAPIENTRY EGL_CreateContext(EGLDisplay dpy,
EGLConfig config,
EGLContext share_context,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateContext,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", share_context = 0x%016" PRIxPTR
", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)share_context, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
gl::Context *share_contextPacked = PackParam<gl::Context *>(share_context);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateContext, GetDisplayIfValid(dpyPacked), EGLContext, dpyPacked,
configPacked, share_contextPacked, attrib_listPacked);
return CreateContext(thread, dpyPacked, configPacked, share_contextPacked, attrib_listPacked);
}
EGLSurface EGLAPIENTRY EGL_CreatePbufferSurface(EGLDisplay dpy,
EGLConfig config,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePbufferSurface,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
"",
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePbufferSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
dpyPacked, configPacked, attrib_listPacked);
return CreatePbufferSurface(thread, dpyPacked, configPacked, attrib_listPacked);
}
EGLSurface EGLAPIENTRY EGL_CreatePixmapSurface(EGLDisplay dpy,
EGLConfig config,
EGLNativePixmapType pixmap,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePixmapSurface,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", pixmap = 0x%016" PRIxPTR
", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)pixmap, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePixmapSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
dpyPacked, configPacked, pixmap, attrib_listPacked);
return CreatePixmapSurface(thread, dpyPacked, configPacked, pixmap, attrib_listPacked);
}
EGLSurface EGLAPIENTRY EGL_CreateWindowSurface(EGLDisplay dpy,
EGLConfig config,
EGLNativeWindowType win,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateWindowSurface,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", win = 0x%016" PRIxPTR
", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)win, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateWindowSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
dpyPacked, configPacked, win, attrib_listPacked);
return CreateWindowSurface(thread, dpyPacked, configPacked, win, attrib_listPacked);
}
EGLBoolean EGLAPIENTRY EGL_DestroyContext(EGLDisplay dpy, EGLContext ctx)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroyContext, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "", (uintptr_t)dpy,
(uintptr_t)ctx);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
gl::Context *ctxPacked = PackParam<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE(thread, DestroyContext, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
ctxPacked);
return DestroyContext(thread, dpyPacked, ctxPacked);
}
EGLBoolean EGLAPIENTRY EGL_DestroySurface(EGLDisplay dpy, EGLSurface surface)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroySurface, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, DestroySurface, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked);
return DestroySurface(thread, dpyPacked, surfacePacked);
}
EGLBoolean EGLAPIENTRY EGL_GetConfigAttrib(EGLDisplay dpy,
EGLConfig config,
EGLint attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetConfigAttrib,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
", attribute = %d, value = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)config, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
ANGLE_EGL_VALIDATE(thread, GetConfigAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
configPacked, attribute, value);
return GetConfigAttrib(thread, dpyPacked, configPacked, attribute, value);
}
EGLBoolean EGLAPIENTRY EGL_GetConfigs(EGLDisplay dpy,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetConfigs,
"dpy = 0x%016" PRIxPTR ", configs = 0x%016" PRIxPTR
", config_size = %d, num_config = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)configs, config_size, (uintptr_t)num_config);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, GetConfigs, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
configs, config_size, num_config);
return GetConfigs(thread, dpyPacked, configs, config_size, num_config);
}
EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay()
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCurrentDisplay, "");
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetCurrentDisplay, nullptr, EGLDisplay);
return GetCurrentDisplay(thread);
}
EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCurrentSurface, "readdraw = %d", readdraw);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetCurrentSurface, nullptr, EGLSurface, readdraw);
return GetCurrentSurface(thread, readdraw);
}
EGLDisplay EGLAPIENTRY EGL_GetDisplay(EGLNativeDisplayType display_id)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetDisplay, "display_id = 0x%016" PRIxPTR "", (uintptr_t)display_id);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetDisplay, nullptr, EGLDisplay, display_id);
return GetDisplay(thread, display_id);
}
EGLint EGLAPIENTRY EGL_GetError()
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetError, "");
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetError, nullptr, EGLint);
return GetError(thread);
}
__eglMustCastToProperFunctionPointerType EGLAPIENTRY EGL_GetProcAddress(const char *procname)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetProcAddress, "procname = 0x%016" PRIxPTR "", (uintptr_t)procname);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetProcAddress, nullptr, __eglMustCastToProperFunctionPointerType,
procname);
return GetProcAddress(thread, procname);
}
EGLBoolean EGLAPIENTRY EGL_Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(Initialize,
"dpy = 0x%016" PRIxPTR ", major = 0x%016" PRIxPTR ", minor = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)major, (uintptr_t)minor);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, Initialize, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
major, minor);
return Initialize(thread, dpyPacked, major, minor);
}
EGLBoolean EGLAPIENTRY EGL_MakeCurrent(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
EGLContext ctx)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(MakeCurrent,
"dpy = 0x%016" PRIxPTR ", draw = 0x%016" PRIxPTR ", read = 0x%016" PRIxPTR
", ctx = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)draw, (uintptr_t)read, (uintptr_t)ctx);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *drawPacked = PackParam<Surface *>(draw);
Surface *readPacked = PackParam<Surface *>(read);
gl::Context *ctxPacked = PackParam<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE(thread, MakeCurrent, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
drawPacked, readPacked, ctxPacked);
return MakeCurrent(thread, dpyPacked, drawPacked, readPacked, ctxPacked);
}
EGLBoolean EGLAPIENTRY EGL_QueryContext(EGLDisplay dpy,
EGLContext ctx,
EGLint attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryContext,
"dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
", attribute = %d, value = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)ctx, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
gl::Context *ctxPacked = PackParam<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE(thread, QueryContext, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
ctxPacked, attribute, value);
return QueryContext(thread, dpyPacked, ctxPacked, attribute, value);
}
const char *EGLAPIENTRY EGL_QueryString(EGLDisplay dpy, EGLint name)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryString, "dpy = 0x%016" PRIxPTR ", name = %d", (uintptr_t)dpy, name);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, QueryString, GetDisplayIfValid(dpyPacked), const char *, dpyPacked,
name);
return QueryString(thread, dpyPacked, name);
}
EGLBoolean EGLAPIENTRY EGL_QuerySurface(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QuerySurface,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
", attribute = %d, value = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, QuerySurface, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked, attribute, value);
return QuerySurface(thread, dpyPacked, surfacePacked, attribute, value);
}
EGLBoolean EGLAPIENTRY EGL_SwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SwapBuffers, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "", (uintptr_t)dpy,
(uintptr_t)surface);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, SwapBuffers, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked);
return SwapBuffers(thread, dpyPacked, surfacePacked);
}
EGLBoolean EGLAPIENTRY EGL_Terminate(EGLDisplay dpy)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(Terminate, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, Terminate, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked);
return Terminate(thread, dpyPacked);
}
EGLBoolean EGLAPIENTRY EGL_WaitGL()
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitGL, "");
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, WaitGL, nullptr, EGLBoolean);
return WaitGL(thread);
}
EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitNative, "engine = %d", engine);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, WaitNative, nullptr, EGLBoolean, engine);
return WaitNative(thread, engine);
}
// EGL 1.1
EGLBoolean EGLAPIENTRY EGL_BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(BindTexImage, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", buffer = %d",
(uintptr_t)dpy, (uintptr_t)surface, buffer);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, BindTexImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked, buffer);
return BindTexImage(thread, dpyPacked, surfacePacked, buffer);
}
EGLBoolean EGLAPIENTRY EGL_ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReleaseTexImage, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", buffer = %d",
(uintptr_t)dpy, (uintptr_t)surface, buffer);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, ReleaseTexImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked, buffer);
return ReleaseTexImage(thread, dpyPacked, surfacePacked, buffer);
}
EGLBoolean EGLAPIENTRY EGL_SurfaceAttrib(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
EGLint value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SurfaceAttrib,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", attribute = %d, value = %d",
(uintptr_t)dpy, (uintptr_t)surface, attribute, value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, SurfaceAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked, attribute, value);
return SurfaceAttrib(thread, dpyPacked, surfacePacked, attribute, value);
}
EGLBoolean EGLAPIENTRY EGL_SwapInterval(EGLDisplay dpy, EGLint interval)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SwapInterval, "dpy = 0x%016" PRIxPTR ", interval = %d", (uintptr_t)dpy, interval);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, SwapInterval, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
interval);
return SwapInterval(thread, dpyPacked, interval);
}
// EGL 1.2
EGLBoolean EGLAPIENTRY EGL_BindAPI(EGLenum api)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(BindAPI, "api = 0x%X", api);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, BindAPI, nullptr, EGLBoolean, api);
return BindAPI(thread, api);
}
EGLSurface EGLAPIENTRY EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,
EGLenum buftype,
EGLClientBuffer buffer,
EGLConfig config,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePbufferFromClientBuffer,
"dpy = 0x%016" PRIxPTR ", buftype = 0x%X, buffer = 0x%016" PRIxPTR
", config = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, buftype, (uintptr_t)buffer, (uintptr_t)config,
(uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePbufferFromClientBuffer, GetDisplayIfValid(dpyPacked),
EGLSurface, dpyPacked, buftype, buffer, configPacked, attrib_listPacked);
return CreatePbufferFromClientBuffer(thread, dpyPacked, buftype, buffer, configPacked,
attrib_listPacked);
}
EGLenum EGLAPIENTRY EGL_QueryAPI()
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryAPI, "");
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, QueryAPI, nullptr, EGLenum);
return QueryAPI(thread);
}
EGLBoolean EGLAPIENTRY EGL_ReleaseThread()
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReleaseThread, "");
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, ReleaseThread, nullptr, EGLBoolean);
return ReleaseThread(thread);
}
EGLBoolean EGLAPIENTRY EGL_WaitClient()
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitClient, "");
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, WaitClient, nullptr, EGLBoolean);
return WaitClient(thread);
}
// EGL 1.4
EGLContext EGLAPIENTRY EGL_GetCurrentContext()
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCurrentContext, "");
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetCurrentContext, nullptr, EGLContext);
return GetCurrentContext(thread);
}
// EGL 1.5
EGLint EGLAPIENTRY EGL_ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ClientWaitSync,
"dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d, timeout = %llu",
(uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, ClientWaitSync, GetDisplayIfValid(dpyPacked), EGLint, dpyPacked,
syncPacked, flags, timeout);
return ClientWaitSync(thread, dpyPacked, syncPacked, flags, timeout);
}
EGLImage EGLAPIENTRY EGL_CreateImage(EGLDisplay dpy,
EGLContext ctx,
EGLenum target,
EGLClientBuffer buffer,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateImage,
"dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
", target = 0x%X, buffer = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
gl::Context *ctxPacked = PackParam<gl::Context *>(ctx);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateImage, GetDisplayIfValid(dpyPacked), EGLImage, dpyPacked,
ctxPacked, target, buffer, attrib_listPacked);
return CreateImage(thread, dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
}
EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,
EGLConfig config,
void *native_pixmap,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePlatformPixmapSurface,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", native_pixmap = 0x%016" PRIxPTR
", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurface, GetDisplayIfValid(dpyPacked),
EGLSurface, dpyPacked, configPacked, native_pixmap, attrib_listPacked);
return CreatePlatformPixmapSurface(thread, dpyPacked, configPacked, native_pixmap,
attrib_listPacked);
}
EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurface(EGLDisplay dpy,
EGLConfig config,
void *native_window,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePlatformWindowSurface,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", native_window = 0x%016" PRIxPTR
", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurface, GetDisplayIfValid(dpyPacked),
EGLSurface, dpyPacked, configPacked, native_window, attrib_listPacked);
return CreatePlatformWindowSurface(thread, dpyPacked, configPacked, native_window,
attrib_listPacked);
}
EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateSync, "dpy = 0x%016" PRIxPTR ", type = 0x%X, attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, type, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateSync, GetDisplayIfValid(dpyPacked), EGLSync, dpyPacked, type,
attrib_listPacked);
return CreateSync(thread, dpyPacked, type, attrib_listPacked);
}
EGLBoolean EGLAPIENTRY EGL_DestroyImage(EGLDisplay dpy, EGLImage image)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroyImage, "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR "", (uintptr_t)dpy,
(uintptr_t)image);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Image *imagePacked = PackParam<Image *>(image);
ANGLE_EGL_VALIDATE(thread, DestroyImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
imagePacked);
return DestroyImage(thread, dpyPacked, imagePacked);
}
EGLBoolean EGLAPIENTRY EGL_DestroySync(EGLDisplay dpy, EGLSync sync)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroySync, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "", (uintptr_t)dpy,
(uintptr_t)sync);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, DestroySync, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
syncPacked);
return DestroySync(thread, dpyPacked, syncPacked);
}
EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplay(EGLenum platform,
void *native_display,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetPlatformDisplay,
"platform = 0x%X, native_display = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
"",
platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, GetPlatformDisplay, nullptr, EGLDisplay, platform, native_display,
attrib_listPacked);
return GetPlatformDisplay(thread, platform, native_display, attrib_listPacked);
}
EGLBoolean EGLAPIENTRY EGL_GetSyncAttrib(EGLDisplay dpy,
EGLSync sync,
EGLint attribute,
EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetSyncAttrib,
"dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR
", attribute = %d, value = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, GetSyncAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
syncPacked, attribute, value);
return GetSyncAttrib(thread, dpyPacked, syncPacked, attribute, value);
}
EGLBoolean EGLAPIENTRY EGL_WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitSync, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d",
(uintptr_t)dpy, (uintptr_t)sync, flags);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, WaitSync, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
syncPacked, flags);
return WaitSync(thread, dpyPacked, syncPacked, flags);
}
} // extern "C"
//
// Copyright 2014 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.
//
// entry_points_ext.cpp : Implements the EGL extension entry points.
#include "libGLESv2/entry_points_egl_ext_autogen.h"
#include "common/debug.h"
#include "libANGLE/Context.h"
#include "libANGLE/Device.h"
#include "libANGLE/Display.h"
#include "libANGLE/EGLSync.h"
#include "libANGLE/Stream.h"
#include "libANGLE/Surface.h"
#include "libANGLE/Thread.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/queryutils.h"
#include "libANGLE/validationEGL.h"
#include "libANGLE/validationEGL_autogen.h"
#include "libGLESv2/global_state.h"
using namespace egl;
extern "C" {
// EGL_ANGLE_query_surface_pointer
EGLBoolean EGLAPIENTRY EGL_QuerySurfacePointerANGLE(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
void **value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QuerySurfacePointerANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint attribute = %d, void "
"**value = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, QuerySurfacePointerANGLE, GetDisplayIfValid(display), EGL_FALSE,
display, eglSurface, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQuerySurfacePointerANGLE",
GetDisplayIfValid(display), EGL_FALSE);
Error error = eglSurface->querySurfacePointerANGLE(attribute, value);
if (error.isError())
{
thread->setError(error, "eglQuerySurfacePointerANGLE",
GetSurfaceIfValid(display, eglSurface));
return EGL_FALSE;
}
thread->setSuccess();
return EGL_TRUE;
}
// EGL_NV_post_sub_buffer
EGLBoolean EGLAPIENTRY EGL_PostSubBufferNV(EGLDisplay dpy,
EGLSurface surface,
EGLint x,
EGLint y,
EGLint width,
EGLint height)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(PostSubBufferNV,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint x = %d, EGLint y = %d, "
"EGLint width = %d, EGLint height = %d",
(uintptr_t)dpy, (uintptr_t)surface, x, y, width, height);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, PostSubBufferNV, GetDisplayIfValid(display), EGL_FALSE, display,
eglSurface, x, y, width, height);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglPostSubBufferNV",
GetDisplayIfValid(display), EGL_FALSE);
Error error = eglSurface->postSubBuffer(thread->getContext(), x, y, width, height);
if (error.isError())
{
thread->setError(error, "eglPostSubBufferNV", GetSurfaceIfValid(display, eglSurface));
return EGL_FALSE;
}
thread->setSuccess();
return EGL_TRUE;
}
// EGL_EXT_platform_base
EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplayEXT(EGLenum platform,
void *native_display,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetPlatformDisplayEXT,
"EGLenum platform = %d, void* native_display = 0x%016" PRIxPTR
", const EGLint* attrib_list = "
"0x%016" PRIxPTR,
platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
const auto &attribMap = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, GetPlatformDisplayEXT, GetThreadIfValid(thread), EGL_NO_DISPLAY,
platform, native_display, attribMap);
if (platform == EGL_PLATFORM_ANGLE_ANGLE)
{
return egl::Display::GetDisplayFromNativeDisplay(
gl::bitCast<EGLNativeDisplayType>(native_display), attribMap);
}
else if (platform == EGL_PLATFORM_DEVICE_EXT)
{
Device *eglDevice = static_cast<Device *>(native_display);
return egl::Display::GetDisplayFromDevice(eglDevice, attribMap);
}
else
{
UNREACHABLE();
return EGL_NO_DISPLAY;
}
}
EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
EGLConfig config,
void *native_window,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePlatformWindowSurfaceEXT,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", void *native_window = 0x%016" PRIxPTR
", "
"const EGLint *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
EGLNativeWindowType win = reinterpret_cast<EGLNativeWindowType>(native_window);
ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurfaceEXT, GetDisplayIfValid(display),
EGL_NO_SURFACE, display, configuration, win, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePlatformWindowSurfaceEXT",
GetDisplayIfValid(display), EGL_NO_SURFACE);
thread->setError(EGL_BAD_DISPLAY, "eglCreatePlatformWindowSurfaceEXT",
GetDisplayIfValid(display), "CreatePlatformWindowSurfaceEXT unimplemented.");
return EGL_NO_SURFACE;
}
EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
EGLConfig config,
void *native_pixmap,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePlatformPixmapSurfaceEXT,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
", void *native_pixmap = 0x%016" PRIxPTR
", "
"const EGLint *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Config *configuration = static_cast<Config *>(config);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
EGLNativePixmapType pixmap = reinterpret_cast<EGLNativePixmapType>(native_pixmap);
ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurfaceEXT, GetDisplayIfValid(display),
EGL_NO_SURFACE, display, configuration, pixmap, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreatePlatformPixmapSurfaceEXT",
GetDisplayIfValid(display), EGL_NO_SURFACE);
thread->setError(EGL_BAD_DISPLAY, "eglCreatePlatformPixmapSurfaceEXT",
GetDisplayIfValid(display), "CreatePlatformPixmapSurfaceEXT unimplemented.");
return EGL_NO_SURFACE;
}
// EGL_EXT_device_query
EGLBoolean EGLAPIENTRY EGL_QueryDeviceAttribEXT(EGLDeviceEXT device,
EGLint attribute,
EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDeviceAttribEXT,
"EGLDeviceEXT device = 0x%016" PRIxPTR
", EGLint attribute = %d, EGLAttrib *value = 0x%016" PRIxPTR,
(uintptr_t)device, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Device *dev = static_cast<Device *>(device);
ANGLE_EGL_VALIDATE(thread, QueryDeviceAttribEXT, GetDeviceIfValid(dev), EGL_FALSE, dev,
attribute, value);
ANGLE_EGL_TRY_RETURN(thread, dev->getAttribute(attribute, value), "eglQueryDeviceAttribEXT",
GetDeviceIfValid(dev), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
// EGL_EXT_device_query
const char *EGLAPIENTRY EGL_QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDeviceStringEXT, "EGLDeviceEXT device = 0x%016" PRIxPTR ", EGLint name = %d",
(uintptr_t)device, name);
Thread *thread = egl::GetCurrentThread();
Device *dev = static_cast<Device *>(device);
ANGLE_EGL_VALIDATE(thread, QueryDeviceStringEXT, GetDeviceIfValid(dev), EGL_FALSE, dev, name);
egl::Display *owningDisplay = dev->getOwningDisplay();
ANGLE_EGL_TRY_RETURN(thread, owningDisplay->prepareForCall(), "eglQueryDeviceStringEXT",
GetDisplayIfValid(owningDisplay), EGL_FALSE);
const char *result;
switch (name)
{
case EGL_EXTENSIONS:
result = dev->getExtensionString().c_str();
break;
default:
thread->setError(EglBadDevice(), "eglQueryDeviceStringEXT", GetDeviceIfValid(dev));
return nullptr;
}
thread->setSuccess();
return result;
}
// EGL_EXT_device_query
EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDisplayAttribEXT,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLint attribute = %d, EGLAttrib *value = 0x%016" PRIxPTR,
(uintptr_t)dpy, attribute, (uintptr_t)value);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, QueryDisplayAttribEXT, GetDisplayIfValid(display), EGL_FALSE,
display, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryDisplayAttribEXT",
GetDisplayIfValid(display), EGL_FALSE);
*value = display->queryAttrib(attribute);
thread->setSuccess();
return EGL_TRUE;
}
// EGL_ANGLE_feature_control
EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribANGLE(EGLDisplay dpy,
EGLint attribute,
EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDisplayAttribANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLint attribute = %d, EGLAttrib *value = 0x%016" PRIxPTR,
(uintptr_t)dpy, attribute, (uintptr_t)value);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, QueryDisplayAttribANGLE, GetDisplayIfValid(display), EGL_FALSE,
display, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryDisplayAttribANGLE",
GetDisplayIfValid(display), EGL_FALSE);
*value = display->queryAttrib(attribute);
thread->setSuccess();
return EGL_TRUE;
}
ANGLE_EXPORT EGLImageKHR EGLAPIENTRY EGL_CreateImageKHR(EGLDisplay dpy,
EGLContext ctx,
EGLenum target,
EGLClientBuffer buffer,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateImageKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLContext ctx = %d"
", EGLenum target = 0x%X, "
"EGLClientBuffer buffer = 0x%016" PRIxPTR
", const EGLAttrib *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, CID(dpy, ctx), target, (uintptr_t)buffer, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
gl::Context *context = static_cast<gl::Context *>(ctx);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateImageKHR, GetDisplayIfValid(display), EGL_NO_IMAGE, display,
context, target, buffer, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateImageKHR",
GetDisplayIfValid(display), EGL_NO_IMAGE);
Image *image = nullptr;
ANGLE_EGL_TRY_RETURN(thread, display->createImage(context, target, buffer, attributes, &image),
"", GetDisplayIfValid(display), EGL_NO_IMAGE);
thread->setSuccess();
return static_cast<EGLImage>(image);
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroyImageKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLImage image = 0x%016" PRIxPTR, (uintptr_t)dpy,
(uintptr_t)image);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Image *img = static_cast<Image *>(image);
ANGLE_EGL_VALIDATE(thread, DestroyImageKHR, GetImageIfValid(display, img), EGL_FALSE, display,
img);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroyImageKHR",
GetDisplayIfValid(display), EGL_FALSE);
display->destroyImage(img);
thread->setSuccess();
return EGL_TRUE;
}
ANGLE_EXPORT EGLDeviceEXT EGLAPIENTRY EGL_CreateDeviceANGLE(EGLint device_type,
void *native_device,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateDeviceANGLE,
"EGLint device_type = %d, void* native_device = 0x%016" PRIxPTR
", const EGLAttrib* attrib_list = "
"0x%016" PRIxPTR,
device_type, (uintptr_t)native_device, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, CreateDeviceANGLE, GetThreadIfValid(thread), EGL_NO_DEVICE_EXT,
device_type, native_device, attrib_list);
Device *device = nullptr;
ANGLE_EGL_TRY_RETURN(thread, Device::CreateDevice(device_type, native_device, &device),
"eglCreateDeviceANGLE", GetThreadIfValid(thread), EGL_NO_DEVICE_EXT);
thread->setSuccess();
return device;
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_ReleaseDeviceANGLE(EGLDeviceEXT device)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReleaseDeviceANGLE, "EGLDeviceEXT device = 0x%016" PRIxPTR, (uintptr_t)device);
Thread *thread = egl::GetCurrentThread();
Device *dev = static_cast<Device *>(device);
ANGLE_EGL_VALIDATE(thread, ReleaseDeviceANGLE, GetDeviceIfValid(dev), EGL_FALSE, dev);
SafeDelete(dev);
thread->setSuccess();
return EGL_TRUE;
}
// EGL_KHR_stream
EGLStreamKHR EGLAPIENTRY EGL_CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateStreamKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", const EGLAttrib* attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateStreamKHR, GetDisplayIfValid(display), EGL_NO_STREAM_KHR,
display, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateStreamKHR",
GetDisplayIfValid(display), EGL_NO_STREAM_KHR);
Stream *stream;
ANGLE_EGL_TRY_RETURN(thread, display->createStream(attributes, &stream), "eglCreateStreamKHR",
GetDisplayIfValid(display), EGL_NO_STREAM_KHR);
thread->setSuccess();
return static_cast<EGLStreamKHR>(stream);
}
EGLBoolean EGLAPIENTRY EGL_DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroyStreamKHR, "EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)stream);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, DestroyStreamKHR, GetStreamIfValid(display, streamObject), EGL_FALSE,
display, streamObject);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroyStreamKHR",
GetDisplayIfValid(display), EGL_FALSE);
display->destroyStream(streamObject);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_StreamAttribKHR(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
EGLint value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamAttribKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
", EGLenum attribute = 0x%X, "
"EGLint value = 0x%X",
(uintptr_t)dpy, (uintptr_t)stream, attribute, value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, StreamAttribKHR, GetStreamIfValid(display, streamObject), EGL_FALSE,
display, streamObject, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamAttribKHR",
GetDisplayIfValid(display), EGL_FALSE);
switch (attribute)
{
case EGL_CONSUMER_LATENCY_USEC_KHR:
streamObject->setConsumerLatency(value);
break;
case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR:
streamObject->setConsumerAcquireTimeout(value);
break;
default:
UNREACHABLE();
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_QueryStreamKHR(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryStreamKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
", EGLenum attribute = 0x%X, "
"EGLint value = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, QueryStreamKHR, GetStreamIfValid(display, streamObject), EGL_FALSE,
display, streamObject, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryStreamKHR",
GetDisplayIfValid(display), EGL_FALSE);
switch (attribute)
{
case EGL_STREAM_STATE_KHR:
*value = streamObject->getState();
break;
case EGL_CONSUMER_LATENCY_USEC_KHR:
*value = streamObject->getConsumerLatency();
break;
case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR:
*value = streamObject->getConsumerAcquireTimeout();
break;
default:
UNREACHABLE();
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_QueryStreamu64KHR(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
EGLuint64KHR *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryStreamu64KHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
", EGLenum attribute = 0x%X, "
"EGLuint64KHR value = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, QueryStreamu64KHR, GetStreamIfValid(display, streamObject),
EGL_FALSE, display, streamObject, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryStreamu64KHR",
GetDisplayIfValid(display), EGL_FALSE);
switch (attribute)
{
case EGL_PRODUCER_FRAME_KHR:
*value = streamObject->getProducerFrame();
break;
case EGL_CONSUMER_FRAME_KHR:
*value = streamObject->getConsumerFrame();
break;
default:
UNREACHABLE();
}
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamConsumerGLTextureExternalKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR = 0x%016" PRIxPTR, (uintptr_t)dpy,
(uintptr_t)stream);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, StreamConsumerGLTextureExternalKHR,
GetStreamIfValid(display, streamObject), EGL_FALSE, display, streamObject);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamConsumerGLTextureExternalKHR",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(
thread, streamObject->createConsumerGLTextureExternal(AttributeMap(), thread->getContext()),
"eglStreamConsumerGLTextureExternalKHR", GetStreamIfValid(display, streamObject),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamConsumerAcquireKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR = 0x%016" PRIxPTR, (uintptr_t)dpy,
(uintptr_t)stream);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, StreamConsumerAcquireKHR, GetStreamIfValid(display, streamObject),
EGL_FALSE, display, streamObject);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamConsumerAcquireKHR",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, streamObject->consumerAcquire(thread->getContext()),
"eglStreamConsumerAcquireKHR", GetStreamIfValid(display, streamObject),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamConsumerReleaseKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR = 0x%016" PRIxPTR, (uintptr_t)dpy,
(uintptr_t)stream);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
gl::Context *context = gl::GetValidGlobalContext();
ANGLE_EGL_VALIDATE(thread, StreamConsumerReleaseKHR, GetStreamIfValid(display, streamObject),
EGL_FALSE, display, streamObject);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamConsumerReleaseKHR",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, streamObject->consumerRelease(context),
"eglStreamConsumerReleaseKHR", GetStreamIfValid(display, streamObject),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
EGLStreamKHR stream,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamConsumerGLTextureExternalAttribsNV,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
", EGLAttrib attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
gl::Context *context = gl::GetValidGlobalContext();
AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, StreamConsumerGLTextureExternalAttribsNV,
GetStreamIfValid(display, streamObject), EGL_FALSE, display, streamObject,
attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(),
"eglStreamConsumerGLTextureExternalAttribsNV", GetDisplayIfValid(display),
EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, streamObject->createConsumerGLTextureExternal(attributes, context),
"eglStreamConsumerGLTextureExternalAttribsNV",
GetStreamIfValid(display, streamObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_CreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,
EGLStreamKHR stream,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateStreamProducerD3DTextureANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
", EGLAttrib attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateStreamProducerD3DTextureANGLE,
GetStreamIfValid(display, streamObject), EGL_FALSE, display, streamObject,
attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(),
"eglCreateStreamProducerD3DTextureANGLE", GetDisplayIfValid(display),
EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, streamObject->createProducerD3D11Texture(attributes),
"eglCreateStreamProducerD3DTextureANGLE",
GetStreamIfValid(display, streamObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_StreamPostD3DTextureANGLE(EGLDisplay dpy,
EGLStreamKHR stream,
void *texture,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamPostD3DTextureANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
", void* texture = 0x%016" PRIxPTR
", "
"EGLAttrib attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)texture, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Stream *streamObject = static_cast<Stream *>(stream);
AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, StreamPostD3DTextureANGLE, GetStreamIfValid(display, streamObject),
EGL_FALSE, display, streamObject, texture, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglStreamPostD3DTextureANGLE",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, streamObject->postD3D11Texture(texture, attributes),
"eglStreamPostD3DTextureANGLE", GetStreamIfValid(display, streamObject),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
// EGL_KHR_fence_sync
ANGLE_EXPORT EGLSync EGLAPIENTRY EGL_CreateSyncKHR(EGLDisplay dpy,
EGLenum type,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateSyncKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLenum type = 0x%X, const EGLint* attrib_list = 0x%016" PRIxPTR,
(uintptr_t)dpy, type, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateSyncKHR, GetDisplayIfValid(display), EGL_NO_SYNC, display,
type, attributes);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglCreateSync",
GetDisplayIfValid(display), EGL_NO_SYNC);
egl::Sync *syncObject = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
display->createSync(thread->getContext(), type, attributes, &syncObject),
"eglCreateSync", GetDisplayIfValid(display), EGL_NO_SYNC);
thread->setSuccess();
return static_cast<EGLSync>(syncObject);
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroySyncKHR, "EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)sync);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, DestroySyncKHR, GetDisplayIfValid(display), EGL_FALSE, display,
syncObject);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDestroySync",
GetDisplayIfValid(display), EGL_FALSE);
display->destroySync(syncObject);
thread->setSuccess();
return EGL_TRUE;
}
ANGLE_EXPORT EGLint EGLAPIENTRY EGL_ClientWaitSyncKHR(EGLDisplay dpy,
EGLSyncKHR sync,
EGLint flags,
EGLTimeKHR timeout)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ClientWaitSyncKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
", EGLint flags = 0x%X, EGLTime timeout = "
"%llu",
(uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, ClientWaitSyncKHR, GetSyncIfValid(display, syncObject), EGL_FALSE,
display, syncObject, flags, timeout);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglClientWaitSync",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
EGLint syncStatus = EGL_FALSE;
ANGLE_EGL_TRY_RETURN(
thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
"eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return syncStatus;
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetSyncAttribKHR(EGLDisplay dpy,
EGLSyncKHR sync,
EGLint attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetSyncAttribKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
", EGLint attribute = 0x%X, EGLAttrib "
"*value = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, GetSyncAttribKHR, GetSyncIfValid(display, syncObject), EGL_FALSE,
display, syncObject, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetSyncAttrib",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, GetSyncAttrib(display, syncObject, attribute, value),
"eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
// EGL_KHR_wait_sync
ANGLE_EXPORT EGLint EGLAPIENTRY EGL_WaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitSyncKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR "p, EGLSync sync = 0x%016" PRIxPTR
", EGLint flags = 0x%X",
(uintptr_t)dpy, (uintptr_t)sync, flags);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, WaitSyncKHR, GetSyncIfValid(display, syncObject), EGL_FALSE, display,
syncObject, flags);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglWaitSync",
GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, syncObject->serverWait(display, currentContext, flags),
"eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_GetMscRateANGLE(EGLDisplay dpy,
EGLSurface surface,
EGLint *numerator,
EGLint *denominator)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetMscRateANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint* numerator = 0x%016" PRIxPTR
", "
"EGLint* denomintor = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)numerator, (uintptr_t)denominator);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, GetMscRateANGLE, GetSurfaceIfValid(display, eglSurface), EGL_FALSE,
display, eglSurface, numerator, denominator);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetMscRateANGLE",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getMscRate(numerator, denominator),
"eglGetMscRateANGLE", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_GetSyncValuesCHROMIUM(EGLDisplay dpy,
EGLSurface surface,
EGLuint64KHR *ust,
EGLuint64KHR *msc,
EGLuint64KHR *sbc)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetSyncValuesCHROMIUM,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLuint64KHR* ust = 0x%016" PRIxPTR
", "
"EGLuint64KHR* msc = 0x%016" PRIxPTR ", EGLuint64KHR* sbc = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)ust, (uintptr_t)msc, (uintptr_t)sbc);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, GetSyncValuesCHROMIUM, GetSurfaceIfValid(display, eglSurface),
EGL_FALSE, display, eglSurface, ust, msc, sbc);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetSyncValuesCHROMIUM",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getSyncValues(ust, msc, sbc),
"eglGetSyncValuesCHROMIUM", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithDamageKHR(EGLDisplay dpy,
EGLSurface surface,
EGLint *rects,
EGLint n_rects)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SwapBuffersWithDamageKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint *rects = 0x%016" PRIxPTR
", EGLint "
"n_rects = %d",
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)rects, n_rects);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, SwapBuffersWithDamageKHR, GetSurfaceIfValid(display, eglSurface),
EGL_FALSE, display, eglSurface, rects, n_rects);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSwapBuffersWithDamageEXT",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->swapWithDamage(thread->getContext(), rects, n_rects),
"eglSwapBuffersWithDamageEXT", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY EGL_PresentationTimeANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLnsecsANDROID time)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(PresentationTimeANDROID,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLnsecsANDROID time = %llu",
(uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(time));
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, PresentationTimeANDROID, GetSurfaceIfValid(display, eglSurface),
EGL_FALSE, display, eglSurface, time);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglPresentationTimeANDROID",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->setPresentationTime(time),
"eglPresentationTimeANDROID", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
return EGL_TRUE;
}
ANGLE_EXPORT void EGLAPIENTRY EGL_SetBlobCacheFuncsANDROID(EGLDisplay dpy,
EGLSetBlobFuncANDROID set,
EGLGetBlobFuncANDROID get)
{
EGL_EVENT(SetBlobCacheFuncsANDROID,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSetBlobFuncANDROID set = 0x%016" PRIxPTR
", EGLGetBlobFuncANDROID get "
"= 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)set, (uintptr_t)get);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
ANGLE_EGL_VALIDATE_VOID(thread, SetBlobCacheFuncsANDROID, GetDisplayIfValid(display), display,
set, get);
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglSetBlobCacheFuncsANDROID",
GetDisplayIfValid(display));
thread->setSuccess();
display->setBlobCacheFuncs(set, get);
}
EGLint EGLAPIENTRY EGL_ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ProgramCacheGetAttribANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLenum attrib = 0x%X", (uintptr_t)dpy, attrib);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, ProgramCacheGetAttribANGLE, GetDisplayIfValid(display), 0, display,
attrib);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglProgramCacheGetAttribANGLE",
GetDisplayIfValid(display), 0);
thread->setSuccess();
return display->programCacheGetAttrib(attrib);
}
void EGLAPIENTRY EGL_ProgramCacheQueryANGLE(EGLDisplay dpy,
EGLint index,
void *key,
EGLint *keysize,
void *binary,
EGLint *binarysize)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ProgramCacheQueryANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint index = %d, void *key = 0x%016" PRIxPTR
", EGLint *keysize = "
"0x%016" PRIxPTR ", void *binary = 0x%016" PRIxPTR ", EGLint *size = 0x%016" PRIxPTR,
(uintptr_t)dpy, index, (uintptr_t)key, (uintptr_t)keysize, (uintptr_t)binary,
(uintptr_t)binarysize);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE_VOID(thread, ProgramCacheQueryANGLE, GetDisplayIfValid(display), display,
index, key, keysize, binary, binarysize);
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglProgramCacheQueryANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, display->programCacheQuery(index, key, keysize, binary, binarysize),
"eglProgramCacheQueryANGLE", GetDisplayIfValid(display));
thread->setSuccess();
}
void EGLAPIENTRY EGL_ProgramCachePopulateANGLE(EGLDisplay dpy,
const void *key,
EGLint keysize,
const void *binary,
EGLint binarysize)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ProgramCachePopulateANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", void *key = 0x%016" PRIxPTR
", EGLint keysize = %d, void *binary = "
"0x%016" PRIxPTR ", EGLint size = %d",
(uintptr_t)dpy, (uintptr_t)key, keysize, (uintptr_t)binary, binarysize);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE_VOID(thread, ProgramCachePopulateANGLE, GetDisplayIfValid(display), display,
key, keysize, binary, binarysize);
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglProgramCachePopulateANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, display->programCachePopulate(key, keysize, binary, binarysize),
"eglProgramCachePopulateANGLE", GetDisplayIfValid(display));
thread->setSuccess();
}
EGLint EGLAPIENTRY EGL_ProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLint mode)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ProgramCacheResizeANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint limit = %d, EGLenum mode = 0x%X",
(uintptr_t)dpy, limit, mode);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, ProgramCacheResizeANGLE, GetDisplayIfValid(display), 0, display,
limit, mode);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglProgramCacheResizeANGLE",
GetDisplayIfValid(display), 0);
thread->setSuccess();
return display->programCacheResize(limit, mode);
}
EGLint EGLAPIENTRY EGL_DebugMessageControlKHR(EGLDEBUGPROCKHR callback,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DebugMessageControlKHR,
"EGLDEBUGPROCKHR callback = 0x%016" PRIxPTR
", EGLAttrib attrib_list = 0x%016" PRIxPTR,
(uintptr_t)callback, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, DebugMessageControlKHR, nullptr, thread->getError(), callback,
attributes);
Debug *debug = GetDebug();
debug->setCallback(callback, attributes);
thread->setSuccess();
return EGL_SUCCESS;
}
EGLBoolean EGLAPIENTRY EGL_QueryDebugKHR(EGLint attribute, EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDebugKHR, "EGLint attribute = 0x%X, EGLAttrib* value = 0x%016" PRIxPTR,
attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, QueryDebugKHR, nullptr, EGL_FALSE, attribute, value);
Debug *debug = GetDebug();
switch (attribute)
{
case EGL_DEBUG_MSG_CRITICAL_KHR:
case EGL_DEBUG_MSG_ERROR_KHR:
case EGL_DEBUG_MSG_WARN_KHR:
case EGL_DEBUG_MSG_INFO_KHR:
*value = debug->isMessageTypeEnabled(FromEGLenum<MessageType>(attribute)) ? EGL_TRUE
: EGL_FALSE;
break;
case EGL_DEBUG_CALLBACK_KHR:
*value = reinterpret_cast<EGLAttrib>(debug->getCallback());
break;
default:
UNREACHABLE();
}
thread->setSuccess();
return EGL_TRUE;
}
EGLint EGLAPIENTRY EGL_LabelObjectKHR(EGLDisplay dpy,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(LabelObjectKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR
", EGLenum objectType = 0x%X, EGLObjectKHR object = 0x%016" PRIxPTR
", "
"EGLLabelKHR label = 0x%016" PRIxPTR,
(uintptr_t)dpy, objectType, (uintptr_t)object, (uintptr_t)label);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ObjectType objectTypePacked = FromEGLenum<ObjectType>(objectType);
ANGLE_EGL_VALIDATE(thread, LabelObjectKHR,
GetLabeledObjectIfValid(thread, display, objectTypePacked, object),
thread->getError(), display, objectTypePacked, object, label);
LabeledObject *labeledObject =
GetLabeledObjectIfValid(thread, display, objectTypePacked, object);
ASSERT(labeledObject != nullptr);
labeledObject->setLabel(label);
thread->setSuccess();
return EGL_SUCCESS;
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingSupportedANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLint name)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCompositorTimingSupportedANDROID,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint name = 0x%X",
(uintptr_t)dpy, (uintptr_t)surface, name);
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
Thread *thread = egl::GetCurrentThread();
CompositorTiming nameInternal = FromEGLenum<CompositorTiming>(name);
ANGLE_EGL_VALIDATE(thread, GetCompositorTimingSupportedANDROID,
GetSurfaceIfValid(display, eglSurface), EGL_FALSE, display, eglSurface,
nameInternal);
thread->setSuccess();
return eglSurface->getSupportedCompositorTimings().test(nameInternal);
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLint numTimestamps,
const EGLint *names,
EGLnsecsANDROID *values)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCompositorTimingANDROID,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint numTimestamps = %d, const EGLint *names = 0x%016" PRIxPTR
", EGLnsecsANDROID *values = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)surface, numTimestamps, (uintptr_t)names,
(uintptr_t)values);
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetCompositorTimingANDROID, GetSurfaceIfValid(display, eglSurface),
EGL_FALSE, display, eglSurface, numTimestamps, names, values);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetCompositorTimingANDROIDD",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getCompositorTiming(numTimestamps, names, values),
"eglGetCompositorTimingANDROIDD", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetNextFrameIdANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLuint64KHR *frameId)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetNextFrameIdANDROID,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLuint64KHR *frameId = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)frameId);
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetNextFrameIdANDROID, GetSurfaceIfValid(display, eglSurface),
EGL_FALSE, display, eglSurface, frameId);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetNextFrameIdANDROID",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getNextFrameId(frameId), "eglGetNextFrameIdANDROID",
GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampSupportedANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLint timestamp)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetFrameTimestampSupportedANDROID,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLint timestamp = 0x%X",
(uintptr_t)dpy, (uintptr_t)surface, timestamp);
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
Thread *thread = egl::GetCurrentThread();
Timestamp timestampInternal = FromEGLenum<Timestamp>(timestamp);
ANGLE_EGL_VALIDATE(thread, GetFrameTimestampSupportedANDROID,
GetSurfaceIfValid(display, eglSurface), EGL_FALSE, display, eglSurface,
timestampInternal);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryTimestampSupportedANDROID",
GetDisplayIfValid(display), EGL_FALSE);
thread->setSuccess();
return eglSurface->getSupportedTimestamps().test(timestampInternal);
}
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampsANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLuint64KHR frameId,
EGLint numTimestamps,
const EGLint *timestamps,
EGLnsecsANDROID *values)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(
GetFrameTimestampsANDROID,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLuint64KHR frameId = %llu, EGLint numTimestamps = %d, const EGLint *timestamps = "
"0x%016" PRIxPTR ", EGLnsecsANDROID *values = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)surface, (unsigned long long)frameId, numTimestamps,
(uintptr_t)timestamps, (uintptr_t)values);
egl::Display *display = static_cast<egl::Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetFrameTimestampsANDROID, GetSurfaceIfValid(display, eglSurface),
EGL_FALSE, display, eglSurface, frameId, numTimestamps, timestamps, values);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglGetFrameTimestampsANDROID",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(
thread, eglSurface->getFrameTimestamps(frameId, numTimestamps, timestamps, values),
"eglGetFrameTimestampsANDROID", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
// EGL_ANGLE_feature_control
ANGLE_EXPORT const char *EGLAPIENTRY EGL_QueryStringiANGLE(EGLDisplay dpy,
EGLint name,
EGLint index)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryStringiANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint name = %d, EGLint index = %d",
(uintptr_t)dpy, name, index);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, QueryStringiANGLE, GetDisplayIfValid(display), nullptr, display,
name, index);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglQueryStringiANGLE",
GetDisplayIfValid(display), nullptr);
thread->setSuccess();
return display->queryStringi(name, index);
}
EGLClientBuffer EGLAPIENTRY EGL_GetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetNativeClientBufferANDROID, "const struct AHardwareBuffer *buffer = 0x%016" PRIxPTR,
(uintptr_t)buffer);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetNativeClientBufferANDROID, nullptr, nullptr, buffer);
thread->setSuccess();
return egl::Display::GetNativeClientBuffer(buffer);
}
EGLClientBuffer EGLAPIENTRY EGL_CreateNativeClientBufferANDROID(const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateNativeClientBufferANDROID, "const EGLint *attrib_list = 0x%016" PRIxPTR,
(uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_TRY_RETURN(thread,
(attrib_list == nullptr || attrib_list[0] == EGL_NONE)
? egl::EglBadParameter() << "invalid attribute list."
: NoError(),
"eglCreateNativeClientBufferANDROID", nullptr, nullptr);
const AttributeMap &attribMap = AttributeMap::CreateFromIntArray(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateNativeClientBufferANDROID, nullptr, nullptr, attribMap);
EGLClientBuffer eglClientBuffer = nullptr;
ANGLE_EGL_TRY_RETURN(thread,
egl::Display::CreateNativeClientBuffer(attribMap, &eglClientBuffer),
"eglCreateNativeClientBufferANDROID", nullptr, nullptr);
thread->setSuccess();
return eglClientBuffer;
}
EGLint EGLAPIENTRY EGL_DupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DupNativeFenceFDANDROID,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSyncKHR sync = 0x%016" PRIxPTR,
(uintptr_t)dpy, (uintptr_t)sync);
egl::Display *display = static_cast<egl::Display *>(dpy);
Sync *syncObject = static_cast<Sync *>(sync);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, DupNativeFenceFDANDROID, GetSyncIfValid(display, syncObject),
EGL_NO_NATIVE_FENCE_FD_ANDROID, display, syncObject);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglDupNativeFenceFDANDROID",
GetDisplayIfValid(display), EGL_NO_NATIVE_FENCE_FD_ANDROID);
EGLint result = EGL_NO_NATIVE_FENCE_FD_ANDROID;
ANGLE_EGL_TRY_RETURN(thread, syncObject->dupNativeFenceFD(display, &result),
"eglDupNativeFenceFDANDROID", GetSyncIfValid(display, syncObject),
EGL_NO_NATIVE_FENCE_FD_ANDROID);
thread->setSuccess();
return result;
}
EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithFrameTokenANGLE(EGLDisplay dpy,
EGLSurface surface,
EGLFrameTokenANGLE frametoken)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SwapBuffersWithFrameTokenANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
", EGLFrameTokenANGLE frametoken = 0x%llX",
(uintptr_t)dpy, (uintptr_t)surface, (unsigned long long)frametoken);
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Surface *eglSurface = static_cast<egl::Surface *>(surface);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, SwapBuffersWithFrameTokenANGLE, GetDisplayIfValid(display),
EGL_FALSE, display, eglSurface, frametoken);
ANGLE_EGL_TRY_RETURN(thread, display->prepareForCall(), "eglSwapBuffersWithFrameTokenANGLE",
GetDisplayIfValid(display), EGL_FALSE);
ANGLE_EGL_TRY_RETURN(thread, eglSurface->swapWithFrameToken(thread->getContext(), frametoken),
"eglSwapBuffersWithFrameTokenANGLE", GetDisplayIfValid(display),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
void EGLAPIENTRY EGL_ReleaseHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReleaseHighPowerGPUANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLContext ctx = 0x%016" PRIxPTR, (uintptr_t)dpy,
(uintptr_t)ctx);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
gl::Context *context = static_cast<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE_VOID(thread, ReleaseHighPowerGPUANGLE, GetDisplayIfValid(display), display,
context);
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglReleaseHighPowerGPUANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, context->releaseHighPowerGPU(), "eglReleaseHighPowerGPUANGLE",
GetDisplayIfValid(display));
thread->setSuccess();
}
void EGLAPIENTRY EGL_ReacquireHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReacquireHighPowerGPUANGLE,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLContext ctx = 0x%016" PRIxPTR, (uintptr_t)dpy,
(uintptr_t)ctx);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
gl::Context *context = static_cast<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE_VOID(thread, ReacquireHighPowerGPUANGLE, GetDisplayIfValid(display), display,
context);
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglReacquireHighPowerGPUANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, context->reacquireHighPowerGPU(), "eglReacquireHighPowerGPUANGLE",
GetDisplayIfValid(display));
thread->setSuccess();
}
void EGLAPIENTRY EGL_HandleGPUSwitchANGLE(EGLDisplay dpy)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(HandleGPUSwitchANGLE, "EGLDisplay dpy = 0x%016" PRIxPTR, (uintptr_t)dpy);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
ANGLE_EGL_VALIDATE_VOID(thread, HandleGPUSwitchANGLE, GetDisplayIfValid(display), display);
ANGLE_EGL_TRY(thread, display->prepareForCall(), "eglHandleGPUSwitchANGLE",
GetDisplayIfValid(display));
ANGLE_EGL_TRY(thread, display->handleGPUSwitch(), "eglHandleGPUSwitchANGLE",
GetDisplayIfValid(display));
thread->setSuccess();
}
// EGL_KHR_reusable_sync
ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_SignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SignalSyncKHR,
"EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
", EGLint mode = 0x%X",
(uintptr_t)dpy, (uintptr_t)sync, mode);
Thread *thread = egl::GetCurrentThread();
egl::Display *display = static_cast<egl::Display *>(dpy);
egl::Sync *syncObject = static_cast<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, SignalSyncKHR, GetSyncIfValid(display, syncObject), EGL_FALSE,
display, syncObject, mode);
gl::Context *currentContext = thread->getContext();
ANGLE_EGL_TRY_RETURN(thread, syncObject->signal(display, currentContext, mode),
"eglSignalSyncKHR", GetSyncIfValid(display, syncObject), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
} // extern "C"
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_entry_points.py using data from egl.xml and egl_angle_ext.xml.
//
// Copyright 2020 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.
//
// entry_points_egl_ext_autogen.cpp:
// Defines the EGL Extension entry points.
#include "libGLESv2/entry_points_egl_ext_autogen.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/validationEGL_autogen.h"
#include "libGLESv2/egl_ext_stubs_autogen.h"
#include "libGLESv2/global_state.h"
using namespace egl;
extern "C" {
// EGL_ANDROID_blob_cache
void EGLAPIENTRY EGL_SetBlobCacheFuncsANDROID(EGLDisplay dpy,
EGLSetBlobFuncANDROID set,
EGLGetBlobFuncANDROID get)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SetBlobCacheFuncsANDROID,
"dpy = 0x%016" PRIxPTR ", set = 0x%016" PRIxPTR ", get = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)set, (uintptr_t)get);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE_VOID(thread, SetBlobCacheFuncsANDROID, GetDisplayIfValid(dpyPacked),
dpyPacked, set, get);
SetBlobCacheFuncsANDROID(thread, dpyPacked, set, get);
}
// EGL_ANDROID_create_native_client_buffer
EGLClientBuffer EGLAPIENTRY EGL_CreateNativeClientBufferANDROID(const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateNativeClientBufferANDROID, "attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateNativeClientBufferANDROID, nullptr, EGLClientBuffer,
attrib_listPacked);
return CreateNativeClientBufferANDROID(thread, attrib_listPacked);
}
// EGL_ANDROID_get_frame_timestamps
EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingSupportedANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLint name)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCompositorTimingSupportedANDROID,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", name = %d", (uintptr_t)dpy,
(uintptr_t)surface, name);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
CompositorTiming namePacked = PackParam<CompositorTiming>(name);
ANGLE_EGL_VALIDATE(thread, GetCompositorTimingSupportedANDROID, GetDisplayIfValid(dpyPacked),
EGLBoolean, dpyPacked, surfacePacked, namePacked);
return GetCompositorTimingSupportedANDROID(thread, dpyPacked, surfacePacked, namePacked);
}
EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLint numTimestamps,
const EGLint *names,
EGLnsecsANDROID *values)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetCompositorTimingANDROID,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
", numTimestamps = %d, names = 0x%016" PRIxPTR ", values = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, numTimestamps, (uintptr_t)names,
(uintptr_t)values);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, GetCompositorTimingANDROID, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, surfacePacked, numTimestamps, names, values);
return GetCompositorTimingANDROID(thread, dpyPacked, surfacePacked, numTimestamps, names,
values);
}
EGLBoolean EGLAPIENTRY EGL_GetNextFrameIdANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLuint64KHR *frameId)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetNextFrameIdANDROID,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", frameId = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)frameId);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, GetNextFrameIdANDROID, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, surfacePacked, frameId);
return GetNextFrameIdANDROID(thread, dpyPacked, surfacePacked, frameId);
}
EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampSupportedANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLint timestamp)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetFrameTimestampSupportedANDROID,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", timestamp = %d",
(uintptr_t)dpy, (uintptr_t)surface, timestamp);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
Timestamp timestampPacked = PackParam<Timestamp>(timestamp);
ANGLE_EGL_VALIDATE(thread, GetFrameTimestampSupportedANDROID, GetDisplayIfValid(dpyPacked),
EGLBoolean, dpyPacked, surfacePacked, timestampPacked);
return GetFrameTimestampSupportedANDROID(thread, dpyPacked, surfacePacked, timestampPacked);
}
EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampsANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLuint64KHR frameId,
EGLint numTimestamps,
const EGLint *timestamps,
EGLnsecsANDROID *values)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetFrameTimestampsANDROID,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
", frameId = %llu, numTimestamps = %d, timestamps = 0x%016" PRIxPTR
", values = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(frameId),
numTimestamps, (uintptr_t)timestamps, (uintptr_t)values);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, GetFrameTimestampsANDROID, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, surfacePacked, frameId, numTimestamps, timestamps, values);
return GetFrameTimestampsANDROID(thread, dpyPacked, surfacePacked, frameId, numTimestamps,
timestamps, values);
}
// EGL_ANDROID_get_native_client_buffer
EGLClientBuffer EGLAPIENTRY EGL_GetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetNativeClientBufferANDROID, "buffer = 0x%016" PRIxPTR "", (uintptr_t)buffer);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, GetNativeClientBufferANDROID, nullptr, EGLClientBuffer, buffer);
return GetNativeClientBufferANDROID(thread, buffer);
}
// EGL_ANDROID_native_fence_sync
EGLint EGLAPIENTRY EGL_DupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DupNativeFenceFDANDROID, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)sync);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, DupNativeFenceFDANDROID, GetDisplayIfValid(dpyPacked), EGLint,
dpyPacked, syncPacked);
return DupNativeFenceFDANDROID(thread, dpyPacked, syncPacked);
}
// EGL_ANDROID_presentation_time
EGLBoolean EGLAPIENTRY EGL_PresentationTimeANDROID(EGLDisplay dpy,
EGLSurface surface,
EGLnsecsANDROID time)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(PresentationTimeANDROID,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", time = %llu", (uintptr_t)dpy,
(uintptr_t)surface, static_cast<unsigned long long>(time));
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, PresentationTimeANDROID, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, surfacePacked, time);
return PresentationTimeANDROID(thread, dpyPacked, surfacePacked, time);
}
// EGL_ANGLE_device_creation
EGLDeviceEXT EGLAPIENTRY EGL_CreateDeviceANGLE(EGLint device_type,
void *native_device,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateDeviceANGLE,
"device_type = %d, native_device = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
"",
device_type, (uintptr_t)native_device, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, CreateDeviceANGLE, nullptr, EGLDeviceEXT, device_type, native_device,
attrib_list);
return CreateDeviceANGLE(thread, device_type, native_device, attrib_list);
}
EGLBoolean EGLAPIENTRY EGL_ReleaseDeviceANGLE(EGLDeviceEXT device)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReleaseDeviceANGLE, "device = 0x%016" PRIxPTR "", (uintptr_t)device);
Thread *thread = egl::GetCurrentThread();
Device *devicePacked = PackParam<Device *>(device);
ANGLE_EGL_VALIDATE(thread, ReleaseDeviceANGLE, nullptr, EGLBoolean, devicePacked);
return ReleaseDeviceANGLE(thread, devicePacked);
}
// EGL_ANGLE_feature_control
const char *EGLAPIENTRY EGL_QueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryStringiANGLE, "dpy = 0x%016" PRIxPTR ", name = %d, index = %d", (uintptr_t)dpy,
name, index);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, QueryStringiANGLE, GetDisplayIfValid(dpyPacked), const char *,
dpyPacked, name, index);
return QueryStringiANGLE(thread, dpyPacked, name, index);
}
EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribANGLE(EGLDisplay dpy,
EGLint attribute,
EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDisplayAttribANGLE,
"dpy = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "", (uintptr_t)dpy,
attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, QueryDisplayAttribANGLE, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, attribute, value);
return QueryDisplayAttribANGLE(thread, dpyPacked, attribute, value);
}
// EGL_ANGLE_power_preference
void EGLAPIENTRY EGL_ReleaseHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReleaseHighPowerGPUANGLE, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)ctx);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
gl::Context *ctxPacked = PackParam<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE_VOID(thread, ReleaseHighPowerGPUANGLE, GetDisplayIfValid(dpyPacked),
dpyPacked, ctxPacked);
ReleaseHighPowerGPUANGLE(thread, dpyPacked, ctxPacked);
}
void EGLAPIENTRY EGL_ReacquireHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ReacquireHighPowerGPUANGLE, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)ctx);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
gl::Context *ctxPacked = PackParam<gl::Context *>(ctx);
ANGLE_EGL_VALIDATE_VOID(thread, ReacquireHighPowerGPUANGLE, GetDisplayIfValid(dpyPacked),
dpyPacked, ctxPacked);
ReacquireHighPowerGPUANGLE(thread, dpyPacked, ctxPacked);
}
void EGLAPIENTRY EGL_HandleGPUSwitchANGLE(EGLDisplay dpy)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(HandleGPUSwitchANGLE, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE_VOID(thread, HandleGPUSwitchANGLE, GetDisplayIfValid(dpyPacked), dpyPacked);
HandleGPUSwitchANGLE(thread, dpyPacked);
}
// EGL_ANGLE_program_cache_control
EGLint EGLAPIENTRY EGL_ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ProgramCacheGetAttribANGLE, "dpy = 0x%016" PRIxPTR ", attrib = 0x%X", (uintptr_t)dpy,
attrib);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, ProgramCacheGetAttribANGLE, GetDisplayIfValid(dpyPacked), EGLint,
dpyPacked, attrib);
return ProgramCacheGetAttribANGLE(thread, dpyPacked, attrib);
}
void EGLAPIENTRY EGL_ProgramCacheQueryANGLE(EGLDisplay dpy,
EGLint index,
void *key,
EGLint *keysize,
void *binary,
EGLint *binarysize)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ProgramCacheQueryANGLE,
"dpy = 0x%016" PRIxPTR ", index = %d, key = 0x%016" PRIxPTR
", keysize = 0x%016" PRIxPTR ", binary = 0x%016" PRIxPTR
", binarysize = 0x%016" PRIxPTR "",
(uintptr_t)dpy, index, (uintptr_t)key, (uintptr_t)keysize, (uintptr_t)binary,
(uintptr_t)binarysize);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE_VOID(thread, ProgramCacheQueryANGLE, GetDisplayIfValid(dpyPacked), dpyPacked,
index, key, keysize, binary, binarysize);
ProgramCacheQueryANGLE(thread, dpyPacked, index, key, keysize, binary, binarysize);
}
void EGLAPIENTRY EGL_ProgramCachePopulateANGLE(EGLDisplay dpy,
const void *key,
EGLint keysize,
const void *binary,
EGLint binarysize)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ProgramCachePopulateANGLE,
"dpy = 0x%016" PRIxPTR ", key = 0x%016" PRIxPTR
", keysize = %d, binary = 0x%016" PRIxPTR ", binarysize = %d",
(uintptr_t)dpy, (uintptr_t)key, keysize, (uintptr_t)binary, binarysize);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE_VOID(thread, ProgramCachePopulateANGLE, GetDisplayIfValid(dpyPacked),
dpyPacked, key, keysize, binary, binarysize);
ProgramCachePopulateANGLE(thread, dpyPacked, key, keysize, binary, binarysize);
}
EGLint EGLAPIENTRY EGL_ProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLint mode)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ProgramCacheResizeANGLE, "dpy = 0x%016" PRIxPTR ", limit = %d, mode = %d",
(uintptr_t)dpy, limit, mode);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, ProgramCacheResizeANGLE, GetDisplayIfValid(dpyPacked), EGLint,
dpyPacked, limit, mode);
return ProgramCacheResizeANGLE(thread, dpyPacked, limit, mode);
}
// EGL_ANGLE_query_surface_pointer
EGLBoolean EGLAPIENTRY EGL_QuerySurfacePointerANGLE(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
void **value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QuerySurfacePointerANGLE,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
", attribute = %d, value = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, QuerySurfacePointerANGLE, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, surfacePacked, attribute, value);
return QuerySurfacePointerANGLE(thread, dpyPacked, surfacePacked, attribute, value);
}
// EGL_ANGLE_stream_producer_d3d_texture
EGLBoolean EGLAPIENTRY EGL_CreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,
EGLStreamKHR stream,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateStreamProducerD3DTextureANGLE,
"dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
"",
(uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateStreamProducerD3DTextureANGLE, GetDisplayIfValid(dpyPacked),
EGLBoolean, dpyPacked, streamPacked, attrib_listPacked);
return CreateStreamProducerD3DTextureANGLE(thread, dpyPacked, streamPacked, attrib_listPacked);
}
EGLBoolean EGLAPIENTRY EGL_StreamPostD3DTextureANGLE(EGLDisplay dpy,
EGLStreamKHR stream,
void *texture,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamPostD3DTextureANGLE,
"dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR ", texture = 0x%016" PRIxPTR
", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)texture, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, StreamPostD3DTextureANGLE, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, streamPacked, texture, attrib_listPacked);
return StreamPostD3DTextureANGLE(thread, dpyPacked, streamPacked, texture, attrib_listPacked);
}
// EGL_ANGLE_swap_with_frame_token
EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithFrameTokenANGLE(EGLDisplay dpy,
EGLSurface surface,
EGLFrameTokenANGLE frametoken)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SwapBuffersWithFrameTokenANGLE,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", frametoken = 0x%llX",
(uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(frametoken));
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, SwapBuffersWithFrameTokenANGLE, GetDisplayIfValid(dpyPacked),
EGLBoolean, dpyPacked, surfacePacked, frametoken);
return SwapBuffersWithFrameTokenANGLE(thread, dpyPacked, surfacePacked, frametoken);
}
// EGL_ANGLE_sync_control_rate
EGLBoolean EGLAPIENTRY EGL_GetMscRateANGLE(EGLDisplay dpy,
EGLSurface surface,
EGLint *numerator,
EGLint *denominator)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetMscRateANGLE,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", numerator = 0x%016" PRIxPTR
", denominator = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)numerator, (uintptr_t)denominator);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, GetMscRateANGLE, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked, numerator, denominator);
return GetMscRateANGLE(thread, dpyPacked, surfacePacked, numerator, denominator);
}
// EGL_CHROMIUM_sync_control
EGLBoolean EGLAPIENTRY EGL_GetSyncValuesCHROMIUM(EGLDisplay dpy,
EGLSurface surface,
EGLuint64KHR *ust,
EGLuint64KHR *msc,
EGLuint64KHR *sbc)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetSyncValuesCHROMIUM,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", ust = 0x%016" PRIxPTR
", msc = 0x%016" PRIxPTR ", sbc = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)ust, (uintptr_t)msc, (uintptr_t)sbc);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, GetSyncValuesCHROMIUM, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, surfacePacked, ust, msc, sbc);
return GetSyncValuesCHROMIUM(thread, dpyPacked, surfacePacked, ust, msc, sbc);
}
// EGL_EXT_device_query
EGLBoolean EGLAPIENTRY EGL_QueryDeviceAttribEXT(EGLDeviceEXT device,
EGLint attribute,
EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDeviceAttribEXT,
"device = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "",
(uintptr_t)device, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Device *devicePacked = PackParam<Device *>(device);
ANGLE_EGL_VALIDATE(thread, QueryDeviceAttribEXT, nullptr, EGLBoolean, devicePacked, attribute,
value);
return QueryDeviceAttribEXT(thread, devicePacked, attribute, value);
}
const char *EGLAPIENTRY EGL_QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDeviceStringEXT, "device = 0x%016" PRIxPTR ", name = %d", (uintptr_t)device,
name);
Thread *thread = egl::GetCurrentThread();
Device *devicePacked = PackParam<Device *>(device);
ANGLE_EGL_VALIDATE(thread, QueryDeviceStringEXT, nullptr, const char *, devicePacked, name);
return QueryDeviceStringEXT(thread, devicePacked, name);
}
EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDisplayAttribEXT,
"dpy = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "", (uintptr_t)dpy,
attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
ANGLE_EGL_VALIDATE(thread, QueryDisplayAttribEXT, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, attribute, value);
return QueryDisplayAttribEXT(thread, dpyPacked, attribute, value);
}
// EGL_EXT_platform_base
EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
EGLConfig config,
void *native_pixmap,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePlatformPixmapSurfaceEXT,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", native_pixmap = 0x%016" PRIxPTR
", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurfaceEXT, GetDisplayIfValid(dpyPacked),
EGLSurface, dpyPacked, configPacked, native_pixmap, attrib_listPacked);
return CreatePlatformPixmapSurfaceEXT(thread, dpyPacked, configPacked, native_pixmap,
attrib_listPacked);
}
EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
EGLConfig config,
void *native_window,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreatePlatformWindowSurfaceEXT,
"dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", native_window = 0x%016" PRIxPTR
", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Config *configPacked = PackParam<Config *>(config);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurfaceEXT, GetDisplayIfValid(dpyPacked),
EGLSurface, dpyPacked, configPacked, native_window, attrib_listPacked);
return CreatePlatformWindowSurfaceEXT(thread, dpyPacked, configPacked, native_window,
attrib_listPacked);
}
EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplayEXT(EGLenum platform,
void *native_display,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetPlatformDisplayEXT,
"platform = 0x%X, native_display = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
"",
platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, GetPlatformDisplayEXT, nullptr, EGLDisplay, platform, native_display,
attrib_listPacked);
return GetPlatformDisplayEXT(thread, platform, native_display, attrib_listPacked);
}
// EGL_KHR_debug
EGLint EGLAPIENTRY EGL_DebugMessageControlKHR(EGLDEBUGPROCKHR callback,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DebugMessageControlKHR,
"callback = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "", (uintptr_t)callback,
(uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, DebugMessageControlKHR, nullptr, EGLint, callback,
attrib_listPacked);
return DebugMessageControlKHR(thread, callback, attrib_listPacked);
}
EGLint EGLAPIENTRY EGL_LabelObjectKHR(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(LabelObjectKHR,
"display = 0x%016" PRIxPTR ", objectType = 0x%X, object = 0x%016" PRIxPTR
", label = 0x%016" PRIxPTR "",
(uintptr_t)display, objectType, (uintptr_t)object, (uintptr_t)label);
Thread *thread = egl::GetCurrentThread();
Display *displayPacked = PackParam<Display *>(display);
ObjectType objectTypePacked = PackParam<ObjectType>(objectType);
ANGLE_EGL_VALIDATE(thread, LabelObjectKHR, GetDisplayIfValid(displayPacked), EGLint,
displayPacked, objectTypePacked, object, label);
return LabelObjectKHR(thread, displayPacked, objectTypePacked, object, label);
}
EGLBoolean EGLAPIENTRY EGL_QueryDebugKHR(EGLint attribute, EGLAttrib *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryDebugKHR, "attribute = %d, value = 0x%016" PRIxPTR "", attribute,
(uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_VALIDATE(thread, QueryDebugKHR, nullptr, EGLBoolean, attribute, value);
return QueryDebugKHR(thread, attribute, value);
}
// EGL_KHR_fence_sync
EGLint EGLAPIENTRY EGL_ClientWaitSyncKHR(EGLDisplay dpy,
EGLSyncKHR sync,
EGLint flags,
EGLTimeKHR timeout)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(ClientWaitSyncKHR,
"dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d, timeout = %llu",
(uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, ClientWaitSyncKHR, GetDisplayIfValid(dpyPacked), EGLint, dpyPacked,
syncPacked, flags, timeout);
return ClientWaitSyncKHR(thread, dpyPacked, syncPacked, flags, timeout);
}
EGLSyncKHR EGLAPIENTRY EGL_CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateSyncKHR,
"dpy = 0x%016" PRIxPTR ", type = 0x%X, attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, type, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateSyncKHR, GetDisplayIfValid(dpyPacked), EGLSyncKHR, dpyPacked,
type, attrib_listPacked);
return CreateSyncKHR(thread, dpyPacked, type, attrib_listPacked);
}
EGLBoolean EGLAPIENTRY EGL_DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroySyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "", (uintptr_t)dpy,
(uintptr_t)sync);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, DestroySyncKHR, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
syncPacked);
return DestroySyncKHR(thread, dpyPacked, syncPacked);
}
EGLBoolean EGLAPIENTRY EGL_GetSyncAttribKHR(EGLDisplay dpy,
EGLSyncKHR sync,
EGLint attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(GetSyncAttribKHR,
"dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR
", attribute = %d, value = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, GetSyncAttribKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, syncPacked, attribute, value);
return GetSyncAttribKHR(thread, dpyPacked, syncPacked, attribute, value);
}
// EGL_KHR_image
EGLImageKHR EGLAPIENTRY EGL_CreateImageKHR(EGLDisplay dpy,
EGLContext ctx,
EGLenum target,
EGLClientBuffer buffer,
const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateImageKHR,
"dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
", target = 0x%X, buffer = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
gl::Context *ctxPacked = PackParam<gl::Context *>(ctx);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateImageKHR, GetDisplayIfValid(dpyPacked), EGLImageKHR, dpyPacked,
ctxPacked, target, buffer, attrib_listPacked);
return CreateImageKHR(thread, dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
}
EGLBoolean EGLAPIENTRY EGL_DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroyImageKHR, "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR "", (uintptr_t)dpy,
(uintptr_t)image);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Image *imagePacked = PackParam<Image *>(image);
ANGLE_EGL_VALIDATE(thread, DestroyImageKHR, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
imagePacked);
return DestroyImageKHR(thread, dpyPacked, imagePacked);
}
// EGL_KHR_reusable_sync
EGLBoolean EGLAPIENTRY EGL_SignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SignalSyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", mode = 0x%X",
(uintptr_t)dpy, (uintptr_t)sync, mode);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, SignalSyncKHR, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
syncPacked, mode);
return SignalSyncKHR(thread, dpyPacked, syncPacked, mode);
}
// ClientWaitSyncKHR is already defined.
// CreateSyncKHR is already defined.
// DestroySyncKHR is already defined.
// GetSyncAttribKHR is already defined.
// EGL_KHR_stream
EGLStreamKHR EGLAPIENTRY EGL_CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(CreateStreamKHR, "dpy = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, CreateStreamKHR, GetDisplayIfValid(dpyPacked), EGLStreamKHR,
dpyPacked, attrib_listPacked);
return CreateStreamKHR(thread, dpyPacked, attrib_listPacked);
}
EGLBoolean EGLAPIENTRY EGL_DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(DestroyStreamKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, DestroyStreamKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, streamPacked);
return DestroyStreamKHR(thread, dpyPacked, streamPacked);
}
EGLBoolean EGLAPIENTRY EGL_QueryStreamKHR(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
EGLint *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryStreamKHR,
"dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
", attribute = 0x%X, value = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, QueryStreamKHR, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
streamPacked, attribute, value);
return QueryStreamKHR(thread, dpyPacked, streamPacked, attribute, value);
}
EGLBoolean EGLAPIENTRY EGL_QueryStreamu64KHR(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
EGLuint64KHR *value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(QueryStreamu64KHR,
"dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
", attribute = 0x%X, value = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, QueryStreamu64KHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, streamPacked, attribute, value);
return QueryStreamu64KHR(thread, dpyPacked, streamPacked, attribute, value);
}
EGLBoolean EGLAPIENTRY EGL_StreamAttribKHR(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
EGLint value)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamAttribKHR,
"dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR ", attribute = 0x%X, value = %d",
(uintptr_t)dpy, (uintptr_t)stream, attribute, value);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, StreamAttribKHR, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
streamPacked, attribute, value);
return StreamAttribKHR(thread, dpyPacked, streamPacked, attribute, value);
}
// EGL_KHR_stream_consumer_gltexture
EGLBoolean EGLAPIENTRY EGL_StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamConsumerAcquireKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, StreamConsumerAcquireKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, streamPacked);
return StreamConsumerAcquireKHR(thread, dpyPacked, streamPacked);
}
EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamConsumerGLTextureExternalKHR,
"dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "", (uintptr_t)dpy,
(uintptr_t)stream);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, StreamConsumerGLTextureExternalKHR, GetDisplayIfValid(dpyPacked),
EGLBoolean, dpyPacked, streamPacked);
return StreamConsumerGLTextureExternalKHR(thread, dpyPacked, streamPacked);
}
EGLBoolean EGLAPIENTRY EGL_StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamConsumerReleaseKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
(uintptr_t)dpy, (uintptr_t)stream);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
ANGLE_EGL_VALIDATE(thread, StreamConsumerReleaseKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, streamPacked);
return StreamConsumerReleaseKHR(thread, dpyPacked, streamPacked);
}
// EGL_KHR_swap_buffers_with_damage
EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithDamageKHR(EGLDisplay dpy,
EGLSurface surface,
EGLint *rects,
EGLint n_rects)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(SwapBuffersWithDamageKHR,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", rects = 0x%016" PRIxPTR
", n_rects = %d",
(uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)rects, n_rects);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, SwapBuffersWithDamageKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
dpyPacked, surfacePacked, rects, n_rects);
return SwapBuffersWithDamageKHR(thread, dpyPacked, surfacePacked, rects, n_rects);
}
// EGL_KHR_wait_sync
EGLint EGLAPIENTRY EGL_WaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(WaitSyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d",
(uintptr_t)dpy, (uintptr_t)sync, flags);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Sync *syncPacked = PackParam<Sync *>(sync);
ANGLE_EGL_VALIDATE(thread, WaitSyncKHR, GetDisplayIfValid(dpyPacked), EGLint, dpyPacked,
syncPacked, flags);
return WaitSyncKHR(thread, dpyPacked, syncPacked, flags);
}
// EGL_NV_post_sub_buffer
EGLBoolean EGLAPIENTRY EGL_PostSubBufferNV(EGLDisplay dpy,
EGLSurface surface,
EGLint x,
EGLint y,
EGLint width,
EGLint height)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(PostSubBufferNV,
"dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
", x = %d, y = %d, width = %d, height = %d",
(uintptr_t)dpy, (uintptr_t)surface, x, y, width, height);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Surface *surfacePacked = PackParam<Surface *>(surface);
ANGLE_EGL_VALIDATE(thread, PostSubBufferNV, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
surfacePacked, x, y, width, height);
return PostSubBufferNV(thread, dpyPacked, surfacePacked, x, y, width, height);
}
// EGL_NV_stream_consumer_gltexture_yuv
EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
EGLStreamKHR stream,
const EGLAttrib *attrib_list)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EGL_EVENT(StreamConsumerGLTextureExternalAttribsNV,
"dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
"",
(uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
Thread *thread = egl::GetCurrentThread();
Display *dpyPacked = PackParam<Display *>(dpy);
Stream *streamPacked = PackParam<Stream *>(stream);
const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
ANGLE_EGL_VALIDATE(thread, StreamConsumerGLTextureExternalAttribsNV,
GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked, streamPacked,
attrib_listPacked);
return StreamConsumerGLTextureExternalAttribsNV(thread, dpyPacked, streamPacked,
attrib_listPacked);
}
} // extern "C"
......@@ -153,26 +153,29 @@ TEST_P(EGLDebugTest, SetLabel)
{
ANGLE_SKIP_TEST_IF(!hasExtension());
EGLDisplay display = getEGLWindow()->getDisplay();
EGLSurface surface = getEGLWindow()->getSurface();
EXPECT_EQ(static_cast<EGLint>(EGL_SUCCESS), eglDebugMessageControlKHR(nullptr, nullptr));
// Display display and object must be equal when setting a display label
EXPECT_EQ(static_cast<EGLint>(EGL_SUCCESS),
eglLabelObjectKHR(getEGLWindow()->getDisplay(), EGL_OBJECT_DISPLAY_KHR,
getEGLWindow()->getDisplay(), const_cast<char *>("Display")));
EXPECT_EQ(
static_cast<EGLint>(EGL_SUCCESS),
eglLabelObjectKHR(display, EGL_OBJECT_DISPLAY_KHR, display, const_cast<char *>("Display")));
EXPECT_NE(static_cast<EGLint>(EGL_SUCCESS),
eglLabelObjectKHR(nullptr, EGL_OBJECT_DISPLAY_KHR, getEGLWindow()->getDisplay(),
const_cast<char *>("Display")));
// Set a surface label
EXPECT_EQ(static_cast<EGLint>(EGL_SUCCESS),
eglLabelObjectKHR(getEGLWindow()->getDisplay(), EGL_OBJECT_SURFACE_KHR,
getEGLWindow()->getSurface(), const_cast<char *>("Surface")));
EXPECT_EQ(
static_cast<EGLint>(EGL_SUCCESS),
eglLabelObjectKHR(display, EGL_OBJECT_SURFACE_KHR, surface, const_cast<char *>("Surface")));
EXPECT_EGL_ERROR(EGL_SUCCESS);
// Provide a surface but use an image label type
EXPECT_EQ(static_cast<EGLint>(EGL_BAD_PARAMETER),
eglLabelObjectKHR(getEGLWindow()->getDisplay(), EGL_OBJECT_IMAGE_KHR,
getEGLWindow()->getSurface(), const_cast<char *>("Image")));
EXPECT_EQ(
static_cast<EGLint>(EGL_BAD_PARAMETER),
eglLabelObjectKHR(display, EGL_OBJECT_IMAGE_KHR, surface, const_cast<char *>("Image")));
EXPECT_EGL_ERROR(EGL_BAD_PARAMETER);
}
......
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