From 461c34c0cb0e23f11fd9390a37a62d9930a1c48e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Thu, 8 Mar 2012 12:16:40 +0100 Subject: [PATCH] gallivm: add support for R8G8_R8B8 and G8R8_B8R8 formats MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Just to keep lp_test_format happy. Signed-off-by: Christian König --- src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c index cdf1956..ccc8320 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c @@ -398,6 +398,42 @@ grgb_to_rgba_aos(struct gallivm_state *gallivm, return rgba; } +/** + * Convert from packed GR_BR to <4n x i8> RGBA AoS + */ +static LLVMValueRef +grbr_to_rgba_aos(struct gallivm_state *gallivm, + unsigned n, + LLVMValueRef packed, + LLVMValueRef i) +{ + LLVMValueRef r, g, b; + LLVMValueRef rgba; + + uyvy_to_yuv_soa(gallivm, n, packed, i, &r, &g, &b); + rgba = rgb_to_rgba_aos(gallivm, n, r, g, b); + + return rgba; +} + + +/** + * Convert from packed RG_RB to <4n x i8> RGBA AoS + */ +static LLVMValueRef +rgrb_to_rgba_aos(struct gallivm_state *gallivm, + unsigned n, + LLVMValueRef packed, + LLVMValueRef i) +{ + LLVMValueRef r, g, b; + LLVMValueRef rgba; + + yuyv_to_yuv_soa(gallivm, n, packed, i, &r, &g, &b); + rgba = rgb_to_rgba_aos(gallivm, n, r, g, b); + + return rgba; +} /** * @param n is the number of pixels processed @@ -439,6 +475,12 @@ lp_build_fetch_subsampled_rgba_aos(struct gallivm_state *gallivm, case PIPE_FORMAT_G8R8_G8B8_UNORM: rgba = grgb_to_rgba_aos(gallivm, n, packed, i); break; + case PIPE_FORMAT_G8R8_B8R8_UNORM: + rgba = grbr_to_rgba_aos(gallivm, n, packed, i); + break; + case PIPE_FORMAT_R8G8_R8B8_UNORM: + rgba = rgrb_to_rgba_aos(gallivm, n, packed, i); + break; default: assert(0); rgba = LLVMGetUndef(LLVMVectorType(LLVMInt8TypeInContext(gallivm->context), 4*n)); -- 2.7.4