From 4c116cbafb086653e3fcfb78128cc04b8c9264b1 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 25 Aug 2016 22:52:22 -0700 Subject: [PATCH] i965: Use gs_prog_data in is_drawing_points/lines(). State upload code should use prog_data rather than poking at core Mesa shader data structures wherever possible. Signed-off-by: Kenneth Graunke Reviewed-by: Iago Toral Quiroga --- src/mesa/drivers/dri/i965/gen6_clip_state.c | 16 ++++++++-------- src/mesa/drivers/dri/i965/gen6_sf_state.c | 8 +++++--- src/mesa/drivers/dri/i965/gen7_sf_state.c | 8 ++++---- src/mesa/drivers/dri/i965/gen8_sf_state.c | 4 ++-- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c index 8a3d05a..1c5b944 100644 --- a/src/mesa/drivers/dri/i965/gen6_clip_state.c +++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c @@ -43,9 +43,9 @@ brw_is_drawing_points(const struct brw_context *brw) return true; } - if (brw->geometry_program) { - /* BRW_NEW_GEOMETRY_PROGRAM */ - return brw->geometry_program->OutputType == GL_POINTS; + if (brw->gs.prog_data) { + /* BRW_NEW_GS_PROG_DATA */ + return brw->gs.prog_data->output_topology == _3DPRIM_POINTLIST; } else if (brw->tes.prog_data) { /* BRW_NEW_TES_PROG_DATA */ return brw->tes.prog_data->output_topology == @@ -66,9 +66,9 @@ brw_is_drawing_lines(const struct brw_context *brw) return true; } - if (brw->geometry_program) { - /* BRW_NEW_GEOMETRY_PROGRAM */ - return brw->geometry_program->OutputType == GL_LINE_STRIP; + if (brw->gs.prog_data) { + /* BRW_NEW_GS_PROG_DATA */ + return brw->gs.prog_data->output_topology == _3DPRIM_LINESTRIP; } else if (brw->tes.prog_data) { /* BRW_NEW_TES_PROG_DATA */ return brw->tes.prog_data->output_topology == @@ -263,7 +263,7 @@ const struct brw_tracked_state gen6_clip_state = { .brw = BRW_NEW_BLORP | BRW_NEW_CONTEXT | BRW_NEW_FS_PROG_DATA | - BRW_NEW_GEOMETRY_PROGRAM | + BRW_NEW_GS_PROG_DATA | BRW_NEW_META_IN_PROGRESS | BRW_NEW_PRIMITIVE | BRW_NEW_RASTERIZER_DISCARD | @@ -281,7 +281,7 @@ const struct brw_tracked_state gen7_clip_state = { .brw = BRW_NEW_BLORP | BRW_NEW_CONTEXT | BRW_NEW_FS_PROG_DATA | - BRW_NEW_GEOMETRY_PROGRAM | + BRW_NEW_GS_PROG_DATA | BRW_NEW_META_IN_PROGRESS | BRW_NEW_PRIMITIVE | BRW_NEW_RASTERIZER_DISCARD | diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index 7cef17a..059dd90 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -193,7 +193,7 @@ calculate_attr_overrides(const struct brw_context *brw, * correctly set the attr overrides. * * _NEW_POLYGON - * BRW_NEW_PRIMITIVE | BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_TES_PROG_DATA + * BRW_NEW_PRIMITIVE | BRW_NEW_GS_PROG_DATA | BRW_NEW_TES_PROG_DATA */ bool drawing_points = brw_is_drawing_points(brw); @@ -335,7 +335,9 @@ upload_sf_state(struct brw_context *brw) unreachable("not reached"); } - /* _NEW_SCISSOR _NEW_POLYGON BRW_NEW_GEOMETRY_PROGRAM BRW_NEW_PRIMITIVE */ + /* _NEW_SCISSOR | _NEW_POLYGON, + * BRW_NEW_GS_PROG_DATA | BRW_NEW_TES_PROG_DATA | BRW_NEW_PRIMITIVE + */ if (ctx->Scissor.EnableFlags || brw_is_drawing_points(brw) || brw_is_drawing_lines(brw)) dw3 |= GEN6_SF_SCISSOR_ENABLE; @@ -448,7 +450,7 @@ const struct brw_tracked_state gen6_sf_state = { BRW_NEW_CONTEXT | BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_FS_PROG_DATA | - BRW_NEW_GEOMETRY_PROGRAM | + BRW_NEW_GS_PROG_DATA | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA | BRW_NEW_VUE_MAP_GEOM_OUT, diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c index 8727bf8..06d3463 100644 --- a/src/mesa/drivers/dri/i965/gen7_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c @@ -61,7 +61,7 @@ upload_sbe_state(struct brw_context *brw) /* _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM, * BRW_NEW_FS_PROG_DATA | BRW_NEW_FRAGMENT_PROGRAM | - * BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA | + * BRW_NEW_GS_PROG_DATA | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA | * BRW_NEW_VUE_MAP_GEOM_OUT */ uint32_t urb_entry_read_length; @@ -98,7 +98,7 @@ const struct brw_tracked_state gen7_sbe_state = { BRW_NEW_CONTEXT | BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_FS_PROG_DATA | - BRW_NEW_GEOMETRY_PROGRAM | + BRW_NEW_GS_PROG_DATA | BRW_NEW_TES_PROG_DATA | BRW_NEW_PRIMITIVE | BRW_NEW_VUE_MAP_GEOM_OUT, @@ -192,7 +192,7 @@ upload_sf_state(struct brw_context *brw) } /* _NEW_SCISSOR | _NEW_POLYGON, - * BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA + * BRW_NEW_GS_PROG_DATA | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA */ if (ctx->Scissor.EnableFlags || brw_is_drawing_points(brw) || brw_is_drawing_lines(brw)) @@ -262,7 +262,7 @@ const struct brw_tracked_state gen7_sf_state = { _NEW_SCISSOR, .brw = BRW_NEW_BLORP | BRW_NEW_CONTEXT | - BRW_NEW_GEOMETRY_PROGRAM | + BRW_NEW_GS_PROG_DATA | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA | BRW_NEW_VUE_MAP_GEOM_OUT, diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/dri/i965/gen8_sf_state.c index 93c77f7..5272217 100644 --- a/src/mesa/drivers/dri/i965/gen8_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c @@ -62,7 +62,7 @@ upload_sbe(struct brw_context *brw) /* _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM, * BRW_NEW_FS_PROG_DATA | BRW_NEW_FRAGMENT_PROGRAM | - * BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA | + * BRW_NEW_GS_PROG_DATA | BRW_NEW_PRIMITIVE | BRW_NEW_TES_PROG_DATA | * BRW_NEW_VUE_MAP_GEOM_OUT */ calculate_attr_overrides(brw, attr_overrides, @@ -140,7 +140,7 @@ const struct brw_tracked_state gen8_sbe_state = { BRW_NEW_CONTEXT | BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_FS_PROG_DATA | - BRW_NEW_GEOMETRY_PROGRAM | + BRW_NEW_GS_PROG_DATA | BRW_NEW_TES_PROG_DATA | BRW_NEW_VUE_MAP_GEOM_OUT, }, -- 2.7.4