~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i915/i915_program.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
}
196
196
 
197
197
GLuint i915_emit_texld( struct i915_fragment_program *p,
198
 
                          GLuint dest,
199
 
                          GLuint destmask,
200
 
                          GLuint sampler,
201
 
                          GLuint coord,
202
 
                          GLuint op )
 
198
                        GLuint dest,
 
199
                        GLuint destmask,
 
200
                        GLuint sampler,
 
201
                        GLuint coord,
 
202
                        GLuint op )
203
203
{
204
 
   assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
205
 
   assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
206
 
 
207
 
   if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
208
 
      p->nr_tex_indirect++;
209
 
   }
210
 
 
211
 
   *(p->csr++) = (op | 
212
 
                  T0_DEST( dest ) |
213
 
                  destmask |
214
 
                  T0_SAMPLER( sampler ));
215
 
 
216
 
   *(p->csr++) = T1_ADDRESS_REG( coord );
217
 
   *(p->csr++) = T2_MBZ;
218
 
 
219
 
   p->nr_tex_insn++;
220
 
   return dest;
 
204
   if (coord != UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord))) {
 
205
      /* No real way to work around this in the general case - need to
 
206
       * allocate and declare a new temporary register (a utemp won't
 
207
       * do).  Will fallback for now.
 
208
       */
 
209
      i915_program_error(p, "Can't (yet) swizzle TEX arguments");
 
210
      return 0;
 
211
   }
 
212
 
 
213
   /* Don't worry about saturate as we only support  
 
214
    */
 
215
   if (destmask != A0_DEST_CHANNEL_ALL) {
 
216
      GLuint tmp = i915_get_utemp(p);
 
217
      i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, op );
 
218
      i915_emit_arith( p, A0_MOV, dest, destmask, 0, tmp, 0, 0 );
 
219
      return dest;
 
220
   }
 
221
   else {
 
222
      assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
 
223
      assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
 
224
 
 
225
      if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
 
226
         p->nr_tex_indirect++;
 
227
      }
 
228
 
 
229
      *(p->csr++) = (op | 
 
230
                     T0_DEST( dest ) |
 
231
                     T0_SAMPLER( sampler ));
 
232
 
 
233
      *(p->csr++) = T1_ADDRESS_REG( coord );
 
234
      *(p->csr++) = T2_MBZ;
 
235
 
 
236
      p->nr_tex_insn++;
 
237
      return dest;
 
238
   }
221
239
}
222
240
 
223
241
 
351
369
 
352
370
void i915_program_error( struct i915_fragment_program *p, const char *msg )
353
371
{
354
 
   /* XXX we shouldn't print anything to stdout, record GL error or
355
 
    * call _mesa_problem()
356
 
    */
357
 
   fprintf(stderr, "%s\n", msg);
 
372
   _mesa_problem(NULL, "i915_program_error: %s", msg);
358
373
   p->error = 1;
359
374
}
360
375