llvmpipe: Support sampling from PIPE_FORMAT_R32_FLOAT.
This commit is contained in:
parent
13d2f3c738
commit
7e1aceaf0a
|
@ -80,6 +80,24 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unpack several pixels in SoA.
|
||||||
|
*
|
||||||
|
* It takes a vector of packed pixels:
|
||||||
|
*
|
||||||
|
* packed = {P0, P1, P2, P3, ..., Pn}
|
||||||
|
*
|
||||||
|
* And will produce four vectors:
|
||||||
|
*
|
||||||
|
* red = {R0, R1, R2, R3, ..., Rn}
|
||||||
|
* green = {G0, G1, G2, G3, ..., Gn}
|
||||||
|
* blue = {B0, B1, B2, B3, ..., Bn}
|
||||||
|
* alpha = {A0, A1, A2, A3, ..., An}
|
||||||
|
*
|
||||||
|
* It requires that a packed pixel fits into an element of the output
|
||||||
|
* channels. The common case is when converting pixel with a depth of 32 bit or
|
||||||
|
* less into floats.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
|
lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
|
||||||
const struct util_format_description *format_desc,
|
const struct util_format_description *format_desc,
|
||||||
|
@ -91,11 +109,13 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
|
||||||
unsigned start;
|
unsigned start;
|
||||||
unsigned chan;
|
unsigned chan;
|
||||||
|
|
||||||
/* FIXME: Support more formats */
|
/* FIXME: Support more pixel formats */
|
||||||
assert(format_desc->is_bitmask);
|
|
||||||
assert(format_desc->block.width == 1);
|
assert(format_desc->block.width == 1);
|
||||||
assert(format_desc->block.height == 1);
|
assert(format_desc->block.height == 1);
|
||||||
assert(format_desc->block.bits <= 32);
|
assert(format_desc->block.bits <= type.width);
|
||||||
|
/* FIXME: Support more output types */
|
||||||
|
assert(type.floating);
|
||||||
|
assert(type.width == 32);
|
||||||
|
|
||||||
/* Decode the input vector components */
|
/* Decode the input vector components */
|
||||||
start = 0;
|
start = 0;
|
||||||
|
@ -188,7 +208,27 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case UTIL_FORMAT_TYPE_FLOAT:
|
||||||
|
if (type.floating) {
|
||||||
|
assert(start == 0);
|
||||||
|
assert(stop == 32);
|
||||||
|
assert(type.width == 32);
|
||||||
|
input = LLVMBuildBitCast(builder, input, lp_build_vec_type(type), "");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* FIXME */
|
||||||
|
assert(0);
|
||||||
|
input = lp_build_undef(type);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UTIL_FORMAT_TYPE_FIXED:
|
||||||
|
assert(0);
|
||||||
|
input = lp_build_undef(type);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
assert(0);
|
||||||
input = lp_build_undef(type);
|
input = lp_build_undef(type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,8 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
|
||||||
|
|
||||||
/* FIXME: Temporary restrictions. See lp_bld_sample_soa.c */
|
/* FIXME: Temporary restrictions. See lp_bld_sample_soa.c */
|
||||||
if(tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) {
|
if(tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) {
|
||||||
if(!format_desc->is_bitmask)
|
if(!format_desc->is_bitmask &&
|
||||||
|
format != PIPE_FORMAT_R32_FLOAT)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
|
if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
|
||||||
|
|
Loading…
Reference in New Issue