i965/vs: Fix unit mismatch in scratch base_offset parameter.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_vec4_visitor.cpp
index 682837ffa6a3eb8ba33998e1a6e1f826139288c9..59428a192102f3d003333bbada06513baed46ac7 100644 (file)
@@ -2443,6 +2443,8 @@ vec4_visitor::get_pull_constant_offset(vec4_instruction *inst,
 /**
  * Emits an instruction before @inst to load the value named by @orig_src
  * from scratch space at @base_offset to @temp.
+ *
+ * @base_offset is measured in 32-byte units (the size of a register).
  */
 void
 vec4_visitor::emit_scratch_read(vec4_instruction *inst,
@@ -2458,6 +2460,8 @@ vec4_visitor::emit_scratch_read(vec4_instruction *inst,
 /**
  * Emits an instruction after @inst to store the value to be written
  * to @orig_dst to scratch space at @base_offset, from @temp.
+ *
+ * @base_offset is measured in 32-byte units (the size of a register).
  */
 void
 vec4_visitor::emit_scratch_write(vec4_instruction *inst,
@@ -2501,7 +2505,7 @@ vec4_visitor::move_grf_array_access_to_scratch()
       if (inst->dst.file == GRF && inst->dst.reladdr &&
          scratch_loc[inst->dst.reg] == -1) {
         scratch_loc[inst->dst.reg] = c->last_scratch;
-        c->last_scratch += this->virtual_grf_sizes[inst->dst.reg] * 8 * 4;
+        c->last_scratch += this->virtual_grf_sizes[inst->dst.reg];
       }
 
       for (int i = 0 ; i < 3; i++) {
@@ -2510,7 +2514,7 @@ vec4_visitor::move_grf_array_access_to_scratch()
         if (src->file == GRF && src->reladdr &&
             scratch_loc[src->reg] == -1) {
            scratch_loc[src->reg] = c->last_scratch;
-           c->last_scratch += this->virtual_grf_sizes[src->reg] * 8 * 4;
+           c->last_scratch += this->virtual_grf_sizes[src->reg];
         }
       }
    }