[Mesa-dev] [PATCH] mesa: handle zero-size buffers in MapBuffer and ranges in MapBufferRange

Ian Romanick idr at freedesktop.org
Tue Aug 30 11:57:34 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/30/2011 11:54 AM, Ian Romanick wrote:
> On 08/30/2011 10:15 AM, Marek Olaák wrote:
>> Moved from st/mesa.
>> This also fixes an assertion failure in piglit/fdo31934 on gallium drivers.
> 
> So... I guess I don't understand why the mapping can't just fail and set
> GL_OUT_OF_MEMORY.  Returning a pointer to some random bit of storage
> seems like a recipe for bugs that are excruciating for app developers to
> debug.

As another data point, and perhaps Eric can correct me if I'm wrong,
this is what the Intel drivers already do.  In intel_bufferobj_map_range
(intel_buffer_objects.c):

   if (intel_obj->buffer == NULL) {
      obj->Pointer = NULL;
      return NULL;
   }

> I'd be more inclined to return an invalid pointer, like (void
> *)0xdeadbeef, so the reads or writes through it will cause the segfault
> that the app deserves.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk5dMp4ACgkQX1gOwKyEAw/QhACgoKVPaHTZh/pRSjcOK+e1X9Ui
EU8An2pLZ6oQUlEgrEtPOq3aBaDqTRMm
=RKmk
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list