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

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


---
 src/mesa/drivers/dri/i965/brw_compiler.h         |  2 +-
 src/mesa/drivers/dri/i965/brw_context.h          | 13 -------------
 src/mesa/drivers/dri/i965/brw_gs.c               | 10 ++++------
 src/mesa/drivers/dri/i965/brw_gs.h               |  2 +-
 src/mesa/drivers/dri/i965/brw_gs_surface_state.c |  3 +--
 src/mesa/drivers/dri/i965/brw_program.c          | 14 ++------------
 src/mesa/drivers/dri/i965/gen6_gs_state.c        |  3 +--
 7 files changed, 10 insertions(+), 37 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index 772c11e..819c7d6 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -34,7 +34,7 @@ extern "C" {
 
 struct ra_regs;
 struct nir_shader;
-struct brw_geometry_program;
+struct brw_program;
 union gl_constant_value;
 
 struct brw_compiler {
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index e6a290e..e3aa5d7 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -348,13 +348,6 @@ struct brw_tess_eval_program {
 };
 
 
-/** Subclass of Mesa geometry program */
-struct brw_geometry_program {
-   struct gl_program program;
-   unsigned id;  /**< serial no. to identify geom progs, never re-used */
-};
-
-
 /** Subclass of Mesa fragment program */
 struct brw_fragment_program {
    struct gl_program program;
@@ -1723,12 +1716,6 @@ brw_tess_eval_program(struct gl_program *p)
    return (struct brw_tess_eval_program *) p;
 }
 
-static inline struct brw_geometry_program *
-brw_geometry_program(struct gl_program *p)
-{
-   return (struct brw_geometry_program *) p;
-}
-
 static inline struct brw_fragment_program *
 brw_fragment_program(struct gl_program *p)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index ee0b8f4..5055c29 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -94,7 +94,7 @@ assign_gs_binding_table_offsets(const struct gen_device_info *devinfo,
 bool
 brw_codegen_gs_prog(struct brw_context *brw,
                     struct gl_shader_program *prog,
-                    struct brw_geometry_program *gp,
+                    struct brw_program *gp,
                     struct brw_gs_prog_key *key)
 {
    struct brw_compiler *compiler = brw->screen->compiler;
@@ -210,8 +210,7 @@ brw_gs_populate_key(struct brw_context *brw,
                     struct brw_gs_prog_key *key)
 {
    struct gl_context *ctx = &brw->ctx;
-   struct brw_geometry_program *gp =
-      (struct brw_geometry_program *) brw->geometry_program;
+   struct brw_program *gp = (struct brw_program *) brw->geometry_program;
 
    memset(key, 0, sizeof(*key));
 
@@ -229,8 +228,7 @@ brw_upload_gs_prog(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->gs.base;
    struct brw_gs_prog_key key;
    /* BRW_NEW_GEOMETRY_PROGRAM */
-   struct brw_geometry_program *gp =
-      (struct brw_geometry_program *) brw->geometry_program;
+   struct brw_program *gp = (struct brw_program *) brw->geometry_program;
 
    if (!brw_gs_state_dirty(brw))
       return;
@@ -275,7 +273,7 @@ brw_gs_precompile(struct gl_context *ctx,
    struct brw_stage_prog_data *old_prog_data = brw->gs.base.prog_data;
    bool success;
 
-   struct brw_geometry_program *bgp = brw_geometry_program(prog);
+   struct brw_program *bgp = brw_program(prog);
 
    memset(&key, 0, sizeof(key));
 
diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h
index 7ccd22e..e1f8c4d 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.h
+++ b/src/mesa/drivers/dri/i965/brw_gs.h
@@ -44,7 +44,7 @@ brw_gs_populate_key(struct brw_context *brw,
 bool
 brw_codegen_gs_prog(struct brw_context *brw,
                     struct gl_shader_program *prog,
-                    struct brw_geometry_program *gp,
+                    struct brw_program *gp,
                     struct brw_gs_prog_key *key);
 
 #ifdef __cplusplus
diff --git a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
index 686ddb4..4d0f50c 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
@@ -41,8 +41,7 @@ brw_upload_gs_pull_constants(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->gs.base;
 
    /* BRW_NEW_GEOMETRY_PROGRAM */
-   struct brw_geometry_program *gp =
-      (struct brw_geometry_program *) brw->geometry_program;
+   struct brw_program *gp = (struct brw_program *) brw->geometry_program;
 
    if (!gp)
       return;
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 9937fac..2829d6f 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -130,7 +130,8 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
    struct brw_context *brw = brw_context(ctx);
 
    switch (target) {
-   case GL_VERTEX_PROGRAM_ARB: {
+   case GL_VERTEX_PROGRAM_ARB:
+   case GL_GEOMETRY_PROGRAM_NV: {
       struct brw_program *prog = CALLOC_STRUCT(brw_program);
       if (prog) {
 	 prog->id = get_new_program_id(brw->screen);
@@ -160,17 +161,6 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
 	 return NULL;
    }
 
-   case GL_GEOMETRY_PROGRAM_NV: {
-      struct brw_geometry_program *prog = CALLOC_STRUCT(brw_geometry_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_CONTROL_PROGRAM_NV: {
       struct brw_tess_ctrl_program *prog = CALLOC_STRUCT(brw_tess_ctrl_program);
       if (prog) {
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c b/src/mesa/drivers/dri/i965/gen6_gs_state.c
index 4923764..a2520d8 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c
@@ -37,8 +37,7 @@ gen6_upload_gs_push_constants(struct brw_context *brw)
    struct brw_stage_state *stage_state = &brw->gs.base;
 
    /* BRW_NEW_GEOMETRY_PROGRAM */
-   const struct brw_geometry_program *gp =
-      (struct brw_geometry_program *) brw->geometry_program;
+   const struct brw_program *gp = brw_program_const(brw->geometry_program);
 
    if (gp) {
       /* BRW_NEW_GS_PROG_DATA */
-- 
2.7.4



More information about the mesa-dev mailing list