Mesa (staging/19.0): anv: Treat zero size XFB buffer as disabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Mar 18 18:51:24 UTC 2019


Module: Mesa
Branch: staging/19.0
Commit: ddea2a99c5c5ca31d02a234308728e51950c0347
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddea2a99c5c5ca31d02a234308728e51950c0347

Author: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Date:   Mon Mar 18 12:53:30 2019 +0200

anv: Treat zero size XFB buffer as disabled

Vulkan spec doesn't explicitly forbid zero size transform
feedback buffers.
Having zero size xfb caused SurfaceSize overflow and
triggered assert in debug build.

The only way to have zero size SO_BUFFER is to disable
SO_BUFFER as stated in hardware spec.

>From SKL PRM, Vol 2a, "3DSTATE_SO_BUFFER":
  "If set, stream output to SO Buffer is enabled,
  if 3DSTATE_STREAMOUT::SO Function ENABLE is also enabled.
  If clear, the SO Buffer is considered "not bound" and effectively
  treated as a zero- length buffer for the purposes of SO output and
  overflow detection. If an enabled stream's Stream to Buffer Selects
  includes this buffer it is by definition an overflow condition.
  That stream will cause no writes to occur,
  and only SO_PRIM_STORAGE_NEEDED[<stream>] will increment."

Fixes: 36ee2fd61c8 "anv: Implement the basic form of VK_EXT_transform_feedback"

Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
(cherry picked from commit ecb98c68988570806c239c7cc705c69a98aafc23)

---

 src/intel/vulkan/genX_cmd_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index d980ec428d0..a3994f5870c 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2653,7 +2653,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
          anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_SO_BUFFER), sob) {
             sob.SOBufferIndex = idx;
 
-            if (cmd_buffer->state.xfb_enabled && xfb->buffer) {
+            if (cmd_buffer->state.xfb_enabled && xfb->buffer && xfb->size != 0) {
                sob.SOBufferEnable = true;
                sob.MOCS = cmd_buffer->device->default_mocs,
                sob.StreamOffsetWriteEnable = false;




More information about the mesa-commit mailing list