mesa/main: Make FEATURE_histogram follow feature conventions.
[mesa.git] / src / mesa / main / renderbuffer.c
index 7c35575d12ed1f33cf05487b015df1aa01601b48..38be8266e05c5bd6df0fa3e83e3f7525bbb0af84 100644 (file)
 
 #include "rbadaptors.h"
 
-#include "pipe/softpipe/sp_z_surface.h"
-#include "pipe/p_state.h"
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "state_tracker/st_context.h"
-
 
 /* 32-bit color index format.  Not a public format. */
 #define COLOR_INDEX32 0x424243
@@ -951,7 +945,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
                                 GLenum internalFormat,
                                 GLuint width, GLuint height)
 {
-   struct pipe_context *pipe = ctx->st->pipe;
    GLuint pixelSize;
 
    /* first clear these fields */
@@ -1068,9 +1061,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoValues = put_mono_values_ubyte;
       rb->StencilBits = 8 * sizeof(GLubyte);
       pixelSize = sizeof(GLubyte);
-      if (!rb->surface)
-         rb->surface = (struct pipe_surface *)
-            pipe->surface_alloc(pipe, PIPE_FORMAT_U_S8);
       break;
    case GL_STENCIL_INDEX16_EXT:
       rb->_ActualFormat = GL_STENCIL_INDEX16_EXT;
@@ -1101,9 +1091,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutValues = put_values_ushort;
       rb->PutMonoValues = put_mono_values_ushort;
       rb->DepthBits = 8 * sizeof(GLushort);
-      if (!rb->surface)
-         rb->surface = (struct pipe_surface *)
-            pipe->surface_alloc(pipe, PIPE_FORMAT_U_Z16);
       pixelSize = sizeof(GLushort);
       break;
    case GL_DEPTH_COMPONENT24:
@@ -1126,9 +1113,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
          rb->_ActualFormat = GL_DEPTH_COMPONENT32;
          rb->DepthBits = 32;
       }
-      if (!rb->surface)
-         rb->surface = (struct pipe_surface *)
-            pipe->surface_alloc(pipe, PIPE_FORMAT_U_Z32);
       pixelSize = sizeof(GLuint);
       break;
    case GL_DEPTH_STENCIL_EXT:
@@ -1146,9 +1130,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
       rb->PutMonoValues = put_mono_values_uint;
       rb->DepthBits = 24;
       rb->StencilBits = 8;
-      if (!rb->surface)
-         rb->surface = (struct pipe_surface *)
-            pipe->surface_alloc(pipe, PIPE_FORMAT_Z24_S8);
       pixelSize = sizeof(GLuint);
       break;
    case GL_COLOR_INDEX8_EXT:
@@ -1211,32 +1192,14 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
    ASSERT(rb->PutMonoValues);
 
    /* free old buffer storage */
-   if (rb->surface) {
-      /* pipe_surface/region */
-   }
-   else if (rb->Data) {
-      /* legacy renderbuffer (this will go away) */
+   if (rb->Data) {
       _mesa_free(rb->Data);
+      rb->Data = NULL;
    }
-   rb->Data = NULL;
 
    if (width > 0 && height > 0) {
       /* allocate new buffer storage */
-      if (rb->surface) {
-         /* pipe_surface/region */
-         if (rb->surface->region) {
-            pipe->region_unmap(pipe, rb->surface->region);
-            pipe->region_release(pipe, &rb->surface->region);
-         }
-         rb->surface->region = pipe->region_alloc(pipe, pixelSize, width, height);
-         /* XXX probably don't want to really map here */
-         pipe->region_map(pipe, rb->surface->region);
-         rb->Data = rb->surface->region->map;
-      }
-      else {
-         /* legacy renderbuffer (this will go away) */
-         rb->Data = malloc(width * height * pixelSize);
-      }
+      rb->Data = malloc(width * height * pixelSize);
 
       if (rb->Data == NULL) {
          rb->Width = 0;
@@ -1525,11 +1488,16 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
    rb->InternalFormat = GL_NONE;
    rb->_ActualFormat = GL_NONE;
    rb->_BaseFormat = GL_NONE;
-   rb->DataType = GL_NONE;
+
+   rb->ComponentType = GL_UNSIGNED_NORMALIZED; /* ARB_fbo */
+   rb->ColorEncoding = GL_LINEAR; /* ARB_fbo */
+
    rb->RedBits = rb->GreenBits = rb->BlueBits = rb->AlphaBits = 0;
    rb->IndexBits = 0;
    rb->DepthBits = 0;
    rb->StencilBits = 0;
+
+   rb->DataType = GL_NONE;
    rb->Data = NULL;
 
    /* Point back to ourself so that we don't have to check for Wrapped==NULL