evergreen: set gl_texture_image::TexFormat field in evergreenSetTexBuffer()
[mesa.git] / src / mesa / drivers / dri / sis / sis_dd.c
index e144a936f2689e56a511673a0e782e61137fd4fa..90e894b842c98364e29203d1c59e761a12a6c7e2 100644 (file)
@@ -24,7 +24,6 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_ctx.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
 
 /*
  * Authors:
@@ -41,18 +40,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "sis_state.h"
 #include "sis_tris.h"
 
-#include "swrast/swrast.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
+#include "main/formats.h"
+#include "main/renderbuffer.h"
 
 #include "utils.h"
 
-#define DRIVER_DATE    "20041008"
+#define DRIVER_DATE    "20060710"
 
 /* Return the width and height of the given buffer.
  */
 static void
-sisGetBufferSize( GLframebuffer *buffer,
+sisGetBufferSize( struct gl_framebuffer *buffer,
                              GLuint *width, GLuint *height )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -67,7 +65,7 @@ sisGetBufferSize( GLframebuffer *buffer,
 /* Return various strings for glGetString().
  */
 static const GLubyte *
-sisGetString( GLcontext *ctx, GLenum name )
+sisGetString( struct gl_context *ctx, GLenum name )
 {
    sisContextPtr smesa = SIS_CONTEXT(ctx);
    static char buffer[128];
@@ -92,7 +90,7 @@ sisGetString( GLcontext *ctx, GLenum name )
 /* Send all commands to the hardware.
  */
 static void
-sisFlush( GLcontext *ctx )
+sisFlush( struct gl_context *ctx )
 {
    sisContextPtr smesa = SIS_CONTEXT(ctx);
 
@@ -103,7 +101,7 @@ sisFlush( GLcontext *ctx )
  * completed processing.
  */
 static void
-sisFinish( GLcontext *ctx )
+sisFinish( struct gl_context *ctx )
 {
    sisContextPtr smesa = SIS_CONTEXT(ctx);
 
@@ -120,7 +118,7 @@ sisDeleteRenderbuffer(struct gl_renderbuffer *rb)
 }
 
 static GLboolean
-sisRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
+sisRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb,
                        GLenum internalFormat, GLuint width, GLuint height)
 {
    rb->Width = width;
@@ -143,25 +141,25 @@ sisInitRenderbuffer(struct gl_renderbuffer *rb, GLenum format)
 
    if (format == GL_RGBA) {
       /* Color */
-      rb->_BaseFormat = GL_RGBA;
+      rb->Format = MESA_FORMAT_ARGB8888;
       rb->DataType = GL_UNSIGNED_BYTE;
    }
    else if (format == GL_DEPTH_COMPONENT16) {
       /* Depth */
-      rb->_BaseFormat = GL_DEPTH_COMPONENT;
       /* we always Get/Put 32-bit Z values */
+      rb->Format = MESA_FORMAT_Z16;
       rb->DataType = GL_UNSIGNED_INT;
    }
    else if (format == GL_DEPTH_COMPONENT24) {
       /* Depth */
-      rb->_BaseFormat = GL_DEPTH_COMPONENT;
       /* we always Get/Put 32-bit Z values */
+      rb->Format = MESA_FORMAT_Z32;
       rb->DataType = GL_UNSIGNED_INT;
    }
    else {
       /* Stencil */
-      ASSERT(format == GL_STENCIL_INDEX8);
-      rb->_BaseFormat = GL_STENCIL_INDEX;
+      ASSERT(format == GL_STENCIL_INDEX8_EXT);
+      rb->Format = MESA_FORMAT_S8;
       rb->DataType = GL_UNSIGNED_BYTE;
    }
 
@@ -215,6 +213,11 @@ sisUpdateBufferSize(sisContextPtr smesa)
       assert(smesa->depth.Base.AllocStorage);
    }
 
+   /* XXX Should get the base offset of the frontbuffer from the X Server */
+   smesa->front.offset = smesa->driDrawable->x * smesa->bytesPerPixel +
+                        smesa->driDrawable->y * smesa->front.pitch;
+   smesa->front.map = (char *) smesa->driScreen->pFB + smesa->front.offset;
+
    if ( smesa->width == smesa->driDrawable->w &&
        smesa->height == smesa->driDrawable->h )
    {
@@ -224,10 +227,6 @@ sisUpdateBufferSize(sisContextPtr smesa)
    smesa->front.bpp = smesa->bytesPerPixel * 8;
    /* Front pitch set on context create */
    smesa->front.size = smesa->front.pitch * smesa->driDrawable->h;
-   /* XXX Should get the base offset of the frontbuffer from the X Server */
-   smesa->front.offset = smesa->driDrawable->x * smesa->bytesPerPixel +
-                        smesa->driDrawable->y * smesa->front.pitch;
-   smesa->front.map = (char *) smesa->driScreen->pFB;
 
    smesa->width = smesa->driDrawable->w;
    smesa->height = smesa->driDrawable->h;