summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/radeon/radeon_span.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-10-20 15:15:34 -0700
committerEric Anholt <[email protected]>2011-10-28 11:21:38 -0700
commit3996ed555e0a024051e4d161c8d31b2530d8cdc5 (patch)
tree9b5dda39f9f96037bfa9db87a79cbe0249e8e2a6 /src/mesa/drivers/dri/radeon/radeon_span.c
parentb300d62617839a4bb6fca60125e914f8919e8e69 (diff)
radeon: Unifdef RADEON_R300 and RADEON_R600.
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_span.c')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_span.c510
1 files changed, 6 insertions, 504 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 8c6f2e49a5c..9d88ce98f09 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -118,324 +118,6 @@ static GLubyte *r200_depth_4byte(const struct radeon_renderbuffer * rrb,
}
#endif
-/* r600 tiling
- * two main types:
- * - 1D (akin to macro-linear/micro-tiled on older asics)
- * - 2D (akin to macro-tiled/micro-tiled on older asics)
- */
-#if defined(RADEON_R600)
-static inline GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb,
- GLint x, GLint y, GLint is_depth, GLint is_stencil)
-{
- GLint element_bytes = rrb->cpp;
- GLint num_samples = 1;
- GLint tile_width = 8;
- GLint tile_height = 8;
- GLint tile_thickness = 1;
- GLint pitch_elements = rrb->pitch / element_bytes;
- GLint height = rrb->base.Height;
- GLint z = 0;
- GLint sample_number = 0;
- /* */
- GLint tile_bytes;
- GLint tiles_per_row;
- GLint tiles_per_slice;
- GLint slice_offset;
- GLint tile_row_index;
- GLint tile_column_index;
- GLint tile_offset;
- GLint pixel_number = 0;
- GLint element_offset;
- GLint offset = 0;
-
- tile_bytes = tile_width * tile_height * tile_thickness * element_bytes * num_samples;
- tiles_per_row = pitch_elements / tile_width;
- tiles_per_slice = tiles_per_row * (height / tile_height);
- slice_offset = (z / tile_thickness) * tiles_per_slice * tile_bytes;
- tile_row_index = y / tile_height;
- tile_column_index = x / tile_width;
- tile_offset = ((tile_row_index * tiles_per_row) + tile_column_index) * tile_bytes;
-
- if (is_depth) {
- GLint pixel_offset = 0;
-
- pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
- pixel_number |= ((y >> 0) & 1) << 1; // pn[1] = y[0]
- pixel_number |= ((x >> 1) & 1) << 2; // pn[2] = x[1]
- pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1]
- pixel_number |= ((x >> 2) & 1) << 4; // pn[4] = x[2]
- pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
- switch (element_bytes) {
- case 2:
- pixel_offset = pixel_number * element_bytes * num_samples;
- break;
- case 4:
- /* stencil and depth data are stored separately within a tile.
- * stencil is stored in a contiguous tile before the depth tile.
- * stencil element is 1 byte, depth element is 3 bytes.
- * stencil tile is 64 bytes.
- */
- if (is_stencil)
- pixel_offset = pixel_number * 1 * num_samples;
- else
- pixel_offset = (pixel_number * 3 * num_samples) + 64;
- break;
- }
- element_offset = pixel_offset + (sample_number * element_bytes);
- } else {
- GLint sample_offset;
-
- switch (element_bytes) {
- case 1:
- pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
- pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1]
- pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2]
- pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1]
- pixel_number |= ((y >> 0) & 1) << 4; // pn[4] = y[0]
- pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
- break;
- case 2:
- pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
- pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1]
- pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2]
- pixel_number |= ((y >> 0) & 1) << 3; // pn[3] = y[0]
- pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1]
- pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
- break;
- case 4:
- pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
- pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1]
- pixel_number |= ((y >> 0) & 1) << 2; // pn[2] = y[0]
- pixel_number |= ((x >> 2) & 1) << 3; // pn[3] = x[2]
- pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1]
- pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
- break;
- }
- sample_offset = sample_number * (tile_bytes / num_samples);
- element_offset = sample_offset + (pixel_number * element_bytes);
- }
- offset = slice_offset + tile_offset + element_offset;
- return offset;
-}
-
-static inline GLint r600_log2(GLint n)
-{
- GLint log2 = 0;
-
- while (n >>= 1)
- ++log2;
- return log2;
-}
-
-static inline GLint r600_2d_tile_helper(const struct radeon_renderbuffer * rrb,
- GLint x, GLint y, GLint is_depth, GLint is_stencil)
-{
- GLint group_bytes = rrb->group_bytes;
- GLint num_channels = rrb->num_channels;
- GLint num_banks = rrb->num_banks;
- GLint r7xx_bank_op = rrb->r7xx_bank_op;
- /* */
- GLint group_bits = r600_log2(group_bytes);
- GLint channel_bits = r600_log2(num_channels);
- GLint bank_bits = r600_log2(num_banks);
- GLint element_bytes = rrb->cpp;
- GLint num_samples = 1;
- GLint tile_width = 8;
- GLint tile_height = 8;
- GLint tile_thickness = 1;
- GLint macro_tile_width = num_banks;
- GLint macro_tile_height = num_channels;
- GLint pitch_elements = (rrb->pitch / element_bytes) / tile_width;
- GLint height = rrb->base.Height / tile_height;
- GLint z = 0;
- GLint sample_number = 0;
- /* */
- GLint tile_bytes;
- GLint macro_tile_bytes;
- GLint macro_tiles_per_row;
- GLint macro_tiles_per_slice;
- GLint slice_offset;
- GLint macro_tile_row_index;
- GLint macro_tile_column_index;
- GLint macro_tile_offset;
- GLint pixel_number = 0;
- GLint element_offset;
- GLint bank = 0;
- GLint channel = 0;
- GLint total_offset;
- GLint group_mask = (1 << group_bits) - 1;
- GLint offset_low;
- GLint offset_high;
- GLint offset = 0;
-
- switch (num_channels) {
- case 2:
- default:
- // channel[0] = x[3] ^ y[3]
- channel |= (((x >> 3) ^ (y >> 3)) & 1) << 0;
- break;
- case 4:
- // channel[0] = x[4] ^ y[3]
- channel |= (((x >> 4) ^ (y >> 3)) & 1) << 0;
- // channel[1] = x[3] ^ y[4]
- channel |= (((x >> 3) ^ (y >> 4)) & 1) << 1;
- break;
- case 8:
- // channel[0] = x[5] ^ y[3]
- channel |= (((x >> 5) ^ (y >> 3)) & 1) << 0;
- // channel[0] = x[4] ^ x[5] ^ y[4]
- channel |= (((x >> 4) ^ (x >> 5) ^ (y >> 4)) & 1) << 1;
- // channel[0] = x[3] ^ y[5]
- channel |= (((x >> 3) ^ (y >> 5)) & 1) << 2;
- break;
- }
-
- switch (num_banks) {
- case 4:
- // bank[0] = x[3] ^ y[4 + log2(num_channels)]
- bank |= (((x >> 3) ^ (y >> (4 + channel_bits))) & 1) << 0;
- if (r7xx_bank_op)
- // bank[1] = x[3] ^ y[4 + log2(num_channels)] ^ x[5]
- bank |= (((x >> 4) ^ (y >> (3 + channel_bits)) ^ (x >> 5)) & 1) << 1;
- else
- // bank[1] = x[4] ^ y[3 + log2(num_channels)]
- bank |= (((x >> 4) ^ (y >> (3 + channel_bits))) & 1) << 1;
- break;
- case 8:
- // bank[0] = x[3] ^ y[5 + log2(num_channels)]
- bank |= (((x >> 3) ^ (y >> (5 + channel_bits))) & 1) << 0;
- // bank[1] = x[4] ^ y[4 + log2(num_channels)] ^ y[5 + log2(num_channels)]
- bank |= (((x >> 4) ^ (y >> (4 + channel_bits)) ^ (y >> (5 + channel_bits))) & 1) << 1;
- if (r7xx_bank_op)
- // bank[2] = x[5] ^ y[3 + log2(num_channels)] ^ x[6]
- bank |= (((x >> 5) ^ (y >> (3 + channel_bits)) ^ (x >> 6)) & 1) << 2;
- else
- // bank[2] = x[5] ^ y[3 + log2(num_channels)]
- bank |= (((x >> 5) ^ (y >> (3 + channel_bits))) & 1) << 2;
- break;
- }
-
- tile_bytes = tile_width * tile_height * tile_thickness * element_bytes * num_samples;
- macro_tile_bytes = macro_tile_width * macro_tile_height * tile_bytes;
- macro_tiles_per_row = pitch_elements / macro_tile_width;
- macro_tiles_per_slice = macro_tiles_per_row * (height / macro_tile_height);
- slice_offset = (z / tile_thickness) * macro_tiles_per_slice * macro_tile_bytes;
- macro_tile_row_index = (y / tile_height) / macro_tile_height;
- macro_tile_column_index = (x / tile_width) / macro_tile_width;
- macro_tile_offset = ((macro_tile_row_index * macro_tiles_per_row) + macro_tile_column_index) * macro_tile_bytes;
-
- if (is_depth) {
- GLint pixel_offset = 0;
-
- pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
- pixel_number |= ((y >> 0) & 1) << 1; // pn[1] = y[0]
- pixel_number |= ((x >> 1) & 1) << 2; // pn[2] = x[1]
- pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1]
- pixel_number |= ((x >> 2) & 1) << 4; // pn[4] = x[2]
- pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
- switch (element_bytes) {
- case 2:
- pixel_offset = pixel_number * element_bytes * num_samples;
- break;
- case 4:
- /* stencil and depth data are stored separately within a tile.
- * stencil is stored in a contiguous tile before the depth tile.
- * stencil element is 1 byte, depth element is 3 bytes.
- * stencil tile is 64 bytes.
- */
- if (is_stencil)
- pixel_offset = pixel_number * 1 * num_samples;
- else
- pixel_offset = (pixel_number * 3 * num_samples) + 64;
- break;
- }
- element_offset = pixel_offset + (sample_number * element_bytes);
- } else {
- GLint sample_offset;
-
- switch (element_bytes) {
- case 1:
- pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
- pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1]
- pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2]
- pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1]
- pixel_number |= ((y >> 0) & 1) << 4; // pn[4] = y[0]
- pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
- break;
- case 2:
- pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
- pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1]
- pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2]
- pixel_number |= ((y >> 0) & 1) << 3; // pn[3] = y[0]
- pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1]
- pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
- break;
- case 4:
- pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
- pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1]
- pixel_number |= ((y >> 0) & 1) << 2; // pn[2] = y[0]
- pixel_number |= ((x >> 2) & 1) << 3; // pn[3] = x[2]
- pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1]
- pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
- break;
- }
- sample_offset = sample_number * (tile_bytes / num_samples);
- element_offset = sample_offset + (pixel_number * element_bytes);
- }
- total_offset = (slice_offset + macro_tile_offset) >> (channel_bits + bank_bits);
- total_offset += element_offset;
-
- offset_low = total_offset & group_mask;
- offset_high = (total_offset & ~group_mask) << (channel_bits + bank_bits);
- offset = (bank << (group_bits + channel_bits)) + (channel << group_bits) + offset_low + offset_high;
-
- return offset;
-}
-
-/* depth buffers */
-static GLubyte *r600_ptr_depth(const struct radeon_renderbuffer * rrb,
- GLint x, GLint y)
-{
- GLubyte *ptr = rrb->bo->ptr;
- GLint offset;
- if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE)
- offset = r600_2d_tile_helper(rrb, x, y, 1, 0);
- else
- offset = r600_1d_tile_helper(rrb, x, y, 1, 0);
- return &ptr[offset];
-}
-
-static GLubyte *r600_ptr_stencil(const struct radeon_renderbuffer * rrb,
- GLint x, GLint y)
-{
- GLubyte *ptr = rrb->bo->ptr;
- GLint offset;
- if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE)
- offset = r600_2d_tile_helper(rrb, x, y, 1, 1);
- else
- offset = r600_1d_tile_helper(rrb, x, y, 1, 1);
- return &ptr[offset];
-}
-
-static GLubyte *r600_ptr_color(const struct radeon_renderbuffer * rrb,
- GLint x, GLint y)
-{
- GLubyte *ptr = rrb->bo->ptr;
- uint32_t mask = RADEON_BO_FLAGS_MACRO_TILE | RADEON_BO_FLAGS_MICRO_TILE;
- GLint offset;
-
- if (rrb->has_surface || !(rrb->bo->flags & mask)) {
- offset = x * rrb->cpp + y * rrb->pitch;
- } else {
- if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE)
- offset = r600_2d_tile_helper(rrb, x, y, 0, 0);
- else
- offset = r600_1d_tile_helper(rrb, x, y, 0, 0);
- }
- return &ptr[offset];
-}
-
-#else
/* radeon tiling on r300-r500 has 4 states,
macro-linear/micro-linear
@@ -528,8 +210,6 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
return &ptr[offset];
}
-#endif
-
/*
* Note that all information needed to access pixels in a renderbuffer
* should be obtained through the gl_renderbuffer parameter, not per-context
@@ -589,15 +269,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_RGB565
#define TAG2(x,y) radeon##x##_RGB565##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))))
-#define PUT_VALUE(_x, _y, d) { \
- GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE16(d); \
-} while (0)
-#else
#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
-#endif
#include "spantmp2.h"
#define SPANTMP_PIXEL_FMT GL_RGB
@@ -605,15 +277,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_RGB565_REV
#define TAG2(x,y) radeon##x##_RGB565_REV##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))))
-#define PUT_VALUE(_x, _y, d) { \
- GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE16(d); \
-} while (0)
-#else
#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
-#endif
#include "spantmp2.h"
/* 16 bit, ARGB1555 color spanline and pixel functions
@@ -623,15 +287,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_ARGB1555
#define TAG2(x,y) radeon##x##_ARGB1555##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))))
-#define PUT_VALUE(_x, _y, d) { \
- GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE16(d); \
-} while (0)
-#else
#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
-#endif
#include "spantmp2.h"
#define SPANTMP_PIXEL_FMT GL_BGRA
@@ -639,15 +295,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_ARGB1555_REV
#define TAG2(x,y) radeon##x##_ARGB1555_REV##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))))
-#define PUT_VALUE(_x, _y, d) { \
- GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE16(d); \
-} while (0)
-#else
#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
-#endif
#include "spantmp2.h"
/* 16 bit, RGBA4 color spanline and pixel functions
@@ -657,15 +305,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_ARGB4444
#define TAG2(x,y) radeon##x##_ARGB4444##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))))
-#define PUT_VALUE(_x, _y, d) { \
- GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE16(d); \
-} while (0)
-#else
#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
-#endif
#include "spantmp2.h"
#define SPANTMP_PIXEL_FMT GL_BGRA
@@ -673,15 +313,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_ARGB4444_REV
#define TAG2(x,y) radeon##x##_ARGB4444_REV##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))))
-#define PUT_VALUE(_x, _y, d) { \
- GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE16(d); \
-} while (0)
-#else
#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off)
-#endif
#include "spantmp2.h"
/* 32 bit, xRGB8888 color spanline and pixel functions
@@ -691,19 +323,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_xRGB8888
#define TAG2(x,y) radeon##x##_xRGB8888##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) ((LE32_TO_CPU(*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))) | 0xff000000))
-#define PUT_VALUE(_x, _y, d) { \
- GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE32(d); \
-} while (0)
-#else
#define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0xff000000))
#define PUT_VALUE(_x, _y, d) { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
*_ptr = d; \
} while (0)
-#endif
#include "spantmp2.h"
/* 32 bit, ARGB8888 color spanline and pixel functions
@@ -713,19 +337,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_ARGB8888
#define TAG2(x,y) radeon##x##_ARGB8888##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) (LE32_TO_CPU(*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))))
-#define PUT_VALUE(_x, _y, d) { \
- GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE32(d); \
-} while (0)
-#else
#define GET_VALUE(_x, _y) (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)))
#define PUT_VALUE(_x, _y, d) { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
*_ptr = d; \
} while (0)
-#endif
#include "spantmp2.h"
/* 32 bit, BGRx8888 color spanline and pixel functions
@@ -735,19 +351,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_BGRx8888
#define TAG2(x,y) radeon##x##_BGRx8888##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) ((LE32_TO_CPU(*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))) | 0x000000ff))
-#define PUT_VALUE(_x, _y, d) { \
- GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE32(d); \
-} while (0)
-#else
#define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0x000000ff))
#define PUT_VALUE(_x, _y, d) { \
GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
*_ptr = d; \
} while (0)
-#endif
#include "spantmp2.h"
/* 32 bit, BGRA8888 color spanline and pixel functions
@@ -757,15 +365,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#define TAG(x) radeon##x##_BGRA8888
#define TAG2(x,y) radeon##x##_BGRA8888##y
-#if defined(RADEON_R600)
-#define GET_VALUE(_x, _y) (LE32_TO_CPU(*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))))
-#define PUT_VALUE(_x, _y, d) { \
- GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE32(d); \
-} while (0)
-#else
#define GET_PTR(X,Y) radeon_ptr_4byte(rrb, (X) + x_off, (Y) + y_off)
-#endif
#include "spantmp2.h"
/* ================================================================
@@ -789,9 +389,6 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#if defined(RADEON_R200)
#define WRITE_DEPTH( _x, _y, d ) \
*(GLushort *)r200_depth_2byte(rrb, _x + x_off, _y + y_off) = d
-#elif defined(RADEON_R600)
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)r600_ptr_depth(rrb, _x + x_off, _y + y_off) = CPU_TO_LE16(d)
#else
#define WRITE_DEPTH( _x, _y, d ) \
*(GLushort *)radeon_ptr_2byte_8x2(rrb, _x + x_off, _y + y_off) = d
@@ -800,9 +397,6 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
#if defined(RADEON_R200)
#define READ_DEPTH( d, _x, _y ) \
d = *(GLushort *)r200_depth_2byte(rrb, _x + x_off, _y + y_off)
-#elif defined(RADEON_R600)
-#define READ_DEPTH( d, _x, _y ) \
- d = LE16_TO_CPU(*(GLushort *)r600_ptr_depth(rrb, _x + x_off, _y + y_off))
#else
#define READ_DEPTH( d, _x, _y ) \
d = *(GLushort *)radeon_ptr_2byte_8x2(rrb, _x + x_off, _y + y_off)
@@ -818,25 +412,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb,
*/
#define VALUE_TYPE GLuint
-#if defined(RADEON_R300)
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = LE32_TO_CPU(*_ptr); \
- tmp &= 0x000000ff; \
- tmp |= ((d << 8) & 0xffffff00); \
- *_ptr = CPU_TO_LE32(tmp); \
-} while (0)
-#elif defined(RADEON_R600)
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint *_ptr = (GLuint*)r600_ptr_depth( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = LE32_TO_CPU(*_ptr); \
- tmp &= 0xff000000; \
- tmp |= ((d) & 0x00ffffff); \
- *_ptr = CPU_TO_LE32(tmp); \
-} while (0)
-#elif defined(RADEON_R200)
+#if defined(RADEON_R200)
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \
@@ -856,17 +432,7 @@ do { \
} while (0)
#endif
-#if defined(RADEON_R300)
-#define READ_DEPTH( d, _x, _y ) \
- do { \
- d = (LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) & 0xffffff00) >> 8; \
- }while(0)
-#elif defined(RADEON_R600)
-#define READ_DEPTH( d, _x, _y ) \
- do { \
- d = (LE32_TO_CPU(*(GLuint*)(r600_ptr_depth(rrb, _x + x_off, _y + y_off))) & 0x00ffffff); \
- }while(0)
-#elif defined(RADEON_R200)
+#if defined(RADEON_R200)
#define READ_DEPTH( d, _x, _y ) \
do { \
d = LE32_TO_CPU(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))) & 0x00ffffff; \
@@ -887,27 +453,7 @@ do { \
*/
#define VALUE_TYPE GLuint
-#if defined(RADEON_R300)
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- *_ptr = CPU_TO_LE32((((d) & 0xff000000) >> 24) | (((d) & 0x00ffffff) << 8)); \
-} while (0)
-#elif defined(RADEON_R600)
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint *_ptr = (GLuint*)r600_ptr_depth( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = LE32_TO_CPU(*_ptr); \
- tmp &= 0xff000000; \
- tmp |= ((d) & 0x00ffffff); \
- *_ptr = CPU_TO_LE32(tmp); \
- _ptr = (GLuint*)r600_ptr_stencil(rrb, _x + x_off, _y + y_off); \
- tmp = LE32_TO_CPU(*_ptr); \
- tmp &= 0xffffff00; \
- tmp |= ((d) >> 24) & 0xff; \
- *_ptr = CPU_TO_LE32(tmp); \
-} while (0)
-#elif defined(RADEON_R200)
+#if defined(RADEON_R200)
#define WRITE_DEPTH( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \
@@ -921,19 +467,7 @@ do { \
} while (0)
#endif
-#if defined(RADEON_R300)
-#define READ_DEPTH( d, _x, _y ) \
- do { \
- GLuint tmp = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \
- d = LE32_TO_CPU(((tmp & 0x000000ff) << 24) | ((tmp & 0xffffff00) >> 8)); \
- }while(0)
-#elif defined(RADEON_R600)
-#define READ_DEPTH( d, _x, _y ) \
- do { \
- d = (LE32_TO_CPU(*(GLuint*)(r600_ptr_depth(rrb, _x + x_off, _y + y_off))) & 0x00ffffff); \
- d |= ((LE32_TO_CPU(*(GLuint*)(r600_ptr_stencil(rrb, _x + x_off, _y + y_off))) << 24) & 0xff000000); \
- }while(0)
-#elif defined(RADEON_R200)
+#if defined(RADEON_R200)
#define READ_DEPTH( d, _x, _y ) \
do { \
d = LE32_TO_CPU(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))); \
@@ -953,25 +487,7 @@ do { \
/* 24 bit depth, 8 bit stencil depthbuffer functions
*/
-#ifdef RADEON_R300
-#define WRITE_STENCIL( _x, _y, d ) \
-do { \
- GLuint *_ptr = (GLuint*)radeon_ptr_4byte(rrb, _x + x_off, _y + y_off); \
- GLuint tmp = LE32_TO_CPU(*_ptr); \
- tmp &= 0xffffff00; \
- tmp |= (d) & 0xff; \
- *_ptr = CPU_TO_LE32(tmp); \
-} while (0)
-#elif defined(RADEON_R600)
-#define WRITE_STENCIL( _x, _y, d ) \
-do { \
- GLuint *_ptr = (GLuint*)r600_ptr_stencil(rrb, _x + x_off, _y + y_off); \
- GLuint tmp = LE32_TO_CPU(*_ptr); \
- tmp &= 0xffffff00; \
- tmp |= (d) & 0xff; \
- *_ptr = CPU_TO_LE32(tmp); \
-} while (0)
-#elif defined(RADEON_R200)
+#if defined(RADEON_R200)
#define WRITE_STENCIL( _x, _y, d ) \
do { \
GLuint *_ptr = (GLuint*)r200_depth_4byte(rrb, _x + x_off, _y + y_off); \
@@ -991,21 +507,7 @@ do { \
} while (0)
#endif
-#ifdef RADEON_R300
-#define READ_STENCIL( d, _x, _y ) \
-do { \
- GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = LE32_TO_CPU(*_ptr); \
- d = tmp & 0x000000ff; \
-} while (0)
-#elif defined(RADEON_R600)
-#define READ_STENCIL( d, _x, _y ) \
-do { \
- GLuint *_ptr = (GLuint*)r600_ptr_stencil( rrb, _x + x_off, _y + y_off ); \
- GLuint tmp = LE32_TO_CPU(*_ptr); \
- d = tmp & 0x000000ff; \
-} while (0)
-#elif defined(RADEON_R200)
+#if defined(RADEON_R200)
#define READ_STENCIL( d, _x, _y ) \
do { \
GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \