#include "radeon_common.h"
#include "radeon_span.h"
-#define DBG 0
-
-#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
-#if defined(__linux__)
-#include <byteswap.h>
-#define CPU_TO_LE16( x ) bswap_16( x )
-#define LE16_TO_CPU( x ) bswap_16( x )
-#endif /* __linux__ */
-#else
-#define CPU_TO_LE16( x ) ( x )
-#define LE16_TO_CPU( x ) ( x )
-#endif
-
-static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb);
-
-/*
- * Note that all information needed to access pixels in a renderbuffer
- * should be obtained through the gl_renderbuffer parameter, not per-context
- * information.
- */
-#define LOCAL_VARS \
- struct radeon_renderbuffer *rrb = (void *) rb; \
- int minx = 0, miny = 0; \
- int maxx = rb->Width; \
- int maxy = rb->Height; \
- void *buf = rb->Map; \
- int pitch = rb->RowStrideBytes; \
- GLuint p; \
- (void)p;
-
-#define Y_FLIP(_y) (_y)
-
-#define HW_LOCK()
-#define HW_UNLOCK()
-#define HW_CLIPLOOP()
-#define HW_ENDCLIPLOOP()
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-#define TAG(x) radeon##x##_RGB565
-#define TAG2(x,y) radeon##x##_RGB565##y
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5_REV
-#define TAG(x) radeon##x##_RGB565_REV
-#define TAG2(x,y) radeon##x##_RGB565_REV##y
-#include "spantmp2.h"
-
-/* 16 bit, ARGB1555 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_1_5_5_5_REV
-#define TAG(x) radeon##x##_ARGB1555
-#define TAG2(x,y) radeon##x##_ARGB1555##y
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_1_5_5_5
-#define TAG(x) radeon##x##_ARGB1555_REV
-#define TAG2(x,y) radeon##x##_ARGB1555_REV##y
-#include "spantmp2.h"
-
-/* 16 bit, RGBA4 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_4_4_4_4_REV
-#define TAG(x) radeon##x##_ARGB4444
-#define TAG2(x,y) radeon##x##_ARGB4444##y
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_4_4_4_4
-#define TAG(x) radeon##x##_ARGB4444_REV
-#define TAG2(x,y) radeon##x##_ARGB4444_REV##y
-#include "spantmp2.h"
-
-/* 32 bit, xRGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-#define TAG(x) radeon##x##_xRGB8888
-#define TAG2(x,y) radeon##x##_xRGB8888##y
-#include "spantmp2.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-#define TAG(x) radeon##x##_ARGB8888
-#define TAG2(x,y) radeon##x##_ARGB8888##y
-#include "spantmp2.h"
-
-/* 32 bit, BGRx8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8
-#define TAG(x) radeon##x##_BGRx8888
-#define TAG2(x,y) radeon##x##_BGRx8888##y
-#include "spantmp2.h"
-
-/* 32 bit, BGRA8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8
-#define TAG(x) radeon##x##_BGRA8888
-#define TAG2(x,y) radeon##x##_BGRA8888##y
-#include "spantmp2.h"
static void
radeon_renderbuffer_map(struct gl_context *ctx, struct gl_renderbuffer *rb)
rb->Map = map;
rb->RowStride = stride / _mesa_get_format_bytes(rb->Format);
rb->RowStrideBytes = stride;
-
- radeonSetSpanFunctions(rrb);
}
static void
ctx->Driver.UnmapRenderbuffer(ctx, rb);
- rb->GetRow = NULL;
- rb->PutRow = NULL;
rb->Map = NULL;
rb->RowStride = 0;
rb->RowStrideBytes = 0;
swdd->SpanRenderFinish = radeonSpanRenderFinish;
}
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb)
-{
- if (rrb->base.Format == MESA_FORMAT_RGB565) {
- radeonInitPointers_RGB565(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_RGB565_REV) {
- radeonInitPointers_RGB565_REV(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_XRGB8888) {
- radeonInitPointers_xRGB8888(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_XRGB8888_REV) {
- radeonInitPointers_BGRx8888(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_ARGB8888) {
- radeonInitPointers_ARGB8888(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_ARGB8888_REV) {
- radeonInitPointers_BGRA8888(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_ARGB4444) {
- radeonInitPointers_ARGB4444(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_ARGB4444_REV) {
- radeonInitPointers_ARGB4444_REV(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_ARGB1555) {
- radeonInitPointers_ARGB1555(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_ARGB1555_REV) {
- radeonInitPointers_ARGB1555_REV(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_Z16) {
- _swrast_set_renderbuffer_accessors(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_X8_Z24) {
- _swrast_set_renderbuffer_accessors(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_S8_Z24) {
- _swrast_set_renderbuffer_accessors(&rrb->base);
- } else if (rrb->base.Format == MESA_FORMAT_S8) {
- _swrast_set_renderbuffer_accessors(&rrb->base);
- } else {
- fprintf(stderr, "radeonSetSpanFunctions: bad format: 0x%04X\n", rrb->base.Format);
- }
-}