mesa: remove FEATURE_feedback define.
[mesa.git] / src / mesa / main / pixelstore.c
index 6a641f83f27fea499748db7b4d1388e245fba0fd..d1e96aa8f57b7089ea87e70cfd9ac1e6d02e6c8a 100644 (file)
 
 #include "glheader.h"
 #include "bufferobj.h"
-#include "colormac.h"
 #include "context.h"
-#include "image.h"
-#include "macros.h"
 #include "pixelstore.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 
 
@@ -47,18 +45,24 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 
    switch (pname) {
       case GL_PACK_SWAP_BYTES:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
         if (param == (GLint)ctx->Pack.SwapBytes)
            return;
         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
          ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
         break;
       case GL_PACK_LSB_FIRST:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
         if (param == (GLint)ctx->Pack.LsbFirst)
            return;
         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
          ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
         break;
       case GL_PACK_ROW_LENGTH:
+         if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+            goto invalid_enum_error;
         if (param<0) {
            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -69,6 +73,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Pack.RowLength = param;
         break;
       case GL_PACK_IMAGE_HEIGHT:
+         if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+            goto invalid_enum_error;
          if (param<0) {
             _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -79,6 +85,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Pack.ImageHeight = param;
          break;
       case GL_PACK_SKIP_PIXELS:
+         if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+            goto invalid_enum_error;
         if (param<0) {
            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -89,6 +97,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Pack.SkipPixels = param;
         break;
       case GL_PACK_SKIP_ROWS:
+         if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+            goto invalid_enum_error;
         if (param<0) {
            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -99,6 +109,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Pack.SkipRows = param;
         break;
       case GL_PACK_SKIP_IMAGES:
+         if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+            goto invalid_enum_error;
         if (param<0) {
            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -119,6 +131,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Pack.Alignment = param;
         break;
       case GL_PACK_INVERT_MESA:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
          if (!ctx->Extensions.MESA_pack_invert) {
             _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
             return;
@@ -130,6 +144,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
          break;
 
       case GL_UNPACK_SWAP_BYTES:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
         if (param == (GLint)ctx->Unpack.SwapBytes)
            return;
         if ((GLint)ctx->Unpack.SwapBytes == param)
@@ -138,6 +154,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
          break;
       case GL_UNPACK_LSB_FIRST:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
         if (param == (GLint)ctx->Unpack.LsbFirst)
            return;
         if ((GLint)ctx->Unpack.LsbFirst == param)
@@ -146,6 +164,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
         break;
       case GL_UNPACK_ROW_LENGTH:
+         if (ctx->API == API_OPENGLES)
+            goto invalid_enum_error;
         if (param<0) {
            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -156,6 +176,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Unpack.RowLength = param;
         break;
       case GL_UNPACK_IMAGE_HEIGHT:
+         if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+            goto invalid_enum_error;
          if (param<0) {
             _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -167,6 +189,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Unpack.ImageHeight = param;
          break;
       case GL_UNPACK_SKIP_PIXELS:
+         if (ctx->API == API_OPENGLES)
+            goto invalid_enum_error;
         if (param<0) {
            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -177,6 +201,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Unpack.SkipPixels = param;
         break;
       case GL_UNPACK_SKIP_ROWS:
+         if (ctx->API == API_OPENGLES)
+            goto invalid_enum_error;
         if (param<0) {
            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -187,6 +213,8 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         ctx->Unpack.SkipRows = param;
         break;
       case GL_UNPACK_SKIP_IMAGES:
+         if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+            goto invalid_enum_error;
         if (param < 0) {
            _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
            return;
@@ -206,23 +234,22 @@ _mesa_PixelStorei( GLenum pname, GLint param )
         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
         ctx->Unpack.Alignment = param;
         break;
-      case GL_UNPACK_CLIENT_STORAGE_APPLE:
-         if (param == (GLint)ctx->Unpack.ClientStorage)
-            return;
-         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
-         ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
-         break;
       default:
-        _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
-        return;
+         goto invalid_enum_error;
    }
+
+   return;
+
+invalid_enum_error:
+   _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
+   return;
 }
 
 
 void GLAPIENTRY
 _mesa_PixelStoref( GLenum pname, GLfloat param )
 {
-   _mesa_PixelStorei( pname, (GLint) param );
+   _mesa_PixelStorei( pname, IROUND(param) );
 }
 
 
@@ -231,7 +258,7 @@ _mesa_PixelStoref( GLenum pname, GLfloat param )
  * Initialize the context's pixel store state.
  */
 void
-_mesa_init_pixelstore( GLcontext *ctx )
+_mesa_init_pixelstore( struct gl_context *ctx )
 {
    /* Pixel transfer */
    ctx->Pack.Alignment = 4;
@@ -242,7 +269,6 @@ _mesa_init_pixelstore( GLcontext *ctx )
    ctx->Pack.SkipImages = 0;
    ctx->Pack.SwapBytes = GL_FALSE;
    ctx->Pack.LsbFirst = GL_FALSE;
-   ctx->Pack.ClientStorage = GL_FALSE;
    ctx->Pack.Invert = GL_FALSE;
 #if FEATURE_EXT_pixel_buffer_object
    _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj,
@@ -256,7 +282,6 @@ _mesa_init_pixelstore( GLcontext *ctx )
    ctx->Unpack.SkipImages = 0;
    ctx->Unpack.SwapBytes = GL_FALSE;
    ctx->Unpack.LsbFirst = GL_FALSE;
-   ctx->Unpack.ClientStorage = GL_FALSE;
    ctx->Unpack.Invert = GL_FALSE;
 #if FEATURE_EXT_pixel_buffer_object
    _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj,
@@ -277,7 +302,6 @@ _mesa_init_pixelstore( GLcontext *ctx )
    ctx->DefaultPacking.SkipImages = 0;
    ctx->DefaultPacking.SwapBytes = GL_FALSE;
    ctx->DefaultPacking.LsbFirst = GL_FALSE;
-   ctx->DefaultPacking.ClientStorage = GL_FALSE;
    ctx->DefaultPacking.Invert = GL_FALSE;
 #if FEATURE_EXT_pixel_buffer_object
    _mesa_reference_buffer_object(ctx, &ctx->DefaultPacking.BufferObj,