OSDN Git Service

i965: use new cast wrappers
authorBrian Paul <brianp@vmware.com>
Tue, 10 Mar 2009 21:53:33 +0000 (15:53 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 11 Mar 2009 00:27:48 +0000 (18:27 -0600)
src/mesa/drivers/dri/i965/brw_curbe.c
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_vs_constval.c

index 4bee54f..f90f72c 100644 (file)
@@ -53,7 +53,7 @@ static void calculate_curbe_offsets( struct brw_context *brw )
    GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16;
    
    /* BRW_NEW_VERTEX_PROGRAM */
-   struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program;
+   struct brw_vertex_program *vp = brw_vertex_program(brw->vertex_program);
    GLuint nr_vp_regs = (vp->program.Base.Parameters->NumParameters * 4 + 15) / 16;
    GLuint nr_clip_regs = 0;
    GLuint total_regs;
@@ -174,8 +174,10 @@ static GLfloat fixed_plane[6][4] = {
 static void prepare_constant_buffer(struct brw_context *brw)
 {
    GLcontext *ctx = &brw->intel.ctx;
-   const struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program;
-   const struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program;
+   const struct brw_vertex_program *vp =
+      brw_vertex_program_const(brw->vertex_program);
+   const struct brw_fragment_program *fp =
+      brw_fragment_program_const(brw->fragment_program);
    const GLuint sz = brw->curbe.total_size;
    const GLuint bufsz = sz * 16 * sizeof(GLfloat);
    GLfloat *buf;
index 2894cce..d90bd82 100644 (file)
@@ -113,8 +113,10 @@ static void brwProgramStringNotify( GLcontext *ctx,
    struct brw_context *brw = brw_context(ctx);
    if (target == GL_FRAGMENT_PROGRAM_ARB) {
       struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
-      struct brw_fragment_program *newFP = (struct brw_fragment_program *) prog;
-      struct brw_fragment_program *curFP = (struct brw_fragment_program *) brw->fragment_program;
+      struct brw_fragment_program *newFP = brw_fragment_program(fprog);
+      const struct brw_fragment_program *curFP =
+         brw_fragment_program_const(brw->fragment_program);
+
       if (fprog->FogOption) {
          _mesa_append_fog_code(ctx, fprog);
          fprog->FogOption = GL_NONE;
@@ -126,8 +128,11 @@ static void brwProgramStringNotify( GLcontext *ctx,
       newFP->isGLSL = brw_wm_is_glsl(fprog);
    }
    else if (target == GL_VERTEX_PROGRAM_ARB) {
-      struct brw_vertex_program *newVP = (struct brw_vertex_program *) prog;
-      struct brw_vertex_program *curVP = (struct brw_vertex_program *) brw->vertex_program;
+      struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;
+      struct brw_vertex_program *newVP = brw_vertex_program(vprog);
+      const struct brw_vertex_program *curVP =
+         brw_vertex_program_const(brw->vertex_program);
+
       if (newVP == curVP)
         brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
       if (newVP->program.IsPositionInvariant) {
index 9977677..d29eb17 100644 (file)
@@ -170,8 +170,8 @@ static void calc_wm_input_sizes( struct brw_context *brw )
 {
    GLcontext *ctx = &brw->intel.ctx;
    /* BRW_NEW_VERTEX_PROGRAM */
-   struct brw_vertex_program *vp = 
-      (struct brw_vertex_program *)brw->vertex_program;
+   const struct brw_vertex_program *vp =
+      brw_vertex_program_const(brw->vertex_program);
    /* BRW_NEW_INPUT_DIMENSIONS */
    struct tracker t;
    GLuint insn;