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

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


---
 src/mesa/drivers/dri/i965/brw_context.h          | 21 +--------------------
 src/mesa/drivers/dri/i965/brw_program.c          | 10 +++++-----
 src/mesa/drivers/dri/i965/brw_wm.c               | 10 ++++------
 src/mesa/drivers/dri/i965/brw_wm.h               |  2 +-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |  3 +--
 src/mesa/drivers/dri/i965/gen6_wm_state.c        |  3 +--
 6 files changed, 13 insertions(+), 36 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 0baab30..eb9379e 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -334,15 +334,8 @@ struct brw_program {
 };
 
 
-/** Subclass of Mesa fragment program */
-struct brw_fragment_program {
-   struct gl_program program;
-   GLuint id;  /**< serial no. to identify frag progs, never re-used */
-};
-
-
 struct gen5_fragment_program {
-   struct brw_fragment_program base;
+   struct brw_program base;
 
    bool contains_flat_varying;
    bool contains_noperspective_varying;
@@ -1690,18 +1683,6 @@ brw_program_const(const struct gl_program *p)
    return (const struct brw_program *) p;
 }
 
-static inline struct brw_fragment_program *
-brw_fragment_program(struct gl_program *p)
-{
-   return (struct brw_fragment_program *) p;
-}
-
-static inline const struct brw_fragment_program *
-brw_fragment_program_const(const struct gl_program *p)
-{
-   return (const struct brw_fragment_program *) p;
-}
-
 static inline struct brw_compute_program *
 brw_compute_program(struct gl_program *p)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index cf0b3a2..603b0b6 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -145,13 +145,13 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
    }
 
    case GL_FRAGMENT_PROGRAM_ARB: {
-      struct brw_fragment_program *prog;
+      struct brw_program *prog;
       if (brw->gen < 6) {
          struct gen5_fragment_program *g5_prog =
             CALLOC_STRUCT(gen5_fragment_program);
          prog = &g5_prog->base;
       } else {
-         prog = CALLOC_STRUCT(brw_fragment_program);
+         prog = CALLOC_STRUCT(brw_program);
       }
 
       if (prog) {
@@ -196,9 +196,9 @@ brwProgramStringNotify(struct gl_context *ctx,
 
    switch (target) {
    case GL_FRAGMENT_PROGRAM_ARB: {
-      struct brw_fragment_program *newFP = brw_fragment_program(prog);
-      const struct brw_fragment_program *curFP =
-         brw_fragment_program_const(brw->fragment_program);
+      struct brw_program *newFP = brw_program(prog);
+      const struct brw_program *curFP =
+         brw_program_const(brw->fragment_program);
 
       if (newFP == curFP)
 	 brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 851ba10..f433ed6 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -76,7 +76,7 @@ assign_fs_binding_table_offsets(const struct gen_device_info *devinfo,
 bool
 brw_codegen_wm_prog(struct brw_context *brw,
                     struct gl_shader_program *prog,
-                    struct brw_fragment_program *fp,
+                    struct brw_program *fp,
                     struct brw_wm_prog_key *key,
                     struct brw_vue_map *vue_map)
 {
@@ -438,8 +438,7 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key)
 {
    struct gl_context *ctx = &brw->ctx;
    /* BRW_NEW_FRAGMENT_PROGRAM */
-   const struct brw_fragment_program *fp =
-      (struct brw_fragment_program *) brw->fragment_program;
+   const struct brw_program *fp = brw_program_const(brw->fragment_program);
    const struct gl_program *prog = (struct gl_program *) brw->fragment_program;
    GLuint lookup = 0;
    GLuint line_aa;
@@ -574,8 +573,7 @@ brw_upload_wm_prog(struct brw_context *brw)
    struct gl_context *ctx = &brw->ctx;
    struct gl_shader_program *current = ctx->_Shader->_CurrentFragmentProgram;
    struct brw_wm_prog_key key;
-   struct brw_fragment_program *fp = (struct brw_fragment_program *)
-      brw->fragment_program;
+   struct brw_program *fp = (struct brw_program *) brw->fragment_program;
 
    if (!brw_wm_state_dirty(brw))
       return;
@@ -601,7 +599,7 @@ brw_fs_precompile(struct gl_context *ctx,
    struct brw_context *brw = brw_context(ctx);
    struct brw_wm_prog_key key;
 
-   struct brw_fragment_program *bfp = brw_fragment_program(prog);
+   struct brw_program *bfp = brw_program(prog);
 
    memset(&key, 0, sizeof(key));
 
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index f4f513b..135e98f 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -62,7 +62,7 @@ extern "C" {
 bool brw_color_buffer_write_enabled(struct brw_context *brw);
 bool brw_codegen_wm_prog(struct brw_context *brw,
                          struct gl_shader_program *prog,
-                         struct brw_fragment_program *fp,
+                         struct brw_program *fp,
                          struct brw_wm_prog_key *key,
                          struct brw_vue_map *vue_map);
 void brw_wm_debug_recompile(struct brw_context *brw,
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 667d48c..fcd753c 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -832,8 +832,7 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
 {
    struct brw_stage_state *stage_state = &brw->wm.base;
    /* BRW_NEW_FRAGMENT_PROGRAM */
-   struct brw_fragment_program *fp =
-      (struct brw_fragment_program *) brw->fragment_program;
+   struct brw_program *fp = (struct brw_program *) brw->fragment_program;
    /* BRW_NEW_FS_PROG_DATA */
    struct brw_stage_prog_data *prog_data = brw->wm.base.prog_data;
 
diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index bd279ec..a618ea9 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -42,8 +42,7 @@ gen6_upload_wm_push_constants(struct brw_context *brw)
 {
    struct brw_stage_state *stage_state = &brw->wm.base;
    /* BRW_NEW_FRAGMENT_PROGRAM */
-   const struct brw_fragment_program *fp =
-      brw_fragment_program_const(brw->fragment_program);
+   const struct brw_program *fp = brw_program_const(brw->fragment_program);
    /* BRW_NEW_FS_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = brw->wm.base.prog_data;
 
-- 
2.7.4



More information about the mesa-dev mailing list