[Mesa-dev] [PATCH 2/2] i965: Use gs_prog_data in is_drawing_points/lines().
Iago Toral
itoral at igalia.com
Tue Aug 30 08:05:06 UTC 2016
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
On Mon, 2016-08-29 at 15:05 -0700, Kenneth Graunke wrote:
> State upload code should use prog_data rather than poking at core
> Mesa shader data structures wherever possible.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> 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 1edefb0..f8c552d 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 ==
> @@ -262,7 +262,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 |
> @@ -280,7 +280,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 ffe92a6..764b4e3 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;
> @@ -97,7 +97,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,
> @@ -191,7 +191,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))
> @@ -261,7 +261,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 cf3e680..4cf1a36 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,
> @@ -139,7 +139,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,
> },
More information about the mesa-dev
mailing list