summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-04-07 22:17:07 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-04-07 22:17:07 +0100
commit40bac07f9b5182890719151c99e9d9035e7984e7 (patch)
treef1f20168dac48a3fa5289d93890439eb5d4a669a /src
parent2c06fa4682ec0dd8a9f9d15ace867a6b952fd2e8 (diff)
gallivm: Get the format translation logic write.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_soa.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index 433134b809..459a6bfe3f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -113,7 +113,7 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
unsigned start;
unsigned chan;
- /* FIXME: Support more pixel formats */
+ assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
assert(format_desc->block.width == 1);
assert(format_desc->block.height == 1);
assert(format_desc->block.bits <= type.width);
@@ -227,8 +227,17 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
break;
case UTIL_FORMAT_TYPE_FIXED:
- assert(0);
- input = lp_build_undef(type);
+ if (type.floating) {
+ double scale = 1.0 / ((1 << (format_desc->channel[chan].size/2)) - 1);
+ LLVMValueRef scale_val = lp_build_const_vec(type, scale);
+ input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
+ input = LLVMBuildMul(builder, input, scale_val, "");
+ }
+ else {
+ /* FIXME */
+ assert(0);
+ input = lp_build_undef(type);
+ }
break;
default:
@@ -262,9 +271,14 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
LLVMValueRef *rgba)
{
- if (format_desc->block.width == 1 &&
+ if (format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN &&
+ (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+ format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) &&
+ format_desc->block.width == 1 &&
format_desc->block.height == 1 &&
- format_desc->block.bits <= type.width)
+ format_desc->block.bits <= type.width &&
+ (format_desc->channel[0].type != UTIL_FORMAT_TYPE_FLOAT ||
+ format_desc->channel[0].size == 32))
{
/*
* The packed pixel fits into an element of the destination format. Put