-/* $XFree86$ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.c,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
#include "enums.h"
#include "mtypes.h"
#include "macros.h"
-#include "texutil.h"
#include "swrast/swrast.h"
#include "r200_context.h"
#include "r200_pixel.h"
#include "r200_swtcl.h"
+#include "drirenderbuffer.h"
static GLboolean
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] ||
ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest
+ ctx->Texture._EnabledUnits
) &&
ctx->Current.RasterPosValid);
GLvoid *pixels )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint size;
GLint pitch = pack->RowLength ? pack->RowLength : width;
GLint blit_format;
+ GLuint cpp = rmesa->r200Screen->cpp;
+ GLint size = width * height * cpp;
if (R200_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
- /* Only accelerate reading to agp buffers.
+ /* Only accelerate reading to GART buffers.
*/
- if ( !r200IsAgpMemory(rmesa, pixels,
+ if ( !r200IsGartMemory(rmesa, pixels,
pitch * height * rmesa->r200Screen->cpp ) ) {
if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: dest not agp\n", __FUNCTION__);
+ fprintf(stderr, "%s: dest not GART\n", __FUNCTION__);
return GL_FALSE;
}
{
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
+ driRenderbuffer *drb = (driRenderbuffer *) ctx->ReadBuffer->_ColorReadBuffer;
int nbox = dPriv->numClipRects;
- int src_offset = rmesa->state.color.drawOffset;
- int src_pitch = rmesa->state.color.drawPitch * rmesa->r200Screen->cpp;
- int dst_offset = r200AgpOffsetFromVirtual( rmesa, pixels);
+ int src_offset = drb->offset
+ + rmesa->r200Screen->fbLocation;
+ int src_pitch = drb->pitch * drb->cpp;
+ int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels );
int dst_pitch = pitch * rmesa->r200Screen->cpp;
- XF86DRIClipRectRec *box = dPriv->pClipRects;
+ drm_clip_rect_t *box = dPriv->pClipRects;
int i;
r200EmitWait( rmesa, RADEON_WAIT_3D );
GLint x, GLint y, GLsizei width, GLsizei height,
GLint pitch,
const void *pixels,
- GLuint dest, GLuint planemask)
+ GLuint planemask)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- XF86DRIClipRectPtr box = dPriv->pClipRects;
+ drm_clip_rect_t *box = dPriv->pClipRects;
+ struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorDrawBuffers[0][0];
+ driRenderbuffer *drb = (driRenderbuffer *) rb;
int nbox = dPriv->numClipRects;
int i;
int blit_format;
int size;
- int src_offset = r200AgpOffsetFromVirtual( rmesa, pixels);
+ int src_offset = r200GartOffsetFromVirtual( rmesa, pixels );
int src_pitch = pitch * rmesa->r200Screen->cpp;
if (R200_DEBUG & DEBUG_PIXEL)
r200EmitBlit( rmesa,
blit_format,
src_pitch, src_offset,
- rmesa->state.color.drawPitch * rmesa->r200Screen->cpp,
- rmesa->state.color.drawOffset,
+ drb->pitch * drb->cpp,
+ drb->offset + rmesa->r200Screen->fbLocation,
bx - x, by - y,
bx, by,
bw, bh );
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- GLuint dest, planemask;
+ GLuint planemask;
GLuint cpp = rmesa->r200Screen->cpp;
GLint size = width * pitch * cpp;
if (R200_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
+ /* check that we're drawing to exactly one color buffer */
+ if (ctx->DrawBuffer->_NumColorDrawBuffers[0] != 1)
+ return GL_FALSE;
+
switch (format) {
case GL_RGB:
case GL_RGBA:
case GL_BGRA:
- dest = rmesa->state.color.drawOffset;
-
planemask = r200PackColor(cpp,
ctx->Color.ColorMask[RCOMP],
ctx->Color.ColorMask[GCOMP],
if (planemask != ~0)
return GL_FALSE; /* fix me -- should be possible */
- /* Can't do conversions on agp reads/draws.
+ /* Can't do conversions on GART reads/draws.
*/
- if ( !r200IsAgpMemory( rmesa, pixels, size ) ) {
+ if ( !r200IsGartMemory( rmesa, pixels, size ) ) {
if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: not agp memory\n", __FUNCTION__);
+ fprintf(stderr, "%s: not GART memory\n", __FUNCTION__);
return GL_FALSE;
}
return GL_FALSE;
}
- if ( r200IsAgpMemory(rmesa, pixels, size) )
+ if ( r200IsGartMemory(rmesa, pixels, size) )
{
- do_draw_pix( ctx, x, y, width, height, pitch, pixels,
- dest, planemask );
+ do_draw_pix( ctx, x, y, width, height, pitch, pixels, planemask );
return GL_TRUE;
}
else if (0)