You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
334 lines
12 KiB
334 lines
12 KiB
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c |
|
index f0d4503..c617425 100644 |
|
--- a/src/gallium/drivers/r600/evergreen_state.c |
|
+++ b/src/gallium/drivers/r600/evergreen_state.c |
|
@@ -219,7 +219,7 @@ static bool r600_is_sampler_format_supported(struct pipe_screen *screen, enum pi |
|
static bool r600_is_colorbuffer_format_supported(enum chip_class chip, enum pipe_format format) |
|
{ |
|
return r600_translate_colorformat(chip, format) != ~0U && |
|
- r600_translate_colorswap(format) != ~0U; |
|
+ r600_translate_colorswap(chip, format) != ~0U; |
|
} |
|
|
|
static bool r600_is_zs_format_supported(enum pipe_format format) |
|
@@ -918,7 +918,8 @@ void evergreen_init_color_surface_rat(struct r600_context *rctx, |
|
unsigned format = r600_translate_colorformat(rctx->b.chip_class, |
|
surf->base.format); |
|
unsigned endian = r600_colorformat_endian_swap(format); |
|
- unsigned swap = r600_translate_colorswap(surf->base.format); |
|
+ unsigned swap = r600_translate_colorswap(rctx->b.chip_class, |
|
+ surf->base.format); |
|
unsigned block_size = |
|
align(util_format_get_blocksize(pipe_buffer->format), 4); |
|
unsigned pitch_alignment = |
|
@@ -1078,7 +1079,7 @@ void evergreen_init_color_surface(struct r600_context *rctx, |
|
format = r600_translate_colorformat(rctx->b.chip_class, surf->base.format); |
|
assert(format != ~0); |
|
|
|
- swap = r600_translate_colorswap(surf->base.format); |
|
+ swap = r600_translate_colorswap(rctx->b.chip_class, surf->base.format); |
|
assert(swap != ~0); |
|
|
|
if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { |
|
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c |
|
index dd2e423..190fdfc 100644 |
|
--- a/src/gallium/drivers/r600/r600_state.c |
|
+++ b/src/gallium/drivers/r600/r600_state.c |
|
@@ -149,7 +149,7 @@ static bool r600_is_sampler_format_supported(struct pipe_screen *screen, enum pi |
|
static bool r600_is_colorbuffer_format_supported(enum chip_class chip, enum pipe_format format) |
|
{ |
|
return r600_translate_colorformat(chip, format) != ~0U && |
|
- r600_translate_colorswap(format) != ~0U; |
|
+ r600_translate_colorswap(chip, format) != ~0U; |
|
} |
|
|
|
static bool r600_is_zs_format_supported(enum pipe_format format) |
|
@@ -899,7 +899,7 @@ static void r600_init_color_surface(struct r600_context *rctx, |
|
format = r600_translate_colorformat(rctx->b.chip_class, surf->base.format); |
|
assert(format != ~0); |
|
|
|
- swap = r600_translate_colorswap(surf->base.format); |
|
+ swap = r600_translate_colorswap(rctx->b.chip_class, surf->base.format); |
|
assert(swap != ~0); |
|
|
|
if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { |
|
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c |
|
index fabc52c..c276016 100644 |
|
--- a/src/gallium/drivers/r600/r600_state_common.c |
|
+++ b/src/gallium/drivers/r600/r600_state_common.c |
|
@@ -2258,7 +2258,7 @@ uint32_t r600_translate_colorformat(enum chip_class chip, enum pipe_format forma |
|
|
|
uint32_t r600_colorformat_endian_swap(uint32_t colorformat) |
|
{ |
|
- if (R600_BIG_ENDIAN) { |
|
+ if (0 && R600_BIG_ENDIAN) { |
|
switch(colorformat) { |
|
/* 8-bit buffers. */ |
|
case V_0280A0_COLOR_4_4: |
|
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h |
|
index e7f410d..9bb471a 100644 |
|
--- a/src/gallium/drivers/radeon/r600_pipe_common.h |
|
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h |
|
@@ -457,7 +457,7 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe, |
|
struct pipe_resource *texture, |
|
const struct pipe_surface *templ, |
|
unsigned width, unsigned height); |
|
-unsigned r600_translate_colorswap(enum pipe_format format); |
|
+unsigned r600_translate_colorswap(enum chip_class chip, enum pipe_format format); |
|
void evergreen_do_fast_color_clear(struct r600_common_context *rctx, |
|
struct pipe_framebuffer_state *fb, |
|
struct r600_atom *fb_state, |
|
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c |
|
index 9a46c53..5022666 100644 |
|
--- a/src/gallium/drivers/radeon/r600_texture.c |
|
+++ b/src/gallium/drivers/radeon/r600_texture.c |
|
@@ -1157,10 +1157,215 @@ static void r600_surface_destroy(struct pipe_context *pipe, |
|
FREE(surface); |
|
} |
|
|
|
-unsigned r600_translate_colorswap(enum pipe_format format) |
|
+static uint32_t evergreen_translate_colorswap(enum pipe_format format) |
|
+{ |
|
+ switch (format) { |
|
+ /* 8-bit buffers. */ |
|
+ case PIPE_FORMAT_A8_UNORM: |
|
+ case PIPE_FORMAT_A8_SNORM: |
|
+ case PIPE_FORMAT_A8_UINT: |
|
+ case PIPE_FORMAT_A8_SINT: |
|
+ case PIPE_FORMAT_A16_UNORM: |
|
+ case PIPE_FORMAT_A16_SNORM: |
|
+ case PIPE_FORMAT_A16_UINT: |
|
+ case PIPE_FORMAT_A16_SINT: |
|
+ case PIPE_FORMAT_A16_FLOAT: |
|
+ case PIPE_FORMAT_A32_UINT: |
|
+ case PIPE_FORMAT_A32_SINT: |
|
+ case PIPE_FORMAT_A32_FLOAT: |
|
+ case PIPE_FORMAT_R4A4_UNORM: |
|
+ return V_0280A0_SWAP_ALT_REV; |
|
+ case PIPE_FORMAT_I8_UNORM: |
|
+ case PIPE_FORMAT_I8_SNORM: |
|
+ case PIPE_FORMAT_I8_UINT: |
|
+ case PIPE_FORMAT_I8_SINT: |
|
+ case PIPE_FORMAT_L8_UNORM: |
|
+ case PIPE_FORMAT_L8_SNORM: |
|
+ case PIPE_FORMAT_L8_UINT: |
|
+ case PIPE_FORMAT_L8_SINT: |
|
+ case PIPE_FORMAT_L8_SRGB: |
|
+ case PIPE_FORMAT_L16_UNORM: |
|
+ case PIPE_FORMAT_L16_SNORM: |
|
+ case PIPE_FORMAT_L16_UINT: |
|
+ case PIPE_FORMAT_L16_SINT: |
|
+ case PIPE_FORMAT_L16_FLOAT: |
|
+ case PIPE_FORMAT_L32_UINT: |
|
+ case PIPE_FORMAT_L32_SINT: |
|
+ case PIPE_FORMAT_L32_FLOAT: |
|
+ case PIPE_FORMAT_I16_UNORM: |
|
+ case PIPE_FORMAT_I16_SNORM: |
|
+ case PIPE_FORMAT_I16_UINT: |
|
+ case PIPE_FORMAT_I16_SINT: |
|
+ case PIPE_FORMAT_I16_FLOAT: |
|
+ case PIPE_FORMAT_I32_UINT: |
|
+ case PIPE_FORMAT_I32_SINT: |
|
+ case PIPE_FORMAT_I32_FLOAT: |
|
+ case PIPE_FORMAT_R8_UNORM: |
|
+ case PIPE_FORMAT_R8_SNORM: |
|
+ case PIPE_FORMAT_R8_UINT: |
|
+ case PIPE_FORMAT_R8_SINT: |
|
+ return V_0280A0_SWAP_STD; |
|
+ |
|
+ case PIPE_FORMAT_L4A4_UNORM: |
|
+ case PIPE_FORMAT_A4R4_UNORM: |
|
+ return V_0280A0_SWAP_ALT; |
|
+ |
|
+ /* 16-bit buffers. */ |
|
+ case PIPE_FORMAT_B5G6R5_UNORM: |
|
+ return V_0280A0_SWAP_STD_REV; |
|
+ |
|
+ case PIPE_FORMAT_B5G5R5A1_UNORM: |
|
+ case PIPE_FORMAT_B5G5R5X1_UNORM: |
|
+ return V_0280A0_SWAP_ALT; |
|
+ |
|
+ case PIPE_FORMAT_B4G4R4A4_UNORM: |
|
+ case PIPE_FORMAT_B4G4R4X4_UNORM: |
|
+ return V_0280A0_SWAP_ALT; |
|
+ |
|
+ case PIPE_FORMAT_Z16_UNORM: |
|
+ return V_0280A0_SWAP_STD; |
|
+ |
|
+ case PIPE_FORMAT_L8A8_UNORM: |
|
+ case PIPE_FORMAT_L8A8_SNORM: |
|
+ case PIPE_FORMAT_L8A8_UINT: |
|
+ case PIPE_FORMAT_L8A8_SINT: |
|
+ case PIPE_FORMAT_L8A8_SRGB: |
|
+ case PIPE_FORMAT_L16A16_UNORM: |
|
+ case PIPE_FORMAT_L16A16_SNORM: |
|
+ case PIPE_FORMAT_L16A16_UINT: |
|
+ case PIPE_FORMAT_L16A16_SINT: |
|
+ case PIPE_FORMAT_L16A16_FLOAT: |
|
+ case PIPE_FORMAT_L32A32_UINT: |
|
+ case PIPE_FORMAT_L32A32_SINT: |
|
+ case PIPE_FORMAT_L32A32_FLOAT: |
|
+ case PIPE_FORMAT_R8A8_UNORM: |
|
+ case PIPE_FORMAT_R8A8_SNORM: |
|
+ case PIPE_FORMAT_R8A8_UINT: |
|
+ case PIPE_FORMAT_R8A8_SINT: |
|
+ case PIPE_FORMAT_R16A16_UNORM: |
|
+ case PIPE_FORMAT_R16A16_SNORM: |
|
+ case PIPE_FORMAT_R16A16_UINT: |
|
+ case PIPE_FORMAT_R16A16_SINT: |
|
+ case PIPE_FORMAT_R16A16_FLOAT: |
|
+ case PIPE_FORMAT_R32A32_UINT: |
|
+ case PIPE_FORMAT_R32A32_SINT: |
|
+ case PIPE_FORMAT_R32A32_FLOAT: |
|
+ return V_0280A0_SWAP_ALT; |
|
+ case PIPE_FORMAT_R8G8_UNORM: |
|
+ case PIPE_FORMAT_R8G8_SNORM: |
|
+ case PIPE_FORMAT_R8G8_UINT: |
|
+ case PIPE_FORMAT_R8G8_SINT: |
|
+ return V_0280A0_SWAP_STD; |
|
+ |
|
+ case PIPE_FORMAT_R16_UNORM: |
|
+ case PIPE_FORMAT_R16_SNORM: |
|
+ case PIPE_FORMAT_R16_UINT: |
|
+ case PIPE_FORMAT_R16_SINT: |
|
+ case PIPE_FORMAT_R16_FLOAT: |
|
+ return V_0280A0_SWAP_STD; |
|
+ |
|
+ /* 32-bit buffers. */ |
|
+ |
|
+ case PIPE_FORMAT_A8B8G8R8_SRGB: |
|
+ return V_0280A0_SWAP_STD_REV; |
|
+ case PIPE_FORMAT_B8G8R8A8_SRGB: |
|
+ return V_0280A0_SWAP_ALT; |
|
+ |
|
+ case PIPE_FORMAT_B8G8R8A8_UNORM: |
|
+ case PIPE_FORMAT_B8G8R8X8_UNORM: |
|
+ return V_0280A0_SWAP_ALT; |
|
+ |
|
+ case PIPE_FORMAT_A8R8G8B8_UNORM: |
|
+ case PIPE_FORMAT_X8R8G8B8_UNORM: |
|
+ return V_0280A0_SWAP_ALT_REV; |
|
+ case PIPE_FORMAT_R8G8B8A8_SNORM: |
|
+ case PIPE_FORMAT_R8G8B8A8_UNORM: |
|
+ case PIPE_FORMAT_R8G8B8X8_UNORM: |
|
+ case PIPE_FORMAT_R8G8B8X8_SNORM: |
|
+ case PIPE_FORMAT_R8G8B8X8_SRGB: |
|
+ case PIPE_FORMAT_R8G8B8X8_UINT: |
|
+ case PIPE_FORMAT_R8G8B8X8_SINT: |
|
+ case PIPE_FORMAT_R8G8B8A8_SINT: |
|
+ case PIPE_FORMAT_R8G8B8A8_UINT: |
|
+ return V_0280A0_SWAP_STD; |
|
+ |
|
+ case PIPE_FORMAT_A8B8G8R8_UNORM: |
|
+ case PIPE_FORMAT_X8B8G8R8_UNORM: |
|
+ /* case PIPE_FORMAT_R8SG8SB8UX8U_NORM: */ |
|
+ return V_0280A0_SWAP_STD_REV; |
|
+ |
|
+ case PIPE_FORMAT_Z24X8_UNORM: |
|
+ case PIPE_FORMAT_Z24_UNORM_S8_UINT: |
|
+ return V_0280A0_SWAP_STD; |
|
+ |
|
+ case PIPE_FORMAT_R10G10B10A2_UNORM: |
|
+ case PIPE_FORMAT_R10G10B10X2_SNORM: |
|
+ case PIPE_FORMAT_R10SG10SB10SA2U_NORM: |
|
+ case PIPE_FORMAT_R10G10B10A2_UINT: |
|
+ return V_0280A0_SWAP_STD; |
|
+ |
|
+ case PIPE_FORMAT_B10G10R10A2_UNORM: |
|
+ case PIPE_FORMAT_B10G10R10A2_UINT: |
|
+ case PIPE_FORMAT_B10G10R10X2_UNORM: |
|
+ return V_0280A0_SWAP_ALT; |
|
+ |
|
+ case PIPE_FORMAT_R11G11B10_FLOAT: |
|
+ case PIPE_FORMAT_R16G16_UNORM: |
|
+ case PIPE_FORMAT_R16G16_SNORM: |
|
+ case PIPE_FORMAT_R16G16_FLOAT: |
|
+ case PIPE_FORMAT_R16G16_UINT: |
|
+ case PIPE_FORMAT_R16G16_SINT: |
|
+ case PIPE_FORMAT_R32_UINT: |
|
+ case PIPE_FORMAT_R32_SINT: |
|
+ case PIPE_FORMAT_R32_FLOAT: |
|
+ case PIPE_FORMAT_Z32_FLOAT: |
|
+ return V_0280A0_SWAP_STD; |
|
+ |
|
+ /* 64-bit buffers. */ |
|
+ case PIPE_FORMAT_R32G32_FLOAT: |
|
+ case PIPE_FORMAT_R32G32_UINT: |
|
+ case PIPE_FORMAT_R32G32_SINT: |
|
+ case PIPE_FORMAT_R16G16B16A16_UNORM: |
|
+ case PIPE_FORMAT_R16G16B16A16_SNORM: |
|
+ case PIPE_FORMAT_R16G16B16A16_UINT: |
|
+ case PIPE_FORMAT_R16G16B16A16_SINT: |
|
+ case PIPE_FORMAT_R16G16B16A16_FLOAT: |
|
+ case PIPE_FORMAT_R16G16B16X16_UNORM: |
|
+ case PIPE_FORMAT_R16G16B16X16_SNORM: |
|
+ case PIPE_FORMAT_R16G16B16X16_FLOAT: |
|
+ case PIPE_FORMAT_R16G16B16X16_UINT: |
|
+ case PIPE_FORMAT_R16G16B16X16_SINT: |
|
+ case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: |
|
+ |
|
+ /* 128-bit buffers. */ |
|
+ case PIPE_FORMAT_R32G32B32A32_FLOAT: |
|
+ case PIPE_FORMAT_R32G32B32A32_SNORM: |
|
+ case PIPE_FORMAT_R32G32B32A32_UNORM: |
|
+ case PIPE_FORMAT_R32G32B32A32_SINT: |
|
+ case PIPE_FORMAT_R32G32B32A32_UINT: |
|
+ case PIPE_FORMAT_R32G32B32X32_FLOAT: |
|
+ case PIPE_FORMAT_R32G32B32X32_UINT: |
|
+ case PIPE_FORMAT_R32G32B32X32_SINT: |
|
+ return V_0280A0_SWAP_STD; |
|
+ default: |
|
+ R600_ERR("unsupported colorswap format %d\n", format); |
|
+ return ~0U; |
|
+ } |
|
+ return ~0U; |
|
+} |
|
+ |
|
+unsigned r600_translate_colorswap(enum chip_class chip, enum pipe_format format) |
|
{ |
|
const struct util_format_description *desc = util_format_description(format); |
|
|
|
+#ifdef PIPE_ARCH_BIG_ENDIAN |
|
+ if (chip == EVERGREEN) { |
|
+ unsigned ret = evergreen_translate_colorswap(format); |
|
+ if (ret != ~0U) |
|
+ return ret; |
|
+ } |
|
+#endif |
|
+ |
|
#define HAS_SWIZZLE(chan,swz) (desc->swizzle[chan] == UTIL_FORMAT_SWIZZLE_##swz) |
|
|
|
if (format == PIPE_FORMAT_R11G11B10_FLOAT) /* isn't plain */ |
|
@@ -1238,6 +1443,10 @@ void evergreen_do_fast_color_clear(struct r600_common_context *rctx, |
|
{ |
|
int i; |
|
|
|
+#ifdef PIPE_ARCH_BIG_ENDIAN |
|
+ return false; /* broken; overkill to just disable them, but */ |
|
+#endif |
|
+ |
|
if (rctx->current_render_cond) |
|
return; |
|
|
|
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c |
|
index 7f65c47..f3976eb 100644 |
|
--- a/src/gallium/drivers/radeonsi/si_state.c |
|
+++ b/src/gallium/drivers/radeonsi/si_state.c |
|
@@ -1447,7 +1447,7 @@ static bool si_is_vertex_format_supported(struct pipe_screen *screen, enum pipe_ |
|
static bool si_is_colorbuffer_format_supported(enum pipe_format format) |
|
{ |
|
return si_translate_colorformat(format) != V_028C70_COLOR_INVALID && |
|
- r600_translate_colorswap(format) != ~0U; |
|
+ r600_translate_colorswap(0, format) != ~0U; |
|
} |
|
|
|
static bool si_is_zs_format_supported(enum pipe_format format) |
|
@@ -1615,7 +1615,7 @@ static void si_initialize_color_surface(struct si_context *sctx, |
|
R600_ERR("Invalid CB format: %d, disabling CB.\n", surf->base.format); |
|
} |
|
assert(format != V_028C70_COLOR_INVALID); |
|
- swap = r600_translate_colorswap(surf->base.format); |
|
+ swap = r600_translate_colorswap(0, surf->base.format); |
|
if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { |
|
endian = V_028C70_ENDIAN_NONE; |
|
} else {
|
|
|