i965: Consolidate BRW_NEW_TESS_{CTRL,EVAL}_PROGRAM flags.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 18 Dec 2015 05:02:40 +0000 (21:02 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 23 Dec 2015 01:22:00 +0000 (17:22 -0800)
For several reasons, I don't think it's particularly useful to have
separate flags:

1. Most of the time, tessellation shaders are paired, so both will be
   replaced at the same time.

2. The data layout is tightly coupled.  Both need to agree on the number
   of per-patch slots in the VUE map.  Even adding extra TCS outputs
   that aren't read by the TES will trigger the need for recompiles.

3. The TCS is optional from an API perspective, but required by the
   hardware whenever tessellation is enabled.  So, atoms that deal with
   the TCS must check brw->tess_eval_program (BRW_NEW_TESS_EVAL_PROGRAM?)
   rather than brw->tess_ctrl_program to tell whether tessellation is
   enabled.

So, not only is it unlikely to be useful, it's a bit confusing to get
right.  Simply using one flag for both simplifies this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
14 files changed:
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_sampler_state.c
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/brw_tcs.c
src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
src/mesa/drivers/dri/i965/brw_tes.c
src/mesa/drivers/dri/i965/brw_tes_surface_state.c
src/mesa/drivers/dri/i965/brw_wm_surface_state.c
src/mesa/drivers/dri/i965/gen7_ds_state.c
src/mesa/drivers/dri/i965/gen7_hs_state.c
src/mesa/drivers/dri/i965/gen7_te_state.c
src/mesa/drivers/dri/i965/gen7_urb.c
src/mesa/drivers/dri/i965/gen8_ds_state.c
src/mesa/drivers/dri/i965/gen8_hs_state.c

index 1d989f351bfa25d4b5d9f52548f3699287e4ece0..d249beaaae1cb3cce360f575adcb92bdb25c33b7 100644 (file)
@@ -179,8 +179,7 @@ enum brw_state_id {
    BRW_STATE_URB_FENCE = BRW_MAX_CACHE,
    BRW_STATE_FRAGMENT_PROGRAM,
    BRW_STATE_GEOMETRY_PROGRAM,
-   BRW_STATE_TESS_CTRL_PROGRAM,
-   BRW_STATE_TESS_EVAL_PROGRAM,
+   BRW_STATE_TESS_PROGRAMS,
    BRW_STATE_VERTEX_PROGRAM,
    BRW_STATE_CURBE_OFFSETS,
    BRW_STATE_REDUCED_PRIMITIVE,
@@ -262,8 +261,7 @@ enum brw_state_id {
 #define BRW_NEW_URB_FENCE               (1ull << BRW_STATE_URB_FENCE)
 #define BRW_NEW_FRAGMENT_PROGRAM        (1ull << BRW_STATE_FRAGMENT_PROGRAM)
 #define BRW_NEW_GEOMETRY_PROGRAM        (1ull << BRW_STATE_GEOMETRY_PROGRAM)
-#define BRW_NEW_TESS_EVAL_PROGRAM       (1ull << BRW_STATE_TESS_EVAL_PROGRAM)
-#define BRW_NEW_TESS_CTRL_PROGRAM       (1ull << BRW_STATE_TESS_CTRL_PROGRAM)
+#define BRW_NEW_TESS_PROGRAMS           (1ull << BRW_STATE_TESS_PROGRAMS)
 #define BRW_NEW_VERTEX_PROGRAM          (1ull << BRW_STATE_VERTEX_PROGRAM)
 #define BRW_NEW_CURBE_OFFSETS           (1ull << BRW_STATE_CURBE_OFFSETS)
 #define BRW_NEW_REDUCED_PRIMITIVE       (1ull << BRW_STATE_REDUCED_PRIMITIVE)
index 3f29e2fc105fdd4800377576f57f4de87da2e207..d181468f5cba31d63d1129b6b90520af52ff425f 100644 (file)
@@ -654,7 +654,7 @@ const struct brw_tracked_state brw_gs_samplers = {
 static void
 brw_upload_tcs_samplers(struct brw_context *brw)
 {
-   /* BRW_NEW_TESS_CTRL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct gl_program *tcs = (struct gl_program *) brw->tess_ctrl_program;
    if (!tcs)
       return;
@@ -667,7 +667,7 @@ const struct brw_tracked_state brw_tcs_samplers = {
    .dirty = {
       .mesa = _NEW_TEXTURE,
       .brw = BRW_NEW_BATCH |
-             BRW_NEW_TESS_CTRL_PROGRAM,
+             BRW_NEW_TESS_PROGRAMS,
    },
    .emit = brw_upload_tcs_samplers,
 };
@@ -676,7 +676,7 @@ const struct brw_tracked_state brw_tcs_samplers = {
 static void
 brw_upload_tes_samplers(struct brw_context *brw)
 {
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct gl_program *tes = (struct gl_program *) brw->tess_eval_program;
    if (!tes)
       return;
@@ -689,7 +689,7 @@ const struct brw_tracked_state brw_tes_samplers = {
    .dirty = {
       .mesa = _NEW_TEXTURE,
       .brw = BRW_NEW_BATCH |
-             BRW_NEW_TESS_EVAL_PROGRAM,
+             BRW_NEW_TESS_PROGRAMS,
    },
    .emit = brw_upload_tes_samplers,
 };
index af9fb5b8a63c0db66108cf8a02f984ff106c9443..ac64c8c7a9903a3c4965b4cd9e7fd41c55854c32 100644 (file)
@@ -607,8 +607,7 @@ static struct dirty_bit_map brw_bits[] = {
    DEFINE_BIT(BRW_NEW_URB_FENCE),
    DEFINE_BIT(BRW_NEW_FRAGMENT_PROGRAM),
    DEFINE_BIT(BRW_NEW_GEOMETRY_PROGRAM),
-   DEFINE_BIT(BRW_NEW_TESS_EVAL_PROGRAM),
-   DEFINE_BIT(BRW_NEW_TESS_CTRL_PROGRAM),
+   DEFINE_BIT(BRW_NEW_TESS_PROGRAMS),
    DEFINE_BIT(BRW_NEW_VERTEX_PROGRAM),
    DEFINE_BIT(BRW_NEW_CURBE_OFFSETS),
    DEFINE_BIT(BRW_NEW_REDUCED_PRIMITIVE),
@@ -761,12 +760,12 @@ brw_upload_pipeline_state(struct brw_context *brw,
 
       if (brw->tess_eval_program != ctx->TessEvalProgram._Current) {
          brw->tess_eval_program = ctx->TessEvalProgram._Current;
-         brw->ctx.NewDriverState |= BRW_NEW_TESS_EVAL_PROGRAM;
+         brw->ctx.NewDriverState |= BRW_NEW_TESS_PROGRAMS;
       }
 
       if (brw->tess_ctrl_program != ctx->TessCtrlProgram._Current) {
          brw->tess_ctrl_program = ctx->TessCtrlProgram._Current;
-         brw->ctx.NewDriverState |= BRW_NEW_TESS_CTRL_PROGRAM;
+         brw->ctx.NewDriverState |= BRW_NEW_TESS_PROGRAMS;
       }
 
       if (brw->geometry_program != ctx->GeometryProgram._Current) {
index 037a2da76818ebf7ce4545d616be8a813d9fe33f..aa0e87a7ddaa41180da3d87be33a5ac950f9c318 100644 (file)
@@ -184,10 +184,9 @@ brw_upload_tcs_prog(struct brw_context *brw)
    struct gl_shader_program **current = ctx->_Shader->CurrentProgram;
    struct brw_stage_state *stage_state = &brw->tcs.base;
    struct brw_tcs_prog_key key;
-   /* BRW_NEW_TESS_CTRL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct brw_tess_ctrl_program *tcp =
       (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
    struct brw_tess_eval_program *tep =
       (struct brw_tess_eval_program *) brw->tess_eval_program;
    assert(tcp && tep);
@@ -195,8 +194,7 @@ brw_upload_tcs_prog(struct brw_context *brw)
    if (!brw_state_dirty(brw,
                         _NEW_TEXTURE,
                         BRW_NEW_PATCH_PRIMITIVE |
-                        BRW_NEW_TESS_CTRL_PROGRAM |
-                        BRW_NEW_TESS_EVAL_PROGRAM))
+                        BRW_NEW_TESS_PROGRAMS))
       return;
 
    struct gl_program *prog = &tcp->program.Base;
index 115c5abd3915f93fbf0c3698c37f529516420998..28cef3ca589f9544ae827d10579d900627c2b3db 100644 (file)
@@ -39,7 +39,7 @@ brw_upload_tcs_pull_constants(struct brw_context *brw)
 {
    struct brw_stage_state *stage_state = &brw->tcs.base;
 
-   /* BRW_NEW_TESS_CTRL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct brw_tess_ctrl_program *tcp =
       (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
 
@@ -59,7 +59,7 @@ const struct brw_tracked_state brw_tcs_pull_constants = {
       .mesa = _NEW_PROGRAM_CONSTANTS,
       .brw = BRW_NEW_BATCH |
              BRW_NEW_TCS_PROG_DATA |
-             BRW_NEW_TESS_CTRL_PROGRAM,
+             BRW_NEW_TESS_PROGRAMS,
    },
    .emit = brw_upload_tcs_pull_constants,
 };
@@ -122,7 +122,7 @@ static void
 brw_upload_tcs_image_surfaces(struct brw_context *brw)
 {
    struct gl_context *ctx = &brw->ctx;
-   /* BRW_NEW_TESS_CTRL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct gl_shader_program *prog =
       ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
 
@@ -138,7 +138,7 @@ const struct brw_tracked_state brw_tcs_image_surfaces = {
       .brw = BRW_NEW_BATCH |
              BRW_NEW_TCS_PROG_DATA |
              BRW_NEW_IMAGE_UNITS |
-             BRW_NEW_TESS_CTRL_PROGRAM,
+             BRW_NEW_TESS_PROGRAMS,
    },
    .emit = brw_upload_tcs_image_surfaces,
 };
index 4b2bf8cdcdd6b419268bbe67f80406de65221f10..844c5b28b33cfe685256ffd07d1634558ce771ae 100644 (file)
@@ -232,13 +232,13 @@ brw_upload_tes_prog(struct brw_context *brw)
    struct gl_shader_program **current = ctx->_Shader->CurrentProgram;
    struct brw_stage_state *stage_state = &brw->tes.base;
    struct brw_tes_prog_key key;
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct brw_tess_eval_program *tep =
       (struct brw_tess_eval_program *) brw->tess_eval_program;
 
    if (!brw_state_dirty(brw,
                         _NEW_TEXTURE,
-                        BRW_NEW_TESS_EVAL_PROGRAM))
+                        BRW_NEW_TESS_PROGRAMS))
       return;
 
    struct gl_program *prog = &tep->program.Base;
index 142bd5a3109fa2cf3f531d1957498f66c850b05c..eff1740c12fc453a639080900b019503e5c66abe 100644 (file)
@@ -39,7 +39,7 @@ brw_upload_tes_pull_constants(struct brw_context *brw)
 {
    struct brw_stage_state *stage_state = &brw->tes.base;
 
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct brw_tess_eval_program *dp =
       (struct brw_tess_eval_program *) brw->tess_eval_program;
 
@@ -59,7 +59,7 @@ const struct brw_tracked_state brw_tes_pull_constants = {
       .mesa = _NEW_PROGRAM_CONSTANTS,
       .brw = BRW_NEW_BATCH |
              BRW_NEW_TES_PROG_DATA |
-             BRW_NEW_TESS_EVAL_PROGRAM,
+             BRW_NEW_TESS_PROGRAMS,
    },
    .emit = brw_upload_tes_pull_constants,
 };
@@ -122,7 +122,7 @@ static void
 brw_upload_tes_image_surfaces(struct brw_context *brw)
 {
    struct gl_context *ctx = &brw->ctx;
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct gl_shader_program *prog =
       ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
 
@@ -137,7 +137,7 @@ const struct brw_tracked_state brw_tes_image_surfaces = {
    .dirty = {
       .brw = BRW_NEW_BATCH |
              BRW_NEW_IMAGE_UNITS |
-             BRW_NEW_TESS_EVAL_PROGRAM |
+             BRW_NEW_TESS_PROGRAMS |
              BRW_NEW_TES_PROG_DATA,
    },
    .emit = brw_upload_tes_image_surfaces,
index c4ebbf3b48c7a0bd47deb0fe3b8980c7dfe692d5..76dc577512163c664c626a7e3754b11df84e954a 100644 (file)
@@ -862,10 +862,8 @@ brw_update_texture_surfaces(struct brw_context *brw)
    /* BRW_NEW_VERTEX_PROGRAM */
    struct gl_program *vs = (struct gl_program *) brw->vertex_program;
 
-   /* BRW_NEW_TESS_CTRL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    struct gl_program *tcs = (struct gl_program *) brw->tess_ctrl_program;
-
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
    struct gl_program *tes = (struct gl_program *) brw->tess_eval_program;
 
    /* BRW_NEW_GEOMETRY_PROGRAM */
@@ -915,8 +913,7 @@ const struct brw_tracked_state brw_texture_surfaces = {
              BRW_NEW_FS_PROG_DATA |
              BRW_NEW_GEOMETRY_PROGRAM |
              BRW_NEW_GS_PROG_DATA |
-             BRW_NEW_TESS_CTRL_PROGRAM |
-             BRW_NEW_TESS_EVAL_PROGRAM |
+             BRW_NEW_TESS_PROGRAMS |
              BRW_NEW_TCS_PROG_DATA |
              BRW_NEW_TES_PROG_DATA |
              BRW_NEW_TEXTURE_BUFFER |
index 4d3d94f68a68f2ba5802b9be33f73d3a5ac9ac06..9a697140386882985f53f365837d721601ddc3eb 100644 (file)
@@ -30,7 +30,7 @@ static void
 gen7_upload_tes_push_constants(struct brw_context *brw)
 {
    struct brw_stage_state *stage_state = &brw->tes.base;
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    const struct brw_tess_eval_program *tep =
       (struct brw_tess_eval_program *) brw->tess_eval_program;
 
@@ -49,7 +49,7 @@ const struct brw_tracked_state gen7_tes_push_constants = {
       .mesa  = _NEW_PROGRAM_CONSTANTS,
       .brw   = BRW_NEW_BATCH |
                BRW_NEW_PUSH_CONSTANT_ALLOCATION |
-               BRW_NEW_TESS_EVAL_PROGRAM |
+               BRW_NEW_TESS_PROGRAMS |
                BRW_NEW_TES_PROG_DATA,
    },
    .emit = gen7_upload_tes_push_constants,
index fcaa919785758cbebfe52079c7b48db7d4660295..97eb8d41e18d82103fb224e88ef63a880859e265 100644 (file)
@@ -30,7 +30,7 @@ static void
 gen7_upload_tcs_push_constants(struct brw_context *brw)
 {
    struct brw_stage_state *stage_state = &brw->tcs.base;
-   /* BRW_NEW_TESS_CTRL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    const struct brw_tess_ctrl_program *tcp =
       (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
 
@@ -49,7 +49,7 @@ const struct brw_tracked_state gen7_tcs_push_constants = {
       .mesa  = _NEW_PROGRAM_CONSTANTS,
       .brw   = BRW_NEW_BATCH |
                BRW_NEW_PUSH_CONSTANT_ALLOCATION |
-               BRW_NEW_TESS_CTRL_PROGRAM |
+               BRW_NEW_TESS_PROGRAMS |
                BRW_NEW_TCS_PROG_DATA,
    },
    .emit = gen7_upload_tcs_push_constants,
index 2650fa562ec755b90bb03c6118c6338e1b864790..6d7ce40de51d23cff77601e513650faac70e0926 100644 (file)
@@ -29,7 +29,7 @@
 static void
 upload_te_state(struct brw_context *brw)
 {
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    bool active = brw->tess_eval_program;
    if (active)
       assert(brw->tess_ctrl_program);
@@ -61,7 +61,7 @@ const struct brw_tracked_state gen7_te_state = {
       .mesa  = 0,
       .brw   = BRW_NEW_CONTEXT |
                BRW_NEW_TES_PROG_DATA |
-               BRW_NEW_TESS_EVAL_PROGRAM,
+               BRW_NEW_TESS_PROGRAMS,
    },
    .emit = upload_te_state,
 };
index f2b6ec3de058ca4adb5a3e560bc9a3f81f99e513..bc24a66959cd6f11ebc6995abab5ebae74fc3af1 100644 (file)
@@ -63,7 +63,7 @@ gen7_allocate_push_constants(struct brw_context *brw)
    /* BRW_NEW_GEOMETRY_PROGRAM */
    bool gs_present = brw->geometry_program;
 
-   /* BRW_NEW_TESS_CTRL_PROGRAM, BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    bool tess_present = brw->tess_eval_program;
 
    unsigned avail_size = 16;
@@ -146,8 +146,7 @@ const struct brw_tracked_state gen7_push_constant_space = {
       .mesa = 0,
       .brw = BRW_NEW_CONTEXT |
              BRW_NEW_GEOMETRY_PROGRAM |
-             BRW_NEW_TESS_CTRL_PROGRAM |
-             BRW_NEW_TESS_EVAL_PROGRAM,
+             BRW_NEW_TESS_PROGRAMS,
    },
    .emit = gen7_allocate_push_constants,
 };
@@ -167,7 +166,7 @@ gen7_upload_urb(struct brw_context *brw)
    unsigned gs_size = gs_present ? brw->gs.prog_data->base.urb_entry_size : 1;
    unsigned gs_entry_size_bytes = gs_size * 64;
 
-   /* BRW_NEW_TESS_CTRL_PROGRAM, BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    const bool tess_present = brw->tess_eval_program;
    assert(!tess_present || brw->tess_ctrl_program);
    /* BRW_NEW_TCS_PROG_DATA */
@@ -422,8 +421,7 @@ const struct brw_tracked_state gen7_urb = {
       .brw = BRW_NEW_CONTEXT |
              BRW_NEW_URB_SIZE |
              BRW_NEW_GEOMETRY_PROGRAM |
-             BRW_NEW_TESS_CTRL_PROGRAM |
-             BRW_NEW_TESS_EVAL_PROGRAM |
+             BRW_NEW_TESS_PROGRAMS |
              BRW_NEW_GS_PROG_DATA |
              BRW_NEW_TCS_PROG_DATA |
              BRW_NEW_TES_PROG_DATA |
index a79e8aa020e0f3b86fab024afa3ffd1a5b201218..55558006752f82eab52191542b3f291266b1f332 100644 (file)
@@ -31,7 +31,7 @@ gen8_upload_ds_state(struct brw_context *brw)
 {
    struct gl_context *ctx = &brw->ctx;
    const struct brw_stage_state *stage_state = &brw->tes.base;
-   /* BRW_NEW_TESS_EVAL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    bool active = brw->tess_eval_program;
    assert(!active || brw->tess_ctrl_program);
 
@@ -92,7 +92,7 @@ const struct brw_tracked_state gen8_ds_state = {
    .dirty = {
       .mesa  = 0,
       .brw   = BRW_NEW_BATCH |
-               BRW_NEW_TESS_EVAL_PROGRAM |
+               BRW_NEW_TESS_PROGRAMS |
                BRW_NEW_TES_PROG_DATA,
    },
    .emit = gen8_upload_ds_state,
index 38e22359ffbaba6c9d82cf3384204c014eb4cdde..1277420050292a27dd7e12fab7f29325b8e6031d 100644 (file)
@@ -30,7 +30,7 @@ static void
 gen8_upload_hs_state(struct brw_context *brw)
 {
    const struct brw_stage_state *stage_state = &brw->tcs.base;
-   /* BRW_NEW_TESS_CTRL_PROGRAM */
+   /* BRW_NEW_TESS_PROGRAMS */
    bool active = brw->tess_ctrl_program;
    assert(!active || brw->tess_eval_program);
    /* BRW_NEW_HS_PROG_DATA */
@@ -84,7 +84,7 @@ const struct brw_tracked_state gen8_hs_state = {
       .mesa  = 0,
       .brw   = BRW_NEW_BATCH |
                BRW_NEW_TCS_PROG_DATA |
-               BRW_NEW_TESS_CTRL_PROGRAM,
+               BRW_NEW_TESS_PROGRAMS,
    },
    .emit = gen8_upload_hs_state,
 };