mesa/get: fix enum16 big-endian getting.
[mesa.git] / src / mesa / main / pbo.c
index 7762324a4ae30caaa1a40cf8d043bf1bb9453d08..7cb463d93fc989944936ae28cc5f16f464c85a38 100644 (file)
 
 
 
+#include "errors.h"
 #include "glheader.h"
 #include "bufferobj.h"
 #include "glformats.h"
 #include "image.h"
-#include "imports.h"
 #include "mtypes.h"
+#include "macros.h"
 #include "pbo.h"
 
 
@@ -78,7 +79,7 @@ _mesa_validate_pbo_access(GLuint dimensions,
       If a PBO is bound, 'ptr' is an offset into the bound PBO.
       In that case 'clientMemSize' is ignored: we just use the PBO's size.
     */
-   if (!_mesa_is_bufferobj(pack->BufferObj)) {
+   if (!pack->BufferObj) {
       offset = 0;
       size = (clientMemSize == INT_MAX) ? UINTPTR_MAX : clientMemSize;
    } else {
@@ -150,7 +151,7 @@ _mesa_map_pbo_source(struct gl_context *ctx,
 {
    const GLubyte *buf;
 
-   if (_mesa_is_bufferobj(unpack->BufferObj)) {
+   if (unpack->BufferObj) {
       /* unpack from PBO */
       buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0,
                                                   unpack->BufferObj->Size,
@@ -187,7 +188,7 @@ _mesa_validate_pbo_source(struct gl_context *ctx, GLuint dimensions,
 
    if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
                                   format, type, clientMemSize, ptr)) {
-      if (_mesa_is_bufferobj(unpack->BufferObj)) {
+      if (unpack->BufferObj) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "%s(out of bounds PBO access)",
                      where);
@@ -199,7 +200,7 @@ _mesa_validate_pbo_source(struct gl_context *ctx, GLuint dimensions,
       return false;
    }
 
-   if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+   if (!unpack->BufferObj) {
       /* non-PBO access: no further validation to be done */
       return true;
    }
@@ -224,7 +225,7 @@ _mesa_validate_pbo_source_compressed(struct gl_context *ctx, GLuint dimensions,
                                      GLsizei imageSize, const GLvoid *pixels,
                                      const char *where)
 {
-   if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+   if (!unpack->BufferObj) {
       /* not using a PBO */
       return true;
    }
@@ -283,7 +284,7 @@ _mesa_unmap_pbo_source(struct gl_context *ctx,
                        const struct gl_pixelstore_attrib *unpack)
 {
    assert(unpack != &ctx->Pack); /* catch pack/unpack mismatch */
-   if (_mesa_is_bufferobj(unpack->BufferObj)) {
+   if (unpack->BufferObj) {
       ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
    }
 }
@@ -304,7 +305,7 @@ _mesa_map_pbo_dest(struct gl_context *ctx,
 {
    void *buf;
 
-   if (_mesa_is_bufferobj(pack->BufferObj)) {
+   if (pack->BufferObj) {
       /* pack into PBO */
       buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0,
                                                   pack->BufferObj->Size,
@@ -345,7 +346,7 @@ _mesa_map_validate_pbo_dest(struct gl_context *ctx,
 
    if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
                                   format, type, clientMemSize, ptr)) {
-      if (_mesa_is_bufferobj(unpack->BufferObj)) {
+      if (unpack->BufferObj) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "%s(out of bounds PBO access)", where);
       } else {
@@ -356,7 +357,7 @@ _mesa_map_validate_pbo_dest(struct gl_context *ctx,
       return NULL;
    }
 
-   if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+   if (!unpack->BufferObj) {
       /* non-PBO access: no further validation to be done */
       return ptr;
    }
@@ -380,7 +381,7 @@ _mesa_unmap_pbo_dest(struct gl_context *ctx,
                      const struct gl_pixelstore_attrib *pack)
 {
    assert(pack != &ctx->Unpack); /* catch pack/unpack mismatch */
-   if (_mesa_is_bufferobj(pack->BufferObj)) {
+   if (pack->BufferObj) {
       ctx->Driver.UnmapBuffer(ctx, pack->BufferObj, MAP_INTERNAL);
    }
 }
@@ -401,7 +402,7 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
 {
    GLubyte *buf;
 
-   if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+   if (!unpack->BufferObj) {
       /* no PBO */
       return pixels;
    }
@@ -449,7 +450,7 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
       return NULL;
    }
 
-   if (!_mesa_is_bufferobj(packing->BufferObj)) {
+   if (!packing->BufferObj) {
       /* not using a PBO - return pointer unchanged */
       return pixels;
    }
@@ -477,7 +478,7 @@ void
 _mesa_unmap_teximage_pbo(struct gl_context *ctx,
                          const struct gl_pixelstore_attrib *unpack)
 {
-   if (_mesa_is_bufferobj(unpack->BufferObj)) {
+   if (unpack->BufferObj) {
       ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
    }
 }