i965: replace brw_tess_{eval,ctrl}_program with brw_program
authorTimothy Arceri <timothy.arceri@collabora.com>
Tue, 18 Oct 2016 05:03:32 +0000 (16:03 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Wed, 26 Oct 2016 03:29:36 +0000 (14:29 +1100)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_program.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/gen7_ds_state.c
src/mesa/drivers/dri/i965/gen7_hs_state.c

index 0c887510acd3c7ab23f9af0956a1fb8f8a3d57d3..203c9fef533c47c040fc37c46ec0a99cf69f957d 100644 (file)
@@ -334,20 +334,6 @@ struct brw_program {
 };
 
 
-/** Subclass of Mesa tessellation control program */
-struct brw_tess_ctrl_program {
-   struct gl_program program;
-   unsigned id;  /**< serial no. to identify tess ctrl progs, never re-used */
-};
-
-
-/** Subclass of Mesa tessellation evaluation program */
-struct brw_tess_eval_program {
-   struct gl_program program;
-   unsigned id;  /**< serial no. to identify tess eval progs, never re-used */
-};
-
-
 /** Subclass of Mesa fragment program */
 struct brw_fragment_program {
    struct gl_program program;
@@ -1704,18 +1690,6 @@ brw_program_const(const struct gl_program *p)
    return (const struct brw_program *) p;
 }
 
-static inline struct brw_tess_ctrl_program *
-brw_tess_ctrl_program(struct gl_program *p)
-{
-   return (struct brw_tess_ctrl_program *) p;
-}
-
-static inline struct brw_tess_eval_program *
-brw_tess_eval_program(struct gl_program *p)
-{
-   return (struct brw_tess_eval_program *) p;
-}
-
 static inline struct brw_fragment_program *
 brw_fragment_program(struct gl_program *p)
 {
index cb73f424f33479b20f1331ae1f71c879c10860e8..b7ad962e4ead1213d4f8133e737856a536a5638a 100644 (file)
@@ -131,6 +131,8 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
 
    switch (target) {
    case GL_VERTEX_PROGRAM_ARB:
+   case GL_TESS_CONTROL_PROGRAM_NV:
+   case GL_TESS_EVALUATION_PROGRAM_NV:
    case GL_GEOMETRY_PROGRAM_NV: {
       struct brw_program *prog = CALLOC_STRUCT(brw_program);
       if (prog) {
@@ -161,28 +163,6 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
         return NULL;
    }
 
-   case GL_TESS_CONTROL_PROGRAM_NV: {
-      struct brw_tess_ctrl_program *prog = CALLOC_STRUCT(brw_tess_ctrl_program);
-      if (prog) {
-         prog->id = get_new_program_id(brw->screen);
-
-         return _mesa_init_gl_program(&prog->program, target, id);
-      } else {
-         return NULL;
-      }
-   }
-
-   case GL_TESS_EVALUATION_PROGRAM_NV: {
-      struct brw_tess_eval_program *prog = CALLOC_STRUCT(brw_tess_eval_program);
-      if (prog) {
-         prog->id = get_new_program_id(brw->screen);
-
-         return _mesa_init_gl_program(&prog->program, target, id);
-      } else {
-         return NULL;
-      }
-   }
-
    case GL_COMPUTE_PROGRAM_NV: {
       struct brw_compute_program *prog = CALLOC_STRUCT(brw_compute_program);
       if (prog) {
index 75115074c0c97ec77653c7b7c7cf8053b754b4d3..58d080d28767ec3f31a1a8ceb1e4423ee5b23dec 100644 (file)
@@ -165,7 +165,7 @@ brw_tcs_debug_recompile(struct brw_context *brw,
 static bool
 brw_codegen_tcs_prog(struct brw_context *brw,
                      struct gl_shader_program *shader_prog,
-                     struct brw_tess_ctrl_program *tcp,
+                     struct brw_program *tcp,
                      struct brw_tcs_prog_key *key)
 {
    struct gl_context *ctx = &brw->ctx;
@@ -316,10 +316,8 @@ void
 brw_tcs_populate_key(struct brw_context *brw,
                      struct brw_tcs_prog_key *key)
 {
-   struct brw_tess_ctrl_program *tcp =
-      (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
-   struct brw_tess_eval_program *tep =
-      (struct brw_tess_eval_program *) brw->tess_eval_program;
+   struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+   struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
    struct gl_program *tes_prog = &tep->program;
 
    uint64_t per_vertex_slots = tes_prog->info.inputs_read;
@@ -363,10 +361,9 @@ brw_upload_tcs_prog(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->tcs.base;
    struct brw_tcs_prog_key key;
    /* BRW_NEW_TESS_PROGRAMS */
-   struct brw_tess_ctrl_program *tcp =
-      (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
-   MAYBE_UNUSED struct brw_tess_eval_program *tep =
-      (struct brw_tess_eval_program *) brw->tess_eval_program;
+   struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+   MAYBE_UNUSED struct brw_program *tep =
+      (struct brw_program *) brw->tess_eval_program;
    assert(tep);
 
    if (!brw_state_dirty(brw,
@@ -400,7 +397,7 @@ brw_tcs_precompile(struct gl_context *ctx,
    struct brw_stage_prog_data *old_prog_data = brw->tcs.base.prog_data;
    bool success;
 
-   struct brw_tess_ctrl_program *btcp = brw_tess_ctrl_program(prog);
+   struct brw_program *btcp = brw_program(prog);
    const struct gl_linked_shader *tes =
       shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL];
 
index e91488fb492cedece9bf4a8c85884336951d2600..83b561190bb34b4fdad9dca28dee49b1b94cc26c 100644 (file)
@@ -41,8 +41,7 @@ brw_upload_tcs_pull_constants(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->tcs.base;
 
    /* BRW_NEW_TESS_PROGRAMS */
-   struct brw_tess_ctrl_program *tcp =
-      (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
+   struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
 
    if (!tcp)
       return;
index 3992bb312a870c7e38dd54fe6a10acb778fc163d..6060c765a8fc60890ce3d4cc1452d405ba15f3ee 100644 (file)
@@ -79,7 +79,7 @@ brw_tes_debug_recompile(struct brw_context *brw,
 static bool
 brw_codegen_tes_prog(struct brw_context *brw,
                      struct gl_shader_program *shader_prog,
-                     struct brw_tess_eval_program *tep,
+                     struct brw_program *tep,
                      struct brw_tes_prog_key *key)
 {
    const struct brw_compiler *compiler = brw->screen->compiler;
@@ -233,10 +233,8 @@ void
 brw_tes_populate_key(struct brw_context *brw,
                      struct brw_tes_prog_key *key)
 {
-   struct brw_tess_ctrl_program *tcp =
-      (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
-   struct brw_tess_eval_program *tep =
-      (struct brw_tess_eval_program *) brw->tess_eval_program;
+   struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+   struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
    struct gl_program *prog = &tep->program;
 
    uint64_t per_vertex_slots = prog->info.inputs_read;
@@ -275,8 +273,7 @@ brw_upload_tes_prog(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->tes.base;
    struct brw_tes_prog_key key;
    /* BRW_NEW_TESS_PROGRAMS */
-   struct brw_tess_eval_program *tep =
-      (struct brw_tess_eval_program *) brw->tess_eval_program;
+   struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
 
    if (!brw_state_dirty(brw,
                         _NEW_TEXTURE,
@@ -308,7 +305,7 @@ brw_tes_precompile(struct gl_context *ctx,
    struct brw_stage_prog_data *old_prog_data = brw->tes.base.prog_data;
    bool success;
 
-   struct brw_tess_eval_program *btep = brw_tess_eval_program(prog);
+   struct brw_program *btep = brw_program(prog);
 
    memset(&key, 0, sizeof(key));
 
index 2a7d48a591d3d2c61ff4632c7e7a57b86ad019ba..53b39cd29e76ce740a6192b46217d14d82dc2eb5 100644 (file)
@@ -41,8 +41,7 @@ brw_upload_tes_pull_constants(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->tes.base;
 
    /* BRW_NEW_TESS_PROGRAMS */
-   struct brw_tess_eval_program *dp =
-      (struct brw_tess_eval_program *) brw->tess_eval_program;
+   struct brw_program *dp = (struct brw_program *) brw->tess_eval_program;
 
    if (!dp)
       return;
index 23e03d7e2af16abe2fa53d3b847362d5beaf680a..9d7f5315de4d860b56e341ca9ba0ed465b847602 100644 (file)
@@ -32,8 +32,7 @@ gen7_upload_tes_push_constants(struct brw_context *brw)
 {
    struct brw_stage_state *stage_state = &brw->tes.base;
    /* BRW_NEW_TESS_PROGRAMS */
-   const struct brw_tess_eval_program *tep =
-      (struct brw_tess_eval_program *) brw->tess_eval_program;
+   const struct brw_program *tep = brw_program_const(brw->tess_eval_program);
 
    if (tep) {
       /* BRW_NEW_TES_PROG_DATA */
index 290aea2392470a0fb84cf6c408daec4b0971b301..fadea2351dabb8feeeda788557b41d8a5909185d 100644 (file)
@@ -32,8 +32,7 @@ gen7_upload_tcs_push_constants(struct brw_context *brw)
 {
    struct brw_stage_state *stage_state = &brw->tcs.base;
    /* BRW_NEW_TESS_PROGRAMS */
-   const struct brw_tess_ctrl_program *tcp =
-      (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
+   const struct brw_program *tcp = brw_program_const(brw->tess_ctrl_program);
    bool active = brw->tess_eval_program;
 
    if (active) {