i965: Remove brw->attribs now that we can just always look in the GLcontext.
authorEric Anholt <eric@anholt.net>
Fri, 30 Jan 2009 22:32:23 +0000 (14:32 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 2 Feb 2009 23:34:10 +0000 (15:34 -0800)
19 files changed:
src/mesa/drivers/dri/i965/brw_cc.c
src/mesa/drivers/dri/i965/brw_clip.c
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_curbe.c
src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/i965/brw_fallback.c
src/mesa/drivers/dri/i965/brw_misc_state.c
src/mesa/drivers/dri/i965/brw_sf.c
src/mesa/drivers/dri/i965/brw_sf_state.c
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/brw_tex.c
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_vs_constval.c
src/mesa/drivers/dri/i965/brw_vs_state.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
src/mesa/drivers/dri/i965/brw_wm_state.c
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index abae4b321525256bf27a85eba16103cb02324fef..82370162f595756b63ecbae50f735b67b8e93654 100644 (file)
@@ -83,60 +83,60 @@ struct brw_cc_unit_key {
 static void
 cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key)
 {
-   struct gl_stencil_attrib *stencil = brw->attribs.Stencil;
-   const unsigned back = stencil->_BackFace;
+   GLcontext *ctx = &brw->intel.ctx;
+   const unsigned back = ctx->Stencil._BackFace;
 
    memset(key, 0, sizeof(*key));
 
-   key->stencil = stencil->Enabled;
-   key->stencil_two_side = stencil->_TestTwoSide;
+   key->stencil = ctx->Stencil.Enabled;
+   key->stencil_two_side = ctx->Stencil._TestTwoSide;
 
    if (key->stencil) {
-      key->stencil_func[0] = stencil->Function[0];
-      key->stencil_fail_op[0] = stencil->FailFunc[0];
-      key->stencil_pass_depth_fail_op[0] = stencil->ZFailFunc[0];
-      key->stencil_pass_depth_pass_op[0] = stencil->ZPassFunc[0];
-      key->stencil_ref[0] = stencil->Ref[0];
-      key->stencil_write_mask[0] = stencil->WriteMask[0];
-      key->stencil_test_mask[0] = stencil->ValueMask[0];
+      key->stencil_func[0] = ctx->Stencil.Function[0];
+      key->stencil_fail_op[0] = ctx->Stencil.FailFunc[0];
+      key->stencil_pass_depth_fail_op[0] = ctx->Stencil.ZFailFunc[0];
+      key->stencil_pass_depth_pass_op[0] = ctx->Stencil.ZPassFunc[0];
+      key->stencil_ref[0] = ctx->Stencil.Ref[0];
+      key->stencil_write_mask[0] = ctx->Stencil.WriteMask[0];
+      key->stencil_test_mask[0] = ctx->Stencil.ValueMask[0];
    }
    if (key->stencil_two_side) {
-      key->stencil_func[1] = stencil->Function[back];
-      key->stencil_fail_op[1] = stencil->FailFunc[back];
-      key->stencil_pass_depth_fail_op[1] = stencil->ZFailFunc[back];
-      key->stencil_pass_depth_pass_op[1] = stencil->ZPassFunc[back];
-      key->stencil_ref[1] = stencil->Ref[back];
-      key->stencil_write_mask[1] = stencil->WriteMask[back];
-      key->stencil_test_mask[1] = stencil->ValueMask[back];
+      key->stencil_func[1] = ctx->Stencil.Function[back];
+      key->stencil_fail_op[1] = ctx->Stencil.FailFunc[back];
+      key->stencil_pass_depth_fail_op[1] = ctx->Stencil.ZFailFunc[back];
+      key->stencil_pass_depth_pass_op[1] = ctx->Stencil.ZPassFunc[back];
+      key->stencil_ref[1] = ctx->Stencil.Ref[back];
+      key->stencil_write_mask[1] = ctx->Stencil.WriteMask[back];
+      key->stencil_test_mask[1] = ctx->Stencil.ValueMask[back];
    }
 
-   if (brw->attribs.Color->_LogicOpEnabled)
-      key->logic_op = brw->attribs.Color->LogicOp;
+   if (ctx->Color._LogicOpEnabled)
+      key->logic_op = ctx->Color.LogicOp;
    else
       key->logic_op = GL_COPY;
 
-   key->color_blend = brw->attribs.Color->BlendEnabled;
+   key->color_blend = ctx->Color.BlendEnabled;
    if (key->color_blend) {
-      key->blend_eq_rgb = brw->attribs.Color->BlendEquationRGB;
-      key->blend_eq_a = brw->attribs.Color->BlendEquationA;
-      key->blend_src_rgb = brw->attribs.Color->BlendSrcRGB;
-      key->blend_dst_rgb = brw->attribs.Color->BlendDstRGB;
-      key->blend_src_a = brw->attribs.Color->BlendSrcA;
-      key->blend_dst_a = brw->attribs.Color->BlendDstA;
+      key->blend_eq_rgb = ctx->Color.BlendEquationRGB;
+      key->blend_eq_a = ctx->Color.BlendEquationA;
+      key->blend_src_rgb = ctx->Color.BlendSrcRGB;
+      key->blend_dst_rgb = ctx->Color.BlendDstRGB;
+      key->blend_src_a = ctx->Color.BlendSrcA;
+      key->blend_dst_a = ctx->Color.BlendDstA;
    }
 
-   key->alpha_enabled = brw->attribs.Color->AlphaEnabled;
+   key->alpha_enabled = ctx->Color.AlphaEnabled;
    if (key->alpha_enabled) {
-      key->alpha_func = brw->attribs.Color->AlphaFunc;
-      key->alpha_ref = brw->attribs.Color->AlphaRef;
+      key->alpha_func = ctx->Color.AlphaFunc;
+      key->alpha_ref = ctx->Color.AlphaRef;
    }
 
-   key->dither = brw->attribs.Color->DitherFlag;
+   key->dither = ctx->Color.DitherFlag;
 
-   key->depth_test = brw->attribs.Depth->Test;
+   key->depth_test = ctx->Depth.Test;
    if (key->depth_test) {
-      key->depth_func = brw->attribs.Depth->Func;
-      key->depth_write = brw->attribs.Depth->Mask;
+      key->depth_func = ctx->Depth.Func;
+      key->depth_write = ctx->Depth.Mask;
    }
 }
 
index 38d8b704d7e616e0ae000175c07303c1cd2fdc56..5cffcebde43de3e10c6c9ca403a4b0b7848bb28e 100644 (file)
@@ -145,14 +145,14 @@ static void upload_clip_prog(struct brw_context *brw)
    /* CACHE_NEW_VS_PROG */
    key.attrs = brw->vs.prog_data->outputs_written;
    /* _NEW_LIGHT */
-   key.do_flat_shading = (brw->attribs.Light->ShadeModel == GL_FLAT);
+   key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT);
    /* _NEW_TRANSFORM */
