#include "lp_clear.h"
#include "lp_context.h"
#include "lp_setup.h"
+#include "lp_debug.h"
/**
if (llvmpipe->no_rast)
return;
+ if (LP_PERF & PERF_NO_DEPTH)
+ buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
+
lp_setup_clear( llvmpipe->setup, rgba, depth, stencil, buffers );
}
#define DEBUG_FENCE 0x2000
#define DEBUG_MEM 0x4000
+/* Performance flags. These are active even on release builds.
+ */
+#define PERF_TEX_MEM 0x1 /* minimize texture cache footprint */
+#define PERF_NO_MIP_LINEAR 0x2 /* MIP_FILTER_LINEAR ==> _NEAREST */
+#define PERF_NO_MIPMAPS 0x4 /* MIP_FILTER_NONE always */
+#define PERF_NO_LINEAR 0x8 /* FILTER_NEAREST always */
+#define PERF_NO_TEX 0x10 /* sample white always */
+#define PERF_NO_BLEND 0x20 /* disable blending */
+#define PERF_NO_DEPTH 0x40 /* disable depth buffering entirely */
+#define PERF_NO_ALPHATEST 0x80 /* disable alpha testing */
+
+
+extern int LP_PERF;
#ifdef DEBUG
extern int LP_DEBUG;
};
#endif
+int LP_PERF = 0;
+static const struct debug_named_value lp_perf_flags[] = {
+ { "texmem", PERF_TEX_MEM, NULL },
+ { "no_mipmap", PERF_NO_MIPMAPS, NULL },
+ { "no_linear", PERF_NO_LINEAR, NULL },
+ { "no_mip_linear", PERF_NO_MIP_LINEAR, NULL },
+ { "no_tex", PERF_NO_TEX, NULL },
+ { "no_blend", PERF_NO_BLEND, NULL },
+ { "no_depth", PERF_NO_DEPTH, NULL },
+ { "no_alphatest", PERF_NO_ALPHATEST, NULL },
+ DEBUG_NAMED_VALUE_END
+};
+
static const char *
llvmpipe_get_vendor(struct pipe_screen *screen)
LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 );
#endif
+ LP_PERF = debug_get_flags_option("LP_PERF", lp_perf_flags, 0 );
+
if (!screen)
return NULL;
jit_tex->row_stride[j] = lp_tex->row_stride[j];
jit_tex->img_stride[j] = lp_tex->img_stride[j];
- if (!jit_tex->data[j]) {
+ if ((LP_PERF & PERF_TEX_MEM) ||
+ !jit_tex->data[j]) {
/* out of memory - use dummy tile memory */
jit_tex->data[j] = lp_dummy_tile;
- jit_tex->width = TILE_SIZE;
- jit_tex->height = TILE_SIZE;
+ jit_tex->width = TILE_SIZE/8;
+ jit_tex->height = TILE_SIZE/8;
jit_tex->depth = 1;
jit_tex->last_level = 0;
jit_tex->row_stride[j] = 0;
#include "lp_screen.h"
#include "lp_context.h"
#include "lp_state.h"
+#include "lp_debug.h"
static void *
llvmpipe_create_blend_state(struct pipe_context *pipe,
const struct pipe_blend_state *blend)
{
- return mem_dup(blend, sizeof(*blend));
+ struct pipe_blend_state *state = mem_dup(blend, sizeof *blend);
+ int i;
+
+ if (LP_PERF & PERF_NO_BLEND) {
+ state->independent_blend_enable = 0;
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
+ state->rt[i].blend_enable = 0;
+ }
+
+ return state;
}
llvmpipe_create_depth_stencil_state(struct pipe_context *pipe,
const struct pipe_depth_stencil_alpha_state *depth_stencil)
{
- return mem_dup(depth_stencil, sizeof(*depth_stencil));
+ struct pipe_depth_stencil_alpha_state *state;
+
+ state = mem_dup(depth_stencil, sizeof *depth_stencil);
+
+ if (LP_PERF & PERF_NO_DEPTH) {
+ state->depth.enabled = 0;
+ state->depth.writemask = 0;
+ state->stencil[0].enabled = 0;
+ state->stencil[1].enabled = 0;
+ }
+
+ if (LP_PERF & PERF_NO_ALPHATEST) {
+ state->alpha.enabled = 0;
+ }
+
+ return state;
}
#include "lp_context.h"
#include "lp_screen.h"
#include "lp_state.h"
+#include "lp_debug.h"
#include "state_tracker/sw_winsys.h"
llvmpipe_create_sampler_state(struct pipe_context *pipe,
const struct pipe_sampler_state *sampler)
{
- return mem_dup(sampler, sizeof(*sampler));
+ struct pipe_sampler_state *state = mem_dup(sampler, sizeof *sampler);
+
+ if (LP_PERF & PERF_NO_MIP_LINEAR) {
+ if (state->min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR)
+ state->min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
+ }
+
+ if (LP_PERF & PERF_NO_MIPMAPS)
+ state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
+
+ if (LP_PERF & PERF_NO_LINEAR) {
+ state->mag_img_filter = PIPE_TEX_FILTER_NEAREST;
+ state->min_img_filter = PIPE_TEX_FILTER_NEAREST;
+ }
+
+ return state;
}
util_copy_framebuffer_state(&lp->framebuffer, fb);
+ if (LP_PERF & PERF_NO_DEPTH) {
+ pipe_surface_reference(&lp->framebuffer.zsbuf, NULL);
+ }
+
/* Tell draw module how deep the Z/depth buffer is */
if (lp->framebuffer.zsbuf) {
int depth_bits;
#include "gallivm/lp_bld_tgsi.h"
#include "lp_jit.h"
#include "lp_tex_sample.h"
+#include "lp_debug.h"
/**
struct lp_llvm_sampler_soa *sampler = (struct lp_llvm_sampler_soa *)base;
assert(unit < PIPE_MAX_SAMPLERS);
+
+ if (LP_PERF & PERF_NO_TEX) {
+ lp_build_sample_nop(type, texel);
+ return;
+ }
lp_build_sample_soa(builder,
&sampler->dynamic_state.static_state[unit],