Android Build Tools
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,3 @@
|
||||
DisableFormat: true
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: false
|
||||
@ -0,0 +1,338 @@
|
||||
//
|
||||
// Copyright (c) 2015 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.
|
||||
|
||||
// Platform.h: The public interface ANGLE exposes to the API layer, for
|
||||
// doing platform-specific tasks like gathering data, or for tracing.
|
||||
|
||||
#ifndef ANGLE_PLATFORM_H
|
||||
#define ANGLE_PLATFORM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <array>
|
||||
|
||||
#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x3482
|
||||
|
||||
#if defined(_WIN32)
|
||||
# if !defined(LIBANGLE_IMPLEMENTATION)
|
||||
# define ANGLE_PLATFORM_EXPORT __declspec(dllimport)
|
||||
# else
|
||||
# define ANGLE_PLATFORM_EXPORT __declspec(dllexport)
|
||||
# endif
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
# define ANGLE_PLATFORM_EXPORT __attribute__((visibility ("default")))
|
||||
#endif
|
||||
#if !defined(ANGLE_PLATFORM_EXPORT)
|
||||
# define ANGLE_PLATFORM_EXPORT
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define ANGLE_APIENTRY __stdcall
|
||||
#else
|
||||
# define ANGLE_APIENTRY
|
||||
#endif
|
||||
|
||||
namespace angle
|
||||
{
|
||||
struct WorkaroundsD3D;
|
||||
struct FeaturesVk;
|
||||
using TraceEventHandle = uint64_t;
|
||||
using EGLDisplayType = void *;
|
||||
struct PlatformMethods;
|
||||
|
||||
// Use a C-like API to not trigger undefined calling behaviour.
|
||||
// Avoid using decltype here to work around sanitizer limitations.
|
||||
// TODO(jmadill): Use decltype here if/when UBSAN is fixed.
|
||||
|
||||
// System --------------------------------------------------------------
|
||||
|
||||
// Wall clock time in seconds since the epoch.
|
||||
// TODO(jmadill): investigate using an ANGLE internal time library
|
||||
using CurrentTimeFunc = double (*)(PlatformMethods *platform);
|
||||
inline double DefaultCurrentTime(PlatformMethods *platform)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// Monotonically increasing time in seconds from an arbitrary fixed point in the past.
|
||||
// This function is expected to return at least millisecond-precision values. For this reason,
|
||||
// it is recommended that the fixed point be no further in the past than the epoch.
|
||||
using MonotonicallyIncreasingTimeFunc = double (*)(PlatformMethods *platform);
|
||||
inline double DefaultMonotonicallyIncreasingTime(PlatformMethods *platform)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// Logging ------------------------------------------------------------
|
||||
|
||||
// Log an error message within the platform implementation.
|
||||
using LogErrorFunc = void (*)(PlatformMethods *platform, const char *errorMessage);
|
||||
inline void DefaultLogError(PlatformMethods *platform, const char *errorMessage)
|
||||
{
|
||||
}
|
||||
|
||||
// Log a warning message within the platform implementation.
|
||||
using LogWarningFunc = void (*)(PlatformMethods *platform, const char *warningMessage);
|
||||
inline void DefaultLogWarning(PlatformMethods *platform, const char *warningMessage)
|
||||
{
|
||||
}
|
||||
|
||||
// Log an info message within the platform implementation.
|
||||
using LogInfoFunc = void (*)(PlatformMethods *platform, const char *infoMessage);
|
||||
inline void DefaultLogInfo(PlatformMethods *platform, const char *infoMessage)
|
||||
{
|
||||
}
|
||||
|
||||
// Tracing --------
|
||||
|
||||
// Get a pointer to the enabled state of the given trace category. The
|
||||
// embedder can dynamically change the enabled state as trace event
|
||||
// recording is started and stopped by the application. Only long-lived
|
||||
// literal strings should be given as the category name. The implementation
|
||||
// expects the returned pointer to be held permanently in a local static. If
|
||||
// the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
|
||||
// addTraceEvent is expected to be called by the trace event macros.
|
||||
using GetTraceCategoryEnabledFlagFunc = const unsigned char *(*)(PlatformMethods *platform,
|
||||
const char *categoryName);
|
||||
inline const unsigned char *DefaultGetTraceCategoryEnabledFlag(PlatformMethods *platform,
|
||||
const char *categoryName)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//
|
||||
// Add a trace event to the platform tracing system. Depending on the actual
|
||||
// enabled state, this event may be recorded or dropped.
|
||||
// - phase specifies the type of event:
|
||||
// - BEGIN ('B'): Marks the beginning of a scoped event.
|
||||
// - END ('E'): Marks the end of a scoped event.
|
||||
// - COMPLETE ('X'): Marks the beginning of a scoped event, but doesn't
|
||||
// need a matching END event. Instead, at the end of the scope,
|
||||
// updateTraceEventDuration() must be called with the TraceEventHandle
|
||||
// returned from addTraceEvent().
|
||||
// - INSTANT ('I'): Standalone, instantaneous event.
|
||||
// - START ('S'): Marks the beginning of an asynchronous event (the end
|
||||
// event can occur in a different scope or thread). The id parameter is
|
||||
// used to match START/FINISH pairs.
|
||||
// - FINISH ('F'): Marks the end of an asynchronous event.
|
||||
// - COUNTER ('C'): Used to trace integer quantities that change over
|
||||
// time. The argument values are expected to be of type int.
|
||||
// - METADATA ('M'): Reserved for internal use.
|
||||
// - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag.
|
||||
// - name is the name of the event. Also used to match BEGIN/END and
|
||||
// START/FINISH pairs.
|
||||
// - id optionally allows events of the same name to be distinguished from
|
||||
// each other. For example, to trace the construction and destruction of
|
||||
// objects, specify the pointer as the id parameter.
|
||||
// - timestamp should be a time value returned from monotonicallyIncreasingTime.
|
||||
// - numArgs specifies the number of elements in argNames, argTypes, and
|
||||
// argValues.
|
||||
// - argNames is the array of argument names. Use long-lived literal strings
|
||||
// or specify the COPY flag.
|
||||
// - argTypes is the array of argument types:
|
||||
// - BOOL (1): bool
|
||||
// - UINT (2): unsigned long long
|
||||
// - INT (3): long long
|
||||
// - DOUBLE (4): double
|
||||
// - POINTER (5): void*
|
||||
// - STRING (6): char* (long-lived null-terminated char* string)
|
||||
// - COPY_STRING (7): char* (temporary null-terminated char* string)
|
||||
// - CONVERTABLE (8): WebConvertableToTraceFormat
|
||||
// - argValues is the array of argument values. Each value is the unsigned
|
||||
// long long member of a union of all supported types.
|
||||
// - flags can be 0 or one or more of the following, ORed together:
|
||||
// - COPY (0x1): treat all strings (name, argNames and argValues of type
|
||||
// string) as temporary so that they will be copied by addTraceEvent.
|
||||
// - HAS_ID (0x2): use the id argument to uniquely identify the event for
|
||||
// matching with other events of the same name.
|
||||
// - MANGLE_ID (0x4): specify this flag if the id parameter is the value
|
||||
// of a pointer.
|
||||
using AddTraceEventFunc = angle::TraceEventHandle (*)(PlatformMethods *platform,
|
||||
char phase,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
double timestamp,
|
||||
int numArgs,
|
||||
const char **argNames,
|
||||
const unsigned char *argTypes,
|
||||
const unsigned long long *argValues,
|
||||
unsigned char flags);
|
||||
inline angle::TraceEventHandle DefaultAddTraceEvent(PlatformMethods *platform,
|
||||
char phase,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
double timestamp,
|
||||
int numArgs,
|
||||
const char **argNames,
|
||||
const unsigned char *argTypes,
|
||||
const unsigned long long *argValues,
|
||||
unsigned char flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set the duration field of a COMPLETE trace event.
|
||||
using UpdateTraceEventDurationFunc = void (*)(PlatformMethods *platform,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
const char *name,
|
||||
angle::TraceEventHandle eventHandle);
|
||||
inline void DefaultUpdateTraceEventDuration(PlatformMethods *platform,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
const char *name,
|
||||
angle::TraceEventHandle eventHandle)
|
||||
{
|
||||
}
|
||||
|
||||
// Callbacks for reporting histogram data.
|
||||
// CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50
|
||||
// would do.
|
||||
using HistogramCustomCountsFunc = void (*)(PlatformMethods *platform,
|
||||
const char *name,
|
||||
int sample,
|
||||
int min,
|
||||
int max,
|
||||
int bucketCount);
|
||||
inline void DefaultHistogramCustomCounts(PlatformMethods *platform,
|
||||
const char *name,
|
||||
int sample,
|
||||
int min,
|
||||
int max,
|
||||
int bucketCount)
|
||||
{
|
||||
}
|
||||
// Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample
|
||||
// value.
|
||||
using HistogramEnumerationFunc = void (*)(PlatformMethods *platform,
|
||||
const char *name,
|
||||
int sample,
|
||||
int boundaryValue);
|
||||
inline void DefaultHistogramEnumeration(PlatformMethods *platform,
|
||||
const char *name,
|
||||
int sample,
|
||||
int boundaryValue)
|
||||
{
|
||||
}
|
||||
// Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets.
|
||||
using HistogramSparseFunc = void (*)(PlatformMethods *platform, const char *name, int sample);
|
||||
inline void DefaultHistogramSparse(PlatformMethods *platform, const char *name, int sample)
|
||||
{
|
||||
}
|
||||
// Boolean histograms track two-state variables.
|
||||
using HistogramBooleanFunc = void (*)(PlatformMethods *platform, const char *name, bool sample);
|
||||
inline void DefaultHistogramBoolean(PlatformMethods *platform, const char *name, bool sample)
|
||||
{
|
||||
}
|
||||
|
||||
// Allows us to programatically override ANGLE's default workarounds for testing purposes.
|
||||
using OverrideWorkaroundsD3DFunc = void (*)(PlatformMethods *platform,
|
||||
angle::WorkaroundsD3D *workaroundsD3D);
|
||||
inline void DefaultOverrideWorkaroundsD3D(PlatformMethods *platform,
|
||||
angle::WorkaroundsD3D *workaroundsD3D)
|
||||
{
|
||||
}
|
||||
|
||||
using OverrideFeaturesVkFunc = void (*)(PlatformMethods *platform,
|
||||
angle::FeaturesVk *workaroundsVulkan);
|
||||
inline void DefaultOverrideFeaturesVk(PlatformMethods *platform,
|
||||
angle::FeaturesVk *workaroundsVulkan)
|
||||
{
|
||||
}
|
||||
|
||||
// Callback on a successful program link with the program binary. Can be used to store
|
||||
// shaders to disk. Keys are a 160-bit SHA-1 hash.
|
||||
using ProgramKeyType = std::array<uint8_t, 20>;
|
||||
using CacheProgramFunc = void (*)(PlatformMethods *platform,
|
||||
const ProgramKeyType &key,
|
||||
size_t programSize,
|
||||
const uint8_t *programBytes);
|
||||
inline void DefaultCacheProgram(PlatformMethods *platform,
|
||||
const ProgramKeyType &key,
|
||||
size_t programSize,
|
||||
const uint8_t *programBytes)
|
||||
{
|
||||
}
|
||||
|
||||
// Platform methods are enumerated here once.
|
||||
#define ANGLE_PLATFORM_OP(OP) \
|
||||
OP(currentTime, CurrentTime) \
|
||||
OP(monotonicallyIncreasingTime, MonotonicallyIncreasingTime) \
|
||||
OP(logError, LogError) \
|
||||
OP(logWarning, LogWarning) \
|
||||
OP(logInfo, LogInfo) \
|
||||
OP(getTraceCategoryEnabledFlag, GetTraceCategoryEnabledFlag) \
|
||||
OP(addTraceEvent, AddTraceEvent) \
|
||||
OP(updateTraceEventDuration, UpdateTraceEventDuration) \
|
||||
OP(histogramCustomCounts, HistogramCustomCounts) \
|
||||
OP(histogramEnumeration, HistogramEnumeration) \
|
||||
OP(histogramSparse, HistogramSparse) \
|
||||
OP(histogramBoolean, HistogramBoolean) \
|
||||
OP(overrideWorkaroundsD3D, OverrideWorkaroundsD3D) \
|
||||
OP(overrideFeaturesVk, OverrideFeaturesVk) \
|
||||
OP(cacheProgram, CacheProgram)
|
||||
|
||||
#define ANGLE_PLATFORM_METHOD_DEF(Name, CapsName) CapsName##Func Name = Default##CapsName;
|
||||
|
||||
struct ANGLE_PLATFORM_EXPORT PlatformMethods
|
||||
{
|
||||
PlatformMethods() {}
|
||||
|
||||
// User data pointer for any implementation specific members. Put it at the start of the
|
||||
// platform structure so it doesn't become overwritten if one version of the platform
|
||||
// adds or removes new members.
|
||||
void *context = 0;
|
||||
|
||||
ANGLE_PLATFORM_OP(ANGLE_PLATFORM_METHOD_DEF);
|
||||
};
|
||||
|
||||
#undef ANGLE_PLATFORM_METHOD_DEF
|
||||
|
||||
// Subtract one to account for the context pointer.
|
||||
constexpr unsigned int g_NumPlatformMethods = (sizeof(PlatformMethods) / sizeof(uintptr_t)) - 1;
|
||||
|
||||
#define ANGLE_PLATFORM_METHOD_STRING(Name) #Name
|
||||
#define ANGLE_PLATFORM_METHOD_STRING2(Name, CapsName) ANGLE_PLATFORM_METHOD_STRING(Name),
|
||||
|
||||
constexpr const char *const g_PlatformMethodNames[g_NumPlatformMethods] = {
|
||||
ANGLE_PLATFORM_OP(ANGLE_PLATFORM_METHOD_STRING2)};
|
||||
|
||||
#undef ANGLE_PLATFORM_METHOD_STRING2
|
||||
#undef ANGLE_PLATFORM_METHOD_STRING
|
||||
|
||||
} // namespace angle
|
||||
|
||||
extern "C" {
|
||||
|
||||
// Gets the platform methods on the passed-in EGL display. If the method name signature does not
|
||||
// match the compiled signature for this ANGLE, false is returned. On success true is returned.
|
||||
// The application should set any platform methods it cares about on the returned pointer.
|
||||
// If display is not valid, behaviour is undefined.
|
||||
|
||||
ANGLE_PLATFORM_EXPORT bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display,
|
||||
const char *const methodNames[],
|
||||
unsigned int methodNameCount,
|
||||
void *context,
|
||||
void *platformMethodsOut);
|
||||
|
||||
// Sets the platform methods back to their defaults.
|
||||
// If display is not valid, behaviour is undefined.
|
||||
ANGLE_PLATFORM_EXPORT void ANGLE_APIENTRY ANGLEResetDisplayPlatform(angle::EGLDisplayType display);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
typedef bool(ANGLE_APIENTRY *GetDisplayPlatformFunc)(angle::EGLDisplayType,
|
||||
const char *const *,
|
||||
unsigned int,
|
||||
void *,
|
||||
void *);
|
||||
typedef void(ANGLE_APIENTRY *ResetDisplayPlatformFunc)(angle::EGLDisplayType);
|
||||
} // namespace angle
|
||||
|
||||
// This function is not exported
|
||||
angle::PlatformMethods *ANGLEPlatformCurrent();
|
||||
|
||||
#endif // ANGLE_PLATFORM_H
|
||||
@ -0,0 +1,303 @@
|
||||
#ifndef __egl_h_
|
||||
#define __egl_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2017 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** http://www.khronos.org/registry/egl
|
||||
**
|
||||
** Khronos $Git commit SHA1: bae3518c48 $ on $Git commit date: 2018-05-17 10:56:57 -0700 $
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
/* Generated on date 20180517 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
* Versions considered: .*
|
||||
* Versions emitted: .*
|
||||
* Default extensions included: None
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef EGL_VERSION_1_0
|
||||
#define EGL_VERSION_1_0 1
|
||||
typedef unsigned int EGLBoolean;
|
||||
typedef void *EGLDisplay;
|
||||
#include <KHR/khrplatform.h>
|
||||
#include <EGL/eglplatform.h>
|
||||
typedef void *EGLConfig;
|
||||
typedef void *EGLSurface;
|
||||
typedef void *EGLContext;
|
||||
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
||||
#define EGL_ALPHA_SIZE 0x3021
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
#define EGL_BAD_PARAMETER 0x300C
|
||||
#define EGL_BAD_SURFACE 0x300D
|
||||
#define EGL_BLUE_SIZE 0x3022
|
||||
#define EGL_BUFFER_SIZE 0x3020
|
||||
#define EGL_CONFIG_CAVEAT 0x3027
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_DONT_CARE EGL_CAST(EGLint,-1)
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_EXTENSIONS 0x3055
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_GREEN_SIZE 0x3023
|
||||
#define EGL_HEIGHT 0x3056
|
||||
#define EGL_LARGEST_PBUFFER 0x3058
|
||||
#define EGL_LEVEL 0x3029
|
||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
#define EGL_NONE 0x3038
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
|
||||
#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
|
||||
#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
|
||||
#define EGL_PBUFFER_BIT 0x0001
|
||||
#define EGL_PIXMAP_BIT 0x0002
|
||||
#define EGL_READ 0x305A
|
||||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
||||
#define EGL_SLOW_CONFIG 0x3050
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
#define EGL_TRANSPARENT_RGB 0x3052
|
||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
||||
#define EGL_TRUE 1
|
||||
#define EGL_VENDOR 0x3053
|
||||
#define EGL_VERSION 0x3054
|
||||
#define EGL_WIDTH 0x3057
|
||||
#define EGL_WINDOW_BIT 0x0004
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
|
||||
EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
|
||||
EGLAPI EGLint EGLAPIENTRY eglGetError (void);
|
||||
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
|
||||
EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
|
||||
#endif /* EGL_VERSION_1_0 */
|
||||
|
||||
#ifndef EGL_VERSION_1_1
|
||||
#define EGL_VERSION_1_1 1
|
||||
#define EGL_BACK_BUFFER 0x3084
|
||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
#define EGL_CONTEXT_LOST 0x300E
|
||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
#define EGL_MIPMAP_TEXTURE 0x3082
|
||||
#define EGL_MIPMAP_LEVEL 0x3083
|
||||
#define EGL_NO_TEXTURE 0x305C
|
||||
#define EGL_TEXTURE_2D 0x305F
|
||||
#define EGL_TEXTURE_FORMAT 0x3080
|
||||
#define EGL_TEXTURE_RGB 0x305D
|
||||
#define EGL_TEXTURE_RGBA 0x305E
|
||||
#define EGL_TEXTURE_TARGET 0x3081
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
|
||||
#endif /* EGL_VERSION_1_1 */
|
||||
|
||||
#ifndef EGL_VERSION_1_2
|
||||
#define EGL_VERSION_1_2 1
|
||||
typedef unsigned int EGLenum;
|
||||
typedef void *EGLClientBuffer;
|
||||
#define EGL_ALPHA_FORMAT 0x3088
|
||||
#define EGL_ALPHA_FORMAT_NONPRE 0x308B
|
||||
#define EGL_ALPHA_FORMAT_PRE 0x308C
|
||||
#define EGL_ALPHA_MASK_SIZE 0x303E
|
||||
#define EGL_BUFFER_PRESERVED 0x3094
|
||||
#define EGL_BUFFER_DESTROYED 0x3095
|
||||
#define EGL_CLIENT_APIS 0x308D
|
||||
#define EGL_COLORSPACE 0x3087
|
||||
#define EGL_COLORSPACE_sRGB 0x3089
|
||||
#define EGL_COLORSPACE_LINEAR 0x308A
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303F
|
||||
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
|
||||
#define EGL_DISPLAY_SCALING 10000
|
||||
#define EGL_HORIZONTAL_RESOLUTION 0x3090
|
||||
#define EGL_LUMINANCE_BUFFER 0x308F
|
||||
#define EGL_LUMINANCE_SIZE 0x303D
|
||||
#define EGL_OPENGL_ES_BIT 0x0001
|
||||
#define EGL_OPENVG_BIT 0x0002
|
||||
#define EGL_OPENGL_ES_API 0x30A0
|
||||
#define EGL_OPENVG_API 0x30A1
|
||||
#define EGL_OPENVG_IMAGE 0x3096
|
||||
#define EGL_PIXEL_ASPECT_RATIO 0x3092
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_RENDER_BUFFER 0x3086
|
||||
#define EGL_RGB_BUFFER 0x308E
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
||||
#define EGL_UNKNOWN EGL_CAST(EGLint,-1)
|
||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
|
||||
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
||||
#ifndef EGL_VERSION_1_3
|
||||
#define EGL_VERSION_1_3 1
|
||||
#define EGL_CONFORMANT 0x3042
|
||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||
#define EGL_MATCH_NATIVE_PIXMAP 0x3041
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004
|
||||
#define EGL_VG_ALPHA_FORMAT 0x3088
|
||||
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
|
||||
#define EGL_VG_COLORSPACE 0x3087
|
||||
#define EGL_VG_COLORSPACE_sRGB 0x3089
|
||||
#define EGL_VG_COLORSPACE_LINEAR 0x308A
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
|
||||
#endif /* EGL_VERSION_1_3 */
|
||||
|
||||
#ifndef EGL_VERSION_1_4
|
||||
#define EGL_VERSION_1_4 1
|
||||
#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
|
||||
#define EGL_MULTISAMPLE_RESOLVE 0x3099
|
||||
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
|
||||
#define EGL_OPENGL_API 0x30A2
|
||||
#define EGL_OPENGL_BIT 0x0008
|
||||
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
|
||||
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
|
||||
#endif /* EGL_VERSION_1_4 */
|
||||
|
||||
#ifndef EGL_VERSION_1_5
|
||||
#define EGL_VERSION_1_5 1
|
||||
typedef void *EGLSync;
|
||||
typedef intptr_t EGLAttrib;
|
||||
typedef khronos_utime_nanoseconds_t EGLTime;
|
||||
typedef void *EGLImage;
|
||||
#define EGL_CONTEXT_MAJOR_VERSION 0x3098
|
||||
#define EGL_CONTEXT_MINOR_VERSION 0x30FB
|
||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
|
||||
#define EGL_NO_RESET_NOTIFICATION 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
|
||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
|
||||
#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
|
||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
|
||||
#define EGL_OPENGL_ES3_BIT 0x00000040
|
||||
#define EGL_CL_EVENT_HANDLE 0x309C
|
||||
#define EGL_SYNC_CL_EVENT 0x30FE
|
||||
#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
|
||||
#define EGL_SYNC_TYPE 0x30F7
|
||||
#define EGL_SYNC_STATUS 0x30F1
|
||||
#define EGL_SYNC_CONDITION 0x30F8
|
||||
#define EGL_SIGNALED 0x30F2
|
||||
#define EGL_UNSIGNALED 0x30F3
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
|
||||
#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_TIMEOUT_EXPIRED 0x30F5
|
||||
#define EGL_CONDITION_SATISFIED 0x30F6
|
||||
#define EGL_NO_SYNC EGL_CAST(EGLSync,0)
|
||||
#define EGL_SYNC_FENCE 0x30F9
|
||||
#define EGL_GL_COLORSPACE 0x309D
|
||||
#define EGL_GL_COLORSPACE_SRGB 0x3089
|
||||
#define EGL_GL_COLORSPACE_LINEAR 0x308A
|
||||
#define EGL_GL_RENDERBUFFER 0x30B9
|
||||
#define EGL_GL_TEXTURE_2D 0x30B1
|
||||
#define EGL_GL_TEXTURE_LEVEL 0x30BC
|
||||
#define EGL_GL_TEXTURE_3D 0x30B2
|
||||
#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
|
||||
#define EGL_IMAGE_PRESERVED 0x30D2
|
||||
#define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
|
||||
EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
|
||||
EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
|
||||
#endif /* EGL_VERSION_1_5 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,211 @@
|
||||
//
|
||||
// Copyright (c) 2017 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.
|
||||
//
|
||||
// eglext_angle.h: ANGLE modifications to the eglext.h header file.
|
||||
|
||||
#ifndef INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
#define INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef EGL_ANGLE_robust_resource_initialization
|
||||
#define EGL_ANGLE_robust_resource_initialization 1
|
||||
#define EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE 0x3453
|
||||
#endif /* EGL_ANGLE_robust_resource_initialization */
|
||||
|
||||
#ifndef EGL_ANGLE_keyed_mutex
|
||||
#define EGL_ANGLE_keyed_mutex 1
|
||||
#define EGL_DXGI_KEYED_MUTEX_ANGLE 0x33A2
|
||||
#endif /* EGL_ANGLE_keyed_mutex */
|
||||
|
||||
#ifndef EGL_ANGLE_d3d_texture_client_buffer
|
||||
#define EGL_ANGLE_d3d_texture_client_buffer 1
|
||||
#define EGL_D3D_TEXTURE_ANGLE 0x33A3
|
||||
#endif /* EGL_ANGLE_d3d_texture_client_buffer */
|
||||
|
||||
#ifndef EGL_ANGLE_software_display
|
||||
#define EGL_ANGLE_software_display 1
|
||||
#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
|
||||
#endif /* EGL_ANGLE_software_display */
|
||||
|
||||
#ifndef EGL_ANGLE_direct3d_display
|
||||
#define EGL_ANGLE_direct3d_display 1
|
||||
#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ((EGLNativeDisplayType)-2)
|
||||
#define EGL_D3D11_ONLY_DISPLAY_ANGLE ((EGLNativeDisplayType)-3)
|
||||
#endif /* EGL_ANGLE_direct3d_display */
|
||||
|
||||
#ifndef EGL_ANGLE_direct_composition
|
||||
#define EGL_ANGLE_direct_composition 1
|
||||
#define EGL_DIRECT_COMPOSITION_ANGLE 0x33A5
|
||||
#endif /* EGL_ANGLE_direct_composition */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle
|
||||
#define EGL_ANGLE_platform_angle 1
|
||||
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
|
||||
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204
|
||||
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206
|
||||
#define EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE 0x3451
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x345E
|
||||
#endif /* EGL_ANGLE_platform_angle */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_d3d
|
||||
#define EGL_ANGLE_platform_angle_d3d 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE 0x320B
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE 0x320C
|
||||
#define EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
|
||||
#endif /* EGL_ANGLE_platform_angle_d3d */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_opengl
|
||||
#define EGL_ANGLE_platform_angle_opengl 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
|
||||
#define EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE 0x3480
|
||||
#endif /* EGL_ANGLE_platform_angle_opengl */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_null
|
||||
#define EGL_ANGLE_platform_angle_null 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE 0x33AE
|
||||
#endif /* EGL_ANGLE_platform_angle_null */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_vulkan
|
||||
#define EGL_ANGLE_platform_angle_vulkan 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450
|
||||
#endif /* EGL_ANGLE_platform_angle_vulkan */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_context_virtualization
|
||||
#define EGL_ANGLE_platform_angle_context_virtualization 1
|
||||
#define EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_ANGLE 0x3481
|
||||
#endif /* EGL_ANGLE_platform_angle_context_virtualization */
|
||||
|
||||
#ifndef EGL_ANGLE_x11_visual
|
||||
#define EGL_ANGLE_x11_visual
|
||||
#define EGL_X11_VISUAL_ID_ANGLE 0x33A3
|
||||
#endif /* EGL_ANGLE_x11_visual */
|
||||
|
||||
#ifndef EGL_ANGLE_flexible_surface_compatibility
|
||||
#define EGL_ANGLE_flexible_surface_compatibility 1
|
||||
#define EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE 0x33A6
|
||||
#endif /* EGL_ANGLE_flexible_surface_compatibility */
|
||||
|
||||
#ifndef EGL_ANGLE_surface_orientation
|
||||
#define EGL_ANGLE_surface_orientation
|
||||
#define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7
|
||||
#define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8
|
||||
#define EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE 0x0001
|
||||
#define EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE 0x0002
|
||||
#endif /* EGL_ANGLE_surface_orientation */
|
||||
|
||||
#ifndef EGL_ANGLE_experimental_present_path
|
||||
#define EGL_ANGLE_experimental_present_path
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE 0x33A4
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE 0x33A9
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE 0x33AA
|
||||
#endif /* EGL_ANGLE_experimental_present_path */
|
||||
|
||||
#ifndef EGL_ANGLE_stream_producer_d3d_texture
|
||||
#define EGL_ANGLE_stream_producer_d3d_texture
|
||||
#define EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE 0x33AB
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC)(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC)(EGLDisplay dpy, EGLStreamKHR stream, void *texture, const EGLAttrib *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCreateStreamProducerD3DTextureANGLE(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamPostD3DTextureANGLE(EGLDisplay dpy, EGLStreamKHR stream, void *texture, const EGLAttrib *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_stream_producer_d3d_texture */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_webgl_compatibility
|
||||
#define EGL_ANGLE_create_context_webgl_compatibility 1
|
||||
#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x33AC
|
||||
#endif /* EGL_ANGLE_create_context_webgl_compatibility */
|
||||
|
||||
#ifndef EGL_ANGLE_display_texture_share_group
|
||||
#define EGL_ANGLE_display_texture_share_group 1
|
||||
#define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x33AF
|
||||
#endif /* EGL_ANGLE_display_texture_share_group */
|
||||
|
||||
#ifndef EGL_CHROMIUM_create_context_bind_generates_resource
|
||||
#define EGL_CHROMIUM_create_context_bind_generates_resource 1
|
||||
#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x33AD
|
||||
#endif /* EGL_CHROMIUM_create_context_bind_generates_resource */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_client_arrays
|
||||
#define EGL_ANGLE_create_context_client_arrays 1
|
||||
#define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE 0x3452
|
||||
#endif /* EGL_ANGLE_create_context_client_arrays */
|
||||
|
||||
#ifndef EGL_ANGLE_device_creation
|
||||
#define EGL_ANGLE_device_creation 1
|
||||
typedef EGLDeviceEXT(EGLAPIENTRYP PFNEGLCREATEDEVICEANGLEPROC) (EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLRELEASEDEVICEANGLEPROC) (EGLDeviceEXT device);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLDeviceEXT EGLAPIENTRY eglCreateDeviceANGLE(EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE(EGLDeviceEXT device);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_device_creation */
|
||||
|
||||
#ifndef EGL_ANGLE_program_cache_control
|
||||
#define EGL_ANGLE_program_cache_control 1
|
||||
#define EGL_PROGRAM_CACHE_SIZE_ANGLE 0x3455
|
||||
#define EGL_PROGRAM_CACHE_KEY_LENGTH_ANGLE 0x3456
|
||||
#define EGL_PROGRAM_CACHE_RESIZE_ANGLE 0x3457
|
||||
#define EGL_PROGRAM_CACHE_TRIM_ANGLE 0x3458
|
||||
#define EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE 0x3459
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLPROGRAMCACHEGETATTRIBANGLEPROC) (EGLDisplay dpy, EGLenum attrib);
|
||||
typedef void (EGLAPIENTRYP PFNEGLPROGRAMCACHEQUERYANGLEPROC) (EGLDisplay dpy, EGLint index, void *key, EGLint *keysize, void *binary, EGLint *binarysize);
|
||||
typedef void (EGLAPIENTRYP PFNEGPROGRAMCACHELPOPULATEANGLEPROC) (EGLDisplay dpy, const void *key, EGLint keysize, const void *binary, EGLint binarysize);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLPROGRAMCACHERESIZEANGLEPROC) (EGLDisplay dpy, EGLint limit, EGLenum mode);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLint EGLAPIENTRY eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib);
|
||||
EGLAPI void EGLAPIENTRY eglProgramCacheQueryANGLE(EGLDisplay dpy, EGLint index, void *key, EGLint *keysize, void *binary, EGLint *binarysize);
|
||||
EGLAPI void EGLAPIENTRY eglProgramCachePopulateANGLE(EGLDisplay dpy, const void *key, EGLint keysize, const void *binary, EGLint binarysize);
|
||||
EGLAPI EGLint EGLAPIENTRY eglProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLenum mode);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_program_cache_control */
|
||||
|
||||
#ifndef EGL_ANGLE_iosurface_client_buffer
|
||||
#define EGL_ANGLE_iosurface_client_buffer 1
|
||||
#define EGL_IOSURFACE_ANGLE 0x3454
|
||||
#define EGL_IOSURFACE_PLANE_ANGLE 0x345A
|
||||
#define EGL_TEXTURE_RECTANGLE_ANGLE 0x345B
|
||||
#define EGL_TEXTURE_TYPE_ANGLE 0x345C
|
||||
#define EGL_TEXTURE_INTERNAL_FORMAT_ANGLE 0x345D
|
||||
#endif /* EGL_ANGLE_iosurface_client_buffer */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_extensions_enabled
|
||||
#define EGL_ANGLE_create_context_extensions_enabled 1
|
||||
#define EGL_EXTENSIONS_ENABLED_ANGLE 0x345F
|
||||
#endif /* EGL_ANGLE_create_context_extensions_enabled */
|
||||
|
||||
#ifndef EGL_ANGLE_feature_control
|
||||
#define EGL_ANGLE_feature_control 1
|
||||
#define EGL_FEATURE_NAME_ANGLE 0x3460
|
||||
#define EGL_FEATURE_CATEGORY_ANGLE 0x3461
|
||||
#define EGL_FEATURE_DESCRIPTION_ANGLE 0x3462
|
||||
#define EGL_FEATURE_BUG_ANGLE 0x3463
|
||||
#define EGL_FEATURE_STATUS_ANGLE 0x3464
|
||||
#define EGL_FEATURE_COUNT_ANGLE 0x3465
|
||||
#define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
|
||||
#define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
|
||||
#define EGL_FEATURE_CONDITION_ANGLE 0x3468
|
||||
#define EGL_FEATURE_ALL_DISABLED_ANGLE 0x3469
|
||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGIANGLEPROC) (EGLDisplay dpy, EGLint name, EGLint index);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBANGLEPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI const char *EGLAPIENTRY eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribANGLE(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_feature_control */
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif // INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
@ -0,0 +1,164 @@
|
||||
#ifndef __eglplatform_h_
|
||||
#define __eglplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2016 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for egl.h
|
||||
* $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* You are encouraged to submit all modifications to the Khronos group so that
|
||||
* they can be included in future versions of this file. Please submit changes
|
||||
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
|
||||
* by filing a bug against product "EGL" component "Registry".
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
/* Macros used in EGL function prototype declarations.
|
||||
*
|
||||
* EGL functions should be prototyped as:
|
||||
*
|
||||
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
|
||||
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
|
||||
*
|
||||
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
|
||||
*/
|
||||
|
||||
#ifndef EGLAPI
|
||||
#define EGLAPI KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef EGLAPIENTRY
|
||||
#define EGLAPIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
#define EGLAPIENTRYP EGLAPIENTRY*
|
||||
|
||||
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
|
||||
* are aliases of window-system-dependent types, such as X Display * or
|
||||
* Windows Device Context. They must be defined in platform-specific
|
||||
* code below. The EGL-prefixed versions of Native*Type are the same
|
||||
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
|
||||
*
|
||||
* Khronos STRONGLY RECOMMENDS that you use the default definitions
|
||||
* provided below, since these changes affect both binary and source
|
||||
* portability of applications using EGL running on different EGL
|
||||
* implementations.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
typedef HDC EGLNativeDisplayType;
|
||||
typedef HBITMAP EGLNativePixmapType;
|
||||
typedef HWND EGLNativeWindowType;
|
||||
|
||||
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
|
||||
|
||||
typedef int EGLNativeDisplayType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
|
||||
#elif defined(WL_EGL_PLATFORM)
|
||||
|
||||
typedef struct wl_display *EGLNativeDisplayType;
|
||||
typedef struct wl_egl_pixmap *EGLNativePixmapType;
|
||||
typedef struct wl_egl_window *EGLNativeWindowType;
|
||||
|
||||
#elif defined(__GBM__)
|
||||
|
||||
typedef struct gbm_device *EGLNativeDisplayType;
|
||||
typedef struct gbm_bo *EGLNativePixmapType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
|
||||
#elif defined(__ANDROID__) || defined(ANDROID)
|
||||
|
||||
struct ANativeWindow;
|
||||
struct egl_native_pixmap_t;
|
||||
|
||||
typedef struct ANativeWindow* EGLNativeWindowType;
|
||||
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
|
||||
typedef void* EGLNativeDisplayType;
|
||||
|
||||
#elif defined(USE_OZONE)
|
||||
|
||||
typedef intptr_t EGLNativeDisplayType;
|
||||
typedef intptr_t EGLNativeWindowType;
|
||||
typedef intptr_t EGLNativePixmapType;
|
||||
|
||||
#elif defined(__unix__) || defined(USE_X11)
|
||||
|
||||
/* X11 (tentative) */
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
typedef Display *EGLNativeDisplayType;
|
||||
typedef Pixmap EGLNativePixmapType;
|
||||
typedef Window EGLNativeWindowType;
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
typedef int EGLNativeDisplayType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
#include <kernel/image.h>
|
||||
|
||||
typedef void *EGLNativeDisplayType;
|
||||
typedef khronos_uintptr_t EGLNativePixmapType;
|
||||
typedef khronos_uintptr_t EGLNativeWindowType;
|
||||
|
||||
#else
|
||||
#error "Platform not recognized"
|
||||
#endif
|
||||
|
||||
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
|
||||
typedef EGLNativeDisplayType NativeDisplayType;
|
||||
typedef EGLNativePixmapType NativePixmapType;
|
||||
typedef EGLNativeWindowType NativeWindowType;
|
||||
|
||||
|
||||
/* Define EGLint. This must be a signed integral type large enough to contain
|
||||
* all legal attribute names and values passed into and out of EGL, whether
|
||||
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
|
||||
* handle, or other. While in general a 32-bit integer will suffice, if
|
||||
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
|
||||
* integer type.
|
||||
*/
|
||||
typedef khronos_int32_t EGLint;
|
||||
|
||||
|
||||
/* C++ / C typecast macros for special EGL handle values */
|
||||
#if defined(__cplusplus)
|
||||
#define EGL_CAST(type, value) (static_cast<type>(value))
|
||||
#else
|
||||
#define EGL_CAST(type, value) ((type) (value))
|
||||
#endif
|
||||
|
||||
#endif /* __eglplatform_h */
|
||||
@ -0,0 +1,29 @@
|
||||
/*
|
||||
** Copyright (c) 2008-2017 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Skeleton egl.h to provide compatibility for early GLES 1.0
|
||||
* applications. Several early implementations included gl.h
|
||||
* in egl.h leading applications to include only egl.h
|
||||
*/
|
||||
|
||||
#ifndef __legacy_egl_h_
|
||||
#define __legacy_egl_h_
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#endif /* __legacy_egl_h_ */
|
||||
@ -0,0 +1,591 @@
|
||||
#ifndef __gl_h_
|
||||
#define __gl_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2017 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#include <GLES/glplatform.h>
|
||||
|
||||
/* Generated on date 20170613 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: gles1
|
||||
* Profile: common
|
||||
* Versions considered: .*
|
||||
* Versions emitted: .*
|
||||
* Default extensions included: None
|
||||
* Additional extensions included: ^(GL_OES_read_format|GL_OES_compressed_paletted_texture|GL_OES_point_size_array|GL_OES_point_sprite)$
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef GL_VERSION_ES_CM_1_0
|
||||
#define GL_VERSION_ES_CM_1_0 1
|
||||
typedef void GLvoid;
|
||||
typedef char GLchar;
|
||||
typedef unsigned int GLenum;
|
||||
#include <KHR/khrplatform.h>
|
||||
typedef khronos_float_t GLfloat;
|
||||
typedef khronos_int32_t GLfixed;
|
||||
typedef unsigned int GLuint;
|
||||
typedef khronos_ssize_t GLsizeiptr;
|
||||
typedef khronos_intptr_t GLintptr;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef int GLint;
|
||||
typedef unsigned short GLushort;
|
||||
typedef short GLshort;
|
||||
typedef khronos_int8_t GLbyte;
|
||||
typedef khronos_uint8_t GLubyte;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef int GLsizei;
|
||||
typedef khronos_float_t GLclampf;
|
||||
typedef khronos_int32_t GLclampx;
|
||||
#define GL_VERSION_ES_CL_1_0 1
|
||||
#define GL_VERSION_ES_CM_1_1 1
|
||||
#define GL_VERSION_ES_CL_1_1 1
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_FALSE 0
|
||||
#define GL_TRUE 1
|
||||
#define GL_POINTS 0x0000
|
||||
#define GL_LINES 0x0001
|
||||
#define GL_LINE_LOOP 0x0002
|
||||
#define GL_LINE_STRIP 0x0003
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_TRIANGLE_STRIP 0x0005
|
||||
#define GL_TRIANGLE_FAN 0x0006
|
||||
#define GL_NEVER 0x0200
|
||||
#define GL_LESS 0x0201
|
||||
#define GL_EQUAL 0x0202
|
||||
#define GL_LEQUAL 0x0203
|
||||
#define GL_GREATER 0x0204
|
||||
#define GL_NOTEQUAL 0x0205
|
||||
#define GL_GEQUAL 0x0206
|
||||
#define GL_ALWAYS 0x0207
|
||||
#define GL_ZERO 0
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_COLOR 0x0300
|
||||
#define GL_ONE_MINUS_SRC_COLOR 0x0301
|
||||
#define GL_SRC_ALPHA 0x0302
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_DST_ALPHA 0x0304
|
||||
#define GL_ONE_MINUS_DST_ALPHA 0x0305
|
||||
#define GL_DST_COLOR 0x0306
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x0307
|
||||
#define GL_SRC_ALPHA_SATURATE 0x0308
|
||||
#define GL_CLIP_PLANE0 0x3000
|
||||
#define GL_CLIP_PLANE1 0x3001
|
||||
#define GL_CLIP_PLANE2 0x3002
|
||||
#define GL_CLIP_PLANE3 0x3003
|
||||
#define GL_CLIP_PLANE4 0x3004
|
||||
#define GL_CLIP_PLANE5 0x3005
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_FRONT_AND_BACK 0x0408
|
||||
#define GL_FOG 0x0B60
|
||||
#define GL_LIGHTING 0x0B50
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_ALPHA_TEST 0x0BC0
|
||||
#define GL_BLEND 0x0BE2
|
||||
#define GL_COLOR_LOGIC_OP 0x0BF2
|
||||
#define GL_DITHER 0x0BD0
|
||||
#define GL_STENCIL_TEST 0x0B90
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
#define GL_POINT_SMOOTH 0x0B10
|
||||
#define GL_LINE_SMOOTH 0x0B20
|
||||
#define GL_SCISSOR_TEST 0x0C11
|
||||
#define GL_COLOR_MATERIAL 0x0B57
|
||||
#define GL_NORMALIZE 0x0BA1
|
||||
#define GL_RESCALE_NORMAL 0x803A
|
||||
#define GL_VERTEX_ARRAY 0x8074
|
||||
#define GL_NORMAL_ARRAY 0x8075
|
||||
#define GL_COLOR_ARRAY 0x8076
|
||||
#define GL_TEXTURE_COORD_ARRAY 0x8078
|
||||
#define GL_MULTISAMPLE 0x809D
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
|
||||
#define GL_SAMPLE_COVERAGE 0x80A0
|
||||
#define GL_NO_ERROR 0
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_STACK_OVERFLOW 0x0503
|
||||
#define GL_STACK_UNDERFLOW 0x0504
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
#define GL_EXP 0x0800
|
||||
#define GL_EXP2 0x0801
|
||||
#define GL_FOG_DENSITY 0x0B62
|
||||
#define GL_FOG_START 0x0B63
|
||||
#define GL_FOG_END 0x0B64
|
||||
#define GL_FOG_MODE 0x0B65
|
||||
#define GL_FOG_COLOR 0x0B66
|
||||
#define GL_CW 0x0900
|
||||
#define GL_CCW 0x0901
|
||||
#define GL_CURRENT_COLOR 0x0B00
|
||||
#define GL_CURRENT_NORMAL 0x0B02
|
||||
#define GL_CURRENT_TEXTURE_COORDS 0x0B03
|
||||
#define GL_POINT_SIZE 0x0B11
|
||||
#define GL_POINT_SIZE_MIN 0x8126
|
||||
#define GL_POINT_SIZE_MAX 0x8127
|
||||
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
|
||||
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
|
||||
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
|
||||
#define GL_LINE_WIDTH 0x0B21
|
||||
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
#define GL_CULL_FACE_MODE 0x0B45
|
||||
#define GL_FRONT_FACE 0x0B46
|
||||
#define GL_SHADE_MODEL 0x0B54
|
||||
#define GL_DEPTH_RANGE 0x0B70
|
||||
#define GL_DEPTH_WRITEMASK 0x0B72
|
||||
#define GL_DEPTH_CLEAR_VALUE 0x0B73
|
||||
#define GL_DEPTH_FUNC 0x0B74
|
||||
#define GL_STENCIL_CLEAR_VALUE 0x0B91
|
||||
#define GL_STENCIL_FUNC 0x0B92
|
||||
#define GL_STENCIL_VALUE_MASK 0x0B93
|
||||
#define GL_STENCIL_FAIL 0x0B94
|
||||
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
|
||||
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
|
||||
#define GL_STENCIL_REF 0x0B97
|
||||
#define GL_STENCIL_WRITEMASK 0x0B98
|
||||
#define GL_MATRIX_MODE 0x0BA0
|
||||
#define GL_VIEWPORT 0x0BA2
|
||||
#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
|
||||
#define GL_PROJECTION_STACK_DEPTH 0x0BA4
|
||||
#define GL_TEXTURE_STACK_DEPTH 0x0BA5
|
||||
#define GL_MODELVIEW_MATRIX 0x0BA6
|
||||
#define GL_PROJECTION_MATRIX 0x0BA7
|
||||
#define GL_TEXTURE_MATRIX 0x0BA8
|
||||
#define GL_ALPHA_TEST_FUNC 0x0BC1
|
||||
#define GL_ALPHA_TEST_REF 0x0BC2
|
||||
#define GL_BLEND_DST 0x0BE0
|
||||
#define GL_BLEND_SRC 0x0BE1
|
||||
#define GL_LOGIC_OP_MODE 0x0BF0
|
||||
#define GL_SCISSOR_BOX 0x0C10
|
||||
#define GL_COLOR_CLEAR_VALUE 0x0C22
|
||||
#define GL_COLOR_WRITEMASK 0x0C23
|
||||
#define GL_MAX_LIGHTS 0x0D31
|
||||
#define GL_MAX_CLIP_PLANES 0x0D32
|
||||
#define GL_MAX_TEXTURE_SIZE 0x0D33
|
||||
#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
|
||||
#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
|
||||
#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
|
||||
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
|
||||
#define GL_MAX_TEXTURE_UNITS 0x84E2
|
||||
#define GL_SUBPIXEL_BITS 0x0D50
|
||||
#define GL_RED_BITS 0x0D52
|
||||
#define GL_GREEN_BITS 0x0D53
|
||||
#define GL_BLUE_BITS 0x0D54
|
||||
#define GL_ALPHA_BITS 0x0D55
|
||||
#define GL_DEPTH_BITS 0x0D56
|
||||
#define GL_STENCIL_BITS 0x0D57
|
||||
#define GL_POLYGON_OFFSET_UNITS 0x2A00
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_POLYGON_OFFSET_FACTOR 0x8038
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_VERTEX_ARRAY_SIZE 0x807A
|
||||
#define GL_VERTEX_ARRAY_TYPE 0x807B
|
||||
#define GL_VERTEX_ARRAY_STRIDE 0x807C
|
||||
#define GL_NORMAL_ARRAY_TYPE 0x807E
|
||||
#define GL_NORMAL_ARRAY_STRIDE 0x807F
|
||||
#define GL_COLOR_ARRAY_SIZE 0x8081
|
||||
#define GL_COLOR_ARRAY_TYPE 0x8082
|
||||
#define GL_COLOR_ARRAY_STRIDE 0x8083
|
||||
#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
|
||||
#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
|
||||
#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
|
||||
#define GL_VERTEX_ARRAY_POINTER 0x808E
|
||||
#define GL_NORMAL_ARRAY_POINTER 0x808F
|
||||
#define GL_COLOR_ARRAY_POINTER 0x8090
|
||||
#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
|
||||
#define GL_SAMPLE_BUFFERS 0x80A8
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
#define GL_DONT_CARE 0x1100
|
||||
#define GL_FASTEST 0x1101
|
||||
#define GL_NICEST 0x1102
|
||||
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
|
||||
#define GL_POINT_SMOOTH_HINT 0x0C51
|
||||
#define GL_LINE_SMOOTH_HINT 0x0C52
|
||||
#define GL_FOG_HINT 0x0C54
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
#define GL_LIGHT_MODEL_AMBIENT 0x0B53
|
||||
#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
|
||||
#define GL_AMBIENT 0x1200
|
||||
#define GL_DIFFUSE 0x1201
|
||||
#define GL_SPECULAR 0x1202
|
||||
#define GL_POSITION 0x1203
|
||||
#define GL_SPOT_DIRECTION 0x1204
|
||||
#define GL_SPOT_EXPONENT 0x1205
|
||||
#define GL_SPOT_CUTOFF 0x1206
|
||||
#define GL_CONSTANT_ATTENUATION 0x1207
|
||||
#define GL_LINEAR_ATTENUATION 0x1208
|
||||
#define GL_QUADRATIC_ATTENUATION 0x1209
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_SHORT 0x1402
|
||||
#define GL_UNSIGNED_SHORT 0x1403
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FIXED 0x140C
|
||||
#define GL_CLEAR 0x1500
|
||||
#define GL_AND 0x1501
|
||||
#define GL_AND_REVERSE 0x1502
|
||||
#define GL_COPY 0x1503
|
||||
#define GL_AND_INVERTED 0x1504
|
||||
#define GL_NOOP 0x1505
|
||||
#define GL_XOR 0x1506
|
||||
#define GL_OR 0x1507
|
||||
#define GL_NOR 0x1508
|
||||
#define GL_EQUIV 0x1509
|
||||
#define GL_INVERT 0x150A
|
||||
#define GL_OR_REVERSE 0x150B
|
||||
#define GL_COPY_INVERTED 0x150C
|
||||
#define GL_OR_INVERTED 0x150D
|
||||
#define GL_NAND 0x150E
|
||||
#define GL_SET 0x150F
|
||||
#define GL_EMISSION 0x1600
|
||||
#define GL_SHININESS 0x1601
|
||||
#define GL_AMBIENT_AND_DIFFUSE 0x1602
|
||||
#define GL_MODELVIEW 0x1700
|
||||
#define GL_PROJECTION 0x1701
|
||||
#define GL_TEXTURE 0x1702
|
||||
#define GL_ALPHA 0x1906
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_LUMINANCE 0x1909
|
||||
#define GL_LUMINANCE_ALPHA 0x190A
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define GL_PACK_ALIGNMENT 0x0D05
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
|
||||
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
|
||||
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
|
||||
#define GL_FLAT 0x1D00
|
||||
#define GL_SMOOTH 0x1D01
|
||||
#define GL_KEEP 0x1E00
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_INCR 0x1E02
|
||||
#define GL_DECR 0x1E03
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
#define GL_MODULATE 0x2100
|
||||
#define GL_DECAL 0x2101
|
||||
#define GL_ADD 0x0104
|
||||
#define GL_TEXTURE_ENV_MODE 0x2200
|
||||
#define GL_TEXTURE_ENV_COLOR 0x2201
|
||||
#define GL_TEXTURE_ENV 0x2300
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR 0x2601
|
||||
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
|
||||
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
|
||||
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_TEXTURE_WRAP_T 0x2803
|
||||
#define GL_GENERATE_MIPMAP 0x8191
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
#define GL_TEXTURE3 0x84C3
|
||||
#define GL_TEXTURE4 0x84C4
|
||||
#define GL_TEXTURE5 0x84C5
|
||||
#define GL_TEXTURE6 0x84C6
|
||||
#define GL_TEXTURE7 0x84C7
|
||||
#define GL_TEXTURE8 0x84C8
|
||||
#define GL_TEXTURE9 0x84C9
|
||||
#define GL_TEXTURE10 0x84CA
|
||||
#define GL_TEXTURE11 0x84CB
|
||||
#define GL_TEXTURE12 0x84CC
|
||||
#define GL_TEXTURE13 0x84CD
|
||||
#define GL_TEXTURE14 0x84CE
|
||||
#define GL_TEXTURE15 0x84CF
|
||||
#define GL_TEXTURE16 0x84D0
|
||||
#define GL_TEXTURE17 0x84D1
|
||||
#define GL_TEXTURE18 0x84D2
|
||||
#define GL_TEXTURE19 0x84D3
|
||||
#define GL_TEXTURE20 0x84D4
|
||||
#define GL_TEXTURE21 0x84D5
|
||||
#define GL_TEXTURE22 0x84D6
|
||||
#define GL_TEXTURE23 0x84D7
|
||||
#define GL_TEXTURE24 0x84D8
|
||||
#define GL_TEXTURE25 0x84D9
|
||||
#define GL_TEXTURE26 0x84DA
|
||||
#define GL_TEXTURE27 0x84DB
|
||||
#define GL_TEXTURE28 0x84DC
|
||||
#define GL_TEXTURE29 0x84DD
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#define GL_LIGHT0 0x4000
|
||||
#define GL_LIGHT1 0x4001
|
||||
#define GL_LIGHT2 0x4002
|
||||
#define GL_LIGHT3 0x4003
|
||||
#define GL_LIGHT4 0x4004
|
||||
#define GL_LIGHT5 0x4005
|
||||
#define GL_LIGHT6 0x4006
|
||||
#define GL_LIGHT7 0x4007
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
|
||||
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
|
||||
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
|
||||
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
#define GL_BUFFER_SIZE 0x8764
|
||||
#define GL_BUFFER_USAGE 0x8765
|
||||
#define GL_SUBTRACT 0x84E7
|
||||
#define GL_COMBINE 0x8570
|
||||
#define GL_COMBINE_RGB 0x8571
|
||||
#define GL_COMBINE_ALPHA 0x8572
|
||||
#define GL_RGB_SCALE 0x8573
|
||||
#define GL_ADD_SIGNED 0x8574
|
||||
#define GL_INTERPOLATE 0x8575
|
||||
#define GL_CONSTANT 0x8576
|
||||
#define GL_PRIMARY_COLOR 0x8577
|
||||
#define GL_PREVIOUS 0x8578
|
||||
#define GL_OPERAND0_RGB 0x8590
|
||||
#define GL_OPERAND1_RGB 0x8591
|
||||
#define GL_OPERAND2_RGB 0x8592
|
||||
#define GL_OPERAND0_ALPHA 0x8598
|
||||
#define GL_OPERAND1_ALPHA 0x8599
|
||||
#define GL_OPERAND2_ALPHA 0x859A
|
||||
#define GL_ALPHA_SCALE 0x0D1C
|
||||
#define GL_SRC0_RGB 0x8580
|
||||
#define GL_SRC1_RGB 0x8581
|
||||
#define GL_SRC2_RGB 0x8582
|
||||
#define GL_SRC0_ALPHA 0x8588
|
||||
#define GL_SRC1_ALPHA 0x8589
|
||||
#define GL_SRC2_ALPHA 0x858A
|
||||
#define GL_DOT3_RGB 0x86AE
|
||||
#define GL_DOT3_RGBA 0x86AF
|
||||
GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLfloat ref);
|
||||
GL_API void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_API void GL_APIENTRY glClearDepthf (GLfloat d);
|
||||
GL_API void GL_APIENTRY glClipPlanef (GLenum p, const GLfloat *eqn);
|
||||
GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_API void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
|
||||
GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glFrustumf (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
|
||||
GL_API void GL_APIENTRY glGetClipPlanef (GLenum plane, GLfloat *equation);
|
||||
GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
|
||||
GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
|
||||
GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
|
||||
GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
|
||||
GL_API void GL_APIENTRY glOrthof (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
|
||||
GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glPointSize (GLfloat size);
|
||||
GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLfixed ref);
|
||||
GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
GL_API void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_API void GL_APIENTRY glClearColorx (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
GL_API void GL_APIENTRY glClearDepthx (GLfixed depth);
|
||||
GL_API void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
|
||||
GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
|
||||
GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
|
||||
GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
|
||||
GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||
GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||
GL_API void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_API void GL_APIENTRY glDepthRangex (GLfixed n, GLfixed f);
|
||||
GL_API void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_API void GL_APIENTRY glDisableClientState (GLenum array);
|
||||
GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
GL_API void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_API void GL_APIENTRY glEnableClientState (GLenum array);
|
||||
GL_API void GL_APIENTRY glFinish (void);
|
||||
GL_API void GL_APIENTRY glFlush (void);
|
||||
GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *param);
|
||||
GL_API void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_API void GL_APIENTRY glFrustumx (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
|
||||
GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
|
||||
GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetClipPlanex (GLenum plane, GLfixed *equation);
|
||||
GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||
GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||
GL_API GLenum GL_APIENTRY glGetError (void);
|
||||
GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
|
||||
GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetPointerv (GLenum pname, void **params);
|
||||
GL_API const GLubyte *GL_APIENTRY glGetString (GLenum name);
|
||||
GL_API void GL_APIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetTexEnvxv (GLenum target, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *param);
|
||||
GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
|
||||
GL_API void GL_APIENTRY glLoadIdentity (void);
|
||||
GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
|
||||
GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *param);
|
||||
GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
|
||||
GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
|
||||
GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
|
||||
GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const void *pointer);
|
||||
GL_API void GL_APIENTRY glOrthox (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
|
||||
GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glPointSizex (GLfixed size);
|
||||
GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
|
||||
GL_API void GL_APIENTRY glPopMatrix (void);
|
||||
GL_API void GL_APIENTRY glPushMatrix (void);
|
||||
GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
|
||||
GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
|
||||
GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glShadeModel (GLenum mode);
|
||||
GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_API void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#endif /* GL_VERSION_ES_CM_1_0 */
|
||||
|
||||
#ifndef GL_OES_compressed_paletted_texture
|
||||
#define GL_OES_compressed_paletted_texture 1
|
||||
#define GL_PALETTE4_RGB8_OES 0x8B90
|
||||
#define GL_PALETTE4_RGBA8_OES 0x8B91
|
||||
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
|
||||
#define GL_PALETTE4_RGBA4_OES 0x8B93
|
||||
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
|
||||
#define GL_PALETTE8_RGB8_OES 0x8B95
|
||||
#define GL_PALETTE8_RGBA8_OES 0x8B96
|
||||
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
|
||||
#define GL_PALETTE8_RGBA4_OES 0x8B98
|
||||
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
|
||||
#endif /* GL_OES_compressed_paletted_texture */
|
||||
|
||||
#ifndef GL_OES_point_size_array
|
||||
#define GL_OES_point_size_array 1
|
||||
#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
|
||||
#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
|
||||
#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
|
||||
#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
|
||||
#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
|
||||
GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const void *pointer);
|
||||
#endif /* GL_OES_point_size_array */
|
||||
|
||||
#ifndef GL_OES_point_sprite
|
||||
#define GL_OES_point_sprite 1
|
||||
#define GL_POINT_SPRITE_OES 0x8861
|
||||
#define GL_COORD_REPLACE_OES 0x8862
|
||||
#endif /* GL_OES_point_sprite */
|
||||
|
||||
#ifndef GL_OES_read_format
|
||||
#define GL_OES_read_format 1
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
|
||||
#endif /* GL_OES_read_format */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,948 @@
|
||||
#ifndef __glext_h_
|
||||
#define __glext_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2017 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#ifndef GL_APIENTRYP
|
||||
#define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
/* Generated on date 20170613 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: gles1
|
||||
* Profile: common
|
||||
* Versions considered: .*
|
||||
* Versions emitted: _nomatch_^
|
||||
* Default extensions included: gles1
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: ^(GL_OES_read_format|GL_OES_compressed_paletted_texture|GL_OES_point_size_array|GL_OES_point_sprite)$
|
||||
*/
|
||||
|
||||
#ifndef GL_OES_EGL_image
|
||||
#define GL_OES_EGL_image 1
|
||||
typedef void *GLeglImageOES;
|
||||
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
|
||||
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
|
||||
GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
|
||||
#endif
|
||||
#endif /* GL_OES_EGL_image */
|
||||
|
||||
#ifndef GL_OES_EGL_image_external
|
||||
#define GL_OES_EGL_image_external 1
|
||||
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
|
||||
#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
|
||||
#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
|
||||
#endif /* GL_OES_EGL_image_external */
|
||||
|
||||
#ifndef GL_OES_blend_equation_separate
|
||||
#define GL_OES_blend_equation_separate 1
|
||||
#define GL_BLEND_EQUATION_RGB_OES 0x8009
|
||||
#define GL_BLEND_EQUATION_ALPHA_OES 0x883D
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha);
|
||||
#endif
|
||||
#endif /* GL_OES_blend_equation_separate */
|
||||
|
||||
#ifndef GL_OES_blend_func_separate
|
||||
#define GL_OES_blend_func_separate 1
|
||||
#define GL_BLEND_DST_RGB_OES 0x80C8
|
||||
#define GL_BLEND_SRC_RGB_OES 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA_OES 0x80CA
|
||||
#define GL_BLEND_SRC_ALPHA_OES 0x80CB
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
#endif
|
||||
#endif /* GL_OES_blend_func_separate */
|
||||
|
||||
#ifndef GL_OES_blend_subtract
|
||||
#define GL_OES_blend_subtract 1
|
||||
#define GL_BLEND_EQUATION_OES 0x8009
|
||||
#define GL_FUNC_ADD_OES 0x8006
|
||||
#define GL_FUNC_SUBTRACT_OES 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode);
|
||||
#endif
|
||||
#endif /* GL_OES_blend_subtract */
|
||||
|
||||
#ifndef GL_OES_byte_coordinates
|
||||
#define GL_OES_byte_coordinates 1
|
||||
#endif /* GL_OES_byte_coordinates */
|
||||
|
||||
#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture
|
||||
#define GL_OES_compressed_ETC1_RGB8_sub_texture 1
|
||||
#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */
|
||||
|
||||
#ifndef GL_OES_compressed_ETC1_RGB8_texture
|
||||
#define GL_OES_compressed_ETC1_RGB8_texture 1
|
||||
#define GL_ETC1_RGB8_OES 0x8D64
|
||||
#endif /* GL_OES_compressed_ETC1_RGB8_texture */
|
||||
|
||||
#ifndef GL_OES_depth24
|
||||
#define GL_OES_depth24 1
|
||||
#define GL_DEPTH_COMPONENT24_OES 0x81A6
|
||||
#endif /* GL_OES_depth24 */
|
||||
|
||||
#ifndef GL_OES_depth32
|
||||
#define GL_OES_depth32 1
|
||||
#define GL_DEPTH_COMPONENT32_OES 0x81A7
|
||||
#endif /* GL_OES_depth32 */
|
||||
|
||||
#ifndef GL_OES_draw_texture
|
||||
#define GL_OES_draw_texture 1
|
||||
#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
|
||||
GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
|
||||
GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
|
||||
GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
|
||||
GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
|
||||
GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
|
||||
GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
|
||||
GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
|
||||
#endif
|
||||
#endif /* GL_OES_draw_texture */
|
||||
|
||||
#ifndef GL_OES_element_index_uint
|
||||
#define GL_OES_element_index_uint 1
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
#endif /* GL_OES_element_index_uint */
|
||||
|
||||
#ifndef GL_OES_extended_matrix_palette
|
||||
#define GL_OES_extended_matrix_palette 1
|
||||
#endif /* GL_OES_extended_matrix_palette */
|
||||
|
||||
#ifndef GL_OES_fbo_render_mipmap
|
||||
#define GL_OES_fbo_render_mipmap 1
|
||||
#endif /* GL_OES_fbo_render_mipmap */
|
||||
|
||||
#ifndef GL_OES_fixed_point
|
||||
#define GL_OES_fixed_point 1
|
||||
#define GL_FIXED_OES 0x140C
|
||||
typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth);
|
||||
typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
|
||||
typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f);
|
||||
typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param);
|
||||
typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
|
||||
typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param);
|
||||
typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
|
||||
typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
|
||||
typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
|
||||
typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
|
||||
typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
|
||||
typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
|
||||
typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
|
||||
typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
|
||||
typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
|
||||
typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref);
|
||||
GL_API void GL_APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
GL_API void GL_APIENTRY glClearDepthxOES (GLfixed depth);
|
||||
GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
|
||||
GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
GL_API void GL_APIENTRY glDepthRangexOES (GLfixed n, GLfixed f);
|
||||
GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *param);
|
||||
GL_API void GL_APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
|
||||
GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation);
|
||||
GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param);
|
||||
GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width);
|
||||
GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param);
|
||||
GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
|
||||
GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
|
||||
GL_API void GL_APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
|
||||
GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glPointSizexOES (GLfixed size);
|
||||
GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
|
||||
GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert);
|
||||
GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
|
||||
#endif
|
||||
#endif /* GL_OES_fixed_point */
|
||||
|
||||
#ifndef GL_OES_framebuffer_object
|
||||
#define GL_OES_framebuffer_object 1
|
||||
#define GL_NONE_OES 0
|
||||
#define GL_FRAMEBUFFER_OES 0x8D40
|
||||
#define GL_RENDERBUFFER_OES 0x8D41
|
||||
#define GL_RGBA4_OES 0x8056
|
||||
#define GL_RGB5_A1_OES 0x8057
|
||||
#define GL_RGB565_OES 0x8D62
|
||||
#define GL_DEPTH_COMPONENT16_OES 0x81A5
|
||||
#define GL_RENDERBUFFER_WIDTH_OES 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44
|
||||
#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50
|
||||
#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51
|
||||
#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52
|
||||
#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3
|
||||
#define GL_COLOR_ATTACHMENT0_OES 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT_OES 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT_OES 0x8D20
|
||||
#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD
|
||||
#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING_OES 0x8CA7
|
||||
#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint *renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint *renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint *framebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint *framebuffers);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer);
|
||||
GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer);
|
||||
GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint *renderbuffers);
|
||||
GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint *renderbuffers);
|
||||
GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint *params);
|
||||
GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer);
|
||||
GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer);
|
||||
GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint *framebuffers);
|
||||
GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint *framebuffers);
|
||||
GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target);
|
||||
GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target);
|
||||
#endif
|
||||
#endif /* GL_OES_framebuffer_object */
|
||||
|
||||
#ifndef GL_OES_mapbuffer
|
||||
#define GL_OES_mapbuffer 1
|
||||
#define GL_WRITE_ONLY_OES 0x88B9
|
||||
#define GL_BUFFER_ACCESS_OES 0x88BB
|
||||
#define GL_BUFFER_MAPPED_OES 0x88BC
|
||||
#define GL_BUFFER_MAP_POINTER_OES 0x88BD
|
||||
typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
|
||||
GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
|
||||
GL_API void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params);
|
||||
#endif
|
||||
#endif /* GL_OES_mapbuffer */
|
||||
|
||||
#ifndef GL_OES_matrix_get
|
||||
#define GL_OES_matrix_get 1
|
||||
#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D
|
||||
#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E
|
||||
#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F
|
||||
#endif /* GL_OES_matrix_get */
|
||||
|
||||
#ifndef GL_OES_matrix_palette
|
||||
#define GL_OES_matrix_palette 1
|
||||
#define GL_MAX_VERTEX_UNITS_OES 0x86A4
|
||||
#define GL_MAX_PALETTE_MATRICES_OES 0x8842
|
||||
#define GL_MATRIX_PALETTE_OES 0x8840
|
||||
#define GL_MATRIX_INDEX_ARRAY_OES 0x8844
|
||||
#define GL_WEIGHT_ARRAY_OES 0x86AD
|
||||
#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843
|
||||
#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846
|
||||
#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847
|
||||
#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848
|
||||
#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849
|
||||
#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E
|
||||
#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB
|
||||
#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9
|
||||
#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA
|
||||
#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC
|
||||
#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E
|
||||
typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
|
||||
typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex);
|
||||
GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void);
|
||||
GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
#endif
|
||||
#endif /* GL_OES_matrix_palette */
|
||||
|
||||
#ifndef GL_OES_packed_depth_stencil
|
||||
#define GL_OES_packed_depth_stencil 1
|
||||
#define GL_DEPTH_STENCIL_OES 0x84F9
|
||||
#define GL_UNSIGNED_INT_24_8_OES 0x84FA
|
||||
#define GL_DEPTH24_STENCIL8_OES 0x88F0
|
||||
#endif /* GL_OES_packed_depth_stencil */
|
||||
|
||||
#ifndef GL_OES_query_matrix
|
||||
#define GL_OES_query_matrix 1
|
||||
typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent);
|
||||
#endif
|
||||
#endif /* GL_OES_query_matrix */
|
||||
|
||||
#ifndef GL_OES_required_internalformat
|
||||
#define GL_OES_required_internalformat 1
|
||||
#define GL_ALPHA8_OES 0x803C
|
||||
#define GL_LUMINANCE4_ALPHA4_OES 0x8043
|
||||
#define GL_LUMINANCE8_ALPHA8_OES 0x8045
|
||||
#define GL_LUMINANCE8_OES 0x8040
|
||||
#define GL_RGB8_OES 0x8051
|
||||
#define GL_RGBA8_OES 0x8058
|
||||
#define GL_RGB10_EXT 0x8052
|
||||
#define GL_RGB10_A2_EXT 0x8059
|
||||
#endif /* GL_OES_required_internalformat */
|
||||
|
||||
#ifndef GL_OES_rgb8_rgba8
|
||||
#define GL_OES_rgb8_rgba8 1
|
||||
#endif /* GL_OES_rgb8_rgba8 */
|
||||
|
||||
#ifndef GL_OES_single_precision
|
||||
#define GL_OES_single_precision 1
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
|
||||
typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);
|
||||
typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
|
||||
typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation);
|
||||
typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
|
||||
GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
|
||||
GL_API void GL_APIENTRY glDepthRangefOES (GLclampf n, GLclampf f);
|
||||
GL_API void GL_APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
|
||||
GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation);
|
||||
GL_API void GL_APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
|
||||
#endif
|
||||
#endif /* GL_OES_single_precision */
|
||||
|
||||
#ifndef GL_OES_stencil1
|
||||
#define GL_OES_stencil1 1
|
||||
#define GL_STENCIL_INDEX1_OES 0x8D46
|
||||
#endif /* GL_OES_stencil1 */
|
||||
|
||||
#ifndef GL_OES_stencil4
|
||||
#define GL_OES_stencil4 1
|
||||
#define GL_STENCIL_INDEX4_OES 0x8D47
|
||||
#endif /* GL_OES_stencil4 */
|
||||
|
||||
#ifndef GL_OES_stencil8
|
||||
#define GL_OES_stencil8 1
|
||||
#define GL_STENCIL_INDEX8_OES 0x8D48
|
||||
#endif /* GL_OES_stencil8 */
|
||||
|
||||
#ifndef GL_OES_stencil_wrap
|
||||
#define GL_OES_stencil_wrap 1
|
||||
#define GL_INCR_WRAP_OES 0x8507
|
||||
#define GL_DECR_WRAP_OES 0x8508
|
||||
#endif /* GL_OES_stencil_wrap */
|
||||
|
||||
#ifndef GL_OES_texture_cube_map
|
||||
#define GL_OES_texture_cube_map 1
|
||||
#define GL_NORMAL_MAP_OES 0x8511
|
||||
#define GL_REFLECTION_MAP_OES 0x8512
|
||||
#define GL_TEXTURE_CUBE_MAP_OES 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C
|
||||
#define GL_TEXTURE_GEN_MODE_OES 0x2500
|
||||
#define GL_TEXTURE_GEN_STR_OES 0x8D60
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params);
|
||||
GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params);
|
||||
#endif
|
||||
#endif /* GL_OES_texture_cube_map */
|
||||
|
||||
#ifndef GL_OES_texture_env_crossbar
|
||||
#define GL_OES_texture_env_crossbar 1
|
||||
#endif /* GL_OES_texture_env_crossbar */
|
||||
|
||||
#ifndef GL_OES_texture_mirrored_repeat
|
||||
#define GL_OES_texture_mirrored_repeat 1
|
||||
#define GL_MIRRORED_REPEAT_OES 0x8370
|
||||
#endif /* GL_OES_texture_mirrored_repeat */
|
||||
|
||||
#ifndef GL_OES_vertex_array_object
|
||||
#define GL_OES_vertex_array_object 1
|
||||
#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
|
||||
typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
|
||||
typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glBindVertexArrayOES (GLuint array);
|
||||
GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
|
||||
GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
|
||||
GL_API GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
|
||||
#endif
|
||||
#endif /* GL_OES_vertex_array_object */
|
||||
|
||||
#ifndef GL_AMD_compressed_3DC_texture
|
||||
#define GL_AMD_compressed_3DC_texture 1
|
||||
#define GL_3DC_X_AMD 0x87F9
|
||||
#define GL_3DC_XY_AMD 0x87FA
|
||||
#endif /* GL_AMD_compressed_3DC_texture */
|
||||
|
||||
#ifndef GL_AMD_compressed_ATC_texture
|
||||
#define GL_AMD_compressed_ATC_texture 1
|
||||
#define GL_ATC_RGB_AMD 0x8C92
|
||||
#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
|
||||
#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
|
||||
#endif /* GL_AMD_compressed_ATC_texture */
|
||||
|
||||
#ifndef GL_APPLE_copy_texture_levels
|
||||
#define GL_APPLE_copy_texture_levels 1
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
|
||||
#endif
|
||||
#endif /* GL_APPLE_copy_texture_levels */
|
||||
|
||||
#ifndef GL_APPLE_framebuffer_multisample
|
||||
#define GL_APPLE_framebuffer_multisample 1
|
||||
#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
|
||||
#define GL_MAX_SAMPLES_APPLE 0x8D57
|
||||
#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
|
||||
#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
|
||||
#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
|
||||
#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
|
||||
#endif
|
||||
#endif /* GL_APPLE_framebuffer_multisample */
|
||||
|
||||
#ifndef GL_APPLE_sync
|
||||
#define GL_APPLE_sync 1
|
||||
typedef struct __GLsync *GLsync;
|
||||
typedef khronos_uint64_t GLuint64;
|
||||
typedef khronos_int64_t GLint64;
|
||||
#define GL_SYNC_OBJECT_APPLE 0x8A53
|
||||
#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
|
||||
#define GL_OBJECT_TYPE_APPLE 0x9112
|
||||
#define GL_SYNC_CONDITION_APPLE 0x9113
|
||||
#define GL_SYNC_STATUS_APPLE 0x9114
|
||||
#define GL_SYNC_FLAGS_APPLE 0x9115
|
||||
#define GL_SYNC_FENCE_APPLE 0x9116
|
||||
#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
|
||||
#define GL_UNSIGNALED_APPLE 0x9118
|
||||
#define GL_SIGNALED_APPLE 0x9119
|
||||
#define GL_ALREADY_SIGNALED_APPLE 0x911A
|
||||
#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
|
||||
#define GL_CONDITION_SATISFIED_APPLE 0x911C
|
||||
#define GL_WAIT_FAILED_APPLE 0x911D
|
||||
#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
|
||||
#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
|
||||
typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
|
||||
typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
|
||||
GL_API GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
|
||||
GL_API void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
|
||||
GL_API GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
|
||||
GL_API void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
|
||||
GL_API void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
|
||||
GL_API void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
|
||||
#endif
|
||||
#endif /* GL_APPLE_sync */
|
||||
|
||||
#ifndef GL_APPLE_texture_2D_limited_npot
|
||||
#define GL_APPLE_texture_2D_limited_npot 1
|
||||
#endif /* GL_APPLE_texture_2D_limited_npot */
|
||||
|
||||
#ifndef GL_APPLE_texture_format_BGRA8888
|
||||
#define GL_APPLE_texture_format_BGRA8888 1
|
||||
#define GL_BGRA_EXT 0x80E1
|
||||
#define GL_BGRA8_EXT 0x93A1
|
||||
#endif /* GL_APPLE_texture_format_BGRA8888 */
|
||||
|
||||
#ifndef GL_APPLE_texture_max_level
|
||||
#define GL_APPLE_texture_max_level 1
|
||||
#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
|
||||
#endif /* GL_APPLE_texture_max_level */
|
||||
|
||||
#ifndef GL_ARM_rgba8
|
||||
#define GL_ARM_rgba8 1
|
||||
#endif /* GL_ARM_rgba8 */
|
||||
|
||||
#ifndef GL_EXT_blend_minmax
|
||||
#define GL_EXT_blend_minmax 1
|
||||
#define GL_MIN_EXT 0x8007
|
||||
#define GL_MAX_EXT 0x8008
|
||||
#endif /* GL_EXT_blend_minmax */
|
||||
|
||||
#ifndef GL_EXT_discard_framebuffer
|
||||
#define GL_EXT_discard_framebuffer 1
|
||||
#define GL_COLOR_EXT 0x1800
|
||||
#define GL_DEPTH_EXT 0x1801
|
||||
#define GL_STENCIL_EXT 0x1802
|
||||
typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
||||
#endif
|
||||
#endif /* GL_EXT_discard_framebuffer */
|
||||
|
||||
#ifndef GL_EXT_map_buffer_range
|
||||
#define GL_EXT_map_buffer_range 1
|
||||
#define GL_MAP_READ_BIT_EXT 0x0001
|
||||
#define GL_MAP_WRITE_BIT_EXT 0x0002
|
||||
#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
|
||||
#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
|
||||
#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
|
||||
#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
|
||||
typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
|
||||
typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
|
||||
GL_API void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
|
||||
#endif
|
||||
#endif /* GL_EXT_map_buffer_range */
|
||||
|
||||
#ifndef GL_EXT_multi_draw_arrays
|
||||
#define GL_EXT_multi_draw_arrays 1
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
|
||||
GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
|
||||
#endif
|
||||
#endif /* GL_EXT_multi_draw_arrays */
|
||||
|
||||
#ifndef GL_EXT_multisampled_render_to_texture
|
||||
#define GL_EXT_multisampled_render_to_texture 1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
|
||||
#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
|
||||
#define GL_MAX_SAMPLES_EXT 0x8D57
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
|
||||
#endif
|
||||
#endif /* GL_EXT_multisampled_render_to_texture */
|
||||
|
||||
#ifndef GL_EXT_read_format_bgra
|
||||
#define GL_EXT_read_format_bgra 1
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
|
||||
#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
|
||||
#endif /* GL_EXT_read_format_bgra */
|
||||
|
||||
#ifndef GL_EXT_robustness
|
||||
#define GL_EXT_robustness 1
|
||||
#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
|
||||
#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
|
||||
#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
|
||||
#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
|
||||
#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
|
||||
#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
|
||||
#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
|
||||
typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
|
||||
GL_API void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
|
||||
GL_API void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
|
||||
#endif
|
||||
#endif /* GL_EXT_robustness */
|
||||
|
||||
#ifndef GL_EXT_sRGB
|
||||
#define GL_EXT_sRGB 1
|
||||
#define GL_SRGB_EXT 0x8C40
|
||||
#define GL_SRGB_ALPHA_EXT 0x8C42
|
||||
#define GL_SRGB8_ALPHA8_EXT 0x8C43
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
|
||||
#endif /* GL_EXT_sRGB */
|
||||
|
||||
#ifndef GL_EXT_texture_compression_dxt1
|
||||
#define GL_EXT_texture_compression_dxt1 1
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#endif /* GL_EXT_texture_compression_dxt1 */
|
||||
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_EXT_texture_filter_anisotropic 1
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
#endif /* GL_EXT_texture_filter_anisotropic */
|
||||
|
||||
#ifndef GL_EXT_texture_format_BGRA8888
|
||||
#define GL_EXT_texture_format_BGRA8888 1
|
||||
#endif /* GL_EXT_texture_format_BGRA8888 */
|
||||
|
||||
#ifndef GL_EXT_texture_lod_bias
|
||||
#define GL_EXT_texture_lod_bias 1
|
||||
#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
|
||||
#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
|
||||
#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
|
||||
#endif /* GL_EXT_texture_lod_bias */
|
||||
|
||||
#ifndef GL_EXT_texture_storage
|
||||
#define GL_EXT_texture_storage 1
|
||||
#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
|
||||
#define GL_ALPHA8_EXT 0x803C
|
||||
#define GL_LUMINANCE8_EXT 0x8040
|
||||
#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
|
||||
#define GL_RGBA32F_EXT 0x8814
|
||||
#define GL_RGB32F_EXT 0x8815
|
||||
#define GL_ALPHA32F_EXT 0x8816
|
||||
#define GL_LUMINANCE32F_EXT 0x8818
|
||||
#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
|
||||
#define GL_RGBA16F_EXT 0x881A
|
||||
#define GL_RGB16F_EXT 0x881B
|
||||
#define GL_ALPHA16F_EXT 0x881C
|
||||
#define GL_LUMINANCE16F_EXT 0x881E
|
||||
#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
|
||||
#define GL_R8_EXT 0x8229
|
||||
#define GL_RG8_EXT 0x822B
|
||||
#define GL_R32F_EXT 0x822E
|
||||
#define GL_RG32F_EXT 0x8230
|
||||
#define GL_R16F_EXT 0x822D
|
||||
#define GL_RG16F_EXT 0x822F
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
|
||||
GL_API void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
GL_API void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
|
||||
GL_API void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
#endif /* GL_EXT_texture_storage */
|
||||
|
||||
#ifndef GL_IMG_multisampled_render_to_texture
|
||||
#define GL_IMG_multisampled_render_to_texture 1
|
||||
#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
|
||||
#define GL_MAX_SAMPLES_IMG 0x9135
|
||||
#define GL_TEXTURE_SAMPLES_IMG 0x9136
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
|
||||
#endif
|
||||
#endif /* GL_IMG_multisampled_render_to_texture */
|
||||
|
||||
#ifndef GL_IMG_read_format
|
||||
#define GL_IMG_read_format 1
|
||||
#define GL_BGRA_IMG 0x80E1
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
|
||||
#endif /* GL_IMG_read_format */
|
||||
|
||||
#ifndef GL_IMG_texture_compression_pvrtc
|
||||
#define GL_IMG_texture_compression_pvrtc 1
|
||||
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
|
||||
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
|
||||
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
|
||||
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
|
||||
#endif /* GL_IMG_texture_compression_pvrtc */
|
||||
|
||||
#ifndef GL_IMG_texture_env_enhanced_fixed_function
|
||||
#define GL_IMG_texture_env_enhanced_fixed_function 1
|
||||
#define GL_MODULATE_COLOR_IMG 0x8C04
|
||||
#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05
|
||||
#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06
|
||||
#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07
|
||||
#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08
|
||||
#define GL_ADD_BLEND_IMG 0x8C09
|
||||
#define GL_DOT3_RGBA_IMG 0x86AF
|
||||
#endif /* GL_IMG_texture_env_enhanced_fixed_function */
|
||||
|
||||
#ifndef GL_IMG_user_clip_plane
|
||||
#define GL_IMG_user_clip_plane 1
|
||||
#define GL_CLIP_PLANE0_IMG 0x3000
|
||||
#define GL_CLIP_PLANE1_IMG 0x3001
|
||||
#define GL_CLIP_PLANE2_IMG 0x3002
|
||||
#define GL_CLIP_PLANE3_IMG 0x3003
|
||||
#define GL_CLIP_PLANE4_IMG 0x3004
|
||||
#define GL_CLIP_PLANE5_IMG 0x3005
|
||||
#define GL_MAX_CLIP_PLANES_IMG 0x0D32
|
||||
typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn);
|
||||
typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glClipPlanefIMG (GLenum p, const GLfloat *eqn);
|
||||
GL_API void GL_APIENTRY glClipPlanexIMG (GLenum p, const GLfixed *eqn);
|
||||
#endif
|
||||
#endif /* GL_IMG_user_clip_plane */
|
||||
|
||||
#ifndef GL_NV_fence
|
||||
#define GL_NV_fence 1
|
||||
#define GL_ALL_COMPLETED_NV 0x84F2
|
||||
#define GL_FENCE_STATUS_NV 0x84F3
|
||||
#define GL_FENCE_CONDITION_NV 0x84F4
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
|
||||
typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
|
||||
typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
|
||||
GL_API void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
|
||||
GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
|
||||
GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
|
||||
GL_API void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glFinishFenceNV (GLuint fence);
|
||||
GL_API void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
|
||||
#endif
|
||||
#endif /* GL_NV_fence */
|
||||
|
||||
#ifndef GL_QCOM_driver_control
|
||||
#define GL_QCOM_driver_control 1
|
||||
typedef char GLchar;
|
||||
typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
|
||||
typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
|
||||
GL_API void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
|
||||
GL_API void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
|
||||
GL_API void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
|
||||
#endif
|
||||
#endif /* GL_QCOM_driver_control */
|
||||
|
||||
#ifndef GL_QCOM_extended_get
|
||||
#define GL_QCOM_extended_get 1
|
||||
#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
|
||||
#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
|
||||
#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
|
||||
#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
|
||||
#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
|
||||
#define GL_TEXTURE_TYPE_QCOM 0x8BD7
|
||||
#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
|
||||
#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
|
||||
#define GL_TEXTURE_TARGET_QCOM 0x8BDA
|
||||
#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
|
||||
#define GL_STATE_RESTORE 0x8BDC
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
|
||||
GL_API void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
|
||||
GL_API void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
|
||||
GL_API void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
|
||||
GL_API void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
|
||||
GL_API void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
|
||||
#endif
|
||||
#endif /* GL_QCOM_extended_get */
|
||||
|
||||
#ifndef GL_QCOM_extended_get2
|
||||
#define GL_QCOM_extended_get2 1
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
|
||||
GL_API void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
|
||||
GL_API GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
|
||||
GL_API void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
|
||||
#endif
|
||||
#endif /* GL_QCOM_extended_get2 */
|
||||
|
||||
#ifndef GL_QCOM_perfmon_global_mode
|
||||
#define GL_QCOM_perfmon_global_mode 1
|
||||
#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
|
||||
#endif /* GL_QCOM_perfmon_global_mode */
|
||||
|
||||
#ifndef GL_QCOM_tiled_rendering
|
||||
#define GL_QCOM_tiled_rendering 1
|
||||
#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
|
||||
#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
|
||||
#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
|
||||
#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
|
||||
#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
|
||||
#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
|
||||
#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
|
||||
#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
|
||||
#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
|
||||
#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
|
||||
#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
|
||||
#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
|
||||
#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
|
||||
#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
|
||||
#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
|
||||
#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
|
||||
#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
|
||||
#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
|
||||
#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
|
||||
#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
|
||||
#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
|
||||
#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
|
||||
#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
|
||||
#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
|
||||
#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
|
||||
#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
|
||||
#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
|
||||
#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
|
||||
#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
|
||||
#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
|
||||
#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
|
||||
#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
|
||||
typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
|
||||
typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_API void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
|
||||
GL_API void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
|
||||
#endif
|
||||
#endif /* GL_QCOM_tiled_rendering */
|
||||
|
||||
#ifndef GL_QCOM_writeonly_rendering
|
||||
#define GL_QCOM_writeonly_rendering 1
|
||||
#define GL_WRITEONLY_RENDERING_QCOM 0x8823
|
||||
#endif /* GL_QCOM_writeonly_rendering */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,38 @@
|
||||
#ifndef __glplatform_h_
|
||||
#define __glplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2017 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* Please contribute modifications back to Khronos as pull requests on the
|
||||
* public github repository:
|
||||
* https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
#ifndef GL_API
|
||||
#define GL_API KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef GL_APIENTRY
|
||||
#define GL_APIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
#endif /* __glplatform_h_ */
|
||||
@ -0,0 +1,675 @@
|
||||
#ifndef __gl2_h_
|
||||
#define __gl2_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2017 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#include <GLES2/gl2platform.h>
|
||||
|
||||
#ifndef GL_APIENTRYP
|
||||
#define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
#ifndef GL_GLES_PROTOTYPES
|
||||
#define GL_GLES_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
/* Generated on date 20170613 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: gles2
|
||||
* Profile: common
|
||||
* Versions considered: 2\.[0-9]
|
||||
* Versions emitted: .*
|
||||
* Default extensions included: None
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef GL_ES_VERSION_2_0
|
||||
#define GL_ES_VERSION_2_0 1
|
||||
#include <KHR/khrplatform.h>
|
||||
typedef khronos_int8_t GLbyte;
|
||||
typedef khronos_float_t GLclampf;
|
||||
typedef khronos_int32_t GLfixed;
|
||||
typedef short GLshort;
|
||||
typedef unsigned short GLushort;
|
||||
typedef void GLvoid;
|
||||
typedef struct __GLsync *GLsync;
|
||||
typedef khronos_int64_t GLint64;
|
||||
typedef khronos_uint64_t GLuint64;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned int GLuint;
|
||||
typedef char GLchar;
|
||||
typedef khronos_float_t GLfloat;
|
||||
typedef khronos_ssize_t GLsizeiptr;
|
||||
typedef khronos_intptr_t GLintptr;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef int GLint;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef int GLsizei;
|
||||
typedef khronos_uint8_t GLubyte;
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_FALSE 0
|
||||
#define GL_TRUE 1
|
||||
#define GL_POINTS 0x0000
|
||||
#define GL_LINES 0x0001
|
||||
#define GL_LINE_LOOP 0x0002
|
||||
#define GL_LINE_STRIP 0x0003
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_TRIANGLE_STRIP 0x0005
|
||||
#define GL_TRIANGLE_FAN 0x0006
|
||||
#define GL_ZERO 0
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_COLOR 0x0300
|
||||
#define GL_ONE_MINUS_SRC_COLOR 0x0301
|
||||
#define GL_SRC_ALPHA 0x0302
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_DST_ALPHA 0x0304
|
||||
#define GL_ONE_MINUS_DST_ALPHA 0x0305
|
||||
#define GL_DST_COLOR 0x0306
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x0307
|
||||
#define GL_SRC_ALPHA_SATURATE 0x0308
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
#define GL_BLEND_EQUATION 0x8009
|
||||
#define GL_BLEND_EQUATION_RGB 0x8009
|
||||
#define GL_BLEND_EQUATION_ALPHA 0x883D
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
#define GL_BLEND_DST_RGB 0x80C8
|
||||
#define GL_BLEND_SRC_RGB 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA 0x80CA
|
||||
#define GL_BLEND_SRC_ALPHA 0x80CB
|
||||
#define GL_CONSTANT_COLOR 0x8001
|
||||
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
|
||||
#define GL_CONSTANT_ALPHA 0x8003
|
||||
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
|
||||
#define GL_BLEND_COLOR 0x8005
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
#define GL_STREAM_DRAW 0x88E0
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
#define GL_BUFFER_SIZE 0x8764
|
||||
#define GL_BUFFER_USAGE 0x8765
|
||||
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_FRONT_AND_BACK 0x0408
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_BLEND 0x0BE2
|
||||
#define GL_DITHER 0x0BD0
|
||||
#define GL_STENCIL_TEST 0x0B90
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
#define GL_SCISSOR_TEST 0x0C11
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_COVERAGE 0x80A0
|
||||
#define GL_NO_ERROR 0
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
#define GL_CW 0x0900
|
||||
#define GL_CCW 0x0901
|
||||
#define GL_LINE_WIDTH 0x0B21
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
#define GL_CULL_FACE_MODE 0x0B45
|
||||
#define GL_FRONT_FACE 0x0B46
|
||||
#define GL_DEPTH_RANGE 0x0B70
|
||||
#define GL_DEPTH_WRITEMASK 0x0B72
|
||||
#define GL_DEPTH_CLEAR_VALUE 0x0B73
|
||||
#define GL_DEPTH_FUNC 0x0B74
|
||||
#define GL_STENCIL_CLEAR_VALUE 0x0B91
|
||||
#define GL_STENCIL_FUNC 0x0B92
|
||||
#define GL_STENCIL_FAIL 0x0B94
|
||||
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
|
||||
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
|
||||
#define GL_STENCIL_REF 0x0B97
|
||||
#define GL_STENCIL_VALUE_MASK 0x0B93
|
||||
#define GL_STENCIL_WRITEMASK 0x0B98
|
||||
#define GL_STENCIL_BACK_FUNC 0x8800
|
||||
#define GL_STENCIL_BACK_FAIL 0x8801
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
|
||||
#define GL_STENCIL_BACK_REF 0x8CA3
|
||||
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
|
||||
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
|
||||
#define GL_VIEWPORT 0x0BA2
|
||||
#define GL_SCISSOR_BOX 0x0C10
|
||||
#define GL_COLOR_CLEAR_VALUE 0x0C22
|
||||
#define GL_COLOR_WRITEMASK 0x0C23
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define GL_PACK_ALIGNMENT 0x0D05
|
||||
#define GL_MAX_TEXTURE_SIZE 0x0D33
|
||||
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
|
||||
#define GL_SUBPIXEL_BITS 0x0D50
|
||||
#define GL_RED_BITS 0x0D52
|
||||
#define GL_GREEN_BITS 0x0D53
|
||||
#define GL_BLUE_BITS 0x0D54
|
||||
#define GL_ALPHA_BITS 0x0D55
|
||||
#define GL_DEPTH_BITS 0x0D56
|
||||
#define GL_STENCIL_BITS 0x0D57
|
||||
#define GL_POLYGON_OFFSET_UNITS 0x2A00
|
||||
#define GL_POLYGON_OFFSET_FACTOR 0x8038
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_SAMPLE_BUFFERS 0x80A8
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
#define GL_DONT_CARE 0x1100
|
||||
#define GL_FASTEST 0x1101
|
||||
#define GL_NICEST 0x1102
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_SHORT 0x1402
|
||||
#define GL_UNSIGNED_SHORT 0x1403
|
||||
#define GL_INT 0x1404
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FIXED 0x140C
|
||||
#define GL_DEPTH_COMPONENT 0x1902
|
||||
#define GL_ALPHA 0x1906
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_LUMINANCE 0x1909
|
||||
#define GL_LUMINANCE_ALPHA 0x190A
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
|
||||
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
|
||||
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
|
||||
#define GL_MAX_VARYING_VECTORS 0x8DFC
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
|
||||
#define GL_SHADER_TYPE 0x8B4F
|
||||
#define GL_DELETE_STATUS 0x8B80
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_VALIDATE_STATUS 0x8B83
|
||||
#define GL_ATTACHED_SHADERS 0x8B85
|
||||
#define GL_ACTIVE_UNIFORMS 0x8B86
|
||||
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
|
||||
#define GL_ACTIVE_ATTRIBUTES 0x8B89
|
||||
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
|
||||
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
|
||||
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||
#define GL_NEVER 0x0200
|
||||
#define GL_LESS 0x0201
|
||||
#define GL_EQUAL 0x0202
|
||||
#define GL_LEQUAL 0x0203
|
||||
#define GL_GREATER 0x0204
|
||||
#define GL_NOTEQUAL 0x0205
|
||||
#define GL_GEQUAL 0x0206
|
||||
#define GL_ALWAYS 0x0207
|
||||
#define GL_KEEP 0x1E00
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_INCR 0x1E02
|
||||
#define GL_DECR 0x1E03
|
||||
#define GL_INVERT 0x150A
|
||||
#define GL_INCR_WRAP 0x8507
|
||||
#define GL_DECR_WRAP 0x8508
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR 0x2601
|
||||
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
|
||||
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
|
||||
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_TEXTURE_WRAP_T 0x2803
|
||||
#define GL_TEXTURE 0x1702
|
||||
#define GL_TEXTURE_CUBE_MAP 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
#define GL_TEXTURE3 0x84C3
|
||||
#define GL_TEXTURE4 0x84C4
|
||||
#define GL_TEXTURE5 0x84C5
|
||||
#define GL_TEXTURE6 0x84C6
|
||||
#define GL_TEXTURE7 0x84C7
|
||||
#define GL_TEXTURE8 0x84C8
|
||||
#define GL_TEXTURE9 0x84C9
|
||||
#define GL_TEXTURE10 0x84CA
|
||||
#define GL_TEXTURE11 0x84CB
|
||||
#define GL_TEXTURE12 0x84CC
|
||||
#define GL_TEXTURE13 0x84CD
|
||||
#define GL_TEXTURE14 0x84CE
|
||||
#define GL_TEXTURE15 0x84CF
|
||||
#define GL_TEXTURE16 0x84D0
|
||||
#define GL_TEXTURE17 0x84D1
|
||||
#define GL_TEXTURE18 0x84D2
|
||||
#define GL_TEXTURE19 0x84D3
|
||||
#define GL_TEXTURE20 0x84D4
|
||||
#define GL_TEXTURE21 0x84D5
|
||||
#define GL_TEXTURE22 0x84D6
|
||||
#define GL_TEXTURE23 0x84D7
|
||||
#define GL_TEXTURE24 0x84D8
|
||||
#define GL_TEXTURE25 0x84D9
|
||||
#define GL_TEXTURE26 0x84DA
|
||||
#define GL_TEXTURE27 0x84DB
|
||||
#define GL_TEXTURE28 0x84DC
|
||||
#define GL_TEXTURE29 0x84DD
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#define GL_MIRRORED_REPEAT 0x8370
|
||||
#define GL_FLOAT_VEC2 0x8B50
|
||||
#define GL_FLOAT_VEC3 0x8B51
|
||||
#define GL_FLOAT_VEC4 0x8B52
|
||||
#define GL_INT_VEC2 0x8B53
|
||||
#define GL_INT_VEC3 0x8B54
|
||||
#define GL_INT_VEC4 0x8B55
|
||||
#define GL_BOOL 0x8B56
|
||||
#define GL_BOOL_VEC2 0x8B57
|
||||
#define GL_BOOL_VEC3 0x8B58
|
||||
#define GL_BOOL_VEC4 0x8B59
|
||||
#define GL_FLOAT_MAT2 0x8B5A
|
||||
#define GL_FLOAT_MAT3 0x8B5B
|
||||
#define GL_FLOAT_MAT4 0x8B5C
|
||||
#define GL_SAMPLER_2D 0x8B5E
|
||||
#define GL_SAMPLER_CUBE 0x8B60
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||
#define GL_SHADER_SOURCE_LENGTH 0x8B88
|
||||
#define GL_SHADER_COMPILER 0x8DFA
|
||||
#define GL_SHADER_BINARY_FORMATS 0x8DF8
|
||||
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
|
||||
#define GL_LOW_FLOAT 0x8DF0
|
||||
#define GL_MEDIUM_FLOAT 0x8DF1
|
||||
#define GL_HIGH_FLOAT 0x8DF2
|
||||
#define GL_LOW_INT 0x8DF3
|
||||
#define GL_MEDIUM_INT 0x8DF4
|
||||
#define GL_HIGH_INT 0x8DF5
|
||||
#define GL_FRAMEBUFFER 0x8D40
|
||||
#define GL_RENDERBUFFER 0x8D41
|
||||
#define GL_RGBA4 0x8056
|
||||
#define GL_RGB5_A1 0x8057
|
||||
#define GL_RGB565 0x8D62
|
||||
#define GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define GL_STENCIL_INDEX8 0x8D48
|
||||
#define GL_RENDERBUFFER_WIDTH 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
|
||||
#define GL_RENDERBUFFER_RED_SIZE 0x8D50
|
||||
#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
|
||||
#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
|
||||
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT 0x8D20
|
||||
#define GL_NONE 0
|
||||
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
|
||||
#define GL_FRAMEBUFFER_BINDING 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING 0x8CA7
|
||||
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
|
||||
typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
|
||||
typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
|
||||
typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
|
||||
typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
|
||||
typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
|
||||
typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
|
||||
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
|
||||
typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
|
||||
typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
|
||||
typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#if GL_GLES_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
|
||||
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
|
||||
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glFinish (void);
|
||||
GL_APICALL void GL_APIENTRY glFlush (void);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
|
||||
GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL GLenum GL_APIENTRY glGetError (void);
|
||||
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
|
||||
GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
|
||||
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
|
||||
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
|
||||
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
|
||||
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
|
||||
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
|
||||
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
|
||||
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
|
||||
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#endif
|
||||
#endif /* GL_ES_VERSION_2_0 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@
|
||||
#ifndef __gl2platform_h_
|
||||
#define __gl2platform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2017 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* Please contribute modifications back to Khronos as pull requests on the
|
||||
* public github repository:
|
||||
* https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
#ifndef GL_APICALL
|
||||
#define GL_APICALL KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef GL_APIENTRY
|
||||
#define GL_APIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
#endif /* __gl2platform_h_ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
#ifndef __gl3ext_h_
|
||||
#define __gl3ext_h_
|
||||
|
||||
/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
*/
|
||||
|
||||
/* OpenGL ES 3 Extensions
|
||||
*
|
||||
* After an OES extension's interactions with OpenGl ES 3.0 have been documented,
|
||||
* its tokens and function definitions should be added to this file in a manner
|
||||
* that does not conflict with gl2ext.h or gl3.h.
|
||||
*
|
||||
* Tokens and function definitions for extensions that have become standard
|
||||
* features in OpenGL ES 3.0 will not be added to this file.
|
||||
*
|
||||
* Applications using OpenGL-ES-2-only extensions should include gl2ext.h
|
||||
*/
|
||||
|
||||
#endif /* __gl3ext_h_ */
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
#ifndef __gl3platform_h_
|
||||
#define __gl3platform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2017 The Khronos Group Inc.
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* Please contribute modifications back to Khronos as pull requests on the
|
||||
* public github repository:
|
||||
* https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
#ifndef GL_APICALL
|
||||
#define GL_APICALL KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef GL_APIENTRY
|
||||
#define GL_APIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
#endif /* __gl3platform_h_ */
|
||||
@ -0,0 +1,271 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||
* "Khronos (general)" component "Registry".
|
||||
*
|
||||
* A predefined template which fills in some of the bug fields can be
|
||||
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||
* must create a Bugzilla login first.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(ANDROID)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OPENMAX_AL_ANDROID_H_
|
||||
#define OPENMAX_AL_ANDROID_H_
|
||||
|
||||
#include "OpenMAXAL.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android common types */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
typedef xa_int64_t XAAint64; /* 64 bit signed integer */
|
||||
|
||||
typedef xa_uint64_t XAAuint64; /* 64 bit unsigned integer */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android common types */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#define XA_ANDROID_VIDEOCODEC_VP8 ((XAuint32) 0x00000006)
|
||||
|
||||
#define XA_ANDROID_VIDEOPROFILE_VP8_MAIN ((XAuint32) 0x00000001)
|
||||
|
||||
#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION0 ((XAuint32) 0x00000001)
|
||||
#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION1 ((XAuint32) 0x00000002)
|
||||
#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION2 ((XAuint32) 0x00000003)
|
||||
#define XA_ANDROID_VIDEOLEVEL_VP8_VERSION3 ((XAuint32) 0x00000004)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Buffer Queue Interface */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
extern XA_API const XAInterfaceID XA_IID_ANDROIDBUFFERQUEUESOURCE;
|
||||
|
||||
struct XAAndroidBufferQueueItf_;
|
||||
typedef const struct XAAndroidBufferQueueItf_ * const * XAAndroidBufferQueueItf;
|
||||
|
||||
#define XA_ANDROID_ITEMKEY_NONE ((XAuint32) 0x00000000)
|
||||
#define XA_ANDROID_ITEMKEY_EOS ((XAuint32) 0x00000001)
|
||||
#define XA_ANDROID_ITEMKEY_DISCONTINUITY ((XAuint32) 0x00000002)
|
||||
#define XA_ANDROID_ITEMKEY_BUFFERQUEUEEVENT ((XAuint32) 0x00000003)
|
||||
#define XA_ANDROID_ITEMKEY_FORMAT_CHANGE ((XAuint32) 0x00000004)
|
||||
|
||||
// optional data for XA_ANDROID_ITEMKEY_FORMAT_CHANGE, used when only one stream changes format,
|
||||
// and the others remain continuous (i.e. no temporal discontinuity is introduced for them)
|
||||
// candidate for being exposed in NDK
|
||||
#define XA_ANDROID_FORMATCHANGE_ITEMDATA_VIDEO ((XAuint32) 0x00000001)
|
||||
// not supported at this stage, for illustration purposes only
|
||||
//#define XA_ANDROID_FORMATCHANGE_ITEMDATA_AUDIO ((XAuint32) 0x00000002)
|
||||
|
||||
#define XA_ANDROIDBUFFERQUEUEEVENT_NONE ((XAuint32) 0x00000000)
|
||||
#define XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED ((XAuint32) 0x00000001)
|
||||
#if 0 // reserved for future use
|
||||
#define XA_ANDROIDBUFFERQUEUEEVENT_UNREALIZED ((XAuint32) 0x00000002)
|
||||
#define XA_ANDROIDBUFFERQUEUEEVENT_CLEARED ((XAuint32) 0x00000004)
|
||||
#define XA_ANDROIDBUFFERQUEUEEVENT_STOPPED ((XAuint32) 0x00000008)
|
||||
#define XA_ANDROIDBUFFERQUEUEEVENT_ERROR ((XAuint32) 0x00000010)
|
||||
#define XA_ANDROIDBUFFERQUEUEEVENT_CONTENT_END ((XAuint32) 0x00000020)
|
||||
#endif
|
||||
|
||||
typedef struct XAAndroidBufferItem_ {
|
||||
XAuint32 itemKey; // identifies the item
|
||||
XAuint32 itemSize;
|
||||
XAuint8 itemData[0];
|
||||
} XAAndroidBufferItem;
|
||||
|
||||
typedef XAresult (XAAPIENTRY *xaAndroidBufferQueueCallback)(
|
||||
XAAndroidBufferQueueItf caller,/* input */
|
||||
void *pCallbackContext, /* input */
|
||||
void *pBufferContext, /* input */
|
||||
void *pBufferData, /* input */
|
||||
XAuint32 dataSize, /* input */
|
||||
XAuint32 dataUsed, /* input */
|
||||
const XAAndroidBufferItem *pItems,/* input */
|
||||
XAuint32 itemsLength /* input */
|
||||
);
|
||||
|
||||
typedef struct XAAndroidBufferQueueState_ {
|
||||
XAuint32 count;
|
||||
XAuint32 index;
|
||||
} XAAndroidBufferQueueState;
|
||||
|
||||
struct XAAndroidBufferQueueItf_ {
|
||||
XAresult (*RegisterCallback) (
|
||||
XAAndroidBufferQueueItf self,
|
||||
xaAndroidBufferQueueCallback callback,
|
||||
void* pCallbackContext
|
||||
);
|
||||
|
||||
XAresult (*Clear) (
|
||||
XAAndroidBufferQueueItf self
|
||||
);
|
||||
|
||||
XAresult (*Enqueue) (
|
||||
XAAndroidBufferQueueItf self,
|
||||
void *pBufferContext,
|
||||
void *pData,
|
||||
XAuint32 dataLength,
|
||||
const XAAndroidBufferItem *pItems,
|
||||
XAuint32 itemsLength
|
||||
);
|
||||
|
||||
XAresult (*GetState) (
|
||||
XAAndroidBufferQueueItf self,
|
||||
XAAndroidBufferQueueState *pState
|
||||
);
|
||||
|
||||
|
||||
XAresult (*SetCallbackEventsMask) (
|
||||
XAAndroidBufferQueueItf self,
|
||||
XAuint32 eventFlags
|
||||
);
|
||||
|
||||
XAresult (*GetCallbackEventsMask) (
|
||||
XAAndroidBufferQueueItf self,
|
||||
XAuint32 *pEventFlags
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Buffer Queue Data Locator */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Addendum to Data locator macros */
|
||||
#define XA_DATALOCATOR_ANDROIDBUFFERQUEUE ((XAuint32) 0x800007BE)
|
||||
|
||||
/** Android Buffer Queue-based data locator definition,
|
||||
* locatorType must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE */
|
||||
typedef struct XADataLocator_AndroidBufferQueue_ {
|
||||
XAuint32 locatorType;
|
||||
XAuint32 numBuffers;
|
||||
} XADataLocator_AndroidBufferQueue;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android File Descriptor Data Locator */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Addendum to Data locator macros */
|
||||
#define XA_DATALOCATOR_ANDROIDFD ((XAuint32) 0x800007BC)
|
||||
|
||||
#define XA_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((XAAint64) 0xFFFFFFFFFFFFFFFFll)
|
||||
|
||||
/** File Descriptor-based data locator definition, locatorType must be XA_DATALOCATOR_ANDROIDFD */
|
||||
typedef struct XADataLocator_AndroidFD_ {
|
||||
XAuint32 locatorType;
|
||||
XAint32 fd;
|
||||
XAAint64 offset;
|
||||
XAAint64 length;
|
||||
} XADataLocator_AndroidFD;
|
||||
|
||||
/**
|
||||
* MIME types required for data in Android Buffer Queues
|
||||
*/
|
||||
#define XA_ANDROID_MIME_MP2TS ((XAchar *) "video/mp2ts")
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OPENMAX_AL_ANDROID_H_ */
|
||||
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and/or associated documentation files (the
|
||||
* "Materials "), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*
|
||||
* OpenMAXAL_Platform.h - OpenMAX AL version 1.0.1
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************************************/
|
||||
/* NOTE: This file contains definitions for the base types and the */
|
||||
/* XAAPIENTRY macro. This file **WILL NEED TO BE EDITED** to provide */
|
||||
/* the correct definitions specific to the platform being used. */
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _OPENMAXAL_PLATFORM_H_
|
||||
#define _OPENMAXAL_PLATFORM_H_
|
||||
|
||||
typedef unsigned char xa_uint8_t;
|
||||
typedef signed char xa_int8_t;
|
||||
typedef unsigned short xa_uint16_t;
|
||||
typedef signed short xa_int16_t;
|
||||
typedef unsigned int /*long*/ xa_uint32_t;
|
||||
typedef signed int /*long*/ xa_int32_t;
|
||||
typedef long long xa_int64_t;
|
||||
typedef unsigned long long xa_uint64_t;
|
||||
|
||||
#ifndef XAAPIENTRY
|
||||
#define XAAPIENTRY /* override per-platform */
|
||||
#endif
|
||||
|
||||
/** The XA_API is a platform-specific macro used
|
||||
* to declare OPENMAX AL function prototypes. It is modified to meet the
|
||||
* requirements for a particular platform
|
||||
*
|
||||
* Example:
|
||||
* #ifdef __SYMBIAN32__
|
||||
* # define XA_API __declspec(dllimport)
|
||||
* #endif
|
||||
*/
|
||||
|
||||
#ifndef XA_API
|
||||
#ifdef __GNUC__
|
||||
#define XA_API
|
||||
#else
|
||||
#define XA_API __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _OPENMAXAL_PLATFORM_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,467 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OPENSL_ES_ANDROID_H_
|
||||
#define OPENSL_ES_ANDROID_H_
|
||||
|
||||
#include "OpenSLES.h"
|
||||
#include "OpenSLES_AndroidConfiguration.h"
|
||||
#include "OpenSLES_AndroidMetadata.h"
|
||||
#include <jni.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android common types */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
typedef sl_int64_t SLAint64; /* 64 bit signed integer */
|
||||
|
||||
typedef sl_uint64_t SLAuint64; /* 64 bit unsigned integer */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android PCM Data Format */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* The following pcm representations and data formats map to those in OpenSLES 1.1 */
|
||||
#define SL_ANDROID_PCM_REPRESENTATION_SIGNED_INT ((SLuint32) 0x00000001)
|
||||
#define SL_ANDROID_PCM_REPRESENTATION_UNSIGNED_INT ((SLuint32) 0x00000002)
|
||||
#define SL_ANDROID_PCM_REPRESENTATION_FLOAT ((SLuint32) 0x00000003)
|
||||
|
||||
#define SL_ANDROID_DATAFORMAT_PCM_EX ((SLuint32) 0x00000004)
|
||||
|
||||
typedef struct SLAndroidDataFormat_PCM_EX_ {
|
||||
SLuint32 formatType;
|
||||
SLuint32 numChannels;
|
||||
SLuint32 sampleRate;
|
||||
SLuint32 bitsPerSample;
|
||||
SLuint32 containerSize;
|
||||
SLuint32 channelMask;
|
||||
SLuint32 endianness;
|
||||
SLuint32 representation;
|
||||
} SLAndroidDataFormat_PCM_EX;
|
||||
|
||||
#define SL_ANDROID_SPEAKER_NON_POSITIONAL ((SLuint32) 0x80000000)
|
||||
|
||||
// Make an indexed channel mask from a bitfield.
|
||||
//
|
||||
// Each bit in the bitfield corresponds to a channel index,
|
||||
// from least-significant bit (channel 0) up to the bit
|
||||
// corresponding to the maximum channel count (currently FCC_8).
|
||||
// A '1' in the bitfield indicates that the channel should be
|
||||
// included in the stream, while a '0' indicates that it
|
||||
// should be excluded. For instance, a bitfield of 0x0A (binary 00001010)
|
||||
// would define a stream that contains channels 1 and 3. (The corresponding
|
||||
// indexed mask, after setting the SL_ANDROID_NON_POSITIONAL bit,
|
||||
// would be 0x8000000A.)
|
||||
#define SL_ANDROID_MAKE_INDEXED_CHANNEL_MASK(bitfield) \
|
||||
((bitfield) | SL_ANDROID_SPEAKER_NON_POSITIONAL)
|
||||
|
||||
// Specifying SL_ANDROID_SPEAKER_USE_DEFAULT as a channel mask in
|
||||
// SLAndroidDataFormat_PCM_EX causes OpenSL ES to assign a default
|
||||
// channel mask based on the number of channels requested. This
|
||||
// value cannot be combined with SL_ANDROID_SPEAKER_NON_POSITIONAL.
|
||||
#define SL_ANDROID_SPEAKER_USE_DEFAULT ((SLuint32)0)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Effect interface */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDEFFECT;
|
||||
|
||||
/** Android Effect interface methods */
|
||||
|
||||
struct SLAndroidEffectItf_;
|
||||
typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf;
|
||||
|
||||
struct SLAndroidEffectItf_ {
|
||||
|
||||
SLresult (*CreateEffect) (SLAndroidEffectItf self,
|
||||
SLInterfaceID effectImplementationId);
|
||||
|
||||
SLresult (*ReleaseEffect) (SLAndroidEffectItf self,
|
||||
SLInterfaceID effectImplementationId);
|
||||
|
||||
SLresult (*SetEnabled) (SLAndroidEffectItf self,
|
||||
SLInterfaceID effectImplementationId,
|
||||
SLboolean enabled);
|
||||
|
||||
SLresult (*IsEnabled) (SLAndroidEffectItf self,
|
||||
SLInterfaceID effectImplementationId,
|
||||
SLboolean *pEnabled);
|
||||
|
||||
SLresult (*SendCommand) (SLAndroidEffectItf self,
|
||||
SLInterfaceID effectImplementationId,
|
||||
SLuint32 command,
|
||||
SLuint32 commandSize,
|
||||
void *pCommandData,
|
||||
SLuint32 *replySize,
|
||||
void *pReplyData);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Effect Send interface */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDEFFECTSEND;
|
||||
|
||||
/** Android Effect Send interface methods */
|
||||
|
||||
struct SLAndroidEffectSendItf_;
|
||||
typedef const struct SLAndroidEffectSendItf_ * const * SLAndroidEffectSendItf;
|
||||
|
||||
struct SLAndroidEffectSendItf_ {
|
||||
SLresult (*EnableEffectSend) (
|
||||
SLAndroidEffectSendItf self,
|
||||
SLInterfaceID effectImplementationId,
|
||||
SLboolean enable,
|
||||
SLmillibel initialLevel
|
||||
);
|
||||
SLresult (*IsEnabled) (
|
||||
SLAndroidEffectSendItf self,
|
||||
SLInterfaceID effectImplementationId,
|
||||
SLboolean *pEnable
|
||||
);
|
||||
SLresult (*SetDirectLevel) (
|
||||
SLAndroidEffectSendItf self,
|
||||
SLmillibel directLevel
|
||||
);
|
||||
SLresult (*GetDirectLevel) (
|
||||
SLAndroidEffectSendItf self,
|
||||
SLmillibel *pDirectLevel
|
||||
);
|
||||
SLresult (*SetSendLevel) (
|
||||
SLAndroidEffectSendItf self,
|
||||
SLInterfaceID effectImplementationId,
|
||||
SLmillibel sendLevel
|
||||
);
|
||||
SLresult (*GetSendLevel)(
|
||||
SLAndroidEffectSendItf self,
|
||||
SLInterfaceID effectImplementationId,
|
||||
SLmillibel *pSendLevel
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Effect Capabilities interface */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES;
|
||||
|
||||
/** Android Effect Capabilities interface methods */
|
||||
|
||||
struct SLAndroidEffectCapabilitiesItf_;
|
||||
typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf;
|
||||
|
||||
struct SLAndroidEffectCapabilitiesItf_ {
|
||||
|
||||
SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self,
|
||||
SLuint32 *pNumSupportedEffects);
|
||||
|
||||
|
||||
SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self,
|
||||
SLuint32 index,
|
||||
SLInterfaceID *pEffectType,
|
||||
SLInterfaceID *pEffectImplementation,
|
||||
SLchar *pName,
|
||||
SLuint16 *pNameSize);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Configuration interface */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDCONFIGURATION;
|
||||
|
||||
/** Android Configuration interface methods */
|
||||
|
||||
struct SLAndroidConfigurationItf_;
|
||||
typedef const struct SLAndroidConfigurationItf_ * const * SLAndroidConfigurationItf;
|
||||
|
||||
/*
|
||||
* Java Proxy Type IDs
|
||||
*/
|
||||
#define SL_ANDROID_JAVA_PROXY_ROUTING 0x0001
|
||||
|
||||
struct SLAndroidConfigurationItf_ {
|
||||
|
||||
SLresult (*SetConfiguration) (SLAndroidConfigurationItf self,
|
||||
const SLchar *configKey,
|
||||
const void *pConfigValue,
|
||||
SLuint32 valueSize);
|
||||
|
||||
SLresult (*GetConfiguration) (SLAndroidConfigurationItf self,
|
||||
const SLchar *configKey,
|
||||
SLuint32 *pValueSize,
|
||||
void *pConfigValue
|
||||
);
|
||||
|
||||
SLresult (*AcquireJavaProxy) (SLAndroidConfigurationItf self,
|
||||
SLuint32 proxyType,
|
||||
jobject *pProxyObj);
|
||||
|
||||
SLresult (*ReleaseJavaProxy) (SLAndroidConfigurationItf self,
|
||||
SLuint32 proxyType);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Simple Buffer Queue Interface */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE;
|
||||
|
||||
struct SLAndroidSimpleBufferQueueItf_;
|
||||
typedef const struct SLAndroidSimpleBufferQueueItf_ * const * SLAndroidSimpleBufferQueueItf;
|
||||
|
||||
typedef void (SLAPIENTRY *slAndroidSimpleBufferQueueCallback)(
|
||||
SLAndroidSimpleBufferQueueItf caller,
|
||||
void *pContext
|
||||
);
|
||||
|
||||
/** Android simple buffer queue state **/
|
||||
|
||||
typedef struct SLAndroidSimpleBufferQueueState_ {
|
||||
SLuint32 count;
|
||||
SLuint32 index;
|
||||
} SLAndroidSimpleBufferQueueState;
|
||||
|
||||
|
||||
struct SLAndroidSimpleBufferQueueItf_ {
|
||||
SLresult (*Enqueue) (
|
||||
SLAndroidSimpleBufferQueueItf self,
|
||||
const void *pBuffer,
|
||||
SLuint32 size
|
||||
);
|
||||
SLresult (*Clear) (
|
||||
SLAndroidSimpleBufferQueueItf self
|
||||
);
|
||||
SLresult (*GetState) (
|
||||
SLAndroidSimpleBufferQueueItf self,
|
||||
SLAndroidSimpleBufferQueueState *pState
|
||||
);
|
||||
SLresult (*RegisterCallback) (
|
||||
SLAndroidSimpleBufferQueueItf self,
|
||||
slAndroidSimpleBufferQueueCallback callback,
|
||||
void* pContext
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Buffer Queue Interface */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDBUFFERQUEUESOURCE;
|
||||
|
||||
struct SLAndroidBufferQueueItf_;
|
||||
typedef const struct SLAndroidBufferQueueItf_ * const * SLAndroidBufferQueueItf;
|
||||
|
||||
#define SL_ANDROID_ITEMKEY_NONE ((SLuint32) 0x00000000)
|
||||
#define SL_ANDROID_ITEMKEY_EOS ((SLuint32) 0x00000001)
|
||||
#define SL_ANDROID_ITEMKEY_DISCONTINUITY ((SLuint32) 0x00000002)
|
||||
#define SL_ANDROID_ITEMKEY_BUFFERQUEUEEVENT ((SLuint32) 0x00000003)
|
||||
#define SL_ANDROID_ITEMKEY_FORMAT_CHANGE ((SLuint32) 0x00000004)
|
||||
|
||||
#define SL_ANDROIDBUFFERQUEUEEVENT_NONE ((SLuint32) 0x00000000)
|
||||
#define SL_ANDROIDBUFFERQUEUEEVENT_PROCESSED ((SLuint32) 0x00000001)
|
||||
#if 0 // reserved for future use
|
||||
#define SL_ANDROIDBUFFERQUEUEEVENT_UNREALIZED ((SLuint32) 0x00000002)
|
||||
#define SL_ANDROIDBUFFERQUEUEEVENT_CLEARED ((SLuint32) 0x00000004)
|
||||
#define SL_ANDROIDBUFFERQUEUEEVENT_STOPPED ((SLuint32) 0x00000008)
|
||||
#define SL_ANDROIDBUFFERQUEUEEVENT_ERROR ((SLuint32) 0x00000010)
|
||||
#define SL_ANDROIDBUFFERQUEUEEVENT_CONTENT_END ((SLuint32) 0x00000020)
|
||||
#endif
|
||||
|
||||
typedef struct SLAndroidBufferItem_ {
|
||||
SLuint32 itemKey; // identifies the item
|
||||
SLuint32 itemSize;
|
||||
SLuint8 itemData[0];
|
||||
} SLAndroidBufferItem;
|
||||
|
||||
typedef SLresult (SLAPIENTRY *slAndroidBufferQueueCallback)(
|
||||
SLAndroidBufferQueueItf caller,/* input */
|
||||
void *pCallbackContext, /* input */
|
||||
void *pBufferContext, /* input */
|
||||
void *pBufferData, /* input */
|
||||
SLuint32 dataSize, /* input */
|
||||
SLuint32 dataUsed, /* input */
|
||||
const SLAndroidBufferItem *pItems,/* input */
|
||||
SLuint32 itemsLength /* input */
|
||||
);
|
||||
|
||||
typedef struct SLAndroidBufferQueueState_ {
|
||||
SLuint32 count;
|
||||
SLuint32 index;
|
||||
} SLAndroidBufferQueueState;
|
||||
|
||||
struct SLAndroidBufferQueueItf_ {
|
||||
SLresult (*RegisterCallback) (
|
||||
SLAndroidBufferQueueItf self,
|
||||
slAndroidBufferQueueCallback callback,
|
||||
void* pCallbackContext
|
||||
);
|
||||
|
||||
SLresult (*Clear) (
|
||||
SLAndroidBufferQueueItf self
|
||||
);
|
||||
|
||||
SLresult (*Enqueue) (
|
||||
SLAndroidBufferQueueItf self,
|
||||
void *pBufferContext,
|
||||
void *pData,
|
||||
SLuint32 dataLength,
|
||||
const SLAndroidBufferItem *pItems,
|
||||
SLuint32 itemsLength
|
||||
);
|
||||
|
||||
SLresult (*GetState) (
|
||||
SLAndroidBufferQueueItf self,
|
||||
SLAndroidBufferQueueState *pState
|
||||
);
|
||||
|
||||
SLresult (*SetCallbackEventsMask) (
|
||||
SLAndroidBufferQueueItf self,
|
||||
SLuint32 eventFlags
|
||||
);
|
||||
|
||||
SLresult (*GetCallbackEventsMask) (
|
||||
SLAndroidBufferQueueItf self,
|
||||
SLuint32 *pEventFlags
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android File Descriptor Data Locator */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Addendum to Data locator macros */
|
||||
#define SL_DATALOCATOR_ANDROIDFD ((SLuint32) 0x800007BC)
|
||||
|
||||
#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll)
|
||||
|
||||
/** File Descriptor-based data locator definition, locatorType must be SL_DATALOCATOR_ANDROIDFD */
|
||||
typedef struct SLDataLocator_AndroidFD_ {
|
||||
SLuint32 locatorType;
|
||||
SLint32 fd;
|
||||
SLAint64 offset;
|
||||
SLAint64 length;
|
||||
} SLDataLocator_AndroidFD;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Android Simple Buffer Queue Data Locator */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Addendum to Data locator macros */
|
||||
#define SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE ((SLuint32) 0x800007BD)
|
||||
|
||||
/** BufferQueue-based data locator definition where locatorType must
|
||||
* be SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE
|
||||
*/
|
||||
typedef struct SLDataLocator_AndroidSimpleBufferQueue {
|
||||
SLuint32 locatorType;
|
||||
SLuint32 numBuffers;
|
||||
} SLDataLocator_AndroidSimpleBufferQueue;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android Buffer Queue Data Locator */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Addendum to Data locator macros */
|
||||
#define SL_DATALOCATOR_ANDROIDBUFFERQUEUE ((SLuint32) 0x800007BE)
|
||||
|
||||
/** Android Buffer Queue-based data locator definition,
|
||||
* locatorType must be SL_DATALOCATOR_ANDROIDBUFFERQUEUE */
|
||||
typedef struct SLDataLocator_AndroidBufferQueue_ {
|
||||
SLuint32 locatorType;
|
||||
SLuint32 numBuffers;
|
||||
} SLDataLocator_AndroidBufferQueue;
|
||||
|
||||
/**
|
||||
* MIME types required for data in Android Buffer Queues
|
||||
*/
|
||||
#define SL_ANDROID_MIME_AACADTS ((SLchar *) "audio/vnd.android.aac-adts")
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Acoustic Echo Cancellation (AEC) Interface */
|
||||
/* --------------------------------------------------------------------------*/
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDACOUSTICECHOCANCELLATION;
|
||||
|
||||
struct SLAndroidAcousticEchoCancellationItf_;
|
||||
typedef const struct SLAndroidAcousticEchoCancellationItf_ * const *
|
||||
SLAndroidAcousticEchoCancellationItf;
|
||||
|
||||
struct SLAndroidAcousticEchoCancellationItf_ {
|
||||
SLresult (*SetEnabled)(
|
||||
SLAndroidAcousticEchoCancellationItf self,
|
||||
SLboolean enabled
|
||||
);
|
||||
SLresult (*IsEnabled)(
|
||||
SLAndroidAcousticEchoCancellationItf self,
|
||||
SLboolean *pEnabled
|
||||
);
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Automatic Gain Control (ACC) Interface */
|
||||
/* --------------------------------------------------------------------------*/
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDAUTOMATICGAINCONTROL;
|
||||
|
||||
struct SLAndroidAutomaticGainControlItf_;
|
||||
typedef const struct SLAndroidAutomaticGainControlItf_ * const * SLAndroidAutomaticGainControlItf;
|
||||
|
||||
struct SLAndroidAutomaticGainControlItf_ {
|
||||
SLresult (*SetEnabled)(
|
||||
SLAndroidAutomaticGainControlItf self,
|
||||
SLboolean enabled
|
||||
);
|
||||
SLresult (*IsEnabled)(
|
||||
SLAndroidAutomaticGainControlItf self,
|
||||
SLboolean *pEnabled
|
||||
);
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Noise Suppression Interface */
|
||||
/* --------------------------------------------------------------------------*/
|
||||
extern SL_API const SLInterfaceID SL_IID_ANDROIDNOISESUPPRESSION;
|
||||
|
||||
struct SLAndroidNoiseSuppressionItf_;
|
||||
typedef const struct SLAndroidNoiseSuppressionItf_ * const * SLAndroidNoiseSuppressionItf;
|
||||
|
||||
struct SLAndroidNoiseSuppressionItf_ {
|
||||
SLresult (*SetEnabled)(
|
||||
SLAndroidNoiseSuppressionItf self,
|
||||
SLboolean enabled
|
||||
);
|
||||
SLresult (*IsEnabled)(
|
||||
SLAndroidNoiseSuppressionItf self,
|
||||
SLboolean *pEnabled
|
||||
);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OPENSL_ES_ANDROID_H_ */
|
||||
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OPENSL_ES_ANDROIDCONFIGURATION_H_
|
||||
#define OPENSL_ES_ANDROIDCONFIGURATION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android AudioRecorder configuration */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Audio recording preset */
|
||||
/** Audio recording preset key */
|
||||
#define SL_ANDROID_KEY_RECORDING_PRESET ((const SLchar*) "androidRecordingPreset")
|
||||
/** Audio recording preset values */
|
||||
/** preset "none" cannot be set, it is used to indicate the current settings
|
||||
* do not match any of the presets. */
|
||||
#define SL_ANDROID_RECORDING_PRESET_NONE ((SLuint32) 0x00000000)
|
||||
/** generic recording configuration on the platform */
|
||||
#define SL_ANDROID_RECORDING_PRESET_GENERIC ((SLuint32) 0x00000001)
|
||||
/** uses the microphone audio source with the same orientation as the camera
|
||||
* if available, the main device microphone otherwise */
|
||||
#define SL_ANDROID_RECORDING_PRESET_CAMCORDER ((SLuint32) 0x00000002)
|
||||
/** uses the main microphone tuned for voice recognition */
|
||||
#define SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION ((SLuint32) 0x00000003)
|
||||
/** uses the main microphone tuned for audio communications */
|
||||
#define SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION ((SLuint32) 0x00000004)
|
||||
/** uses the main microphone unprocessed */
|
||||
#define SL_ANDROID_RECORDING_PRESET_UNPROCESSED ((SLuint32) 0x00000005)
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android AudioPlayer configuration */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Audio playback stream type */
|
||||
/** Audio playback stream type key */
|
||||
#define SL_ANDROID_KEY_STREAM_TYPE ((const SLchar*) "androidPlaybackStreamType")
|
||||
|
||||
/** Audio playback stream type values */
|
||||
/* same as android.media.AudioManager.STREAM_VOICE_CALL */
|
||||
#define SL_ANDROID_STREAM_VOICE ((SLint32) 0x00000000)
|
||||
/* same as android.media.AudioManager.STREAM_SYSTEM */
|
||||
#define SL_ANDROID_STREAM_SYSTEM ((SLint32) 0x00000001)
|
||||
/* same as android.media.AudioManager.STREAM_RING */
|
||||
#define SL_ANDROID_STREAM_RING ((SLint32) 0x00000002)
|
||||
/* same as android.media.AudioManager.STREAM_MUSIC */
|
||||
#define SL_ANDROID_STREAM_MEDIA ((SLint32) 0x00000003)
|
||||
/* same as android.media.AudioManager.STREAM_ALARM */
|
||||
#define SL_ANDROID_STREAM_ALARM ((SLint32) 0x00000004)
|
||||
/* same as android.media.AudioManager.STREAM_NOTIFICATION */
|
||||
#define SL_ANDROID_STREAM_NOTIFICATION ((SLint32) 0x00000005)
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android AudioPlayer and AudioRecorder configuration */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** Audio Performance mode.
|
||||
* Performance mode tells the framework how to configure the audio path
|
||||
* for a player or recorder according to application performance and
|
||||
* functional requirements.
|
||||
* It affects the output or input latency based on acceptable tradeoffs on
|
||||
* battery drain and use of pre or post processing effects.
|
||||
* Performance mode should be set before realizing the object and should be
|
||||
* read after realizing the object to check if the requested mode could be
|
||||
* granted or not.
|
||||
*/
|
||||
/** Audio Performance mode key */
|
||||
#define SL_ANDROID_KEY_PERFORMANCE_MODE ((const SLchar*) "androidPerformanceMode")
|
||||
|
||||
/** Audio performance values */
|
||||
/* No specific performance requirement. Allows HW and SW pre/post processing. */
|
||||
#define SL_ANDROID_PERFORMANCE_NONE ((SLuint32) 0x00000000)
|
||||
/* Priority given to latency. No HW or software pre/post processing.
|
||||
* This is the default if no performance mode is specified. */
|
||||
#define SL_ANDROID_PERFORMANCE_LATENCY ((SLuint32) 0x00000001)
|
||||
/* Priority given to latency while still allowing HW pre and post processing. */
|
||||
#define SL_ANDROID_PERFORMANCE_LATENCY_EFFECTS ((SLuint32) 0x00000002)
|
||||
/* Priority given to power saving if latency is not a concern.
|
||||
* Allows HW and SW pre/post processing. */
|
||||
#define SL_ANDROID_PERFORMANCE_POWER_SAVING ((SLuint32) 0x00000003)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OPENSL_ES_ANDROIDCONFIGURATION_H_ */
|
||||
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OPENSL_ES_ANDROIDMETADATA_H_
|
||||
#define OPENSL_ES_ANDROIDMETADATA_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Android metadata keys */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Additional metadata keys to be used in SLMetadataExtractionItf:
|
||||
* the ANDROID_KEY_PCMFORMAT_* keys follow the fields of the SLDataFormat_PCM struct, and as such
|
||||
* all values corresponding to these keys are of SLuint32 type, and are defined as the fields
|
||||
* of the same name in SLDataFormat_PCM. The exception is that sample rate is expressed here
|
||||
* in Hz units, rather than in milliHz units.
|
||||
*/
|
||||
#define ANDROID_KEY_PCMFORMAT_NUMCHANNELS "AndroidPcmFormatNumChannels"
|
||||
#define ANDROID_KEY_PCMFORMAT_SAMPLERATE "AndroidPcmFormatSampleRate"
|
||||
#define ANDROID_KEY_PCMFORMAT_BITSPERSAMPLE "AndroidPcmFormatBitsPerSample"
|
||||
#define ANDROID_KEY_PCMFORMAT_CONTAINERSIZE "AndroidPcmFormatContainerSize"
|
||||
#define ANDROID_KEY_PCMFORMAT_CHANNELMASK "AndroidPcmFormatChannelMask"
|
||||
#define ANDROID_KEY_PCMFORMAT_ENDIANNESS "AndroidPcmFormatEndianness"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OPENSL_ES_ANDROIDMETADATA_H_ */
|
||||
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and /or associated documentation files (the "Materials "), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE
|
||||
* MATERIALS.
|
||||
*
|
||||
* OpenSLES_Platform.h - OpenSL ES version 1.0
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************************************/
|
||||
/* NOTE: This file contains definitions for the base types and the */
|
||||
/* SLAPIENTRY macro. This file **WILL NEED TO BE EDITED** to provide */
|
||||
/* the correct definitions specific to the platform being used. */
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _OPENSLES_PLATFORM_H_
|
||||
#define _OPENSLES_PLATFORM_H_
|
||||
|
||||
typedef unsigned char sl_uint8_t;
|
||||
typedef signed char sl_int8_t;
|
||||
typedef unsigned short sl_uint16_t;
|
||||
typedef signed short sl_int16_t;
|
||||
typedef unsigned int /*long*/ sl_uint32_t;
|
||||
typedef signed int /*long*/ sl_int32_t;
|
||||
typedef long long sl_int64_t;
|
||||
typedef unsigned long long sl_uint64_t;
|
||||
|
||||
#ifndef SL_API
|
||||
#ifdef __GNUC__
|
||||
#define SL_API /* override per-platform */
|
||||
#else
|
||||
#define SL_API __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SLAPIENTRY
|
||||
#define SLAPIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef SL_API_DEPRECATED
|
||||
#define SL_API_DEPRECATED(level) __attribute__((availability(android,deprecated=level)))
|
||||
#endif
|
||||
|
||||
#endif /* _OPENSLES_PLATFORM_H_ */
|
||||
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_AUXVEC_H
|
||||
#define __ASM_AUXVEC_H
|
||||
#define AT_SYSINFO_EHDR 33
|
||||
#define AT_MINSIGSTKSZ 51
|
||||
#define AT_VECTOR_SIZE_ARCH 2
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_BITSPERLONG_H
|
||||
#define __ASM_BITSPERLONG_H
|
||||
#define __BITS_PER_LONG 64
|
||||
#include <asm-generic/bitsperlong.h>
|
||||
#endif
|
||||
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
|
||||
#define _UAPI__ASM_BPF_PERF_EVENT_H__
|
||||
#include <asm/ptrace.h>
|
||||
typedef struct user_pt_regs bpf_user_pt_regs_t;
|
||||
#endif
|
||||
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_BYTEORDER_H
|
||||
#define __ASM_BYTEORDER_H
|
||||
#ifdef __AARCH64EB__
|
||||
#include <linux/byteorder/big_endian.h>
|
||||
#else
|
||||
#include <linux/byteorder/little_endian.h>
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/errno.h>
|
||||
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_FCNTL_H
|
||||
#define __ASM_FCNTL_H
|
||||
#define O_DIRECTORY 040000
|
||||
#define O_NOFOLLOW 0100000
|
||||
#define O_DIRECT 0200000
|
||||
#define O_LARGEFILE 0400000
|
||||
#include <asm-generic/fcntl.h>
|
||||
#endif
|
||||
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef _UAPI__ASM_HWCAP_H
|
||||
#define _UAPI__ASM_HWCAP_H
|
||||
#define HWCAP_FP (1 << 0)
|
||||
#define HWCAP_ASIMD (1 << 1)
|
||||
#define HWCAP_EVTSTRM (1 << 2)
|
||||
#define HWCAP_AES (1 << 3)
|
||||
#define HWCAP_PMULL (1 << 4)
|
||||
#define HWCAP_SHA1 (1 << 5)
|
||||
#define HWCAP_SHA2 (1 << 6)
|
||||
#define HWCAP_CRC32 (1 << 7)
|
||||
#define HWCAP_ATOMICS (1 << 8)
|
||||
#define HWCAP_FPHP (1 << 9)
|
||||
#define HWCAP_ASIMDHP (1 << 10)
|
||||
#define HWCAP_CPUID (1 << 11)
|
||||
#define HWCAP_ASIMDRDM (1 << 12)
|
||||
#define HWCAP_JSCVT (1 << 13)
|
||||
#define HWCAP_FCMA (1 << 14)
|
||||
#define HWCAP_LRCPC (1 << 15)
|
||||
#define HWCAP_DCPOP (1 << 16)
|
||||
#define HWCAP_SHA3 (1 << 17)
|
||||
#define HWCAP_SM3 (1 << 18)
|
||||
#define HWCAP_SM4 (1 << 19)
|
||||
#define HWCAP_ASIMDDP (1 << 20)
|
||||
#define HWCAP_SHA512 (1 << 21)
|
||||
#define HWCAP_SVE (1 << 22)
|
||||
#define HWCAP_ASIMDFHM (1 << 23)
|
||||
#define HWCAP_DIT (1 << 24)
|
||||
#define HWCAP_USCAT (1 << 25)
|
||||
#define HWCAP_ILRCPC (1 << 26)
|
||||
#define HWCAP_FLAGM (1 << 27)
|
||||
#define HWCAP_SSBS (1 << 28)
|
||||
#define HWCAP_SB (1 << 29)
|
||||
#define HWCAP_PACA (1 << 30)
|
||||
#define HWCAP_PACG (1UL << 31)
|
||||
#define HWCAP2_DCPODP (1 << 0)
|
||||
#define HWCAP2_SVE2 (1 << 1)
|
||||
#define HWCAP2_SVEAES (1 << 2)
|
||||
#define HWCAP2_SVEPMULL (1 << 3)
|
||||
#define HWCAP2_SVEBITPERM (1 << 4)
|
||||
#define HWCAP2_SVESHA3 (1 << 5)
|
||||
#define HWCAP2_SVESM4 (1 << 6)
|
||||
#define HWCAP2_FLAGM2 (1 << 7)
|
||||
#define HWCAP2_FRINT (1 << 8)
|
||||
#define HWCAP2_SVEI8MM (1 << 9)
|
||||
#define HWCAP2_SVEF32MM (1 << 10)
|
||||
#define HWCAP2_SVEF64MM (1 << 11)
|
||||
#define HWCAP2_SVEBF16 (1 << 12)
|
||||
#define HWCAP2_I8MM (1 << 13)
|
||||
#define HWCAP2_BF16 (1 << 14)
|
||||
#define HWCAP2_DGH (1 << 15)
|
||||
#define HWCAP2_RNG (1 << 16)
|
||||
#define HWCAP2_BTI (1 << 17)
|
||||
#define HWCAP2_MTE (1 << 18)
|
||||
#define HWCAP2_ECV (1 << 19)
|
||||
#define HWCAP2_AFP (1 << 20)
|
||||
#define HWCAP2_RPRES (1 << 21)
|
||||
#define HWCAP2_MTE3 (1 << 22)
|
||||
#define HWCAP2_SME (1 << 23)
|
||||
#define HWCAP2_SME_I16I64 (1 << 24)
|
||||
#define HWCAP2_SME_F64F64 (1 << 25)
|
||||
#define HWCAP2_SME_I8I32 (1 << 26)
|
||||
#define HWCAP2_SME_F16F32 (1 << 27)
|
||||
#define HWCAP2_SME_B16F32 (1 << 28)
|
||||
#define HWCAP2_SME_F32F32 (1 << 29)
|
||||
#define HWCAP2_SME_FA64 (1 << 30)
|
||||
#define HWCAP2_WFXT (1UL << 31)
|
||||
#define HWCAP2_EBF16 (1UL << 32)
|
||||
#define HWCAP2_SVE_EBF16 (1UL << 33)
|
||||
#define HWCAP2_CSSC (1UL << 34)
|
||||
#define HWCAP2_RPRFM (1UL << 35)
|
||||
#define HWCAP2_SVE2P1 (1UL << 36)
|
||||
#define HWCAP2_SME2 (1UL << 37)
|
||||
#define HWCAP2_SME2P1 (1UL << 38)
|
||||
#define HWCAP2_SME_I16I32 (1UL << 39)
|
||||
#define HWCAP2_SME_BI32I32 (1UL << 40)
|
||||
#define HWCAP2_SME_B16B16 (1UL << 41)
|
||||
#define HWCAP2_SME_F16F16 (1UL << 42)
|
||||
#define HWCAP2_MOPS (1UL << 43)
|
||||
#define HWCAP2_HBC (1UL << 44)
|
||||
#define HWCAP2_SVE_B16B16 (1UL << 45)
|
||||
#define HWCAP2_LRCPC3 (1UL << 46)
|
||||
#define HWCAP2_LSE128 (1UL << 47)
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/ioctl.h>
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/ioctls.h>
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/ipcbuf.h>
|
||||
@ -0,0 +1,287 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ARM_KVM_H__
|
||||
#define __ARM_KVM_H__
|
||||
#define KVM_SPSR_EL1 0
|
||||
#define KVM_SPSR_SVC KVM_SPSR_EL1
|
||||
#define KVM_SPSR_ABT 1
|
||||
#define KVM_SPSR_UND 2
|
||||
#define KVM_SPSR_IRQ 3
|
||||
#define KVM_SPSR_FIQ 4
|
||||
#define KVM_NR_SPSR 5
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/psci.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/sve_context.h>
|
||||
#define __KVM_HAVE_GUEST_DEBUG
|
||||
#define __KVM_HAVE_IRQ_LINE
|
||||
#define __KVM_HAVE_READONLY_MEM
|
||||
#define __KVM_HAVE_VCPU_EVENTS
|
||||
#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
|
||||
#define KVM_DIRTY_LOG_PAGE_OFFSET 64
|
||||
#define KVM_REG_SIZE(id) (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
|
||||
struct kvm_regs {
|
||||
struct user_pt_regs regs;
|
||||
__u64 sp_el1;
|
||||
__u64 elr_el1;
|
||||
__u64 spsr[KVM_NR_SPSR];
|
||||
struct user_fpsimd_state fp_regs;
|
||||
};
|
||||
#define KVM_ARM_TARGET_AEM_V8 0
|
||||
#define KVM_ARM_TARGET_FOUNDATION_V8 1
|
||||
#define KVM_ARM_TARGET_CORTEX_A57 2
|
||||
#define KVM_ARM_TARGET_XGENE_POTENZA 3
|
||||
#define KVM_ARM_TARGET_CORTEX_A53 4
|
||||
#define KVM_ARM_TARGET_GENERIC_V8 5
|
||||
#define KVM_ARM_NUM_TARGETS 6
|
||||
#define KVM_ARM_DEVICE_TYPE_SHIFT 0
|
||||
#define KVM_ARM_DEVICE_TYPE_MASK GENMASK(KVM_ARM_DEVICE_TYPE_SHIFT + 15, KVM_ARM_DEVICE_TYPE_SHIFT)
|
||||
#define KVM_ARM_DEVICE_ID_SHIFT 16
|
||||
#define KVM_ARM_DEVICE_ID_MASK GENMASK(KVM_ARM_DEVICE_ID_SHIFT + 15, KVM_ARM_DEVICE_ID_SHIFT)
|
||||
#define KVM_ARM_DEVICE_VGIC_V2 0
|
||||
#define KVM_VGIC_V2_ADDR_TYPE_DIST 0
|
||||
#define KVM_VGIC_V2_ADDR_TYPE_CPU 1
|
||||
#define KVM_VGIC_V2_DIST_SIZE 0x1000
|
||||
#define KVM_VGIC_V2_CPU_SIZE 0x2000
|
||||
#define KVM_VGIC_V3_ADDR_TYPE_DIST 2
|
||||
#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3
|
||||
#define KVM_VGIC_ITS_ADDR_TYPE 4
|
||||
#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION 5
|
||||
#define KVM_VGIC_V3_DIST_SIZE SZ_64K
|
||||
#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K)
|
||||
#define KVM_VGIC_V3_ITS_SIZE (2 * SZ_64K)
|
||||
#define KVM_ARM_VCPU_POWER_OFF 0
|
||||
#define KVM_ARM_VCPU_EL1_32BIT 1
|
||||
#define KVM_ARM_VCPU_PSCI_0_2 2
|
||||
#define KVM_ARM_VCPU_PMU_V3 3
|
||||
#define KVM_ARM_VCPU_SVE 4
|
||||
#define KVM_ARM_VCPU_PTRAUTH_ADDRESS 5
|
||||
#define KVM_ARM_VCPU_PTRAUTH_GENERIC 6
|
||||
#define KVM_ARM_VCPU_HAS_EL2 7
|
||||
struct kvm_vcpu_init {
|
||||
__u32 target;
|
||||
__u32 features[7];
|
||||
};
|
||||
struct kvm_sregs {
|
||||
};
|
||||
struct kvm_fpu {
|
||||
};
|
||||
#define KVM_ARM_MAX_DBG_REGS 16
|
||||
struct kvm_guest_debug_arch {
|
||||
__u64 dbg_bcr[KVM_ARM_MAX_DBG_REGS];
|
||||
__u64 dbg_bvr[KVM_ARM_MAX_DBG_REGS];
|
||||
__u64 dbg_wcr[KVM_ARM_MAX_DBG_REGS];
|
||||
__u64 dbg_wvr[KVM_ARM_MAX_DBG_REGS];
|
||||
};
|
||||
#define KVM_DEBUG_ARCH_HSR_HIGH_VALID (1 << 0)
|
||||
struct kvm_debug_exit_arch {
|
||||
__u32 hsr;
|
||||
__u32 hsr_high;
|
||||
__u64 far;
|
||||
};
|
||||
#define KVM_GUESTDBG_USE_SW_BP (1 << 16)
|
||||
#define KVM_GUESTDBG_USE_HW (1 << 17)
|
||||
struct kvm_sync_regs {
|
||||
__u64 device_irq_level;
|
||||
};
|
||||
struct kvm_pmu_event_filter {
|
||||
__u16 base_event;
|
||||
__u16 nevents;
|
||||
#define KVM_PMU_EVENT_ALLOW 0
|
||||
#define KVM_PMU_EVENT_DENY 1
|
||||
__u8 action;
|
||||
__u8 pad[3];
|
||||
};
|
||||
struct kvm_vcpu_events {
|
||||
struct {
|
||||
__u8 serror_pending;
|
||||
__u8 serror_has_esr;
|
||||
__u8 ext_dabt_pending;
|
||||
__u8 pad[5];
|
||||
__u64 serror_esr;
|
||||
} exception;
|
||||
__u32 reserved[12];
|
||||
};
|
||||
struct kvm_arm_copy_mte_tags {
|
||||
__u64 guest_ipa;
|
||||
__u64 length;
|
||||
void * addr;
|
||||
__u64 flags;
|
||||
__u64 reserved[2];
|
||||
};
|
||||
struct kvm_arm_counter_offset {
|
||||
__u64 counter_offset;
|
||||
__u64 reserved;
|
||||
};
|
||||
#define KVM_ARM_TAGS_TO_GUEST 0
|
||||
#define KVM_ARM_TAGS_FROM_GUEST 1
|
||||
#define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000
|
||||
#define KVM_REG_ARM_COPROC_SHIFT 16
|
||||
#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT)
|
||||
#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / sizeof(__u32))
|
||||
#define KVM_REG_ARM_DEMUX (0x0011 << KVM_REG_ARM_COPROC_SHIFT)
|
||||
#define KVM_REG_ARM_DEMUX_ID_MASK 0x000000000000FF00
|
||||
#define KVM_REG_ARM_DEMUX_ID_SHIFT 8
|
||||
#define KVM_REG_ARM_DEMUX_ID_CCSIDR (0x00 << KVM_REG_ARM_DEMUX_ID_SHIFT)
|
||||
#define KVM_REG_ARM_DEMUX_VAL_MASK 0x00000000000000FF
|
||||
#define KVM_REG_ARM_DEMUX_VAL_SHIFT 0
|
||||
#define KVM_REG_ARM64_SYSREG (0x0013 << KVM_REG_ARM_COPROC_SHIFT)
|
||||
#define KVM_REG_ARM64_SYSREG_OP0_MASK 0x000000000000c000
|
||||
#define KVM_REG_ARM64_SYSREG_OP0_SHIFT 14
|
||||
#define KVM_REG_ARM64_SYSREG_OP1_MASK 0x0000000000003800
|
||||
#define KVM_REG_ARM64_SYSREG_OP1_SHIFT 11
|
||||
#define KVM_REG_ARM64_SYSREG_CRN_MASK 0x0000000000000780
|
||||
#define KVM_REG_ARM64_SYSREG_CRN_SHIFT 7
|
||||
#define KVM_REG_ARM64_SYSREG_CRM_MASK 0x0000000000000078
|
||||
#define KVM_REG_ARM64_SYSREG_CRM_SHIFT 3
|
||||
#define KVM_REG_ARM64_SYSREG_OP2_MASK 0x0000000000000007
|
||||
#define KVM_REG_ARM64_SYSREG_OP2_SHIFT 0
|
||||
#define ARM64_SYS_REG_SHIFT_MASK(x,n) (((x) << KVM_REG_ARM64_SYSREG_ ##n ##_SHIFT) & KVM_REG_ARM64_SYSREG_ ##n ##_MASK)
|
||||
#define __ARM64_SYS_REG(op0,op1,crn,crm,op2) (KVM_REG_ARM64 | KVM_REG_ARM64_SYSREG | ARM64_SYS_REG_SHIFT_MASK(op0, OP0) | ARM64_SYS_REG_SHIFT_MASK(op1, OP1) | ARM64_SYS_REG_SHIFT_MASK(crn, CRN) | ARM64_SYS_REG_SHIFT_MASK(crm, CRM) | ARM64_SYS_REG_SHIFT_MASK(op2, OP2))
|
||||
#define ARM64_SYS_REG(...) (__ARM64_SYS_REG(__VA_ARGS__) | KVM_REG_SIZE_U64)
|
||||
#define KVM_REG_ARM_PTIMER_CTL ARM64_SYS_REG(3, 3, 14, 2, 1)
|
||||
#define KVM_REG_ARM_PTIMER_CVAL ARM64_SYS_REG(3, 3, 14, 2, 2)
|
||||
#define KVM_REG_ARM_PTIMER_CNT ARM64_SYS_REG(3, 3, 14, 0, 1)
|
||||
#define KVM_REG_ARM_TIMER_CTL ARM64_SYS_REG(3, 3, 14, 3, 1)
|
||||
#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2)
|
||||
#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)
|
||||
#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
|
||||
#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
|
||||
#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 KVM_REG_ARM_FW_REG(1)
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2)
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL 2
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4)
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3 KVM_REG_ARM_FW_REG(3)
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_AVAIL 0
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_AVAIL 1
|
||||
#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_REQUIRED 2
|
||||
#define KVM_REG_ARM64_SVE (0x15 << KVM_REG_ARM_COPROC_SHIFT)
|
||||
#define KVM_REG_ARM64_SVE_ZREG_BASE 0
|
||||
#define KVM_REG_ARM64_SVE_PREG_BASE 0x400
|
||||
#define KVM_REG_ARM64_SVE_FFR_BASE 0x600
|
||||
#define KVM_ARM64_SVE_NUM_ZREGS __SVE_NUM_ZREGS
|
||||
#define KVM_ARM64_SVE_NUM_PREGS __SVE_NUM_PREGS
|
||||
#define KVM_ARM64_SVE_MAX_SLICES 32
|
||||
#define KVM_REG_ARM64_SVE_ZREG(n,i) (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_ZREG_BASE | KVM_REG_SIZE_U2048 | (((n) & (KVM_ARM64_SVE_NUM_ZREGS - 1)) << 5) | ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
|
||||
#define KVM_REG_ARM64_SVE_PREG(n,i) (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_PREG_BASE | KVM_REG_SIZE_U256 | (((n) & (KVM_ARM64_SVE_NUM_PREGS - 1)) << 5) | ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
|
||||
#define KVM_REG_ARM64_SVE_FFR(i) (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_FFR_BASE | KVM_REG_SIZE_U256 | ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
|
||||
#define KVM_ARM64_SVE_VQ_MIN __SVE_VQ_MIN
|
||||
#define KVM_ARM64_SVE_VQ_MAX __SVE_VQ_MAX
|
||||
#define KVM_REG_ARM64_SVE_VLS (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_SIZE_U512 | 0xffff)
|
||||
#define KVM_ARM64_SVE_VLS_WORDS ((KVM_ARM64_SVE_VQ_MAX - KVM_ARM64_SVE_VQ_MIN) / 64 + 1)
|
||||
#define KVM_REG_ARM_FW_FEAT_BMAP (0x0016 << KVM_REG_ARM_COPROC_SHIFT)
|
||||
#define KVM_REG_ARM_FW_FEAT_BMAP_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW_FEAT_BMAP | ((r) & 0xffff))
|
||||
#define KVM_REG_ARM_STD_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(0)
|
||||
enum {
|
||||
KVM_REG_ARM_STD_BIT_TRNG_V1_0 = 0,
|
||||
};
|
||||
#define KVM_REG_ARM_STD_HYP_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(1)
|
||||
enum {
|
||||
KVM_REG_ARM_STD_HYP_BIT_PV_TIME = 0,
|
||||
};
|
||||
#define KVM_REG_ARM_VENDOR_HYP_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(2)
|
||||
enum {
|
||||
KVM_REG_ARM_VENDOR_HYP_BIT_FUNC_FEAT = 0,
|
||||
KVM_REG_ARM_VENDOR_HYP_BIT_PTP = 1,
|
||||
};
|
||||
#define KVM_ARM_VM_SMCCC_CTRL 0
|
||||
#define KVM_ARM_VM_SMCCC_FILTER 0
|
||||
#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
|
||||
#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
|
||||
#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
|
||||
#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32
|
||||
#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT)
|
||||
#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32
|
||||
#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT)
|
||||
#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0
|
||||
#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
|
||||
#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff)
|
||||
#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3
|
||||
#define KVM_DEV_ARM_VGIC_GRP_CTRL 4
|
||||
#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5
|
||||
#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6
|
||||
#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7
|
||||
#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8
|
||||
#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10
|
||||
#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT)
|
||||
#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff
|
||||
#define VGIC_LEVEL_INFO_LINE_LEVEL 0
|
||||
#define KVM_DEV_ARM_VGIC_CTRL_INIT 0
|
||||
#define KVM_DEV_ARM_ITS_SAVE_TABLES 1
|
||||
#define KVM_DEV_ARM_ITS_RESTORE_TABLES 2
|
||||
#define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3
|
||||
#define KVM_DEV_ARM_ITS_CTRL_RESET 4
|
||||
#define KVM_ARM_VCPU_PMU_V3_CTRL 0
|
||||
#define KVM_ARM_VCPU_PMU_V3_IRQ 0
|
||||
#define KVM_ARM_VCPU_PMU_V3_INIT 1
|
||||
#define KVM_ARM_VCPU_PMU_V3_FILTER 2
|
||||
#define KVM_ARM_VCPU_PMU_V3_SET_PMU 3
|
||||
#define KVM_ARM_VCPU_TIMER_CTRL 1
|
||||
#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
|
||||
#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
|
||||
#define KVM_ARM_VCPU_TIMER_IRQ_HVTIMER 2
|
||||
#define KVM_ARM_VCPU_TIMER_IRQ_HPTIMER 3
|
||||
#define KVM_ARM_VCPU_PVTIME_CTRL 2
|
||||
#define KVM_ARM_VCPU_PVTIME_IPA 0
|
||||
#define KVM_ARM_IRQ_VCPU2_SHIFT 28
|
||||
#define KVM_ARM_IRQ_VCPU2_MASK 0xf
|
||||
#define KVM_ARM_IRQ_TYPE_SHIFT 24
|
||||
#define KVM_ARM_IRQ_TYPE_MASK 0xf
|
||||
#define KVM_ARM_IRQ_VCPU_SHIFT 16
|
||||
#define KVM_ARM_IRQ_VCPU_MASK 0xff
|
||||
#define KVM_ARM_IRQ_NUM_SHIFT 0
|
||||
#define KVM_ARM_IRQ_NUM_MASK 0xffff
|
||||
#define KVM_ARM_IRQ_TYPE_CPU 0
|
||||
#define KVM_ARM_IRQ_TYPE_SPI 1
|
||||
#define KVM_ARM_IRQ_TYPE_PPI 2
|
||||
#define KVM_ARM_IRQ_CPU_IRQ 0
|
||||
#define KVM_ARM_IRQ_CPU_FIQ 1
|
||||
#define KVM_ARM_IRQ_GIC_MAX 127
|
||||
#define KVM_NR_IRQCHIPS 1
|
||||
#define KVM_PSCI_FN_BASE 0x95c1ba5e
|
||||
#define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n))
|
||||
#define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0)
|
||||
#define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1)
|
||||
#define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2)
|
||||
#define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3)
|
||||
#define KVM_PSCI_RET_SUCCESS PSCI_RET_SUCCESS
|
||||
#define KVM_PSCI_RET_NI PSCI_RET_NOT_SUPPORTED
|
||||
#define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS
|
||||
#define KVM_PSCI_RET_DENIED PSCI_RET_DENIED
|
||||
#define KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 (1ULL << 0)
|
||||
#define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED (1ULL << 0)
|
||||
enum kvm_smccc_filter_action {
|
||||
KVM_SMCCC_FILTER_HANDLE = 0,
|
||||
KVM_SMCCC_FILTER_DENY,
|
||||
KVM_SMCCC_FILTER_FWD_TO_USER,
|
||||
};
|
||||
struct kvm_smccc_filter {
|
||||
__u32 base;
|
||||
__u32 nr_functions;
|
||||
__u8 action;
|
||||
__u8 pad[15];
|
||||
};
|
||||
#define KVM_HYPERCALL_EXIT_SMC (1U << 0)
|
||||
#define KVM_HYPERCALL_EXIT_16BIT (1U << 1)
|
||||
#define KVM_ARM_FEATURE_ID_RANGE_IDX(op0,op1,crn,crm,op2) ({ __u64 __op1 = (op1) & 3; __op1 -= (__op1 == 3); (__op1 << 6 | ((crm) & 7) << 3 | (op2)); })
|
||||
#define KVM_ARM_FEATURE_ID_RANGE 0
|
||||
#define KVM_ARM_FEATURE_ID_RANGE_SIZE (3 * 8 * 8)
|
||||
struct reg_mask_range {
|
||||
__u64 addr;
|
||||
__u32 range;
|
||||
__u32 reserved[13];
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/kvm_para.h>
|
||||
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef _UAPI__ASM_MMAN_H
|
||||
#define _UAPI__ASM_MMAN_H
|
||||
#include <asm-generic/mman.h>
|
||||
#define PROT_BTI 0x10
|
||||
#define PROT_MTE 0x20
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/msgbuf.h>
|
||||
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_PARAM_H
|
||||
#define __ASM_PARAM_H
|
||||
#define EXEC_PAGESIZE 65536
|
||||
#include <asm-generic/param.h>
|
||||
#endif
|
||||
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef _ASM_ARM64_PERF_REGS_H
|
||||
#define _ASM_ARM64_PERF_REGS_H
|
||||
enum perf_event_arm_regs {
|
||||
PERF_REG_ARM64_X0,
|
||||
PERF_REG_ARM64_X1,
|
||||
PERF_REG_ARM64_X2,
|
||||
PERF_REG_ARM64_X3,
|
||||
PERF_REG_ARM64_X4,
|
||||
PERF_REG_ARM64_X5,
|
||||
PERF_REG_ARM64_X6,
|
||||
PERF_REG_ARM64_X7,
|
||||
PERF_REG_ARM64_X8,
|
||||
PERF_REG_ARM64_X9,
|
||||
PERF_REG_ARM64_X10,
|
||||
PERF_REG_ARM64_X11,
|
||||
PERF_REG_ARM64_X12,
|
||||
PERF_REG_ARM64_X13,
|
||||
PERF_REG_ARM64_X14,
|
||||
PERF_REG_ARM64_X15,
|
||||
PERF_REG_ARM64_X16,
|
||||
PERF_REG_ARM64_X17,
|
||||
PERF_REG_ARM64_X18,
|
||||
PERF_REG_ARM64_X19,
|
||||
PERF_REG_ARM64_X20,
|
||||
PERF_REG_ARM64_X21,
|
||||
PERF_REG_ARM64_X22,
|
||||
PERF_REG_ARM64_X23,
|
||||
PERF_REG_ARM64_X24,
|
||||
PERF_REG_ARM64_X25,
|
||||
PERF_REG_ARM64_X26,
|
||||
PERF_REG_ARM64_X27,
|
||||
PERF_REG_ARM64_X28,
|
||||
PERF_REG_ARM64_X29,
|
||||
PERF_REG_ARM64_LR,
|
||||
PERF_REG_ARM64_SP,
|
||||
PERF_REG_ARM64_PC,
|
||||
PERF_REG_ARM64_MAX,
|
||||
PERF_REG_ARM64_VG = 46,
|
||||
PERF_REG_ARM64_EXTENDED_MAX
|
||||
};
|
||||
#define PERF_REG_EXTENDED_MASK (1ULL << PERF_REG_ARM64_VG)
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/poll.h>
|
||||
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_POSIX_TYPES_H
|
||||
#define __ASM_POSIX_TYPES_H
|
||||
typedef unsigned short __kernel_old_uid_t;
|
||||
typedef unsigned short __kernel_old_gid_t;
|
||||
#define __kernel_old_uid_t __kernel_old_uid_t
|
||||
#include <asm-generic/posix_types.h>
|
||||
#endif
|
||||
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef _UAPI__ASM_PTRACE_H
|
||||
#define _UAPI__ASM_PTRACE_H
|
||||
#include <linux/types.h>
|
||||
#include <asm/hwcap.h>
|
||||
#include <asm/sve_context.h>
|
||||
#define PSR_MODE_EL0t 0x00000000
|
||||
#define PSR_MODE_EL1t 0x00000004
|
||||
#define PSR_MODE_EL1h 0x00000005
|
||||
#define PSR_MODE_EL2t 0x00000008
|
||||
#define PSR_MODE_EL2h 0x00000009
|
||||
#define PSR_MODE_EL3t 0x0000000c
|
||||
#define PSR_MODE_EL3h 0x0000000d
|
||||
#define PSR_MODE_MASK 0x0000000f
|
||||
#define PSR_MODE32_BIT 0x00000010
|
||||
#define PSR_F_BIT 0x00000040
|
||||
#define PSR_I_BIT 0x00000080
|
||||
#define PSR_A_BIT 0x00000100
|
||||
#define PSR_D_BIT 0x00000200
|
||||
#define PSR_BTYPE_MASK 0x00000c00
|
||||
#define PSR_SSBS_BIT 0x00001000
|
||||
#define PSR_PAN_BIT 0x00400000
|
||||
#define PSR_UAO_BIT 0x00800000
|
||||
#define PSR_DIT_BIT 0x01000000
|
||||
#define PSR_TCO_BIT 0x02000000
|
||||
#define PSR_V_BIT 0x10000000
|
||||
#define PSR_C_BIT 0x20000000
|
||||
#define PSR_Z_BIT 0x40000000
|
||||
#define PSR_N_BIT 0x80000000
|
||||
#define PSR_BTYPE_SHIFT 10
|
||||
#define PSR_f 0xff000000
|
||||
#define PSR_s 0x00ff0000
|
||||
#define PSR_x 0x0000ff00
|
||||
#define PSR_c 0x000000ff
|
||||
#define PSR_BTYPE_NONE (0b00 << PSR_BTYPE_SHIFT)
|
||||
#define PSR_BTYPE_JC (0b01 << PSR_BTYPE_SHIFT)
|
||||
#define PSR_BTYPE_C (0b10 << PSR_BTYPE_SHIFT)
|
||||
#define PSR_BTYPE_J (0b11 << PSR_BTYPE_SHIFT)
|
||||
#define PTRACE_SYSEMU 31
|
||||
#define PTRACE_SYSEMU_SINGLESTEP 32
|
||||
#define PTRACE_PEEKMTETAGS 33
|
||||
#define PTRACE_POKEMTETAGS 34
|
||||
#ifndef __ASSEMBLY__
|
||||
struct user_pt_regs {
|
||||
__u64 regs[31];
|
||||
__u64 sp;
|
||||
__u64 pc;
|
||||
__u64 pstate;
|
||||
};
|
||||
struct user_fpsimd_state {
|
||||
__uint128_t vregs[32];
|
||||
__u32 fpsr;
|
||||
__u32 fpcr;
|
||||
__u32 __reserved[2];
|
||||
};
|
||||
struct user_hwdebug_state {
|
||||
__u32 dbg_info;
|
||||
__u32 pad;
|
||||
struct {
|
||||
__u64 addr;
|
||||
__u32 ctrl;
|
||||
__u32 pad;
|
||||
} dbg_regs[16];
|
||||
};
|
||||
struct user_sve_header {
|
||||
__u32 size;
|
||||
__u32 max_size;
|
||||
__u16 vl;
|
||||
__u16 max_vl;
|
||||
__u16 flags;
|
||||
__u16 __reserved;
|
||||
};
|
||||
#define SVE_PT_REGS_MASK (1 << 0)
|
||||
#define SVE_PT_REGS_FPSIMD 0
|
||||
#define SVE_PT_REGS_SVE SVE_PT_REGS_MASK
|
||||
#define SVE_PT_VL_INHERIT ((1 << 17) >> 16)
|
||||
#define SVE_PT_VL_ONEXEC ((1 << 18) >> 16)
|
||||
#define SVE_PT_REGS_OFFSET ((sizeof(struct user_sve_header) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
|
||||
#define SVE_PT_FPSIMD_OFFSET SVE_PT_REGS_OFFSET
|
||||
#define SVE_PT_FPSIMD_SIZE(vq,flags) (sizeof(struct user_fpsimd_state))
|
||||
#define SVE_PT_SVE_ZREG_SIZE(vq) __SVE_ZREG_SIZE(vq)
|
||||
#define SVE_PT_SVE_PREG_SIZE(vq) __SVE_PREG_SIZE(vq)
|
||||
#define SVE_PT_SVE_FFR_SIZE(vq) __SVE_FFR_SIZE(vq)
|
||||
#define SVE_PT_SVE_FPSR_SIZE sizeof(__u32)
|
||||
#define SVE_PT_SVE_FPCR_SIZE sizeof(__u32)
|
||||
#define SVE_PT_SVE_OFFSET SVE_PT_REGS_OFFSET
|
||||
#define SVE_PT_SVE_ZREGS_OFFSET (SVE_PT_REGS_OFFSET + __SVE_ZREGS_OFFSET)
|
||||
#define SVE_PT_SVE_ZREG_OFFSET(vq,n) (SVE_PT_REGS_OFFSET + __SVE_ZREG_OFFSET(vq, n))
|
||||
#define SVE_PT_SVE_ZREGS_SIZE(vq) (SVE_PT_SVE_ZREG_OFFSET(vq, __SVE_NUM_ZREGS) - SVE_PT_SVE_ZREGS_OFFSET)
|
||||
#define SVE_PT_SVE_PREGS_OFFSET(vq) (SVE_PT_REGS_OFFSET + __SVE_PREGS_OFFSET(vq))
|
||||
#define SVE_PT_SVE_PREG_OFFSET(vq,n) (SVE_PT_REGS_OFFSET + __SVE_PREG_OFFSET(vq, n))
|
||||
#define SVE_PT_SVE_PREGS_SIZE(vq) (SVE_PT_SVE_PREG_OFFSET(vq, __SVE_NUM_PREGS) - SVE_PT_SVE_PREGS_OFFSET(vq))
|
||||
#define SVE_PT_SVE_FFR_OFFSET(vq) (SVE_PT_REGS_OFFSET + __SVE_FFR_OFFSET(vq))
|
||||
#define SVE_PT_SVE_FPSR_OFFSET(vq) ((SVE_PT_SVE_FFR_OFFSET(vq) + SVE_PT_SVE_FFR_SIZE(vq) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
|
||||
#define SVE_PT_SVE_FPCR_OFFSET(vq) (SVE_PT_SVE_FPSR_OFFSET(vq) + SVE_PT_SVE_FPSR_SIZE)
|
||||
#define SVE_PT_SVE_SIZE(vq,flags) ((SVE_PT_SVE_FPCR_OFFSET(vq) + SVE_PT_SVE_FPCR_SIZE - SVE_PT_SVE_OFFSET + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
|
||||
#define SVE_PT_SIZE(vq,flags) (((flags) & SVE_PT_REGS_MASK) == SVE_PT_REGS_SVE ? SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq, flags) : ((((flags) & SVE_PT_REGS_MASK) == SVE_PT_REGS_FPSIMD ? SVE_PT_FPSIMD_OFFSET + SVE_PT_FPSIMD_SIZE(vq, flags) : SVE_PT_REGS_OFFSET)))
|
||||
struct user_pac_mask {
|
||||
__u64 data_mask;
|
||||
__u64 insn_mask;
|
||||
};
|
||||
struct user_pac_address_keys {
|
||||
__uint128_t apiakey;
|
||||
__uint128_t apibkey;
|
||||
__uint128_t apdakey;
|
||||
__uint128_t apdbkey;
|
||||
};
|
||||
struct user_pac_generic_keys {
|
||||
__uint128_t apgakey;
|
||||
};
|
||||
struct user_za_header {
|
||||
__u32 size;
|
||||
__u32 max_size;
|
||||
__u16 vl;
|
||||
__u16 max_vl;
|
||||
__u16 flags;
|
||||
__u16 __reserved;
|
||||
};
|
||||
#define ZA_PT_VL_INHERIT ((1 << 17) >> 16)
|
||||
#define ZA_PT_VL_ONEXEC ((1 << 18) >> 16)
|
||||
#define ZA_PT_ZA_OFFSET ((sizeof(struct user_za_header) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
|
||||
#define ZA_PT_ZAV_OFFSET(vq,n) (ZA_PT_ZA_OFFSET + ((vq * __SVE_VQ_BYTES) * n))
|
||||
#define ZA_PT_ZA_SIZE(vq) ((vq * __SVE_VQ_BYTES) * (vq * __SVE_VQ_BYTES))
|
||||
#define ZA_PT_SIZE(vq) (ZA_PT_ZA_OFFSET + ZA_PT_ZA_SIZE(vq))
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/resource.h>
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/sembuf.h>
|
||||
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_SETUP_H
|
||||
#define __ASM_SETUP_H
|
||||
#include <linux/types.h>
|
||||
#define COMMAND_LINE_SIZE 2048
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/shmbuf.h>
|
||||
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef _UAPI__ASM_SIGCONTEXT_H
|
||||
#define _UAPI__ASM_SIGCONTEXT_H
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/types.h>
|
||||
struct sigcontext {
|
||||
__u64 fault_address;
|
||||
__u64 regs[31];
|
||||
__u64 sp;
|
||||
__u64 pc;
|
||||
__u64 pstate;
|
||||
__u8 __reserved[4096] __attribute__((__aligned__(16)));
|
||||
};
|
||||
struct _aarch64_ctx {
|
||||
__u32 magic;
|
||||
__u32 size;
|
||||
};
|
||||
#define FPSIMD_MAGIC 0x46508001
|
||||
struct fpsimd_context {
|
||||
struct _aarch64_ctx head;
|
||||
__u32 fpsr;
|
||||
__u32 fpcr;
|
||||
__uint128_t vregs[32];
|
||||
};
|
||||
#define ESR_MAGIC 0x45535201
|
||||
struct esr_context {
|
||||
struct _aarch64_ctx head;
|
||||
__u64 esr;
|
||||
};
|
||||
#define EXTRA_MAGIC 0x45585401
|
||||
struct extra_context {
|
||||
struct _aarch64_ctx head;
|
||||
__u64 datap;
|
||||
__u32 size;
|
||||
__u32 __reserved[3];
|
||||
};
|
||||
#define SVE_MAGIC 0x53564501
|
||||
struct sve_context {
|
||||
struct _aarch64_ctx head;
|
||||
__u16 vl;
|
||||
__u16 flags;
|
||||
__u16 __reserved[2];
|
||||
};
|
||||
#define SVE_SIG_FLAG_SM 0x1
|
||||
#define TPIDR2_MAGIC 0x54504902
|
||||
struct tpidr2_context {
|
||||
struct _aarch64_ctx head;
|
||||
__u64 tpidr2;
|
||||
};
|
||||
#define ZA_MAGIC 0x54366345
|
||||
struct za_context {
|
||||
struct _aarch64_ctx head;
|
||||
__u16 vl;
|
||||
__u16 __reserved[3];
|
||||
};
|
||||
#define ZT_MAGIC 0x5a544e01
|
||||
struct zt_context {
|
||||
struct _aarch64_ctx head;
|
||||
__u16 nregs;
|
||||
__u16 __reserved[3];
|
||||
};
|
||||
#endif
|
||||
#include <asm/sve_context.h>
|
||||
#define SVE_VQ_BYTES __SVE_VQ_BYTES
|
||||
#define SVE_VQ_MIN __SVE_VQ_MIN
|
||||
#define SVE_VQ_MAX __SVE_VQ_MAX
|
||||
#define SVE_VL_MIN __SVE_VL_MIN
|
||||
#define SVE_VL_MAX __SVE_VL_MAX
|
||||
#define SVE_NUM_ZREGS __SVE_NUM_ZREGS
|
||||
#define SVE_NUM_PREGS __SVE_NUM_PREGS
|
||||
#define sve_vl_valid(vl) __sve_vl_valid(vl)
|
||||
#define sve_vq_from_vl(vl) __sve_vq_from_vl(vl)
|
||||
#define sve_vl_from_vq(vq) __sve_vl_from_vq(vq)
|
||||
#define SVE_SIG_ZREG_SIZE(vq) __SVE_ZREG_SIZE(vq)
|
||||
#define SVE_SIG_PREG_SIZE(vq) __SVE_PREG_SIZE(vq)
|
||||
#define SVE_SIG_FFR_SIZE(vq) __SVE_FFR_SIZE(vq)
|
||||
#define SVE_SIG_REGS_OFFSET ((sizeof(struct sve_context) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
|
||||
#define SVE_SIG_ZREGS_OFFSET (SVE_SIG_REGS_OFFSET + __SVE_ZREGS_OFFSET)
|
||||
#define SVE_SIG_ZREG_OFFSET(vq,n) (SVE_SIG_REGS_OFFSET + __SVE_ZREG_OFFSET(vq, n))
|
||||
#define SVE_SIG_ZREGS_SIZE(vq) __SVE_ZREGS_SIZE(vq)
|
||||
#define SVE_SIG_PREGS_OFFSET(vq) (SVE_SIG_REGS_OFFSET + __SVE_PREGS_OFFSET(vq))
|
||||
#define SVE_SIG_PREG_OFFSET(vq,n) (SVE_SIG_REGS_OFFSET + __SVE_PREG_OFFSET(vq, n))
|
||||
#define SVE_SIG_PREGS_SIZE(vq) __SVE_PREGS_SIZE(vq)
|
||||
#define SVE_SIG_FFR_OFFSET(vq) (SVE_SIG_REGS_OFFSET + __SVE_FFR_OFFSET(vq))
|
||||
#define SVE_SIG_REGS_SIZE(vq) (__SVE_FFR_OFFSET(vq) + __SVE_FFR_SIZE(vq))
|
||||
#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
|
||||
#define ZA_SIG_REGS_OFFSET ((sizeof(struct za_context) + (__SVE_VQ_BYTES - 1)) / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
|
||||
#define ZA_SIG_REGS_SIZE(vq) ((vq * __SVE_VQ_BYTES) * (vq * __SVE_VQ_BYTES))
|
||||
#define ZA_SIG_ZAV_OFFSET(vq,n) (ZA_SIG_REGS_OFFSET + (SVE_SIG_ZREG_SIZE(vq) * n))
|
||||
#define ZA_SIG_CONTEXT_SIZE(vq) (ZA_SIG_REGS_OFFSET + ZA_SIG_REGS_SIZE(vq))
|
||||
#define ZT_SIG_REG_SIZE 512
|
||||
#define ZT_SIG_REG_BYTES (ZT_SIG_REG_SIZE / 8)
|
||||
#define ZT_SIG_REGS_OFFSET sizeof(struct zt_context)
|
||||
#define ZT_SIG_REGS_SIZE(n) (ZT_SIG_REG_BYTES * n)
|
||||
#define ZT_SIG_CONTEXT_SIZE(n) (sizeof(struct zt_context) + ZT_SIG_REGS_SIZE(n))
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/siginfo.h>
|
||||
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_SIGNAL_H
|
||||
#define __ASM_SIGNAL_H
|
||||
#define SA_RESTORER 0x04000000
|
||||
#define MINSIGSTKSZ 5120
|
||||
#define SIGSTKSZ 16384
|
||||
#include <asm-generic/signal.h>
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/socket.h>
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/sockios.h>
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/stat.h>
|
||||
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef __ASM_STATFS_H
|
||||
#define __ASM_STATFS_H
|
||||
#define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed, aligned(4)))
|
||||
#include <asm-generic/statfs.h>
|
||||
#endif
|
||||
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef _UAPI__ASM_SVE_CONTEXT_H
|
||||
#define _UAPI__ASM_SVE_CONTEXT_H
|
||||
#include <linux/types.h>
|
||||
#define __SVE_VQ_BYTES 16
|
||||
#define __SVE_VQ_MIN 1
|
||||
#define __SVE_VQ_MAX 512
|
||||
#define __SVE_VL_MIN (__SVE_VQ_MIN * __SVE_VQ_BYTES)
|
||||
#define __SVE_VL_MAX (__SVE_VQ_MAX * __SVE_VQ_BYTES)
|
||||
#define __SVE_NUM_ZREGS 32
|
||||
#define __SVE_NUM_PREGS 16
|
||||
#define __sve_vl_valid(vl) ((vl) % __SVE_VQ_BYTES == 0 && (vl) >= __SVE_VL_MIN && (vl) <= __SVE_VL_MAX)
|
||||
#define __sve_vq_from_vl(vl) ((vl) / __SVE_VQ_BYTES)
|
||||
#define __sve_vl_from_vq(vq) ((vq) * __SVE_VQ_BYTES)
|
||||
#define __SVE_ZREG_SIZE(vq) ((__u32) (vq) * __SVE_VQ_BYTES)
|
||||
#define __SVE_PREG_SIZE(vq) ((__u32) (vq) * (__SVE_VQ_BYTES / 8))
|
||||
#define __SVE_FFR_SIZE(vq) __SVE_PREG_SIZE(vq)
|
||||
#define __SVE_ZREGS_OFFSET 0
|
||||
#define __SVE_ZREG_OFFSET(vq,n) (__SVE_ZREGS_OFFSET + __SVE_ZREG_SIZE(vq) * (n))
|
||||
#define __SVE_ZREGS_SIZE(vq) (__SVE_ZREG_OFFSET(vq, __SVE_NUM_ZREGS) - __SVE_ZREGS_OFFSET)
|
||||
#define __SVE_PREGS_OFFSET(vq) (__SVE_ZREGS_OFFSET + __SVE_ZREGS_SIZE(vq))
|
||||
#define __SVE_PREG_OFFSET(vq,n) (__SVE_PREGS_OFFSET(vq) + __SVE_PREG_SIZE(vq) * (n))
|
||||
#define __SVE_PREGS_SIZE(vq) (__SVE_PREG_OFFSET(vq, __SVE_NUM_PREGS) - __SVE_PREGS_OFFSET(vq))
|
||||
#define __SVE_FFR_OFFSET(vq) (__SVE_PREGS_OFFSET(vq) + __SVE_PREGS_SIZE(vq))
|
||||
#endif
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/swab.h>
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/termbits.h>
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/termios.h>
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#include <asm-generic/types.h>
|
||||
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#ifndef _UAPI__ASM_UCONTEXT_H
|
||||
#define _UAPI__ASM_UCONTEXT_H
|
||||
#include <linux/types.h>
|
||||
struct ucontext {
|
||||
unsigned long uc_flags;
|
||||
struct ucontext * uc_link;
|
||||
stack_t uc_stack;
|
||||
sigset_t uc_sigmask;
|
||||
__u8 __linux_unused[1024 / 8 - sizeof(sigset_t)];
|
||||
struct sigcontext uc_mcontext;
|
||||
};
|
||||
#endif
|
||||
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is auto-generated. Modifications will be lost.
|
||||
*
|
||||
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
|
||||
* for more information.
|
||||
*/
|
||||
#define __ARCH_WANT_RENAMEAT
|
||||
#define __ARCH_WANT_NEW_STAT
|
||||
#define __ARCH_WANT_SET_GET_RLIMIT
|
||||
#define __ARCH_WANT_TIME32_SYSCALLS
|
||||
#define __ARCH_WANT_SYS_CLONE3
|
||||
#define __ARCH_WANT_MEMFD_SECRET
|
||||
#include <asm-generic/unistd.h>
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file alloca.h
|
||||
* @brief Allocate space on the stack.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/**
|
||||
* [alloca(3)](http://man7.org/linux/man-pages/man3/alloca.3.html) allocates space on the stack.
|
||||
*
|
||||
* New code should not use alloca because it cannot report failure.
|
||||
* Use regular heap allocation instead.
|
||||
*
|
||||
* @return a pointer to the space on success, but has undefined behavior on failure.
|
||||
*/
|
||||
#define alloca(size) __builtin_alloca(size)
|
||||
@ -0,0 +1,353 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* @addtogroup Midi
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file AMidi.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_MEDIA_AMIDI_H_
|
||||
#define ANDROID_MEDIA_AMIDI_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <media/NdkMediaError.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AMIDI_API __attribute__((visibility("default")))
|
||||
|
||||
typedef struct AMidiDevice AMidiDevice;
|
||||
typedef struct AMidiInputPort AMidiInputPort;
|
||||
typedef struct AMidiOutputPort AMidiOutputPort;
|
||||
|
||||
/*
|
||||
* Message Op Codes. Used to parse MIDI data packets
|
||||
*/
|
||||
enum {
|
||||
AMIDI_OPCODE_DATA = 1, /* The MIDI packet contains normal MIDI data */
|
||||
AMIDI_OPCODE_FLUSH = 2, /* The MIDI packet contains just a MIDI FLUSH command. */
|
||||
/* Forces the send of any pending MIDI data. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Type IDs for various MIDI devices.
|
||||
*/
|
||||
enum {
|
||||
AMIDI_DEVICE_TYPE_USB = 1, /* A MIDI device connected to the Android USB port */
|
||||
AMIDI_DEVICE_TYPE_VIRTUAL = 2, /* A software object implementing MidiDeviceService */
|
||||
AMIDI_DEVICE_TYPE_BLUETOOTH = 3 /* A MIDI device connected via BlueTooth */
|
||||
};
|
||||
|
||||
/*
|
||||
* Protocol IDs for various MIDI devices.
|
||||
*
|
||||
* Introduced in API 33.
|
||||
*/
|
||||
typedef enum AMidiDevice_Protocol : int32_t {
|
||||
/**
|
||||
* Constant representing a default protocol with Universal MIDI Packets (UMP).
|
||||
* UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec.
|
||||
* All UMP data should be a multiple of 4 bytes.
|
||||
* Use UMP to negotiate with the device with MIDI-CI.
|
||||
* MIDI-CI is defined in "MIDI Capability Inquiry (MIDI-CI)" spec.
|
||||
*/
|
||||
AMIDI_DEVICE_PROTOCOL_UMP_USE_MIDI_CI = 0,
|
||||
|
||||
/**
|
||||
* Constant representing a default protocol with Universal MIDI Packets (UMP).
|
||||
* UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec.
|
||||
* All UMP data should be a multiple of 4 bytes.
|
||||
* Use MIDI 1.0 through UMP with packet sizes up to 64 bits.
|
||||
*/
|
||||
AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS = 1,
|
||||
|
||||
/**
|
||||
* Constant representing a default protocol with Universal MIDI Packets (UMP).
|
||||
* UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec.
|
||||
* All UMP data should be a multiple of 4 bytes.
|
||||
* Use MIDI 1.0 through UMP with packet sizes up to 64 bits and jitter reduction timestamps.
|
||||
*/
|
||||
AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS = 2,
|
||||
|
||||
/**
|
||||
* Constant representing a default protocol with Universal MIDI Packets (UMP).
|
||||
* UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec.
|
||||
* All UMP data should be a multiple of 4 bytes.
|
||||
* Use MIDI 1.0 through UMP with packet sizes up to 128 bits.
|
||||
*/
|
||||
AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS = 3,
|
||||
|
||||
/**
|
||||
* Constant representing a default protocol with Universal MIDI Packets (UMP).
|
||||
* UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec.
|
||||
* All UMP data should be a multiple of 4 bytes.
|
||||
* Use MIDI 1.0 through UMP with packet sizes up to 128 bits and jitter reduction timestamps.
|
||||
*/
|
||||
AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS = 4,
|
||||
|
||||
/**
|
||||
* Constant representing a default protocol with Universal MIDI Packets (UMP).
|
||||
* UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec.
|
||||
* All UMP data should be a multiple of 4 bytes.
|
||||
* Use MIDI 2.0 through UMP.
|
||||
*/
|
||||
AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0 = 17,
|
||||
|
||||
/**
|
||||
* Constant representing a default protocol with Universal MIDI Packets (UMP).
|
||||
* UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec.
|
||||
* All UMP data should be a multiple of 4 bytes.
|
||||
* Use MIDI 2.0 through UMP and jitter reduction timestamps.
|
||||
*/
|
||||
AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0_AND_JRTS = 18,
|
||||
|
||||
/**
|
||||
* Constant representing a device with an unknown default protocol.
|
||||
* If Universal MIDI Packets (UMP) are needed, use MIDI-CI through MIDI 1.0.
|
||||
* UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec.
|
||||
* MIDI-CI is defined in "MIDI Capability Inquiry (MIDI-CI)" spec.
|
||||
*/
|
||||
AMIDI_DEVICE_PROTOCOL_UNKNOWN = -1
|
||||
} AMidiDevice_Protocol;
|
||||
|
||||
/*
|
||||
* Device API
|
||||
*/
|
||||
/**
|
||||
* Connects a native Midi Device object to the associated Java MidiDevice object. Use this
|
||||
* AMidiDevice to access the rest of the native MIDI API. Use AMidiDevice_release() to
|
||||
* disconnect from the Java object when not being used any more.
|
||||
*
|
||||
* @param env Points to the Java Environment.
|
||||
* @param midiDeviceObj The Java MidiDevice Object.
|
||||
* @param outDevicePtrPtr Points to the pointer to receive the AMidiDevice
|
||||
*
|
||||
* @return AMEDIA_OK on success, or a negative error value:
|
||||
* @see AMEDIA_ERROR_INVALID_OBJECT - the midiDeviceObj
|
||||
* is null or already connected to a native AMidiDevice
|
||||
* @see AMEDIA_ERROR_UNKNOWN - an unknown error occurred.
|
||||
*/
|
||||
media_status_t AMIDI_API AMidiDevice_fromJava(
|
||||
JNIEnv *env, jobject midiDeviceObj, AMidiDevice **outDevicePtrPtr) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Disconnects the native Midi Device Object from the associated Java MidiDevice object.
|
||||
*
|
||||
* @param midiDevice Points to the native AMIDI_MidiDevice.
|
||||
*
|
||||
* @return AMEDIA_OK on success,
|
||||
* or a negative error value:
|
||||
* @see AMEDIA_ERROR_INVALID_PARAMETER - the device parameter is NULL.
|
||||
* @see AMEDIA_ERROR_INVALID_OBJECT - the device is not consistent with the associated Java MidiDevice.
|
||||
* @see AMEDIA_ERROR_INVALID_OBJECT - the JNI interface initialization to the associated java MidiDevice failed.
|
||||
* @see AMEDIA_ERROR_UNKNOWN - couldn't retrieve the device info.
|
||||
*/
|
||||
media_status_t AMIDI_API AMidiDevice_release(const AMidiDevice *midiDevice) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Gets the MIDI device type.
|
||||
*
|
||||
* @param device Specifies the MIDI device.
|
||||
*
|
||||
* @return The identifier of the MIDI device type:
|
||||
* AMIDI_DEVICE_TYPE_USB
|
||||
* AMIDI_DEVICE_TYPE_VIRTUAL
|
||||
* AMIDI_DEVICE_TYPE_BLUETOOTH
|
||||
* or a negative error value:
|
||||
* @see AMEDIA_ERROR_INVALID_PARAMETER - the device parameter is NULL.
|
||||
* @see AMEDIA_ERROR_UNKNOWN - Unknown error.
|
||||
*/
|
||||
int32_t AMIDI_API AMidiDevice_getType(const AMidiDevice *device) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Gets the number of input (sending) ports available on the specified MIDI device.
|
||||
*
|
||||
* @param device Specifies the MIDI device.
|
||||
*
|
||||
* @return If successful, returns the number of MIDI input (sending) ports available on the
|
||||
* device. If an error occurs, returns a negative value indicating the error:
|
||||
* @see AMEDIA_ERROR_INVALID_PARAMETER - the device parameter is NULL.
|
||||
* @see AMEDIA_ERROR_UNKNOWN - couldn't retrieve the device info.
|
||||
*/
|
||||
ssize_t AMIDI_API AMidiDevice_getNumInputPorts(const AMidiDevice *device) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Gets the number of output (receiving) ports available on the specified MIDI device.
|
||||
*
|
||||
* @param device Specifies the MIDI device.
|
||||
*
|
||||
* @return If successful, returns the number of MIDI output (receiving) ports available on the
|
||||
* device. If an error occurs, returns a negative value indicating the error:
|
||||
* @see AMEDIA_ERROR_INVALID_PARAMETER - the device parameter is NULL.
|
||||
* @see AMEDIA_ERROR_UNKNOWN - couldn't retrieve the device info.
|
||||
*/
|
||||
ssize_t AMIDI_API AMidiDevice_getNumOutputPorts(const AMidiDevice *device) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Gets the MIDI device default protocol.
|
||||
*
|
||||
* @param device Specifies the MIDI device.
|
||||
*
|
||||
* @return The identifier of the MIDI device default protocol:
|
||||
* AMIDI_DEVICE_PROTOCOL_UMP_USE_MIDI_CI
|
||||
* AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS
|
||||
* AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS
|
||||
* AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS
|
||||
* AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS
|
||||
* AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0
|
||||
* AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0_AND_JRTS
|
||||
* AMIDI_DEVICE_PROTOCOL_UNKNOWN
|
||||
*
|
||||
* Most devices should return PROTOCOL_UNKNOWN (-1). This is intentional as devices
|
||||
* with default UMP support are not backwards compatible. When the device is null,
|
||||
* return AMIDI_DEVICE_PROTOCOL_UNKNOWN.
|
||||
*
|
||||
* Available since API 33.
|
||||
*/
|
||||
AMidiDevice_Protocol AMIDI_API AMidiDevice_getDefaultProtocol(const AMidiDevice *device)
|
||||
__INTRODUCED_IN(33);
|
||||
|
||||
/*
|
||||
* API for receiving data from the Output port of a device.
|
||||
*/
|
||||
/**
|
||||
* Opens the output port so that the client can receive data from it. The port remains open and
|
||||
* valid until AMidiOutputPort_close() is called for the returned AMidiOutputPort.
|
||||
*
|
||||
* @param device Specifies the MIDI device.
|
||||
* @param portNumber Specifies the zero-based port index on the device to open. This value ranges
|
||||
* between 0 and one less than the number of output ports reported by the
|
||||
* AMidiDevice_getNumOutputPorts function.
|
||||
* @param outOutputPortPtr Receives the native API port identifier of the opened port.
|
||||
*
|
||||
* @return AMEDIA_OK, or a negative error code:
|
||||
* @see AMEDIA_ERROR_UNKNOWN - Unknown Error.
|
||||
*/
|
||||
media_status_t AMIDI_API AMidiOutputPort_open(const AMidiDevice *device, int32_t portNumber,
|
||||
AMidiOutputPort **outOutputPortPtr) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Closes the output port.
|
||||
*
|
||||
* @param outputPort The native API port identifier of the port.
|
||||
*/
|
||||
void AMIDI_API AMidiOutputPort_close(const AMidiOutputPort *outputPort) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Receives the next pending MIDI message. To retrieve all pending messages, the client should
|
||||
* repeatedly call this method until it returns 0.
|
||||
*
|
||||
* Note that this is a non-blocking call. If there are no Midi messages are available, the function
|
||||
* returns 0 immediately (for 0 messages received).
|
||||
*
|
||||
* @param outputPort Identifies the port to receive messages from.
|
||||
* @param opcodePtr Receives the message Op Code.
|
||||
* @param buffer Points to the buffer to receive the message data bytes.
|
||||
* @param maxBytes Specifies the size of the buffer pointed to by the buffer parameter.
|
||||
* @param numBytesReceivedPtr On exit, receives the actual number of bytes stored in buffer.
|
||||
* @param outTimestampPtr If non-NULL, receives the timestamp associated with the message.
|
||||
* (the current value of the running Java Virtual Machine's high-resolution time source,
|
||||
* in nanoseconds)
|
||||
* @return the number of messages received (either 0 or 1), or a negative error code:
|
||||
* @see AMEDIA_ERROR_UNKNOWN - Unknown Error.
|
||||
*/
|
||||
ssize_t AMIDI_API AMidiOutputPort_receive(const AMidiOutputPort *outputPort, int32_t *opcodePtr,
|
||||
uint8_t *buffer, size_t maxBytes, size_t* numBytesReceivedPtr, int64_t *outTimestampPtr) __INTRODUCED_IN(29);
|
||||
|
||||
/*
|
||||
* API for sending data to the Input port of a device.
|
||||
*/
|
||||
/**
|
||||
* Opens the input port so that the client can send data to it. The port remains open and
|
||||
* valid until AMidiInputPort_close() is called for the returned AMidiInputPort.
|
||||
*
|
||||
* @param device Specifies the MIDI device.
|
||||
* @param portNumber Specifies the zero-based port index on the device to open. This value ranges
|
||||
* between 0 and one less than the number of input ports reported by the
|
||||
* AMidiDevice_getNumInputPorts() function..
|
||||
* @param outInputPortPtr Receives the native API port identifier of the opened port.
|
||||
*
|
||||
* @return AMEDIA_OK, or a negative error code:
|
||||
* @see AMEDIA_ERROR_UNKNOWN - Unknown Error.
|
||||
*/
|
||||
media_status_t AMIDI_API AMidiInputPort_open(const AMidiDevice *device, int32_t portNumber,
|
||||
AMidiInputPort **outInputPortPtr) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Sends data to the specified input port.
|
||||
*
|
||||
* @param inputPort The identifier of the port to send data to.
|
||||
* @param buffer Points to the array of bytes containing the data to send.
|
||||
* @param numBytes Specifies the number of bytes to write.
|
||||
*
|
||||
* @return The number of bytes sent, which could be less than specified or a negative error code:
|
||||
* @see AMEDIA_ERROR_INVALID_PARAMETER - The specified port was NULL, the specified buffer was NULL.
|
||||
*/
|
||||
ssize_t AMIDI_API AMidiInputPort_send(const AMidiInputPort *inputPort, const uint8_t *buffer,
|
||||
size_t numBytes) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Sends data to the specified input port with a timestamp.
|
||||
*
|
||||
* @param inputPort The identifier of the port to send data to.
|
||||
* @param buffer Points to the array of bytes containing the data to send.
|
||||
* @param numBytes Specifies the number of bytes to write.
|
||||
* @param timestamp The CLOCK_MONOTONIC time in nanoseconds to associate with the sent data.
|
||||
*
|
||||
* @return The number of bytes sent, which could be less than specified or a negative error code:
|
||||
* @see AMEDIA_ERROR_INVALID_PARAMETER - The specified port was NULL, the specified buffer was NULL.
|
||||
*/
|
||||
ssize_t AMIDI_API AMidiInputPort_sendWithTimestamp(const AMidiInputPort *inputPort,
|
||||
const uint8_t *buffer, size_t numBytes, int64_t timestamp) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Sends a message with a 'MIDI flush command code' to the specified port. This should cause
|
||||
* a receiver to discard any pending MIDI data it may have accumulated and not processed.
|
||||
*
|
||||
* @param inputPort The identifier of the port to send the flush command to.
|
||||
*
|
||||
* @returns @see AMEDIA_OK if successful, otherwise a negative error code:
|
||||
* @see AMEDIA_ERROR_INVALID_PARAMETER - The specified port was NULL
|
||||
* @see AMEDIA_ERROR_UNSUPPORTED - The FLUSH command couldn't
|
||||
* be sent.
|
||||
*/
|
||||
media_status_t AMIDI_API AMidiInputPort_sendFlush(const AMidiInputPort *inputPort) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Closes the input port.
|
||||
*
|
||||
* @param inputPort Identifies the input (sending) port to close.
|
||||
*/
|
||||
void AMIDI_API AMidiInputPort_close(const AMidiInputPort *inputPort) __INTRODUCED_IN(29);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ANDROID_MEDIA_AMIDI_H_ */
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,222 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @defgroup apilevels API Levels
|
||||
*
|
||||
* Defines functions and constants for working with Android API levels.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file android/api-level.h
|
||||
* @brief Functions and constants for dealing with multiple API levels.
|
||||
*
|
||||
* See
|
||||
* https://android.googlesource.com/platform/bionic/+/main/docs/defines.md.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Magic version number for an Android OS build which has not yet turned
|
||||
* into an official release, for comparison against `__ANDROID_API__`. See
|
||||
* https://android.googlesource.com/platform/bionic/+/main/docs/defines.md.
|
||||
*/
|
||||
#define __ANDROID_API_FUTURE__ 10000
|
||||
|
||||
/* This #ifndef should never be true except when doxygen is generating docs. */
|
||||
#ifndef __ANDROID_API__
|
||||
/**
|
||||
* `__ANDROID_API__` is the [API
|
||||
* level](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)
|
||||
* this code is being built for. The resulting binaries are only guaranteed to
|
||||
* be compatible with devices which have an API level greater than or equal to
|
||||
* `__ANDROID_API__`.
|
||||
*
|
||||
* For NDK and APEX builds, this macro will always be defined. It is set
|
||||
* automatically by Clang using the version suffix that is a part of the target
|
||||
* name. For example, `__ANDROID_API__` will be 24 when Clang is given the
|
||||
* argument `-target aarch64-linux-android24`.
|
||||
*
|
||||
* For non-APEX OS code, this defaults to __ANDROID_API_FUTURE__.
|
||||
*
|
||||
* The value of `__ANDROID_API__` can be compared to the named constants in
|
||||
* `<android/api-level.h>`.
|
||||
*
|
||||
* The interpretation of `__ANDROID_API__` is similar to the AndroidManifest.xml
|
||||
* `minSdkVersion`. In most cases `__ANDROID_API__` will be identical to
|
||||
* `minSdkVersion`, but as it is a build time constant it is possible for
|
||||
* library code to use a different value than the app it will be included in.
|
||||
* When libraries and applications build for different API levels, the
|
||||
* `minSdkVersion` of the application must be at least as high as the highest
|
||||
* API level used by any of its libraries which are loaded unconditionally.
|
||||
*
|
||||
* Note that in some cases the resulting binaries may load successfully on
|
||||
* devices with an older API level. That behavior should not be relied upon,
|
||||
* even if you are careful to avoid using new APIs, as the toolchain may make
|
||||
* use of new features by default. For example, additional FORTIFY features may
|
||||
* implicitly make use of new APIs, SysV hashes may be omitted in favor of GNU
|
||||
* hashes to improve library load times, or relocation packing may be enabled to
|
||||
* reduce binary size.
|
||||
*
|
||||
* See android_get_device_api_level(),
|
||||
* android_get_application_target_sdk_version() and
|
||||
* https://android.googlesource.com/platform/bionic/+/main/docs/defines.md.
|
||||
*/
|
||||
#define __ANDROID_API__ __ANDROID_API_FUTURE__
|
||||
#endif
|
||||
|
||||
/** Names the Gingerbread API level (9), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_G__ 9
|
||||
|
||||
/** Names the Ice-Cream Sandwich API level (14), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_I__ 14
|
||||
|
||||
/** Names the Jellybean API level (16), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_J__ 16
|
||||
|
||||
/** Names the Jellybean MR1 API level (17), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_J_MR1__ 17
|
||||
|
||||
/** Names the Jellybean MR2 API level (18), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_J_MR2__ 18
|
||||
|
||||
/** Names the KitKat API level (19), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_K__ 19
|
||||
|
||||
/** Names the Lollipop API level (21), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_L__ 21
|
||||
|
||||
/** Names the Lollipop MR1 API level (22), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_L_MR1__ 22
|
||||
|
||||
/** Names the Marshmallow API level (23), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_M__ 23
|
||||
|
||||
/** Names the Nougat API level (24), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_N__ 24
|
||||
|
||||
/** Names the Nougat MR1 API level (25), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_N_MR1__ 25
|
||||
|
||||
/** Names the Oreo API level (26), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_O__ 26
|
||||
|
||||
/** Names the Oreo MR1 API level (27), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_O_MR1__ 27
|
||||
|
||||
/** Names the Pie API level (28), for comparison against `__ANDROID_API__`. */
|
||||
#define __ANDROID_API_P__ 28
|
||||
|
||||
/**
|
||||
* Names the Android 10 (aka "Q" or "Quince Tart") API level (29), for
|
||||
* comparison against `__ANDROID_API__`.
|
||||
*/
|
||||
#define __ANDROID_API_Q__ 29
|
||||
|
||||
/**
|
||||
* Names the Android 11 (aka "R" or "Red Velvet Cake") API level (30), for
|
||||
* comparison against `__ANDROID_API__`.
|
||||
*/
|
||||
#define __ANDROID_API_R__ 30
|
||||
|
||||
/**
|
||||
* Names the Android 12 (aka "S" or "Snowcone") API level (31), for
|
||||
* comparison against `__ANDROID_API__`.
|
||||
*/
|
||||
#define __ANDROID_API_S__ 31
|
||||
|
||||
/**
|
||||
* Names the Android 13 (aka "T" or "Tiramisu") API level (33), for
|
||||
* comparison against `__ANDROID_API__`.
|
||||
*/
|
||||
#define __ANDROID_API_T__ 33
|
||||
|
||||
/**
|
||||
* Names the Android 14 (aka "U" or "UpsideDownCake") API level (34),
|
||||
* for comparison against `__ANDROID_API__`.
|
||||
*/
|
||||
#define __ANDROID_API_U__ 34
|
||||
|
||||
/**
|
||||
* Names the Android 15 (aka "V" or "VanillaIceCream") API level (35),
|
||||
* for comparison against `__ANDROID_API__`.
|
||||
*/
|
||||
#define __ANDROID_API_V__ 35
|
||||
|
||||
/* This file is included in <features.h>, and might be used from .S files. */
|
||||
#if !defined(__ASSEMBLY__)
|
||||
|
||||
/**
|
||||
* Returns the `targetSdkVersion` of the caller, or `__ANDROID_API_FUTURE__` if
|
||||
* there is no known target SDK version (for code not running in the context of
|
||||
* an app).
|
||||
*
|
||||
* The returned values correspond to the named constants in `<android/api-level.h>`,
|
||||
* and is equivalent to the AndroidManifest.xml `targetSdkVersion`.
|
||||
*
|
||||
* See also android_get_device_api_level().
|
||||
*
|
||||
* Available since API level 24.
|
||||
*/
|
||||
|
||||
#if __ANDROID_API__ >= 24
|
||||
int android_get_application_target_sdk_version() __INTRODUCED_IN(24);
|
||||
#endif /* __ANDROID_API__ >= 24 */
|
||||
|
||||
|
||||
#if __ANDROID_API__ < 29
|
||||
|
||||
/* android_get_device_api_level is a static inline before API level 29. */
|
||||
#define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static __inline
|
||||
#include <bits/get_device_api_level_inlines.h>
|
||||
#undef __BIONIC_GET_DEVICE_API_LEVEL_INLINE
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
* Returns the API level of the device we're actually running on, or -1 on failure.
|
||||
* The returned values correspond to the named constants in `<android/api-level.h>`,
|
||||
* and is equivalent to the Java `Build.VERSION.SDK_INT` API.
|
||||
*
|
||||
* See also android_get_application_target_sdk_version().
|
||||
*/
|
||||
int android_get_device_api_level() __INTRODUCED_IN(29);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* defined(__ASSEMBLY__) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Asset
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file asset_manager.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_ASSET_MANAGER_H
|
||||
#define ANDROID_ASSET_MANAGER_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(__ANDROID__) && !defined(__RENAME_IF_FILE_OFFSET64)
|
||||
#define __RENAME_IF_FILE_OFFSET64(x)
|
||||
#endif
|
||||
|
||||
struct AAssetManager;
|
||||
/**
|
||||
* {@link AAssetManager} provides access to an application's raw assets by
|
||||
* creating {@link AAsset} objects.
|
||||
*
|
||||
* AAssetManager is a wrapper to the low-level native implementation
|
||||
* of the java {@link AAssetManager}, a pointer can be obtained using
|
||||
* AAssetManager_fromJava().
|
||||
*
|
||||
* The asset hierarchy may be examined like a filesystem, using
|
||||
* {@link AAssetDir} objects to peruse a single directory.
|
||||
*
|
||||
* A native {@link AAssetManager} pointer may be shared across multiple threads.
|
||||
*/
|
||||
typedef struct AAssetManager AAssetManager;
|
||||
|
||||
struct AAssetDir;
|
||||
/**
|
||||
* {@link AAssetDir} provides access to a chunk of the asset hierarchy as if
|
||||
* it were a single directory. The contents are populated by the
|
||||
* {@link AAssetManager}.
|
||||
*
|
||||
* The list of files will be sorted in ascending order by ASCII value.
|
||||
*/
|
||||
typedef struct AAssetDir AAssetDir;
|
||||
|
||||
struct AAsset;
|
||||
/**
|
||||
* {@link AAsset} provides access to a read-only asset.
|
||||
*
|
||||
* {@link AAsset} objects are NOT thread-safe, and should not be shared across
|
||||
* threads.
|
||||
*/
|
||||
typedef struct AAsset AAsset;
|
||||
|
||||
/** Available access modes for opening assets with {@link AAssetManager_open} */
|
||||
enum {
|
||||
/** No specific information about how data will be accessed. **/
|
||||
AASSET_MODE_UNKNOWN = 0,
|
||||
/** Read chunks, and seek forward and backward. */
|
||||
AASSET_MODE_RANDOM = 1,
|
||||
/** Read sequentially, with an occasional forward seek. */
|
||||
AASSET_MODE_STREAMING = 2,
|
||||
/** Caller plans to ask for a read-only buffer with all data. */
|
||||
AASSET_MODE_BUFFER = 3
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Open the named directory within the asset hierarchy. The directory can then
|
||||
* be inspected with the AAssetDir functions. To open the top-level directory,
|
||||
* pass in "" as the dirName.
|
||||
*
|
||||
* The object returned here should be freed by calling AAssetDir_close().
|
||||
*/
|
||||
AAssetDir* AAssetManager_openDir(AAssetManager* mgr, const char* dirName);
|
||||
|
||||
/**
|
||||
* Open an asset.
|
||||
*
|
||||
* The object returned here should be freed by calling AAsset_close().
|
||||
*/
|
||||
AAsset* AAssetManager_open(AAssetManager* mgr, const char* filename, int mode);
|
||||
|
||||
/**
|
||||
* Iterate over the files in an asset directory. A NULL string is returned
|
||||
* when all the file names have been returned.
|
||||
*
|
||||
* The returned file name is suitable for passing to AAssetManager_open().
|
||||
*
|
||||
* The string returned here is owned by the AssetDir implementation and is not
|
||||
* guaranteed to remain valid if any other calls are made on this AAssetDir
|
||||
* instance.
|
||||
*/
|
||||
const char* AAssetDir_getNextFileName(AAssetDir* assetDir);
|
||||
|
||||
/**
|
||||
* Reset the iteration state of AAssetDir_getNextFileName() to the beginning.
|
||||
*/
|
||||
void AAssetDir_rewind(AAssetDir* assetDir);
|
||||
|
||||
/**
|
||||
* Close an opened AAssetDir, freeing any related resources.
|
||||
*/
|
||||
void AAssetDir_close(AAssetDir* assetDir);
|
||||
|
||||
/**
|
||||
* Attempt to read 'count' bytes of data from the current offset.
|
||||
*
|
||||
* Returns the number of bytes read, zero on EOF, or < 0 on error.
|
||||
*/
|
||||
int AAsset_read(AAsset* asset, void* buf, size_t count);
|
||||
|
||||
/**
|
||||
* Seek to the specified offset within the asset data. 'whence' uses the
|
||||
* same constants as lseek()/fseek().
|
||||
*
|
||||
* Returns the new position on success, or (off_t) -1 on error.
|
||||
*/
|
||||
off_t AAsset_seek(AAsset* asset, off_t offset, int whence)
|
||||
__RENAME_IF_FILE_OFFSET64(AAsset_seek64);
|
||||
|
||||
/**
|
||||
* Seek to the specified offset within the asset data. 'whence' uses the
|
||||
* same constants as lseek()/fseek().
|
||||
*
|
||||
* Uses 64-bit data type for large files as opposed to the 32-bit type used
|
||||
* by AAsset_seek.
|
||||
*
|
||||
* Returns the new position on success, or (off64_t) -1 on error.
|
||||
*/
|
||||
off64_t AAsset_seek64(AAsset* asset, off64_t offset, int whence);
|
||||
|
||||
/**
|
||||
* Close the asset, freeing all associated resources.
|
||||
*/
|
||||
void AAsset_close(AAsset* asset);
|
||||
|
||||
/**
|
||||
* Get a pointer to a buffer holding the entire contents of the assset.
|
||||
*
|
||||
* Returns NULL on failure.
|
||||
*/
|
||||
const void* AAsset_getBuffer(AAsset* asset);
|
||||
|
||||
/**
|
||||
* Report the total size of the asset data.
|
||||
*/
|
||||
off_t AAsset_getLength(AAsset* asset)
|
||||
__RENAME_IF_FILE_OFFSET64(AAsset_getLength64);
|
||||
|
||||
/**
|
||||
* Report the total size of the asset data. Reports the size using a 64-bit
|
||||
* number insted of 32-bit as AAsset_getLength.
|
||||
*/
|
||||
off64_t AAsset_getLength64(AAsset* asset);
|
||||
|
||||
/**
|
||||
* Report the total amount of asset data that can be read from the current position.
|
||||
*/
|
||||
off_t AAsset_getRemainingLength(AAsset* asset)
|
||||
__RENAME_IF_FILE_OFFSET64(AAsset_getRemainingLength64);
|
||||
|
||||
/**
|
||||
* Report the total amount of asset data that can be read from the current position.
|
||||
*
|
||||
* Uses a 64-bit number instead of a 32-bit number as AAsset_getRemainingLength does.
|
||||
*/
|
||||
off64_t AAsset_getRemainingLength64(AAsset* asset);
|
||||
|
||||
/**
|
||||
* Open a new file descriptor that can be used to read the asset data. If the
|
||||
* start or length cannot be represented by a 32-bit number, it will be
|
||||
* truncated. If the file is large, use AAsset_openFileDescriptor64 instead.
|
||||
*
|
||||
* Returns < 0 if direct fd access is not possible (for example, if the asset is
|
||||
* compressed).
|
||||
*/
|
||||
int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength)
|
||||
__RENAME_IF_FILE_OFFSET64(AAsset_openFileDescriptor64);
|
||||
|
||||
/**
|
||||
* Open a new file descriptor that can be used to read the asset data.
|
||||
*
|
||||
* Uses a 64-bit number for the offset and length instead of 32-bit instead of
|
||||
* as AAsset_openFileDescriptor does.
|
||||
*
|
||||
* Returns < 0 if direct fd access is not possible (for example, if the asset is
|
||||
* compressed).
|
||||
*/
|
||||
int AAsset_openFileDescriptor64(AAsset* asset, off64_t* outStart, off64_t* outLength);
|
||||
|
||||
/**
|
||||
* Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not
|
||||
* mmapped).
|
||||
*/
|
||||
int AAsset_isAllocated(AAsset* asset);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // ANDROID_ASSET_MANAGER_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Asset
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file asset_manager_jni.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_ASSET_MANAGER_JNI_H
|
||||
#define ANDROID_ASSET_MANAGER_JNI_H
|
||||
|
||||
#include <android/asset_manager.h>
|
||||
#include <jni.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Given a Dalvik AssetManager object, obtain the corresponding native AAssetManager
|
||||
* object. Note that the caller is responsible for obtaining and holding a VM reference
|
||||
* to the jobject to prevent its being garbage collected while the native object is
|
||||
* in use.
|
||||
*/
|
||||
AAssetManager* AAssetManager_fromJava(JNIEnv* env, jobject assetManager);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // ANDROID_ASSET_MANAGER_JNI_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,416 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_auto_utils.h
|
||||
* @brief These objects provide a more C++-like thin interface to the binder.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/binder_ibinder.h>
|
||||
#include <android/binder_internal_logging.h>
|
||||
#include <android/binder_parcel.h>
|
||||
#include <android/binder_status.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace ndk {
|
||||
|
||||
/**
|
||||
* Represents one strong pointer to an AIBinder object.
|
||||
*/
|
||||
class SpAIBinder {
|
||||
public:
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
SpAIBinder() : mBinder(nullptr) {}
|
||||
|
||||
/**
|
||||
* Takes ownership of one strong refcount of binder.
|
||||
*/
|
||||
explicit SpAIBinder(AIBinder* binder) : mBinder(binder) {}
|
||||
|
||||
/**
|
||||
* Convenience operator for implicitly constructing an SpAIBinder from nullptr. This is not
|
||||
* explicit because it is not taking ownership of anything.
|
||||
*/
|
||||
SpAIBinder(std::nullptr_t) : SpAIBinder() {} // NOLINT(google-explicit-constructor)
|
||||
|
||||
/**
|
||||
* This will delete the underlying object if it exists. See operator=.
|
||||
*/
|
||||
SpAIBinder(const SpAIBinder& other) { *this = other; }
|
||||
|
||||
/**
|
||||
* This deletes the underlying object if it exists. See set.
|
||||
*/
|
||||
~SpAIBinder() { set(nullptr); }
|
||||
|
||||
/**
|
||||
* This takes ownership of a binder from another AIBinder object but it does not affect the
|
||||
* ownership of that other object.
|
||||
*/
|
||||
SpAIBinder& operator=(const SpAIBinder& other) {
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
AIBinder_incStrong(other.mBinder);
|
||||
set(other.mBinder);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes ownership of one strong refcount of binder
|
||||
*/
|
||||
void set(AIBinder* binder) {
|
||||
AIBinder* old = *const_cast<AIBinder* volatile*>(&mBinder);
|
||||
if (old != nullptr) AIBinder_decStrong(old);
|
||||
if (old != *const_cast<AIBinder* volatile*>(&mBinder)) {
|
||||
__assert(__FILE__, __LINE__, "Race detected.");
|
||||
}
|
||||
mBinder = binder;
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the underlying binder object for transactions. If it is used to create another
|
||||
* SpAIBinder object, it should first be incremented.
|
||||
*/
|
||||
AIBinder* get() const { return mBinder; }
|
||||
|
||||
/**
|
||||
* This allows the value in this class to be set from beneath it. If you call this method and
|
||||
* then change the value of T*, you must take ownership of the value you are replacing and add
|
||||
* ownership to the object that is put in here.
|
||||
*
|
||||
* Recommended use is like this:
|
||||
* SpAIBinder a; // will be nullptr
|
||||
* SomeInitFunction(a.getR()); // value is initialized with refcount
|
||||
*
|
||||
* Other usecases are discouraged.
|
||||
*
|
||||
*/
|
||||
AIBinder** getR() { return &mBinder; }
|
||||
|
||||
private:
|
||||
AIBinder* mBinder = nullptr;
|
||||
};
|
||||
|
||||
#define SP_AIBINDER_COMPARE(_op_) \
|
||||
static inline bool operator _op_(const SpAIBinder& lhs, const SpAIBinder& rhs) { \
|
||||
return lhs.get() _op_ rhs.get(); \
|
||||
} \
|
||||
static inline bool operator _op_(const SpAIBinder& lhs, const AIBinder* rhs) { \
|
||||
return lhs.get() _op_ rhs; \
|
||||
} \
|
||||
static inline bool operator _op_(const AIBinder* lhs, const SpAIBinder& rhs) { \
|
||||
return lhs _op_ rhs.get(); \
|
||||
}
|
||||
|
||||
SP_AIBINDER_COMPARE(!=)
|
||||
SP_AIBINDER_COMPARE(<)
|
||||
SP_AIBINDER_COMPARE(<=)
|
||||
SP_AIBINDER_COMPARE(==)
|
||||
SP_AIBINDER_COMPARE(>)
|
||||
SP_AIBINDER_COMPARE(>=)
|
||||
#undef SP_AIBINDER_COMPARE
|
||||
|
||||
namespace impl {
|
||||
|
||||
/**
|
||||
* This baseclass owns a single object, used to make various classes RAII.
|
||||
*/
|
||||
template <typename T, void (*Destroy)(T), T DEFAULT>
|
||||
class ScopedAResource {
|
||||
public:
|
||||
/**
|
||||
* Takes ownership of t.
|
||||
*/
|
||||
explicit ScopedAResource(T t = DEFAULT) : mT(t) {}
|
||||
|
||||
/**
|
||||
* This deletes the underlying object if it exists. See set.
|
||||
*/
|
||||
~ScopedAResource() { set(DEFAULT); }
|
||||
|
||||
/**
|
||||
* Takes ownership of t.
|
||||
*/
|
||||
void set(T t) {
|
||||
Destroy(mT);
|
||||
mT = t;
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the underlying object to be modified but does not affect ownership.
|
||||
*/
|
||||
T get() { return mT; }
|
||||
|
||||
/**
|
||||
* This returns the const underlying object but does not affect ownership.
|
||||
*/
|
||||
const T get() const { return mT; }
|
||||
|
||||
/**
|
||||
* Release the underlying resource.
|
||||
*/
|
||||
[[nodiscard]] T release() {
|
||||
T a = mT;
|
||||
mT = DEFAULT;
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* This allows the value in this class to be set from beneath it. If you call this method and
|
||||
* then change the value of T*, you must take ownership of the value you are replacing and add
|
||||
* ownership to the object that is put in here.
|
||||
*
|
||||
* Recommended use is like this:
|
||||
* ScopedAResource<T> a; // will be nullptr
|
||||
* SomeInitFunction(a.getR()); // value is initialized with refcount
|
||||
*
|
||||
* Other usecases are discouraged.
|
||||
*
|
||||
*/
|
||||
T* getR() { return &mT; }
|
||||
|
||||
// copy-constructing/assignment is disallowed
|
||||
ScopedAResource(const ScopedAResource&) = delete;
|
||||
ScopedAResource& operator=(const ScopedAResource&) = delete;
|
||||
|
||||
// move-constructing/assignment is okay
|
||||
ScopedAResource(ScopedAResource&& other) noexcept : mT(std::move(other.mT)) {
|
||||
other.mT = DEFAULT;
|
||||
}
|
||||
ScopedAResource& operator=(ScopedAResource&& other) noexcept {
|
||||
set(other.mT);
|
||||
other.mT = DEFAULT;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
T mT;
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
/**
|
||||
* Convenience wrapper. See AParcel.
|
||||
*/
|
||||
class ScopedAParcel : public impl::ScopedAResource<AParcel*, AParcel_delete, nullptr> {
|
||||
public:
|
||||
/**
|
||||
* Takes ownership of a.
|
||||
*/
|
||||
explicit ScopedAParcel(AParcel* a = nullptr) : ScopedAResource(a) {}
|
||||
~ScopedAParcel() {}
|
||||
ScopedAParcel(ScopedAParcel&&) = default;
|
||||
ScopedAParcel& operator=(ScopedAParcel&&) = default;
|
||||
|
||||
bool operator!=(const ScopedAParcel& rhs) const { return get() != rhs.get(); }
|
||||
bool operator<(const ScopedAParcel& rhs) const { return get() < rhs.get(); }
|
||||
bool operator<=(const ScopedAParcel& rhs) const { return get() <= rhs.get(); }
|
||||
bool operator==(const ScopedAParcel& rhs) const { return get() == rhs.get(); }
|
||||
bool operator>(const ScopedAParcel& rhs) const { return get() > rhs.get(); }
|
||||
bool operator>=(const ScopedAParcel& rhs) const { return get() >= rhs.get(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience wrapper. See AStatus.
|
||||
*/
|
||||
class ScopedAStatus : public impl::ScopedAResource<AStatus*, AStatus_delete, nullptr> {
|
||||
public:
|
||||
/**
|
||||
* Takes ownership of a.
|
||||
*
|
||||
* WARNING: this constructor is only expected to be used when reading a
|
||||
* status value. Use `ScopedAStatus::ok()` instead.
|
||||
*/
|
||||
explicit ScopedAStatus(AStatus* a = nullptr) : ScopedAResource(a) {}
|
||||
~ScopedAStatus() {}
|
||||
ScopedAStatus(ScopedAStatus&&) = default;
|
||||
ScopedAStatus& operator=(ScopedAStatus&&) = default;
|
||||
|
||||
/**
|
||||
* See AStatus_isOk.
|
||||
*/
|
||||
bool isOk() const { return get() != nullptr && AStatus_isOk(get()); }
|
||||
|
||||
/**
|
||||
* See AStatus_getExceptionCode
|
||||
*/
|
||||
binder_exception_t getExceptionCode() const { return AStatus_getExceptionCode(get()); }
|
||||
|
||||
/**
|
||||
* See AStatus_getServiceSpecificError
|
||||
*/
|
||||
int32_t getServiceSpecificError() const { return AStatus_getServiceSpecificError(get()); }
|
||||
|
||||
/**
|
||||
* See AStatus_getStatus
|
||||
*/
|
||||
binder_status_t getStatus() const { return AStatus_getStatus(get()); }
|
||||
|
||||
/**
|
||||
* See AStatus_getMessage
|
||||
*/
|
||||
const char* getMessage() const { return AStatus_getMessage(get()); }
|
||||
|
||||
std::string getDescription() const {
|
||||
#ifdef __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__
|
||||
if (__builtin_available(android 30, *)) {
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__) || __ANDROID_API__ >= 30
|
||||
const char* cStr = AStatus_getDescription(get());
|
||||
std::string ret = cStr;
|
||||
AStatus_deleteDescription(cStr);
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__
|
||||
}
|
||||
#endif
|
||||
|
||||
binder_exception_t exception = getExceptionCode();
|
||||
std::string desc = std::to_string(exception);
|
||||
if (exception == EX_SERVICE_SPECIFIC) {
|
||||
desc += " (" + std::to_string(getServiceSpecificError()) + ")";
|
||||
} else if (exception == EX_TRANSACTION_FAILED) {
|
||||
desc += " (" + std::to_string(getStatus()) + ")";
|
||||
}
|
||||
if (const char* msg = getMessage(); msg != nullptr) {
|
||||
desc += ": ";
|
||||
desc += msg;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience methods for creating scoped statuses.
|
||||
*/
|
||||
static ScopedAStatus ok() { return ScopedAStatus(AStatus_newOk()); }
|
||||
static ScopedAStatus fromExceptionCode(binder_exception_t exception) {
|
||||
return ScopedAStatus(AStatus_fromExceptionCode(exception));
|
||||
}
|
||||
static ScopedAStatus fromExceptionCodeWithMessage(binder_exception_t exception,
|
||||
const char* message) {
|
||||
return ScopedAStatus(AStatus_fromExceptionCodeWithMessage(exception, message));
|
||||
}
|
||||
static ScopedAStatus fromServiceSpecificError(int32_t serviceSpecific) {
|
||||
return ScopedAStatus(AStatus_fromServiceSpecificError(serviceSpecific));
|
||||
}
|
||||
static ScopedAStatus fromServiceSpecificErrorWithMessage(int32_t serviceSpecific,
|
||||
const char* message) {
|
||||
return ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(serviceSpecific, message));
|
||||
}
|
||||
static ScopedAStatus fromStatus(binder_status_t status) {
|
||||
return ScopedAStatus(AStatus_fromStatus(status));
|
||||
}
|
||||
};
|
||||
|
||||
static inline std::ostream& operator<<(std::ostream& os, const ScopedAStatus& status) {
|
||||
return os << status.getDescription();
|
||||
return os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience wrapper. See AIBinder_DeathRecipient.
|
||||
*/
|
||||
class ScopedAIBinder_DeathRecipient
|
||||
: public impl::ScopedAResource<AIBinder_DeathRecipient*, AIBinder_DeathRecipient_delete,
|
||||
nullptr> {
|
||||
public:
|
||||
/**
|
||||
* Takes ownership of a.
|
||||
*/
|
||||
explicit ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient* a = nullptr)
|
||||
: ScopedAResource(a) {}
|
||||
~ScopedAIBinder_DeathRecipient() {}
|
||||
ScopedAIBinder_DeathRecipient(ScopedAIBinder_DeathRecipient&&) = default;
|
||||
ScopedAIBinder_DeathRecipient& operator=(ScopedAIBinder_DeathRecipient&&) = default;
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience wrapper. See AIBinder_Weak.
|
||||
*/
|
||||
class ScopedAIBinder_Weak
|
||||
: public impl::ScopedAResource<AIBinder_Weak*, AIBinder_Weak_delete, nullptr> {
|
||||
public:
|
||||
/**
|
||||
* Takes ownership of a.
|
||||
*/
|
||||
explicit ScopedAIBinder_Weak(AIBinder_Weak* a = nullptr) : ScopedAResource(a) {}
|
||||
~ScopedAIBinder_Weak() {}
|
||||
ScopedAIBinder_Weak(ScopedAIBinder_Weak&&) = default;
|
||||
ScopedAIBinder_Weak& operator=(ScopedAIBinder_Weak&&) = default;
|
||||
|
||||
/**
|
||||
* See AIBinder_Weak_promote.
|
||||
*/
|
||||
SpAIBinder promote() const { return SpAIBinder(AIBinder_Weak_promote(get())); }
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
|
||||
inline void closeWithError(int fd) {
|
||||
if (fd == -1) return;
|
||||
int ret = close(fd);
|
||||
if (ret != 0) {
|
||||
syslog(LOG_ERR, "Could not close FD %d: %s", fd, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
/**
|
||||
* Convenience wrapper for a file descriptor.
|
||||
*/
|
||||
class ScopedFileDescriptor : public impl::ScopedAResource<int, internal::closeWithError, -1> {
|
||||
public:
|
||||
/**
|
||||
* Takes ownership of a.
|
||||
*/
|
||||
ScopedFileDescriptor() : ScopedFileDescriptor(-1) {}
|
||||
explicit ScopedFileDescriptor(int a) : ScopedAResource(a) {}
|
||||
~ScopedFileDescriptor() {}
|
||||
ScopedFileDescriptor(ScopedFileDescriptor&&) = default;
|
||||
ScopedFileDescriptor& operator=(ScopedFileDescriptor&&) = default;
|
||||
|
||||
ScopedFileDescriptor dup() const { return ScopedFileDescriptor(::dup(get())); }
|
||||
|
||||
bool operator!=(const ScopedFileDescriptor& rhs) const { return get() != rhs.get(); }
|
||||
bool operator<(const ScopedFileDescriptor& rhs) const { return get() < rhs.get(); }
|
||||
bool operator<=(const ScopedFileDescriptor& rhs) const { return get() <= rhs.get(); }
|
||||
bool operator==(const ScopedFileDescriptor& rhs) const { return get() == rhs.get(); }
|
||||
bool operator>(const ScopedFileDescriptor& rhs) const { return get() > rhs.get(); }
|
||||
bool operator>=(const ScopedFileDescriptor& rhs) const { return get() >= rhs.get(); }
|
||||
};
|
||||
|
||||
} // namespace ndk
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_enums.h
|
||||
* @brief Helpers for AIDL enum types.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace ndk {
|
||||
|
||||
namespace internal {
|
||||
/**
|
||||
* Never instantiated. Used as a placeholder for template variables.
|
||||
*/
|
||||
template <typename T>
|
||||
struct invalid_type;
|
||||
|
||||
/**
|
||||
* AIDL generates specializations of this for enums.
|
||||
*/
|
||||
template <typename EnumType, typename = std::enable_if_t<std::is_enum<EnumType>::value>>
|
||||
constexpr invalid_type<EnumType> enum_values;
|
||||
} // namespace internal
|
||||
|
||||
/**
|
||||
* Iterable interface to enumerate all values of AIDL enum types.
|
||||
*/
|
||||
template <typename EnumType, typename = std::enable_if_t<std::is_enum<EnumType>::value>>
|
||||
struct enum_range {
|
||||
/**
|
||||
* Return an iterator pointing to the first enum value.
|
||||
*/
|
||||
constexpr auto begin() const { return std::begin(internal::enum_values<EnumType>); }
|
||||
/**
|
||||
* Return an iterator pointing to one past the last enum value.
|
||||
*/
|
||||
constexpr auto end() const { return std::end(internal::enum_values<EnumType>); }
|
||||
};
|
||||
|
||||
} // namespace ndk
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,841 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_ibinder.h
|
||||
* @brief Object which can receive transactions and be sent across processes.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <android/binder_parcel.h>
|
||||
#include <android/binder_status.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Flags for AIBinder_transact.
|
||||
*/
|
||||
typedef uint32_t binder_flags_t;
|
||||
enum {
|
||||
/**
|
||||
* The transaction will be dispatched and then returned to the caller. The outgoing process
|
||||
* cannot block a call made by this, and execution of the call will not be waited on. An error
|
||||
* can still be returned if the call is unable to be processed by the binder driver. All oneway
|
||||
* calls are guaranteed to be ordered if they are sent on the same AIBinder object.
|
||||
*/
|
||||
FLAG_ONEWAY = 0x01,
|
||||
};
|
||||
|
||||
/**
|
||||
* Codes for AIBinder_transact. This defines the range of codes available for
|
||||
* usage. Other codes are used or reserved by the Android system.
|
||||
*/
|
||||
typedef uint32_t transaction_code_t;
|
||||
enum {
|
||||
/**
|
||||
* The first transaction code available for user commands (inclusive).
|
||||
*/
|
||||
FIRST_CALL_TRANSACTION = 0x00000001,
|
||||
/**
|
||||
* The last transaction code available for user commands (inclusive).
|
||||
*/
|
||||
LAST_CALL_TRANSACTION = 0x00ffffff,
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a type of AIBinder object which can be sent out.
|
||||
*/
|
||||
struct AIBinder_Class;
|
||||
typedef struct AIBinder_Class AIBinder_Class;
|
||||
|
||||
/**
|
||||
* Represents a local or remote object which can be used for IPC or which can itself be sent.
|
||||
*
|
||||
* This object has a refcount associated with it and will be deleted when its refcount reaches zero.
|
||||
* How methods interactive with this refcount is described below. When using this API, it is
|
||||
* intended for a client of a service to hold a strong reference to that service. This also means
|
||||
* that user data typically should hold a strong reference to a local AIBinder object. A remote
|
||||
* AIBinder object automatically holds a strong reference to the AIBinder object in the server's
|
||||
* process. A typically memory layout looks like this:
|
||||
*
|
||||
* Key:
|
||||
* ---> Ownership/a strong reference
|
||||
* ...> A weak reference
|
||||
*
|
||||
* (process boundary)
|
||||
* |
|
||||
* MyInterface ---> AIBinder_Weak | ProxyForMyInterface
|
||||
* ^ . | |
|
||||
* | . | |
|
||||
* | v | v
|
||||
* UserData <--- AIBinder <-|- AIBinder
|
||||
* |
|
||||
*
|
||||
* In this way, you'll notice that a proxy for the interface holds a strong reference to the
|
||||
* implementation and that in the server process, the AIBinder object which was sent can be resent
|
||||
* so that the same AIBinder object always represents the same object. This allows, for instance, an
|
||||
* implementation (usually a callback) to transfer all ownership to a remote process and
|
||||
* automatically be deleted when the remote process is done with it or dies. Other memory models are
|
||||
* possible, but this is the standard one.
|
||||
*
|
||||
* If the process containing an AIBinder dies, it is possible to be holding a strong reference to
|
||||
* an object which does not exist. In this case, transactions to this binder will return
|
||||
* STATUS_DEAD_OBJECT. See also AIBinder_linkToDeath, AIBinder_unlinkToDeath, and AIBinder_isAlive.
|
||||
*
|
||||
* Once an AIBinder is created, anywhere it is passed (remotely or locally), there is a 1-1
|
||||
* correspondence between the address of an AIBinder and the object it represents. This means that
|
||||
* when two AIBinder pointers point to the same address, they represent the same object (whether
|
||||
* that object is local or remote). This correspondance can be broken accidentally if AIBinder_new
|
||||
* is erronesouly called to create the same object multiple times.
|
||||
*/
|
||||
struct AIBinder;
|
||||
typedef struct AIBinder AIBinder;
|
||||
|
||||
/**
|
||||
* The AIBinder object associated with this can be retrieved if it is still alive so that it can be
|
||||
* re-used. The intention of this is to enable the same AIBinder object to always represent the same
|
||||
* object.
|
||||
*/
|
||||
struct AIBinder_Weak;
|
||||
typedef struct AIBinder_Weak AIBinder_Weak;
|
||||
|
||||
/**
|
||||
* Represents a handle on a death notification. See AIBinder_linkToDeath/AIBinder_unlinkToDeath.
|
||||
*/
|
||||
struct AIBinder_DeathRecipient;
|
||||
typedef struct AIBinder_DeathRecipient AIBinder_DeathRecipient;
|
||||
|
||||
/**
|
||||
* This is called whenever a new AIBinder object is needed of a specific class.
|
||||
*
|
||||
* \param args these can be used to construct a new class. These are passed from AIBinder_new.
|
||||
* \return this is the userdata representing the class. It can be retrieved using
|
||||
* AIBinder_getUserData.
|
||||
*/
|
||||
typedef void* (*AIBinder_Class_onCreate)(void* args);
|
||||
|
||||
/**
|
||||
* This is called whenever an AIBinder object is no longer referenced and needs destroyed.
|
||||
*
|
||||
* Typically, this just deletes whatever the implementation is.
|
||||
*
|
||||
* \param userData this is the same object returned by AIBinder_Class_onCreate
|
||||
*/
|
||||
typedef void (*AIBinder_Class_onDestroy)(void* userData);
|
||||
|
||||
/**
|
||||
* This is called whenever a transaction needs to be processed by a local implementation.
|
||||
*
|
||||
* This method will be called after the equivalent of
|
||||
* android.os.Parcel#enforceInterface is called. That is, the interface
|
||||
* descriptor associated with the AIBinder_Class descriptor will already be
|
||||
* checked.
|
||||
*
|
||||
* \param binder the object being transacted on.
|
||||
* \param code implementation-specific code representing which transaction should be taken.
|
||||
* \param in the implementation-specific input data to this transaction.
|
||||
* \param out the implementation-specific output data to this transaction.
|
||||
*
|
||||
* \return the implementation-specific output code. This may be forwarded from another service, the
|
||||
* result of a parcel read or write, or another error as is applicable to the specific
|
||||
* implementation. Usually, implementation-specific error codes are written to the output parcel,
|
||||
* and the transaction code is reserved for kernel errors or error codes that have been repeated
|
||||
* from subsequent transactions.
|
||||
*/
|
||||
typedef binder_status_t (*AIBinder_Class_onTransact)(AIBinder* binder, transaction_code_t code,
|
||||
const AParcel* in, AParcel* out);
|
||||
|
||||
/**
|
||||
* This creates a new instance of a class of binders which can be instantiated. This is called one
|
||||
* time during library initialization and cleaned up when the process exits or execs.
|
||||
*
|
||||
* None of these parameters can be null.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param interfaceDescriptor this is a unique identifier for the class. This is used internally for
|
||||
* validity checks on transactions. This should be utf-8.
|
||||
* \param onCreate see AIBinder_Class_onCreate.
|
||||
* \param onDestroy see AIBinder_Class_onDestroy.
|
||||
* \param onTransact see AIBinder_Class_onTransact.
|
||||
*
|
||||
* \return the class object representing these parameters or null on error.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AIBinder_Class* AIBinder_Class_define(
|
||||
const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate,
|
||||
AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Dump information about an AIBinder (usually for debugging).
|
||||
*
|
||||
* When no arguments are provided, a brief overview of the interview should be given.
|
||||
*
|
||||
* \param binder interface being dumped
|
||||
* \param fd file descriptor to be dumped to, should be flushed, ownership is not passed.
|
||||
* \param args array of null-terminated strings for dump (may be null if numArgs is 0)
|
||||
* \param numArgs number of args to be sent
|
||||
*
|
||||
* \return binder_status_t result of transaction (if remote, for instance)
|
||||
*/
|
||||
typedef binder_status_t (*AIBinder_onDump)(AIBinder* binder, int fd, const char** args,
|
||||
uint32_t numArgs);
|
||||
|
||||
/**
|
||||
* This sets the implementation of the dump method for a class.
|
||||
*
|
||||
* If this isn't set, nothing will be dumped when dump is called (for instance with
|
||||
* android.os.Binder#dump). Must be called before any instance of the class is created.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param clazz class which should use this dump function
|
||||
* \param onDump function to call when an instance of this binder class is being dumped.
|
||||
*/
|
||||
void AIBinder_Class_setOnDump(AIBinder_Class* clazz, AIBinder_onDump onDump) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* This tells users of this class not to use a transaction header. By default, libbinder_ndk users
|
||||
* read/write transaction headers implicitly (in the SDK, this must be manually written by
|
||||
* android.os.Parcel#writeInterfaceToken, and it is read/checked with
|
||||
* android.os.Parcel#enforceInterface). This method is provided in order to talk to legacy code
|
||||
* which does not write an interface token. When this is disabled, type safety is reduced, so you
|
||||
* must have a separate way of determining the binder you are talking to is the right type. Must
|
||||
* be called before any instance of the class is created.
|
||||
*
|
||||
* Available since API level 33.
|
||||
*
|
||||
* WARNING: this API interacts badly with linkernamespaces. For correct behavior, you must
|
||||
* use it on all instances of a class in the same process which share the same interface
|
||||
* descriptor. In general, it is recommended you do not use this API, because it is disabling
|
||||
* type safety.
|
||||
*
|
||||
* \param clazz class to disable interface header on.
|
||||
*/
|
||||
void AIBinder_Class_disableInterfaceTokenHeader(AIBinder_Class* clazz) __INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* Creates a new binder object of the appropriate class.
|
||||
*
|
||||
* Ownership of args is passed to this object. The lifecycle is implemented with AIBinder_incStrong
|
||||
* and AIBinder_decStrong. When the reference count reaches zero, onDestroy is called.
|
||||
*
|
||||
* When this is called, the refcount is implicitly 1. So, calling decStrong exactly one time is
|
||||
* required to delete this object.
|
||||
*
|
||||
* Once an AIBinder object is created using this API, re-creating that AIBinder for the same
|
||||
* instance of the same class will break pointer equality for that specific AIBinder object. For
|
||||
* instance, if someone erroneously created two AIBinder instances representing the same callback
|
||||
* object and passed one to a hypothetical addCallback function and then later another one to a
|
||||
* hypothetical removeCallback function, the remote process would have no way to determine that
|
||||
* these two objects are actually equal using the AIBinder pointer alone (which they should be able
|
||||
* to do). Also see the suggested memory ownership model suggested above.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param clazz the type of the object to be created.
|
||||
* \param args the args to pass to AIBinder_onCreate for that class.
|
||||
*
|
||||
* \return a binder object representing the newly instantiated object.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AIBinder* AIBinder_new(const AIBinder_Class* clazz, void* args)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* If this is hosted in a process other than the current one.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder being queried.
|
||||
*
|
||||
* \return true if the AIBinder represents an object in another process.
|
||||
*/
|
||||
bool AIBinder_isRemote(const AIBinder* binder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* If this binder is known to be alive. This will not send a transaction to a remote process and
|
||||
* returns a result based on the last known information. That is, whenever a transaction is made,
|
||||
* this is automatically updated to reflect the current alive status of this binder. This will be
|
||||
* updated as the result of a transaction made using AIBinder_transact, but it will also be updated
|
||||
* based on the results of bookkeeping or other transactions made internally.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder being queried.
|
||||
*
|
||||
* \return true if the binder is alive.
|
||||
*/
|
||||
bool AIBinder_isAlive(const AIBinder* binder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Built-in transaction for all binder objects. This sends a transaction that will immediately
|
||||
* return. Usually this is used to make sure that a binder is alive, as a placeholder call, or as a
|
||||
* consistency check.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder being queried.
|
||||
*
|
||||
* \return STATUS_OK if the ping succeeds.
|
||||
*/
|
||||
binder_status_t AIBinder_ping(AIBinder* binder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Built-in transaction for all binder objects. This dumps information about a given binder.
|
||||
*
|
||||
* See also AIBinder_Class_setOnDump, AIBinder_onDump.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder to dump information about
|
||||
* \param fd where information should be dumped to
|
||||
* \param args null-terminated arguments to pass (may be null if numArgs is 0)
|
||||
* \param numArgs number of args to send
|
||||
*
|
||||
* \return STATUS_OK if dump succeeds (or if there is nothing to dump)
|
||||
*/
|
||||
binder_status_t AIBinder_dump(AIBinder* binder, int fd, const char** args, uint32_t numArgs)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Registers for notifications that the associated binder is dead. The same death recipient may be
|
||||
* associated with multiple different binders. If the binder is local, then no death recipient will
|
||||
* be given (since if the local process dies, then no recipient will exist to receive a
|
||||
* transaction). The cookie is passed to recipient in the case that this binder dies and can be
|
||||
* null. The exact cookie must also be used to unlink this transaction (see AIBinder_unlinkToDeath).
|
||||
* This function may return a binder transaction failure. The cookie can be used both for
|
||||
* identification and holding user data.
|
||||
*
|
||||
* If binder is local, this will return STATUS_INVALID_OPERATION.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder object you want to receive death notifications from.
|
||||
* \param recipient the callback that will receive notifications when/if the binder dies.
|
||||
* \param cookie the value that will be passed to the death recipient on death.
|
||||
*
|
||||
* \return STATUS_OK on success.
|
||||
*/
|
||||
binder_status_t AIBinder_linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient,
|
||||
void* cookie) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Stops registration for the associated binder dying. Does not delete the recipient. This function
|
||||
* may return a binder transaction failure and in case the death recipient cannot be found, it
|
||||
* returns STATUS_NAME_NOT_FOUND.
|
||||
*
|
||||
* This only ever needs to be called when the AIBinder_DeathRecipient remains for use with other
|
||||
* AIBinder objects. If the death recipient is deleted, all binders will automatically be unlinked.
|
||||
* If the binder dies, it will automatically unlink. If the binder is deleted, it will be
|
||||
* automatically unlinked.
|
||||
*
|
||||
* Be aware that it is not safe to immediately deallocate the cookie when this call returns. If you
|
||||
* need to clean up the cookie, you should do so in the onUnlinked callback, which can be set using
|
||||
* AIBinder_DeathRecipient_setOnUnlinked.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder object to remove a previously linked death recipient from.
|
||||
* \param recipient the callback to remove.
|
||||
* \param cookie the cookie used to link to death.
|
||||
*
|
||||
* \return STATUS_OK on success. STATUS_NAME_NOT_FOUND if the binder cannot be found to be unlinked.
|
||||
*/
|
||||
binder_status_t AIBinder_unlinkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient,
|
||||
void* cookie) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* This returns the calling UID assuming that this thread is called from a thread that is processing
|
||||
* a binder transaction (for instance, in the implementation of AIBinder_Class_onTransact).
|
||||
*
|
||||
* This can be used with higher-level system services to determine the caller's identity and check
|
||||
* permissions.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \return calling uid or the current process's UID if this thread isn't processing a transaction.
|
||||
*/
|
||||
uid_t AIBinder_getCallingUid() __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* This returns the calling PID assuming that this thread is called from a thread that is processing
|
||||
* a binder transaction (for instance, in the implementation of AIBinder_Class_onTransact).
|
||||
*
|
||||
* This can be used with higher-level system services to determine the caller's identity and check
|
||||
* permissions. However, when doing this, one should be aware of possible TOCTOU problems when the
|
||||
* calling process dies and is replaced with another process with elevated permissions and the same
|
||||
* PID.
|
||||
*
|
||||
* Warning: oneway transactions do not receive PID. Even if you expect
|
||||
* a transaction to be synchronous, a misbehaving client could send it
|
||||
* as a synchronous call and result in a 0 PID here. Additionally, if
|
||||
* there is a race and the calling process dies, the PID may still be
|
||||
* 0 for a synchronous call.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \return calling pid or the current process's PID if this thread isn't processing a transaction.
|
||||
* If the transaction being processed is a oneway transaction, then this method will return 0.
|
||||
*/
|
||||
pid_t AIBinder_getCallingPid() __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Determine whether the current thread is currently executing an incoming transaction.
|
||||
*
|
||||
* \return true if the current thread is currently executing an incoming transaction, and false
|
||||
* otherwise.
|
||||
*/
|
||||
bool AIBinder_isHandlingTransaction() __INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* This can only be called if a strong reference to this object already exists in process.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder object to add a refcount to.
|
||||
*/
|
||||
void AIBinder_incStrong(AIBinder* binder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* This will delete the object and call onDestroy once the refcount reaches zero.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder object to remove a refcount from.
|
||||
*/
|
||||
void AIBinder_decStrong(AIBinder* binder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* For debugging only!
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder object to retrieve the refcount of.
|
||||
*
|
||||
* \return the number of strong-refs on this binder in this process. If binder is null, this will be
|
||||
* -1.
|
||||
*/
|
||||
int32_t AIBinder_debugGetRefCount(AIBinder* binder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* This sets the class of an AIBinder object. This checks to make sure the remote object is of
|
||||
* the expected class. A class must be set in order to use transactions on an AIBinder object.
|
||||
* However, if an object is just intended to be passed through to another process or used as a
|
||||
* handle this need not be called.
|
||||
*
|
||||
* This returns true if the class association succeeds. If it fails, no change is made to the
|
||||
* binder object.
|
||||
*
|
||||
* Warning: this may fail if the binder is dead.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the object to attach the class to.
|
||||
* \param clazz the clazz to attach to binder.
|
||||
*
|
||||
* \return true if the binder has the class clazz and if the association was successful.
|
||||
*/
|
||||
bool AIBinder_associateClass(AIBinder* binder, const AIBinder_Class* clazz) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Returns the class that this binder was constructed with or associated with.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the object that is being queried.
|
||||
*
|
||||
* \return the class that this binder is associated with. If this binder wasn't created with
|
||||
* AIBinder_new, and AIBinder_associateClass hasn't been called, then this will return null.
|
||||
*/
|
||||
const AIBinder_Class* AIBinder_getClass(AIBinder* binder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Value returned by onCreate for a local binder. For stateless classes (if onCreate returns
|
||||
* null), this also returns null. For a remote binder, this will always return null.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the object that is being queried.
|
||||
*
|
||||
* \return the userdata returned from AIBinder_onCreate when this object was created. This may be
|
||||
* null for stateless objects. For remote objects, this is always null.
|
||||
*/
|
||||
void* AIBinder_getUserData(AIBinder* binder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* A transaction is a series of calls to these functions which looks this
|
||||
* - call AIBinder_prepareTransaction
|
||||
* - fill out the in parcel with parameters (lifetime of the 'in' variable)
|
||||
* - call AIBinder_transact
|
||||
* - read results from the out parcel (lifetime of the 'out' variable)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a parcel to start filling out for a transaction. This will add a header to the
|
||||
* transaction that corresponds to android.os.Parcel#writeInterfaceToken. This may add debugging
|
||||
* or other information to the transaction for platform use or to enable other features to work. The
|
||||
* contents of this header is a platform implementation detail, and it is required to use
|
||||
* libbinder_ndk. This parcel is to be sent via AIBinder_transact and it represents the input data
|
||||
* to the transaction. It is recommended to check if the object is local and call directly into its
|
||||
* user data before calling this as the parceling and unparceling cost can be avoided. This AIBinder
|
||||
* must be either built with a class or associated with a class before using this API.
|
||||
*
|
||||
* This does not affect the ownership of binder. When this function succeeds, the in parcel's
|
||||
* ownership is passed to the caller. At this point, the parcel can be filled out and passed to
|
||||
* AIBinder_transact. Alternatively, if there is an error while filling out the parcel, it can be
|
||||
* deleted with AParcel_delete.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder object to start a transaction on.
|
||||
* \param in out parameter for input data to the transaction.
|
||||
*
|
||||
* \return STATUS_OK on success. This will return STATUS_INVALID_OPERATION if the binder has not yet
|
||||
* been associated with a class (see AIBinder_new and AIBinder_associateClass).
|
||||
*/
|
||||
binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Transact using a parcel created from AIBinder_prepareTransaction. This actually communicates with
|
||||
* the object representing this binder object. This also passes out a parcel to be used for the
|
||||
* return transaction. This takes ownership of the in parcel and automatically deletes it after it
|
||||
* is sent to the remote process. The output parcel is the result of the transaction. If the
|
||||
* transaction has FLAG_ONEWAY, the out parcel will be empty. Otherwise, this will block until the
|
||||
* remote process has processed the transaction, and the out parcel will contain the output data
|
||||
* from transaction.
|
||||
*
|
||||
* This does not affect the ownership of binder. The out parcel's ownership is passed to the caller
|
||||
* and must be released with AParcel_delete when finished reading.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder the binder object to transact on.
|
||||
* \param code the implementation-specific code representing which transaction should be taken.
|
||||
* \param in the implementation-specific input data to this transaction.
|
||||
* \param out the implementation-specific output data to this transaction.
|
||||
* \param flags possible flags to alter the way in which the transaction is conducted or 0.
|
||||
*
|
||||
* \return the result from the kernel or from the remote process. Usually, implementation-specific
|
||||
* error codes are written to the output parcel, and the transaction code is reserved for kernel
|
||||
* errors or error codes that have been repeated from subsequent transactions.
|
||||
*/
|
||||
binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, AParcel** in,
|
||||
AParcel** out, binder_flags_t flags) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* This does not take any ownership of the input binder, but it can be used to retrieve it if
|
||||
* something else in some process still holds a reference to it.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param binder object to create a weak pointer to.
|
||||
*
|
||||
* \return object representing a weak pointer to binder (or null if binder is null).
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AIBinder_Weak* AIBinder_Weak_new(AIBinder* binder)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Deletes the weak reference. This will have no impact on the lifetime of the binder.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param weakBinder object created with AIBinder_Weak_new.
|
||||
*/
|
||||
void AIBinder_Weak_delete(AIBinder_Weak* weakBinder) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* If promotion succeeds, result will have one strong refcount added to it. Otherwise, this returns
|
||||
* null.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param weakBinder weak pointer to attempt retrieving the original object from.
|
||||
*
|
||||
* \return an AIBinder object with one refcount given to the caller or null.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AIBinder* AIBinder_Weak_promote(AIBinder_Weak* weakBinder)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* This function is executed on death receipt. See AIBinder_linkToDeath/AIBinder_unlinkToDeath.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param cookie the cookie passed to AIBinder_linkToDeath.
|
||||
*/
|
||||
typedef void (*AIBinder_DeathRecipient_onBinderDied)(void* cookie) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* This function is intended for cleaning up the data in the provided cookie, and it is executed
|
||||
* when the DeathRecipient is unlinked. When the DeathRecipient is unlinked due to a death receipt,
|
||||
* this method is called after the call to onBinderDied.
|
||||
*
|
||||
* This method is called once for each binder that is unlinked. Hence, if the same cookie is passed
|
||||
* to multiple binders, then the caller is responsible for reference counting the cookie.
|
||||
*
|
||||
* See also AIBinder_linkToDeath/AIBinder_unlinkToDeath.
|
||||
*
|
||||
* WARNING: Make sure the lifetime of this cookie is long enough. If it is dynamically
|
||||
* allocated, it should be deleted with AIBinder_DeathRecipient_setOnUnlinked.
|
||||
*
|
||||
* Available since API level 33.
|
||||
*
|
||||
* \param cookie the cookie passed to AIBinder_linkToDeath.
|
||||
*/
|
||||
typedef void (*AIBinder_DeathRecipient_onBinderUnlinked)(void* cookie) __INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* Creates a new binder death recipient. This can be attached to multiple different binder objects.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* WARNING: Make sure the lifetime of this cookie is long enough. If it is dynamically
|
||||
* allocated, it should be deleted with AIBinder_DeathRecipient_setOnUnlinked.
|
||||
*
|
||||
* \param onBinderDied the callback to call when this death recipient is invoked.
|
||||
*
|
||||
* \return the newly constructed object (or null if onBinderDied is null).
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AIBinder_DeathRecipient* AIBinder_DeathRecipient_new(
|
||||
AIBinder_DeathRecipient_onBinderDied onBinderDied) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Set the callback to be called when this DeathRecipient is unlinked from a binder. The callback is
|
||||
* called in the following situations:
|
||||
*
|
||||
* 1. If the binder died, shortly after the call to onBinderDied.
|
||||
* 2. If the binder is explicitly unlinked with AIBinder_unlinkToDeath or
|
||||
* AIBinder_DeathRecipient_delete, after any pending onBinderDied calls
|
||||
* finish.
|
||||
* 3. During or shortly after the AIBinder_linkToDeath call if it returns an error.
|
||||
*
|
||||
* It is guaranteed that the callback is called exactly once for each call to linkToDeath unless the
|
||||
* process is aborted before the binder is unlinked.
|
||||
*
|
||||
* Be aware that when the binder is explicitly unlinked, it is not guaranteed that onUnlinked has
|
||||
* been called before the call to AIBinder_unlinkToDeath or AIBinder_DeathRecipient_delete returns.
|
||||
* For example, if the binder dies concurrently with a call to AIBinder_unlinkToDeath, the binder is
|
||||
* not unlinked until after the death notification is delivered, even if AIBinder_unlinkToDeath
|
||||
* returns before that happens.
|
||||
*
|
||||
* This method should be called before linking the DeathRecipient to a binder because the function
|
||||
* pointer is cached. If you change it after linking to a binder, it is unspecified whether the old
|
||||
* binder will call the old or new onUnlinked callback.
|
||||
*
|
||||
* The onUnlinked argument may be null. In this case, no notification is given when the binder is
|
||||
* unlinked.
|
||||
*
|
||||
* Available since API level 33.
|
||||
*
|
||||
* \param recipient the DeathRecipient to set the onUnlinked callback for.
|
||||
* \param onUnlinked the callback to call when a binder is unlinked from recipient.
|
||||
*/
|
||||
void AIBinder_DeathRecipient_setOnUnlinked(AIBinder_DeathRecipient* recipient,
|
||||
AIBinder_DeathRecipient_onBinderUnlinked onUnlinked)
|
||||
__INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* Deletes a binder death recipient. It is not necessary to call AIBinder_unlinkToDeath before
|
||||
* calling this as these will all be automatically unlinked.
|
||||
*
|
||||
* Be aware that it is not safe to immediately deallocate the cookie when this call returns. If you
|
||||
* need to clean up the cookie, you should do so in the onUnlinked callback, which can be set using
|
||||
* AIBinder_DeathRecipient_setOnUnlinked.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param recipient the binder to delete (previously created with AIBinder_DeathRecipient_new).
|
||||
*/
|
||||
void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient* recipient) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Gets the extension registered with AIBinder_setExtension.
|
||||
*
|
||||
* See AIBinder_setExtension.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*
|
||||
* \param binder the object to get the extension of.
|
||||
* \param outExt the returned extension object. Will be null if there is no extension set or
|
||||
* non-null with one strong ref count.
|
||||
*
|
||||
* \return error of getting the interface (may be a transaction error if this is
|
||||
* remote binder). STATUS_UNEXPECTED_NULL if binder is null.
|
||||
*/
|
||||
binder_status_t AIBinder_getExtension(AIBinder* binder, AIBinder** outExt) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Gets the extension of a binder interface. This allows a downstream developer to add
|
||||
* an extension to an interface without modifying its interface file. This should be
|
||||
* called immediately when the object is created before it is passed to another thread.
|
||||
* No thread safety is required.
|
||||
*
|
||||
* For instance, imagine if we have this interface:
|
||||
* interface IFoo { void doFoo(); }
|
||||
*
|
||||
* A). Historical option that has proven to be BAD! Only the original
|
||||
* author of an interface should change an interface. If someone
|
||||
* downstream wants additional functionality, they should not ever
|
||||
* change the interface or use this method.
|
||||
*
|
||||
* BAD TO DO: interface IFoo { BAD TO DO
|
||||
* BAD TO DO: void doFoo(); BAD TO DO
|
||||
* BAD TO DO: + void doBar(); // adding a method BAD TO DO
|
||||
* BAD TO DO: } BAD TO DO
|
||||
*
|
||||
* B). Option that this method enables.
|
||||
* Leave the original interface unchanged (do not change IFoo!).
|
||||
* Instead, create a new interface in a downstream package:
|
||||
*
|
||||
* package com.<name>; // new functionality in a new package
|
||||
* interface IBar { void doBar(); }
|
||||
*
|
||||
* When registering the interface, add:
|
||||
* std::shared_ptr<MyFoo> foo = new MyFoo; // class in AOSP codebase
|
||||
* std::shared_ptr<MyBar> bar = new MyBar; // custom extension class
|
||||
* SpAIBinder binder = foo->asBinder(); // target binder to extend
|
||||
* ... = AIBinder_setExtension(binder.get(), bar->asBinder().get());
|
||||
* ... = AServiceManager_addService(binder.get(), instanceName);
|
||||
* // handle error
|
||||
*
|
||||
* Do not use foo->asBinder().get() as the target binder argument to
|
||||
* AIBinder_setExtensions because asBinder it creates a new binder
|
||||
* object that will be destroyed after the function is called. The same
|
||||
* binder object must be used for AIBinder_setExtension and
|
||||
* AServiceManager_addService to register the service with an extension.
|
||||
*
|
||||
* Then, clients of IFoo can get this extension:
|
||||
* SpAIBinder binder = ...;
|
||||
* std::shared_ptr<IFoo> foo = IFoo::fromBinder(binder); // handle if null
|
||||
* SpAIBinder barBinder;
|
||||
* ... = AIBinder_getExtension(barBinder.get());
|
||||
* // handle error
|
||||
* std::shared_ptr<IBar> bar = IBar::fromBinder(barBinder);
|
||||
* // type is checked with AIBinder_associateClass
|
||||
* // if bar is null, then there is no extension or a different
|
||||
* // type of extension
|
||||
*
|
||||
* Available since API level 30.
|
||||
*
|
||||
* \param binder the object to get the extension on. Must be local.
|
||||
* \param ext the extension to set (binder will hold a strong reference to this)
|
||||
*
|
||||
* \return OK on success, STATUS_INVALID_OPERATION if binder is not local, STATUS_UNEXPECTED_NULL
|
||||
* if either binder is null.
|
||||
*/
|
||||
binder_status_t AIBinder_setExtension(AIBinder* binder, AIBinder* ext) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Retrieve the class descriptor for the class.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param clazz the class to fetch the descriptor from
|
||||
*
|
||||
* \return the class descriptor string. This pointer will never be null; a
|
||||
* descriptor is required to define a class. The pointer is owned by the class
|
||||
* and will remain valid as long as the class does. For a local class, this will
|
||||
* be the same value (not necessarily pointer equal) as is passed into
|
||||
* AIBinder_Class_define. Format is utf-8.
|
||||
*/
|
||||
const char* AIBinder_Class_getDescriptor(const AIBinder_Class* clazz) __INTRODUCED_IN(31);
|
||||
|
||||
/**
|
||||
* Whether AIBinder is less than another.
|
||||
*
|
||||
* This provides a per-process-unique total ordering of binders where a null
|
||||
* AIBinder* object is considered to be before all other binder objects.
|
||||
* For instance, two binders refer to the same object in a local or remote
|
||||
* process when both AIBinder_lt(a, b) and AIBinder(b, a) are false. This API
|
||||
* might be used to insert and lookup binders in binary search trees.
|
||||
*
|
||||
* AIBinder* pointers themselves actually also create a per-process-unique total
|
||||
* ordering. However, this ordering is inconsistent with AIBinder_Weak_lt for
|
||||
* remote binders. So, in general, this function should be preferred.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param lhs comparison object
|
||||
* \param rhs comparison object
|
||||
*
|
||||
* \return whether "lhs < rhs" is true
|
||||
*/
|
||||
bool AIBinder_lt(const AIBinder* lhs, const AIBinder* rhs) __INTRODUCED_IN(31);
|
||||
|
||||
/**
|
||||
* Clone an AIBinder_Weak. Useful because even if a weak binder promotes to a
|
||||
* null value, after further binder transactions, it may no longer promote to a
|
||||
* null value.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param weak Object to clone
|
||||
*
|
||||
* \return clone of the input parameter. This must be deleted with
|
||||
* AIBinder_Weak_delete. Null if weak input parameter is also null.
|
||||
*/
|
||||
AIBinder_Weak* AIBinder_Weak_clone(const AIBinder_Weak* weak) __INTRODUCED_IN(31);
|
||||
|
||||
/**
|
||||
* Whether AIBinder_Weak is less than another.
|
||||
*
|
||||
* This provides a per-process-unique total ordering of binders which is exactly
|
||||
* the same as AIBinder_lt. Similarly, a null AIBinder_Weak* is considered to be
|
||||
* ordered before all other weak references.
|
||||
*
|
||||
* This function correctly distinguishes binders even if one is deallocated. So,
|
||||
* for instance, an AIBinder_Weak* entry representing a deleted binder will
|
||||
* never compare as equal to an AIBinder_Weak* entry which represents a
|
||||
* different allocation of a binder, even if the two binders were originally
|
||||
* allocated at the same address. That is:
|
||||
*
|
||||
* AIBinder* a = ...; // imagine this has address 0x8
|
||||
* AIBinder_Weak* bWeak = AIBinder_Weak_new(a);
|
||||
* AIBinder_decStrong(a); // a may be deleted, if this is the last reference
|
||||
* AIBinder* b = ...; // imagine this has address 0x8 (same address as b)
|
||||
* AIBinder_Weak* bWeak = AIBinder_Weak_new(b);
|
||||
*
|
||||
* Then when a/b are compared with other binders, their order will be preserved,
|
||||
* and it will either be the case that AIBinder_Weak_lt(aWeak, bWeak) OR
|
||||
* AIBinder_Weak_lt(bWeak, aWeak), but not both.
|
||||
*
|
||||
* Unlike AIBinder*, the AIBinder_Weak* addresses themselves have nothing to do
|
||||
* with the underlying binder.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param lhs comparison object
|
||||
* \param rhs comparison object
|
||||
*
|
||||
* \return whether "lhs < rhs" is true
|
||||
*/
|
||||
bool AIBinder_Weak_lt(const AIBinder_Weak* lhs, const AIBinder_Weak* rhs) __INTRODUCED_IN(31);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_ibinder_jni.h
|
||||
* @brief Conversions between AIBinder and android.os.IBinder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/binder_ibinder.h>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Converts an android.os.IBinder object into an AIBinder* object.
|
||||
*
|
||||
* If the binder is null, null is returned. If this binder object was originally an
|
||||
* AIBinder object, the original object is returned. The returned object has one refcount
|
||||
* associated with it, and so this should be accompanied with an AIBinder_decStrong call.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param env Java environment. Must not be null.
|
||||
* \param binder android.os.IBinder java object.
|
||||
*
|
||||
* \return an AIBinder object representing the Java binder object. If either parameter is null, or
|
||||
* the Java object is of the wrong type, this will return null.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AIBinder* AIBinder_fromJavaBinder(JNIEnv* env, jobject binder)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Converts an AIBinder* object into an android.os.IBinder object.
|
||||
*
|
||||
* If the binder is null, null is returned. If this binder object was originally an IBinder object,
|
||||
* the original java object will be returned.
|
||||
*
|
||||
* WARNING: this function returns global and local references. This can be
|
||||
* figured out using GetObjectRefType. Though, when this function is called
|
||||
* from within a Java context, the local ref will automatically be cleaned
|
||||
* up. If this is called outside of a Java frame,
|
||||
* PushObjectFrame/PopObjectFrame can simulate this automatic cleanup.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param env Java environment. Must not be null.
|
||||
* \param binder the object to convert.
|
||||
*
|
||||
* \return an android.os.IBinder object or null if the parameters were null.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) jobject AIBinder_toJavaBinder(JNIEnv* env, AIBinder* binder)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,379 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_interface_utils.h
|
||||
* @brief This provides common C++ classes for common operations and as base classes for C++
|
||||
* interfaces.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/binder_auto_utils.h>
|
||||
#include <android/binder_ibinder.h>
|
||||
|
||||
#if __has_include(<android/binder_shell.h>)
|
||||
#include <android/binder_shell.h>
|
||||
#define HAS_BINDER_SHELL_COMMAND
|
||||
#endif //_has_include
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
namespace ndk {
|
||||
|
||||
/**
|
||||
* Binder analog to using std::shared_ptr for an internally held refcount.
|
||||
*
|
||||
* ref must be called at least one time during the lifetime of this object. The recommended way to
|
||||
* construct this object is with SharedRefBase::make.
|
||||
*
|
||||
* If you need a "this" shared reference analogous to shared_from_this, use this->ref().
|
||||
*/
|
||||
class SharedRefBase {
|
||||
public:
|
||||
SharedRefBase() {}
|
||||
virtual ~SharedRefBase() {
|
||||
std::call_once(mFlagThis, [&]() {
|
||||
__assert(__FILE__, __LINE__, "SharedRefBase: no ref created during lifetime");
|
||||
});
|
||||
|
||||
if (ref() != nullptr) {
|
||||
__assert(__FILE__, __LINE__,
|
||||
"SharedRefBase: destructed but still able to lock weak_ptr. Is this object "
|
||||
"double-owned?");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A shared_ptr must be held to this object when this is called. This must be called once during
|
||||
* the lifetime of this object.
|
||||
*/
|
||||
std::shared_ptr<SharedRefBase> ref() {
|
||||
std::shared_ptr<SharedRefBase> thiz = mThis.lock();
|
||||
|
||||
std::call_once(mFlagThis, [&]() { mThis = thiz = std::shared_ptr<SharedRefBase>(this); });
|
||||
|
||||
return thiz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for a ref (see above) which automatically casts to the desired child type.
|
||||
*/
|
||||
template <typename CHILD>
|
||||
std::shared_ptr<CHILD> ref() {
|
||||
return std::static_pointer_cast<CHILD>(ref());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for making an object directly with a reference.
|
||||
*/
|
||||
template <class T, class... Args>
|
||||
static std::shared_ptr<T> make(Args&&... args) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
T* t = new T(std::forward<Args>(args)...);
|
||||
#pragma clang diagnostic pop
|
||||
// warning: Potential leak of memory pointed to by 't' [clang-analyzer-unix.Malloc]
|
||||
return t->template ref<T>(); // NOLINT(clang-analyzer-unix.Malloc)
|
||||
}
|
||||
|
||||
static void operator delete(void* p) { std::free(p); }
|
||||
|
||||
// Once minSdkVersion is 30, we are guaranteed to be building with the
|
||||
// Android 11 AIDL compiler which supports the SharedRefBase::make API.
|
||||
//
|
||||
// Use 'SharedRefBase::make<T>(...)' to make. SharedRefBase has implicit
|
||||
// ownership. Making this operator private to avoid double-ownership.
|
||||
#if !defined(__ANDROID_API__) || __ANDROID_API__ >= 30 || defined(__ANDROID_APEX__)
|
||||
private:
|
||||
#else
|
||||
[[deprecated("Prefer SharedRefBase::make<T>(...) if possible.")]]
|
||||
#endif
|
||||
static void* operator new(size_t s) { return std::malloc(s); }
|
||||
|
||||
private:
|
||||
std::once_flag mFlagThis;
|
||||
std::weak_ptr<SharedRefBase> mThis;
|
||||
};
|
||||
|
||||
/**
|
||||
* wrapper analog to IInterface
|
||||
*/
|
||||
class ICInterface : public SharedRefBase {
|
||||
public:
|
||||
ICInterface() {}
|
||||
virtual ~ICInterface() {}
|
||||
|
||||
/**
|
||||
* This either returns the single existing implementation or creates a new implementation.
|
||||
*/
|
||||
virtual SpAIBinder asBinder() = 0;
|
||||
|
||||
/**
|
||||
* Returns whether this interface is in a remote process. If it cannot be determined locally,
|
||||
* this will be checked using AIBinder_isRemote.
|
||||
*/
|
||||
virtual bool isRemote() = 0;
|
||||
|
||||
/**
|
||||
* Dumps information about the interface. By default, dumps nothing.
|
||||
*
|
||||
* This method is not given ownership of the FD.
|
||||
*/
|
||||
virtual inline binder_status_t dump(int fd, const char** args, uint32_t numArgs);
|
||||
|
||||
#ifdef HAS_BINDER_SHELL_COMMAND
|
||||
/**
|
||||
* Process shell commands. By default, does nothing.
|
||||
*/
|
||||
virtual inline binder_status_t handleShellCommand(int in, int out, int err, const char** argv,
|
||||
uint32_t argc);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Interprets this binder as this underlying interface if this has stored an ICInterface in the
|
||||
* binder's user data.
|
||||
*
|
||||
* This does not do type checking and should only be used when the binder is known to originate
|
||||
* from ICInterface. Most likely, you want to use I*::fromBinder.
|
||||
*/
|
||||
static inline std::shared_ptr<ICInterface> asInterface(AIBinder* binder);
|
||||
|
||||
/**
|
||||
* Helper method to create a class
|
||||
*/
|
||||
static inline AIBinder_Class* defineClass(const char* interfaceDescriptor,
|
||||
AIBinder_Class_onTransact onTransact);
|
||||
|
||||
private:
|
||||
class ICInterfaceData {
|
||||
public:
|
||||
std::shared_ptr<ICInterface> interface;
|
||||
|
||||
static inline std::shared_ptr<ICInterface> getInterface(AIBinder* binder);
|
||||
|
||||
static inline void* onCreate(void* args);
|
||||
static inline void onDestroy(void* userData);
|
||||
static inline binder_status_t onDump(AIBinder* binder, int fd, const char** args,
|
||||
uint32_t numArgs);
|
||||
|
||||
#ifdef HAS_BINDER_SHELL_COMMAND
|
||||
static inline binder_status_t handleShellCommand(AIBinder* binder, int in, int out, int err,
|
||||
const char** argv, uint32_t argc);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* implementation of IInterface for server (n = native)
|
||||
*/
|
||||
template <typename INTERFACE>
|
||||
class BnCInterface : public INTERFACE {
|
||||
public:
|
||||
BnCInterface() {}
|
||||
virtual ~BnCInterface() {}
|
||||
|
||||
SpAIBinder asBinder() override final;
|
||||
|
||||
bool isRemote() override final { return false; }
|
||||
|
||||
static std::string makeServiceName(std::string_view instance) {
|
||||
return INTERFACE::descriptor + ("/" + std::string(instance));
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* This function should only be called by asBinder. Otherwise, there is a possibility of
|
||||
* multiple AIBinder* objects being created for the same instance of an object.
|
||||
*/
|
||||
virtual SpAIBinder createBinder() = 0;
|
||||
|
||||
private:
|
||||
std::mutex mMutex; // for asBinder
|
||||
ScopedAIBinder_Weak mWeakBinder;
|
||||
};
|
||||
|
||||
/**
|
||||
* implementation of IInterface for client (p = proxy)
|
||||
*/
|
||||
template <typename INTERFACE>
|
||||
class BpCInterface : public INTERFACE {
|
||||
public:
|
||||
explicit BpCInterface(const SpAIBinder& binder) : mBinder(binder) {}
|
||||
virtual ~BpCInterface() {}
|
||||
|
||||
SpAIBinder asBinder() override final;
|
||||
|
||||
bool isRemote() override final { return AIBinder_isRemote(mBinder.get()); }
|
||||
|
||||
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override {
|
||||
return AIBinder_dump(asBinder().get(), fd, args, numArgs);
|
||||
}
|
||||
|
||||
private:
|
||||
SpAIBinder mBinder;
|
||||
};
|
||||
|
||||
// END OF CLASS DECLARATIONS
|
||||
|
||||
binder_status_t ICInterface::dump(int /*fd*/, const char** /*args*/, uint32_t /*numArgs*/) {
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
#ifdef HAS_BINDER_SHELL_COMMAND
|
||||
binder_status_t ICInterface::handleShellCommand(int /*in*/, int /*out*/, int /*err*/,
|
||||
const char** /*argv*/, uint32_t /*argc*/) {
|
||||
return STATUS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::shared_ptr<ICInterface> ICInterface::asInterface(AIBinder* binder) {
|
||||
return ICInterfaceData::getInterface(binder);
|
||||
}
|
||||
|
||||
AIBinder_Class* ICInterface::defineClass(const char* interfaceDescriptor,
|
||||
AIBinder_Class_onTransact onTransact) {
|
||||
AIBinder_Class* clazz = AIBinder_Class_define(interfaceDescriptor, ICInterfaceData::onCreate,
|
||||
ICInterfaceData::onDestroy, onTransact);
|
||||
if (clazz == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We can't know if these methods are overridden by a subclass interface, so we must register
|
||||
// ourselves. The defaults are harmless.
|
||||
AIBinder_Class_setOnDump(clazz, ICInterfaceData::onDump);
|
||||
#ifdef HAS_BINDER_SHELL_COMMAND
|
||||
#ifdef __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__
|
||||
if (__builtin_available(android 30, *)) {
|
||||
#else
|
||||
if (__ANDROID_API__ >= 30) {
|
||||
#endif
|
||||
AIBinder_Class_setHandleShellCommand(clazz, ICInterfaceData::handleShellCommand);
|
||||
}
|
||||
#endif
|
||||
return clazz;
|
||||
}
|
||||
|
||||
std::shared_ptr<ICInterface> ICInterface::ICInterfaceData::getInterface(AIBinder* binder) {
|
||||
if (binder == nullptr) return nullptr;
|
||||
|
||||
void* userData = AIBinder_getUserData(binder);
|
||||
if (userData == nullptr) return nullptr;
|
||||
|
||||
return static_cast<ICInterfaceData*>(userData)->interface;
|
||||
}
|
||||
|
||||
void* ICInterface::ICInterfaceData::onCreate(void* args) {
|
||||
std::shared_ptr<ICInterface> interface = static_cast<ICInterface*>(args)->ref<ICInterface>();
|
||||
ICInterfaceData* data = new ICInterfaceData{interface};
|
||||
return static_cast<void*>(data);
|
||||
}
|
||||
|
||||
void ICInterface::ICInterfaceData::onDestroy(void* userData) {
|
||||
delete static_cast<ICInterfaceData*>(userData);
|
||||
}
|
||||
|
||||
binder_status_t ICInterface::ICInterfaceData::onDump(AIBinder* binder, int fd, const char** args,
|
||||
uint32_t numArgs) {
|
||||
std::shared_ptr<ICInterface> interface = getInterface(binder);
|
||||
if (interface != nullptr) {
|
||||
return interface->dump(fd, args, numArgs);
|
||||
}
|
||||
return STATUS_DEAD_OBJECT;
|
||||
}
|
||||
|
||||
#ifdef HAS_BINDER_SHELL_COMMAND
|
||||
binder_status_t ICInterface::ICInterfaceData::handleShellCommand(AIBinder* binder, int in, int out,
|
||||
int err, const char** argv,
|
||||
uint32_t argc) {
|
||||
std::shared_ptr<ICInterface> interface = getInterface(binder);
|
||||
if (interface != nullptr) {
|
||||
return interface->handleShellCommand(in, out, err, argv, argc);
|
||||
}
|
||||
return STATUS_DEAD_OBJECT;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename INTERFACE>
|
||||
SpAIBinder BnCInterface<INTERFACE>::asBinder() {
|
||||
std::lock_guard<std::mutex> l(mMutex);
|
||||
|
||||
SpAIBinder binder;
|
||||
if (mWeakBinder.get() != nullptr) {
|
||||
binder.set(AIBinder_Weak_promote(mWeakBinder.get()));
|
||||
}
|
||||
if (binder.get() == nullptr) {
|
||||
binder = createBinder();
|
||||
mWeakBinder.set(AIBinder_Weak_new(binder.get()));
|
||||
}
|
||||
|
||||
return binder;
|
||||
}
|
||||
|
||||
template <typename INTERFACE>
|
||||
SpAIBinder BpCInterface<INTERFACE>::asBinder() {
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
} // namespace ndk
|
||||
|
||||
// Once minSdkVersion is 30, we are guaranteed to be building with the
|
||||
// Android 11 AIDL compiler which supports the SharedRefBase::make API.
|
||||
#if !defined(__ANDROID_API__) || __ANDROID_API__ >= 30 || defined(__ANDROID_APEX__)
|
||||
namespace ndk::internal {
|
||||
template <typename T, typename = void>
|
||||
struct is_complete_type : std::false_type {};
|
||||
|
||||
template <typename T>
|
||||
struct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_type {};
|
||||
} // namespace ndk::internal
|
||||
|
||||
namespace std {
|
||||
|
||||
// Define `SharedRefBase` specific versions of `std::make_shared` and
|
||||
// `std::make_unique` to block people from using them. Using them to allocate
|
||||
// `ndk::SharedRefBase` objects results in double ownership. Use
|
||||
// `ndk::SharedRefBase::make<T>(...)` instead.
|
||||
//
|
||||
// Note: We exclude incomplete types because `std::is_base_of` is undefined in
|
||||
// that case.
|
||||
|
||||
template <typename T, typename... Args,
|
||||
std::enable_if_t<ndk::internal::is_complete_type<T>::value, bool> = true,
|
||||
std::enable_if_t<std::is_base_of<ndk::SharedRefBase, T>::value, bool> = true>
|
||||
shared_ptr<T> make_shared(Args...) { // SEE COMMENT ABOVE.
|
||||
static_assert(!std::is_base_of<ndk::SharedRefBase, T>::value);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args,
|
||||
std::enable_if_t<ndk::internal::is_complete_type<T>::value, bool> = true,
|
||||
std::enable_if_t<std::is_base_of<ndk::SharedRefBase, T>::value, bool> = true>
|
||||
unique_ptr<T> make_unique(Args...) { // SEE COMMENT ABOVE.
|
||||
static_assert(!std::is_base_of<ndk::SharedRefBase, T>::value);
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_internal_logging.h
|
||||
* @brief This provides the ability to use syslog from binder headers, since
|
||||
* other logging functionality might be inaccessable.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// defined differently by liblog
|
||||
#pragma push_macro("LOG_PRI")
|
||||
#ifdef LOG_PRI
|
||||
#undef LOG_PRI
|
||||
#endif
|
||||
#include <syslog.h>
|
||||
#pragma pop_macro("LOG_PRI")
|
||||
|
||||
/** @} */
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_parcel_jni.h
|
||||
* @brief Conversions between AParcel and android.os.Parcel
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/binder_parcel.h>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Converts an android.os.Parcel object into an AParcel* object.
|
||||
*
|
||||
* If the parcel is null, null is returned.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*
|
||||
* \param env Java environment. Must not be null.
|
||||
* \param parcel android.os.Parcel java object.
|
||||
*
|
||||
* \return an AParcel object representing the Java parcel object. If either parameter is null, this
|
||||
* will return null. This must be deleted with AParcel_delete. This does not take ownership of the
|
||||
* jobject and is only good for as long as the jobject is alive.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AParcel* AParcel_fromJavaParcel(JNIEnv* env, jobject parcel)
|
||||
__INTRODUCED_IN(30);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/** @} */
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_parcelable_utils.h
|
||||
* @brief Helper for parcelable.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <android/binder_parcel_utils.h>
|
||||
#include <optional>
|
||||
|
||||
namespace ndk {
|
||||
// Also see Parcelable.h in libbinder.
|
||||
typedef int32_t parcelable_stability_t;
|
||||
enum {
|
||||
STABILITY_LOCAL,
|
||||
STABILITY_VINTF, // corresponds to @VintfStability
|
||||
};
|
||||
#define RETURN_ON_FAILURE(expr) \
|
||||
do { \
|
||||
binder_status_t _status = (expr); \
|
||||
if (_status != STATUS_OK) return _status; \
|
||||
} while (false)
|
||||
|
||||
// AParcelableHolder has been introduced in 31.
|
||||
#if __ANDROID_API__ >= 31
|
||||
class AParcelableHolder {
|
||||
public:
|
||||
AParcelableHolder() = delete;
|
||||
explicit AParcelableHolder(parcelable_stability_t stability)
|
||||
: mParcel(AParcel_create()), mStability(stability) {}
|
||||
|
||||
AParcelableHolder(const AParcelableHolder& other)
|
||||
: mParcel(AParcel_create()), mStability(other.mStability) {
|
||||
AParcel_appendFrom(other.mParcel.get(), this->mParcel.get(), 0,
|
||||
AParcel_getDataSize(other.mParcel.get()));
|
||||
}
|
||||
|
||||
AParcelableHolder(AParcelableHolder&& other) = default;
|
||||
virtual ~AParcelableHolder() = default;
|
||||
|
||||
binder_status_t writeToParcel(AParcel* parcel) const {
|
||||
RETURN_ON_FAILURE(AParcel_writeInt32(parcel, static_cast<int32_t>(this->mStability)));
|
||||
int32_t size = AParcel_getDataSize(this->mParcel.get());
|
||||
RETURN_ON_FAILURE(AParcel_writeInt32(parcel, size));
|
||||
size = AParcel_getDataSize(this->mParcel.get());
|
||||
RETURN_ON_FAILURE(AParcel_appendFrom(this->mParcel.get(), parcel, 0, size));
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
binder_status_t readFromParcel(const AParcel* parcel) {
|
||||
AParcel_reset(mParcel.get());
|
||||
|
||||
parcelable_stability_t wireStability;
|
||||
RETURN_ON_FAILURE(AParcel_readInt32(parcel, &wireStability));
|
||||
if (this->mStability != wireStability) {
|
||||
return STATUS_BAD_VALUE;
|
||||
}
|
||||
|
||||
int32_t dataSize;
|
||||
binder_status_t status = AParcel_readInt32(parcel, &dataSize);
|
||||
|
||||
if (status != STATUS_OK || dataSize < 0) {
|
||||
return status != STATUS_OK ? status : STATUS_BAD_VALUE;
|
||||
}
|
||||
|
||||
int32_t dataStartPos = AParcel_getDataPosition(parcel);
|
||||
|
||||
if (dataStartPos > INT32_MAX - dataSize) {
|
||||
return STATUS_BAD_VALUE;
|
||||
}
|
||||
|
||||
status = AParcel_appendFrom(parcel, mParcel.get(), dataStartPos, dataSize);
|
||||
if (status != STATUS_OK) {
|
||||
return status;
|
||||
}
|
||||
return AParcel_setDataPosition(parcel, dataStartPos + dataSize);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
binder_status_t setParcelable(const T& p) {
|
||||
if (this->mStability > T::_aidl_stability) {
|
||||
return STATUS_BAD_VALUE;
|
||||
}
|
||||
AParcel_reset(mParcel.get());
|
||||
AParcel_writeString(mParcel.get(), T::descriptor, strlen(T::descriptor));
|
||||
p.writeToParcel(mParcel.get());
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
binder_status_t getParcelable(std::optional<T>* ret) const {
|
||||
const std::string parcelableDesc(T::descriptor);
|
||||
AParcel_setDataPosition(mParcel.get(), 0);
|
||||
if (AParcel_getDataSize(mParcel.get()) == 0) {
|
||||
*ret = std::nullopt;
|
||||
return STATUS_OK;
|
||||
}
|
||||
std::string parcelableDescInParcel;
|
||||
binder_status_t status = AParcel_readString(mParcel.get(), &parcelableDescInParcel);
|
||||
if (status != STATUS_OK || parcelableDesc != parcelableDescInParcel) {
|
||||
*ret = std::nullopt;
|
||||
return status;
|
||||
}
|
||||
*ret = std::make_optional<T>();
|
||||
status = (*ret)->readFromParcel(this->mParcel.get());
|
||||
if (status != STATUS_OK) {
|
||||
*ret = std::nullopt;
|
||||
return status;
|
||||
}
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
void reset() { AParcel_reset(mParcel.get()); }
|
||||
|
||||
inline bool operator!=(const AParcelableHolder& rhs) const { return this != &rhs; }
|
||||
inline bool operator<(const AParcelableHolder& rhs) const { return this < &rhs; }
|
||||
inline bool operator<=(const AParcelableHolder& rhs) const { return this <= &rhs; }
|
||||
inline bool operator==(const AParcelableHolder& rhs) const { return this == &rhs; }
|
||||
inline bool operator>(const AParcelableHolder& rhs) const { return this > &rhs; }
|
||||
inline bool operator>=(const AParcelableHolder& rhs) const { return this >= &rhs; }
|
||||
inline AParcelableHolder& operator=(const AParcelableHolder& rhs) {
|
||||
this->reset();
|
||||
if (this->mStability != rhs.mStability) {
|
||||
syslog(LOG_ERR, "AParcelableHolder stability mismatch: this %d rhs %d!",
|
||||
this->mStability, rhs.mStability);
|
||||
abort();
|
||||
}
|
||||
AParcel_appendFrom(rhs.mParcel.get(), this->mParcel.get(), 0,
|
||||
AParcel_getDataSize(rhs.mParcel.get()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable ndk::ScopedAParcel mParcel;
|
||||
parcelable_stability_t mStability;
|
||||
};
|
||||
#endif // __ANDROID_API__ >= 31
|
||||
|
||||
#undef RETURN_ON_FAILURE
|
||||
} // namespace ndk
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,315 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_status.h
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if !defined(__BIONIC__) && defined(BINDER_ENABLE_LIBLOG_ASSERT)
|
||||
#include <log/log.h>
|
||||
#define __assert(file, line, message) LOG_ALWAYS_FATAL(file ":" #line ": " message)
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#ifndef __BIONIC__
|
||||
|
||||
#ifndef __INTRODUCED_IN
|
||||
#define __INTRODUCED_IN(n)
|
||||
#endif
|
||||
|
||||
#ifndef __assert
|
||||
#define __assert(a, b, c) \
|
||||
do { \
|
||||
syslog(LOG_ERR, a ": " c); \
|
||||
abort(); \
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
#ifndef __ANDROID_API__
|
||||
#define __ANDROID_API__ 10000
|
||||
#endif
|
||||
|
||||
#endif // __BIONIC__
|
||||
|
||||
/**
|
||||
* Low-level status types for use in binder. This is the least preferable way to
|
||||
* return an error for binder services (where binder_exception_t should be used,
|
||||
* particularly EX_SERVICE_SPECIFIC).
|
||||
*/
|
||||
enum {
|
||||
STATUS_OK = 0,
|
||||
|
||||
STATUS_UNKNOWN_ERROR = (-2147483647 - 1), // INT32_MIN value
|
||||
STATUS_NO_MEMORY = -ENOMEM,
|
||||
STATUS_INVALID_OPERATION = -ENOSYS,
|
||||
STATUS_BAD_VALUE = -EINVAL,
|
||||
STATUS_BAD_TYPE = (STATUS_UNKNOWN_ERROR + 1),
|
||||
STATUS_NAME_NOT_FOUND = -ENOENT,
|
||||
STATUS_PERMISSION_DENIED = -EPERM,
|
||||
STATUS_NO_INIT = -ENODEV,
|
||||
STATUS_ALREADY_EXISTS = -EEXIST,
|
||||
STATUS_DEAD_OBJECT = -EPIPE,
|
||||
STATUS_FAILED_TRANSACTION = (STATUS_UNKNOWN_ERROR + 2),
|
||||
STATUS_BAD_INDEX = -EOVERFLOW,
|
||||
STATUS_NOT_ENOUGH_DATA = -ENODATA,
|
||||
STATUS_WOULD_BLOCK = -EWOULDBLOCK,
|
||||
STATUS_TIMED_OUT = -ETIMEDOUT,
|
||||
STATUS_UNKNOWN_TRANSACTION = -EBADMSG,
|
||||
STATUS_FDS_NOT_ALLOWED = (STATUS_UNKNOWN_ERROR + 7),
|
||||
STATUS_UNEXPECTED_NULL = (STATUS_UNKNOWN_ERROR + 8),
|
||||
};
|
||||
|
||||
/**
|
||||
* One of the STATUS_* values.
|
||||
*
|
||||
* All unrecognized values are coerced into STATUS_UNKNOWN_ERROR.
|
||||
*/
|
||||
typedef int32_t binder_status_t;
|
||||
|
||||
/**
|
||||
* Top level exceptions types for Android binder errors, mapping to Java
|
||||
* exceptions. Also see Parcel.java.
|
||||
*/
|
||||
enum {
|
||||
EX_NONE = 0,
|
||||
EX_SECURITY = -1,
|
||||
EX_BAD_PARCELABLE = -2,
|
||||
EX_ILLEGAL_ARGUMENT = -3,
|
||||
EX_NULL_POINTER = -4,
|
||||
EX_ILLEGAL_STATE = -5,
|
||||
EX_NETWORK_MAIN_THREAD = -6,
|
||||
EX_UNSUPPORTED_OPERATION = -7,
|
||||
EX_SERVICE_SPECIFIC = -8,
|
||||
EX_PARCELABLE = -9,
|
||||
|
||||
/**
|
||||
* This is special, and indicates to native binder proxies that the
|
||||
* transaction has failed at a low level.
|
||||
*/
|
||||
EX_TRANSACTION_FAILED = -129,
|
||||
};
|
||||
|
||||
/**
|
||||
* One of the EXCEPTION_* types.
|
||||
*
|
||||
* All unrecognized values are coerced into EXCEPTION_TRANSACTION_FAILED.
|
||||
*
|
||||
* These exceptions values are used by the SDK for parcelables. Also see Parcel.java.
|
||||
*/
|
||||
typedef int32_t binder_exception_t;
|
||||
|
||||
/**
|
||||
* This is a helper class that encapsulates a standard way to keep track of and chain binder errors
|
||||
* along with service specific errors.
|
||||
*
|
||||
* It is not required to be used in order to parcel/receive transactions, but it is required in
|
||||
* order to be compatible with standard AIDL transactions since it is written as the header to the
|
||||
* out parcel for transactions which get executed (don't fail during unparceling of input arguments
|
||||
* or sooner).
|
||||
*/
|
||||
struct AStatus;
|
||||
typedef struct AStatus AStatus;
|
||||
|
||||
/**
|
||||
* New status which is considered a success.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \return a newly constructed status object that the caller owns.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AStatus* AStatus_newOk() __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* New status with exception code.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param exception the code that this status should represent. If this is EX_NONE, then this
|
||||
* constructs an non-error status object.
|
||||
*
|
||||
* \return a newly constructed status object that the caller owns.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AStatus* AStatus_fromExceptionCode(binder_exception_t exception)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* New status with exception code and message.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param exception the code that this status should represent. If this is EX_NONE, then this
|
||||
* constructs an non-error status object.
|
||||
* \param message the error message to associate with this status object.
|
||||
*
|
||||
* \return a newly constructed status object that the caller owns.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AStatus* AStatus_fromExceptionCodeWithMessage(
|
||||
binder_exception_t exception, const char* message) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* New status with a service speciic error.
|
||||
*
|
||||
* This is considered to be EX_TRANSACTION_FAILED with extra information.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param serviceSpecific an implementation defined error code.
|
||||
*
|
||||
* \return a newly constructed status object that the caller owns.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AStatus* AStatus_fromServiceSpecificError(
|
||||
int32_t serviceSpecific) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* New status with a service specific error and message.
|
||||
*
|
||||
* This is considered to be EX_TRANSACTION_FAILED with extra information.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param serviceSpecific an implementation defined error code.
|
||||
* \param message the error message to associate with this status object.
|
||||
*
|
||||
* \return a newly constructed status object that the caller owns.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AStatus* AStatus_fromServiceSpecificErrorWithMessage(
|
||||
int32_t serviceSpecific, const char* message) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* New status with binder_status_t. This is typically for low level failures when a binder_status_t
|
||||
* is returned by an API on AIBinder or AParcel, and that is to be returned from a method returning
|
||||
* an AStatus instance. This is the least preferable way to return errors.
|
||||
* Prefer exceptions (particularly service-specific errors) when possible.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param status a low-level error to associate with this status object.
|
||||
*
|
||||
* \return a newly constructed status object that the caller owns.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) AStatus* AStatus_fromStatus(binder_status_t status)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Whether this object represents a successful transaction. If this function returns true, then
|
||||
* AStatus_getExceptionCode will return EX_NONE.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param status the status being queried.
|
||||
*
|
||||
* \return whether the status represents a successful transaction. For more details, see below.
|
||||
*/
|
||||
bool AStatus_isOk(const AStatus* status) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* The exception that this status object represents.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param status the status being queried.
|
||||
*
|
||||
* \return the exception code that this object represents.
|
||||
*/
|
||||
binder_exception_t AStatus_getExceptionCode(const AStatus* status) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* The service specific error if this object represents one. This function will only ever return a
|
||||
* non-zero result if AStatus_getExceptionCode returns EX_SERVICE_SPECIFIC. If this function returns
|
||||
* 0, the status object may still represent a different exception or status. To find out if this
|
||||
* transaction as a whole is okay, use AStatus_isOk instead.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param status the status being queried.
|
||||
*
|
||||
* \return the service-specific error code if the exception code is EX_SERVICE_SPECIFIC or 0.
|
||||
*/
|
||||
int32_t AStatus_getServiceSpecificError(const AStatus* status) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* The status if this object represents one. This function will only ever return a non-zero result
|
||||
* if AStatus_getExceptionCode returns EX_TRANSACTION_FAILED. If this function return 0, the status
|
||||
* object may represent a different exception or a service specific error. To find out if this
|
||||
* transaction as a whole is okay, use AStatus_isOk instead.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param status the status being queried.
|
||||
*
|
||||
* \return the status code if the exception code is EX_TRANSACTION_FAILED or 0.
|
||||
*/
|
||||
binder_status_t AStatus_getStatus(const AStatus* status) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* If there is a message associated with this status, this will return that message. If there is no
|
||||
* message, this will return an empty string.
|
||||
*
|
||||
* The returned string has the lifetime of the status object passed into this function.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param status the status being queried.
|
||||
*
|
||||
* \return the message associated with this error.
|
||||
*/
|
||||
const char* AStatus_getMessage(const AStatus* status) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Get human-readable description for debugging.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*
|
||||
* \param status the status being queried.
|
||||
*
|
||||
* \return a description, must be deleted with AStatus_deleteDescription.
|
||||
*/
|
||||
__attribute__((warn_unused_result)) const char* AStatus_getDescription(const AStatus* status)
|
||||
__INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Delete description.
|
||||
*
|
||||
* \param description value from AStatus_getDescription
|
||||
*/
|
||||
void AStatus_deleteDescription(const char* description) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Deletes memory associated with the status instance.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param status the status to delete, returned from AStatus_newOk or one of the AStatus_from* APIs.
|
||||
*/
|
||||
void AStatus_delete(AStatus* status) __INTRODUCED_IN(29);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NdkBinder
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file binder_to_string.h
|
||||
* @brief Helper for parcelable.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#if __has_include(<utils/StrongPointer.h>)
|
||||
#include <utils/StrongPointer.h>
|
||||
#define HAS_STRONG_POINTER
|
||||
#endif
|
||||
|
||||
#if __has_include(<utils/String16.h>)
|
||||
#include <utils/String16.h>
|
||||
#define HAS_STRING16
|
||||
#endif
|
||||
|
||||
#if __has_include(<android/binder_ibinder.h>)
|
||||
#include <android/binder_auto_utils.h>
|
||||
#include <android/binder_interface_utils.h>
|
||||
#include <android/binder_parcelable_utils.h>
|
||||
#define HAS_NDK_INTERFACE
|
||||
#endif
|
||||
|
||||
// TODO: some things include libbinder without having access to libbase. This is
|
||||
// due to frameworks/native/include, which symlinks to libbinder headers, so even
|
||||
// though we don't use it here, we detect a different header, so that we are more
|
||||
// confident libbase will be included
|
||||
#if __has_include(<binder/RpcSession.h>)
|
||||
#include <binder/IBinder.h>
|
||||
#include <binder/IInterface.h>
|
||||
#define HAS_CPP_INTERFACE
|
||||
#endif
|
||||
|
||||
namespace android {
|
||||
namespace internal {
|
||||
|
||||
// ToString is a utility to generate string representation for various AIDL-supported types.
|
||||
template <typename _T>
|
||||
std::string ToString(const _T& t);
|
||||
|
||||
namespace details {
|
||||
|
||||
// Truthy if _T has toString() method.
|
||||
template <typename _T>
|
||||
class HasToStringMethod {
|
||||
template <typename _U>
|
||||
static auto _test(int) -> decltype(std::declval<_U>().toString(), std::true_type());
|
||||
template <typename _U>
|
||||
static std::false_type _test(...);
|
||||
|
||||
public:
|
||||
enum { value = decltype(_test<_T>(0))::value };
|
||||
};
|
||||
|
||||
// Truthy if _T has a overloaded toString(T)
|
||||
template <typename _T>
|
||||
class HasToStringFunction {
|
||||
template <typename _U>
|
||||
static auto _test(int) -> decltype(toString(std::declval<_U>()), std::true_type());
|
||||
template <typename _U>
|
||||
static std::false_type _test(...);
|
||||
|
||||
public:
|
||||
enum { value = decltype(_test<_T>(0))::value };
|
||||
};
|
||||
|
||||
template <typename T, template <typename...> typename U>
|
||||
struct IsInstantiationOf : std::false_type {};
|
||||
|
||||
template <template <typename...> typename U, typename... Args>
|
||||
struct IsInstantiationOf<U<Args...>, U> : std::true_type {};
|
||||
|
||||
// Truthy if _T is like a pointer: one of sp/optional/shared_ptr
|
||||
template <typename _T>
|
||||
class IsPointerLike {
|
||||
template <typename _U>
|
||||
static std::enable_if_t<
|
||||
#ifdef HAS_STRONG_POINTER
|
||||
IsInstantiationOf<_U, sp>::value || // for IBinder and interface types in the C++
|
||||
// backend
|
||||
#endif
|
||||
IsInstantiationOf<_U, std::optional>::value || // for @nullable types in the
|
||||
// C++/NDK backends
|
||||
IsInstantiationOf<_U, std::unique_ptr>::value || // for @nullable(heap=true)
|
||||
// in C++/NDK backends
|
||||
IsInstantiationOf<_U, std::shared_ptr>::value, // for interface types in the
|
||||
// NDK backends
|
||||
|
||||
std::true_type>
|
||||
_test(int);
|
||||
template <typename _U>
|
||||
static std::false_type _test(...);
|
||||
|
||||
public:
|
||||
enum { value = decltype(_test<_T>(0))::value };
|
||||
};
|
||||
|
||||
// Truthy if _T is like a container
|
||||
template <typename _T>
|
||||
class IsIterable {
|
||||
template <typename _U>
|
||||
static auto _test(int)
|
||||
-> decltype(begin(std::declval<_U>()), end(std::declval<_U>()), std::true_type());
|
||||
template <typename _U>
|
||||
static std::false_type _test(...);
|
||||
|
||||
public:
|
||||
enum { value = decltype(_test<_T>(0))::value };
|
||||
};
|
||||
|
||||
template <typename _T>
|
||||
struct TypeDependentFalse {
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
|
||||
template <typename _T>
|
||||
std::string ToString(const _T& t) {
|
||||
if constexpr (std::is_same_v<bool, _T>) {
|
||||
return t ? "true" : "false";
|
||||
} else if constexpr (std::is_same_v<char16_t, _T>) {
|
||||
// TODO(b/244494451): codecvt is deprecated in C++17 -- suppress the
|
||||
// warnings. There's no replacement in the standard library yet.
|
||||
_Pragma("clang diagnostic push")
|
||||
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"");
|
||||
return std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>().to_bytes(t);
|
||||
_Pragma("clang diagnostic pop");
|
||||
} else if constexpr (std::is_arithmetic_v<_T>) {
|
||||
return std::to_string(t);
|
||||
} else if constexpr (std::is_same_v<std::string, _T>) {
|
||||
return t;
|
||||
#ifdef HAS_NDK_INTERFACE
|
||||
} else if constexpr (std::is_same_v<::ndk::SpAIBinder, _T>) {
|
||||
std::stringstream ss;
|
||||
ss << "binder:" << std::hex << t.get();
|
||||
return ss.str();
|
||||
} else if constexpr (std::is_same_v<::ndk::ScopedFileDescriptor, _T>) {
|
||||
return "fd:" + std::to_string(t.get());
|
||||
} else if constexpr (std::is_base_of_v<::ndk::ICInterface, _T>) {
|
||||
// TODO(b/266248339): this format is to make it easy to handle resolv_integration_test
|
||||
// freezing the output format. We would like to print more info.
|
||||
return "<interface>";
|
||||
#if __ANDROID_API__ >= 31
|
||||
} else if constexpr (std::is_same_v<::ndk::AParcelableHolder, _T>) {
|
||||
return "AParcelableHolder";
|
||||
#endif
|
||||
#endif // HAS_NDK_INTERFACE
|
||||
#ifdef HAS_CPP_INTERFACE
|
||||
} else if constexpr (std::is_base_of_v<IInterface, _T>) {
|
||||
std::stringstream ss;
|
||||
ss << "interface:" << std::hex << &t;
|
||||
return ss.str();
|
||||
} else if constexpr (std::is_same_v<IBinder, _T>) {
|
||||
std::stringstream ss;
|
||||
ss << "binder:" << std::hex << &t;
|
||||
return ss.str();
|
||||
#endif
|
||||
#ifdef HAS_STRING16
|
||||
} else if constexpr (std::is_same_v<String16, _T>) {
|
||||
std::stringstream out;
|
||||
out << t;
|
||||
return out.str();
|
||||
#endif
|
||||
} else if constexpr (details::IsPointerLike<_T>::value || std::is_pointer_v<_T>) {
|
||||
if (!t) return "(null)";
|
||||
std::stringstream out;
|
||||
out << ToString(*t);
|
||||
return out.str();
|
||||
} else if constexpr (details::HasToStringMethod<_T>::value) {
|
||||
return t.toString();
|
||||
} else if constexpr (details::HasToStringFunction<_T>::value) {
|
||||
return toString(t);
|
||||
} else if constexpr (details::IsIterable<_T>::value) {
|
||||
std::stringstream out;
|
||||
bool first = true;
|
||||
out << "[";
|
||||
for (const auto& e : t) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
out << ", ";
|
||||
}
|
||||
// Use explicit type parameter in case deref of iterator has different type
|
||||
// e.g. vector<bool>
|
||||
out << ToString<typename _T::value_type>(e);
|
||||
}
|
||||
out << "]";
|
||||
return out.str();
|
||||
} else {
|
||||
static_assert(details::TypeDependentFalse<_T>::value, "no toString implemented, huh?");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace android
|
||||
|
||||
#ifdef HAS_STRONG_POINTER
|
||||
#undef HAS_STRONG_POINTER
|
||||
#endif
|
||||
|
||||
#ifdef HAS_STRING16
|
||||
#undef HAS_STRING16
|
||||
#endif
|
||||
|
||||
#ifdef HAS_NDK_INTERFACE
|
||||
#undef HAS_NDK_INTERFACE
|
||||
#endif
|
||||
|
||||
#ifdef HAS_CPP_INTERFACE
|
||||
#undef HAS_CPP_INTERFACE
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,265 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Bitmap
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bitmap.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_BITMAP_H
|
||||
#define ANDROID_BITMAP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <jni.h>
|
||||
|
||||
#if !defined(__INTRODUCED_IN)
|
||||
#define __INTRODUCED_IN(__api_level) /* nothing */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** AndroidBitmap functions result code. */
|
||||
enum {
|
||||
/** Operation was successful. */
|
||||
ANDROID_BITMAP_RESULT_SUCCESS = 0,
|
||||
/** Bad parameter. */
|
||||
ANDROID_BITMAP_RESULT_BAD_PARAMETER = -1,
|
||||
/** JNI exception occured. */
|
||||
ANDROID_BITMAP_RESULT_JNI_EXCEPTION = -2,
|
||||
/** Allocation failed. */
|
||||
ANDROID_BITMAP_RESULT_ALLOCATION_FAILED = -3,
|
||||
};
|
||||
|
||||
/** Backward compatibility: this macro used to be misspelled. */
|
||||
#define ANDROID_BITMAP_RESUT_SUCCESS ANDROID_BITMAP_RESULT_SUCCESS
|
||||
|
||||
/** Bitmap pixel format. */
|
||||
enum AndroidBitmapFormat {
|
||||
/** No format. */
|
||||
ANDROID_BITMAP_FORMAT_NONE = 0,
|
||||
/** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Alpha: 8 bits. **/
|
||||
ANDROID_BITMAP_FORMAT_RGBA_8888 = 1,
|
||||
/** Red: 5 bits, Green: 6 bits, Blue: 5 bits. **/
|
||||
ANDROID_BITMAP_FORMAT_RGB_565 = 4,
|
||||
/** Deprecated in API level 13. Because of the poor quality of this configuration, it is advised to use ARGB_8888 instead. **/
|
||||
ANDROID_BITMAP_FORMAT_RGBA_4444 = 7,
|
||||
/** Alpha: 8 bits. */
|
||||
ANDROID_BITMAP_FORMAT_A_8 = 8,
|
||||
/** Each component is stored as a half float. **/
|
||||
ANDROID_BITMAP_FORMAT_RGBA_F16 = 9,
|
||||
/** Red: 10 bits, Green: 10 bits, Blue: 10 bits, Alpha: 2 bits. **/
|
||||
ANDROID_BITMAP_FORMAT_RGBA_1010102 = 10,
|
||||
};
|
||||
|
||||
/** Bitmap alpha format */
|
||||
enum {
|
||||
/** Pixel components are premultiplied by alpha. */
|
||||
ANDROID_BITMAP_FLAGS_ALPHA_PREMUL = 0,
|
||||
/** Pixels are opaque. */
|
||||
ANDROID_BITMAP_FLAGS_ALPHA_OPAQUE = 1,
|
||||
/** Pixel components are independent of alpha. */
|
||||
ANDROID_BITMAP_FLAGS_ALPHA_UNPREMUL = 2,
|
||||
/** Bit mask for AndroidBitmapFormat.flags to isolate the alpha. */
|
||||
ANDROID_BITMAP_FLAGS_ALPHA_MASK = 0x3,
|
||||
/** Shift for AndroidBitmapFormat.flags to isolate the alpha. */
|
||||
ANDROID_BITMAP_FLAGS_ALPHA_SHIFT = 0,
|
||||
};
|
||||
|
||||
enum {
|
||||
/** If this bit is set in AndroidBitmapInfo.flags, the Bitmap uses the
|
||||
* HARDWARE Config, and its {@link AHardwareBuffer} can be retrieved via
|
||||
* {@link AndroidBitmap_getHardwareBuffer}.
|
||||
*/
|
||||
ANDROID_BITMAP_FLAGS_IS_HARDWARE = 1 << 31,
|
||||
};
|
||||
|
||||
/** Bitmap info, see AndroidBitmap_getInfo(). */
|
||||
typedef struct {
|
||||
/** The bitmap width in pixels. */
|
||||
uint32_t width;
|
||||
/** The bitmap height in pixels. */
|
||||
uint32_t height;
|
||||
/** The number of byte per row. */
|
||||
uint32_t stride;
|
||||
/** The bitmap pixel format. See {@link AndroidBitmapFormat} */
|
||||
int32_t format;
|
||||
/** Bitfield containing information about the bitmap.
|
||||
*
|
||||
* <p>Two bits are used to encode alpha. Use {@link ANDROID_BITMAP_FLAGS_ALPHA_MASK}
|
||||
* and {@link ANDROID_BITMAP_FLAGS_ALPHA_SHIFT} to retrieve them.</p>
|
||||
*
|
||||
* <p>One bit is used to encode whether the Bitmap uses the HARDWARE Config. Use
|
||||
* {@link ANDROID_BITMAP_FLAGS_IS_HARDWARE} to know.</p>
|
||||
*
|
||||
* <p>These flags were introduced in API level 30.</p>
|
||||
*/
|
||||
uint32_t flags;
|
||||
} AndroidBitmapInfo;
|
||||
|
||||
/**
|
||||
* Given a java bitmap object, fill out the {@link AndroidBitmapInfo} struct for it.
|
||||
* If the call fails, the info parameter will be ignored.
|
||||
*/
|
||||
int AndroidBitmap_getInfo(JNIEnv* env, jobject jbitmap,
|
||||
AndroidBitmapInfo* info);
|
||||
|
||||
/**
|
||||
* Given a java bitmap object, return its {@link ADataSpace}.
|
||||
*
|
||||
* Note that {@link ADataSpace} only exposes a few values. This may return
|
||||
* {@link ADATASPACE_UNKNOWN}, even for Named ColorSpaces, if they have no
|
||||
* corresponding ADataSpace.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
int32_t AndroidBitmap_getDataSpace(JNIEnv* env, jobject jbitmap) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Given a java bitmap object, attempt to lock the pixel address.
|
||||
* Locking will ensure that the memory for the pixels will not move
|
||||
* until the unlockPixels call, and ensure that, if the pixels had been
|
||||
* previously purged, they will have been restored.
|
||||
*
|
||||
* If this call succeeds, it must be balanced by a call to
|
||||
* AndroidBitmap_unlockPixels, after which time the address of the pixels should
|
||||
* no longer be used.
|
||||
*
|
||||
* If this succeeds, *addrPtr will be set to the pixel address. If the call
|
||||
* fails, addrPtr will be ignored.
|
||||
*/
|
||||
int AndroidBitmap_lockPixels(JNIEnv* env, jobject jbitmap, void** addrPtr);
|
||||
|
||||
/**
|
||||
* Call this to balance a successful call to AndroidBitmap_lockPixels.
|
||||
*/
|
||||
int AndroidBitmap_unlockPixels(JNIEnv* env, jobject jbitmap);
|
||||
|
||||
// Note: these values match android.graphics.Bitmap#compressFormat.
|
||||
|
||||
/**
|
||||
* Specifies the formats that can be compressed to with
|
||||
* {@link AndroidBitmap_compress}.
|
||||
*/
|
||||
enum AndroidBitmapCompressFormat {
|
||||
/**
|
||||
* Compress to the JPEG format. quality of 0 means
|
||||
* compress for the smallest size. 100 means compress for max
|
||||
* visual quality.
|
||||
*/
|
||||
ANDROID_BITMAP_COMPRESS_FORMAT_JPEG = 0,
|
||||
/**
|
||||
* Compress to the PNG format. PNG is lossless, so quality is
|
||||
* ignored.
|
||||
*/
|
||||
ANDROID_BITMAP_COMPRESS_FORMAT_PNG = 1,
|
||||
/**
|
||||
* Compress to the WEBP lossy format. quality of 0 means
|
||||
* compress for the smallest size. 100 means compress for max
|
||||
* visual quality.
|
||||
*/
|
||||
ANDROID_BITMAP_COMPRESS_FORMAT_WEBP_LOSSY = 3,
|
||||
/**
|
||||
* Compress to the WEBP lossless format. quality refers to how
|
||||
* much effort to put into compression. A value of 0 means to
|
||||
* compress quickly, resulting in a relatively large file size.
|
||||
* 100 means to spend more time compressing, resulting in a
|
||||
* smaller file.
|
||||
*/
|
||||
ANDROID_BITMAP_COMPRESS_FORMAT_WEBP_LOSSLESS = 4,
|
||||
};
|
||||
|
||||
/**
|
||||
* User-defined function for writing the output of compression.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*
|
||||
* @param userContext Pointer to user-defined data passed to
|
||||
* {@link AndroidBitmap_compress}.
|
||||
* @param data Compressed data of `size` bytes to write.
|
||||
* @param size Length in bytes of data to write.
|
||||
* @return Whether the operation succeeded.
|
||||
*/
|
||||
typedef bool (*AndroidBitmap_CompressWriteFunc)(void* userContext,
|
||||
const void* data,
|
||||
size_t size) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Compress `pixels` as described by `info`.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*
|
||||
* @param info Description of the pixels to compress.
|
||||
* @param dataspace {@link ADataSpace} describing the color space of the
|
||||
* pixels.
|
||||
* @param pixels Pointer to pixels to compress.
|
||||
* @param format {@link AndroidBitmapCompressFormat} to compress to.
|
||||
* @param quality Hint to the compressor, 0-100. The value is interpreted
|
||||
* differently depending on the
|
||||
* {@link AndroidBitmapCompressFormat}.
|
||||
* @param userContext User-defined data which will be passed to the supplied
|
||||
* {@link AndroidBitmap_CompressWriteFunc} each time it is
|
||||
* called. May be null.
|
||||
* @param fn Function that writes the compressed data. Will be called each time
|
||||
* the compressor has compressed more data that is ready to be
|
||||
* written. May be called more than once for each call to this method.
|
||||
* May not be null.
|
||||
* @return AndroidBitmap functions result code.
|
||||
*/
|
||||
int AndroidBitmap_compress(const AndroidBitmapInfo* info,
|
||||
int32_t dataspace,
|
||||
const void* pixels,
|
||||
int32_t format, int32_t quality,
|
||||
void* userContext,
|
||||
AndroidBitmap_CompressWriteFunc fn) __INTRODUCED_IN(30);
|
||||
|
||||
struct AHardwareBuffer;
|
||||
typedef struct AHardwareBuffer AHardwareBuffer;
|
||||
|
||||
/**
|
||||
* Retrieve the native object associated with a HARDWARE Bitmap.
|
||||
*
|
||||
* Client must not modify it while a Bitmap is wrapping it.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*
|
||||
* @param env Handle to the JNI environment pointer.
|
||||
* @param bitmap Handle to an android.graphics.Bitmap.
|
||||
* @param outBuffer On success, is set to a pointer to the
|
||||
* {@link AHardwareBuffer} associated with bitmap. This acquires
|
||||
* a reference on the buffer, and the client must call
|
||||
* {@link AHardwareBuffer_release} when finished with it.
|
||||
* @return AndroidBitmap functions result code.
|
||||
* {@link ANDROID_BITMAP_RESULT_BAD_PARAMETER} if bitmap is not a
|
||||
* HARDWARE Bitmap.
|
||||
*/
|
||||
int AndroidBitmap_getHardwareBuffer(JNIEnv* env, jobject bitmap,
|
||||
AHardwareBuffer** outBuffer) __INTRODUCED_IN(30);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,349 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Choreographer
|
||||
*
|
||||
* Choreographer coordinates the timing of frame rendering. This is the C
|
||||
* version of the android.view.Choreographer object in Java. If you do not use
|
||||
* Choreographer to pace your render loop, you may render too quickly for the
|
||||
* display, increasing latency between frame submission and presentation.
|
||||
*
|
||||
* Input events are guaranteed to be processed before the frame callback is
|
||||
* called, and will not be run concurrently. Input and sensor events should not
|
||||
* be handled in the Choregrapher callback.
|
||||
*
|
||||
* The frame callback is also the appropriate place to run any per-frame state
|
||||
* update logic. For example, in a game, the frame callback should be
|
||||
* responsible for updating things like physics, AI, game state, and rendering
|
||||
* the frame. Input and sensors should be handled separately via callbacks
|
||||
* registered with AInputQueue and ASensorManager.
|
||||
*
|
||||
* As of API level 33, apps can follow proper frame pacing and even choose a future frame to render.
|
||||
* The API is used as follows:
|
||||
* 1. The app posts an {@link AChoreographer_vsyncCallback} to Choreographer to run on the next
|
||||
* frame.
|
||||
* 2. The callback is called when it is the time to start the frame with an {@link
|
||||
* AChoreographerFrameCallbackData} payload: information about multiple possible frame
|
||||
* timelines.
|
||||
* 3. Apps can choose a frame timeline from the {@link
|
||||
* AChoreographerFrameCallbackData} payload, depending on the frame deadline they can meet when
|
||||
* rendering the frame and their desired presentation time, and subsequently
|
||||
* {@link ASurfaceTransaction_setFrameTimeline notify SurfaceFlinger}
|
||||
* of the choice. Alternatively, for apps that do not choose a frame timeline, their frame would be
|
||||
* presented at the earliest possible timeline.
|
||||
* - The preferred frame timeline is the default frame
|
||||
* timeline that the platform scheduled for the app, based on device configuration.
|
||||
* 4. SurfaceFlinger attempts to follow the chosen frame timeline, by not applying transactions or
|
||||
* latching buffers before the desired presentation time.
|
||||
*
|
||||
* On older devices, AChoreographer_postFrameCallback64 or
|
||||
* AChoreographer_postFrameCallback can be used to lesser effect. They cannot be
|
||||
* used to precisely plan your render timeline, but will rate limit to avoid
|
||||
* overloading the display pipeline and increasing frame latency.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file choreographer.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_CHOREOGRAPHER_H
|
||||
#define ANDROID_CHOREOGRAPHER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
struct AChoreographer;
|
||||
/**
|
||||
* Opaque type that provides access to an AChoreographer object.
|
||||
*
|
||||
* A pointer can be obtained using {@link AChoreographer_getInstance()}.
|
||||
*/
|
||||
typedef struct AChoreographer AChoreographer;
|
||||
|
||||
|
||||
/**
|
||||
* The identifier of a frame timeline.
|
||||
*/
|
||||
typedef int64_t AVsyncId;
|
||||
|
||||
struct AChoreographerFrameCallbackData;
|
||||
/**
|
||||
* Opaque type that provides access to an AChoreographerFrameCallbackData object, which contains
|
||||
* various methods to extract frame information.
|
||||
*/
|
||||
typedef struct AChoreographerFrameCallbackData AChoreographerFrameCallbackData;
|
||||
|
||||
/**
|
||||
* Prototype of the function that is called when a new frame is being rendered.
|
||||
* It's passed the time that the frame is being rendered as nanoseconds in the
|
||||
* CLOCK_MONOTONIC time base, as well as the data pointer provided by the
|
||||
* application that registered a callback. All callbacks that run as part of
|
||||
* rendering a frame will observe the same frame time, so it should be used
|
||||
* whenever events need to be synchronized (e.g. animations).
|
||||
*/
|
||||
typedef void (*AChoreographer_frameCallback)(long frameTimeNanos, void* data);
|
||||
|
||||
/**
|
||||
* Prototype of the function that is called when a new frame is being rendered.
|
||||
* It's passed the time that the frame is being rendered as nanoseconds in the
|
||||
* CLOCK_MONOTONIC time base, as well as the data pointer provided by the
|
||||
* application that registered a callback. All callbacks that run as part of
|
||||
* rendering a frame will observe the same frame time, so it should be used
|
||||
* whenever events need to be synchronized (e.g. animations).
|
||||
*/
|
||||
typedef void (*AChoreographer_frameCallback64)(int64_t frameTimeNanos, void* data);
|
||||
|
||||
/**
|
||||
* Prototype of the function that is called when a new frame is being rendered.
|
||||
* It is called with \c callbackData describing multiple frame timelines, as well as the \c data
|
||||
* pointer provided by the application that registered a callback. The \c callbackData does not
|
||||
* outlive the callback.
|
||||
*/
|
||||
typedef void (*AChoreographer_vsyncCallback)(
|
||||
const AChoreographerFrameCallbackData* callbackData, void* data);
|
||||
|
||||
/**
|
||||
* Prototype of the function that is called when the display refresh rate
|
||||
* changes. It's passed the new vsync period in nanoseconds, as well as the data
|
||||
* pointer provided by the application that registered a callback.
|
||||
*/
|
||||
typedef void (*AChoreographer_refreshRateCallback)(int64_t vsyncPeriodNanos, void* data);
|
||||
|
||||
/**
|
||||
* Get the AChoreographer instance for the current thread. This must be called
|
||||
* on an ALooper thread.
|
||||
*
|
||||
* Available since API level 24.
|
||||
*/
|
||||
AChoreographer* AChoreographer_getInstance() __INTRODUCED_IN(24);
|
||||
|
||||
/**
|
||||
* Post a callback to be run when the application should begin rendering the
|
||||
* next frame. The data pointer provided will be passed to the callback function
|
||||
* when it's called.
|
||||
*
|
||||
* The callback will only be run for the next frame, not all subsequent frames,
|
||||
* so to render continuously the callback should itself call
|
||||
* AChoreographer_postFrameCallback.
|
||||
*
|
||||
* \bug The callback receives the frame time in nanoseconds as a long. On 32-bit
|
||||
* systems, long is 32-bit, so the frame time will roll over roughly every two
|
||||
* seconds. If your minSdkVersion is 29 or higher, switch to
|
||||
* AChoreographer_postFrameCallback64, which uses a 64-bit frame time for all
|
||||
* platforms. For older OS versions, you must combine the argument with the
|
||||
* upper bits of clock_gettime(CLOCK_MONOTONIC, ...) on 32-bit systems.
|
||||
*
|
||||
* \deprecated Use AChoreographer_postFrameCallback64, which does not have the
|
||||
* bug described above.
|
||||
*/
|
||||
void AChoreographer_postFrameCallback(AChoreographer* choreographer,
|
||||
AChoreographer_frameCallback callback, void* data)
|
||||
__INTRODUCED_IN(24) __DEPRECATED_IN(29, "Use AChoreographer_postFrameCallback64 instead");
|
||||
|
||||
/**
|
||||
* Post a callback to be run when the application should begin rendering the
|
||||
* next frame following the specified delay. The data pointer provided will be
|
||||
* passed to the callback function when it's called.
|
||||
*
|
||||
* The callback will only be run for the next frame after the delay, not all
|
||||
* subsequent frames, so to render continuously the callback should itself call
|
||||
* AChoreographer_postFrameCallbackDelayed.
|
||||
*
|
||||
* \bug The callback receives the frame time in nanoseconds as a long. On 32-bit
|
||||
* systems, long is 32-bit, so the frame time will roll over roughly every two
|
||||
* seconds. If your minSdkVersion is 29 or higher, switch to
|
||||
* AChoreographer_postFrameCallbackDelayed64, which uses a 64-bit frame time for
|
||||
* all platforms. For older OS versions, you must combine the argument with the
|
||||
* upper bits of clock_gettime(CLOCK_MONOTONIC, ...) on 32-bit systems.
|
||||
*
|
||||
* \deprecated Use AChoreographer_postFrameCallbackDelayed64, which does not
|
||||
* have the bug described above.
|
||||
*/
|
||||
void AChoreographer_postFrameCallbackDelayed(AChoreographer* choreographer,
|
||||
AChoreographer_frameCallback callback, void* data,
|
||||
long delayMillis) __INTRODUCED_IN(24)
|
||||
__DEPRECATED_IN(29, "Use AChoreographer_postFrameCallbackDelayed64 instead");
|
||||
|
||||
/**
|
||||
* Post a callback to be run when the application should begin rendering the
|
||||
* next frame. The data pointer provided will be passed to the callback function
|
||||
* when it's called.
|
||||
*
|
||||
* The callback will only be run on the next frame, not all subsequent frames,
|
||||
* so to render continuously the callback should itself call
|
||||
* AChoreographer_postFrameCallback64.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*/
|
||||
void AChoreographer_postFrameCallback64(AChoreographer* choreographer,
|
||||
AChoreographer_frameCallback64 callback, void* data)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Post a callback to be run when the application should begin rendering the
|
||||
* next frame following the specified delay. The data pointer provided will be
|
||||
* passed to the callback function when it's called.
|
||||
*
|
||||
* The callback will only be run for the next frame after the delay, not all
|
||||
* subsequent frames, so to render continuously the callback should itself call
|
||||
* AChoreographer_postFrameCallbackDelayed64.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*/
|
||||
void AChoreographer_postFrameCallbackDelayed64(AChoreographer* choreographer,
|
||||
AChoreographer_frameCallback64 callback, void* data,
|
||||
uint32_t delayMillis) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Posts a callback to be run when the application should begin rendering the
|
||||
* next frame. The data pointer provided will be passed to the callback function
|
||||
* when it's called.
|
||||
*
|
||||
* The callback will only be run for the next frame, not all subsequent frames,
|
||||
* so to render continuously the callback should itself call
|
||||
* AChoreographer_postVsyncCallback.
|
||||
*
|
||||
* Available since API level 33.
|
||||
*/
|
||||
void AChoreographer_postVsyncCallback(AChoreographer* choreographer,
|
||||
AChoreographer_vsyncCallback callback, void* data)
|
||||
__INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* Registers a callback to be run when the display refresh rate changes. The
|
||||
* data pointer provided will be passed to the callback function when it's
|
||||
* called. The same callback may be registered multiple times, provided that a
|
||||
* different data pointer is provided each time.
|
||||
*
|
||||
* If an application registers a callback for this choreographer instance when
|
||||
* no new callbacks were previously registered, that callback is guaranteed to
|
||||
* be dispatched. However, if the callback and associated data pointer are
|
||||
* unregistered prior to running the callback, then the callback may be silently
|
||||
* dropped.
|
||||
*
|
||||
* This api is thread-safe. Any thread is allowed to register a new refresh
|
||||
* rate callback for the choreographer instance.
|
||||
*
|
||||
* Note that in API level 30, this api is not guaranteed to be atomic with
|
||||
* DisplayManager. That is, calling Display#getRefreshRate very soon after
|
||||
* a refresh rate callback is invoked may return a stale refresh rate. If any
|
||||
* Display properties would be required by this callback, then it is recommended
|
||||
* to listen directly to DisplayManager.DisplayListener#onDisplayChanged events
|
||||
* instead.
|
||||
*
|
||||
* As of API level 31, this api is guaranteed to have a consistent view with DisplayManager;
|
||||
* Display#getRefreshRate is guaranteed to not return a stale refresh rate when invoked from this
|
||||
* callback.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
void AChoreographer_registerRefreshRateCallback(AChoreographer* choreographer,
|
||||
AChoreographer_refreshRateCallback, void* data)
|
||||
__INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Unregisters a callback to be run when the display refresh rate changes, along
|
||||
* with the data pointer previously provided when registering the callback. The
|
||||
* callback is only unregistered when the data pointer matches one that was
|
||||
* previously registered.
|
||||
*
|
||||
* This api is thread-safe. Any thread is allowed to unregister an existing
|
||||
* refresh rate callback for the choreographer instance. When a refresh rate
|
||||
* callback and associated data pointer are unregistered, then there is a
|
||||
* guarantee that when the unregistration completes that that callback will not
|
||||
* be run with the data pointer passed.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
void AChoreographer_unregisterRefreshRateCallback(AChoreographer* choreographer,
|
||||
AChoreographer_refreshRateCallback, void* data)
|
||||
__INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* The time in nanoseconds at which the frame started being rendered.
|
||||
*
|
||||
* Note that this time should \b not be used to advance animation clocks.
|
||||
* Instead, see AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos().
|
||||
*
|
||||
* Available since API level 33.
|
||||
*/
|
||||
int64_t AChoreographerFrameCallbackData_getFrameTimeNanos(
|
||||
const AChoreographerFrameCallbackData* data) __INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* The number of possible frame timelines.
|
||||
*
|
||||
* Available since API level 33.
|
||||
*/
|
||||
size_t AChoreographerFrameCallbackData_getFrameTimelinesLength(
|
||||
const AChoreographerFrameCallbackData* data) __INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* Gets the index of the platform-preferred frame timeline.
|
||||
* The preferred frame timeline is the default
|
||||
* by which the platform scheduled the app, based on the device configuration.
|
||||
*
|
||||
* Available since API level 33.
|
||||
*/
|
||||
size_t AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex(
|
||||
const AChoreographerFrameCallbackData* data) __INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* Gets the token used by the platform to identify the frame timeline at the given \c index.
|
||||
* q
|
||||
* Available since API level 33.
|
||||
*
|
||||
* \param index index of a frame timeline, in \f( [0, FrameTimelinesLength) \f). See
|
||||
* AChoreographerFrameCallbackData_getFrameTimelinesLength()
|
||||
*
|
||||
*/
|
||||
AVsyncId AChoreographerFrameCallbackData_getFrameTimelineVsyncId(
|
||||
const AChoreographerFrameCallbackData* data, size_t index) __INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* Gets the time in nanoseconds at which the frame described at the given \c index is expected to
|
||||
* be presented. This time should be used to advance any animation clocks.
|
||||
*
|
||||
* Available since API level 33.
|
||||
*
|
||||
* \param index index of a frame timeline, in \f( [0, FrameTimelinesLength) \f). See
|
||||
* AChoreographerFrameCallbackData_getFrameTimelinesLength()
|
||||
*/
|
||||
int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos(
|
||||
const AChoreographerFrameCallbackData* data, size_t index) __INTRODUCED_IN(33);
|
||||
|
||||
/**
|
||||
* Gets the time in nanoseconds at which the frame described at the given \c index needs to be
|
||||
* ready by in order to be presented on time.
|
||||
*
|
||||
* Available since API level 33.
|
||||
*
|
||||
* \param index index of a frame timeline, in \f( [0, FrameTimelinesLength) \f). See
|
||||
* AChoreographerFrameCallbackData_getFrameTimelinesLength()
|
||||
*/
|
||||
int64_t AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos(
|
||||
const AChoreographerFrameCallbackData* data, size_t index) __INTRODUCED_IN(33);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_CHOREOGRAPHER_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,805 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Configuration
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file configuration.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_CONFIGURATION_H
|
||||
#define ANDROID_CONFIGURATION_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <android/asset_manager.h>
|
||||
|
||||
#if !defined(__INTRODUCED_IN)
|
||||
#define __INTRODUCED_IN(__api_level) /* nothing */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct AConfiguration;
|
||||
/**
|
||||
* {@link AConfiguration} is an opaque type used to get and set
|
||||
* various subsystem configurations.
|
||||
*
|
||||
* A {@link AConfiguration} pointer can be obtained using:
|
||||
* - AConfiguration_new()
|
||||
* - AConfiguration_fromAssetManager()
|
||||
*/
|
||||
typedef struct AConfiguration AConfiguration;
|
||||
|
||||
|
||||
/**
|
||||
* Define flags and constants for various subsystem configurations.
|
||||
*/
|
||||
enum {
|
||||
/** Orientation: not specified. */
|
||||
ACONFIGURATION_ORIENTATION_ANY = 0x0000,
|
||||
/**
|
||||
* Orientation: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#OrientationQualifier">port</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_ORIENTATION_PORT = 0x0001,
|
||||
/**
|
||||
* Orientation: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#OrientationQualifier">land</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_ORIENTATION_LAND = 0x0002,
|
||||
/** @deprecated Not currently supported or used. */
|
||||
ACONFIGURATION_ORIENTATION_SQUARE = 0x0003,
|
||||
|
||||
/** Touchscreen: not specified. */
|
||||
ACONFIGURATION_TOUCHSCREEN_ANY = 0x0000,
|
||||
/**
|
||||
* Touchscreen: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#TouchscreenQualifier">notouch</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_TOUCHSCREEN_NOTOUCH = 0x0001,
|
||||
/** @deprecated Not currently supported or used. */
|
||||
ACONFIGURATION_TOUCHSCREEN_STYLUS = 0x0002,
|
||||
/**
|
||||
* Touchscreen: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#TouchscreenQualifier">finger</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_TOUCHSCREEN_FINGER = 0x0003,
|
||||
|
||||
/** Density: default density. */
|
||||
ACONFIGURATION_DENSITY_DEFAULT = 0,
|
||||
/**
|
||||
* Density: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#DensityQualifier">ldpi</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_DENSITY_LOW = 120,
|
||||
/**
|
||||
* Density: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#DensityQualifier">mdpi</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_DENSITY_MEDIUM = 160,
|
||||
/**
|
||||
* Density: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#DensityQualifier">tvdpi</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_DENSITY_TV = 213,
|
||||
/**
|
||||
* Density: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#DensityQualifier">hdpi</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_DENSITY_HIGH = 240,
|
||||
/**
|
||||
* Density: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#DensityQualifier">xhdpi</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_DENSITY_XHIGH = 320,
|
||||
/**
|
||||
* Density: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#DensityQualifier">xxhdpi</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_DENSITY_XXHIGH = 480,
|
||||
/**
|
||||
* Density: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#DensityQualifier">xxxhdpi</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_DENSITY_XXXHIGH = 640,
|
||||
/** Density: any density. */
|
||||
ACONFIGURATION_DENSITY_ANY = 0xfffe,
|
||||
/** Density: no density specified. */
|
||||
ACONFIGURATION_DENSITY_NONE = 0xffff,
|
||||
|
||||
/** Keyboard: not specified. */
|
||||
ACONFIGURATION_KEYBOARD_ANY = 0x0000,
|
||||
/**
|
||||
* Keyboard: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ImeQualifier">nokeys</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_KEYBOARD_NOKEYS = 0x0001,
|
||||
/**
|
||||
* Keyboard: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ImeQualifier">qwerty</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_KEYBOARD_QWERTY = 0x0002,
|
||||
/**
|
||||
* Keyboard: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ImeQualifier">12key</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_KEYBOARD_12KEY = 0x0003,
|
||||
|
||||
/** Navigation: not specified. */
|
||||
ACONFIGURATION_NAVIGATION_ANY = 0x0000,
|
||||
/**
|
||||
* Navigation: value corresponding to the
|
||||
* <a href="@/guide/topics/resources/providing-resources.html#NavigationQualifier">nonav</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_NAVIGATION_NONAV = 0x0001,
|
||||
/**
|
||||
* Navigation: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#NavigationQualifier">dpad</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_NAVIGATION_DPAD = 0x0002,
|
||||
/**
|
||||
* Navigation: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#NavigationQualifier">trackball</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_NAVIGATION_TRACKBALL = 0x0003,
|
||||
/**
|
||||
* Navigation: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#NavigationQualifier">wheel</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_NAVIGATION_WHEEL = 0x0004,
|
||||
|
||||
/** Keyboard availability: not specified. */
|
||||
ACONFIGURATION_KEYSHIDDEN_ANY = 0x0000,
|
||||
/**
|
||||
* Keyboard availability: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keysexposed</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_KEYSHIDDEN_NO = 0x0001,
|
||||
/**
|
||||
* Keyboard availability: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyshidden</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_KEYSHIDDEN_YES = 0x0002,
|
||||
/**
|
||||
* Keyboard availability: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyssoft</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_KEYSHIDDEN_SOFT = 0x0003,
|
||||
|
||||
/** Navigation availability: not specified. */
|
||||
ACONFIGURATION_NAVHIDDEN_ANY = 0x0000,
|
||||
/**
|
||||
* Navigation availability: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#NavAvailQualifier">navexposed</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_NAVHIDDEN_NO = 0x0001,
|
||||
/**
|
||||
* Navigation availability: value corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#NavAvailQualifier">navhidden</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_NAVHIDDEN_YES = 0x0002,
|
||||
|
||||
/** Screen size: not specified. */
|
||||
ACONFIGURATION_SCREENSIZE_ANY = 0x00,
|
||||
/**
|
||||
* Screen size: value indicating the screen is at least
|
||||
* approximately 320x426 dp units, corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">small</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_SCREENSIZE_SMALL = 0x01,
|
||||
/**
|
||||
* Screen size: value indicating the screen is at least
|
||||
* approximately 320x470 dp units, corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">normal</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_SCREENSIZE_NORMAL = 0x02,
|
||||
/**
|
||||
* Screen size: value indicating the screen is at least
|
||||
* approximately 480x640 dp units, corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">large</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_SCREENSIZE_LARGE = 0x03,
|
||||
/**
|
||||
* Screen size: value indicating the screen is at least
|
||||
* approximately 720x960 dp units, corresponding to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">xlarge</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_SCREENSIZE_XLARGE = 0x04,
|
||||
|
||||
/** Screen layout: not specified. */
|
||||
ACONFIGURATION_SCREENLONG_ANY = 0x00,
|
||||
/**
|
||||
* Screen layout: value that corresponds to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ScreenAspectQualifier">notlong</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_SCREENLONG_NO = 0x1,
|
||||
/**
|
||||
* Screen layout: value that corresponds to the
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ScreenAspectQualifier">long</a>
|
||||
* resource qualifier.
|
||||
*/
|
||||
ACONFIGURATION_SCREENLONG_YES = 0x2,
|
||||
|
||||
ACONFIGURATION_SCREENROUND_ANY = 0x00,
|
||||
ACONFIGURATION_SCREENROUND_NO = 0x1,
|
||||
ACONFIGURATION_SCREENROUND_YES = 0x2,
|
||||
|
||||
/** Wide color gamut: not specified. */
|
||||
ACONFIGURATION_WIDE_COLOR_GAMUT_ANY = 0x00,
|
||||
/**
|
||||
* Wide color gamut: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#WideColorGamutQualifier">no
|
||||
* nowidecg</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_WIDE_COLOR_GAMUT_NO = 0x1,
|
||||
/**
|
||||
* Wide color gamut: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#WideColorGamutQualifier">
|
||||
* widecg</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_WIDE_COLOR_GAMUT_YES = 0x2,
|
||||
|
||||
/** HDR: not specified. */
|
||||
ACONFIGURATION_HDR_ANY = 0x00,
|
||||
/**
|
||||
* HDR: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#HDRQualifier">
|
||||
* lowdr</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_HDR_NO = 0x1,
|
||||
/**
|
||||
* HDR: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#HDRQualifier">
|
||||
* highdr</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_HDR_YES = 0x2,
|
||||
|
||||
/** UI mode: not specified. */
|
||||
ACONFIGURATION_UI_MODE_TYPE_ANY = 0x00,
|
||||
/**
|
||||
* UI mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#UiModeQualifier">no
|
||||
* UI mode type</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_TYPE_NORMAL = 0x01,
|
||||
/**
|
||||
* UI mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#UiModeQualifier">desk</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02,
|
||||
/**
|
||||
* UI mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#UiModeQualifier">car</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03,
|
||||
/**
|
||||
* UI mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#UiModeQualifier">television</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04,
|
||||
/**
|
||||
* UI mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#UiModeQualifier">appliance</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 0x05,
|
||||
/**
|
||||
* UI mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#UiModeQualifier">watch</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_TYPE_WATCH = 0x06,
|
||||
/**
|
||||
* UI mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#UiModeQualifier">vr</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET = 0x07,
|
||||
|
||||
/** UI night mode: not specified.*/
|
||||
ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00,
|
||||
/**
|
||||
* UI night mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#NightQualifier">notnight</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
|
||||
/**
|
||||
* UI night mode: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#NightQualifier">night</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2,
|
||||
|
||||
/** Screen width DPI: not specified. */
|
||||
ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000,
|
||||
|
||||
/** Screen height DPI: not specified. */
|
||||
ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000,
|
||||
|
||||
/** Smallest screen width DPI: not specified.*/
|
||||
ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
|
||||
|
||||
/** Layout direction: not specified. */
|
||||
ACONFIGURATION_LAYOUTDIR_ANY = 0x00,
|
||||
/**
|
||||
* Layout direction: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">ldltr</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_LAYOUTDIR_LTR = 0x01,
|
||||
/**
|
||||
* Layout direction: value that corresponds to
|
||||
* <a href="/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">ldrtl</a> resource qualifier specified.
|
||||
*/
|
||||
ACONFIGURATION_LAYOUTDIR_RTL = 0x02,
|
||||
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#MccQualifier">mcc</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_MCC = 0x0001,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#MccQualifier">mnc</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_MNC = 0x0002,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#LocaleQualifier">locale</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_LOCALE = 0x0004,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#TouchscreenQualifier">touchscreen</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_TOUCHSCREEN = 0x0008,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ImeQualifier">keyboard</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_KEYBOARD = 0x0010,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyboardHidden</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#NavigationQualifier">navigation</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_NAVIGATION = 0x0040,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#OrientationQualifier">orientation</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_ORIENTATION = 0x0080,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#DensityQualifier">density</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_DENSITY = 0x0100,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">screen size</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_SCREEN_SIZE = 0x0200,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#VersionQualifier">platform version</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_VERSION = 0x0400,
|
||||
/**
|
||||
* Bit mask for screen layout configuration.
|
||||
*/
|
||||
ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#UiModeQualifier">ui mode</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_UI_MODE = 0x1000,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">smallest screen width</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">layout direction</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_LAYOUTDIR = 0x4000,
|
||||
ACONFIGURATION_SCREEN_ROUND = 0x8000,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#WideColorGamutQualifier">wide color gamut</a>
|
||||
* and <a href="/guide/topics/resources/providing-resources.html#HDRQualifier">HDR</a> configurations.
|
||||
*/
|
||||
ACONFIGURATION_COLOR_MODE = 0x10000,
|
||||
/**
|
||||
* Bit mask for
|
||||
* <a href="/guide/topics/resources/providing-resources.html#GrammaticalInflectionQualifier">grammatical gender</a>
|
||||
* configuration.
|
||||
*/
|
||||
ACONFIGURATION_GRAMMATICAL_GENDER = 0x20000,
|
||||
/**
|
||||
* Constant used to to represent MNC (Mobile Network Code) zero.
|
||||
* 0 cannot be used, since it is used to represent an undefined MNC.
|
||||
*/
|
||||
ACONFIGURATION_MNC_ZERO = 0xffff,
|
||||
|
||||
/**
|
||||
* <a href="/guide/topics/resources/providing-resources.html#GrammaticalInflectionQualifier">Grammatical gender</a>: not specified.
|
||||
*/
|
||||
ACONFIGURATION_GRAMMATICAL_GENDER_ANY = 0,
|
||||
|
||||
/**
|
||||
* <a href="/guide/topics/resources/providing-resources.html#GrammaticalInflectionQualifier">Grammatical gender</a>: neuter.
|
||||
*/
|
||||
ACONFIGURATION_GRAMMATICAL_GENDER_NEUTER = 1,
|
||||
|
||||
/**
|
||||
* <a href="/guide/topics/resources/providing-resources.html#GrammaticalInflectionQualifier">Grammatical gender</a>: feminine.
|
||||
*/
|
||||
ACONFIGURATION_GRAMMATICAL_GENDER_FEMININE = 2,
|
||||
|
||||
/**
|
||||
* <a href="/guide/topics/resources/providing-resources.html#GrammaticalInflectionQualifier">Grammatical gender</a>: masculine.
|
||||
*/
|
||||
ACONFIGURATION_GRAMMATICAL_GENDER_MASCULINE = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new AConfiguration, initialized with no values set.
|
||||
*/
|
||||
AConfiguration* AConfiguration_new();
|
||||
|
||||
/**
|
||||
* Free an AConfiguration that was previously created with
|
||||
* AConfiguration_new().
|
||||
*/
|
||||
void AConfiguration_delete(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Create and return a new AConfiguration based on the current configuration in
|
||||
* use in the given {@link AAssetManager}.
|
||||
*/
|
||||
void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am);
|
||||
|
||||
/**
|
||||
* Copy the contents of 'src' to 'dest'.
|
||||
*/
|
||||
void AConfiguration_copy(AConfiguration* dest, AConfiguration* src);
|
||||
|
||||
/**
|
||||
* Return the current MCC set in the configuration. 0 if not set.
|
||||
*/
|
||||
int32_t AConfiguration_getMcc(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current MCC in the configuration. 0 to clear.
|
||||
*/
|
||||
void AConfiguration_setMcc(AConfiguration* config, int32_t mcc);
|
||||
|
||||
/**
|
||||
* Return the current MNC set in the configuration. 0 if not set.
|
||||
*/
|
||||
int32_t AConfiguration_getMnc(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current MNC in the configuration. 0 to clear.
|
||||
*/
|
||||
void AConfiguration_setMnc(AConfiguration* config, int32_t mnc);
|
||||
|
||||
/**
|
||||
* Return the current language code set in the configuration. The output will
|
||||
* be filled with an array of two characters. They are not 0-terminated. If
|
||||
* a language is not set, they will be 0.
|
||||
*/
|
||||
void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage);
|
||||
|
||||
/**
|
||||
* Set the current language code in the configuration, from the first two
|
||||
* characters in the string.
|
||||
*/
|
||||
void AConfiguration_setLanguage(AConfiguration* config, const char* language);
|
||||
|
||||
/**
|
||||
* Return the current country code set in the configuration. The output will
|
||||
* be filled with an array of two characters. They are not 0-terminated. If
|
||||
* a country is not set, they will be 0.
|
||||
*/
|
||||
void AConfiguration_getCountry(AConfiguration* config, char* outCountry);
|
||||
|
||||
/**
|
||||
* Set the current country code in the configuration, from the first two
|
||||
* characters in the string.
|
||||
*/
|
||||
void AConfiguration_setCountry(AConfiguration* config, const char* country);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_ORIENTATION_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getOrientation(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current orientation in the configuration.
|
||||
*/
|
||||
void AConfiguration_setOrientation(AConfiguration* config, int32_t orientation);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getTouchscreen(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current touchscreen in the configuration.
|
||||
*/
|
||||
void AConfiguration_setTouchscreen(AConfiguration* config, int32_t touchscreen);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_DENSITY_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getDensity(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current density in the configuration.
|
||||
*/
|
||||
void AConfiguration_setDensity(AConfiguration* config, int32_t density);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_KEYBOARD_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getKeyboard(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current keyboard in the configuration.
|
||||
*/
|
||||
void AConfiguration_setKeyboard(AConfiguration* config, int32_t keyboard);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_NAVIGATION_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getNavigation(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current navigation in the configuration.
|
||||
*/
|
||||
void AConfiguration_setNavigation(AConfiguration* config, int32_t navigation);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getKeysHidden(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current keys hidden in the configuration.
|
||||
*/
|
||||
void AConfiguration_setKeysHidden(AConfiguration* config, int32_t keysHidden);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getNavHidden(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current nav hidden in the configuration.
|
||||
*/
|
||||
void AConfiguration_setNavHidden(AConfiguration* config, int32_t navHidden);
|
||||
|
||||
/**
|
||||
* Return the current SDK (API) version set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getSdkVersion(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current SDK version in the configuration.
|
||||
*/
|
||||
void AConfiguration_setSdkVersion(AConfiguration* config, int32_t sdkVersion);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getScreenSize(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current screen size in the configuration.
|
||||
*/
|
||||
void AConfiguration_setScreenSize(AConfiguration* config, int32_t screenSize);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_SCREENLONG_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getScreenLong(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current screen long in the configuration.
|
||||
*/
|
||||
void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_SCREENROUND_* set in the configuration.
|
||||
*
|
||||
* Available since API level 30.
|
||||
*/
|
||||
int32_t AConfiguration_getScreenRound(AConfiguration* config) __INTRODUCED_IN(30);
|
||||
|
||||
/**
|
||||
* Set the current screen round in the configuration.
|
||||
*/
|
||||
void AConfiguration_setScreenRound(AConfiguration* config, int32_t screenRound);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getUiModeType(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current UI mode type in the configuration.
|
||||
*/
|
||||
void AConfiguration_setUiModeType(AConfiguration* config, int32_t uiModeType);
|
||||
|
||||
/**
|
||||
* Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration.
|
||||
*/
|
||||
int32_t AConfiguration_getUiModeNight(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the current UI mode night in the configuration.
|
||||
*/
|
||||
void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight);
|
||||
|
||||
/**
|
||||
* Return the current configuration screen width in dp units, or
|
||||
* ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set.
|
||||
*/
|
||||
int32_t AConfiguration_getScreenWidthDp(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the configuration's current screen width in dp units.
|
||||
*/
|
||||
void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value);
|
||||
|
||||
/**
|
||||
* Return the current configuration screen height in dp units, or
|
||||
* ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set.
|
||||
*/
|
||||
int32_t AConfiguration_getScreenHeightDp(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the configuration's current screen width in dp units.
|
||||
*/
|
||||
void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value);
|
||||
|
||||
/**
|
||||
* Return the configuration's smallest screen width in dp units, or
|
||||
* ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set.
|
||||
*/
|
||||
int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config);
|
||||
|
||||
/**
|
||||
* Set the configuration's smallest screen width in dp units.
|
||||
*/
|
||||
void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value);
|
||||
|
||||
/**
|
||||
* Return the configuration's layout direction, or
|
||||
* ACONFIGURATION_LAYOUTDIR_ANY if not set.
|
||||
*
|
||||
* Available since API level 17.
|
||||
*/
|
||||
int32_t AConfiguration_getLayoutDirection(AConfiguration* config) __INTRODUCED_IN(17);
|
||||
|
||||
/**
|
||||
* Set the configuration's layout direction.
|
||||
*
|
||||
* Available since API level 17.
|
||||
*/
|
||||
void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value) __INTRODUCED_IN(17);
|
||||
|
||||
/**
|
||||
* Return the configuration's grammatical gender, or ACONFIGURATION_GRAMMATICAL_GENDER_ANY if
|
||||
* not set.
|
||||
*
|
||||
* Available since API level 34.
|
||||
*/
|
||||
int32_t AConfiguration_getGrammaticalGender(AConfiguration* config)
|
||||
__INTRODUCED_IN(__ANDROID_API_U__);
|
||||
|
||||
/**
|
||||
* Set the configuration's grammatical gender to one of the
|
||||
* ACONFIGURATION_GRAMMATICAL_GENDER_* constants.
|
||||
*
|
||||
* Available since API level 34.
|
||||
*/
|
||||
void AConfiguration_setGrammaticalGender(AConfiguration* config, int32_t value)
|
||||
__INTRODUCED_IN(__ANDROID_API_U__);
|
||||
|
||||
/**
|
||||
* Perform a diff between two configurations. Returns a bit mask of
|
||||
* ACONFIGURATION_* constants, each bit set meaning that configuration element
|
||||
* is different between them.
|
||||
*/
|
||||
int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2);
|
||||
|
||||
/**
|
||||
* Determine whether 'base' is a valid configuration for use within the
|
||||
* environment 'requested'. Returns 0 if there are any values in 'base'
|
||||
* that conflict with 'requested'. Returns 1 if it does not conflict.
|
||||
*/
|
||||
int32_t AConfiguration_match(AConfiguration* base, AConfiguration* requested);
|
||||
|
||||
/**
|
||||
* Determine whether the configuration in 'test' is better than the existing
|
||||
* configuration in 'base'. If 'requested' is non-NULL, this decision is based
|
||||
* on the overall configuration given there. If it is NULL, this decision is
|
||||
* simply based on which configuration is more specific. Returns non-0 if
|
||||
* 'test' is better than 'base'.
|
||||
*
|
||||
* This assumes you have already filtered the configurations with
|
||||
* AConfiguration_match().
|
||||
*/
|
||||
int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test,
|
||||
AConfiguration* requested);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // ANDROID_CONFIGURATION_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file android/crash_detail.h
|
||||
* @brief Attach extra information to android crashes.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef struct crash_detail_t crash_detail_t;
|
||||
|
||||
/**
|
||||
* Register a new buffer to get logged into tombstones for crashes.
|
||||
*
|
||||
* It will be added to both the tombstone proto in the crash_detail field, and
|
||||
* in the tombstone text format.
|
||||
*
|
||||
* Tombstone proto definition:
|
||||
* https://cs.android.com/android/platform/superproject/main/+/main:system/core/debuggerd/proto/tombstone.proto
|
||||
*
|
||||
* An app can get hold of these for any `REASON_CRASH_NATIVE` instance of
|
||||
* `android.app.ApplicationExitInfo`.
|
||||
*
|
||||
* https://developer.android.com/reference/android/app/ApplicationExitInfo#getTraceInputStream()
|
||||
|
||||
* The lifetime of name and data has to be valid until the program crashes, or until
|
||||
* android_crash_detail_unregister is called.
|
||||
*
|
||||
* Example usage:
|
||||
* const char* stageName = "garbage_collection";
|
||||
* crash_detail_t* cd = android_crash_detail_register("stage", stageName, strlen(stageName));
|
||||
* do_garbage_collection();
|
||||
* android_crash_detail_unregister(cd);
|
||||
*
|
||||
* If this example crashes in do_garbage_collection, a line will show up in the textual representation of the tombstone:
|
||||
* Extra crash detail: stage: 'garbage_collection'
|
||||
*
|
||||
* Introduced in API 35.
|
||||
*
|
||||
* \param name identifying name for this extra data.
|
||||
* this should generally be a human-readable UTF-8 string, but we are treating
|
||||
* it as arbitrary bytes because it could be corrupted by the crash.
|
||||
* \param name_size number of bytes of the buffer pointed to by name
|
||||
* \param data a buffer containing the extra detail bytes, if null the crash detail
|
||||
* is disabled until android_crash_detail_replace_data replaces it with
|
||||
* a non-null pointer.
|
||||
* \param data_size number of bytes of the buffer pointed to by data
|
||||
*
|
||||
* \return a handle to the extra crash detail.
|
||||
*/
|
||||
|
||||
#if __ANDROID_API__ >= 35
|
||||
crash_detail_t* _Nullable android_crash_detail_register(
|
||||
const void* _Nonnull name, size_t name_size, const void* _Nullable data, size_t data_size) __INTRODUCED_IN(35);
|
||||
|
||||
/**
|
||||
* Unregister crash detail from being logged into tombstones.
|
||||
*
|
||||
* After this function returns, the lifetime of the objects crash_detail was
|
||||
* constructed from no longer needs to be valid.
|
||||
*
|
||||
* Introduced in API 35.
|
||||
*
|
||||
* \param crash_detail the crash_detail that should be removed.
|
||||
*/
|
||||
void android_crash_detail_unregister(crash_detail_t* _Nonnull crash_detail) __INTRODUCED_IN(35);
|
||||
|
||||
/**
|
||||
* Replace data of crash detail.
|
||||
*
|
||||
* This is more efficient than using android_crash_detail_unregister followed by
|
||||
* android_crash_detail_register. If you very frequently need to swap out the data,
|
||||
* you can hold onto the crash_detail.
|
||||
*
|
||||
* Introduced in API 35.
|
||||
*
|
||||
* \param data the new buffer containing the extra detail bytes, or null to disable until
|
||||
* android_crash_detail_replace_data is called again with non-null data.
|
||||
* \param data_size the number of bytes of the buffer pointed to by data.
|
||||
*/
|
||||
void android_crash_detail_replace_data(crash_detail_t* _Nonnull crash_detail, const void* _Nullable data, size_t data_size) __INTRODUCED_IN(35);
|
||||
|
||||
/**
|
||||
* Replace name of crash detail.
|
||||
*
|
||||
* This is more efficient than using android_crash_detail_unregister followed by
|
||||
* android_crash_detail_register. If you very frequently need to swap out the name,
|
||||
* you can hold onto the crash_detail.
|
||||
*
|
||||
* Introduced in API 35.
|
||||
*
|
||||
* \param name identifying name for this extra data.
|
||||
* \param name_size number of bytes of the buffer pointed to by name
|
||||
*/
|
||||
void android_crash_detail_replace_name(crash_detail_t* _Nonnull crash_detail, const void* _Nonnull name, size_t name_size) __INTRODUCED_IN(35);
|
||||
#endif /* __ANDROID_API__ >= 35 */
|
||||
|
||||
|
||||
__END_DECLS
|
||||
@ -0,0 +1,585 @@
|
||||
/*
|
||||
* Copyright 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup ADataSpace Data Space
|
||||
*
|
||||
* ADataSpace describes how to interpret colors.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file data_space.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_DATA_SPACE_H
|
||||
#define ANDROID_DATA_SPACE_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* ADataSpace.
|
||||
*/
|
||||
enum ADataSpace : int32_t {
|
||||
/**
|
||||
* Default-assumption data space, when not explicitly specified.
|
||||
*
|
||||
* It is safest to assume the buffer is an image with sRGB primaries and
|
||||
* encoding ranges, but the consumer and/or the producer of the data may
|
||||
* simply be using defaults. No automatic gamma transform should be
|
||||
* expected, except for a possible display gamma transform when drawn to a
|
||||
* screen.
|
||||
*/
|
||||
ADATASPACE_UNKNOWN = 0,
|
||||
|
||||
/**
|
||||
* Color-description aspects
|
||||
*
|
||||
* The following aspects define various characteristics of the color
|
||||
* specification. These represent bitfields, so that a data space value
|
||||
* can specify each of them independently.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Standard aspect
|
||||
*
|
||||
* Defines the chromaticity coordinates of the source primaries in terms of
|
||||
* the CIE 1931 definition of x and y specified in ISO 11664-1.
|
||||
*/
|
||||
STANDARD_MASK = 63 << 16,
|
||||
|
||||
/**
|
||||
* Chromacity coordinates are unknown or are determined by the application.
|
||||
* Implementations shall use the following suggested standards:
|
||||
*
|
||||
* All YCbCr formats: BT709 if size is 720p or larger (since most video
|
||||
* content is letterboxed this corresponds to width is
|
||||
* 1280 or greater, or height is 720 or greater).
|
||||
* BT601_625 if size is smaller than 720p or is JPEG.
|
||||
* All RGB formats: BT709.
|
||||
*
|
||||
* For all other formats standard is undefined, and implementations should use
|
||||
* an appropriate standard for the data represented.
|
||||
*/
|
||||
STANDARD_UNSPECIFIED = 0 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.300 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.2126, KB = 0.0722 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
STANDARD_BT709 = 1 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.290 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* KR = 0.299, KB = 0.114. This adjusts the luminance interpretation
|
||||
* for RGB conversion from the one purely determined by the primaries
|
||||
* to minimize the color shift into RGB space that uses BT.709
|
||||
* primaries.
|
||||
*/
|
||||
STANDARD_BT601_625 = 2 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.290 0.600
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.222, KB = 0.071 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
STANDARD_BT601_625_UNADJUSTED = 3 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.310 0.595
|
||||
* blue 0.155 0.070
|
||||
* red 0.630 0.340
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* KR = 0.299, KB = 0.114. This adjusts the luminance interpretation
|
||||
* for RGB conversion from the one purely determined by the primaries
|
||||
* to minimize the color shift into RGB space that uses BT.709
|
||||
* primaries.
|
||||
*/
|
||||
STANDARD_BT601_525 = 4 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.310 0.595
|
||||
* blue 0.155 0.070
|
||||
* red 0.630 0.340
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.212, KB = 0.087 luminance interpretation
|
||||
* for RGB conversion (as in SMPTE 240M).
|
||||
*/
|
||||
STANDARD_BT601_525_UNADJUSTED = 5 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.170 0.797
|
||||
* blue 0.131 0.046
|
||||
* red 0.708 0.292
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.2627, KB = 0.0593 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
STANDARD_BT2020 = 6 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.170 0.797
|
||||
* blue 0.131 0.046
|
||||
* red 0.708 0.292
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.2627, KB = 0.0593 luminance interpretation
|
||||
* for RGB conversion using the linear domain.
|
||||
*/
|
||||
STANDARD_BT2020_CONSTANT_LUMINANCE = 7 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.21 0.71
|
||||
* blue 0.14 0.08
|
||||
* red 0.67 0.33
|
||||
* white (C) 0.310 0.316</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.30, KB = 0.11 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
STANDARD_BT470M = 8 << 16,
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.243 0.692
|
||||
* blue 0.145 0.049
|
||||
* red 0.681 0.319
|
||||
* white (C) 0.310 0.316</pre>
|
||||
*
|
||||
* Use the unadjusted KR = 0.254, KB = 0.068 luminance interpretation
|
||||
* for RGB conversion.
|
||||
*/
|
||||
STANDARD_FILM = 9 << 16,
|
||||
|
||||
/**
|
||||
* SMPTE EG 432-1 and SMPTE RP 431-2. (DCI-P3)
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.265 0.690
|
||||
* blue 0.150 0.060
|
||||
* red 0.680 0.320
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*/
|
||||
STANDARD_DCI_P3 = 10 << 16,
|
||||
|
||||
/**
|
||||
* Adobe RGB
|
||||
* <pre>
|
||||
* Primaries: x y
|
||||
* green 0.210 0.710
|
||||
* blue 0.150 0.060
|
||||
* red 0.640 0.330
|
||||
* white (D65) 0.3127 0.3290</pre>
|
||||
*/
|
||||
STANDARD_ADOBE_RGB = 11 << 16,
|
||||
|
||||
/**
|
||||
* Transfer aspect
|
||||
*
|
||||
* Transfer characteristics are the opto-electronic transfer characteristic
|
||||
* at the source as a function of linear optical intensity (luminance).
|
||||
*
|
||||
* For digital signals, E corresponds to the recorded value. Normally, the
|
||||
* transfer function is applied in RGB space to each of the R, G and B
|
||||
* components independently. This may result in color shift that can be
|
||||
* minized by applying the transfer function in Lab space only for the L
|
||||
* component. Implementation may apply the transfer function in RGB space
|
||||
* for all pixel formats if desired.
|
||||
*/
|
||||
TRANSFER_MASK = 31 << 22,
|
||||
|
||||
/**
|
||||
* Transfer characteristics are unknown or are determined by the
|
||||
* application.
|
||||
*
|
||||
* Implementations should use the following transfer functions:
|
||||
*
|
||||
* For YCbCr formats: use TRANSFER_SMPTE_170M
|
||||
* For RGB formats: use TRANSFER_SRGB
|
||||
*
|
||||
* For all other formats transfer function is undefined, and implementations
|
||||
* should use an appropriate standard for the data represented.
|
||||
*/
|
||||
TRANSFER_UNSPECIFIED = 0 << 22,
|
||||
|
||||
/**
|
||||
* Linear transfer.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = L
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
TRANSFER_LINEAR = 1 << 22,
|
||||
|
||||
/**
|
||||
* sRGB transfer.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = 1.055 * L^(1/2.4) - 0.055 for 0.0031308 <= L <= 1
|
||||
* = 12.92 * L for 0 <= L < 0.0031308
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
TRANSFER_SRGB = 2 << 22,
|
||||
|
||||
/**
|
||||
* SMPTE 170M transfer.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = 1.099 * L ^ 0.45 - 0.099 for 0.018 <= L <= 1
|
||||
* = 4.500 * L for 0 <= L < 0.018
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
TRANSFER_SMPTE_170M = 3 << 22,
|
||||
|
||||
/**
|
||||
* Display gamma 2.2.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = L ^ (1/2.2)
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
TRANSFER_GAMMA2_2 = 4 << 22,
|
||||
|
||||
/**
|
||||
* Display gamma 2.6.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = L ^ (1/2.6)
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
TRANSFER_GAMMA2_6 = 5 << 22,
|
||||
|
||||
/**
|
||||
* Display gamma 2.8.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = L ^ (1/2.8)
|
||||
* L - luminance of image 0 <= L <= 1 for conventional colorimetry
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
TRANSFER_GAMMA2_8 = 6 << 22,
|
||||
|
||||
/**
|
||||
* SMPTE ST 2084 (Dolby Perceptual Quantizer).
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = ((c1 + c2 * L^n) / (1 + c3 * L^n)) ^ m
|
||||
* c1 = c3 - c2 + 1 = 3424 / 4096 = 0.8359375
|
||||
* c2 = 32 * 2413 / 4096 = 18.8515625
|
||||
* c3 = 32 * 2392 / 4096 = 18.6875
|
||||
* m = 128 * 2523 / 4096 = 78.84375
|
||||
* n = 0.25 * 2610 / 4096 = 0.1593017578125
|
||||
* L - luminance of image 0 <= L <= 1 for HDR colorimetry.
|
||||
* L = 1 corresponds to 10000 cd/m2
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
TRANSFER_ST2084 = 7 << 22,
|
||||
|
||||
/**
|
||||
* ARIB STD-B67 Hybrid Log Gamma.
|
||||
* <pre>
|
||||
* Transfer characteristic curve:
|
||||
* E = r * L^0.5 for 0 <= L <= 1
|
||||
* = a * ln(L - b) + c for 1 < L
|
||||
* a = 0.17883277
|
||||
* b = 0.28466892
|
||||
* c = 0.55991073
|
||||
* r = 0.5
|
||||
* L - luminance of image 0 <= L for HDR colorimetry. L = 1 corresponds
|
||||
* to reference white level of 100 cd/m2
|
||||
* E - corresponding electrical signal</pre>
|
||||
*/
|
||||
TRANSFER_HLG = 8 << 22,
|
||||
|
||||
/**
|
||||
* Range aspect
|
||||
*
|
||||
* Defines the range of values corresponding to the unit range of 0-1.
|
||||
* This is defined for YCbCr only, but can be expanded to RGB space.
|
||||
*/
|
||||
RANGE_MASK = 7 << 27,
|
||||
|
||||
/**
|
||||
* Range is unknown or are determined by the application. Implementations
|
||||
* shall use the following suggested ranges:
|
||||
*
|
||||
* All YCbCr formats: limited range.
|
||||
* All RGB or RGBA formats (including RAW and Bayer): full range.
|
||||
* All Y formats: full range
|
||||
*
|
||||
* For all other formats range is undefined, and implementations should use
|
||||
* an appropriate range for the data represented.
|
||||
*/
|
||||
RANGE_UNSPECIFIED = 0 << 27,
|
||||
|
||||
/**
|
||||
* Full range uses all values for Y, Cb and Cr from
|
||||
* 0 to 2^b-1, where b is the bit depth of the color format.
|
||||
*/
|
||||
RANGE_FULL = 1 << 27,
|
||||
|
||||
/**
|
||||
* Limited range uses values 16/256*2^b to 235/256*2^b for Y, and
|
||||
* 1/16*2^b to 15/16*2^b for Cb, Cr, R, G and B, where b is the bit depth of
|
||||
* the color format.
|
||||
*
|
||||
* E.g. For 8-bit-depth formats:
|
||||
* Luma (Y) samples should range from 16 to 235, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
|
||||
*
|
||||
* For 10-bit-depth formats:
|
||||
* Luma (Y) samples should range from 64 to 940, inclusive
|
||||
* Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
|
||||
*/
|
||||
RANGE_LIMITED = 2 << 27,
|
||||
|
||||
/**
|
||||
* Extended range is used for scRGB. Intended for use with
|
||||
* floating point pixel formats. [0.0 - 1.0] is the standard
|
||||
* sRGB space. Values outside the range 0.0 - 1.0 can encode
|
||||
* color outside the sRGB gamut.
|
||||
* Used to blend / merge multiple dataspaces on a single display.
|
||||
*/
|
||||
RANGE_EXTENDED = 3 << 27,
|
||||
|
||||
/**
|
||||
* scRGB linear encoding
|
||||
*
|
||||
* The red, green, and blue components are stored in extended sRGB space,
|
||||
* but are linear, not gamma-encoded.
|
||||
*
|
||||
* The values are floating point.
|
||||
* A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
|
||||
* Values beyond the range [0.0 - 1.0] would correspond to other colors
|
||||
* spaces and/or HDR content.
|
||||
*
|
||||
* Uses extended range, linear transfer and BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_SCRGB_LINEAR = 406913024, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_EXTENDED
|
||||
|
||||
/**
|
||||
* sRGB gamma encoding
|
||||
*
|
||||
* The red, green and blue components are stored in sRGB space, and
|
||||
* converted to linear space when read, using the SRGB transfer function
|
||||
* for each of the R, G and B components. When written, the inverse
|
||||
* transformation is performed.
|
||||
*
|
||||
* The alpha component, if present, is always stored in linear space and
|
||||
* is left unmodified when read or written.
|
||||
*
|
||||
* Uses full range, sRGB transfer BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_SRGB = 142671872, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_FULL
|
||||
|
||||
/**
|
||||
* scRGB
|
||||
*
|
||||
* The red, green, and blue components are stored in extended sRGB space,
|
||||
* and gamma-encoded using the SRGB transfer function.
|
||||
*
|
||||
* The values are floating point.
|
||||
* A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
|
||||
* Values beyond the range [0.0 - 1.0] would correspond to other colors
|
||||
* spaces and/or HDR content.
|
||||
*
|
||||
* Uses extended range, sRGB transfer and BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_SCRGB = 411107328, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED
|
||||
|
||||
/**
|
||||
* Display P3
|
||||
*
|
||||
* Uses full range, sRGB transfer and D65 DCI-P3 standard.
|
||||
*/
|
||||
ADATASPACE_DISPLAY_P3 = 143261696, // STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 2020 (BT.2020)
|
||||
*
|
||||
* Ultra High-definition television
|
||||
*
|
||||
* Uses full range, SMPTE 2084 (PQ) transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020_PQ = 163971072, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 2020 (BT.2020)
|
||||
*
|
||||
* Ultra High-definition television
|
||||
*
|
||||
* Uses limited range, SMPTE 2084 (PQ) transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020_ITU_PQ = 298188800, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* Adobe RGB
|
||||
*
|
||||
* Uses full range, gamma 2.2 transfer and Adobe RGB standard.
|
||||
*
|
||||
* Note: Application is responsible for gamma encoding the data as
|
||||
* a 2.2 gamma encoding is not supported in HW.
|
||||
*/
|
||||
ADATASPACE_ADOBE_RGB = 151715840, // STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL
|
||||
|
||||
/**
|
||||
* JPEG File Interchange Format (JFIF)
|
||||
*
|
||||
* Same model as BT.601-625, but all values (Y, Cb, Cr) range from 0 to 255.
|
||||
*
|
||||
* Uses full range, SMPTE 170M transfer and BT.601_625 standard.
|
||||
*/
|
||||
ADATASPACE_JFIF = 146931712, // STANDARD_BT601_625 | TRANSFER_SMPTE_170M | RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 601 (BT.601) - 625-line
|
||||
*
|
||||
* Standard-definition television, 625 Lines (PAL)
|
||||
*
|
||||
* Uses limited range, SMPTE 170M transfer and BT.601_625 standard.
|
||||
*/
|
||||
ADATASPACE_BT601_625 = 281149440, // STANDARD_BT601_625 | TRANSFER_SMPTE_170M | RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 601 (BT.601) - 525-line
|
||||
*
|
||||
* Standard-definition television, 525 Lines (NTSC)
|
||||
*
|
||||
* Uses limited range, SMPTE 170M transfer and BT.601_525 standard.
|
||||
*/
|
||||
ADATASPACE_BT601_525 = 281280512, // STANDARD_BT601_525 | TRANSFER_SMPTE_170M | RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 2020 (BT.2020)
|
||||
*
|
||||
* Ultra High-definition television
|
||||
*
|
||||
* Uses full range, SMPTE 170M transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020 = 147193856, // STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU-R Recommendation 709 (BT.709)
|
||||
*
|
||||
* High-definition television
|
||||
*
|
||||
* Uses limited range, SMPTE 170M transfer and BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_BT709 = 281083904, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* SMPTE EG 432-1 and SMPTE RP 431-2
|
||||
*
|
||||
* Digital Cinema DCI-P3
|
||||
*
|
||||
* Uses full range, gamma 2.6 transfer and D65 DCI-P3 standard.
|
||||
*
|
||||
* Note: Application is responsible for gamma encoding the data as
|
||||
* a 2.6 gamma encoding is not supported in HW.
|
||||
*/
|
||||
ADATASPACE_DCI_P3 = 155844608, // STANDARD_DCI_P3 | TRANSFER_GAMMA2_6 | RANGE_FULL
|
||||
|
||||
/**
|
||||
* sRGB linear encoding
|
||||
*
|
||||
* The red, green, and blue components are stored in sRGB space, but
|
||||
* are linear, not gamma-encoded.
|
||||
* The RGB primaries and the white point are the same as BT.709.
|
||||
*
|
||||
* The values are encoded using the full range ([0,255] for 8-bit) for all
|
||||
* components.
|
||||
*
|
||||
* Uses full range, linear transfer and BT.709 standard.
|
||||
*/
|
||||
ADATASPACE_SRGB_LINEAR = 138477568, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_FULL
|
||||
|
||||
/**
|
||||
* Hybrid Log Gamma encoding
|
||||
*
|
||||
* Uses full range, hybrid log gamma transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020_HLG = 168165376, // STANDARD_BT2020 | TRANSFER_HLG | RANGE_FULL
|
||||
|
||||
/**
|
||||
* ITU Hybrid Log Gamma encoding
|
||||
*
|
||||
* Uses limited range, hybrid log gamma transfer and BT2020 standard.
|
||||
*/
|
||||
ADATASPACE_BT2020_ITU_HLG = 302383104, // STANDARD_BT2020 | TRANSFER_HLG | RANGE_LIMITED
|
||||
|
||||
/**
|
||||
* Depth
|
||||
*
|
||||
* This value is valid with formats HAL_PIXEL_FORMAT_Y16 and HAL_PIXEL_FORMAT_BLOB.
|
||||
*/
|
||||
ADATASPACE_DEPTH = 4096,
|
||||
|
||||
/**
|
||||
* ISO 16684-1:2011(E) Dynamic Depth
|
||||
*
|
||||
* Embedded depth metadata following the dynamic depth specification.
|
||||
*/
|
||||
ADATASPACE_DYNAMIC_DEPTH = 4098
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_DATA_SPACE_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h> /* for off64_t */
|
||||
|
||||
/**
|
||||
* @addtogroup libdl Dynamic Linker
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Advanced dynamic library opening support. Most users will want to use
|
||||
* the standard [dlopen(3)](http://man7.org/linux/man-pages/man3/dlopen.3.html)
|
||||
* functionality in `<dlfcn.h>` instead.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/** Bitfield definitions for `android_dlextinfo::flags`. */
|
||||
enum {
|
||||
/**
|
||||
* When set, the `reserved_addr` and `reserved_size` fields must point to an
|
||||
* already-reserved region of address space which will be used to load the
|
||||
* library if it fits.
|
||||
*
|
||||
* If the reserved region is not large enough, loading will fail.
|
||||
*/
|
||||
ANDROID_DLEXT_RESERVED_ADDRESS = 0x1,
|
||||
|
||||
/**
|
||||
* Like `ANDROID_DLEXT_RESERVED_ADDRESS`, but if the reserved region is not large enough,
|
||||
* the linker will choose an available address instead.
|
||||
*/
|
||||
ANDROID_DLEXT_RESERVED_ADDRESS_HINT = 0x2,
|
||||
|
||||
/**
|
||||
* When set, write the GNU RELRO section of the mapped library to `relro_fd`
|
||||
* after relocation has been performed, to allow it to be reused by another
|
||||
* process loading the same library at the same address. This implies
|
||||
* `ANDROID_DLEXT_USE_RELRO`.
|
||||
*
|
||||
* This is mainly useful for the system WebView implementation.
|
||||
*/
|
||||
ANDROID_DLEXT_WRITE_RELRO = 0x4,
|
||||
|
||||
/**
|
||||
* When set, compare the GNU RELRO section of the mapped library to `relro_fd`
|
||||
* after relocation has been performed, and replace any relocated pages that
|
||||
* are identical with a version mapped from the file.
|
||||
*
|
||||
* This is mainly useful for the system WebView implementation.
|
||||
*/
|
||||
ANDROID_DLEXT_USE_RELRO = 0x8,
|
||||
|
||||
/**
|
||||
* Use `library_fd` instead of opening the file by name.
|
||||
* The filename parameter is still used to identify the library.
|
||||
*/
|
||||
ANDROID_DLEXT_USE_LIBRARY_FD = 0x10,
|
||||
|
||||
/**
|
||||
* If opening a library using `library_fd` read it starting at `library_fd_offset`.
|
||||
* This is mainly useful for loading a library stored within another file (such as uncompressed
|
||||
* inside a ZIP archive).
|
||||
* This flag is only valid when `ANDROID_DLEXT_USE_LIBRARY_FD` is set.
|
||||
*/
|
||||
ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET = 0x20,
|
||||
|
||||
/**
|
||||
* When set, do not use `stat(2)` to check if the library has already been loaded.
|
||||
*
|
||||
* This flag allows forced loading of the library in the case when for some
|
||||
* reason multiple ELF files share the same filename (because the already-loaded
|
||||
* library has been removed and overwritten, for example).
|
||||
*
|
||||
* Note that if the library has the same `DT_SONAME` as an old one and some other
|
||||
* library has the soname in its `DT_NEEDED` list, the first one will be used to resolve any
|
||||
* dependencies.
|
||||
*/
|
||||
ANDROID_DLEXT_FORCE_LOAD = 0x40,
|
||||
|
||||
// Historically we had two other options for ART.
|
||||
// They were last available in API level 28.
|
||||
// Reuse these bits last!
|
||||
// ANDROID_DLEXT_FORCE_FIXED_VADDR = 0x80
|
||||
// ANDROID_DLEXT_LOAD_AT_FIXED_ADDRESS = 0x100
|
||||
|
||||
/**
|
||||
* This flag used to load library in a different namespace. The namespace is
|
||||
* specified in `library_namespace`.
|
||||
*
|
||||
* This flag is for internal use only (since there is no NDK API for namespaces).
|
||||
*/
|
||||
ANDROID_DLEXT_USE_NAMESPACE = 0x200,
|
||||
|
||||
/**
|
||||
* Instructs dlopen() to apply `ANDROID_DLEXT_RESERVED_ADDRESS`,
|
||||
* `ANDROID_DLEXT_RESERVED_ADDRESS_HINT`, `ANDROID_DLEXT_WRITE_RELRO` and
|
||||
* `ANDROID_DLEXT_USE_RELRO` to any libraries loaded as dependencies of the
|
||||
* main library as well.
|
||||
*
|
||||
* This means that if the main library depends on one or more not-already-loaded libraries, they
|
||||
* will be loaded consecutively into the region starting at `reserved_addr`, and `reserved_size`
|
||||
* must be large enough to contain all of the libraries. The libraries will be loaded in the
|
||||
* deterministic order constructed from the DT_NEEDED entries, rather than the more secure random
|
||||
* order used by default.
|
||||
*
|
||||
* Each library's GNU RELRO sections will be written out to `relro_fd` in the same order they were
|
||||
* loaded. This will mean that the resulting file is dependent on which of the libraries were
|
||||
* already loaded, as only the newly loaded libraries will be included, not any already-loaded
|
||||
* dependencies. The caller should ensure that the set of libraries newly loaded is consistent
|
||||
* for this to be effective.
|
||||
*
|
||||
* This is mainly useful for the system WebView implementation.
|
||||
*/
|
||||
ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE = 0x400,
|
||||
|
||||
|
||||
/** Mask of valid bits. */
|
||||
ANDROID_DLEXT_VALID_FLAG_BITS = ANDROID_DLEXT_RESERVED_ADDRESS |
|
||||
ANDROID_DLEXT_RESERVED_ADDRESS_HINT |
|
||||
ANDROID_DLEXT_WRITE_RELRO |
|
||||
ANDROID_DLEXT_USE_RELRO |
|
||||
ANDROID_DLEXT_USE_LIBRARY_FD |
|
||||
ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET |
|
||||
ANDROID_DLEXT_FORCE_LOAD |
|
||||
ANDROID_DLEXT_USE_NAMESPACE |
|
||||
ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE,
|
||||
};
|
||||
|
||||
struct android_namespace_t;
|
||||
|
||||
/** Used to pass Android-specific arguments to android_dlopen_ext(). */
|
||||
typedef struct {
|
||||
/** A bitmask of `ANDROID_DLEXT_` enum values. */
|
||||
uint64_t flags;
|
||||
|
||||
/** Used by `ANDROID_DLEXT_RESERVED_ADDRESS` and `ANDROID_DLEXT_RESERVED_ADDRESS_HINT`. */
|
||||
void* _Nullable reserved_addr;
|
||||
/** Used by `ANDROID_DLEXT_RESERVED_ADDRESS` and `ANDROID_DLEXT_RESERVED_ADDRESS_HINT`. */
|
||||
size_t reserved_size;
|
||||
|
||||
/** Used by `ANDROID_DLEXT_WRITE_RELRO` and `ANDROID_DLEXT_USE_RELRO`. */
|
||||
int relro_fd;
|
||||
|
||||
/** Used by `ANDROID_DLEXT_USE_LIBRARY_FD`. */
|
||||
int library_fd;
|
||||
/** Used by `ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET` */
|
||||
off64_t library_fd_offset;
|
||||
|
||||
/** Used by `ANDROID_DLEXT_USE_NAMESPACE`. */
|
||||
struct android_namespace_t* _Nullable library_namespace;
|
||||
} android_dlextinfo;
|
||||
|
||||
/**
|
||||
* Opens the given library. The `__filename` and `__flags` arguments are
|
||||
* the same as for [dlopen(3)](http://man7.org/linux/man-pages/man3/dlopen.3.html),
|
||||
* with the Android-specific flags supplied via the `flags` member of `__info`.
|
||||
*/
|
||||
void* _Nullable android_dlopen_ext(const char* _Nullable __filename, int __flags, const android_dlextinfo* _Nullable __info);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Error checking for close(2).
|
||||
*
|
||||
* Mishandling of file descriptor ownership is a common source of errors that
|
||||
* can be extremely difficult to diagnose. Mistakes like the following can
|
||||
* result in seemingly 'impossible' failures showing up on other threads that
|
||||
* happened to try to open a file descriptor between the buggy code's close and
|
||||
* fclose:
|
||||
*
|
||||
* int print(int fd) {
|
||||
* int rc;
|
||||
* char buf[128];
|
||||
* while ((rc = read(fd, buf, sizeof(buf))) > 0) {
|
||||
* printf("%.*s", rc);
|
||||
* }
|
||||
* close(fd);
|
||||
* }
|
||||
*
|
||||
* int bug() {
|
||||
* FILE* f = fopen("foo", "r");
|
||||
* print(fileno(f));
|
||||
* fclose(f);
|
||||
* }
|
||||
*
|
||||
* To make it easier to find this class of bugs, bionic provides a method to
|
||||
* require that file descriptors are closed by their owners. File descriptors
|
||||
* can be associated with tags with which they must be closed. This allows
|
||||
* objects that conceptually own an fd (FILE*, unique_fd, etc.) to use their
|
||||
* own address at the tag, to enforce that closure of the fd must come as a
|
||||
* result of their own destruction (fclose, ~unique_fd, etc.)
|
||||
*
|
||||
* By default, a file descriptor's tag is 0, and close(fd) is equivalent to
|
||||
* closing fd with the tag 0.
|
||||
*/
|
||||
|
||||
/*
|
||||
* For improved diagnostics, the type of a file descriptors owner can be
|
||||
* encoded in the most significant byte of the owner tag. Values of 0 and 0xff
|
||||
* are ignored, which allows for raw pointers to be used as owner tags without
|
||||
* modification.
|
||||
*/
|
||||
enum android_fdsan_owner_type {
|
||||
/*
|
||||
* Generic Java or native owners.
|
||||
*
|
||||
* Generic Java objects always use 255 as their type, using identityHashCode
|
||||
* as the value of the tag, leaving bits 33-56 unset. Native pointers are sign
|
||||
* extended from 48-bits of virtual address space, and so can have the MSB
|
||||
* set to 255 as well. Use the value of bits 49-56 to distinguish between
|
||||
* these cases.
|
||||
*/
|
||||
ANDROID_FDSAN_OWNER_TYPE_GENERIC_00 = 0,
|
||||
ANDROID_FDSAN_OWNER_TYPE_GENERIC_FF = 255,
|
||||
|
||||
/* FILE* */
|
||||
ANDROID_FDSAN_OWNER_TYPE_FILE = 1,
|
||||
|
||||
/* DIR* */
|
||||
ANDROID_FDSAN_OWNER_TYPE_DIR = 2,
|
||||
|
||||
/* android::base::unique_fd */
|
||||
ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD = 3,
|
||||
|
||||
/* sqlite-owned file descriptors */
|
||||
ANDROID_FDSAN_OWNER_TYPE_SQLITE = 4,
|
||||
|
||||
/* java.io.FileInputStream */
|
||||
ANDROID_FDSAN_OWNER_TYPE_FILEINPUTSTREAM = 5,
|
||||
|
||||
/* java.io.FileOutputStream */
|
||||
ANDROID_FDSAN_OWNER_TYPE_FILEOUTPUTSTREAM = 6,
|
||||
|
||||
/* java.io.RandomAccessFile */
|
||||
ANDROID_FDSAN_OWNER_TYPE_RANDOMACCESSFILE = 7,
|
||||
|
||||
/* android.os.ParcelFileDescriptor */
|
||||
ANDROID_FDSAN_OWNER_TYPE_PARCELFILEDESCRIPTOR = 8,
|
||||
|
||||
/* ART FdFile */
|
||||
ANDROID_FDSAN_OWNER_TYPE_ART_FDFILE = 9,
|
||||
|
||||
/* java.net.DatagramSocketImpl */
|
||||
ANDROID_FDSAN_OWNER_TYPE_DATAGRAMSOCKETIMPL = 10,
|
||||
|
||||
/* java.net.SocketImpl */
|
||||
ANDROID_FDSAN_OWNER_TYPE_SOCKETIMPL = 11,
|
||||
|
||||
/* libziparchive's ZipArchive */
|
||||
ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE = 12,
|
||||
|
||||
/* native_handle_t */
|
||||
ANDROID_FDSAN_OWNER_TYPE_NATIVE_HANDLE = 13,
|
||||
|
||||
/* android::Parcel */
|
||||
ANDROID_FDSAN_OWNER_TYPE_PARCEL = 14,
|
||||
};
|
||||
|
||||
/*
|
||||
* Create an owner tag with the specified type and least significant 56 bits of tag.
|
||||
*/
|
||||
|
||||
#if __ANDROID_API__ >= 29
|
||||
uint64_t android_fdsan_create_owner_tag(enum android_fdsan_owner_type type, uint64_t tag) __INTRODUCED_IN(29) __attribute__((__weak__));
|
||||
|
||||
/*
|
||||
* Exchange a file descriptor's tag.
|
||||
*
|
||||
* Logs and aborts if the fd's tag does not match expected_tag.
|
||||
*/
|
||||
void android_fdsan_exchange_owner_tag(int fd, uint64_t expected_tag, uint64_t new_tag) __INTRODUCED_IN(29) __attribute__((__weak__));
|
||||
|
||||
/*
|
||||
* Close a file descriptor with a tag, and resets the tag to 0.
|
||||
*
|
||||
* Logs and aborts if the tag is incorrect.
|
||||
*/
|
||||
int android_fdsan_close_with_tag(int fd, uint64_t tag) __INTRODUCED_IN(29) __attribute__((__weak__));
|
||||
|
||||
/*
|
||||
* Get a file descriptor's current owner tag.
|
||||
*
|
||||
* Returns 0 for untagged and invalid file descriptors.
|
||||
*/
|
||||
uint64_t android_fdsan_get_owner_tag(int fd) __INTRODUCED_IN(29);
|
||||
|
||||
/*
|
||||
* Get an owner tag's string representation.
|
||||
*
|
||||
* The return value points to memory with static lifetime, do not attempt to modify it.
|
||||
*/
|
||||
const char* _Nonnull android_fdsan_get_tag_type(uint64_t tag) __INTRODUCED_IN(29);
|
||||
|
||||
/*
|
||||
* Get an owner tag's value, with the type masked off.
|
||||
*/
|
||||
uint64_t android_fdsan_get_tag_value(uint64_t tag) __INTRODUCED_IN(29);
|
||||
#endif /* __ANDROID_API__ >= 29 */
|
||||
|
||||
|
||||
enum android_fdsan_error_level {
|
||||
// No errors.
|
||||
ANDROID_FDSAN_ERROR_LEVEL_DISABLED,
|
||||
|
||||
// Warn once(ish) on error, and then downgrade to ANDROID_FDSAN_ERROR_LEVEL_DISABLED.
|
||||
ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE,
|
||||
|
||||
// Warn always on error.
|
||||
ANDROID_FDSAN_ERROR_LEVEL_WARN_ALWAYS,
|
||||
|
||||
// Abort on error.
|
||||
ANDROID_FDSAN_ERROR_LEVEL_FATAL,
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the error level.
|
||||
*/
|
||||
|
||||
#if __ANDROID_API__ >= 29
|
||||
enum android_fdsan_error_level android_fdsan_get_error_level() __INTRODUCED_IN(29) __attribute__((__weak__));
|
||||
|
||||
/*
|
||||
* Set the error level and return the previous state.
|
||||
*
|
||||
* Error checking is automatically disabled in the child of a fork, to maintain
|
||||
* compatibility with code that forks, closes all file descriptors, and then
|
||||
* execs.
|
||||
*
|
||||
* In cases such as the zygote, where the child has no intention of calling
|
||||
* exec, call this function to reenable fdsan checks.
|
||||
*
|
||||
* This function is not thread-safe and does not synchronize with checks of the
|
||||
* value, and so should probably only be called in single-threaded contexts
|
||||
* (e.g. postfork).
|
||||
*/
|
||||
enum android_fdsan_error_level android_fdsan_set_error_level(enum android_fdsan_error_level new_level) __INTRODUCED_IN(29) __attribute__((__weak__));
|
||||
#endif /* __ANDROID_API__ >= 29 */
|
||||
|
||||
|
||||
/*
|
||||
* Set the error level to the global setting if available, or a default value.
|
||||
*/
|
||||
|
||||
#if __ANDROID_API__ >= 30
|
||||
enum android_fdsan_error_level android_fdsan_set_error_level_from_property(enum android_fdsan_error_level default_level) __INTRODUCED_IN(30) __attribute__((__weak__));
|
||||
#endif /* __ANDROID_API__ >= 30 */
|
||||
|
||||
__END_DECLS
|
||||
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup FileDescriptor File Descriptor
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file file_descriptor_jni.h
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#if !defined(__BIONIC__) && !defined(__INTRODUCED_IN)
|
||||
#define __INTRODUCED_IN(x)
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Returns a new java.io.FileDescriptor.
|
||||
*
|
||||
* The FileDescriptor created represents an invalid Unix file descriptor (represented by
|
||||
* a file descriptor value of -1).
|
||||
*
|
||||
* Callers of this method should be aware that it can fail, returning NULL with a pending Java
|
||||
* exception.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param env a pointer to the JNI Native Interface of the current thread.
|
||||
* \return a java.io.FileDescriptor on success, nullptr if insufficient heap memory is available.
|
||||
*/
|
||||
jobject AFileDescriptor_create(JNIEnv* env) __INTRODUCED_IN(31);
|
||||
|
||||
/**
|
||||
* Returns the Unix file descriptor represented by the given java.io.FileDescriptor.
|
||||
*
|
||||
* A return value of -1 indicates that \a fileDescriptor represents an invalid file descriptor.
|
||||
*
|
||||
* Aborts the program if \a fileDescriptor is not a java.io.FileDescriptor instance.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param env a pointer to the JNI Native Interface of the current thread.
|
||||
* \param fileDescriptor a java.io.FileDescriptor instance.
|
||||
* \return the Unix file descriptor wrapped by \a fileDescriptor.
|
||||
*/
|
||||
int AFileDescriptor_getFd(JNIEnv* env, jobject fileDescriptor) __INTRODUCED_IN(31);
|
||||
|
||||
/**
|
||||
* Sets the Unix file descriptor represented by the given java.io.FileDescriptor.
|
||||
*
|
||||
* This function performs no validation of the Unix file descriptor argument, \a fd. Android uses
|
||||
* the value -1 to represent an invalid file descriptor, all other values are considered valid.
|
||||
* The validity of a file descriptor can be checked with FileDescriptor#valid().
|
||||
*
|
||||
* Aborts the program if \a fileDescriptor is not a java.io.FileDescriptor instance.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \param env a pointer to the JNI Native Interface of the current thread.
|
||||
* \param fileDescriptor a java.io.FileDescriptor instance.
|
||||
* \param fd a Unix file descriptor that \a fileDescriptor will subsequently represent.
|
||||
*/
|
||||
void AFileDescriptor_setFd(JNIEnv* env, jobject fileDescriptor, int fd) __INTRODUCED_IN(31);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,304 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Font
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file font.h
|
||||
* @brief Provides some constants used in system_fonts.h or fonts_matcher.h
|
||||
*
|
||||
* Available since API level 29.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FONT_H
|
||||
#define ANDROID_FONT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/******************************************************************
|
||||
*
|
||||
* IMPORTANT NOTICE:
|
||||
*
|
||||
* This file is part of Android's set of stable system headers
|
||||
* exposed by the Android NDK (Native Development Kit).
|
||||
*
|
||||
* Third-party source AND binary code relies on the definitions
|
||||
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
|
||||
*
|
||||
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
|
||||
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
|
||||
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
|
||||
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
enum {
|
||||
/** The minimum value fot the font weight value. */
|
||||
AFONT_WEIGHT_MIN = 0,
|
||||
|
||||
/** A font weight value for the thin weight. */
|
||||
AFONT_WEIGHT_THIN = 100,
|
||||
|
||||
/** A font weight value for the extra-light weight. */
|
||||
AFONT_WEIGHT_EXTRA_LIGHT = 200,
|
||||
|
||||
/** A font weight value for the light weight. */
|
||||
AFONT_WEIGHT_LIGHT = 300,
|
||||
|
||||
/** A font weight value for the normal weight. */
|
||||
AFONT_WEIGHT_NORMAL = 400,
|
||||
|
||||
/** A font weight value for the medium weight. */
|
||||
AFONT_WEIGHT_MEDIUM = 500,
|
||||
|
||||
/** A font weight value for the semi-bold weight. */
|
||||
AFONT_WEIGHT_SEMI_BOLD = 600,
|
||||
|
||||
/** A font weight value for the bold weight. */
|
||||
AFONT_WEIGHT_BOLD = 700,
|
||||
|
||||
/** A font weight value for the extra-bold weight. */
|
||||
AFONT_WEIGHT_EXTRA_BOLD = 800,
|
||||
|
||||
/** A font weight value for the black weight. */
|
||||
AFONT_WEIGHT_BLACK = 900,
|
||||
|
||||
/** The maximum value for the font weight value. */
|
||||
AFONT_WEIGHT_MAX = 1000
|
||||
};
|
||||
|
||||
struct AFont;
|
||||
/**
|
||||
* AFont provides information of the single font configuration.
|
||||
*/
|
||||
typedef struct AFont AFont;
|
||||
|
||||
/**
|
||||
* Close an AFont.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font returned by ASystemFontIterator_next or AFontMatchert_match.
|
||||
* Do nothing if NULL is passed.
|
||||
*/
|
||||
void AFont_close(AFont* _Nullable font) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Return an absolute path to the current font file.
|
||||
*
|
||||
* Here is a list of font formats returned by this method:
|
||||
* <ul>
|
||||
* <li>OpenType</li>
|
||||
* <li>OpenType Font Collection</li>
|
||||
* <li>TrueType</li>
|
||||
* <li>TrueType Collection</li>
|
||||
* </ul>
|
||||
* The file extension could be one of *.otf, *.ttf, *.otc or *.ttc.
|
||||
*
|
||||
* The font file returned is guaranteed to be opend with O_RDONLY.
|
||||
* Note that the returned pointer is valid until AFont_close() is called for the given font.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font object. Passing NULL is not allowed.
|
||||
* \return a string of the font file path.
|
||||
*/
|
||||
const char* _Nonnull AFont_getFontFilePath(const AFont* _Nonnull font) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Return a weight value associated with the current font.
|
||||
*
|
||||
* The weight values are positive and less than or equal to 1000.
|
||||
* Here are pairs of the common names and their values.
|
||||
* <p>
|
||||
* <table>
|
||||
* <tr>
|
||||
* <th align="center">Value</th>
|
||||
* <th align="center">Name</th>
|
||||
* <th align="center">NDK Definition</th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">100</td>
|
||||
* <td align="center">Thin</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_THIN}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">200</td>
|
||||
* <td align="center">Extra Light (Ultra Light)</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_EXTRA_LIGHT}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">300</td>
|
||||
* <td align="center">Light</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_LIGHT}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">400</td>
|
||||
* <td align="center">Normal (Regular)</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_NORMAL}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">500</td>
|
||||
* <td align="center">Medium</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_MEDIUM}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">600</td>
|
||||
* <td align="center">Semi Bold (Demi Bold)</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_SEMI_BOLD}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">700</td>
|
||||
* <td align="center">Bold</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_BOLD}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">800</td>
|
||||
* <td align="center">Extra Bold (Ultra Bold)</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_EXTRA_BOLD}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="center">900</td>
|
||||
* <td align="center">Black (Heavy)</td>
|
||||
* <td align="center">{@link AFONT_WEIGHT_BLACK}</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </p>
|
||||
* Note that the weight value may fall in between above values, e.g. 250 weight.
|
||||
*
|
||||
* For more information about font weight, read [OpenType usWeightClass](https://docs.microsoft.com/en-us/typography/opentype/spec/os2#usweightclass)
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font object. Passing NULL is not allowed.
|
||||
* \return a positive integer less than or equal to {@link AFONT_WEIGHT_MAX} is returned.
|
||||
*/
|
||||
uint16_t AFont_getWeight(const AFont* _Nonnull font) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Return true if the current font is italic, otherwise returns false.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font object. Passing NULL is not allowed.
|
||||
* \return true if italic, otherwise false.
|
||||
*/
|
||||
bool AFont_isItalic(const AFont* _Nonnull font) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Return a IETF BCP47 compliant language tag associated with the current font.
|
||||
*
|
||||
* For information about IETF BCP47, read [Locale.forLanguageTag(java.lang.String)](https://developer.android.com/reference/java/util/Locale.html#forLanguageTag(java.lang.String)")
|
||||
*
|
||||
* Note that the returned pointer is valid until AFont_close() is called.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font object. Passing NULL is not allowed.
|
||||
* \return a IETF BCP47 compliant language tag or nullptr if not available.
|
||||
*/
|
||||
const char* _Nullable AFont_getLocale(const AFont* _Nonnull font) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Return a font collection index value associated with the current font.
|
||||
*
|
||||
* In case the target font file is a font collection (e.g. .ttc or .otc), this
|
||||
* returns a non-negative value as an font offset in the collection. This
|
||||
* always returns 0 if the target font file is a regular font.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font object. Passing NULL is not allowed.
|
||||
* \return a font collection index.
|
||||
*/
|
||||
size_t AFont_getCollectionIndex(const AFont* _Nonnull font) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Return a count of font variation settings associated with the current font
|
||||
*
|
||||
* The font variation settings are provided as multiple tag-values pairs.
|
||||
*
|
||||
* For example, bold italic font may have following font variation settings:
|
||||
* 'wght' 700, 'slnt' -12
|
||||
* In this case, AFont_getAxisCount returns 2 and AFont_getAxisTag
|
||||
* and AFont_getAxisValue will return following values.
|
||||
* \code{.cpp}
|
||||
* AFont* font = ASystemFontIterator_next(ite);
|
||||
*
|
||||
* // Returns the number of axes
|
||||
* AFont_getAxisCount(font); // Returns 2
|
||||
*
|
||||
* // Returns the tag-value pair for the first axis.
|
||||
* AFont_getAxisTag(font, 0); // Returns 'wght'(0x77676874)
|
||||
* AFont_getAxisValue(font, 0); // Returns 700.0
|
||||
*
|
||||
* // Returns the tag-value pair for the second axis.
|
||||
* AFont_getAxisTag(font, 1); // Returns 'slnt'(0x736c6e74)
|
||||
* AFont_getAxisValue(font, 1); // Returns -12.0
|
||||
* \endcode
|
||||
*
|
||||
* For more information about font variation settings, read [Font Variations Table](https://docs.microsoft.com/en-us/typography/opentype/spec/fvar)
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font object. Passing NULL is not allowed.
|
||||
* \return a number of font variation settings.
|
||||
*/
|
||||
size_t AFont_getAxisCount(const AFont* _Nonnull font) __INTRODUCED_IN(29);
|
||||
|
||||
|
||||
/**
|
||||
* Return an OpenType axis tag associated with the current font.
|
||||
*
|
||||
* See AFont_getAxisCount for more details.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font object. Passing NULL is not allowed.
|
||||
* \param axisIndex an index to the font variation settings. Passing value larger than or
|
||||
* equal to {@link AFont_getAxisCount} is not allowed.
|
||||
* \return an OpenType axis tag value for the given font variation setting.
|
||||
*/
|
||||
uint32_t AFont_getAxisTag(const AFont* _Nonnull font, uint32_t axisIndex)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Return an OpenType axis value associated with the current font.
|
||||
*
|
||||
* See AFont_getAxisCount for more details.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param font a font object. Passing NULL is not allowed.
|
||||
* \param axisIndex an index to the font variation settings. Passing value larger than or
|
||||
* equal to {@link AFont_getAxisCount} is not allowed.
|
||||
* \return a float value for the given font variation setting.
|
||||
*/
|
||||
float AFont_getAxisValue(const AFont* _Nonnull font, uint32_t axisIndex)
|
||||
__INTRODUCED_IN(29);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_FONT_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,224 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Font
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file font_matcher.h
|
||||
* @brief Provides the font matching logic with various inputs.
|
||||
*
|
||||
* You can use this class for deciding what font is to be used for drawing text.
|
||||
*
|
||||
* A matcher is created from text style, locales and UI compatibility. The match function for
|
||||
* matcher object can be called multiple times until close function is called.
|
||||
*
|
||||
* Even if no font can render the given text, the match function will return a non-null result for
|
||||
* drawing Tofu character.
|
||||
*
|
||||
* Examples:
|
||||
* \code{.cpp}
|
||||
* // Simple font query for the ASCII character.
|
||||
* std::vector<uint16_t> text = { 'A' };
|
||||
* AFontMatcher* matcher = AFontMatcher_create("sans-serif");
|
||||
* AFont* font = AFontMatcher_match(text.data(), text.length(), &runLength);
|
||||
* // runLength will be 1 and the font will points a valid font file.
|
||||
* AFontMatcher_destroy(matcher);
|
||||
*
|
||||
* // Querying font for CJK characters
|
||||
* std::vector<uint16_t> text = { 0x9AA8 };
|
||||
* AFontMatcher* matcher = AFontMatcher_create("sans-serif");
|
||||
* AFontMatcher_setLocales(matcher, "zh-CN,ja-JP");
|
||||
* AFont* font = AFontMatcher_match(text.data(), text.length(), &runLength);
|
||||
* // runLength will be 1 and the font will points a Simplified Chinese font.
|
||||
* AFontMatcher_setLocales(matcher, "ja-JP,zh-CN");
|
||||
* AFont* font = AFontMatcher_match(text.data(), text.length(), &runLength);
|
||||
* // runLength will be 1 and the font will points a Japanese font.
|
||||
* AFontMatcher_destroy(matcher);
|
||||
*
|
||||
* // Querying font for text/color emoji
|
||||
* std::vector<uint16_t> text = { 0xD83D, 0xDC68, 0x200D, 0x2764, 0xFE0F, 0x200D, 0xD83D, 0xDC68 };
|
||||
* AFontMatcher* matcher = AFontMatcher_create("sans-serif");
|
||||
* AFont* font = AFontMatcher_match(text.data(), text.length(), &runLength);
|
||||
* // runLength will be 8 and the font will points a color emoji font.
|
||||
* AFontMatcher_destroy(matcher);
|
||||
*
|
||||
* // Mixture of multiple script of characters.
|
||||
* // 0x05D0 is a Hebrew character and 0x0E01 is a Thai character.
|
||||
* std::vector<uint16_t> text = { 0x05D0, 0x0E01 };
|
||||
* AFontMatcher* matcher = AFontMatcher_create("sans-serif");
|
||||
* AFont* font = AFontMatcher_match(text.data(), text.length(), &runLength);
|
||||
* // runLength will be 1 and the font will points a Hebrew font.
|
||||
* AFontMatcher_destroy(matcher);
|
||||
* \endcode
|
||||
*
|
||||
* Available since API level 29.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FONT_MATCHER_H
|
||||
#define ANDROID_FONT_MATCHER_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <android/font.h>
|
||||
|
||||
/******************************************************************
|
||||
*
|
||||
* IMPORTANT NOTICE:
|
||||
*
|
||||
* This file is part of Android's set of stable system headers
|
||||
* exposed by the Android NDK (Native Development Kit).
|
||||
*
|
||||
* Third-party source AND binary code relies on the definitions
|
||||
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
|
||||
*
|
||||
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
|
||||
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
|
||||
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
|
||||
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
enum {
|
||||
/** A family variant value for the system default variant. */
|
||||
AFAMILY_VARIANT_DEFAULT = 0,
|
||||
|
||||
/**
|
||||
* A family variant value for the compact font family variant.
|
||||
*
|
||||
* The compact font family has Latin-based vertical metrics.
|
||||
*/
|
||||
AFAMILY_VARIANT_COMPACT = 1,
|
||||
|
||||
/**
|
||||
* A family variant value for the elegant font family variant.
|
||||
*
|
||||
* The elegant font family may have larger vertical metrics than Latin font.
|
||||
*/
|
||||
AFAMILY_VARIANT_ELEGANT = 2,
|
||||
};
|
||||
|
||||
struct AFontMatcher;
|
||||
/**
|
||||
* AFontMatcher performs match operation on given parameters and available font files.
|
||||
* This matcher is not a thread-safe object. Do not pass this matcher to other threads.
|
||||
*/
|
||||
typedef struct AFontMatcher AFontMatcher;
|
||||
|
||||
/**
|
||||
* Select the best font from given parameters.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a new AFontMatcher object.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*/
|
||||
AFontMatcher* _Nonnull AFontMatcher_create() __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Destroy the matcher object.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param matcher a matcher object. Passing NULL is not allowed.
|
||||
*/
|
||||
void AFontMatcher_destroy(AFontMatcher* _Nonnull matcher) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Set font style to matcher.
|
||||
*
|
||||
* If this function is not called, the matcher performs with {@link AFONT_WEIGHT_NORMAL}
|
||||
* with non-italic style.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param matcher a matcher object. Passing NULL is not allowed.
|
||||
* \param weight a font weight value. Only from 0 to 1000 value is valid
|
||||
* \param italic true if italic, otherwise false.
|
||||
*/
|
||||
void AFontMatcher_setStyle(
|
||||
AFontMatcher* _Nonnull matcher,
|
||||
uint16_t weight,
|
||||
bool italic) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Set font locales to matcher.
|
||||
*
|
||||
* If this function is not called, the matcher performs with empty locale list.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param matcher a matcher object. Passing NULL is not allowed.
|
||||
* \param languageTags a null character terminated comma separated IETF BCP47 compliant language
|
||||
* tags.
|
||||
*/
|
||||
void AFontMatcher_setLocales(
|
||||
AFontMatcher* _Nonnull matcher,
|
||||
const char* _Nonnull languageTags) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Set family variant to matcher.
|
||||
*
|
||||
* If this function is not called, the matcher performs with {@link AFAMILY_VARIANT_DEFAULT}.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param matcher a matcher object. Passing NULL is not allowed.
|
||||
* \param familyVariant Must be one of {@link AFAMILY_VARIANT_DEFAULT},
|
||||
* {@link AFAMILY_VARIANT_COMPACT} or {@link AFAMILY_VARIANT_ELEGANT} is valid.
|
||||
*/
|
||||
void AFontMatcher_setFamilyVariant(
|
||||
AFontMatcher* _Nonnull matcher,
|
||||
uint32_t familyVariant) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Performs the matching from the generic font family for the text and select one font.
|
||||
*
|
||||
* For more information about generic font families, read [W3C spec](https://www.w3.org/TR/css-fonts-4/#generic-font-families)
|
||||
*
|
||||
* Even if no font can render the given text, this function will return a non-null result for
|
||||
* drawing Tofu character.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \param matcher a matcher object. Passing NULL is not allowed.
|
||||
* \param familyName a null character terminated font family name
|
||||
* \param text a UTF-16 encoded text buffer to be rendered. Do not pass empty string.
|
||||
* \param textLength a length of the given text buffer. This must not be zero.
|
||||
* \param runLengthOut if not null, the font run length will be filled.
|
||||
* \return a font to be used for given text and params. You need to release the returned font by
|
||||
* AFont_close when it is no longer needed.
|
||||
*/
|
||||
AFont* _Nonnull AFontMatcher_match(
|
||||
const AFontMatcher* _Nonnull matcher,
|
||||
const char* _Nonnull familyName,
|
||||
const uint16_t* _Nonnull text,
|
||||
const uint32_t textLength,
|
||||
uint32_t* _Nullable runLengthOut) __INTRODUCED_IN(29);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_FONT_MATCHER_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,621 @@
|
||||
/*
|
||||
* Copyright 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hardware_buffer.h
|
||||
* @brief API for native hardware buffers.
|
||||
*/
|
||||
/**
|
||||
* @defgroup AHardwareBuffer Native Hardware Buffer
|
||||
*
|
||||
* AHardwareBuffer objects represent chunks of memory that can be
|
||||
* accessed by various hardware components in the system. It can be
|
||||
* easily converted to the Java counterpart
|
||||
* android.hardware.HardwareBuffer and passed between processes using
|
||||
* Binder. All operations involving AHardwareBuffer and HardwareBuffer
|
||||
* are zero-copy, i.e., passing AHardwareBuffer to another process
|
||||
* creates a shared view of the same region of memory.
|
||||
*
|
||||
* AHardwareBuffers can be bound to EGL/OpenGL and Vulkan primitives.
|
||||
* For EGL, use the extension function eglGetNativeClientBufferANDROID
|
||||
* to obtain an EGLClientBuffer and pass it directly to
|
||||
* eglCreateImageKHR. Refer to the EGL extensions
|
||||
* EGL_ANDROID_get_native_client_buffer and
|
||||
* EGL_ANDROID_image_native_buffer for more information. In Vulkan,
|
||||
* the contents of the AHardwareBuffer can be accessed as external
|
||||
* memory. See the VK_ANDROID_external_memory_android_hardware_buffer
|
||||
* extension for details.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_BUFFER_H
|
||||
#define ANDROID_HARDWARE_BUFFER_H
|
||||
|
||||
#include <android/rect.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
// clang-format off
|
||||
|
||||
/**
|
||||
* Buffer pixel formats.
|
||||
*/
|
||||
enum AHardwareBuffer_Format {
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R8G8B8A8_UNORM
|
||||
* OpenGL ES: GL_RGBA8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM = 1,
|
||||
|
||||
/**
|
||||
* 32 bits per pixel, 8 bits per channel format where alpha values are
|
||||
* ignored (always opaque).
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R8G8B8A8_UNORM
|
||||
* OpenGL ES: GL_RGB8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM = 2,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R8G8B8_UNORM
|
||||
* OpenGL ES: GL_RGB8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM = 3,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R5G6B5_UNORM_PACK16
|
||||
* OpenGL ES: GL_RGB565
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM = 4,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R16G16B16A16_SFLOAT
|
||||
* OpenGL ES: GL_RGBA16F
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT = 0x16,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_A2B10G10R10_UNORM_PACK32
|
||||
* OpenGL ES: GL_RGB10_A2
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM = 0x2b,
|
||||
|
||||
/**
|
||||
* Opaque binary blob format.
|
||||
* Must have height 1 and one layer, with width equal to the buffer
|
||||
* size in bytes. Corresponds to Vulkan buffers and OpenGL buffer
|
||||
* objects. Can be bound to the latter using GL_EXT_external_buffer.
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_BLOB = 0x21,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_D16_UNORM
|
||||
* OpenGL ES: GL_DEPTH_COMPONENT16
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D16_UNORM = 0x30,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_X8_D24_UNORM_PACK32
|
||||
* OpenGL ES: GL_DEPTH_COMPONENT24
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D24_UNORM = 0x31,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_D24_UNORM_S8_UINT
|
||||
* OpenGL ES: GL_DEPTH24_STENCIL8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT = 0x32,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_D32_SFLOAT
|
||||
* OpenGL ES: GL_DEPTH_COMPONENT32F
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D32_FLOAT = 0x33,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_D32_SFLOAT_S8_UINT
|
||||
* OpenGL ES: GL_DEPTH32F_STENCIL8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT = 0x34,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_S8_UINT
|
||||
* OpenGL ES: GL_STENCIL_INDEX8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_S8_UINT = 0x35,
|
||||
|
||||
/**
|
||||
* YUV 420 888 format.
|
||||
* Must have an even width and height. Can be accessed in OpenGL
|
||||
* shaders through an external sampler. Does not support mip-maps
|
||||
* cube-maps or multi-layered textures.
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 = 0x23,
|
||||
|
||||
/**
|
||||
* YUV P010 format.
|
||||
* Must have an even width and height. Can be accessed in OpenGL
|
||||
* shaders through an external sampler. Does not support mip-maps
|
||||
* cube-maps or multi-layered textures.
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_YCbCr_P010 = 0x36,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R8_UNORM
|
||||
* OpenGL ES: GR_GL_R8
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R8_UNORM = 0x38,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R16_UINT
|
||||
* OpenGL ES: GL_R16UI
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R16_UINT = 0x39,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R16G16_UINT
|
||||
* OpenGL ES: GL_RG16UI
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R16G16_UINT = 0x3a,
|
||||
|
||||
/**
|
||||
* Corresponding formats:
|
||||
* Vulkan: VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16
|
||||
* OpenGL ES: N/A
|
||||
*/
|
||||
AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM = 0x3b,
|
||||
};
|
||||
|
||||
/**
|
||||
* Buffer usage flags, specifying how the buffer will be accessed.
|
||||
*/
|
||||
enum AHardwareBuffer_UsageFlags {
|
||||
/**
|
||||
* The buffer will never be locked for direct CPU reads using the
|
||||
* AHardwareBuffer_lock() function. Note that reading the buffer
|
||||
* using OpenGL or Vulkan functions or memory mappings is still
|
||||
* allowed.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_NEVER = 0UL,
|
||||
/**
|
||||
* The buffer will sometimes be locked for direct CPU reads using
|
||||
* the AHardwareBuffer_lock() function. Note that reading the
|
||||
* buffer using OpenGL or Vulkan functions or memory mappings
|
||||
* does not require the presence of this flag.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_RARELY = 2UL,
|
||||
/**
|
||||
* The buffer will often be locked for direct CPU reads using
|
||||
* the AHardwareBuffer_lock() function. Note that reading the
|
||||
* buffer using OpenGL or Vulkan functions or memory mappings
|
||||
* does not require the presence of this flag.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN = 3UL,
|
||||
|
||||
/** CPU read value mask. */
|
||||
AHARDWAREBUFFER_USAGE_CPU_READ_MASK = 0xFUL,
|
||||
/**
|
||||
* The buffer will never be locked for direct CPU writes using the
|
||||
* AHardwareBuffer_lock() function. Note that writing the buffer
|
||||
* using OpenGL or Vulkan functions or memory mappings is still
|
||||
* allowed.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER = 0UL << 4,
|
||||
/**
|
||||
* The buffer will sometimes be locked for direct CPU writes using
|
||||
* the AHardwareBuffer_lock() function. Note that writing the
|
||||
* buffer using OpenGL or Vulkan functions or memory mappings
|
||||
* does not require the presence of this flag.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY = 2UL << 4,
|
||||
/**
|
||||
* The buffer will often be locked for direct CPU writes using
|
||||
* the AHardwareBuffer_lock() function. Note that writing the
|
||||
* buffer using OpenGL or Vulkan functions or memory mappings
|
||||
* does not require the presence of this flag.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN = 3UL << 4,
|
||||
/** CPU write value mask. */
|
||||
AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK = 0xFUL << 4,
|
||||
/** The buffer will be read from by the GPU as a texture. */
|
||||
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE = 1UL << 8,
|
||||
/** The buffer will be written to by the GPU as a framebuffer attachment.*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER = 1UL << 9,
|
||||
/**
|
||||
* The buffer will be written to by the GPU as a framebuffer
|
||||
* attachment.
|
||||
*
|
||||
* Note that the name of this flag is somewhat misleading: it does
|
||||
* not imply that the buffer contains a color format. A buffer with
|
||||
* depth or stencil format that will be used as a framebuffer
|
||||
* attachment should also have this flag. Use the equivalent flag
|
||||
* AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER to avoid this confusion.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT = AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER,
|
||||
/**
|
||||
* The buffer will be used as a composer HAL overlay layer.
|
||||
*
|
||||
* This flag is currently only needed when using ASurfaceTransaction_setBuffer
|
||||
* to set a buffer. In all other cases, the framework adds this flag
|
||||
* internally to buffers that could be presented in a composer overlay.
|
||||
* ASurfaceTransaction_setBuffer is special because it uses buffers allocated
|
||||
* directly through AHardwareBuffer_allocate instead of buffers allocated
|
||||
* by the framework.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY = 1ULL << 11,
|
||||
/**
|
||||
* The buffer is protected from direct CPU access or being read by
|
||||
* non-secure hardware, such as video encoders.
|
||||
*
|
||||
* This flag is incompatible with CPU read and write flags. It is
|
||||
* mainly used when handling DRM video. Refer to the EGL extension
|
||||
* EGL_EXT_protected_content and GL extension
|
||||
* GL_EXT_protected_textures for more information on how these
|
||||
* buffers are expected to behave.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT = 1UL << 14,
|
||||
/** The buffer will be read by a hardware video encoder. */
|
||||
AHARDWAREBUFFER_USAGE_VIDEO_ENCODE = 1UL << 16,
|
||||
/**
|
||||
* The buffer will be used for direct writes from sensors.
|
||||
* When this flag is present, the format must be AHARDWAREBUFFER_FORMAT_BLOB.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA = 1UL << 23,
|
||||
/**
|
||||
* The buffer will be used as a shader storage or uniform buffer object.
|
||||
* When this flag is present, the format must be AHARDWAREBUFFER_FORMAT_BLOB.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER = 1UL << 24,
|
||||
/**
|
||||
* The buffer will be used as a cube map texture.
|
||||
* When this flag is present, the buffer must have a layer count
|
||||
* that is a multiple of 6. Note that buffers with this flag must be
|
||||
* bound to OpenGL textures using the extension
|
||||
* GL_EXT_EGL_image_storage instead of GL_KHR_EGL_image.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP = 1UL << 25,
|
||||
/**
|
||||
* The buffer contains a complete mipmap hierarchy.
|
||||
* Note that buffers with this flag must be bound to OpenGL textures using
|
||||
* the extension GL_EXT_EGL_image_storage instead of GL_KHR_EGL_image.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE = 1UL << 26,
|
||||
|
||||
/**
|
||||
* Usage: The buffer is used for front-buffer rendering. When
|
||||
* front-buffering rendering is specified, different usages may adjust their
|
||||
* behavior as a result. For example, when used as GPU_COLOR_OUTPUT the buffer
|
||||
* will behave similar to a single-buffered window. When used with
|
||||
* COMPOSER_OVERLAY, the system will try to prioritize the buffer receiving
|
||||
* an overlay plane & avoid caching it in intermediate composition buffers.
|
||||
*/
|
||||
AHARDWAREBUFFER_USAGE_FRONT_BUFFER = 1UL << 32,
|
||||
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_0 = 1ULL << 28,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_1 = 1ULL << 29,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_2 = 1ULL << 30,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_3 = 1ULL << 31,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_4 = 1ULL << 48,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_5 = 1ULL << 49,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_6 = 1ULL << 50,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_7 = 1ULL << 51,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_8 = 1ULL << 52,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_9 = 1ULL << 53,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_10 = 1ULL << 54,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_11 = 1ULL << 55,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_12 = 1ULL << 56,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_13 = 1ULL << 57,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_14 = 1ULL << 58,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_15 = 1ULL << 59,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_16 = 1ULL << 60,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_17 = 1ULL << 61,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_18 = 1ULL << 62,
|
||||
AHARDWAREBUFFER_USAGE_VENDOR_19 = 1ULL << 63,
|
||||
};
|
||||
|
||||
/**
|
||||
* Buffer description. Used for allocating new buffers and querying
|
||||
* parameters of existing ones.
|
||||
*/
|
||||
typedef struct AHardwareBuffer_Desc {
|
||||
uint32_t width; ///< Width in pixels.
|
||||
uint32_t height; ///< Height in pixels.
|
||||
/**
|
||||
* Number of images in an image array. AHardwareBuffers with one
|
||||
* layer correspond to regular 2D textures. AHardwareBuffers with
|
||||
* more than layer correspond to texture arrays. If the layer count
|
||||
* is a multiple of 6 and the usage flag
|
||||
* AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP is present, the buffer is
|
||||
* a cube map or a cube map array.
|
||||
*/
|
||||
uint32_t layers;
|
||||
uint32_t format; ///< One of AHardwareBuffer_Format.
|
||||
uint64_t usage; ///< Combination of AHardwareBuffer_UsageFlags.
|
||||
uint32_t stride; ///< Row stride in pixels, ignored for AHardwareBuffer_allocate()
|
||||
uint32_t rfu0; ///< Initialize to zero, reserved for future use.
|
||||
uint64_t rfu1; ///< Initialize to zero, reserved for future use.
|
||||
} AHardwareBuffer_Desc;
|
||||
|
||||
/**
|
||||
* Holds data for a single image plane.
|
||||
*/
|
||||
typedef struct AHardwareBuffer_Plane {
|
||||
void* _Nullable data; ///< Points to first byte in plane
|
||||
uint32_t pixelStride; ///< Distance in bytes from the color channel of one pixel to the next
|
||||
uint32_t rowStride; ///< Distance in bytes from the first value of one row of the image to
|
||||
/// the first value of the next row.
|
||||
} AHardwareBuffer_Plane;
|
||||
|
||||
/**
|
||||
* Holds all image planes that contain the pixel data.
|
||||
*/
|
||||
typedef struct AHardwareBuffer_Planes {
|
||||
uint32_t planeCount; ///< Number of distinct planes
|
||||
AHardwareBuffer_Plane planes[4]; ///< Array of image planes
|
||||
} AHardwareBuffer_Planes;
|
||||
|
||||
/**
|
||||
* Opaque handle for a native hardware buffer.
|
||||
*/
|
||||
typedef struct AHardwareBuffer AHardwareBuffer;
|
||||
|
||||
// clang-format on
|
||||
|
||||
/**
|
||||
* Allocates a buffer that matches the passed AHardwareBuffer_Desc.
|
||||
*
|
||||
* If allocation succeeds, the buffer can be used according to the
|
||||
* usage flags specified in its description. If a buffer is used in ways
|
||||
* not compatible with its usage flags, the results are undefined and
|
||||
* may include program termination.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success, or an error number of the allocation fails for
|
||||
* any reason. The returned buffer has a reference count of 1.
|
||||
*/
|
||||
int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* _Nonnull desc,
|
||||
AHardwareBuffer* _Nullable* _Nonnull outBuffer) __INTRODUCED_IN(26);
|
||||
/**
|
||||
* Acquire a reference on the given AHardwareBuffer object.
|
||||
*
|
||||
* This prevents the object from being deleted until the last reference
|
||||
* is removed.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*/
|
||||
void AHardwareBuffer_acquire(AHardwareBuffer* _Nonnull buffer) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Remove a reference that was previously acquired with
|
||||
* AHardwareBuffer_acquire() or AHardwareBuffer_allocate().
|
||||
*
|
||||
* Available since API level 26.
|
||||
*/
|
||||
void AHardwareBuffer_release(AHardwareBuffer* _Nonnull buffer) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Return a description of the AHardwareBuffer in the passed
|
||||
* AHardwareBuffer_Desc struct.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*/
|
||||
void AHardwareBuffer_describe(const AHardwareBuffer* _Nonnull buffer,
|
||||
AHardwareBuffer_Desc* _Nonnull outDesc) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Lock the AHardwareBuffer for direct CPU access.
|
||||
*
|
||||
* This function can lock the buffer for either reading or writing.
|
||||
* It may block if the hardware needs to finish rendering, if CPU caches
|
||||
* need to be synchronized, or possibly for other implementation-
|
||||
* specific reasons.
|
||||
*
|
||||
* The passed AHardwareBuffer must have one layer, otherwise the call
|
||||
* will fail.
|
||||
*
|
||||
* If \a fence is not negative, it specifies a fence file descriptor on
|
||||
* which to wait before locking the buffer. If it's negative, the caller
|
||||
* is responsible for ensuring that writes to the buffer have completed
|
||||
* before calling this function. Using this parameter is more efficient
|
||||
* than waiting on the fence and then calling this function.
|
||||
*
|
||||
* The \a usage parameter may only specify AHARDWAREBUFFER_USAGE_CPU_*.
|
||||
* If set, then outVirtualAddress is filled with the address of the
|
||||
* buffer in virtual memory. The flags must also be compatible with
|
||||
* usage flags specified at buffer creation: if a read flag is passed,
|
||||
* the buffer must have been created with
|
||||
* AHARDWAREBUFFER_USAGE_CPU_READ_RARELY or
|
||||
* AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN. If a write flag is passed, it
|
||||
* must have been created with AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY or
|
||||
* AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN.
|
||||
*
|
||||
* If \a rect is not NULL, the caller promises to modify only data in
|
||||
* the area specified by rect. If rect is NULL, the caller may modify
|
||||
* the contents of the entire buffer. The content of the buffer outside
|
||||
* of the specified rect is NOT modified by this call.
|
||||
*
|
||||
* It is legal for several different threads to lock a buffer for read
|
||||
* access; none of the threads are blocked.
|
||||
*
|
||||
* Locking a buffer simultaneously for write or read/write is undefined,
|
||||
* but will neither terminate the process nor block the caller.
|
||||
* AHardwareBuffer_lock may return an error or leave the buffer's
|
||||
* content in an indeterminate state.
|
||||
*
|
||||
* If the buffer has AHARDWAREBUFFER_FORMAT_BLOB, it is legal lock it
|
||||
* for reading and writing in multiple threads and/or processes
|
||||
* simultaneously, and the contents of the buffer behave like shared
|
||||
* memory.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success. -EINVAL if \a buffer is NULL, the usage flags
|
||||
* are not a combination of AHARDWAREBUFFER_USAGE_CPU_*, or the buffer
|
||||
* has more than one layer. Error number if the lock fails for any other
|
||||
* reason.
|
||||
*/
|
||||
int AHardwareBuffer_lock(AHardwareBuffer* _Nonnull buffer, uint64_t usage, int32_t fence,
|
||||
const ARect* _Nullable rect, void* _Nullable* _Nonnull outVirtualAddress)
|
||||
__INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Unlock the AHardwareBuffer from direct CPU access.
|
||||
*
|
||||
* Must be called after all changes to the buffer are completed by the
|
||||
* caller. If \a fence is NULL, the function will block until all work
|
||||
* is completed. Otherwise, \a fence will be set either to a valid file
|
||||
* descriptor or to -1. The file descriptor will become signaled once
|
||||
* the unlocking is complete and buffer contents are updated.
|
||||
* The caller is responsible for closing the file descriptor once it's
|
||||
* no longer needed. The value -1 indicates that unlocking has already
|
||||
* completed before the function returned and no further operations are
|
||||
* necessary.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success. -EINVAL if \a buffer is NULL. Error number if
|
||||
* the unlock fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_unlock(AHardwareBuffer* _Nonnull buffer, int32_t* _Nullable fence)
|
||||
__INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Send the AHardwareBuffer to an AF_UNIX socket.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a buffer is NULL, or an error
|
||||
* number if the operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* _Nonnull buffer, int socketFd)
|
||||
__INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Receive an AHardwareBuffer from an AF_UNIX socket.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a outBuffer is NULL, or an error
|
||||
* number if the operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd,
|
||||
AHardwareBuffer* _Nullable* _Nonnull outBuffer)
|
||||
__INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Lock a potentially multi-planar AHardwareBuffer for direct CPU access.
|
||||
*
|
||||
* This function is similar to AHardwareBuffer_lock, but can lock multi-planar
|
||||
* formats. The locked planes are returned in the \a outPlanes argument. Note,
|
||||
* that multi-planar should not be confused with multi-layer images, which this
|
||||
* locking function does not support.
|
||||
*
|
||||
* YUV formats are always represented by three separate planes of data, one for
|
||||
* each color plane. The order of planes in the array is guaranteed such that
|
||||
* plane #0 is always Y, plane #1 is always U (Cb), and plane #2 is always V
|
||||
* (Cr). All other formats are represented by a single plane.
|
||||
*
|
||||
* Additional information always accompanies the buffers, describing the row
|
||||
* stride and the pixel stride for each plane.
|
||||
*
|
||||
* In case the buffer cannot be locked, \a outPlanes will contain zero planes.
|
||||
*
|
||||
* See the AHardwareBuffer_lock documentation for all other locking semantics.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \return 0 on success. -EINVAL if \a buffer is NULL, the usage flags
|
||||
* are not a combination of AHARDWAREBUFFER_USAGE_CPU_*, or the buffer
|
||||
* has more than one layer. Error number if the lock fails for any other
|
||||
* reason.
|
||||
*/
|
||||
int AHardwareBuffer_lockPlanes(AHardwareBuffer* _Nonnull buffer, uint64_t usage, int32_t fence,
|
||||
const ARect* _Nullable rect,
|
||||
AHardwareBuffer_Planes* _Nonnull outPlanes) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Test whether the given format and usage flag combination is
|
||||
* allocatable.
|
||||
*
|
||||
* If this function returns true, it means that a buffer with the given
|
||||
* description can be allocated on this implementation, unless resource
|
||||
* exhaustion occurs. If this function returns false, it means that the
|
||||
* allocation of the given description will never succeed.
|
||||
*
|
||||
* The return value of this function may depend on all fields in the
|
||||
* description, except stride, which is always ignored. For example,
|
||||
* some implementations have implementation-defined limits on texture
|
||||
* size and layer count.
|
||||
*
|
||||
* Available since API level 29.
|
||||
*
|
||||
* \return 1 if the format and usage flag combination is allocatable,
|
||||
* 0 otherwise.
|
||||
*/
|
||||
int AHardwareBuffer_isSupported(const AHardwareBuffer_Desc* _Nonnull desc) __INTRODUCED_IN(29);
|
||||
|
||||
/**
|
||||
* Lock an AHardwareBuffer for direct CPU access.
|
||||
*
|
||||
* This function is the same as the above lock function, but passes back
|
||||
* additional information about the bytes per pixel and the bytes per stride
|
||||
* of the locked buffer. If the bytes per pixel or bytes per stride are unknown
|
||||
* or variable, or if the underlying mapper implementation does not support returning
|
||||
* additional information, then this call will fail with INVALID_OPERATION
|
||||
*
|
||||
* Available since API level 29.
|
||||
*/
|
||||
int AHardwareBuffer_lockAndGetInfo(AHardwareBuffer* _Nonnull buffer, uint64_t usage, int32_t fence,
|
||||
const ARect* _Nullable rect,
|
||||
void* _Nullable* _Nonnull outVirtualAddress,
|
||||
int32_t* _Nonnull outBytesPerPixel,
|
||||
int32_t* _Nonnull outBytesPerStride) __INTRODUCED_IN(29);
|
||||
|
||||
|
||||
/**
|
||||
* Get the system wide unique id for an AHardwareBuffer.
|
||||
*
|
||||
* Available since API level 31.
|
||||
*
|
||||
* \return 0 on success, -EINVAL if \a buffer or \a outId is NULL, or an error number if the
|
||||
* operation fails for any reason.
|
||||
*/
|
||||
int AHardwareBuffer_getId(const AHardwareBuffer* _Nonnull buffer, uint64_t* _Nonnull outId)
|
||||
__INTRODUCED_IN(31);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_HARDWARE_BUFFER_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hardware_buffer_aidl.h
|
||||
* @brief HardwareBuffer NDK AIDL glue code
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup AHardwareBuffer
|
||||
*
|
||||
* Parcelable support for AHardwareBuffer. Can be used with libbinder_ndk
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_BUFFER_AIDL_H
|
||||
#define ANDROID_HARDWARE_BUFFER_AIDL_H
|
||||
|
||||
#include <android/binder_parcel.h>
|
||||
#include <android/hardware_buffer.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Read an AHardwareBuffer from a AParcel. The output buffer will have an
|
||||
* initial reference acquired and will need to be released with
|
||||
* AHardwareBuffer_release.
|
||||
*
|
||||
* Available since API level 34.
|
||||
*
|
||||
* \return STATUS_OK on success
|
||||
* STATUS_BAD_VALUE if the parcel or outBuffer is null, or if there's an
|
||||
* issue deserializing (eg, corrupted parcel)
|
||||
* STATUS_BAD_TYPE if the parcel's current data position is not that of
|
||||
* an AHardwareBuffer type
|
||||
* STATUS_NO_MEMORY if an allocation fails
|
||||
*/
|
||||
binder_status_t AHardwareBuffer_readFromParcel(const AParcel* _Nonnull parcel,
|
||||
AHardwareBuffer* _Nullable* _Nonnull outBuffer) __INTRODUCED_IN(34);
|
||||
|
||||
/**
|
||||
* Write an AHardwareBuffer to an AParcel.
|
||||
*
|
||||
* Available since API level 34.
|
||||
*
|
||||
* \return STATUS_OK on success.
|
||||
* STATUS_BAD_VALUE if either buffer or parcel is null, or if the AHardwareBuffer*
|
||||
* fails to serialize (eg, internally corrupted)
|
||||
* STATUS_NO_MEMORY if the parcel runs out of space to store the buffer & is
|
||||
* unable to allocate more
|
||||
* STATUS_FDS_NOT_ALLOWED if the parcel does not allow storing FDs
|
||||
*/
|
||||
binder_status_t AHardwareBuffer_writeToParcel(const AHardwareBuffer* _Nonnull buffer,
|
||||
AParcel* _Nonnull parcel) __INTRODUCED_IN(34);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
// Only enable the AIDL glue helper if this is C++
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace aidl::android::hardware {
|
||||
|
||||
/**
|
||||
* Wrapper class that enables interop with AIDL NDK generation
|
||||
* Takes ownership of the AHardwareBuffer* given to it in reset() and will automatically
|
||||
* destroy it in the destructor, similar to a smart pointer container
|
||||
*/
|
||||
class HardwareBuffer {
|
||||
public:
|
||||
HardwareBuffer() noexcept {}
|
||||
HardwareBuffer(HardwareBuffer&& other) noexcept : mBuffer(other.release()) {}
|
||||
|
||||
~HardwareBuffer() {
|
||||
reset();
|
||||
}
|
||||
|
||||
binder_status_t readFromParcel(const AParcel* _Nonnull parcel) {
|
||||
reset();
|
||||
if (__builtin_available(android __ANDROID_API_U__, *)) {
|
||||
return AHardwareBuffer_readFromParcel(parcel, &mBuffer);
|
||||
} else {
|
||||
return STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
}
|
||||
|
||||
binder_status_t writeToParcel(AParcel* _Nonnull parcel) const {
|
||||
if (!mBuffer) {
|
||||
return STATUS_BAD_VALUE;
|
||||
}
|
||||
if (__builtin_available(android __ANDROID_API_U__, *)) {
|
||||
return AHardwareBuffer_writeToParcel(mBuffer, parcel);
|
||||
} else {
|
||||
return STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys any currently owned AHardwareBuffer* and takes ownership of the given
|
||||
* AHardwareBuffer*
|
||||
*
|
||||
* @param buffer The buffer to take ownership of
|
||||
*/
|
||||
void reset(AHardwareBuffer* _Nullable buffer = nullptr) noexcept {
|
||||
if (mBuffer) {
|
||||
AHardwareBuffer_release(mBuffer);
|
||||
mBuffer = nullptr;
|
||||
}
|
||||
mBuffer = buffer;
|
||||
}
|
||||
|
||||
inline AHardwareBuffer* _Nullable operator-> () const { return mBuffer; }
|
||||
inline AHardwareBuffer* _Nullable get() const { return mBuffer; }
|
||||
inline explicit operator bool () const { return mBuffer != nullptr; }
|
||||
|
||||
inline bool operator!=(const HardwareBuffer& rhs) const { return get() != rhs.get(); }
|
||||
inline bool operator<(const HardwareBuffer& rhs) const { return get() < rhs.get(); }
|
||||
inline bool operator<=(const HardwareBuffer& rhs) const { return get() <= rhs.get(); }
|
||||
inline bool operator==(const HardwareBuffer& rhs) const { return get() == rhs.get(); }
|
||||
inline bool operator>(const HardwareBuffer& rhs) const { return get() > rhs.get(); }
|
||||
inline bool operator>=(const HardwareBuffer& rhs) const { return get() >= rhs.get(); }
|
||||
|
||||
HardwareBuffer& operator=(HardwareBuffer&& other) noexcept {
|
||||
reset(other.release());
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops managing any contained AHardwareBuffer*, returning it to the caller. Ownership
|
||||
* is released.
|
||||
* @return AHardwareBuffer* or null if this was empty
|
||||
*/
|
||||
[[nodiscard]] AHardwareBuffer* _Nullable release() noexcept {
|
||||
AHardwareBuffer* _Nullable ret = mBuffer;
|
||||
mBuffer = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline std::string toString() const {
|
||||
if (!mBuffer) {
|
||||
return "<HardwareBuffer: Invalid>";
|
||||
}
|
||||
if (__builtin_available(android __ANDROID_API_S__, *)) {
|
||||
uint64_t id = 0;
|
||||
AHardwareBuffer_getId(mBuffer, &id);
|
||||
return "<HardwareBuffer " + std::to_string(id) + ">";
|
||||
} else {
|
||||
return "<HardwareBuffer (unknown)>";
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
HardwareBuffer(const HardwareBuffer& other) = delete;
|
||||
HardwareBuffer& operator=(const HardwareBuffer& other) = delete;
|
||||
|
||||
AHardwareBuffer* _Nullable mBuffer = nullptr;
|
||||
};
|
||||
|
||||
} // aidl::android::hardware
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // ANDROID_HARDWARE_BUFFER_AIDL_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup AHardwareBuffer
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hardware_buffer_jni.h
|
||||
* @brief JNI glue for native hardware buffers.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_BUFFER_JNI_H
|
||||
#define ANDROID_HARDWARE_BUFFER_JNI_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <android/hardware_buffer.h>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Return the AHardwareBuffer wrapped by a Java HardwareBuffer object.
|
||||
*
|
||||
* This method does not acquire any additional reference to the AHardwareBuffer
|
||||
* that is returned. To keep the AHardwareBuffer alive after the Java
|
||||
* HardwareBuffer object is closed, explicitly or by the garbage collector, be
|
||||
* sure to use AHardwareBuffer_acquire() to acquire an additional reference.
|
||||
*
|
||||
* Available since API level 26.
|
||||
*/
|
||||
AHardwareBuffer* AHardwareBuffer_fromHardwareBuffer(JNIEnv* env,
|
||||
jobject hardwareBufferObj) __INTRODUCED_IN(26);
|
||||
|
||||
/**
|
||||
* Return a new Java HardwareBuffer object that wraps the passed native
|
||||
* AHardwareBuffer object. The Java HardwareBuffer will acquire a reference to
|
||||
* the internal buffer and manage its lifetime. For example:
|
||||
*
|
||||
* <pre><code>
|
||||
* AHardwareBuffer* buffer;
|
||||
* AHardwareBuffer_allocate(..., &buffer); // `buffer` has reference count 1
|
||||
* jobject java_result = AHardwareBuffer_toHardwareBuffer(buffer); // `buffer` has reference count 2.
|
||||
* AHardwareBuffer_release(buffer); // `buffer` has reference count 1
|
||||
* return result; // The underlying buffer is kept alive by `java_result` and
|
||||
* // will be set to 0 when it is closed on the Java side with
|
||||
* // HardwareBuffer::close().
|
||||
* </code></pre>
|
||||
*
|
||||
* Available since API level 26.
|
||||
*/
|
||||
jobject AHardwareBuffer_toHardwareBuffer(JNIEnv* env,
|
||||
AHardwareBuffer* hardwareBuffer) __INTRODUCED_IN(26);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_HARDWARE_BUFFER_JNI_H
|
||||
|
||||
/** @} */
|
||||
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hdr_metadata.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HDR_METADATA_H
|
||||
#define ANDROID_HDR_METADATA_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* These structures are used to define the display's capabilities for HDR content.
|
||||
* They can be used to better tone map content to user's display.
|
||||
*/
|
||||
|
||||
/**
|
||||
* HDR metadata standards that are supported by Android.
|
||||
*/
|
||||
enum AHdrMetadataType : uint32_t {
|
||||
HDR10_SMPTE2086 = 1,
|
||||
HDR10_CTA861_3 = 2,
|
||||
HDR10PLUS_SEI = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* Color is defined in CIE XYZ coordinates.
|
||||
*/
|
||||
struct AColor_xy {
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
/**
|
||||
* SMPTE ST 2086 "Mastering Display Color Volume" static metadata
|
||||
*/
|
||||
struct AHdrMetadata_smpte2086 {
|
||||
struct AColor_xy displayPrimaryRed;
|
||||
struct AColor_xy displayPrimaryGreen;
|
||||
struct AColor_xy displayPrimaryBlue;
|
||||
struct AColor_xy whitePoint;
|
||||
float maxLuminance;
|
||||
float minLuminance;
|
||||
};
|
||||
|
||||
/**
|
||||
* CTA 861.3 "HDR Static Metadata Extension" static metadata
|
||||
*/
|
||||
struct AHdrMetadata_cta861_3 {
|
||||
float maxContentLightLevel;
|
||||
float maxFrameAverageLightLevel;
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_HDR_METADATA_H
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user