[Mesa-dev] [PATCH 2/3] mesa: use _mesa_is_bufferobj() helper in _mesa_vertex_attrib_address()

Brian Paul brianp at vmware.com
Tue Nov 12 07:57:25 PST 2013


And use a regular if statment to slightly improve readability.
---
 src/mesa/main/varray.h |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index ecfc6b6..3b9f39a 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -76,9 +76,10 @@ static inline const GLubyte *
 _mesa_vertex_attrib_address(const struct gl_vertex_attrib_array *array,
                             const struct gl_vertex_buffer_binding *binding)
 {
-   return (binding->BufferObj->Name == 0 ?
-           array->Ptr :
-           (const GLubyte *)(binding->Offset + array->RelativeOffset));
+   if (_mesa_is_bufferobj(binding->BufferObj))
+      return (const GLubyte *) (binding->Offset + array->RelativeOffset);
+   else
+      return array->Ptr;       
 }
 
 /**
-- 
1.7.10.4



More information about the mesa-dev mailing list