summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_depthstencil.c282
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_depthstencil.h14
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_fbo.c580
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_fbo.h99
4 files changed, 0 insertions, 975 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_depthstencil.c b/src/mesa/drivers/dri/intel_winsys/intel_depthstencil.c
deleted file mode 100644
index 81e09698cc..0000000000
--- a/src/mesa/drivers/dri/intel_winsys/intel_depthstencil.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "depthstencil.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "hash.h"
-#include "mtypes.h"
-#include "renderbuffer.h"
-
-#include "intel_context.h"
-#include "intel_fbo.h"
-#include "intel_depthstencil.h"
-
-#include "pipe/p_context.h"
-
-/**
- * The GL_EXT_framebuffer_object allows the user to create their own
- * framebuffer objects consisting of color renderbuffers (0 or more),
- * depth renderbuffers (0 or 1) and stencil renderbuffers (0 or 1).
- *
- * The spec considers depth and stencil renderbuffers to be totally independent
- * buffers. In reality, most graphics hardware today uses a combined
- * depth+stencil buffer (one 32-bit pixel = 24 bits of Z + 8 bits of stencil).
- *
- * This causes difficulty because the user may create some number of depth
- * renderbuffers and some number of stencil renderbuffers and bind them
- * together in framebuffers in any combination.
- *
- * This code manages all that.
- *
- * 1. Depth renderbuffers are always allocated in hardware as 32bpp
- * GL_DEPTH24_STENCIL8 buffers.
- *
- * 2. Stencil renderbuffers are initially allocated in software as 8bpp
- * GL_STENCIL_INDEX8 buffers.
- *
- * 3. Depth and Stencil renderbuffers use the PairedStencil and PairedDepth
- * fields (respectively) to indicate if the buffer's currently paired
- * with another stencil or depth buffer (respectively).
- *
- * 4. When a depth and stencil buffer are initially both attached to the
- * current framebuffer, we merge the stencil buffer values into the
- * depth buffer (really a depth+stencil buffer). The then hardware uses
- * the combined buffer.
- *
- * 5. Whenever a depth or stencil buffer is reallocated (with
- * glRenderbufferStorage) we undo the pairing and copy the stencil values
- * from the combined depth/stencil buffer back to the stencil-only buffer.
- *
- * 6. We also undo the pairing when we find a change in buffer bindings.
- *
- * 7. If a framebuffer is only using a depth renderbuffer (no stencil), we
- * just use the combined depth/stencil buffer and ignore the stencil values.
- *
- * 8. If a framebuffer is only using a stencil renderbuffer (no depth) we have
- * to promote the 8bpp software stencil buffer to a 32bpp hardware
- * depth+stencil buffer.
- *
- */
-
-
-
-static void
-map_regions(GLcontext * ctx,
- struct intel_renderbuffer *depthRb,
- struct intel_renderbuffer *stencilRb)
-{
- struct intel_context *intel = intel_context(ctx);
- if (depthRb && depthRb->region) {
- intel->pipe->region_map(intel->pipe, depthRb->region);
- depthRb->pfMap = depthRb->region->map;
- depthRb->pfPitch = depthRb->region->pitch;
- }
- if (stencilRb && stencilRb->region) {
- intel->pipe->region_map(intel->pipe, stencilRb->region);
- stencilRb->pfMap = stencilRb->region->map;
- stencilRb->pfPitch = stencilRb->region->pitch;
- }
-}
-
-static void
-unmap_regions(GLcontext * ctx,
- struct intel_renderbuffer *depthRb,
- struct intel_renderbuffer *stencilRb)
-{
- struct intel_context *intel = intel_context(ctx);
- if (depthRb && depthRb->region) {
- intel->pipe->region_unmap(intel->pipe, depthRb->region);
- depthRb->pfMap = NULL;
- depthRb->pfPitch = 0;
- }
- if (stencilRb && stencilRb->region) {
- intel->pipe->region_unmap(intel->pipe, stencilRb->region);
- stencilRb->pfMap = NULL;
- stencilRb->pfPitch = 0;
- }
-}
-
-
-
-/**
- * Undo the pairing/interleaving between depth and stencil buffers.
- * irb should be a depth/stencil or stencil renderbuffer.
- */
-void
-intel_unpair_depth_stencil(GLcontext * ctx, struct intel_renderbuffer *irb)
-{
- if (irb->PairedStencil) {
- /* irb is a depth/stencil buffer */
- struct gl_renderbuffer *stencilRb;
- struct intel_renderbuffer *stencilIrb;
-
- ASSERT(irb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
-
- stencilRb = _mesa_lookup_renderbuffer(ctx, irb->PairedStencil);
- stencilIrb = intel_renderbuffer(stencilRb);
- if (stencilIrb) {
- /* need to extract stencil values from the depth buffer */
- ASSERT(stencilIrb->PairedDepth == irb->Base.Name);
- map_regions(ctx, irb, stencilIrb);
- _mesa_extract_stencil(ctx, &irb->Base, &stencilIrb->Base);
- unmap_regions(ctx, irb, stencilIrb);
- stencilIrb->PairedDepth = 0;
- }
- irb->PairedStencil = 0;
- }
- else if (irb->PairedDepth) {
- /* irb is a stencil buffer */
- struct gl_renderbuffer *depthRb;
- struct intel_renderbuffer *depthIrb;
-
- ASSERT(irb->Base._ActualFormat == GL_STENCIL_INDEX8_EXT ||
- irb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
-
- depthRb = _mesa_lookup_renderbuffer(ctx, irb->PairedDepth);
- depthIrb = intel_renderbuffer(depthRb);
- if (depthIrb) {
- /* need to extract stencil values from the depth buffer */
- ASSERT(depthIrb->PairedStencil == irb->Base.Name);
- map_regions(ctx, depthIrb, irb);
- _mesa_extract_stencil(ctx, &depthIrb->Base, &irb->Base);
- unmap_regions(ctx, depthIrb, irb);
- depthIrb->PairedStencil = 0;
- }
- irb->PairedDepth = 0;
- }
- else {
- _mesa_problem(ctx, "Problem in undo_depth_stencil_pairing");
- }
-
- ASSERT(irb->PairedStencil == 0);
- ASSERT(irb->PairedDepth == 0);
-}
-
-
-/**
- * Examine the depth and stencil renderbuffers which are attached to the
- * framebuffer. If both depth and stencil are attached, make sure that the
- * renderbuffers are 'paired' (combined). If only depth or only stencil is
- * attached, undo any previous pairing.
- *
- * Must be called if NewState & _NEW_BUFFER (when renderbuffer attachments
- * change, for example).
- */
-void
-intel_validate_paired_depth_stencil(GLcontext * ctx,
- struct gl_framebuffer *fb)
-{
- struct intel_renderbuffer *depthRb, *stencilRb;
-
- depthRb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
- stencilRb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
-
- if (depthRb && stencilRb) {
- if (depthRb == stencilRb) {
- /* Using a user-created combined depth/stencil buffer.
- * Nothing to do.
- */
- ASSERT(depthRb->Base._BaseFormat == GL_DEPTH_STENCIL_EXT);
- ASSERT(depthRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- }
- else {
- /* Separate depth/stencil buffers, need to interleave now */
- ASSERT(depthRb->Base._BaseFormat == GL_DEPTH_COMPONENT);
- ASSERT(stencilRb->Base._BaseFormat == GL_STENCIL_INDEX);
- /* may need to interleave depth/stencil now */
- if (depthRb->PairedStencil == stencilRb->Base.Name) {
- /* OK, the depth and stencil buffers are already interleaved */
- ASSERT(stencilRb->PairedDepth == depthRb->Base.Name);
- }
- else {
- /* need to setup new pairing/interleaving */
- if (depthRb->PairedStencil) {
- intel_unpair_depth_stencil(ctx, depthRb);
- }
- if (stencilRb->PairedDepth) {
- intel_unpair_depth_stencil(ctx, stencilRb);
- }
-
- ASSERT(depthRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- ASSERT(stencilRb->Base._ActualFormat == GL_STENCIL_INDEX8_EXT ||
- stencilRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
-
- /* establish new pairing: interleave stencil into depth buffer */
- map_regions(ctx, depthRb, stencilRb);
- _mesa_insert_stencil(ctx, &depthRb->Base, &stencilRb->Base);
- unmap_regions(ctx, depthRb, stencilRb);
- depthRb->PairedStencil = stencilRb->Base.Name;
- stencilRb->PairedDepth = depthRb->Base.Name;
- }
-
- }
- }
- else if (depthRb) {
- /* Depth buffer but no stencil buffer.
- * We'll use a GL_DEPTH24_STENCIL8 buffer and ignore the stencil bits.
- */
- /* can't assert this until storage is allocated:
- ASSERT(depthRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- */
- /* intel_undo any previous pairing */
- if (depthRb->PairedStencil) {
- intel_unpair_depth_stencil(ctx, depthRb);
- }
- }
- else if (stencilRb) {
- /* Stencil buffer but no depth buffer.
- * Since h/w doesn't typically support just 8bpp stencil w/out Z,
- * we'll use a GL_DEPTH24_STENCIL8 buffer and ignore the depth bits.
- */
- /* undo any previous pairing */
- if (stencilRb->PairedDepth) {
- intel_unpair_depth_stencil(ctx, stencilRb);
- }
- if (stencilRb->Base._ActualFormat == GL_STENCIL_INDEX8_EXT) {
- /* promote buffer to GL_DEPTH24_STENCIL8 for hw rendering */
- _mesa_promote_stencil(ctx, &stencilRb->Base);
- ASSERT(stencilRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- }
- }
-
- /* Finally, update the fb->_DepthBuffer and fb->_StencilBuffer fields */
- _mesa_update_depth_buffer(ctx, fb, BUFFER_DEPTH);
- if (depthRb && depthRb->PairedStencil)
- _mesa_update_stencil_buffer(ctx, fb, BUFFER_DEPTH);
- else
- _mesa_update_stencil_buffer(ctx, fb, BUFFER_STENCIL);
-
-
- /* The hardware should use fb->Attachment[BUFFER_DEPTH].Renderbuffer
- * first, if present, then fb->Attachment[BUFFER_STENCIL].Renderbuffer
- * if present.
- */
-}
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_depthstencil.h b/src/mesa/drivers/dri/intel_winsys/intel_depthstencil.h
deleted file mode 100644
index 2d3fc48b3a..0000000000
--- a/src/mesa/drivers/dri/intel_winsys/intel_depthstencil.h
+++ /dev/null
@@ -1,14 +0,0 @@
-
-#ifndef INTEL_DEPTH_STENCIL_H
-#define INTEL_DEPTH_STENCIL_H
-
-
-extern void
-intel_unpair_depth_stencil(GLcontext * ctx, struct intel_renderbuffer *irb);
-
-extern void
-intel_validate_paired_depth_stencil(GLcontext * ctx,
- struct gl_framebuffer *fb);
-
-
-#endif /* INTEL_DEPTH_STENCIL_H */
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_fbo.c b/src/mesa/drivers/dri/intel_winsys/intel_fbo.c
deleted file mode 100644
index 3dd99747da..0000000000
--- a/src/mesa/drivers/dri/intel_winsys/intel_fbo.c
+++ /dev/null
@@ -1,580 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "imports.h"
-#include "mtypes.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#include "context.h"
-#include "texformat.h"
-#include "texrender.h"
-
-#include "intel_context.h"
-#include "intel_buffers.h"
-#include "intel_depthstencil.h"
-#include "intel_fbo.h"
-#include "state_tracker/st_mipmap_tree.h"
-/*#include "intel_tex.h"*/
-
-#include "pipe/p_context.h"
-
-#define FILE_DEBUG_FLAG DEBUG_FBO
-
-#define INTEL_RB_CLASS 0x12345678
-
-
-/* XXX FBO: move this to intel_context.h (inlined) */
-/**
- * Return a gl_renderbuffer ptr casted to intel_renderbuffer.
- * NULL will be returned if the rb isn't really an intel_renderbuffer.
- * This is determiend by checking the ClassID.
- */
-struct intel_renderbuffer *
-intel_renderbuffer(struct gl_renderbuffer *rb)
-{
- struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb;
- if (irb && irb->Base.ClassID == INTEL_RB_CLASS) {
- /*_mesa_warning(NULL, "Returning non-intel Rb\n");*/
- return irb;
- }
- else
- return NULL;
-}
-
-
-/**
- * Create a new framebuffer object.
- */
-static struct gl_framebuffer *
-intel_new_framebuffer(GLcontext * ctx, GLuint name)
-{
- /* Only drawable state in intel_framebuffer at this time, just use Mesa's
- * class
- */
- return _mesa_new_framebuffer(ctx, name);
-}
-
-
-static void
-intel_delete_renderbuffer(struct gl_renderbuffer *rb)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct intel_context *intel = intel_context(ctx);
- struct intel_renderbuffer *irb = intel_renderbuffer(rb);
-
- ASSERT(irb);
-
- DBG("freeing renderbuffer\n");
-
-#if 0
- if (irb->PairedStencil || irb->PairedDepth) {
- intel_unpair_depth_stencil(ctx, irb);
- }
-#endif
- if (intel && irb->Base.surface->region) {
- intel->pipe->region_release(intel->pipe, &irb->Base.surface->region);
- }
-
- _mesa_free(irb);
-}
-
-
-
-/**
- * Return a pointer to a specific pixel in a renderbuffer.
- */
-static void *
-intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y)
-{
- /* By returning NULL we force all software rendering to go through
- * the span routines.
- */
- return NULL;
-}
-
-
-
-/**
- * Called via glRenderbufferStorageEXT() to set the format and allocate
- * storage for a user-created (or priv buffer) renderbuffer.
- */
-static GLboolean
-intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat,
- GLuint width, GLuint height)
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- GLboolean softwareBuffer = GL_FALSE;
- int cpp;
-
- switch (internalFormat) {
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- rb->_ActualFormat = GL_RGB5;
- rb->DataType = GL_UNSIGNED_BYTE;
- rb->RedBits = 5;
- rb->GreenBits = 6;
- rb->BlueBits = 5;
- cpp = 2;
- break;
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- rb->_ActualFormat = GL_RGBA8;
- rb->DataType = GL_UNSIGNED_BYTE;
- rb->RedBits = 8;
- rb->GreenBits = 8;
- rb->BlueBits = 8;
- rb->AlphaBits = 8;
- cpp = 4;
- break;
- case GL_STENCIL_INDEX:
- case GL_STENCIL_INDEX1_EXT:
- case GL_STENCIL_INDEX4_EXT:
- case GL_STENCIL_INDEX8_EXT:
- case GL_STENCIL_INDEX16_EXT:
- /* alloc a depth+stencil buffer */
- rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
- rb->StencilBits = 8;
- cpp = 4;
- break;
- case GL_DEPTH_COMPONENT16:
- rb->_ActualFormat = GL_DEPTH_COMPONENT16;
- rb->DataType = GL_UNSIGNED_SHORT;
- rb->DepthBits = 16;
- cpp = 2;
- break;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
- rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
- rb->DepthBits = 24;
- cpp = 4;
- break;
- case GL_DEPTH_STENCIL_EXT:
- case GL_DEPTH24_STENCIL8_EXT:
- rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
- rb->DepthBits = 24;
- rb->StencilBits = 8;
- cpp = 4;
- break;
- default:
- _mesa_problem(ctx,
- "Unexpected format (%x) in intel_alloc_renderbuffer_storage", internalFormat);
- return GL_FALSE;
- }
-
- intelFlush(ctx);
-
- /* free old region */
- if (irb->Base.surface->region) {
- intel->pipe->region_release(intel->pipe, &irb->Base.surface->region);
- }
-
- /* allocate new memory region/renderbuffer */
- if (softwareBuffer) {
- return _mesa_soft_renderbuffer_storage(ctx, rb, internalFormat,
- width, height);
- }
- else {
- /* Choose a pitch to match hardware requirements:
- */
- GLuint pitch = ((cpp * width + 63) & ~63) / cpp;
-
- /* alloc hardware renderbuffer */
- DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width,
- height, pitch);
-
- irb->Base.surface->region = intel->pipe->region_alloc(intel->pipe, cpp, pitch, height);
- if (!irb->Base.surface->region)
- return GL_FALSE; /* out of memory? */
-
- ASSERT(irb->Base.surface->region->buffer);
-
- rb->Width = width;
- rb->Height = height;
-
- /* update the surface's size too */
- rb->surface->width = width;
- rb->surface->height = height;
- rb->surface->region = irb->Base.surface->region;/*XXX no-op*/
-
- /* This sets the Get/PutRow/Value functions */
- // intel_set_span_functions(&irb->Base);
-
- return GL_TRUE;
- }
-}
-
-
-static void
-intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
- GLuint width, GLuint height)
-{
- struct intel_framebuffer *intel_fb = (struct intel_framebuffer*)fb;
- int i;
-
- _mesa_resize_framebuffer(ctx, fb, width, height);
-
- fb->Initialized = GL_TRUE; /* XXX remove someday */
-
- if (fb->Name != 0) {
- return;
- }
-
- /* Make sure all window system renderbuffers are up to date */
-#if 0
- for (i = 0; i < 3; i++) {
- struct gl_renderbuffer *rb = &intel_fb->color_rb[i]->Base;
-
- /* only resize if size is changing */
- if (rb && (rb->Width != width || rb->Height != height)) {
- rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height);
- }
- }
-#else
-
-#endif
-}
-
-static GLboolean
-intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat, GLuint width, GLuint height)
-{
- _mesa_problem(ctx, "intel_op_alloc_storage should never be called.");
- return GL_FALSE;
-}
-
-
-
-struct intel_renderbuffer *
-intel_new_renderbuffer_fb(GLuint intFormat)
-{
- struct intel_renderbuffer *irb;
-
- irb = CALLOC_STRUCT(intel_renderbuffer);
- if (!irb) {
- _mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer");
- return NULL;
- }
-
- _mesa_init_renderbuffer(&irb->Base, 0);
- irb->Base.ClassID = INTEL_RB_CLASS;
- irb->Base.InternalFormat = intFormat;
-
- switch (intFormat) {
- case GL_RGB5:
- case GL_RGBA8:
- irb->Base._BaseFormat = GL_RGBA;
- break;
- case GL_DEPTH_COMPONENT16:
- irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- break;
- case GL_DEPTH24_STENCIL8_EXT:
- irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT;
- break;
- default:
- _mesa_problem(NULL,
- "Unexpected intFormat in intel_create_renderbuffer");
- return NULL;
- }
-
- /* intel-specific methods */
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_alloc_renderbuffer_storage;
- irb->Base.GetPointer = intel_get_pointer;
- /* span routines set in alloc_storage function */
-
- irb->Base.surface = intel_new_surface(intFormat);
- irb->Base.surface->rb = irb;
-
- return irb;
-}
-
-/**
- * Create a new renderbuffer object.
- * Typically called via glBindRenderbufferEXT().
- */
-static struct gl_renderbuffer *
-intel_new_renderbuffer(GLcontext * ctx, GLuint name)
-{
- /*struct intel_context *intel = intel_context(ctx); */
- struct intel_renderbuffer *irb;
-
- irb = CALLOC_STRUCT(intel_renderbuffer);
- if (!irb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
- return NULL;
- }
-
- _mesa_init_renderbuffer(&irb->Base, name);
- irb->Base.ClassID = INTEL_RB_CLASS;
-
- /* intel-specific methods */
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_alloc_renderbuffer_storage;
- irb->Base.GetPointer = intel_get_pointer;
- /* span routines set in alloc_storage function */
-
- irb->Base.surface = intel_new_surface(0 /*unknown format*/);
- irb->Base.surface->rb = irb;
-
- return &irb->Base;
-}
-
-
-/**
- * Called via glBindFramebufferEXT().
- */
-static void
-intel_bind_framebuffer(GLcontext * ctx, GLenum target,
- struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
-{
- if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
- intel_draw_buffer(ctx, fb);
- /* Integer depth range depends on depth buffer bits */
- /* XXX
- */
-// ctx->Driver.DepthRange(ctx, ctx->Viewport.Near, ctx->Viewport.Far);
- }
- else {
- /* don't need to do anything if target == GL_READ_FRAMEBUFFER_EXT */
- }
-}
-
-
-/**
- * Called via glFramebufferRenderbufferEXT().
- */
-static void
-intel_framebuffer_renderbuffer(GLcontext * ctx,
- struct gl_framebuffer *fb,
- GLenum attachment, struct gl_renderbuffer *rb)
-{
- DBG("Intel FramebufferRenderbuffer %u %u\n", fb->Name, rb ? rb->Name : 0);
-
- intelFlush(ctx);
-
- _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb);
- intel_draw_buffer(ctx, fb);
-}
-
-
-/**
- * When glFramebufferTexture[123]D is called this function sets up the
- * gl_renderbuffer wrapper around the texture image.
- * This will have the region info needed for hardware rendering.
- */
-static struct intel_renderbuffer *
-intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
-{
- const GLuint name = ~0; /* not significant, but distinct for debugging */
- struct intel_renderbuffer *irb;
-
- /* make an intel_renderbuffer to wrap the texture image */
- irb = CALLOC_STRUCT(intel_renderbuffer);
- if (!irb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture");
- return NULL;
- }
-
- _mesa_init_renderbuffer(&irb->Base, name);
- irb->Base.ClassID = INTEL_RB_CLASS;
-
- if (texImage->TexFormat == &_mesa_texformat_argb8888) {
- irb->Base._ActualFormat = GL_RGBA8;
- irb->Base._BaseFormat = GL_RGBA;
- DBG("Render to RGBA8 texture OK\n");
- }
- else if (texImage->TexFormat == &_mesa_texformat_rgb565) {
- irb->Base._ActualFormat = GL_RGB5;
- irb->Base._BaseFormat = GL_RGB;
- DBG("Render to RGB5 texture OK\n");
- }
- else if (texImage->TexFormat == &_mesa_texformat_z16) {
- irb->Base._ActualFormat = GL_DEPTH_COMPONENT16;
- irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- DBG("Render to DEPTH16 texture OK\n");
- }
- else {
- DBG("Render to texture BAD FORMAT %d\n",
- texImage->TexFormat->MesaFormat);
- _mesa_free(irb);
- return NULL;
- }
-
- irb->Base.InternalFormat = irb->Base._ActualFormat;
- irb->Base.Width = texImage->Width;
- irb->Base.Height = texImage->Height;
- irb->Base.DataType = GL_UNSIGNED_BYTE; /* FBO XXX fix */
- irb->Base.RedBits = texImage->TexFormat->RedBits;
- irb->Base.GreenBits = texImage->TexFormat->GreenBits;
- irb->Base.BlueBits = texImage->TexFormat->BlueBits;
- irb->Base.AlphaBits = texImage->TexFormat->AlphaBits;
- irb->Base.DepthBits = texImage->TexFormat->DepthBits;
-
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_nop_alloc_storage;
-
-// intel_set_span_functions(&irb->Base);
-
-#if 0
- irb->RenderToTexture = GL_TRUE;
-#endif
-
- return irb;
-}
-
-
-/**
- * Called by glFramebufferTexture[123]DEXT() (and other places) to
- * prepare for rendering into texture memory. This might be called
- * many times to choose different texture levels, cube faces, etc
- * before intel_finish_render_texture() is ever called.
- */
-static void
-intel_render_texture(GLcontext * ctx,
- struct gl_framebuffer *fb,
- struct gl_renderbuffer_attachment *att)
-{
-#if 0
- struct intel_context *intel = intel_context(ctx);
- struct gl_texture_image *newImage
- = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
- struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer);
- struct st_texture_image *st_image;
- GLuint imageOffset;
-
- (void) fb;
-
- ASSERT(newImage);
-
- if (!irb) {
- irb = intel_wrap_texture(ctx, newImage);
- if (irb) {
- /* bind the wrapper to the attachment point */
- _mesa_reference_renderbuffer(&att->Renderbuffer, &irb->Base);
- }
- else {
- /* fallback to software rendering */
- _mesa_render_texture(ctx, fb, att);
- return;
- }
- }
-
- DBG("Begin render texture tid %x tex=%u w=%d h=%d refcount=%d\n",
- _glthread_GetID(),
- att->Texture->Name, newImage->Width, newImage->Height,
- irb->Base.RefCount);
-
- /* point the renderbufer's region to the texture image region */
- st_image = st_texture_image(newImage);
- if (irb->region != st_image->mt->region) {
- if (irb->region)
- intel->pipe->region_release(intel->pipe, &irb->region);
- pipe_region_reference(&irb->region, st_image->mt->region);
- }
-
- /* compute offset of the particular 2D image within the texture region */
- imageOffset = st_miptree_image_offset(st_image->mt,
- att->CubeMapFace,
- att->TextureLevel);
-
- if (att->Texture->Target == GL_TEXTURE_3D) {
- const GLuint *offsets = st_miptree_depth_offsets(st_image->mt,
- att->TextureLevel);
- imageOffset += offsets[att->Zoffset];
- }
-
- /* store that offset in the region */
-#if 0
- st_image->mt->region->draw_offset = imageOffset;
-#endif
-
- /* update drawing region, etc */
- intel_draw_buffer(ctx, fb);
-#endif
-}
-
-
-/**
- * Called by Mesa when rendering to a texture is done.
- */
-static void
-intel_finish_render_texture(GLcontext * ctx,
- struct gl_renderbuffer_attachment *att)
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer);
-
- DBG("End render texture (tid %x) tex %u\n", _glthread_GetID(), att->Texture->Name);
-
- if (irb) {
- /* just release the region */
- intel->pipe->region_release(intel->pipe, &irb->Base.surface->region);
- }
- else if (att->Renderbuffer) {
- /* software fallback */
- _mesa_finish_render_texture(ctx, att);
- /* XXX FBO: Need to unmap the buffer (or in intelSpanRenderStart???) */
- }
-}
-
-
-/**
- * Do one-time context initializations related to GL_EXT_framebuffer_object.
- * Hook in device driver functions.
- */
-void
-intel_fbo_init(struct intel_context *intel)
-{
- intel->ctx.Driver.NewFramebuffer = intel_new_framebuffer;
- intel->ctx.Driver.NewRenderbuffer = intel_new_renderbuffer;
- intel->ctx.Driver.BindFramebuffer = intel_bind_framebuffer;
- intel->ctx.Driver.FramebufferRenderbuffer = intel_framebuffer_renderbuffer;
- intel->ctx.Driver.RenderTexture = intel_render_texture;
- intel->ctx.Driver.FinishRenderTexture = intel_finish_render_texture;
- intel->ctx.Driver.ResizeBuffers = intel_resize_buffers;
-}
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_fbo.h b/src/mesa/drivers/dri/intel_winsys/intel_fbo.h
deleted file mode 100644
index 0487c27600..0000000000
--- a/src/mesa/drivers/dri/intel_winsys/intel_fbo.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef INTEL_FBO_H
-#define INTEL_FBO_H
-
-
-#include "pipe/p_state.h"
-#include "pipe/softpipe/sp_surface.h"
-
-
-struct intel_context;
-struct pipe_region;
-
-#if 0
-/**
- * Intel framebuffer, derived from gl_framebuffer.
- */
-struct intel_framebuffer
-{
- struct gl_framebuffer Base;
-
- /* Drawable page flipping state */
- GLboolean pf_active;
- GLuint pf_seq;
- GLint pf_pipes;
- GLint pf_current_page;
- GLint pf_num_pages;
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
- GLuint vbl_waited;
-
- int64_t swap_ust;
- int64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
- GLuint vbl_pending[3]; /**< [number of color buffers] */
-};
-#endif
-
-
-/**
- * Intel renderbuffer, derived from gl_renderbuffer.
- * Note: The PairedDepth and PairedStencil fields use renderbuffer IDs,
- * not pointers because in some circumstances a deleted renderbuffer could
- * result in a dangling pointer here.
- */
-#if 0
-struct intel_renderbuffer
-{
- struct gl_renderbuffer Base;
-};
-#endif
-
-#if 0
-extern struct intel_renderbuffer *intel_new_renderbuffer_fb(GLuint intFormat);
-#endif
-
-extern void intel_fbo_init(struct intel_context *intel);
-
-
-extern struct pipe_surface *
-intel_new_surface(struct pipe_context *pipe, GLuint pipeFormat);
-
-
-extern const GLuint *
-intel_supported_formats(struct pipe_context *pipe, GLuint *numFormats);
-
-
-#endif /* INTEL_FBO_H */