[Mesa-dev] [PATCH V2 00/17] Newbie Project : Enable ARB_map_buffer_alignment in all drivers
Ian Romanick
idr at freedesktop.org
Mon Dec 9 17:34:25 PST 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/09/2013 04:58 PM, Eric Anholt wrote:
> Ian Romanick <idr at freedesktop.org> writes:
>
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> On 12/03/2013 10:44 AM, Eric Anholt wrote:
>>> Siavash Eliasi <siavashserver at gmail.com> writes:
>>>
>>>> Hello, this is V2 series of patches to accomplish *Enable
>>>> ARB_map_buffer_alignment in all drivers* newbie project
>>>> suggested by Ian Romanick.
>>>
>>> I think there's a piece missing to this, which is this bit of
>>> spec text:
>>>
>>> "If no error occurs, the pointer value returned by
>>> MapBufferRange must reflect an allocation aligned to the value
>>> of MIN_MAP_BUFFER_ALIGNMENT basic machine units. Subtracting
>>> <offset> basic machine units from the returned pointer will
>>> always produce a multiple of the value of
>>> MIN_MAP_BUFFER_ALIGNMENT."
>>>
>>> In i965's intel_bufferobj_map_range, range_map_bo or
>>> range_map_buffer mappings won't have that alignment.
>>
>> Yeah... I had forgotten about that when I originally posted the
>> project. There are a couple ways we could handle it. The one
>> that occurred to me first is to modify _mesa_MapBufferRange to
>> only call ctx->Driver.MapBufferRange with a properly aligned
>> offset (and do the fix-up on the pointer before storing it in
>> gl_buffer_object::Pointer). We don't have to worry about
>> gl_buffer_object::Offset being rounded because, as far as I can
>> tell, it's not visible to applications. We'd just have to make
>> sure that each driver's UnmapBuffer implementation only uses
>> Offset and not Pointer.
>>
>> Does that sound sensible?
>
> No, because expanding someone's range with the INVALIDATE_RANGE
> flag would produce incorrect results.
Foo. Good catch.
And the offset /is/ visible via glGetIntegerv(GL_BUFFER_MAP_OFFSET).
I missed that on my first skim of the spec.
> You just have to fix the implementations to know about the
> extension.
Right. I'll cook up a patch for the Intel classic drivers tomorrow.
Looking at intel_bufferobj_map_range, it should be pretty trivial.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iEYEARECAAYFAlKmb6EACgkQX1gOwKyEAw/71ACgi0bS1m5EKGjvpI4N4IqAZyzq
cacAnjx1I0Rf4swgIV0KhuMBx4SUFQxc
=+ppa
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list