mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
draw: take primitive into account when deciding if the pipeline is active
This commit is contained in:
parent
aacfc326cc
commit
4505acf3b2
4 changed files with 67 additions and 35 deletions
|
|
@ -424,7 +424,7 @@ draw_passthrough_arrays(struct draw_context *draw,
|
|||
|
||||
debug_printf("%s %d %d %d\n", __FUNCTION__, prim, start, count);
|
||||
|
||||
if (draw_need_pipeline(draw))
|
||||
if (draw_need_pipeline(draw, prim))
|
||||
return FALSE;
|
||||
|
||||
debug_printf("%s AAA\n", __FUNCTION__);
|
||||
|
|
|
|||
|
|
@ -364,7 +364,8 @@ extern void draw_vertex_shader_queue_flush( struct draw_context *draw );
|
|||
|
||||
extern void draw_update_vertex_fetch( struct draw_context *draw );
|
||||
|
||||
extern boolean draw_need_pipeline(const struct draw_context *draw);
|
||||
extern boolean draw_need_pipeline(const struct draw_context *draw,
|
||||
unsigned prim );
|
||||
|
||||
|
||||
/* Passthrough mode (second attempt):
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ draw_pt_arrays(struct draw_context *draw,
|
|||
unsigned start,
|
||||
unsigned count)
|
||||
{
|
||||
const boolean pipeline = draw_need_pipeline(draw);
|
||||
const boolean pipeline = draw_need_pipeline(draw, prim);
|
||||
const boolean cliptest = !draw->rasterizer->bypass_clipping;
|
||||
const boolean shading = !draw->rasterizer->bypass_vs;
|
||||
struct draw_pt_front_end *frontend = NULL;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,22 @@
|
|||
#include "pipe/p_defines.h"
|
||||
#include "draw_private.h"
|
||||
|
||||
static boolean points( unsigned prim )
|
||||
{
|
||||
return (prim == PIPE_PRIM_POINTS);
|
||||
}
|
||||
|
||||
static boolean lines( unsigned prim )
|
||||
{
|
||||
return (prim == PIPE_PRIM_LINES ||
|
||||
prim == PIPE_PRIM_LINE_STRIP ||
|
||||
prim == PIPE_PRIM_LINE_LOOP);
|
||||
}
|
||||
|
||||
static boolean triangles( unsigned prim )
|
||||
{
|
||||
return prim >= PIPE_PRIM_TRIANGLES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we need any special pipeline stages, or whether
|
||||
|
|
@ -40,48 +56,63 @@
|
|||
* pipeline stages.
|
||||
*/
|
||||
boolean
|
||||
draw_need_pipeline(const struct draw_context *draw)
|
||||
draw_need_pipeline(const struct draw_context *draw,
|
||||
unsigned int prim )
|
||||
{
|
||||
/* line stipple */
|
||||
if (draw->rasterizer->line_stipple_enable && draw->line_stipple)
|
||||
return TRUE;
|
||||
/* Don't have to worry about triangles turning into lines/points
|
||||
* and triggering the pipeline, because we have to trigger the
|
||||
* pipeline *anyway* if unfilled mode is active.
|
||||
*/
|
||||
if (lines(prim))
|
||||
{
|
||||
/* line stipple */
|
||||
if (draw->rasterizer->line_stipple_enable && draw->line_stipple)
|
||||
return TRUE;
|
||||
|
||||
/* wide lines */
|
||||
if (draw->rasterizer->line_width > draw->wide_line_threshold)
|
||||
return TRUE;
|
||||
/* wide lines */
|
||||
if (draw->rasterizer->line_width > draw->wide_line_threshold)
|
||||
return TRUE;
|
||||
|
||||
/* large points */
|
||||
if (draw->rasterizer->point_size > draw->wide_point_threshold)
|
||||
return TRUE;
|
||||
/* AA lines */
|
||||
if (draw->rasterizer->line_smooth && draw->pipeline.aaline)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* AA lines */
|
||||
if (draw->rasterizer->line_smooth && draw->pipeline.aaline)
|
||||
return TRUE;
|
||||
if (points(prim))
|
||||
{
|
||||
/* large points */
|
||||
if (draw->rasterizer->point_size > draw->wide_point_threshold)
|
||||
return TRUE;
|
||||
|
||||
/* AA points */
|
||||
if (draw->rasterizer->point_smooth && draw->pipeline.aapoint)
|
||||
return TRUE;
|
||||
/* AA points */
|
||||
if (draw->rasterizer->point_smooth && draw->pipeline.aapoint)
|
||||
return TRUE;
|
||||
|
||||
/* polygon stipple */
|
||||
if (draw->rasterizer->poly_stipple_enable && draw->pipeline.pstipple)
|
||||
return TRUE;
|
||||
/* point sprites */
|
||||
if (draw->rasterizer->point_sprite && draw->point_sprite)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* unfilled polygons */
|
||||
if (draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
|
||||
draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL)
|
||||
return TRUE;
|
||||
|
||||
/* polygon offset */
|
||||
if (draw->rasterizer->offset_cw || draw->rasterizer->offset_ccw)
|
||||
return TRUE;
|
||||
if (triangles(prim))
|
||||
{
|
||||
/* polygon stipple */
|
||||
if (draw->rasterizer->poly_stipple_enable && draw->pipeline.pstipple)
|
||||
return TRUE;
|
||||
|
||||
/* point sprites */
|
||||
if (draw->rasterizer->point_sprite && draw->point_sprite)
|
||||
return TRUE;
|
||||
/* unfilled polygons */
|
||||
if (draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
|
||||
draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL)
|
||||
return TRUE;
|
||||
|
||||
/* polygon offset */
|
||||
if (draw->rasterizer->offset_cw || draw->rasterizer->offset_ccw)
|
||||
return TRUE;
|
||||
|
||||
/* two-side lighting */
|
||||
if (draw->rasterizer->light_twoside)
|
||||
return TRUE;
|
||||
/* two-side lighting */
|
||||
if (draw->rasterizer->light_twoside)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* polygon cull - this is difficult - hardware can cull just fine
|
||||
* most of the time (though sometimes CULL_NEITHER is unsupported.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue