From 1f3c5eae5c4be582e50c2d4d7950424d86059c45 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Tue, 22 Nov 2011 19:04:04 +0300 Subject: [PATCH] i915g: implement RGBX and BGRX render targets They're not supported by hw directly, but it's easy to emulate them with a shader swizzling fixup. Signed-off-by: Vasily Khoruzhick [danvet: The important thing is to write a 1 to the unused alpha channel, the ddx is relying on this for render accel.] Signed-off-by: Daniel Vetter --- src/gallium/drivers/i915/i915_screen.c | 2 ++ src/gallium/drivers/i915/i915_state_static.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 75545f40172..bf7c2c2e8d3 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -298,7 +298,9 @@ i915_is_format_supported(struct pipe_screen *screen, }; static const enum pipe_format render_supported[] = { PIPE_FORMAT_B8G8R8A8_UNORM, + PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_FORMAT_R8G8B8A8_UNORM, + PIPE_FORMAT_R8G8B8X8_UNORM, PIPE_FORMAT_B5G6R5_UNORM, PIPE_FORMAT_B10G10R10A2_UNORM, PIPE_FORMAT_L8_UNORM, diff --git a/src/gallium/drivers/i915/i915_state_static.c b/src/gallium/drivers/i915/i915_state_static.c index e462937c273..64b842a9f76 100644 --- a/src/gallium/drivers/i915/i915_state_static.c +++ b/src/gallium/drivers/i915/i915_state_static.c @@ -39,13 +39,14 @@ static unsigned translate_format(enum pipe_format format) { switch (format) { case PIPE_FORMAT_B8G8R8A8_UNORM: + case PIPE_FORMAT_B8G8R8X8_UNORM: + case PIPE_FORMAT_R8G8B8A8_UNORM: + case PIPE_FORMAT_R8G8B8X8_UNORM: return COLOR_BUF_ARGB8888; case PIPE_FORMAT_B5G6R5_UNORM: return COLOR_BUF_RGB565; case PIPE_FORMAT_B5G5R5A1_UNORM: return COLOR_BUF_ARGB1555; - case PIPE_FORMAT_R8G8B8A8_UNORM: - return COLOR_BUF_ARGB8888; case PIPE_FORMAT_B4G4R4A4_UNORM: return COLOR_BUF_ARGB4444; case PIPE_FORMAT_B10G10R10A2_UNORM: @@ -168,6 +169,8 @@ static const struct uint hw_swizzle; } fixup_formats[] = { { PIPE_FORMAT_R8G8B8A8_UNORM, 0x21030000 /* BGRA */}, + { PIPE_FORMAT_B8G8R8X8_UNORM, 0x01250000 /* RGBX */}, + { PIPE_FORMAT_R8G8B8X8_UNORM, 0x21050000 /* BGRX */}, { PIPE_FORMAT_L8_UNORM, 0x00030000 /* RRRA */}, { PIPE_FORMAT_I8_UNORM, 0x00030000 /* RRRA */}, { PIPE_FORMAT_A8_UNORM, 0x33330000 /* AAAA */}, -- 2.30.2