Intel Vulkan driver assertion with small xfb buffer
I'm hitting a Vulkan driver assertion:
src/intel/genxml/gen9_pack.h:72: __gen_uint: Assertion `v <= max' failed.
when an xfb buffer of size 1 byte is used. At the assertion, v = 0xffffffff and max = 1073741823.
Long story, but to catch a D3D corner case we sometimes bind a 1-byte buffer as an xfb target buffer. The idea is that any write to it will generate an overflow.
The v = 0xffffffff value comes from genX_cmd_buffer.c:3415: sob.SurfaceSize = xfb->size / 4 - 1;
here, xfb->size = 1 so sob.SurfaceSize winds up being -1.
I can fix the problem by changing the line to read: sob.SurfaceSize = (xfb->size >= 4) ? (xfb->size / 4 - 1) : 0;
Does that seem reasonable?