anv: Treat zero size XFB buffer as disabled

Danylo Piliaiev requested to merge GL/mesa:fix/zero-xfb-buffer-size into master

Vulkan spec doesn't explicitly forbid zero size transform feedback buffers. However I cannot judge if it was originally intended or just an oversight.

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[] will increment."

In the wild this happens in DX11 RenderDoc running under Wine + DXVK.

Edited by Danylo Piliaiev

Merge request reports