-   key.nr_userclip = brw_count_bits(brw->attribs.Transform->ClipPlanesEnabled);
+   key.nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
    key.clip_mode = BRW_CLIPMODE_NORMAL;
 
    /* _NEW_POLYGON */
    if (key.primitive == GL_TRIANGLES) {
-      if (brw->attribs.Polygon->CullFaceMode == GL_FRONT_AND_BACK) 
+      if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) 
         key.clip_mode = BRW_CLIPMODE_REJECT_ALL;
       else {
         GLuint fill_front = CLIP_CULL;
@@ -160,44 +160,44 @@ static void upload_clip_prog(struct brw_context *brw)
         GLuint offset_front = 0;
         GLuint offset_back = 0;
 
-        if (!brw->attribs.Polygon->CullFlag ||
-            brw->attribs.Polygon->CullFaceMode != GL_FRONT) {
-           switch (brw->attribs.Polygon->FrontMode) {
+        if (!ctx->Polygon.CullFlag ||
+            ctx->Polygon.CullFaceMode != GL_FRONT) {
+           switch (ctx->Polygon.FrontMode) {
            case GL_FILL: 
               fill_front = CLIP_FILL; 
               offset_front = 0;
               break;
            case GL_LINE:
               fill_front = CLIP_LINE;
-              offset_front = brw->attribs.Polygon->OffsetLine;
+              offset_front = ctx->Polygon.OffsetLine;
               break;
            case GL_POINT:
               fill_front = CLIP_POINT;
-              offset_front = brw->attribs.Polygon->OffsetPoint;
+              offset_front = ctx->Polygon.OffsetPoint;
               break;
            }
         }
 
-        if (!brw->attribs.Polygon->CullFlag ||
-            brw->attribs.Polygon->CullFaceMode != GL_BACK) {
-           switch (brw->attribs.Polygon->BackMode) {
+        if (!ctx->Polygon.CullFlag ||
+            ctx->Polygon.CullFaceMode != GL_BACK) {
+           switch (ctx->Polygon.BackMode) {
            case GL_FILL: 
               fill_back = CLIP_FILL; 
               offset_back = 0;
               break;
            case GL_LINE:
               fill_back = CLIP_LINE;
-              offset_back = brw->attribs.Polygon->OffsetLine;
+              offset_back = ctx->Polygon.OffsetLine;
               break;
            case GL_POINT:
               fill_back = CLIP_POINT;
-              offset_back = brw->attribs.Polygon->OffsetPoint;
+              offset_back = ctx->Polygon.OffsetPoint;
               break;
            }
         }
 
-        if (brw->attribs.Polygon->BackMode != GL_FILL ||
-            brw->attribs.Polygon->FrontMode != GL_FILL) {
+        if (ctx->Polygon.BackMode != GL_FILL ||
+            ctx->Polygon.FrontMode != GL_FILL) {
            key.do_unfilled = 1;
 
            /* Most cases the fixed function units will handle.  Cases where
@@ -207,17 +207,17 @@ static void upload_clip_prog(struct brw_context *brw)
 
            if (offset_back || offset_front) {
               /* _NEW_POLYGON, _NEW_BUFFERS */
-              key.offset_units = brw->attribs.Polygon->OffsetUnits * brw->intel.polygon_offset_scale;
-              key.offset_factor = brw->attribs.Polygon->OffsetFactor * ctx->DrawBuffer->_MRD;
+              key.offset_units = ctx->Polygon.OffsetUnits * brw->intel.polygon_offset_scale;
+              key.offset_factor = ctx->Polygon.OffsetFactor * ctx->DrawBuffer->_MRD;
            }
 
-           switch (brw->attribs.Polygon->FrontFace) {
+           switch (ctx->Polygon.FrontFace) {
            case GL_CCW:
               key.fill_ccw = fill_front;
               key.fill_cw = fill_back;
               key.offset_ccw = offset_front;
               key.offset_cw = offset_back;
-              if (brw->attribs.Light->Model.TwoSide &&
+              if (ctx->Light.Model.TwoSide &&
                   key.fill_cw != CLIP_CULL) 
                  key.copy_bfc_cw = 1;
               break;
@@ -226,7 +226,7 @@ static void upload_clip_prog(struct brw_context *brw)
               key.fill_ccw = fill_back;
               key.offset_cw = offset_front;
               key.offset_ccw = offset_back;
-              if (brw->attribs.Light->Model.TwoSide &&
+              if (ctx->Light.Model.TwoSide &&
                   key.fill_ccw != CLIP_CULL) 
                  key.copy_bfc_ccw = 1;
               break;
index e33cbb9ce03fd55e83475c93f1f4ba9de1fb4a9f..eaac6224f6ed6ee1d529b4ca58168dec76bc706d 100644 (file)
@@ -76,30 +76,6 @@ static void brwInitDriverFunctions( struct dd_function_table *functions )
    functions->Viewport = intel_viewport;
 }
 
-
-static void brw_init_attribs( struct brw_context *brw )
-{
-   GLcontext *ctx = &brw->intel.ctx;
-
-   brw->attribs.Color = &ctx->Color;
-   brw->attribs.Depth = &ctx->Depth;
-   brw->attribs.Fog = &ctx->Fog;
-   brw->attribs.Hint = &ctx->Hint;
-   brw->attribs.Light = &ctx->Light;
-   brw->attribs.Line = &ctx->Line;
-   brw->attribs.Point = &ctx->Point;
-   brw->attribs.Polygon = &ctx->Polygon;
-   brw->attribs.Scissor = &ctx->Scissor;
-   brw->attribs.Stencil = &ctx->Stencil;
-   brw->attribs.Texture = &ctx->Texture;
-   brw->attribs.Transform = &ctx->Transform;
-   brw->attribs.Viewport = &ctx->Viewport;
-   brw->attribs.VertexProgram = &ctx->VertexProgram;
-   brw->attribs.FragmentProgram = &ctx->FragmentProgram;
-   brw->attribs.PolygonStipple = &ctx->PolygonStipple[0];
-}
-
-
 GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
                            __DRIcontextPrivate *driContextPriv,
                            void *sharedContextPrivate)
@@ -147,7 +123,6 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
 
 /*    ctx->Const.MaxNativeVertexProgramTemps = 32; */
 
-   brw_init_attribs( brw );
    brw_init_state( brw );
 
    brw->state.dirty.mesa = ~0;
index fc0fda98cd166d9149cf8005194673763899f20b..df90c2027f34a281601beaf214227e65f2ece7a7 100644 (file)
@@ -302,26 +302,6 @@ struct brw_cache {
 };
 
 
-
-struct brw_state_pointers {
-   struct gl_colorbuffer_attrib        *Color;
-   struct gl_depthbuffer_attrib        *Depth;
-   struct gl_fog_attrib                *Fog;
-   struct gl_hint_attrib       *Hint;
-   struct gl_light_attrib      *Light;
-   struct gl_line_attrib       *Line;
-   struct gl_point_attrib      *Point;
-   struct gl_polygon_attrib    *Polygon;
-   GLuint                       *PolygonStipple;
-   struct gl_scissor_attrib    *Scissor;
-   struct gl_stencil_attrib    *Stencil;
-   struct gl_texture_attrib    *Texture;
-   struct gl_transform_attrib  *Transform;
-   struct gl_viewport_attrib   *Viewport;
-   struct gl_vertex_program_state *VertexProgram; 
-   struct gl_fragment_program_state *FragmentProgram;
-};
-
 /* Considered adding a member to this struct to document which flags
  * an update might raise so that ordering of the state atoms can be
  * checked or derived at runtime.  Dropped the idea in favor of having
@@ -456,7 +436,6 @@ struct brw_context
       int validated_bo_count;
    } state;
 
-   struct brw_state_pointers attribs;
    struct brw_cache cache;
    struct brw_cached_batch_item *cached_batch_items;
 
index fbf473abf66baaa6a3d0a23377c6251dca624076..4eaaa5f871b35858c165766b2b9be08b762ba93c 100644 (file)
@@ -48,6 +48,7 @@
  */
 static void calculate_curbe_offsets( struct brw_context *brw )
 {
+   GLcontext *ctx = &brw->intel.ctx;
    /* CACHE_NEW_WM_PROG */
    GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16;
    
@@ -58,8 +59,8 @@ static void calculate_curbe_offsets( struct brw_context *brw )
    GLuint total_regs;
 
    /* _NEW_TRANSFORM */
-   if (brw->attribs.Transform->ClipPlanesEnabled) {
-      GLuint nr_planes = 6 + brw_count_bits(brw->attribs.Transform->ClipPlanesEnabled);
+   if (ctx->Transform.ClipPlanesEnabled) {
+      GLuint nr_planes = 6 + brw_count_bits(ctx->Transform.ClipPlanesEnabled);
       nr_clip_regs = (nr_planes * 4 + 15) / 16;
    }
 
@@ -233,11 +234,11 @@ static void prepare_constant_buffer(struct brw_context *brw)
        */
       assert(MAX_CLIP_PLANES == 6);
       for (j = 0; j < MAX_CLIP_PLANES; j++) {
-        if (brw->attribs.Transform->ClipPlanesEnabled & (1<<j)) {
-           buf[offset + i * 4 + 0] = brw->attribs.Transform->_ClipUserPlane[j][0];
-           buf[offset + i * 4 + 1] = brw->attribs.Transform->_ClipUserPlane[j][1];
-           buf[offset + i * 4 + 2] = brw->attribs.Transform->_ClipUserPlane[j][2];
-           buf[offset + i * 4 + 3] = brw->attribs.Transform->_ClipUserPlane[j][3];
+        if (ctx->Transform.ClipPlanesEnabled & (1<<j)) {
+           buf[offset + i * 4 + 0] = ctx->Transform._ClipUserPlane[j][0];
+           buf[offset + i * 4 + 1] = ctx->Transform._ClipUserPlane[j][1];
+           buf[offset + i * 4 + 2] = ctx->Transform._ClipUserPlane[j][2];
+           buf[offset + i * 4 + 3] = ctx->Transform._ClipUserPlane[j][3];
            i++;
         }
       }
index 6a4be83dfb05a838c59df63bea7c933a0ac7110c..99fd587e9fc04a5a7f6752f4279d6daf87ef89d9 100644 (file)
@@ -84,15 +84,17 @@ static const GLenum reduced_prim[GL_POLYGON+1] = {
  */
 static GLuint brw_set_prim(struct brw_context *brw, GLenum prim)
 {
+   GLcontext *ctx = &brw->intel.ctx;
+
    if (INTEL_DEBUG & DEBUG_PRIMS)
       _mesa_printf("PRIM: %s\n", _mesa_lookup_enum_by_nr(prim));
    
    /* Slight optimization to avoid the GS program when not needed:
     */
    if (prim == GL_QUAD_STRIP &&
-       brw->attribs.Light->ShadeModel != GL_FLAT &&
-       brw->attribs.Polygon->FrontMode == GL_FILL &&
-       brw->attribs.Polygon->BackMode == GL_FILL)
+       ctx->Light.ShadeModel != GL_FLAT &&
+       ctx->Polygon.FrontMode == GL_FILL &&
+       ctx->Polygon.BackMode == GL_FILL)
       prim = GL_TRIANGLE_STRIP;
 
    if (prim != brw->primitive) {
@@ -189,12 +191,13 @@ static GLboolean check_fallbacks( struct brw_context *brw,
                                  const struct _mesa_prim *prim,
                                  GLuint nr_prims )
 {
+   GLcontext *ctx = &brw->intel.ctx;
    GLuint i;
 
    if (!brw->intel.strict_conformance)
       return GL_FALSE;
 
-   if (brw->attribs.Polygon->SmoothFlag) {
+   if (ctx->Polygon.SmoothFlag) {
       for (i = 0; i < nr_prims; i++)
         if (reduced_prim[prim[i].mode] == GL_TRIANGLES) 
            return GL_TRUE;
@@ -203,7 +206,7 @@ static GLboolean check_fallbacks( struct brw_context *brw,
    /* BRW hardware will do AA lines, but they are non-conformant it
     * seems.  TBD whether we keep this fallback:
     */
-   if (brw->attribs.Line->SmoothFlag) {
+   if (ctx->Line.SmoothFlag) {
       for (i = 0; i < nr_prims; i++)
         if (reduced_prim[prim[i].mode] == GL_LINES) 
            return GL_TRUE;
@@ -212,7 +215,7 @@ static GLboolean check_fallbacks( struct brw_context *brw,
    /* Stipple -- these fallbacks could be resolved with a little
     * bit of work?
     */
-   if (brw->attribs.Line->StippleFlag) {
+   if (ctx->Line.StippleFlag) {
       for (i = 0; i < nr_prims; i++) {
         /* GS doesn't get enough information to know when to reset
          * the stipple counter?!?
@@ -221,14 +224,14 @@ static GLboolean check_fallbacks( struct brw_context *brw,
            return GL_TRUE;
            
         if (prim[i].mode == GL_POLYGON &&
-            (brw->attribs.Polygon->FrontMode == GL_LINE ||
-             brw->attribs.Polygon->BackMode == GL_LINE))
+            (ctx->Polygon.FrontMode == GL_LINE ||
+             ctx->Polygon.BackMode == GL_LINE))
            return GL_TRUE;
       }
    }
 
 
-   if (brw->attribs.Point->SmoothFlag) {
+   if (ctx->Point.SmoothFlag) {
       for (i = 0; i < nr_prims; i++)
         if (prim[i].mode == GL_POINTS) 
            return GL_TRUE;
index e1ff169f127db9521069779a4139e7c52d60f383..e63098fdd4a9c7fc4bc79d09064c241834af1524 100644 (file)
@@ -62,7 +62,7 @@ static GLboolean do_check_fallback(struct brw_context *brw)
    /* _NEW_TEXTURE:
     */
    for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
-      struct gl_texture_unit *texUnit = &brw->attribs.Texture->Unit[i];
+      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
       if (texUnit->_ReallyEnabled) {
         struct intel_texture_object *intelObj = intel_texture_object(texUnit->_Current);
         struct gl_texture_image *texImage = intelObj->base.Image[0][intelObj->firstLevel];
@@ -75,7 +75,7 @@ static GLboolean do_check_fallback(struct brw_context *brw)
    
    /* _NEW_STENCIL 
     */
-   if (brw->attribs.Stencil->Enabled && 
+   if (ctx->Stencil.Enabled && 
        !brw->intel.hw_stencil) {
       DBG("FALLBACK: stencil\n");
       return GL_TRUE;
index f74ecf53a750e1e05125c650bcdbbb009d9090ce..9dcdad7b4ef590cb10d949b57d9bb94c4d241591 100644 (file)
 
 static void upload_blend_constant_color(struct brw_context *brw)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct brw_blend_constant_color bcc;
 
    memset(&bcc, 0, sizeof(bcc));      
    bcc.header.opcode = CMD_BLEND_CONSTANT_COLOR;
    bcc.header.length = sizeof(bcc)/4-2;
-   bcc.blend_constant_color[0] = brw->attribs.Color->BlendColor[0];
-   bcc.blend_constant_color[1] = brw->attribs.Color->BlendColor[1];
-   bcc.blend_constant_color[2] = brw->attribs.Color->BlendColor[2];
-   bcc.blend_constant_color[3] = brw->attribs.Color->BlendColor[3];
+   bcc.blend_constant_color[0] = ctx->Color.BlendColor[0];
+   bcc.blend_constant_color[1] = ctx->Color.BlendColor[1];
+   bcc.blend_constant_color[2] = ctx->Color.BlendColor[2];
+   bcc.blend_constant_color[3] = ctx->Color.BlendColor[3];
 
    BRW_CACHED_BATCH_STRUCT(brw, &bcc);
 }
@@ -281,6 +282,7 @@ const struct brw_tracked_state brw_depthbuffer = {
 
 static void upload_polygon_stipple(struct brw_context *brw)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct brw_polygon_stipple bps;
    GLuint i;
 
@@ -289,7 +291,7 @@ static void upload_polygon_stipple(struct brw_context *brw)
    bps.header.length = sizeof(bps)/4-2;
 
    for (i = 0; i < 32; i++)
-      bps.stipple[i] = brw->attribs.PolygonStipple[31 - i]; /* invert */
+      bps.stipple[i] = ctx->PolygonStipple[31 - i]; /* invert */
 
    BRW_CACHED_BATCH_STRUCT(brw, &bps);
 }
@@ -367,6 +369,7 @@ const struct brw_tracked_state brw_aa_line_parameters = {
 
 static void upload_line_stipple(struct brw_context *brw)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct brw_line_stipple bls;
    GLfloat tmp;
    GLint tmpi;
@@ -375,10 +378,10 @@ static void upload_line_stipple(struct brw_context *brw)
    bls.header.opcode = CMD_LINE_STIPPLE_PATTERN;
    bls.header.length = sizeof(bls)/4 - 2;
 
-   bls.bits0.pattern = brw->attribs.Line->StipplePattern;
-   bls.bits1.repeat_count = brw->attribs.Line->StippleFactor;
+   bls.bits0.pattern = ctx->Line.StipplePattern;
+   bls.bits1.repeat_count = ctx->Line.StippleFactor;
 
-   tmp = 1.0 / (GLfloat) brw->attribs.Line->StippleFactor;
+   tmp = 1.0 / (GLfloat) ctx->Line.StippleFactor;
    tmpi = tmp * (1<<13);
 
 
index 1a11d546210e7c1582074ea6e2e5ae49064d6ce1..8c1711538af5de59e8c2729e119565945a43c5f8 100644 (file)
@@ -46,6 +46,7 @@
 static void compile_sf_prog( struct brw_context *brw,
                             struct brw_sf_prog_key *key )
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct brw_sf_compile c;
    const GLuint *program;
    GLuint program_size;
@@ -74,7 +75,7 @@ static void compile_sf_prog( struct brw_context *brw,
         c.idx_to_attr[idx] = i;
         if (i >= VERT_RESULT_TEX0 && i <= VERT_RESULT_TEX7) {
             c.point_attrs[i].CoordReplace = 
-               brw->attribs.Point->CoordReplace[i - VERT_RESULT_TEX0];
+               ctx->Point.CoordReplace[i - VERT_RESULT_TEX0];
         }
          else {
             c.point_attrs[i].CoordReplace = GL_FALSE;
@@ -128,6 +129,7 @@ static void compile_sf_prog( struct brw_context *brw,
  */
 static void upload_sf_prog(struct brw_context *brw)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct brw_sf_prog_key key;
 
    memset(&key, 0, sizeof(key));
@@ -158,15 +160,15 @@ static void upload_sf_prog(struct brw_context *brw)
       break;
    }
 
-   key.do_point_sprite = brw->attribs.Point->PointSprite;
-   key.SpriteOrigin = brw->attribs.Point->SpriteOrigin;
+   key.do_point_sprite = ctx->Point.PointSprite;
+   key.SpriteOrigin = ctx->Point.SpriteOrigin;
    /* _NEW_LIGHT */
-   key.do_flat_shading = (brw->attribs.Light->ShadeModel == GL_FLAT);
-   key.do_twoside_color = (brw->attribs.Light->Enabled && brw->attribs.Light->Model.TwoSide);
+   key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT);
+   key.do_twoside_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
 
    /* _NEW_POLYGON */
    if (key.do_twoside_color)
-      key.frontface_ccw = (brw->attribs.Polygon->FrontFace == GL_CCW);
+      key.frontface_ccw = (ctx->Polygon.FrontFace == GL_CCW);
 
    dri_bo_unreference(brw->sf.prog_bo);
    brw->sf.prog_bo = brw_search_cache(&brw->cache, BRW_SF_PROG,
index d9b0479e02be2c1a4dd23ac2c0cad6ac72c1ba2f..e96d5354b300244fe20265ab515ae05c8d5dfc85 100644 (file)
@@ -124,6 +124,7 @@ struct brw_sf_unit_key {
 static void
 sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    memset(key, 0, sizeof(*key));
 
    /* CACHE_NEW_SF_PROG */
@@ -135,20 +136,20 @@ sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key)
    key->urb_size = brw->urb.vsize;
    key->sfsize = brw->urb.sfsize;
 
-   key->scissor = brw->attribs.Scissor->Enabled;
-   key->front_face = brw->attribs.Polygon->FrontFace;
+   key->scissor = ctx->Scissor.Enabled;
+   key->front_face = ctx->Polygon.FrontFace;
 
-   if (brw->attribs.Polygon->CullFlag)
-      key->cull_face = brw->attribs.Polygon->CullFaceMode;
+   if (ctx->Polygon.CullFlag)
+      key->cull_face = ctx->Polygon.CullFaceMode;
    else
       key->cull_face = GL_NONE;
 
-   key->line_width = brw->attribs.Line->Width;
-   key->line_smooth = brw->attribs.Line->SmoothFlag;
+   key->line_width = ctx->Line.Width;
+   key->line_smooth = ctx->Line.SmoothFlag;
 
-   key->point_sprite = brw->attribs.Point->PointSprite;
-   key->point_size = brw->attribs.Point->Size;
-   key->point_attenuated = brw->attribs.Point->_Attenuated;
+   key->point_sprite = ctx->Point.PointSprite;
+   key->point_size = ctx->Point.Size;
+   key->point_attenuated = ctx->Point._Attenuated;
 
    key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
 }
index e4b9731be5fba1957f893943ea0c6c81c3e310a7..5de1450e6122e1e8d7e84da6640cbea4c18ffc6a 100644 (file)
@@ -297,6 +297,7 @@ brw_print_dirty_count(struct dirty_bit_map *bit_map, int32_t bits)
  */
 void brw_validate_state( struct brw_context *brw )
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct intel_context *intel = &brw->intel;
    struct brw_state_flags *state = &brw->state.dirty;
    GLuint i;
@@ -313,13 +314,13 @@ void brw_validate_state( struct brw_context *brw )
       state->brw |= ~0;
    }
 
-   if (brw->fragment_program != brw->attribs.FragmentProgram->_Current) {
-      brw->fragment_program = brw->attribs.FragmentProgram->_Current;
+   if (brw->fragment_program != ctx->FragmentProgram._Current) {
+      brw->fragment_program = ctx->FragmentProgram._Current;
       brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
    }
 
-   if (brw->vertex_program != brw->attribs.VertexProgram->_Current) {
-      brw->vertex_program = brw->attribs.VertexProgram->_Current;
+   if (brw->vertex_program != ctx->VertexProgram._Current) {
+      brw->vertex_program = ctx->VertexProgram._Current;
       brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
    }
 
index 0bb6f176a0df04440dbad06c73363be279d561a8..ef99e9c1aea2047006400c80ad62bc42c65197ab 100644 (file)
@@ -86,11 +86,12 @@ void brw_FrameBufferTexDestroy( struct brw_context *brw )
  */
 void brw_validate_textures( struct brw_context *brw )
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct intel_context *intel = &brw->intel;
    int i;
 
    for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
-      struct gl_texture_unit *texUnit = &brw->attribs.Texture->Unit[i];
+      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
 
       if (texUnit->_ReallyEnabled) {
         intel_finalize_mipmap_tree(intel, i);
index 8beb449bd5f3a427aada8beed5a6fe97d2885c1f..e3111c66800193a49086a60df73fce505a518c59 100644 (file)
@@ -85,6 +85,7 @@ static void do_vs_prog( struct brw_context *brw,
 
 static void brw_upload_vs_prog(struct brw_context *brw)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct brw_vs_prog_key key;
    struct brw_vertex_program *vp = 
       (struct brw_vertex_program *)brw->vertex_program;
@@ -97,9 +98,9 @@ static void brw_upload_vs_prog(struct brw_context *brw)
     * the inputs it asks for, whether they are varying or not.
     */
    key.program_string_id = vp->id;
-   key.nr_userclip = brw_count_bits(brw->attribs.Transform->ClipPlanesEnabled);
-   key.copy_edgeflag = (brw->attribs.Polygon->FrontMode != GL_FILL ||
-                       brw->attribs.Polygon->BackMode != GL_FILL);
+   key.nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
+   key.copy_edgeflag = (ctx->Polygon.FrontMode != GL_FILL ||
+                       ctx->Polygon.BackMode != GL_FILL);
 
    /* Make an early check for the key.
     */
index 6fbac02de63228a0e94841b4aa7fe9205fbd12b9..9977677fd74adbc9301de20f02a37a116831c8c8 100644 (file)
@@ -168,6 +168,7 @@ static GLuint get_input_size(struct brw_context *brw,
  */
 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;
@@ -179,7 +180,7 @@ static void calc_wm_input_sizes( struct brw_context *brw )
    memset(&t, 0, sizeof(t));
 
    /* _NEW_LIGHT */
-   if (brw->attribs.Light->Model.TwoSide)
+   if (ctx->Light.Model.TwoSide)
       t.twoside = 1;
 
    for (i = 0; i < VERT_ATTRIB_MAX; i++) 
index 942581696d8f3c8421caeab935a2bfce9a6f149e..1a63766ea1f2ad1ca894829d35eea2b83dfd914f 100644 (file)
@@ -49,6 +49,8 @@ struct brw_vs_unit_key {
 static void
 vs_unit_populate_key(struct brw_context *brw, struct brw_vs_unit_key *key)
 {
+   GLcontext *ctx = &brw->intel.ctx;
+
    memset(key, 0, sizeof(*key));
 
    /* CACHE_NEW_VS_PROG */
@@ -61,7 +63,7 @@ vs_unit_populate_key(struct brw_context *brw, struct brw_vs_unit_key *key)
    key->urb_size = brw->urb.vsize;
 
    /* BRW_NEW_CURBE_OFFSETS, _NEW_TRANSFORM */
-   if (brw->attribs.Transform->ClipPlanesEnabled) {
+   if (ctx->Transform.ClipPlanesEnabled) {
       /* Note that we read in the userclip planes as well, hence
        * clip_start:
        */
index 3ee0ead9938f1218dc5d6a7f1e315b90bdffeadb..ea708a06815a50468c95fad65702b1534ff56ab6 100644 (file)
@@ -157,6 +157,7 @@ static void do_wm_prog( struct brw_context *brw,
 static void brw_wm_populate_key( struct brw_context *brw,
                                 struct brw_wm_prog_key *key )
 {
+   GLcontext *ctx = &brw->intel.ctx;
    /* BRW_NEW_FRAGMENT_PROGRAM */
    struct brw_fragment_program *fp = 
       (struct brw_fragment_program *)brw->fragment_program;
@@ -170,50 +171,50 @@ static void brw_wm_populate_key( struct brw_context *brw,
     */
    /* _NEW_COLOR */
    if (fp->program.UsesKill ||
-       brw->attribs.Color->AlphaEnabled)
+       ctx->Color.AlphaEnabled)
       lookup |= IZ_PS_KILL_ALPHATEST_BIT;
 
    if (fp->program.Base.OutputsWritten & (1<<FRAG_RESULT_DEPR))
       lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
 
    /* _NEW_DEPTH */
-   if (brw->attribs.Depth->Test)
+   if (ctx->Depth.Test)
       lookup |= IZ_DEPTH_TEST_ENABLE_BIT;
 
-   if (brw->attribs.Depth->Test &&  
-       brw->attribs.Depth->Mask) /* ?? */
+   if (ctx->Depth.Test &&  
+       ctx->Depth.Mask) /* ?? */
       lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
 
    /* _NEW_STENCIL */
-   if (brw->attribs.Stencil->Enabled) {
+   if (ctx->Stencil.Enabled) {
       lookup |= IZ_STENCIL_TEST_ENABLE_BIT;
 
-      if (brw->attribs.Stencil->WriteMask[0] ||
-         brw->attribs.Stencil->WriteMask[brw->attribs.Stencil->_BackFace])
+      if (ctx->Stencil.WriteMask[0] ||
+         ctx->Stencil.WriteMask[ctx->Stencil._BackFace])
         lookup |= IZ_STENCIL_WRITE_ENABLE_BIT;
    }
 
    line_aa = AA_NEVER;
 
    /* _NEW_LINE, _NEW_POLYGON, BRW_NEW_REDUCED_PRIMITIVE */
-   if (brw->attribs.Line->SmoothFlag) {
+   if (ctx->Line.SmoothFlag) {
       if (brw->intel.reduced_primitive == GL_LINES) {
         line_aa = AA_ALWAYS;
       }
       else if (brw->intel.reduced_primitive == GL_TRIANGLES) {
-        if (brw->attribs.Polygon->FrontMode == GL_LINE) {
+        if (ctx->Polygon.FrontMode == GL_LINE) {
            line_aa = AA_SOMETIMES;
 
-           if (brw->attribs.Polygon->BackMode == GL_LINE ||
-               (brw->attribs.Polygon->CullFlag &&
-                brw->attribs.Polygon->CullFaceMode == GL_BACK))
+           if (ctx->Polygon.BackMode == GL_LINE ||
+               (ctx->Polygon.CullFlag &&
+                ctx->Polygon.CullFaceMode == GL_BACK))
               line_aa = AA_ALWAYS;
         }
-        else if (brw->attribs.Polygon->BackMode == GL_LINE) {
+        else if (ctx->Polygon.BackMode == GL_LINE) {
            line_aa = AA_SOMETIMES;
 
-           if ((brw->attribs.Polygon->CullFlag &&
-                brw->attribs.Polygon->CullFaceMode == GL_FRONT))
+           if ((ctx->Polygon.CullFlag &&
+                ctx->Polygon.CullFaceMode == GL_FRONT))
               line_aa = AA_ALWAYS;
         }
       }
@@ -228,11 +229,11 @@ static void brw_wm_populate_key( struct brw_context *brw,
    key->projtex_mask = brw->wm.input_size_masks[4-1] >> (FRAG_ATTRIB_TEX0 - FRAG_ATTRIB_WPOS); 
 
    /* _NEW_LIGHT */
-   key->flat_shade = (brw->attribs.Light->ShadeModel == GL_FLAT);
+   key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT);
 
    /* _NEW_TEXTURE */
    for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
-      const struct gl_texture_unit *unit = &brw->attribs.Texture->Unit[i];
+      const struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
 
       if (unit->_ReallyEnabled) {
          const struct gl_texture_object *t = unit->_Current;
index 8c9cb789453ee9704a5b6e738fd2baf0b9f970eb..b6dac0d69834c578147e236168fef18438152796 100644 (file)
@@ -220,14 +220,15 @@ static void
 brw_wm_sampler_populate_key(struct brw_context *brw,
                            struct wm_sampler_key *key)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    int unit;
 
    memset(key, 0, sizeof(*key));
 
    for (unit = 0; unit < BRW_MAX_TEX_UNIT; unit++) {
-      if (brw->attribs.Texture->Unit[unit]._ReallyEnabled) {
+      if (ctx->Texture.Unit[unit]._ReallyEnabled) {
         struct wm_sampler_entry *entry = &key->sampler[unit];
-        struct gl_texture_unit *texUnit = &brw->attribs.Texture->Unit[unit];
+        struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
         struct gl_texture_object *texObj = texUnit->_Current;
         struct intel_texture_object *intelObj = intel_texture_object(texObj);
         struct gl_texture_image *firstImage =
@@ -274,6 +275,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
  */
 static void upload_wm_samplers( struct brw_context *brw )
 {
+   GLcontext *ctx = &brw->intel.ctx;
    struct wm_sampler_key key;
    int i;
 
@@ -317,7 +319,7 @@ static void upload_wm_samplers( struct brw_context *brw )
 
       /* Emit SDC relocations */
       for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
-        if (!brw->attribs.Texture->Unit[i]._ReallyEnabled)
+        if (!ctx->Texture.Unit[i]._ReallyEnabled)
            continue;
 
         dri_bo_emit_reloc(brw->wm.sampler_bo,
index 5302405eda1bdaefd367f8d7fbd0bf0ec4c58db3..3c3b3473d63b785760445605e5d403aa5b77df24 100644 (file)
@@ -60,6 +60,7 @@ struct brw_wm_unit_key {
 static void
 wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    const struct gl_fragment_program *fp = brw->fragment_program;
    struct intel_context *intel = &brw->intel;
 
@@ -95,7 +96,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
    key->sampler_count = brw->wm.sampler_count;
 
    /* _NEW_POLYGONSTIPPLE */
-   key->polygon_stipple = brw->attribs.Polygon->StippleFlag;
+   key->polygon_stipple = ctx->Polygon.StippleFlag;
 
    /* BRW_NEW_FRAGMENT_PROGRAM */
    key->uses_depth = (fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
@@ -105,19 +106,19 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
       (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) != 0;
 
    /* _NEW_COLOR */
-   key->uses_kill = fp->UsesKill || brw->attribs.Color->AlphaEnabled;
+   key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled;
    key->is_glsl = brw_wm_is_glsl(fp);
 
    /* XXX: This needs a flag to indicate when it changes. */
    key->stats_wm = intel->stats_wm;
 
    /* _NEW_LINE */
-   key->line_stipple = brw->attribs.Line->StippleFlag;
+   key->line_stipple = ctx->Line.StippleFlag;
 
    /* _NEW_POLYGON */
-   key->offset_enable = brw->attribs.Polygon->OffsetFill;
-   key->offset_units = brw->attribs.Polygon->OffsetUnits;
-   key->offset_factor = brw->attribs.Polygon->OffsetFactor;
+   key->offset_enable = ctx->Polygon.OffsetFill;
+   key->offset_units = ctx->Polygon.OffsetUnits;
+   key->offset_factor = ctx->Polygon.OffsetFactor;
 }
 
 static dri_bo *
index 06e71e6d694c5d15d65501b790983eb18e155c3a..d70f9c646cdae439c3b95051e95a17c73304e421 100644 (file)
@@ -253,7 +253,7 @@ static void
 brw_update_texture_surface( GLcontext *ctx, GLuint unit )
 {
    struct brw_context *brw = brw_context(ctx);
-   struct gl_texture_object *tObj = brw->attribs.Texture->Unit[unit]._Current;
+   struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
    struct intel_texture_object *intelObj = intel_texture_object(tObj);
    struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel];
    struct brw_wm_surface_key key;
@@ -301,6 +301,7 @@ static void
 brw_update_region_surface(struct brw_context *brw, struct intel_region *region,
                          unsigned int unit, GLboolean cached)
 {
+   GLcontext *ctx = &brw->intel.ctx;
    dri_bo *region_bo = NULL;
    struct {
       unsigned int surface_type;
@@ -333,10 +334,10 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region,
       key.height = 1;
       key.cpp = 4;
    }
-   memcpy(key.color_mask, brw->attribs.Color->ColorMask,
+   memcpy(key.color_mask, ctx->Color.ColorMask,
          sizeof(key.color_mask));
-   key.color_blend = (!brw->attribs.Color->_LogicOpEnabled &&
-                     brw->attribs.Color->BlendEnabled);
+   key.color_blend = (!ctx->Color._LogicOpEnabled &&
+                     ctx->Color.BlendEnabled);
 
    dri_bo_unreference(brw->wm.surf_bo[unit]);
    brw->wm.surf_bo[unit] = NULL;
@@ -459,7 +460,7 @@ static void prepare_wm_surfaces(struct brw_context *brw )
    brw->wm.nr_surfaces = MAX_DRAW_BUFFERS;
 
    for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
-      struct gl_texture_unit *texUnit = &brw->attribs.Texture->Unit[i];
+      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
 
       /* _NEW_TEXTURE, BRW_NEW_TEXDATA */
       if(texUnit->_ReallyEnabled) {