mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
llvmpipe: Eliminate lp_build_store_rgba_aos.
This commit is contained in:
parent
232b586464
commit
17afb6dd69
3 changed files with 16 additions and 49 deletions
|
|
@ -62,22 +62,10 @@ lp_build_unpack_rgba_aos(LLVMBuilderRef builder,
|
|||
*/
|
||||
LLVMValueRef
|
||||
lp_build_pack_rgba_aos(LLVMBuilderRef builder,
|
||||
enum pipe_format format,
|
||||
const struct util_format_description *desc,
|
||||
LLVMValueRef rgba);
|
||||
|
||||
|
||||
/**
|
||||
* Store a pixel.
|
||||
*
|
||||
* @param rgba 4 float vector with the unpacked components.
|
||||
*/
|
||||
void
|
||||
lp_build_store_rgba_aos(LLVMBuilderRef builder,
|
||||
enum pipe_format format,
|
||||
LLVMValueRef ptr,
|
||||
LLVMValueRef rgba);
|
||||
|
||||
|
||||
void
|
||||
lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
|
||||
const struct util_format_description *format_desc,
|
||||
|
|
|
|||
|
|
@ -150,10 +150,9 @@ lp_build_unpack_rgba_aos(LLVMBuilderRef builder,
|
|||
|
||||
LLVMValueRef
|
||||
lp_build_pack_rgba_aos(LLVMBuilderRef builder,
|
||||
enum pipe_format format,
|
||||
const struct util_format_description *desc,
|
||||
LLVMValueRef rgba)
|
||||
{
|
||||
const struct util_format_description *desc;
|
||||
LLVMTypeRef type;
|
||||
LLVMValueRef packed = NULL;
|
||||
LLVMValueRef swizzles[4];
|
||||
|
|
@ -164,8 +163,6 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
|
|||
unsigned shift;
|
||||
unsigned i, j;
|
||||
|
||||
desc = util_format_description(format);
|
||||
|
||||
assert(desc->layout == UTIL_FORMAT_LAYOUT_ARITH);
|
||||
assert(desc->block.width == 1);
|
||||
assert(desc->block.height == 1);
|
||||
|
|
@ -244,30 +241,3 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
|
|||
|
||||
return packed;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
lp_build_store_rgba_aos(LLVMBuilderRef builder,
|
||||
enum pipe_format format,
|
||||
LLVMValueRef ptr,
|
||||
LLVMValueRef rgba)
|
||||
{
|
||||
const struct util_format_description *desc;
|
||||
LLVMTypeRef type;
|
||||
LLVMValueRef packed;
|
||||
|
||||
desc = util_format_description(format);
|
||||
|
||||
assert(desc->layout == UTIL_FORMAT_LAYOUT_ARITH);
|
||||
assert(desc->block.width == 1);
|
||||
assert(desc->block.height == 1);
|
||||
|
||||
type = LLVMIntType(desc->block.bits);
|
||||
|
||||
packed = lp_build_pack_rgba_aos(builder, format, rgba);
|
||||
|
||||
ptr = LLVMBuildBitCast(builder, ptr, LLVMPointerType(type, 0), "");
|
||||
|
||||
LLVMBuildStore(builder, packed, ptr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,27 +133,31 @@ add_load_rgba_test(LLVMModuleRef module,
|
|||
}
|
||||
|
||||
|
||||
typedef void (*store_ptr_t)(void *, const float *);
|
||||
typedef void (*store_ptr_t)(uint32_t *, const float *);
|
||||
|
||||
|
||||
static LLVMValueRef
|
||||
add_store_rgba_test(LLVMModuleRef module,
|
||||
enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc;
|
||||
LLVMTypeRef args[2];
|
||||
LLVMValueRef func;
|
||||
LLVMValueRef ptr;
|
||||
LLVMValueRef packed_ptr;
|
||||
LLVMValueRef rgba_ptr;
|
||||
LLVMBasicBlockRef block;
|
||||
LLVMBuilderRef builder;
|
||||
LLVMValueRef rgba;
|
||||
LLVMValueRef packed;
|
||||
|
||||
args[0] = LLVMPointerType(LLVMInt8Type(), 0);
|
||||
desc = util_format_description(format);
|
||||
|
||||
args[0] = LLVMPointerType(LLVMInt32Type(), 0);
|
||||
args[1] = LLVMPointerType(LLVMVectorType(LLVMFloatType(), 4), 0);
|
||||
|
||||
func = LLVMAddFunction(module, "store", LLVMFunctionType(LLVMVoidType(), args, 2, 0));
|
||||
LLVMSetFunctionCallConv(func, LLVMCCallConv);
|
||||
ptr = LLVMGetParam(func, 0);
|
||||
packed_ptr = LLVMGetParam(func, 0);
|
||||
rgba_ptr = LLVMGetParam(func, 1);
|
||||
|
||||
block = LLVMAppendBasicBlock(func, "entry");
|
||||
|
|
@ -162,7 +166,12 @@ add_store_rgba_test(LLVMModuleRef module,
|
|||
|
||||
rgba = LLVMBuildLoad(builder, rgba_ptr, "");
|
||||
|
||||
lp_build_store_rgba_aos(builder, format, ptr, rgba);
|
||||
packed = lp_build_pack_rgba_aos(builder, desc, rgba);
|
||||
|
||||
if(desc->block.bits < 32)
|
||||
packed = LLVMBuildZExt(builder, packed, LLVMInt32Type(), "");
|
||||
|
||||
LLVMBuildStore(builder, packed, packed_ptr);
|
||||
|
||||
LLVMBuildRetVoid(builder);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue