#include "lp_rast.h"
#include "lp_state_fs.h"
#include "lp_state_setup.h"
+#include "lp_context.h"
#define NUM_CHANNELS 4
LP_COUNT(nr_fully_covered_64);
/* if variant is opaque and scissor doesn't effect the tile */
- if (inputs->opaque) {
+ /*
+ * Need to disable this optimization for layered rendering and cannot use
+ * setup->layer_slot here to determine it, because it could incorrectly
+ * reset the tile if a previous shader used layer_slot but not this one
+ * (or maybe even "undo" clears). So determine this from presence of layers
+ * instead (in which case layer_slot will have no effect).
+ */
+ if (inputs->opaque && scene->fb_max_layer == 0) {
if (!scene->fb.zsbuf) {
/*
* All previous rendering will be overwritten so reset the bin.
unsigned tri_bytes;
int nr_planes = 3;
unsigned scissor_index = 0;
+ unsigned layer = 0;
/* Area should always be positive here */
assert(position->area > 0);
nr_planes = 7;
if (setup->viewport_index_slot > 0) {
unsigned *udata = (unsigned*)v0[setup->viewport_index_slot];
- scissor_index = *udata;
+ scissor_index = lp_clamp_scissor_idx(*udata);
}
}
else {
nr_planes = 3;
}
+ if (setup->layer_slot > 0) {
+ layer = *(unsigned*)v1[setup->layer_slot];
+ layer = MIN2(layer, scene->fb_max_layer);
+ }
/* Bounding rectangle (in pixels) */
{
LP_COUNT(nr_tris);
+ if (setup->active_query[PIPE_QUERY_PIPELINE_STATISTICS]) {
+ struct llvmpipe_context *lp_context = (struct llvmpipe_context *)setup->pipe;
+ lp_context->pipeline_statistics.c_primitives++;
+ }
+
/* Setup parameter interpolants:
*/
setup->setup.variant->jit_function( v0,
tri->inputs.frontfacing = frontfacing;
tri->inputs.disable = FALSE;
tri->inputs.opaque = setup->fs.current.variant->opaque;
+ tri->inputs.layer = layer;
if (0)
lp_dump_setup_coef(&setup->setup.variant->key,
plane[6].eo = 0;
}
- return lp_setup_bin_triangle( setup, tri, &bbox, nr_planes, scissor_index );
+ return lp_setup_bin_triangle(setup, tri, &bbox, nr_planes, scissor_index);
}
/*
/**
* Subdivide this triangle by bisecting edge (v0, v1).
* \param pv the provoking vertex (must = v0 or v1 or v2)
+ * TODO: should probably think about non-overflowing arithmetic elsewhere.
+ * This will definitely screw with pipeline counters for instance.
*/
static void
subdiv_tri(struct lp_setup_context *setup,