summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-08-21 17:55:33 -0700
committerIan Romanick <[email protected]>2011-08-23 14:52:10 -0700
commitf973be59fa293ea75f05cdbac2372360deb5e186 (patch)
tree6549968359bee91318fee07a7c0b0ffb29d40a80
parent4ddae2fb666c86e3267ef6e3d2699f9bfb40d206 (diff)
intel: Correctly check for read-only mappings in intel_bufferobj_map_range
The old code was an obvious cut-and-paste fail from intel_bufferobj_map. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 7a0102b7226..16a56b03a2e 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -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);