anv/gen8: Subtract 1 from num_elements when setting up buffer surface state
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 14 Nov 2015 06:50:52 +0000 (22:50 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 14 Nov 2015 06:50:54 +0000 (22:50 -0800)
src/vulkan/gen8_state.c

index 22fe21db1a8db3f96c189c9262653a3887b26cfa..6eb65e6ec4ec16421a73a48bd5c6ff7701ccd34d 100644 (file)
@@ -45,9 +45,9 @@ gen8_fill_buffer_surface_state(void *state, const struct anv_format *format,
       .SamplerL2BypassModeDisable = true,
       .RenderCacheReadWriteMode = WriteOnlyCache,
       .MemoryObjectControlState = GEN8_MOCS,
-      .Height = (num_elements >> 7) & 0x3fff,
-      .Width = num_elements & 0x7f,
-      .Depth = (num_elements >> 21) & 0x3f,
+      .Height = ((num_elements - 1) >> 7) & 0x3fff,
+      .Width = (num_elements - 1) & 0x7f,
+      .Depth = ((num_elements - 1) >> 21) & 0x3f,
       .SurfacePitch = stride - 1,
       .NumberofMultisamples = MULTISAMPLECOUNT_1,
       .ShaderChannelSelectRed = SCS_RED,