intel: Correctly check for read-only mappings in intel_bufferobj_map_range
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 22 Aug 2011 00:55:33 +0000 (17:55 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 23 Aug 2011 21:52:10 +0000 (14:52 -0700)
The old code was an obvious cut-and-paste fail from intel_bufferobj_map.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
src/mesa/drivers/dri/intel/intel_buffer_objects.c

index 7a0102b72269d2312e8e24d1872528ee6ec1cbeb..16a56b03a2e464e1083fcfea09f12a117636da5c 100644 (file)
@@ -374,7 +374,6 @@ intel_bufferobj_map_range(struct gl_context * ctx,
 {
    struct intel_context *intel = intel_context(ctx);
    struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
-   GLboolean read_only = (access == GL_READ_ONLY_ARB);
 
    assert(intel_obj);
 
@@ -386,6 +385,9 @@ intel_bufferobj_map_range(struct gl_context * ctx,
    obj->AccessFlags = access;
 
    if (intel_obj->sys_buffer) {
+      const bool read_only =
+        (access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == GL_MAP_READ_BIT;
+
       if (!read_only && intel_obj->source)
         release_buffer(intel_obj);