The value that's split into width/height/depth needs to be the size of
the buffer minus one. This makes it consistent with the constant buffer
and shader time SURFACE_STATE setup code.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
*surf_offset + 4,
bo, 0, I915_GEM_DOMAIN_SAMPLER, 0);
- int w = intel_obj->Base.Size / texel_size;
+ int w = (intel_obj->Base.Size / texel_size) - 1;
surf[2] = ((w & 0x7f) << BRW_SURFACE_WIDTH_SHIFT |
((w >> 7) & 0x1fff) << BRW_SURFACE_HEIGHT_SHIFT);
surf[3] = (((w >> 20) & 0x7f) << BRW_SURFACE_DEPTH_SHIFT |
I915_GEM_DOMAIN_SAMPLER, 0);
int texel_size = _mesa_get_format_bytes(format);
- int w = intel_obj->Base.Size / texel_size;
+ int w = (intel_obj->Base.Size / texel_size) - 1;
/* note that these differ from GEN6 */
surf[2] = SET_FIELD(w & 0x7f, GEN7_SURFACE_WIDTH) | /* bits 6:0 of size */