Commit 68d8c1f9 authored by Dylan Baker's avatar Dylan Baker

r100: Use preprocessor to select big vs little endian paths

Reviewed-by: Eric Engestrom's avatarEric Engestrom <eric@engestrom.ch>
parent a550b6b7
......@@ -42,35 +42,26 @@ static inline uint32_t cmdpacket0(struct radeon_screen *rscrn,
unsigned r100_check_blit(mesa_format mesa_format, uint32_t dst_pitch)
{
/* XXX others? */
if (_mesa_little_endian()) {
switch (mesa_format) {
case MESA_FORMAT_B8G8R8A8_UNORM:
case MESA_FORMAT_B8G8R8X8_UNORM:
case MESA_FORMAT_B5G6R5_UNORM:
case MESA_FORMAT_B4G4R4A4_UNORM:
case MESA_FORMAT_B5G5R5A1_UNORM:
case MESA_FORMAT_A_UNORM8:
case MESA_FORMAT_L_UNORM8:
case MESA_FORMAT_I_UNORM8:
break;
default:
return 0;
}
}
else {
switch (mesa_format) {
case MESA_FORMAT_A8R8G8B8_UNORM:
case MESA_FORMAT_X8R8G8B8_UNORM:
case MESA_FORMAT_R5G6B5_UNORM:
case MESA_FORMAT_A4R4G4B4_UNORM:
case MESA_FORMAT_A1R5G5B5_UNORM:
case MESA_FORMAT_A_UNORM8:
case MESA_FORMAT_L_UNORM8:
case MESA_FORMAT_I_UNORM8:
break;
default:
return 0;
}
switch (mesa_format) {
#ifdef PIPE_ARCH_LITTLE_ENDIAN
case MESA_FORMAT_B8G8R8A8_UNORM:
case MESA_FORMAT_B8G8R8X8_UNORM:
case MESA_FORMAT_B5G6R5_UNORM:
case MESA_FORMAT_B4G4R4A4_UNORM:
case MESA_FORMAT_B5G5R5A1_UNORM:
#else
case MESA_FORMAT_A8R8G8B8_UNORM:
case MESA_FORMAT_X8R8G8B8_UNORM:
case MESA_FORMAT_R5G6B5_UNORM:
case MESA_FORMAT_A4R4G4B4_UNORM:
case MESA_FORMAT_A1R5G5B5_UNORM:
#endif
case MESA_FORMAT_A_UNORM8:
case MESA_FORMAT_L_UNORM8:
case MESA_FORMAT_I_UNORM8:
break;
default:
return 0;
}
/* Rendering to small buffer doesn't work.
......
......@@ -696,11 +696,26 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv,
_mesa_initialize_window_framebuffer(&rfb->base, mesaVis);
if (mesaVis->redBits == 5)
rgbFormat = _mesa_little_endian() ? MESA_FORMAT_B5G6R5_UNORM : MESA_FORMAT_R5G6B5_UNORM;
rgbFormat =
#ifdef PIPE_ARCH_LITTLE_ENDIAN
MESA_FORMAT_B5G6R5_UNORM;
#else
MESA_FORMAT_R5G6B5_UNORM;
#endif
else if (mesaVis->alphaBits == 0)
rgbFormat = _mesa_little_endian() ? MESA_FORMAT_B8G8R8X8_UNORM : MESA_FORMAT_X8R8G8B8_UNORM;
rgbFormat =
#ifdef PIPE_ARCH_LITTLE_ENDIAN
MESA_FORMAT_B8G8R8X8_UNORM;
#else
MESA_FORMAT_X8R8G8B8_UNORM;
#endif
else
rgbFormat = _mesa_little_endian() ? MESA_FORMAT_B8G8R8A8_UNORM : MESA_FORMAT_A8R8G8B8_UNORM;
rgbFormat =
#ifdef PIPE_ARCH_LITTLE_ENDIAN
MESA_FORMAT_B8G8R8A8_UNORM;
#else
MESA_FORMAT_A8R8G8B8_UNORM;
#endif
/* front color renderbuffer */
rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv);
......
......@@ -602,20 +602,19 @@ mesa_format _radeon_texformat_argb1555 = MESA_FORMAT_NONE;
static void
radeonInitTextureFormats(void)
{
if (_mesa_little_endian()) {
_radeon_texformat_rgba8888 = MESA_FORMAT_A8B8G8R8_UNORM;
_radeon_texformat_argb8888 = MESA_FORMAT_B8G8R8A8_UNORM;
_radeon_texformat_rgb565 = MESA_FORMAT_B5G6R5_UNORM;
_radeon_texformat_argb4444 = MESA_FORMAT_B4G4R4A4_UNORM;
_radeon_texformat_argb1555 = MESA_FORMAT_B5G5R5A1_UNORM;
}
else {
_radeon_texformat_rgba8888 = MESA_FORMAT_R8G8B8A8_UNORM;
_radeon_texformat_argb8888 = MESA_FORMAT_A8R8G8B8_UNORM;
_radeon_texformat_rgb565 = MESA_FORMAT_R5G6B5_UNORM;
_radeon_texformat_argb4444 = MESA_FORMAT_A4R4G4B4_UNORM;
_radeon_texformat_argb1555 = MESA_FORMAT_A1R5G5B5_UNORM;
}
#ifdef PIPE_ARCH_LITTLE_ENDIAN
_radeon_texformat_rgba8888 = MESA_FORMAT_A8B8G8R8_UNORM;
_radeon_texformat_argb8888 = MESA_FORMAT_B8G8R8A8_UNORM;
_radeon_texformat_rgb565 = MESA_FORMAT_B5G6R5_UNORM;
_radeon_texformat_argb4444 = MESA_FORMAT_B4G4R4A4_UNORM;
_radeon_texformat_argb1555 = MESA_FORMAT_B5G5R5A1_UNORM;
#else
_radeon_texformat_rgba8888 = MESA_FORMAT_R8G8B8A8_UNORM;
_radeon_texformat_argb8888 = MESA_FORMAT_A8R8G8B8_UNORM;
_radeon_texformat_rgb565 = MESA_FORMAT_R5G6B5_UNORM;
_radeon_texformat_argb4444 = MESA_FORMAT_A4R4G4B4_UNORM;
_radeon_texformat_argb1555 = MESA_FORMAT_A1R5G5B5_UNORM;
#endif
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment