draw: use some cast wrappers in draw_pt_fetch_shade_pipeline*.c
authorBrian Paul <brianp@vmware.com>
Mon, 20 Jan 2014 19:01:48 +0000 (11:01 -0800)
committerBrian Paul <brianp@vmware.com>
Mon, 20 Jan 2014 19:01:48 +0000 (11:01 -0800)
Trivial.

src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c

index a21373baa680ef0bb43f4dfa35203ebf7ddc48d4..f518deef27dcee75925f84598d5f598f7deba330 100644 (file)
@@ -53,6 +53,14 @@ struct fetch_pipeline_middle_end {
 };
 
 
+/** cast wrapper */
+static INLINE struct fetch_pipeline_middle_end *
+fetch_pipeline_middle_end(struct draw_pt_middle_end *middle)
+{
+   return (struct fetch_pipeline_middle_end *) middle;
+}
+
+
 /**
  * Prepare/validate middle part of the vertex pipeline.
  * NOTE: if you change this function, also look at the LLVM
@@ -64,8 +72,7 @@ fetch_pipeline_prepare(struct draw_pt_middle_end *middle,
                        unsigned opt,
                        unsigned *max_vertices)
 {
-   struct fetch_pipeline_middle_end *fpme =
-      (struct fetch_pipeline_middle_end *)middle;
+   struct fetch_pipeline_middle_end *fpme = fetch_pipeline_middle_end(middle);
    struct draw_context *draw = fpme->draw;
    struct draw_vertex_shader *vs = draw->vs.vertex_shader;
    struct draw_geometry_shader *gs = draw->gs.geometry_shader;
@@ -224,8 +231,7 @@ fetch_pipeline_generic(struct draw_pt_middle_end *middle,
                        const struct draw_fetch_info *fetch_info,
                        const struct draw_prim_info *in_prim_info)
 {
-   struct fetch_pipeline_middle_end *fpme =
-      (struct fetch_pipeline_middle_end *) middle;
+   struct fetch_pipeline_middle_end *fpme = fetch_pipeline_middle_end(middle);
    struct draw_context *draw = fpme->draw;
    struct draw_vertex_shader *vshader = draw->vs.vertex_shader;
    struct draw_geometry_shader *gshader = draw->gs.geometry_shader;
@@ -361,8 +367,7 @@ fetch_pipeline_run(struct draw_pt_middle_end *middle,
                    unsigned draw_count,
                    unsigned prim_flags)
 {
-   struct fetch_pipeline_middle_end *fpme =
-      (struct fetch_pipeline_middle_end *) middle;
+   struct fetch_pipeline_middle_end *fpme = fetch_pipeline_middle_end(middle);
    struct draw_fetch_info fetch_info;
    struct draw_prim_info prim_info;
 
@@ -390,8 +395,7 @@ fetch_pipeline_linear_run(struct draw_pt_middle_end *middle,
                           unsigned count,
                           unsigned prim_flags)
 {
-   struct fetch_pipeline_middle_end *fpme =
-      (struct fetch_pipeline_middle_end *) middle;
+   struct fetch_pipeline_middle_end *fpme = fetch_pipeline_middle_end(middle);
    struct draw_fetch_info fetch_info;
    struct draw_prim_info prim_info;
 
@@ -422,8 +426,7 @@ fetch_pipeline_linear_run_elts(struct draw_pt_middle_end *middle,
                                unsigned draw_count,
                                unsigned prim_flags )
 {
-   struct fetch_pipeline_middle_end *fpme =
-      (struct fetch_pipeline_middle_end *) middle;
+   struct fetch_pipeline_middle_end *fpme = fetch_pipeline_middle_end(middle);
    struct draw_fetch_info fetch_info;
    struct draw_prim_info prim_info;
 
@@ -457,8 +460,7 @@ fetch_pipeline_finish( struct draw_pt_middle_end *middle )
 static void
 fetch_pipeline_destroy( struct draw_pt_middle_end *middle )
 {
-   struct fetch_pipeline_middle_end *fpme =
-      (struct fetch_pipeline_middle_end *) middle;
+   struct fetch_pipeline_middle_end *fpme = fetch_pipeline_middle_end(middle);
 
    if (fpme->fetch)
       draw_pt_fetch_destroy( fpme->fetch );
index 21a8e4435052ab83f398aecb048d9d9f06b0f757..481553a78a4cefa0268d08dc2ec2be8155b4420b 100644 (file)
@@ -59,6 +59,14 @@ struct llvm_middle_end {
 };
 
 
+/** cast wrapper */
+static INLINE struct llvm_middle_end *
+llvm_middle_end(struct draw_pt_middle_end *middle)
+{
+   return (struct llvm_middle_end *) middle;
+}
+
+
 static void
 llvm_middle_end_prepare_gs(struct llvm_middle_end *fpme)
 {
@@ -135,7 +143,7 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
                          unsigned opt,
                          unsigned *max_vertices )
 {
-   struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle;
+   struct llvm_middle_end *fpme = llvm_middle_end(middle);
    struct draw_context *draw = fpme->draw;
    struct draw_vertex_shader *vs = draw->vs.vertex_shader;
    struct draw_geometry_shader *gs = draw->gs.geometry_shader;
@@ -276,7 +284,7 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
 static void
 llvm_middle_end_bind_parameters(struct draw_pt_middle_end *middle)
 {
-   struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle;
+   struct llvm_middle_end *fpme = llvm_middle_end(middle);
    struct draw_context *draw = fpme->draw;
    unsigned i;
 
@@ -338,7 +346,7 @@ llvm_pipeline_generic(struct draw_pt_middle_end *middle,
                       const struct draw_fetch_info *fetch_info,
                       const struct draw_prim_info *in_prim_info)
 {
-   struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle;
+   struct llvm_middle_end *fpme = llvm_middle_end(middle);
    struct draw_context *draw = fpme->draw;
    struct draw_geometry_shader *gshader = draw->gs.geometry_shader;
    struct draw_prim_info gs_prim_info;
@@ -475,7 +483,7 @@ llvm_middle_end_run(struct draw_pt_middle_end *middle,
                     unsigned draw_count,
                     unsigned prim_flags)
 {
-   struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle;
+   struct llvm_middle_end *fpme = llvm_middle_end(middle);
    struct draw_fetch_info fetch_info;
    struct draw_prim_info prim_info;
 
@@ -503,7 +511,7 @@ llvm_middle_end_linear_run(struct draw_pt_middle_end *middle,
                            unsigned count,
                            unsigned prim_flags)
 {
-   struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle;
+   struct llvm_middle_end *fpme = llvm_middle_end(middle);
    struct draw_fetch_info fetch_info;
    struct draw_prim_info prim_info;
 
@@ -533,7 +541,7 @@ llvm_middle_end_linear_run_elts(struct draw_pt_middle_end *middle,
                                 unsigned draw_count,
                                 unsigned prim_flags)
 {
-   struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle;
+   struct llvm_middle_end *fpme = llvm_middle_end(middle);
    struct draw_fetch_info fetch_info;
    struct draw_prim_info prim_info;
 
@@ -567,7 +575,7 @@ llvm_middle_end_finish(struct draw_pt_middle_end *middle)
 static void
 llvm_middle_end_destroy(struct draw_pt_middle_end *middle)
 {
-   struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle;
+   struct llvm_middle_end *fpme = llvm_middle_end(middle);
 
    if (fpme->fetch)
       draw_pt_fetch_destroy( fpme->fetch );