Skip to content

Commit 4abf4b8

Browse files
Guy1524Derek Lesho
authored andcommitted
Add MESA_map_buffer_client_pointer.
1 parent 0b449b9 commit 4abf4b8

4 files changed

Lines changed: 162 additions & 2 deletions

File tree

api/GL/glext.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9503,6 +9503,18 @@ GLAPI void APIENTRY glGetFramebufferParameterivMESA (GLenum target, GLenum pname
95039503
#define GL_FRAMEBUFFER_SWAP_XY_MESA 0x8BBD
95049504
#endif /* GL_MESA_framebuffer_swap_xy */
95059505

9506+
#ifndef GL_MESA_map_buffer_client_pointer
9507+
#define GL_MESA_map_buffer_client_pointer
9508+
#define GL_BUFFER_CLIENT_POINTER_SIZE_MESA 0x9790
9509+
#define GL_MAP_CLIENT_POINTER_BIT_MESA 0x4000
9510+
typedef void (APIENTRYP PFNGLADDCLIENTPOINTERRANGEMESAPROC) (void *addr, GLsizeiptr size);
9511+
typedef void *(APIENTRYP PFNGLRELEASECLIENTPOINTERRANGEMESAPROC) (GLsizeiptr *size);
9512+
#ifdef GL_GLEXT_PROTOTYPES
9513+
GLAPI void APIENTRY glAddClientPointerRangeMESA(void *addr, GLsizeiptr size);
9514+
GLAPI void *APIENTRY glReleaseClientPointerRangeMESA(GLsizeiptr *size);
9515+
#endif
9516+
#endif /* GL_MESA_map_buffer_client_memory */
9517+
95069518
#ifndef GL_MESA_pack_invert
95079519
#define GL_MESA_pack_invert 1
95089520
#define GL_PACK_INVERT_MESA 0x8758
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
Name
2+
3+
MESA_map_buffer_client_pointer
4+
5+
Name Strings
6+
7+
GL_MESA_map_buffer_client_pointer
8+
9+
Contact
10+
11+
Derek Lesho <dlesho@codeweavers.com>
12+
13+
Contributors
14+
15+
Derek Lesho, Codeweavers
16+
17+
Status
18+
19+
Proposal
20+
21+
Version
22+
23+
Version 1, February, 2026
24+
25+
Number
26+
27+
OpenGL Extension 562
28+
29+
Dependencies
30+
31+
OpenGL 3.0 or ARB_map_buffer_ranged is required.
32+
33+
This extension is written against the OpenGL 4.6 (Core Profile)
34+
Specification.
35+
36+
Overview
37+
38+
This extension allows the application to specify pointer ranges within
39+
which buffers should be mapped.
40+
41+
This extension is proposed to help the WINE project [https://winehq.org],
42+
which implements the 32-bit Windows OpenGL ABI on top of 64-bit Linux,
43+
return an address in 32-bit range from Map(Named)Buffer(Range).
44+
45+
IP Status
46+
47+
None
48+
49+
Issues
50+
51+
None
52+
53+
New Procedures and Functions
54+
55+
void AddClientPointerRangeMESA( void *addr, sizeiptr size );
56+
57+
void *ReleaseClientPointerRangeMESA( sizeiptr *size );
58+
59+
60+
New Types
61+
62+
None
63+
64+
New Tokens
65+
66+
Accepted by the <access> parameter of MapBufferRange:
67+
68+
MAP_CLIENT_POINTER_BIT_MESA 0x4000
69+
70+
Accepted by the <pname> parameter of GetBufferParameter{i|i64}v:
71+
72+
BUFFER_CLIENT_POINTER_SIZE_MESA 0x9790
73+
74+
75+
Additions to Chapter 6 of the OpenGL Core Profile Specification, Version 4.6,
76+
"Buffer Objects"
77+
78+
Modify Section 6.3, "Mapping and Unmapping Buffer Data"
79+
80+
Add to the bulleted list describing flags that modify buffer mappings,
81+
p.73.
82+
83+
* MAP_CLIENT_POINTER_BIT_MESA indicates the mapped buffer pointer must
84+
be in an address range provided by in AddClientPointerRangeMESA. If
85+
no space is found, OUT_OF_MEMORY is returned.
86+
87+
Append to Section 6.3 "Mapping and Unmapping Buffer Data", p.78.
88+
89+
If a buffer is mapped with the MAP_CLIENT_POINTER_BIT_MESA flag, the
90+
returned pointer will be in a range provided by the application through
91+
92+
void AddClientPointerRangeMESA( void *addr, sizeiptr size );
93+
94+
with <addr> set to the start of a page-aligned address range of size
95+
<size> with read and write permissions. The driver will hold this
96+
address range for as long as it contains any buffer mappings. While the
97+
driver holds the address range, memory access to it in in any manner
98+
other than as defined by Map(Named)BufferRange is undefined. To
99+
reaquire the pages, first unmap any buffers in the range, call Flush,
100+
and thence
101+
102+
void *ReleaseClientPointerRangeMESA( sizeiptr *size );
103+
104+
will return the range back to the application, with <size>
105+
relaying back the size of the returned range.
106+
107+
108+
Errors
109+
110+
OUT_OF_MEMORY is generated by Map(Named)Buffer if
111+
MAP_CLIENT_POINTER_BIT_MESA is included in <access> but no space can be
112+
found for a mapping in the ranges provided by AddClientPointerRangeMESA. In
113+
this case, the buffer object state value BUFFER_CLIENT_POINTER_SIZE_MESA is
114+
set to the size required of a new client pointer range to enable mapping
115+
the buffer with MAP_CLIENT_POINTER_BIT_MESA.
116+
117+
Revision History
118+
119+
Version 1, 2026-2-25 (Derek Lesho)
120+
Initial draft.

extensions/registry.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3109,6 +3109,12 @@
31093109
'supporters' : { 'MESA' },
31103110
'url' : 'extensions/MESA/MESA_framebuffer_swap_xy.txt',
31113111
},
3112+
'GL_MESA_map_buffer_client_pointer' : {
3113+
'number' : 562,
3114+
'flags' : { 'public' },
3115+
'supporters' : { 'MESA' },
3116+
'url' : 'extensions/MESA/MESA_map_buffer_client_pointer.txt',
3117+
},
31123118
'GL_MESA_pack_invert' : {
31133119
'number' : 300,
31143120
'flags' : { 'public' },

xml/gl.xml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ typedef unsigned int GLhandleARB;
194194
<enum value="0x0040" name="GL_MAP_PERSISTENT_BIT_EXT" group="MapBufferAccessMask,BufferStorageMask"/>
195195
<enum value="0x0080" name="GL_MAP_COHERENT_BIT" group="MapBufferAccessMask,BufferStorageMask"/>
196196
<enum value="0x0080" name="GL_MAP_COHERENT_BIT_EXT" group="MapBufferAccessMask,BufferStorageMask"/>
197+
<enum value="0x4000" name="GL_MAP_CLIENT_POINTER_BIT_MESA" group="MapBufferAccessMask"/>
197198
</enums>
198199

199200
<enums namespace="GL" group="MemoryBarrierMask" type="bitmask">
@@ -7113,6 +7114,10 @@ typedef unsigned int GLhandleARB;
71137114
<unused start="0x9781" end="0x978F" vendor="AMD"/>
71147115
</enums>
71157116

7117+
<enums namespace="GL" start="0x9790" end="0x979F" vendor="MESA">
7118+
<enum value="0x9790" name="GL_BUFFER_CLIENT_POINTER_SIZE_MESA" group="BufferPNameARB"/>
7119+
</enums>
7120+
71167121
<!-- Enums reservable for future use. To reserve a new range, allocate one
71177122
or more multiples of 16 starting at the lowest available point in this
71187123
block and note it in a new <enums> block immediately above.
@@ -7122,8 +7127,8 @@ typedef unsigned int GLhandleARB;
71227127
file) File requests in the Khronos Bugzilla, OpenGL project, Registry
71237128
component. -->
71247129

7125-
<enums namespace="GL" start="0x9790" end="99999" vendor="ARB" comment="RESERVED FOR FUTURE ALLOCATIONS BY KHRONOS">
7126-
<unused start="0x9790" end="99999" comment="RESERVED"/>
7130+
<enums namespace="GL" start="0x97A0" end="99999" vendor="ARB" comment="RESERVED FOR FUTURE ALLOCATIONS BY KHRONOS">
7131+
<unused start="0x97A0" end="99999" comment="RESERVED"/>
71277132
</enums>
71287133

71297134
<!-- Historical large block allocations, all unused except (in older days) by IBM -->
@@ -7235,6 +7240,11 @@ typedef unsigned int GLhandleARB;
72357240
<param class="program"><ptype>GLuint</ptype> <name>program</name></param>
72367241
<param len="COMPSIZE(name)">const <ptype>GLchar</ptype> *<name>name</name></param>
72377242
</command>
7243+
<command>
7244+
<proto>void <name>glAddClientPointerRangeMESA</name></proto>
7245+
<param><ptype>GLvoid *</ptype> <name>addr</name></param>
7246+
<param><ptype>GLsizeiptr</ptype> <name>size</name></param>
7247+
</command>
72387248
<command>
72397249
<proto>void <name>glAlphaFragmentOp1ATI</name></proto>
72407250
<param group="FragmentOp1ATI"><ptype>GLenum</ptype> <name>op</name></param>
@@ -22470,6 +22480,10 @@ typedef unsigned int GLhandleARB;
2247022480
<param len="4">const <ptype>GLdouble</ptype> *<name>equation</name></param>
2247122481
<glx type="render" opcode="2071"/>
2247222482
</command>
22483+
<command>
22484+
<proto>void* <name>glReleaseClientPointerRangeMESA</name></proto>
22485+
<param><ptype>GLsizeiptr *</ptype> <name>size</name></param>
22486+
</command>
2247322487
<command>
2247422488
<proto>void <name>glReleaseShaderCompiler</name></proto>
2247522489
</command>
@@ -43662,6 +43676,14 @@ typedef unsigned int GLhandleARB;
4366243676
<enum name="GL_FRAMEBUFFER_SWAP_XY_MESA"/>
4366343677
</require>
4366443678
</extension>
43679+
<extension name="GL_MESA_map_buffer_client_pointer" supported="gl">
43680+
<require>
43681+
<enum name="GL_MAP_CLIENT_POINTER_BIT_MESA"/>
43682+
<enum name="GL_BUFFER_CLIENT_POINTER_SIZE_MESA"/>
43683+
<command name="glAddClientPointerRangeMESA"/>
43684+
<command name="glReleaseClientPointerRangeMESA"/>
43685+
</require>
43686+
</extension>
4366543687
<extension name="GL_MESA_pack_invert" supported="gl">
4366643688
<require>
4366743689
<enum name="GL_PACK_INVERT_MESA"/>

0 commit comments

Comments
 (0)