- /* TODO: can offsets be full words? */
- if (texture->has_offset) {
- print_texture_reg(false, texture->offset_reg_select, texture->offset_reg_upper);
- printf(", ");
+ /* There is *always* an offset attached. Of
+ * course, that offset is just immediate #0 for a
+ * GLES call that doesn't take an offset. If there
+ * is a non-negative non-zero offset, this is
+ * specified in immediate offset mode, with the
+ * values in the offset_* fields as immediates. If
+ * this is a negative offset, we instead switch to
+ * a register offset mode, where the offset_*
+ * fields become register triplets */
+
+ if (texture->offset_register) {
+ printf(" + ");
+ print_texture_reg_triple(texture->offset_x);
+
+ /* I've never seen them different than this */
+ if (texture->offset_y != 2)
+ printf(" /* y = %d */", texture->offset_y);
+
+ if (texture->offset_z != 1)
+ printf(" /* z = %d */", texture->offset_z);
+
+ printf(",");
+ } else if (texture->offset_x || texture->offset_y || texture->offset_z) {
+ printf(" + <%d, %d, %d>, ",
+ texture->offset_x,
+ texture->offset_y,
+ texture->offset_z);
+ } else {
+ printf(",");