~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/glsl/ir_validate.cpp

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 * a dereference chain.
34
34
 */
35
35
 
36
 
#include <inttypes.h>
37
36
#include "ir.h"
38
37
#include "ir_hierarchical_visitor.h"
39
38
#include "program/hash_table.h"
59
58
 
60
59
   virtual ir_visitor_status visit(ir_variable *v);
61
60
   virtual ir_visitor_status visit(ir_dereference_variable *ir);
62
 
   virtual ir_visitor_status visit(ir_if *ir);
 
61
 
 
62
   virtual ir_visitor_status visit_enter(ir_if *ir);
63
63
 
64
64
   virtual ir_visitor_status visit_leave(ir_loop *ir);
65
65
   virtual ir_visitor_status visit_enter(ir_function *ir);
102
102
}
103
103
 
104
104
ir_visitor_status
105
 
ir_validate::visit(ir_if *ir)
 
105
ir_validate::visit_enter(ir_if *ir)
106
106
{
107
107
   if (ir->condition->type != glsl_type::bool_type) {
108
108
      printf("ir_if condition %s type instead of bool.\n",
254
254
 
255
255
   case ir_unop_f2i:
256
256
      assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
257
 
      assert(ir->type->is_integer());
 
257
      assert(ir->type->base_type == GLSL_TYPE_INT);
258
258
      break;
259
259
   case ir_unop_i2f:
260
260
      assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
269
269
      assert(ir->type->base_type == GLSL_TYPE_FLOAT);
270
270
      break;
271
271
   case ir_unop_i2b:
272
 
      assert(ir->operands[0]->type->is_integer());
 
272
      assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
273
273
      assert(ir->type->base_type == GLSL_TYPE_BOOL);
274
274
      break;
275
275
   case ir_unop_b2i:
276
276
      assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
277
 
      assert(ir->type->is_integer());
 
277
      assert(ir->type->base_type == GLSL_TYPE_INT);
278
278
      break;
279
279
   case ir_unop_u2f:
280
280
      assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
281
281
      assert(ir->type->base_type == GLSL_TYPE_FLOAT);
282
282
      break;
 
283
   case ir_unop_i2u:
 
284
      assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
 
285
      assert(ir->type->base_type == GLSL_TYPE_UINT);
 
286
      break;
 
287
   case ir_unop_u2i:
 
288
      assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
 
289
      assert(ir->type->base_type == GLSL_TYPE_INT);
 
290
      break;
283
291
 
284
292
   case ir_unop_any:
285
293
      assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
488
496
      }
489
497
   }
490
498
 
 
499
   if (ir->constant_initializer != NULL && !ir->has_initializer) {
 
500
      printf("ir_variable didn't have an initializer, but has a constant "
 
501
             "initializer value.\n");
 
502
      ir->print();
 
503
      abort();
 
504
   }
 
505
 
491
506
   return visit_continue;
492
507
}
493
508
 
533
548
      abort();
534
549
   }
535
550
 
 
551
   const exec_node *formal_param_node = callee->parameters.head;
 
552
   const exec_node *actual_param_node = ir->actual_parameters.head;
 
553
   while (true) {
 
554
      if (formal_param_node->is_tail_sentinel()
 
555
          != actual_param_node->is_tail_sentinel()) {
 
556
         printf("ir_call has the wrong number of parameters:\n");
 
557
         goto dump_ir;
 
558
      }
 
559
      if (formal_param_node->is_tail_sentinel()) {
 
560
         break;
 
561
      }
 
562
      const ir_variable *formal_param
 
563
         = (const ir_variable *) formal_param_node;
 
564
      const ir_rvalue *actual_param
 
565
         = (const ir_rvalue *) actual_param_node;
 
566
      if (formal_param->type != actual_param->type) {
 
567
         printf("ir_call parameter type mismatch:\n");
 
568
         goto dump_ir;
 
569
      }
 
570
      if (formal_param->mode == ir_var_out
 
571
          || formal_param->mode == ir_var_inout) {
 
572
         if (!actual_param->is_lvalue()) {
 
573
            printf("ir_call out/inout parameters must be lvalues:\n");
 
574
            goto dump_ir;
 
575
         }
 
576
      }
 
577
      formal_param_node = formal_param_node->next;
 
578
      actual_param_node = actual_param_node->next;
 
579
   }
 
580
 
536
581
   return visit_continue;
 
582
 
 
583
dump_ir:
 
584
   ir->print();
 
585
   printf("callee:\n");
 
586
   callee->print();
 
587
   abort();
 
588
   return visit_stop;
537
589
}
538
590
 
539
591
void