aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2012-11-28 21:06:03 +0000
committerJosé Fonseca <[email protected]>2012-11-29 14:08:43 +0000
commit88e92f5bcd41a4affc0f5fc4433f7c9029cb8c03 (patch)
treeb34f833a52bf77e37c669356643bfd19f2ac2180 /src
parent75da95c50aedaa4b1abf51ec1dcaf2fe8ddd4f3b (diff)
llvmpipe: Remove lp_build_blend_soa()
No longer used/necessary, as we always blend in AoS now. Trivial.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/llvmpipe/Makefile1
-rw-r--r--src/gallium/drivers/llvmpipe/SConscript1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_blend.h11
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c343
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_blend.c219
5 files changed, 37 insertions, 538 deletions
diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
index ef16fc7d882..d8d136eab3b 100644
--- a/src/gallium/drivers/llvmpipe/Makefile
+++ b/src/gallium/drivers/llvmpipe/Makefile
@@ -8,7 +8,6 @@ C_SOURCES = \
lp_bld_blend.c \
lp_bld_blend_aos.c \
lp_bld_blend_logicop.c \
- lp_bld_blend_soa.c \
lp_bld_depth.c \
lp_bld_interp.c \
lp_clear.c \
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index d8952b90229..a81cf231a99 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -16,7 +16,6 @@ llvmpipe = env.ConvenienceLibrary(
'lp_bld_blend.c',
'lp_bld_blend_aos.c',
'lp_bld_blend_logicop.c',
- 'lp_bld_blend_soa.c',
'lp_bld_depth.c',
'lp_bld_interp.c',
'lp_clear.c',
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend.h b/src/gallium/drivers/llvmpipe/lp_bld_blend.h
index 75e06d16ed8..0a1cea1153c 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend.h
@@ -69,17 +69,6 @@ lp_build_blend_aos(struct gallivm_state *gallivm,
int nr_channels);
-void
-lp_build_blend_soa(struct gallivm_state *gallivm,
- const struct pipe_blend_state *blend,
- struct lp_type type,
- unsigned rt,
- LLVMValueRef src[4],
- LLVMValueRef dst[4],
- LLVMValueRef const_[4],
- LLVMValueRef res[4]);
-
-
/**
* Apply a logic op.
*
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
deleted file mode 100644
index bba58b10492..00000000000
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009-2010 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.
- *
- **************************************************************************/
-
-
-/**
- * @file
- * Blend LLVM IR generation -- SoA layout.
- *
- * Blending in SoA is much faster than AoS, especially when separate rgb/alpha
- * factors/functions are used, since no channel masking/shuffling is necessary
- * and we can achieve the full throughput of the SIMD operations. Furthermore
- * the fragment shader output is also in SoA, so it fits nicely with the rest
- * of the fragment pipeline.
- *
- * The drawback is that to be displayed the color buffer needs to be in AoS
- * layout, so we need to tile/untile the color buffer before/after rendering.
- * A color buffer like
- *
- * R11 G11 B11 A11 R12 G12 B12 A12 R13 G13 B13 A13 R14 G14 B14 A14 ...
- * R21 G21 B21 A21 R22 G22 B22 A22 R23 G23 B23 A23 R24 G24 B24 A24 ...
- *
- * R31 G31 B31 A31 R32 G32 B32 A32 R33 G33 B33 A33 R34 G34 B34 A34 ...
- * R41 G41 B41 A41 R42 G42 B42 A42 R43 G43 B43 A43 R44 G44 B44 A44 ...
- *
- * ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
- *
- * will actually be stored in memory as
- *
- * R11 R12 R21 R22 R13 R14 R23 R24 ... G11 G12 G21 G22 G13 G14 G23 G24 ... B11 B12 B21 B22 B13 B14 B23 B24 ... A11 A12 A21 A22 A13 A14 A23 A24 ...
- * R31 R32 R41 R42 R33 R34 R43 R44 ... G31 G32 G41 G42 G33 G34 G43 G44 ... B31 B32 B41 B42 B33 B34 B43 B44 ... A31 A32 A41 A42 A33 A34 A43 A44 ...
- * ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
- *
- * NOTE: Run lp_blend_test after any change to this file.
- *
- * You can also run lp_blend_test to obtain AoS vs SoA benchmarks. Invoking it
- * as:
- *
- * lp_blend_test -o blend.tsv
- *
- * will generate a tab-seperated-file with the test results and performance
- * measurements.
- *
- * @author Jose Fonseca <[email protected]>
- */
-
-
-#include "pipe/p_state.h"
-#include "util/u_debug.h"
-
-#include "gallivm/lp_bld_type.h"
-#include "gallivm/lp_bld_arit.h"
-#include "gallivm/lp_bld_init.h"
-#include "lp_bld_blend.h"
-
-
-/**
- * We may use the same values several times, so we keep them here to avoid
- * recomputing them. Also reusing the values allows us to do simplifications
- * that LLVM optimization passes wouldn't normally be able to do.
- */
-struct lp_build_blend_soa_context
-{
- struct lp_build_context base;
-
- LLVMValueRef src[4];
- LLVMValueRef dst[4];
- LLVMValueRef con[4];
-
- LLVMValueRef inv_src[4];
- LLVMValueRef inv_dst[4];
- LLVMValueRef inv_con[4];
-
- LLVMValueRef src_alpha_saturate;
-
- /**
- * We store all factors in a table in order to eliminate redundant
- * multiplications later.
- * Indexes are: factor[src,dst][color,term][r,g,b,a]
- */
- LLVMValueRef factor[2][2][4];
-
- /**
- * Table with all terms.
- * Indexes are: term[src,dst][r,g,b,a]
- */
- LLVMValueRef term[2][4];
-};
-
-
-/**
- * Build a single SOA blend factor for a color channel.
- * \param i the color channel in [0,3]
- */
-static LLVMValueRef
-lp_build_blend_soa_factor(struct lp_build_blend_soa_context *bld,
- unsigned factor, unsigned i)
-{
- /*
- * Compute src/first term RGB
- */
- switch (factor) {
- case PIPE_BLENDFACTOR_ONE:
- return bld->base.one;
- case PIPE_BLENDFACTOR_SRC_COLOR:
- return bld->src[i];
- case PIPE_BLENDFACTOR_SRC_ALPHA:
- return bld->src[3];
- case PIPE_BLENDFACTOR_DST_COLOR:
- return bld->dst[i];
- case PIPE_BLENDFACTOR_DST_ALPHA:
- return bld->dst[3];
- case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
- if(i == 3)
- return bld->base.one;
- else {
- if(!bld->inv_dst[3])
- bld->inv_dst[3] = lp_build_comp(&bld->base, bld->dst[3]);
- if(!bld->src_alpha_saturate)
- bld->src_alpha_saturate = lp_build_min(&bld->base, bld->src[3], bld->inv_dst[3]);
- return bld->src_alpha_saturate;
- }
- case PIPE_BLENDFACTOR_CONST_COLOR:
- return bld->con[i];
- case PIPE_BLENDFACTOR_CONST_ALPHA:
- return bld->con[3];
- case PIPE_BLENDFACTOR_SRC1_COLOR:
- /* TODO */
- assert(0);
- return bld->base.zero;
- case PIPE_BLENDFACTOR_SRC1_ALPHA:
- /* TODO */
- assert(0);
- return bld->base.zero;
- case PIPE_BLENDFACTOR_ZERO:
- return bld->base.zero;
- case PIPE_BLENDFACTOR_INV_SRC_COLOR:
- if(!bld->inv_src[i])
- bld->inv_src[i] = lp_build_comp(&bld->base, bld->src[i]);
- return bld->inv_src[i];
- case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
- if(!bld->inv_src[3])
- bld->inv_src[3] = lp_build_comp(&bld->base, bld->src[3]);
- return bld->inv_src[3];
- case PIPE_BLENDFACTOR_INV_DST_COLOR:
- if(!bld->inv_dst[i])
- bld->inv_dst[i] = lp_build_comp(&bld->base, bld->dst[i]);
- return bld->inv_dst[i];
- case PIPE_BLENDFACTOR_INV_DST_ALPHA:
- if(!bld->inv_dst[3])
- bld->inv_dst[3] = lp_build_comp(&bld->base, bld->dst[3]);
- return bld->inv_dst[3];
- case PIPE_BLENDFACTOR_INV_CONST_COLOR:
- if(!bld->inv_con[i])
- bld->inv_con[i] = lp_build_comp(&bld->base, bld->con[i]);
- return bld->inv_con[i];
- case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
- if(!bld->inv_con[3])
- bld->inv_con[3] = lp_build_comp(&bld->base, bld->con[3]);
- return bld->inv_con[3];
- case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
- /* TODO */
- assert(0);
- return bld->base.zero;
- case PIPE_BLENDFACTOR_INV_SRC1_ALPHA:
- /* TODO */
- assert(0);
- return bld->base.zero;
- default:
- assert(0);
- return bld->base.zero;
- }
-}
-
-
-/**
- * Generate blend code in SOA mode.
- * \param rt render target index (to index the blend / colormask state)
- * \param src src/fragment color
- * \param dst dst/framebuffer color
- * \param con constant blend color
- * \param res the result/output
- */
-void
-lp_build_blend_soa(struct gallivm_state *gallivm,
- const struct pipe_blend_state *blend,
- struct lp_type type,
- unsigned rt,
- LLVMValueRef src[4],
- LLVMValueRef dst[4],
- LLVMValueRef con[4],
- LLVMValueRef res[4])
-{
- LLVMBuilderRef builder = gallivm->builder;
- struct lp_build_blend_soa_context bld;
- unsigned i, j, k;
-
- assert(rt < PIPE_MAX_COLOR_BUFS);
-
- /* Setup build context */
- memset(&bld, 0, sizeof bld);
- lp_build_context_init(&bld.base, gallivm, type);
- for (i = 0; i < 4; ++i) {
- bld.src[i] = src[i];
- bld.dst[i] = dst[i];
- bld.con[i] = con[i];
- }
-
- for (i = 0; i < 4; ++i) {
- /* only compute blending for the color channels enabled for writing */
- if (blend->rt[rt].colormask & (1 << i)) {
- if (blend->logicop_enable) {
- if(!type.floating) {
- res[i] = lp_build_logicop(builder, blend->logicop_func, src[i], dst[i]);
- }
- else
- res[i] = dst[i];
- }
- else if (blend->rt[rt].blend_enable) {
- unsigned src_factor = i < 3 ? blend->rt[rt].rgb_src_factor : blend->rt[rt].alpha_src_factor;
- unsigned dst_factor = i < 3 ? blend->rt[rt].rgb_dst_factor : blend->rt[rt].alpha_dst_factor;
- unsigned func = i < 3 ? blend->rt[rt].rgb_func : blend->rt[rt].alpha_func;
- boolean func_commutative = lp_build_blend_func_commutative(func);
-
- /*
- * Compute src/dst factors.
- */
-
- bld.factor[0][0][i] = src[i];
- bld.factor[0][1][i] = lp_build_blend_soa_factor(&bld, src_factor, i);
- bld.factor[1][0][i] = dst[i];
- bld.factor[1][1][i] = lp_build_blend_soa_factor(&bld, dst_factor, i);
-
- /*
- * Check if lp_build_blend can perform any optimisations
- */
- res[i] = lp_build_blend(&bld.base,
- func,
- src_factor,
- dst_factor,
- bld.factor[0][0][i],
- bld.factor[1][0][i],
- bld.factor[0][1][i],
- bld.factor[1][1][i],
- true,
- true);
-
- if (res[i]) {
- continue;
- }
-
- /*
- * Compute src/dst terms
- */
-
- for(k = 0; k < 2; ++k) {
- /* See if this multiplication has been previously computed */
- for(j = 0; j < i; ++j) {
- if((bld.factor[k][0][j] == bld.factor[k][0][i] &&
- bld.factor[k][1][j] == bld.factor[k][1][i]) ||
- (bld.factor[k][0][j] == bld.factor[k][1][i] &&
- bld.factor[k][1][j] == bld.factor[k][0][i]))
- break;
- }
-
- if(j < i && bld.term[k][j])
- bld.term[k][i] = bld.term[k][j];
- else
- bld.term[k][i] = lp_build_mul(&bld.base, bld.factor[k][0][i], bld.factor[k][1][i]);
-
- if (src_factor == PIPE_BLENDFACTOR_ZERO &&
- (dst_factor == PIPE_BLENDFACTOR_DST_ALPHA ||
- dst_factor == PIPE_BLENDFACTOR_INV_DST_ALPHA)) {
- /* XXX special case these combos to work around an apparent
- * bug in LLVM.
- * This hack disables the check for multiplication by zero
- * in lp_bld_mul(). When we optimize away the
- * multiplication, something goes wrong during code
- * generation and we segfault at runtime.
- */
- LLVMValueRef zeroSave = bld.base.zero;
- bld.base.zero = NULL;
- bld.term[k][i] = lp_build_mul(&bld.base, bld.factor[k][0][i],
- bld.factor[k][1][i]);
- bld.base.zero = zeroSave;
- }
- }
-
- /*
- * Combine terms
- */
-
- /* See if this function has been previously applied */
- for(j = 0; j < i; ++j) {
- unsigned prev_func = j < 3 ? blend->rt[rt].rgb_func : blend->rt[rt].alpha_func;
- unsigned func_reverse = lp_build_blend_func_reverse(func, prev_func);
-
- if((!func_reverse &&
- bld.term[0][j] == bld.term[0][i] &&
- bld.term[1][j] == bld.term[1][i]) ||
- ((func_commutative || func_reverse) &&
- bld.term[0][j] == bld.term[1][i] &&
- bld.term[1][j] == bld.term[0][i]))
- break;
- }
-
- if(j < i)
- res[i] = res[j];
- else
- res[i] = lp_build_blend_func(&bld.base, func, bld.term[0][i], bld.term[1][i]);
- }
- else {
- res[i] = src[i];
- }
- }
- else {
- res[i] = dst[i];
- }
- }
-}
diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c
index 9ceb4a6fdcf..9c0a076fd89 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_blend.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c
@@ -45,13 +45,6 @@
#include "lp_test.h"
-enum vector_mode
-{
- AoS = 0,
- SoA = 1
-};
-
-
typedef void (*blend_test_ptr_t)(const void *src, const void *dst, const void *con, void *res);
@@ -61,7 +54,6 @@ write_tsv_header(FILE *fp)
fprintf(fp,
"result\t"
"cycles_per_channel\t"
- "mode\t"
"type\t"
"sep_func\t"
"sep_src_factor\t"
@@ -80,22 +72,13 @@ write_tsv_header(FILE *fp)
static void
write_tsv_row(FILE *fp,
const struct pipe_blend_state *blend,
- enum vector_mode mode,
struct lp_type type,
double cycles,
boolean success)
{
fprintf(fp, "%s\t", success ? "pass" : "fail");
- if (mode == AoS) {
- fprintf(fp, "%.1f\t", cycles / type.length);
- fprintf(fp, "aos\t");
- }
-
- if (mode == SoA) {
- fprintf(fp, "%.1f\t", cycles / (4 * type.length));
- fprintf(fp, "soa\t");
- }
+ fprintf(fp, "%.1f\t", cycles / type.length);
fprintf(fp, "%s%u%sx%u\t",
type.floating ? "f" : (type.fixed ? "h" : (type.sign ? "s" : "u")),
@@ -125,11 +108,8 @@ write_tsv_row(FILE *fp,
static void
dump_blend_type(FILE *fp,
const struct pipe_blend_state *blend,
- enum vector_mode mode,
struct lp_type type)
{
- fprintf(fp, "%s", mode ? "soa" : "aos");
-
fprintf(fp, " type=%s%u%sx%u",
type.floating ? "f" : (type.fixed ? "h" : (type.sign ? "s" : "u")),
type.width,
@@ -153,7 +133,6 @@ dump_blend_type(FILE *fp,
static LLVMValueRef
add_blend_test(struct gallivm_state *gallivm,
const struct pipe_blend_state *blend,
- enum vector_mode mode,
struct lp_type type)
{
LLVMModuleRef module = gallivm->module;
@@ -170,6 +149,10 @@ add_blend_test(struct gallivm_state *gallivm,
const enum pipe_format format = PIPE_FORMAT_R8G8B8A8_UNORM;
const unsigned rt = 0;
const unsigned char swizzle[4] = { 0, 1, 2, 3 };
+ LLVMValueRef src;
+ LLVMValueRef dst;
+ LLVMValueRef con;
+ LLVMValueRef res;
vec_type = lp_build_vec_type(gallivm, type);
@@ -185,48 +168,15 @@ add_blend_test(struct gallivm_state *gallivm,
builder = gallivm->builder;
LLVMPositionBuilderAtEnd(builder, block);
- if (mode == AoS) {
- LLVMValueRef src;
- LLVMValueRef dst;
- LLVMValueRef con;
- LLVMValueRef res;
+ src = LLVMBuildLoad(builder, src_ptr, "src");
+ dst = LLVMBuildLoad(builder, dst_ptr, "dst");
+ con = LLVMBuildLoad(builder, const_ptr, "const");
- src = LLVMBuildLoad(builder, src_ptr, "src");
- dst = LLVMBuildLoad(builder, dst_ptr, "dst");
- con = LLVMBuildLoad(builder, const_ptr, "const");
+ res = lp_build_blend_aos(gallivm, blend, &format, type, rt, src, NULL, dst, NULL, con, NULL, swizzle, 4);
- res = lp_build_blend_aos(gallivm, blend, &format, type, rt, src, NULL, dst, NULL, con, NULL, swizzle, 4);
+ lp_build_name(res, "res");
- lp_build_name(res, "res");
-
- LLVMBuildStore(builder, res, res_ptr);
- }
-
- if (mode == SoA) {
- LLVMValueRef src[4];
- LLVMValueRef dst[4];
- LLVMValueRef con[4];
- LLVMValueRef res[4];
- unsigned i;
-
- for(i = 0; i < 4; ++i) {
- LLVMValueRef index = LLVMConstInt(LLVMInt32TypeInContext(context), i, 0);
- src[i] = LLVMBuildLoad(builder, LLVMBuildGEP(builder, src_ptr, &index, 1, ""), "");
- dst[i] = LLVMBuildLoad(builder, LLVMBuildGEP(builder, dst_ptr, &index, 1, ""), "");
- con[i] = LLVMBuildLoad(builder, LLVMBuildGEP(builder, const_ptr, &index, 1, ""), "");
- lp_build_name(src[i], "src.%c", "rgba"[i]);
- lp_build_name(con[i], "con.%c", "rgba"[i]);
- lp_build_name(dst[i], "dst.%c", "rgba"[i]);
- }
-
- lp_build_blend_soa(gallivm, blend, type, rt, src, dst, con, res);
-
- for(i = 0; i < 4; ++i) {
- LLVMValueRef index = LLVMConstInt(LLVMInt32TypeInContext(context), i, 0);
- lp_build_name(res[i], "res.%c", "rgba"[i]);
- LLVMBuildStore(builder, res[i], LLVMBuildGEP(builder, res_ptr, &index, 1, ""));
- }
- }
+ LLVMBuildStore(builder, res, res_ptr);
LLVMBuildRetVoid(builder);;
@@ -459,7 +409,6 @@ static boolean
test_one(unsigned verbose,
FILE *fp,
const struct pipe_blend_state *blend,
- enum vector_mode mode,
struct lp_type type)
{
struct gallivm_state *gallivm;
@@ -473,18 +422,19 @@ test_one(unsigned verbose,
const unsigned stride = lp_type_width(type)/8;
if(verbose >= 1)
- dump_blend_type(stdout, blend, mode, type);
+ dump_blend_type(stdout, blend, type);
gallivm = gallivm_create();
- func = add_blend_test(gallivm, blend, mode, type);
+ func = add_blend_test(gallivm, blend, type);
gallivm_compile_module(gallivm);
blend_test_ptr = (blend_test_ptr_t)gallivm_jit_function(gallivm, func);
success = TRUE;
- if(mode == AoS) {
+
+ {
uint8_t *src, *dst, *con, *res, *ref;
src = align_malloc(stride, stride);
dst = align_malloc(stride, stride);
@@ -526,7 +476,7 @@ test_one(unsigned verbose,
success = FALSE;
if(verbose < 1)
- dump_blend_type(stderr, blend, mode, type);
+ dump_blend_type(stderr, blend, type);
fprintf(stderr, "MISMATCH\n");
fprintf(stderr, " Src: ");
@@ -556,95 +506,6 @@ test_one(unsigned verbose,
align_free(res);
align_free(ref);
}
- else if(mode == SoA) {
- uint8_t *src, *dst, *con, *res, *ref;
- src = align_malloc(4*stride, stride);
- dst = align_malloc(4*stride, stride);
- con = align_malloc(4*stride, stride);
- res = align_malloc(4*stride, stride);
- ref = align_malloc(4*stride, stride);
-
- for(i = 0; i < n && success; ++i) {
- int64_t start_counter = 0;
- int64_t end_counter = 0;
- boolean mismatch;
-
- for(j = 0; j < 4; ++j) {
- random_vec(type, src + j*stride);
- random_vec(type, dst + j*stride);
- random_vec(type, con + j*stride);
- }
-
- {
- double fsrc[4];
- double fdst[4];
- double fcon[4];
- double fref[4];
- unsigned k;
-
- for(k = 0; k < type.length; ++k) {
- for(j = 0; j < 4; ++j) {
- fsrc[j] = read_elem(type, src + j*stride, k);
- fdst[j] = read_elem(type, dst + j*stride, k);
- fcon[j] = read_elem(type, con + j*stride, k);
- }
-
- compute_blend_ref(blend, fsrc, fdst, fcon, fref);
-
- for(j = 0; j < 4; ++j)
- write_elem(type, ref + j*stride, k, fref[j]);
- }
- }
-
- start_counter = rdtsc();
- blend_test_ptr(src, dst, con, res);
- end_counter = rdtsc();
-
- cycles[i] = end_counter - start_counter;
-
- mismatch = FALSE;
- for (j = 0; j < 4; ++j)
- if(!compare_vec(type, res + j*stride, ref + j*stride))
- mismatch = TRUE;
-
- if (mismatch) {
- success = FALSE;
-
- if(verbose < 1)
- dump_blend_type(stderr, blend, mode, type);
- fprintf(stderr, "MISMATCH\n");
- for(j = 0; j < 4; ++j) {
- char channel = "RGBA"[j];
- fprintf(stderr, " Src%c: ", channel);
- dump_vec(stderr, type, src + j*stride);
- fprintf(stderr, "\n");
-
- fprintf(stderr, " Dst%c: ", channel);
- dump_vec(stderr, type, dst + j*stride);
- fprintf(stderr, "\n");
-
- fprintf(stderr, " Con%c: ", channel);
- dump_vec(stderr, type, con + j*stride);
- fprintf(stderr, "\n");
-
- fprintf(stderr, " Res%c: ", channel);
- dump_vec(stderr, type, res + j*stride);
- fprintf(stderr, "\n");
-
- fprintf(stderr, " Ref%c: ", channel);
- dump_vec(stderr, type, ref + j*stride);
- fprintf(stderr, "\n");
-
- fprintf(stderr, "\n");
- }
- }
- }
- align_free(src);
- align_free(dst);
- align_free(con);
- align_free(res);
- align_free(ref);
- }
/*
* Unfortunately the output of cycle counter is not very reliable as it comes
@@ -678,7 +539,7 @@ test_one(unsigned verbose,
}
if(fp)
- write_tsv_row(fp, blend, mode, type, cycles_avg, success);
+ write_tsv_row(fp, blend, type, cycles_avg, success);
gallivm_free_function(gallivm, func, blend_test_ptr);
@@ -748,7 +609,6 @@ test_all(unsigned verbose, FILE *fp)
const unsigned *alpha_src_factor;
const unsigned *alpha_dst_factor;
struct pipe_blend_state blend;
- enum vector_mode mode;
const struct lp_type *type;
boolean success = TRUE;
@@ -758,27 +618,25 @@ test_all(unsigned verbose, FILE *fp)
for(rgb_dst_factor = blend_factors; rgb_dst_factor <= rgb_src_factor; ++rgb_dst_factor) {
for(alpha_src_factor = blend_factors; alpha_src_factor < &blend_factors[num_factors]; ++alpha_src_factor) {
for(alpha_dst_factor = blend_factors; alpha_dst_factor <= alpha_src_factor; ++alpha_dst_factor) {
- for(mode = 0; mode < 2; ++mode) {
- for(type = blend_types; type < &blend_types[num_types]; ++type) {
-
- if(*rgb_dst_factor == PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE ||
- *alpha_dst_factor == PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE)
- continue;
-
- memset(&blend, 0, sizeof blend);
- blend.rt[0].blend_enable = 1;
- blend.rt[0].rgb_func = *rgb_func;
- blend.rt[0].rgb_src_factor = *rgb_src_factor;
- blend.rt[0].rgb_dst_factor = *rgb_dst_factor;
- blend.rt[0].alpha_func = *alpha_func;
- blend.rt[0].alpha_src_factor = *alpha_src_factor;
- blend.rt[0].alpha_dst_factor = *alpha_dst_factor;
- blend.rt[0].colormask = PIPE_MASK_RGBA;
-
- if(!test_one(verbose, fp, &blend, mode, *type))
- success = FALSE;
-
- }
+ for(type = blend_types; type < &blend_types[num_types]; ++type) {
+
+ if(*rgb_dst_factor == PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE ||
+ *alpha_dst_factor == PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE)
+ continue;
+
+ memset(&blend, 0, sizeof blend);
+ blend.rt[0].blend_enable = 1;
+ blend.rt[0].rgb_func = *rgb_func;
+ blend.rt[0].rgb_src_factor = *rgb_src_factor;
+ blend.rt[0].rgb_dst_factor = *rgb_dst_factor;
+ blend.rt[0].alpha_func = *alpha_func;
+ blend.rt[0].alpha_src_factor = *alpha_src_factor;
+ blend.rt[0].alpha_dst_factor = *alpha_dst_factor;
+ blend.rt[0].colormask = PIPE_MASK_RGBA;
+
+ if(!test_one(verbose, fp, &blend, *type))
+ success = FALSE;
+
}
}
}
@@ -802,7 +660,6 @@ test_some(unsigned verbose, FILE *fp,
const unsigned *alpha_src_factor;
const unsigned *alpha_dst_factor;
struct pipe_blend_state blend;
- enum vector_mode mode;
const struct lp_type *type;
unsigned long i;
boolean success = TRUE;
@@ -821,8 +678,6 @@ test_some(unsigned verbose, FILE *fp,
alpha_dst_factor = &blend_factors[rand() % num_factors];
} while(*alpha_dst_factor == PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE);
- mode = rand() & 1;
-
type = &blend_types[rand() % num_types];
memset(&blend, 0, sizeof blend);
@@ -835,7 +690,7 @@ test_some(unsigned verbose, FILE *fp,
blend.rt[0].alpha_dst_factor = *alpha_dst_factor;
blend.rt[0].colormask = PIPE_MASK_RGBA;
- if(!test_one(verbose, fp, &blend, mode, *type))
+ if(!test_one(verbose, fp, &blend, *type))
success = FALSE;
}