~ubuntu-branches/ubuntu/jaunty/mesa/jaunty

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i965/brw_clip.c

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2009-04-03 12:42:06 UTC
  • mfrom: (1.2.16 upstream) (3.1.5 experimental)
  • Revision ID: james.westby@ubuntu.com-20090403124206-0oo9dl0tcmd0qr38
Tags: 7.4-0ubuntu1
* New upstream release, merge from debian-experimental
  (LP: #330476, #347171, #349127)
* Drop 103_rs600_support.patch, included in this version.
* Drop 104_swrast_fbconfigs.patch, included in this version.
* Add 103_bump_965_texture_limit.diff. (LP: #146298)
* Add 104_fix_dri2_ext_tfp.diff. (LP: #324854)

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
   /* CACHE_NEW_VS_PROG */
146
146
   key.attrs = brw->vs.prog_data->outputs_written;
147
147
   /* _NEW_LIGHT */
148
 
   key.do_flat_shading = (brw->attribs.Light->ShadeModel == GL_FLAT);
 
148
   key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT);
149
149
   /* _NEW_TRANSFORM */
150
 
   key.nr_userclip = brw_count_bits(brw->attribs.Transform->ClipPlanesEnabled);
 
150
   key.nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
151
151
   key.clip_mode = BRW_CLIPMODE_NORMAL;
152
152
 
153
153
   /* _NEW_POLYGON */
154
154
   if (key.primitive == GL_TRIANGLES) {
155
 
      if (brw->attribs.Polygon->CullFaceMode == GL_FRONT_AND_BACK) 
 
155
      if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) 
156
156
         key.clip_mode = BRW_CLIPMODE_REJECT_ALL;
157
157
      else {
158
158
         GLuint fill_front = CLIP_CULL;
160
160
         GLuint offset_front = 0;
161
161
         GLuint offset_back = 0;
162
162
 
163
 
         if (!brw->attribs.Polygon->CullFlag ||
164
 
             brw->attribs.Polygon->CullFaceMode != GL_FRONT) {
165
 
            switch (brw->attribs.Polygon->FrontMode) {
 
163
         if (!ctx->Polygon.CullFlag ||
 
164
             ctx->Polygon.CullFaceMode != GL_FRONT) {
 
165
            switch (ctx->Polygon.FrontMode) {
166
166
            case GL_FILL: 
167
167
               fill_front = CLIP_FILL; 
168
168
               offset_front = 0;
169
169
               break;
170
170
            case GL_LINE:
171
171
               fill_front = CLIP_LINE;
172
 
               offset_front = brw->attribs.Polygon->OffsetLine;
 
172
               offset_front = ctx->Polygon.OffsetLine;
173
173
               break;
174
174
            case GL_POINT:
175
175
               fill_front = CLIP_POINT;
176
 
               offset_front = brw->attribs.Polygon->OffsetPoint;
 
176
               offset_front = ctx->Polygon.OffsetPoint;
177
177
               break;
178
178
            }
179
179
         }
180
180
 
181
 
         if (!brw->attribs.Polygon->CullFlag ||
182
 
             brw->attribs.Polygon->CullFaceMode != GL_BACK) {
183
 
            switch (brw->attribs.Polygon->BackMode) {
 
181
         if (!ctx->Polygon.CullFlag ||
 
182
             ctx->Polygon.CullFaceMode != GL_BACK) {
 
183
            switch (ctx->Polygon.BackMode) {
184
184
            case GL_FILL: 
185
185
               fill_back = CLIP_FILL; 
186
186
               offset_back = 0;
187
187
               break;
188
188
            case GL_LINE:
189
189
               fill_back = CLIP_LINE;
190
 
               offset_back = brw->attribs.Polygon->OffsetLine;
 
190
               offset_back = ctx->Polygon.OffsetLine;
191
191
               break;
192
192
            case GL_POINT:
193
193
               fill_back = CLIP_POINT;
194
 
               offset_back = brw->attribs.Polygon->OffsetPoint;
 
194
               offset_back = ctx->Polygon.OffsetPoint;
195
195
               break;
196
196
            }
197
197
         }
198
198
 
199
 
         if (brw->attribs.Polygon->BackMode != GL_FILL ||
200
 
             brw->attribs.Polygon->FrontMode != GL_FILL) {
 
199
         if (ctx->Polygon.BackMode != GL_FILL ||
 
200
             ctx->Polygon.FrontMode != GL_FILL) {
201
201
            key.do_unfilled = 1;
202
202
 
203
203
            /* Most cases the fixed function units will handle.  Cases where
207
207
 
208
208
            if (offset_back || offset_front) {
209
209
               /* _NEW_POLYGON, _NEW_BUFFERS */
210
 
               key.offset_units = brw->attribs.Polygon->OffsetUnits * brw->intel.polygon_offset_scale;
211
 
               key.offset_factor = brw->attribs.Polygon->OffsetFactor * ctx->DrawBuffer->_MRD;
 
210
               key.offset_units = ctx->Polygon.OffsetUnits * brw->intel.polygon_offset_scale;
 
211
               key.offset_factor = ctx->Polygon.OffsetFactor * ctx->DrawBuffer->_MRD;
212
212
            }
213
213
 
214
 
            switch (brw->attribs.Polygon->FrontFace) {
 
214
            switch (ctx->Polygon.FrontFace) {
215
215
            case GL_CCW:
216
216
               key.fill_ccw = fill_front;
217
217
               key.fill_cw = fill_back;
218
218
               key.offset_ccw = offset_front;
219
219
               key.offset_cw = offset_back;
220
 
               if (brw->attribs.Light->Model.TwoSide &&
 
220
               if (ctx->Light.Model.TwoSide &&
221
221
                   key.fill_cw != CLIP_CULL) 
222
222
                  key.copy_bfc_cw = 1;
223
223
               break;
226
226
               key.fill_ccw = fill_back;
227
227
               key.offset_cw = offset_front;
228
228
               key.offset_ccw = offset_back;
229
 
               if (brw->attribs.Light->Model.TwoSide &&
 
229
               if (ctx->Light.Model.TwoSide &&
230
230
                   key.fill_ccw != CLIP_CULL) 
231
231
                  key.copy_bfc_ccw = 1;
232
232
               break;