2009-09-07 14:24:31 +01:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright 2009 VMware, Inc.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sub license, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
|
|
|
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
|
|
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
2010-05-08 12:52:50 +01:00
|
|
|
#include "pipe/p_defines.h"
|
|
|
|
|
2009-09-07 14:24:31 +01:00
|
|
|
#include "util/u_format.h"
|
2010-04-06 22:49:33 +01:00
|
|
|
#include "util/u_memory.h"
|
|
|
|
#include "util/u_string.h"
|
2009-09-07 14:24:31 +01:00
|
|
|
|
|
|
|
#include "lp_bld_type.h"
|
|
|
|
#include "lp_bld_const.h"
|
|
|
|
#include "lp_bld_conv.h"
|
2010-05-08 12:52:50 +01:00
|
|
|
#include "lp_bld_swizzle.h"
|
2010-07-02 16:57:57 +01:00
|
|
|
#include "lp_bld_gather.h"
|
2010-09-09 12:09:44 +01:00
|
|
|
#include "lp_bld_debug.h"
|
2009-09-07 14:24:31 +01:00
|
|
|
#include "lp_bld_format.h"
|
|
|
|
|
|
|
|
|
2009-10-25 09:06:05 +00:00
|
|
|
void
|
|
|
|
lp_build_format_swizzle_soa(const struct util_format_description *format_desc,
|
2010-05-08 12:52:50 +01:00
|
|
|
struct lp_build_context *bld,
|
2009-10-25 09:06:05 +00:00
|
|
|
const LLVMValueRef *unswizzled,
|
2010-05-12 18:17:34 +01:00
|
|
|
LLVMValueRef swizzled_out[4])
|
2009-10-25 09:06:05 +00:00
|
|
|
{
|
2010-05-08 12:52:50 +01:00
|
|
|
assert(UTIL_FORMAT_SWIZZLE_0 == PIPE_SWIZZLE_ZERO);
|
|
|
|
assert(UTIL_FORMAT_SWIZZLE_1 == PIPE_SWIZZLE_ONE);
|
|
|
|
|
|
|
|
if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
|
|
|
|
/*
|
|
|
|
* Return zzz1 for depth-stencil formats.
|
|
|
|
*
|
|
|
|
* XXX: Allow to control the depth swizzle with an additional parameter,
|
|
|
|
* as the caller may wish another depth swizzle, or retain the stencil
|
|
|
|
* value.
|
|
|
|
*/
|
2009-10-25 09:06:05 +00:00
|
|
|
enum util_format_swizzle swizzle = format_desc->swizzle[0];
|
2010-05-08 12:52:50 +01:00
|
|
|
LLVMValueRef depth = lp_build_swizzle_soa_channel(bld, unswizzled, swizzle);
|
2010-05-12 18:17:34 +01:00
|
|
|
swizzled_out[2] = swizzled_out[1] = swizzled_out[0] = depth;
|
|
|
|
swizzled_out[3] = bld->one;
|
2009-10-25 09:06:05 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
unsigned chan;
|
|
|
|
for (chan = 0; chan < 4; ++chan) {
|
|
|
|
enum util_format_swizzle swizzle = format_desc->swizzle[chan];
|
2010-05-12 18:17:34 +01:00
|
|
|
swizzled_out[chan] = lp_build_swizzle_soa_channel(bld, unswizzled, swizzle);
|
2009-10-25 09:06:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-01 19:00:03 +01:00
|
|
|
/**
|
|
|
|
* 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.
|
2010-05-14 18:09:29 +01:00
|
|
|
*
|
|
|
|
* \param format_desc the format of the 'packed' incoming pixel vector
|
|
|
|
* \param type the desired type for rgba_out (type.length = n, above)
|
|
|
|
* \param packed the incoming vector of packed pixels
|
|
|
|
* \param rgba_out returns the SoA R,G,B,A vectors
|
2010-04-01 19:00:03 +01:00
|
|
|
*/
|
2009-09-07 14:24:31 +01:00
|
|
|
void
|
|
|
|
lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
|
|
|
|
const struct util_format_description *format_desc,
|
2009-09-14 11:05:06 +01:00
|
|
|
struct lp_type type,
|
2009-09-07 14:24:31 +01:00
|
|
|
LLVMValueRef packed,
|
2010-05-12 18:17:34 +01:00
|
|
|
LLVMValueRef rgba_out[4])
|
2009-09-07 14:24:31 +01:00
|
|
|
{
|
2010-05-08 12:52:50 +01:00
|
|
|
struct lp_build_context bld;
|
2009-09-07 14:24:31 +01:00
|
|
|
LLVMValueRef inputs[4];
|
|
|
|
unsigned start;
|
|
|
|
unsigned chan;
|
|
|
|
|
2010-04-07 22:17:07 +01:00
|
|
|
assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
|
2009-09-07 14:24:31 +01:00
|
|
|
assert(format_desc->block.width == 1);
|
|
|
|
assert(format_desc->block.height == 1);
|
2010-04-01 19:00:03 +01:00
|
|
|
assert(format_desc->block.bits <= type.width);
|
|
|
|
/* FIXME: Support more output types */
|
|
|
|
assert(type.floating);
|
|
|
|
assert(type.width == 32);
|
2009-09-07 14:24:31 +01:00
|
|
|
|
2010-05-08 12:52:50 +01:00
|
|
|
lp_build_context_init(&bld, builder, type);
|
|
|
|
|
2009-09-07 14:24:31 +01:00
|
|
|
/* Decode the input vector components */
|
|
|
|
start = 0;
|
2010-03-31 14:05:21 +01:00
|
|
|
for (chan = 0; chan < format_desc->nr_channels; ++chan) {
|
2010-05-14 18:09:29 +01:00
|
|
|
const unsigned width = format_desc->channel[chan].size;
|
|
|
|
const unsigned stop = start + width;
|
2009-09-07 14:24:31 +01:00
|
|
|
LLVMValueRef input;
|
|
|
|
|
|
|
|
input = packed;
|
|
|
|
|
|
|
|
switch(format_desc->channel[chan].type) {
|
|
|
|
case UTIL_FORMAT_TYPE_VOID:
|
2010-04-01 17:45:29 +01:00
|
|
|
input = lp_build_undef(type);
|
2009-09-07 14:24:31 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UTIL_FORMAT_TYPE_UNSIGNED:
|
2010-04-01 17:45:29 +01:00
|
|
|
/*
|
|
|
|
* Align the LSB
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (start) {
|
|
|
|
input = LLVMBuildLShr(builder, input, lp_build_const_int_vec(type, start), "");
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Zero the MSBs
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (stop < format_desc->block.bits) {
|
|
|
|
unsigned mask = ((unsigned long long)1 << width) - 1;
|
|
|
|
input = LLVMBuildAnd(builder, input, lp_build_const_int_vec(type, mask), "");
|
|
|
|
}
|
2009-09-07 14:24:31 +01:00
|
|
|
|
2010-04-01 17:45:29 +01:00
|
|
|
/*
|
|
|
|
* Type conversion
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (type.floating) {
|
2009-09-07 14:24:31 +01:00
|
|
|
if(format_desc->channel[chan].normalized)
|
|
|
|
input = lp_build_unsigned_norm_to_float(builder, width, type, input);
|
|
|
|
else
|
2010-03-31 14:05:21 +01:00
|
|
|
input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
|
2009-09-07 14:24:31 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* FIXME */
|
|
|
|
assert(0);
|
|
|
|
input = lp_build_undef(type);
|
|
|
|
}
|
2010-04-01 17:45:29 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UTIL_FORMAT_TYPE_SIGNED:
|
|
|
|
/*
|
|
|
|
* Align the sign bit first.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (stop < type.width) {
|
|
|
|
unsigned bits = type.width - stop;
|
|
|
|
LLVMValueRef bits_val = lp_build_const_int_vec(type, bits);
|
|
|
|
input = LLVMBuildShl(builder, input, bits_val, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Align the LSB (with an arithmetic shift to preserve the sign)
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (format_desc->channel[chan].size < type.width) {
|
|
|
|
unsigned bits = type.width - format_desc->channel[chan].size;
|
|
|
|
LLVMValueRef bits_val = lp_build_const_int_vec(type, bits);
|
|
|
|
input = LLVMBuildAShr(builder, input, bits_val, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Type conversion
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (type.floating) {
|
|
|
|
input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
|
|
|
|
if (format_desc->channel[chan].normalized) {
|
|
|
|
double scale = 1.0 / ((1 << (format_desc->channel[chan].size - 1)) - 1);
|
|
|
|
LLVMValueRef scale_val = lp_build_const_vec(type, scale);
|
2010-08-08 20:44:54 +01:00
|
|
|
input = LLVMBuildFMul(builder, input, scale_val, "");
|
2010-04-01 17:45:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* FIXME */
|
|
|
|
assert(0);
|
|
|
|
input = lp_build_undef(type);
|
|
|
|
}
|
|
|
|
|
2009-09-07 14:24:31 +01:00
|
|
|
break;
|
|
|
|
|
2010-04-01 19:00:03 +01:00
|
|
|
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:
|
2010-04-07 22:17:07 +01:00
|
|
|
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), "");
|
2010-08-08 20:44:54 +01:00
|
|
|
input = LLVMBuildFMul(builder, input, scale_val, "");
|
2010-04-07 22:17:07 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* FIXME */
|
|
|
|
assert(0);
|
|
|
|
input = lp_build_undef(type);
|
|
|
|
}
|
2010-04-01 19:00:03 +01:00
|
|
|
break;
|
|
|
|
|
2009-09-07 14:24:31 +01:00
|
|
|
default:
|
2010-04-01 19:00:03 +01:00
|
|
|
assert(0);
|
2009-09-07 14:24:31 +01:00
|
|
|
input = lp_build_undef(type);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
inputs[chan] = input;
|
|
|
|
|
|
|
|
start = stop;
|
|
|
|
}
|
|
|
|
|
2010-05-12 18:17:34 +01:00
|
|
|
lp_build_format_swizzle_soa(format_desc, &bld, inputs, rgba_out);
|
2009-09-07 14:24:31 +01:00
|
|
|
}
|
2010-04-06 22:49:33 +01:00
|
|
|
|
|
|
|
|
2010-07-02 16:59:39 +01:00
|
|
|
void
|
|
|
|
lp_build_rgba8_to_f32_soa(LLVMBuilderRef builder,
|
|
|
|
struct lp_type dst_type,
|
|
|
|
LLVMValueRef packed,
|
|
|
|
LLVMValueRef *rgba)
|
|
|
|
{
|
|
|
|
LLVMValueRef mask = lp_build_const_int_vec(dst_type, 0xff);
|
|
|
|
unsigned chan;
|
|
|
|
|
|
|
|
packed = LLVMBuildBitCast(builder, packed,
|
|
|
|
lp_build_int_vec_type(dst_type), "");
|
|
|
|
|
|
|
|
/* Decode the input vector components */
|
|
|
|
for (chan = 0; chan < 4; ++chan) {
|
|
|
|
unsigned start = chan*8;
|
|
|
|
unsigned stop = start + 8;
|
|
|
|
LLVMValueRef input;
|
|
|
|
|
|
|
|
input = packed;
|
|
|
|
|
|
|
|
if (start)
|
|
|
|
input = LLVMBuildLShr(builder, input,
|
|
|
|
lp_build_const_int_vec(dst_type, start), "");
|
|
|
|
|
|
|
|
if (stop < 32)
|
|
|
|
input = LLVMBuildAnd(builder, input, mask, "");
|
|
|
|
|
|
|
|
input = lp_build_unsigned_norm_to_float(builder, 8, dst_type, input);
|
|
|
|
|
|
|
|
rgba[chan] = input;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-04-06 22:49:33 +01:00
|
|
|
/**
|
2010-05-14 18:09:29 +01:00
|
|
|
* Fetch a texels from a texture, returning them in SoA layout.
|
2010-04-06 22:49:33 +01:00
|
|
|
*
|
2010-05-14 18:09:29 +01:00
|
|
|
* \param type the desired return type for 'rgba'. The vector length
|
|
|
|
* is the number of texels to fetch
|
2010-05-12 19:41:53 +01:00
|
|
|
*
|
|
|
|
* \param base_ptr points to start of the texture image block. For non-
|
|
|
|
* compressed formats, this simply points to the texel.
|
|
|
|
* For compressed formats, it points to the start of the
|
|
|
|
* compressed data block.
|
|
|
|
*
|
|
|
|
* \param i, j the sub-block pixel coordinates. For non-compressed formats
|
|
|
|
* these will always be (0,0). For compressed formats, i will
|
|
|
|
* be in [0, block_width-1] and j will be in [0, block_height-1].
|
2010-04-06 22:49:33 +01:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
|
|
|
|
const struct util_format_description *format_desc,
|
|
|
|
struct lp_type type,
|
|
|
|
LLVMValueRef base_ptr,
|
|
|
|
LLVMValueRef offset,
|
|
|
|
LLVMValueRef i,
|
|
|
|
LLVMValueRef j,
|
2010-05-12 18:17:34 +01:00
|
|
|
LLVMValueRef rgba_out[4])
|
2010-04-06 22:49:33 +01:00
|
|
|
{
|
|
|
|
|
2010-04-07 22:17:07 +01:00
|
|
|
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 &&
|
2010-04-06 22:49:33 +01:00
|
|
|
format_desc->block.height == 1 &&
|
2010-04-07 22:17:07 +01:00
|
|
|
format_desc->block.bits <= type.width &&
|
|
|
|
(format_desc->channel[0].type != UTIL_FORMAT_TYPE_FLOAT ||
|
|
|
|
format_desc->channel[0].size == 32))
|
2010-04-06 22:49:33 +01:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The packed pixel fits into an element of the destination format. Put
|
2010-05-12 18:17:34 +01:00
|
|
|
* the packed pixels into a vector and extract each component for all
|
2010-04-06 22:49:33 +01:00
|
|
|
* vector elements in parallel.
|
|
|
|
*/
|
|
|
|
|
|
|
|
LLVMValueRef packed;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* gather the texels from the texture
|
2010-05-14 18:09:29 +01:00
|
|
|
* Ex: packed = {BGRA, BGRA, BGRA, BGRA}.
|
2010-04-06 22:49:33 +01:00
|
|
|
*/
|
|
|
|
packed = lp_build_gather(builder,
|
|
|
|
type.length,
|
|
|
|
format_desc->block.bits,
|
|
|
|
type.width,
|
|
|
|
base_ptr, offset);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* convert texels to float rgba
|
|
|
|
*/
|
|
|
|
lp_build_unpack_rgba_soa(builder,
|
|
|
|
format_desc,
|
|
|
|
type,
|
2010-05-12 18:17:34 +01:00
|
|
|
packed, rgba_out);
|
2010-07-02 18:36:43 +01:00
|
|
|
return;
|
2010-04-06 22:49:33 +01:00
|
|
|
}
|
|
|
|
|
2010-07-02 18:36:43 +01:00
|
|
|
/*
|
|
|
|
* Try calling lp_build_fetch_rgba_aos for all pixels.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (util_format_fits_8unorm(format_desc) &&
|
|
|
|
type.floating && type.width == 32 && type.length == 4) {
|
|
|
|
struct lp_type tmp_type;
|
|
|
|
LLVMValueRef tmp;
|
|
|
|
|
|
|
|
memset(&tmp_type, 0, sizeof tmp_type);
|
|
|
|
tmp_type.width = 8;
|
|
|
|
tmp_type.length = type.length * 4;
|
|
|
|
tmp_type.norm = TRUE;
|
|
|
|
|
|
|
|
tmp = lp_build_fetch_rgba_aos(builder, format_desc, tmp_type,
|
|
|
|
base_ptr, offset, i, j);
|
|
|
|
|
|
|
|
lp_build_rgba8_to_f32_soa(builder,
|
|
|
|
type,
|
|
|
|
tmp,
|
|
|
|
rgba_out);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fallback to calling lp_build_fetch_rgba_aos for each pixel.
|
|
|
|
*
|
|
|
|
* This is not the most efficient way of fetching pixels, as we
|
|
|
|
* miss some opportunities to do vectorization, but this is
|
|
|
|
* convenient for formats or scenarios for which there was no
|
|
|
|
* opportunity or incentive to optimize.
|
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
2010-04-06 22:49:33 +01:00
|
|
|
unsigned k, chan;
|
2010-07-02 18:36:43 +01:00
|
|
|
struct lp_type tmp_type;
|
|
|
|
|
2010-09-09 12:09:44 +01:00
|
|
|
if (gallivm_debug & GALLIVM_DEBUG_PERF) {
|
|
|
|
debug_printf("%s: scalar unpacking of %s\n",
|
|
|
|
__FUNCTION__, format_desc->short_name);
|
|
|
|
}
|
|
|
|
|
2010-07-02 18:36:43 +01:00
|
|
|
tmp_type = type;
|
|
|
|
tmp_type.length = 4;
|
2010-04-06 22:49:33 +01:00
|
|
|
|
|
|
|
for (chan = 0; chan < 4; ++chan) {
|
2010-05-12 18:17:34 +01:00
|
|
|
rgba_out[chan] = lp_build_undef(type);
|
2010-04-06 22:49:33 +01:00
|
|
|
}
|
|
|
|
|
2010-05-12 19:41:53 +01:00
|
|
|
/* loop over number of pixels */
|
2010-04-06 22:49:33 +01:00
|
|
|
for(k = 0; k < type.length; ++k) {
|
|
|
|
LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), k, 0);
|
|
|
|
LLVMValueRef offset_elem;
|
|
|
|
LLVMValueRef i_elem, j_elem;
|
2010-04-20 15:21:08 +01:00
|
|
|
LLVMValueRef tmp;
|
2010-04-06 22:49:33 +01:00
|
|
|
|
|
|
|
offset_elem = LLVMBuildExtractElement(builder, offset, index, "");
|
|
|
|
|
|
|
|
i_elem = LLVMBuildExtractElement(builder, i, index, "");
|
|
|
|
j_elem = LLVMBuildExtractElement(builder, j, index, "");
|
|
|
|
|
2010-05-12 19:41:53 +01:00
|
|
|
/* Get a single float[4]={R,G,B,A} pixel */
|
2010-07-02 18:36:43 +01:00
|
|
|
tmp = lp_build_fetch_rgba_aos(builder, format_desc, tmp_type,
|
|
|
|
base_ptr, offset_elem,
|
2010-05-12 18:17:34 +01:00
|
|
|
i_elem, j_elem);
|
2010-04-06 22:49:33 +01:00
|
|
|
|
2010-04-20 15:21:08 +01:00
|
|
|
/*
|
2010-05-12 19:41:53 +01:00
|
|
|
* Insert the AoS tmp value channels into the SoA result vectors at
|
|
|
|
* position = 'index'.
|
2010-04-20 15:21:08 +01:00
|
|
|
*/
|
2010-04-06 22:49:33 +01:00
|
|
|
for (chan = 0; chan < 4; ++chan) {
|
|
|
|
LLVMValueRef chan_val = LLVMConstInt(LLVMInt32Type(), chan, 0),
|
2010-04-20 15:21:08 +01:00
|
|
|
tmp_chan = LLVMBuildExtractElement(builder, tmp, chan_val, "");
|
2010-05-12 18:17:34 +01:00
|
|
|
rgba_out[chan] = LLVMBuildInsertElement(builder, rgba_out[chan],
|
|
|
|
tmp_chan, index, "");
|
2010-04-06 22:49:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|