vk/image: Check extent does not exceed surface type limits
[mesa.git] / src / glsl / loop_analysis.h
index 0208890b1fd9df5f00cde537caf81126034e0cbe..3b1971d7edce2ca3283ac5ae820c1b75224ac67b 100644 (file)
@@ -39,15 +39,12 @@ analyze_loop_variables(exec_list *instructions);
 /**
  * Fill in loop control fields
  *
- * Based on analysis of loop variables, this function tries to remove sequences
- * in the loop of the form
+ * Based on analysis of loop variables, this function tries to remove
+ * redundant sequences in the loop of the form
  *
  *  (if (expression bool ...) (break))
  *
- * and fill in the \c normative_bound field of the \c ir_loop.
- *
- * In this process, some conditional break-statements may be eliminated
- * altogether.  For example, if it is provable that one loop exit condition will
+ * For example, if it is provable that one loop exit condition will
  * always be satisfied before another, the unnecessary exit condition will be
  * removed.
  */
@@ -56,7 +53,8 @@ set_loop_controls(exec_list *instructions, loop_state *ls);
 
 
 extern bool
-unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations);
+unroll_loops(exec_list *instructions, loop_state *ls,
+             const struct gl_shader_compiler_options *options);
 
 ir_rvalue *
 find_initial_value(ir_loop *loop, ir_variable *var);
@@ -118,15 +116,6 @@ public:
     */
    hash_table *var_hash;
 
-   /**
-    * Maximum number of loop iterations.
-    *
-    * If this value is negative, then the loop may be infinite.  This actually
-    * means that analysis was unable to determine an upper bound on the number
-    * of loop iterations.
-    */
-   int max_iterations;
-
    /**
     * Number of ir_loop_jump instructions that operate on this loop
     */
@@ -139,7 +128,6 @@ public:
 
    loop_variable_state()
    {
-      this->max_iterations = -1;
       this->num_loop_jumps = 0;
       this->contains_calls = false;
       this->var_hash = hash_table_ctor(0, hash_table_pointer_hash,
@@ -152,22 +140,7 @@ public:
       hash_table_dtor(this->var_hash);
    }
 
-   static void* operator new(size_t size, void *ctx)
-   {
-      void *lvs = ralloc_size(ctx, size);
-      assert(lvs != NULL);
-
-      ralloc_set_destructor(lvs, (void (*)(void*)) destructor);
-
-      return lvs;
-   }
-
-private:
-   static void
-   destructor(loop_variable_state *lvs)
-   {
-      lvs->~loop_variable_state();
-   }
+   DECLARE_RALLOC_CXX_OPERATORS(loop_variable_state)
 };
 
 
@@ -217,10 +190,10 @@ public:
    inline bool is_loop_constant() const
    {
       const bool is_const = (this->num_assignments == 0)
-        || ((this->num_assignments == 1)
+         || (((this->num_assignments == 1)
             && !this->conditional_or_nested_assignment
             && !this->read_before_write
-            && this->rhs_clean);
+             && this->rhs_clean) || this->var->data.read_only);
 
       /* If the RHS of *the* assignment is clean, then there must be exactly
        * one assignment of the variable.
@@ -228,10 +201,6 @@ public:
       assert((this->rhs_clean && (this->num_assignments == 1))
             || !this->rhs_clean);
 
-      /* Variables that are marked read-only *MUST* be loop constant.
-       */
-      assert(!this->var->read_only || (this->var->read_only && is_const));
-
       return is_const;
    }