#include "os/os_time.h"
#include "lp_scene_queue.h"
+#include "lp_context.h"
#include "lp_debug.h"
#include "lp_fence.h"
#include "lp_perf.h"
if ((x % TILE_SIZE) < task->width && (y % TILE_SIZE) < task->height) {
/* not very accurate would need a popcount on the mask */
/* always count this not worth bothering? */
- task->ps_invocations++;
+ task->ps_invocations += 1 * variant->ps_inv_multiplier;
/* run shader on 4x4 block */
BEGIN_JIT_CALL(state, task);
/* occlude counter for visible pixels */
struct lp_jit_thread_data thread_data;
uint64_t ps_invocations;
+ uint8_t ps_inv_multiplier;
pipe_semaphore work_ready;
pipe_semaphore work_done;
if ((x % TILE_SIZE) < task->width && (y % TILE_SIZE) < task->height) {
/* not very accurate would need a popcount on the mask */
/* always count this not worth bothering? */
- task->ps_invocations++;
+ task->ps_invocations += 1 * variant->ps_inv_multiplier;
/* run shader on 4x4 block */
BEGIN_JIT_CALL(state, task);
LP_COUNT(nr_tris);
- if (lp_context->active_statistics_queries) {
+ if (lp_context->active_statistics_queries &&
+ !llvmpipe_rasterization_disabled(lp_context)) {
lp_context->pipeline_statistics.c_primitives++;
}
LP_COUNT(nr_tris);
- if (lp_context->active_statistics_queries) {
+ if (lp_context->active_statistics_queries &&
+ !llvmpipe_rasterization_disabled(lp_context)) {
lp_context->pipeline_statistics.c_primitives++;
}
LP_COUNT(nr_tris);
- if (lp_context->active_statistics_queries) {
+ if (lp_context->active_statistics_queries &&
+ !llvmpipe_rasterization_disabled(lp_context)) {
lp_context->pipeline_statistics.c_primitives++;
}
stats->gs_invocations;
llvmpipe->pipeline_statistics.gs_primitives +=
stats->gs_primitives;
- llvmpipe->pipeline_statistics.c_invocations +=
- stats->c_invocations;
+ if (!llvmpipe_rasterization_disabled(llvmpipe)) {
+ llvmpipe->pipeline_statistics.c_invocations +=
+ stats->c_invocations;
+ } else {
+ llvmpipe->pipeline_statistics.c_invocations = 0;
+ }
}
/**
!key->alpha.enabled &&
!key->depth.enabled &&
!shader->info.base.uses_kill
- ? TRUE : FALSE;
+ ? TRUE : FALSE;
+
+ if ((!shader || shader->info.base.num_tokens <= 1) &&
+ !key->depth.enabled && !key->stencil[0].enabled) {
+ variant->ps_inv_multiplier = 0;
+ } else {
+ variant->ps_inv_multiplier = 1;
+ }
if ((LP_DEBUG & DEBUG_FS) || (gallivm_debug & GALLIVM_DEBUG_IR)) {
lp_debug_fs_variant(variant);
llvmpipe->pipe.set_constant_buffer = llvmpipe_set_constant_buffer;
}
+
+/*
+ * Rasterization is disabled if there is no pixel shader and
+ * both depth and stencil testing are disabled:
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/bb205125
+ */
+boolean
+llvmpipe_rasterization_disabled(struct llvmpipe_context *lp)
+{
+ boolean null_fs = !lp->fs || lp->fs->info.base.num_tokens <= 1;
+
+ return (null_fs &&
+ !lp->depth_stencil->depth.enabled &&
+ !lp->depth_stencil->stencil[0].enabled);
+}
struct lp_fragment_shader_variant_key key;
boolean opaque;
+ uint8_t ps_inv_multiplier;
struct gallivm_state *gallivm;
llvmpipe_remove_shader_variant(struct llvmpipe_context *lp,
struct lp_fragment_shader_variant *variant);
+boolean
+llvmpipe_rasterization_disabled(struct llvmpipe_context *lp);
+
#endif /* LP_STATE_FS_H_ */