Branch
Hash :
166b72c9
Author :
Date :
2024-09-30T19:07:26
GL_ANGLE_blob_cache implementation. Bug: chromium:370538323 Change-Id: Ic51a951e78b48b315e36f518bcc39ff2d54660a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5900761 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
Name
ANGLE_blob_cache
Name Strings
GL_ANGLE_blob_cache
Contributors
Geoff Lang
Contact
Geoff Lang (geofflang 'at' google.com)
Notice
Copyright (c) 2024 The Khronos Group Inc. Copyright terms at
http://www.khronos.org/registry/speccopyright.html
Status
Draft
Version
Version 1, October 4, 2024
Number
OpenGL ES Extension #??
Dependencies
Requires OpenGL ES 2.0
Written against the OpenGL ES 3.2 specification.
Overview
This extension provides a mechanism for an OpenGL context to cache binary
blobs. The application must implement the cache and is in control of caching
behavior.
This extension adds caching callbacks per-context which is useful for
isolating cached data and providing extra security.
New Procedures and Functions
void SetBlobCacheFuncsANGLE(SETBLOBPROCANGLE set,
GETBLOBPROCANGLE get,
const void* userParam);
void GetPointervANGLE(enum pname, void **params);
New Types
The callback functions that applications can define, and
are accepted by SetBlobCacheFuncsANGLE, are defined as:
typedef GLsizeiptr (GL_APIENTRY *GLGETBLOBPROCANGLE)(const void *key,
GLsizeiptr keySize,
void *value,
GLsizeiptr valueSize,
const void *userParam);
typedef void (GL_APIENTRY *GLSETBLOBPROCANGLE)(const void *key,
GLsizeiptr keySize,
const void *value,
GLsizeiptr valueSize,
const void *userParam);
Note that these function pointers are defined as having the same calling
convention as the GL functions.
New Tokens
Tokens accepted by the <pname> parameter of GetPointerv:
BLOB_CACHE_GET_FUNCTION_ANGLE 0x96BF
BLOB_CACHE_SET_FUNCTION_ANGLE 0x96EF
BLOB_CACHE_USER_PARAM_ANGLE 0x972D
Additions to the OpenGL ES Specification
Add a new section after 18 Debug Output:
"Chapter 19
Persistent Caching
Application developers can set callback functions which GL may use for
getting and setting persistently cached data blobs. The command
void SetBlobCacheFuncsANGLE(SETBLOBPROCANGLE set,
GETBLOBPROCANGLE get,
const void* userParam);
stores the get and set callbacks and user parameter. Only one blob cache
get and set function can be installed on the current context. Specifying NULL
for the callbacks will clear the current callbacks and disable blob caching.
Applications can provide user-specified data through the pointer <userParam>.
The context will store this pointer and will include it as one of the parameters
in each call to the callback function.
Applications can query the current callback functions and the current
user-specified parameter by obtaining the values of
BLOB_CACHE_GET_FUNCTION_ANGLE, BLOB_CACHE_SET_FUNCTION_ANGLE and
BLOB_CACHE_USER_PARAM_ANGLE.
To insert a new binary value into the cache and associate it with a given
key, a GL context can call the application-provided callback function
sizeiptr get(const void *key, sizeiptr keySize, void *value, sizeiptr valueSize,
const void *userParam);
<key> and <value> are pointers to the beginning of the key and value,
respectively, that are to be inserted. <keySize> and <valueSize> specify
the size in bytes of the data pointed to by <key> and <value> respectively.
To retrieve the binary value associated with a given key from the cache, a
GL context can call the application-provided callback function
set(const void *key, sizeiptr keySize, const void *value, sizeiptr valueSize,
const void *userParam);
<key> is a pointer to the beginning of the key. <keySize> specifies the
size in bytes of the binary key pointed to by <key>. If the cache contains
a value associated with the given key then the size of that binary value in
bytes is returned. Otherwise 0 is returned.
If the cache contains a value for the given key and its size in bytes is
less than or equal to <valueSize> then the value is written to the memory
pointed to by <value>. Otherwise nothing is written to the memory pointed
to by <value>.
Additionally, these callbacks must be declared with the same platform-dependent
calling convention used in the definition of the type GLGETBLOBPROCANGLE and
GLSETBLOBPROCANGLE. Anything else will result in undefined behavior.
Errors
An INVALID_OPERATION error is generated by SetBlobCacheFuncsANGLE if one of
<get> or <set> are NULL and the other is non-NULL.
New State
Modify Table 21.57: Miscellaneous
Add:
Initial
Get Value Type Get Command Value Description
--------------------------------- ---- ----------- ------- ---------------------
GL_BLOB_CACHE_GET_FUNCTION_ANGLE Y GetPointerv NULL Blob cache getter function
GL_BLOB_CACHE_SET_FUNCTION_ANGLE Y GetPointerv NULL Blob cache setter function
GL_BLOB_CACHE_USER_PARAM_ANGLE Y GetPointerv NULL Blob cache callback user
data parameter
Conformance Tests
TBD
Issues
None
Revision History
Rev. Date Author Changes
---- ------------- --------- ----------------------------------------
1 Oct 4, 2024 geofflang Initial version