#include "intel_fbo.h"
#include "intel_depthstencil.h"
#include "intel_regions.h"
-
+#include "intel_span.h"
/**
* The GL_EXT_framebuffer_object allows the user to create their own
*
*/
-
-
-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_region_map(intel, depthRb->region);
- depthRb->pfMap = depthRb->region->map;
- depthRb->pfPitch = depthRb->region->pitch;
- }
- if (stencilRb && stencilRb->region) {
- intel_region_map(intel, 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_region_unmap(intel, depthRb->region);
- depthRb->pfMap = NULL;
- depthRb->pfPitch = 0;
- }
- if (stencilRb && stencilRb->region) {
- intel_region_unmap(intel, 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)
+intel_unpair_depth_stencil(GLcontext *ctx, struct intel_renderbuffer *irb)
{
+ struct intel_context *intel = intel_context(ctx);
+ struct gl_renderbuffer *rb = &irb->Base;
+
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);
+ ASSERT(rb->_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);
+ ASSERT(stencilIrb->PairedDepth == rb->Name);
+ intel_renderbuffer_map(intel, rb);
+ intel_renderbuffer_map(intel, stencilRb);
+ _mesa_extract_stencil(ctx, rb, stencilRb);
+ intel_renderbuffer_unmap(intel, stencilRb);
+ intel_renderbuffer_unmap(intel, rb);
stencilIrb->PairedDepth = 0;
}
irb->PairedStencil = 0;
struct gl_renderbuffer *depthRb;
struct intel_renderbuffer *depthIrb;
- ASSERT(irb->Base._ActualFormat == GL_STENCIL_INDEX8_EXT ||
- irb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
+ ASSERT(rb->_ActualFormat == GL_STENCIL_INDEX8_EXT ||
+ rb->_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);
+ ASSERT(depthIrb->PairedStencil == rb->Name);
+ intel_renderbuffer_map(intel, rb);
+ intel_renderbuffer_map(intel, depthRb);
+ _mesa_extract_stencil(ctx, depthRb, rb);
+ intel_renderbuffer_unmap(intel, depthRb);
+ intel_renderbuffer_unmap(intel, rb);
depthIrb->PairedStencil = 0;
}
irb->PairedDepth = 0;
intel_validate_paired_depth_stencil(GLcontext * ctx,
struct gl_framebuffer *fb)
{
+ struct intel_context *intel = intel_context(ctx);
struct intel_renderbuffer *depthRb, *stencilRb;
depthRb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
stencilRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
/* establish new pairing: interleave stencil into depth buffer */
- map_regions(ctx, depthRb, stencilRb);
+ intel_renderbuffer_map(intel, &depthRb->Base);
+ intel_renderbuffer_map(intel, &stencilRb->Base);
_mesa_insert_stencil(ctx, &depthRb->Base, &stencilRb->Base);
- unmap_regions(ctx, depthRb, stencilRb);
+ intel_renderbuffer_unmap(intel, &stencilRb->Base);
+ intel_renderbuffer_unmap(intel, &depthRb->Base);
depthRb->PairedStencil = stencilRb->Base.Name;
stencilRb->PairedDepth = depthRb->Base.Name;
}
#define TAG(x) intel_YTile_##x##_z24_s8
#include "stenciltmp.h"
+void
+intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb)
+{
+ struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+
+ if (irb == NULL || irb->region == NULL)
+ return;
+
+ intel_region_map(intel, irb->region);
+
+ irb->pfMap = irb->region->map;
+ irb->pfPitch = irb->region->pitch;
+
+ intel_set_span_functions(intel, rb);
+}
+
+void
+intel_renderbuffer_unmap(struct intel_context *intel,
+ struct gl_renderbuffer *rb)
+{
+ struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+
+ if (irb == NULL || irb->region == NULL)
+ return;
+ intel_region_unmap(intel, irb->region);
+
+ irb->pfMap = NULL;
+ irb->pfPitch = 0;
+
+ rb->GetRow = NULL;
+ rb->PutRow = NULL;
+}
/**
* Map or unmap all the renderbuffers which we may need during
{
GLcontext *ctx = &intel->ctx;
GLuint i, j;
- struct intel_renderbuffer *irb;
/* color draw buffers */
for (j = 0; j < ctx->DrawBuffer->_NumColorDrawBuffers; j++) {
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[j];
- irb = intel_renderbuffer(rb);
- if (irb && irb->region) {
- intel_set_span_functions(intel, rb);
- if (map)
- intel_region_map(intel, irb->region);
- else
- intel_region_unmap(intel, irb->region);
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
+ if (map)
+ intel_renderbuffer_map(intel, ctx->DrawBuffer->_ColorDrawBuffers[j]);
+ else
+ intel_renderbuffer_unmap(intel, ctx->DrawBuffer->_ColorDrawBuffers[j]);
}
/* check for render to textures */
}
/* color read buffers */
- irb = intel_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
- if (irb && irb->region) {
- intel_set_span_functions(intel, ctx->ReadBuffer->_ColorReadBuffer);
- if (map)
- intel_region_map(intel, irb->region);
- else
- intel_region_unmap(intel, irb->region);
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
+ if (map)
+ intel_renderbuffer_map(intel, ctx->ReadBuffer->_ColorReadBuffer);
+ else
+ intel_renderbuffer_unmap(intel, ctx->ReadBuffer->_ColorReadBuffer);
/* Account for front/back color page flipping.
* The span routines use the pfMap and pfPitch fields which will
/* depth buffer (Note wrapper!) */
if (ctx->DrawBuffer->_DepthBuffer) {
- irb = intel_renderbuffer(ctx->DrawBuffer->_DepthBuffer->Wrapped);
- if (irb && irb->region) {
- if (map) {
- intel_set_span_functions(intel,
- ctx->DrawBuffer->_DepthBuffer->Wrapped);
- intel_region_map(intel, irb->region);
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
- else {
- intel_region_unmap(intel, irb->region);
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
- }
+ if (map)
+ intel_renderbuffer_map(intel, ctx->DrawBuffer->_DepthBuffer->Wrapped);
+ else
+ intel_renderbuffer_unmap(intel,
+ ctx->DrawBuffer->_DepthBuffer->Wrapped);
}
/* stencil buffer (Note wrapper!) */
if (ctx->DrawBuffer->_StencilBuffer) {
- irb = intel_renderbuffer(ctx->DrawBuffer->_StencilBuffer->Wrapped);
- if (irb && irb->region) {
- if (map) {
- intel_set_span_functions(intel,
- ctx->DrawBuffer->_StencilBuffer->Wrapped);
- intel_region_map(intel, irb->region);
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
- else {
- intel_region_unmap(intel, irb->region);
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
- }
+ if (map)
+ intel_renderbuffer_map(intel,
+ ctx->DrawBuffer->_StencilBuffer->Wrapped);
+ else
+ intel_renderbuffer_unmap(intel,
+ ctx->DrawBuffer->_StencilBuffer->Wrapped);
}
}