From 48f1409c3bf392f4b277eb6ecaf64e68e314e259 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 9 Nov 2014 23:35:08 +0100 Subject: tgsi/ureg: simplify code for declaring properties Tested-by: Nick Sarnie --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 12 ++++++++---- src/mesa/state_tracker/st_mesa_to_tgsi.c | 12 ++++++++---- src/mesa/state_tracker/st_program.c | 23 ++++++++++++++--------- 3 files changed, 30 insertions(+), 17 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index a4e2c8da586..c10ad7538cd 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4721,7 +4721,8 @@ emit_wpos(struct st_context *st, } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) { /* the driver supports lower-left origin, need to invert Y */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); invert = TRUE; } else @@ -4731,7 +4732,8 @@ emit_wpos(struct st_context *st, /* Fragment shader wants origin in lower-left */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) /* the driver supports lower-left origin */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) /* the driver supports upper-left origin, need to invert Y */ invert = TRUE; @@ -4744,7 +4746,8 @@ emit_wpos(struct st_context *st, if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer */ adjY[1] = 1.0f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER)) { /* the driver supports pixel center half integer, need to bias X,Y */ @@ -4763,7 +4766,8 @@ emit_wpos(struct st_context *st, else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer, need to bias X,Y */ adjX = adjY[0] = adjY[1] = 0.5f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else assert(0); diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 26a5f51c77c..2c9d9a523f4 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -891,7 +891,8 @@ emit_wpos(struct st_context *st, } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) { /* the driver supports lower-left origin, need to invert Y */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); invert = TRUE; } else @@ -901,7 +902,8 @@ emit_wpos(struct st_context *st, /* Fragment shader wants origin in lower-left */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) /* the driver supports lower-left origin */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) /* the driver supports upper-left origin, need to invert Y */ invert = TRUE; @@ -914,7 +916,8 @@ emit_wpos(struct st_context *st, if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer */ adjY[1] = 1.0f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER)) { /* the driver supports pixel center half integer, need to bias X,Y */ @@ -933,7 +936,8 @@ emit_wpos(struct st_context *st, else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer, need to bias X,Y */ adjX = adjY[0] = adjY[1] = 0.5f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else assert(0); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 926086bf898..737c2694e7f 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -742,21 +742,25 @@ st_translate_fragment_program(struct st_context *st, debug_printf("\n"); } if (write_all == GL_TRUE) - ureg_property_fs_color0_writes_all_cbufs(ureg, 1); + ureg_property(ureg, TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS, 1); if (stfp->Base.FragDepthLayout != FRAG_DEPTH_LAYOUT_NONE) { switch (stfp->Base.FragDepthLayout) { case FRAG_DEPTH_LAYOUT_ANY: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_ANY); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_ANY); break; case FRAG_DEPTH_LAYOUT_GREATER: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_GREATER); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_GREATER); break; case FRAG_DEPTH_LAYOUT_LESS: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_LESS); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_LESS); break; case FRAG_DEPTH_LAYOUT_UNCHANGED: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_UNCHANGED); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_UNCHANGED); break; default: assert(0); @@ -1122,10 +1126,11 @@ st_translate_geometry_program(struct st_context *st, stgp->tgsi.tokens = NULL; } - ureg_property_gs_input_prim(ureg, stgp->Base.InputType); - ureg_property_gs_output_prim(ureg, stgp->Base.OutputType); - ureg_property_gs_max_vertices(ureg, stgp->Base.VerticesOut); - ureg_property_gs_invocations(ureg, stgp->Base.Invocations); + ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, stgp->Base.InputType); + ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, stgp->Base.OutputType); + ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES, + stgp->Base.VerticesOut); + ureg_property(ureg, TGSI_PROPERTY_GS_INVOCATIONS, stgp->Base.Invocations); if (stgp->glsl_to_tgsi) st_translate_program(st->ctx, -- cgit v1.2.3