[Mesa-dev] [PATCH 25/25] i965: replace brw_compute_program with brw_program

Timothy Arceri timothy.arceri at collabora.com
Tue Oct 18 06:12:28 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_context.h   | 13 -------------
 src/mesa/drivers/dri/i965/brw_cs.c        | 10 ++++------
 src/mesa/drivers/dri/i965/brw_program.c   | 14 ++------------
 src/mesa/drivers/dri/i965/gen7_cs_state.c |  6 ++----
 4 files changed, 8 insertions(+), 35 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index eb9379e..2615351 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -348,13 +348,6 @@ struct gen5_fragment_program {
 };
 
 
-/** Subclass of Mesa compute program */
-struct brw_compute_program {
-   struct gl_program program;
-   unsigned id;  /**< serial no. to identify compute progs, never re-used */
-};
-
-
 struct brw_shader {
    struct gl_linked_shader base;
 
@@ -1683,12 +1676,6 @@ brw_program_const(const struct gl_program *p)
    return (const struct brw_program *) p;
 }
 
-static inline struct brw_compute_program *
-brw_compute_program(struct gl_program *p)
-{
-   return (struct brw_compute_program *) p;
-}
-
 /**
  * Pre-gen6, the register file of the EUs was shared between threads,
  * and each thread used some subset allocated on a 16-register block
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
index 799a9b4..d16fff8 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -54,7 +54,7 @@ assign_cs_binding_table_offsets(const struct gen_device_info *devinfo,
 static bool
 brw_codegen_cs_prog(struct brw_context *brw,
                     struct gl_shader_program *prog,
-                    struct brw_compute_program *cp,
+                    struct brw_program *cp,
                     struct brw_cs_prog_key *key)
 {
    const struct gen_device_info *devinfo = &brw->screen->devinfo;
@@ -191,8 +191,7 @@ brw_cs_populate_key(struct brw_context *brw, struct brw_cs_prog_key *key)
 {
    struct gl_context *ctx = &brw->ctx;
    /* BRW_NEW_COMPUTE_PROGRAM */
-   const struct brw_compute_program *cp =
-      (struct brw_compute_program *) brw->compute_program;
+   const struct brw_program *cp = (struct brw_program *) brw->compute_program;
    const struct gl_program *prog = (struct gl_program *) cp;
 
    memset(key, 0, sizeof(*key));
@@ -210,8 +209,7 @@ brw_upload_cs_prog(struct brw_context *brw)
 {
    struct gl_context *ctx = &brw->ctx;
    struct brw_cs_prog_key key;
-   struct brw_compute_program *cp = (struct brw_compute_program *)
-      brw->compute_program;
+   struct brw_program *cp = (struct brw_program *) brw->compute_program;
 
    if (!cp)
       return;
@@ -246,7 +244,7 @@ brw_cs_precompile(struct gl_context *ctx,
    struct brw_context *brw = brw_context(ctx);
    struct brw_cs_prog_key key;
 
-   struct brw_compute_program *bcp = brw_compute_program(prog);
+   struct brw_program *bcp = brw_program(prog);
 
    memset(&key, 0, sizeof(key));
    key.program_string_id = bcp->id;
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 603b0b6..0379d72 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -133,7 +133,8 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
    case GL_VERTEX_PROGRAM_ARB:
    case GL_TESS_CONTROL_PROGRAM_NV:
    case GL_TESS_EVALUATION_PROGRAM_NV:
-   case GL_GEOMETRY_PROGRAM_NV: {
+   case GL_GEOMETRY_PROGRAM_NV:
+   case GL_COMPUTE_PROGRAM_NV: {
       struct brw_program *prog = CALLOC_STRUCT(brw_program);
       if (prog) {
 	 prog->id = get_new_program_id(brw->screen);
@@ -163,17 +164,6 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
 	 return NULL;
    }
 
-   case GL_COMPUTE_PROGRAM_NV: {
-      struct brw_compute_program *prog = CALLOC_STRUCT(brw_compute_program);
-      if (prog) {
-         prog->id = get_new_program_id(brw->screen);
-
-         return _mesa_init_gl_program(&prog->program, target, id);
-      } else {
-         return NULL;
-      }
-   }
-
    default:
       unreachable("Unsupported target in brwNewProgram()");
    }
diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c
index 3533ac9..bae4fd2 100644
--- a/src/mesa/drivers/dri/i965/gen7_cs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c
@@ -280,8 +280,7 @@ gen7_upload_cs_push_constants(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->cs.base;
 
    /* BRW_NEW_COMPUTE_PROGRAM */
-   const struct brw_compute_program *cp =
-      (struct brw_compute_program *) brw->compute_program;
+   const struct brw_program *cp = (struct brw_program *) brw->compute_program;
 
    if (cp) {
       /* BRW_NEW_CS_PROG_DATA */
@@ -316,8 +315,7 @@ brw_upload_cs_pull_constants(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->cs.base;
 
    /* BRW_NEW_COMPUTE_PROGRAM */
-   struct brw_compute_program *cp =
-      (struct brw_compute_program *) brw->compute_program;
+   struct brw_program *cp = (struct brw_program *) brw->compute_program;
 
    /* BRW_NEW_CS_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = brw->cs.base.prog_data;
-- 
2.7.4



More information about the mesa-dev mailing list