coordinate.reg_offset++;
mlen += reg_width;
- emit(MOV(fs_reg(MRF, base_mrf + mlen), lod));
- lod.reg_offset++;
- mlen += reg_width;
-
- emit(MOV(fs_reg(MRF, base_mrf + mlen), lod2));
- lod2.reg_offset++;
- mlen += reg_width;
+ /* For cube map array, the coordinate is (u,v,r,ai) but there are
+ * only derivatives for (u, v, r).
+ */
+ if (i < ir->lod_info.grad.dPdx->type->vector_elements) {
+ emit(MOV(fs_reg(MRF, base_mrf + mlen), lod));
+ lod.reg_offset++;
+ mlen += reg_width;
+
+ emit(MOV(fs_reg(MRF, base_mrf + mlen), lod2));
+ lod2.reg_offset++;
+ mlen += reg_width;
+ }
}
break;
}