virgl: don't send a shader create with no data. (v2)
authorDave Airlie <airlied@redhat.com>
Tue, 28 Aug 2018 22:32:29 +0000 (08:32 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 10 Sep 2018 02:23:30 +0000 (12:23 +1000)
This fixes the situation where we'd send a shader with just the
header and no data.

piglit/glsl-max-varyings test was causing this to happen, and
the renderer fix was breaking it.

v2: drop fprintf

Fixes: a8987b88ff1d "virgl: add driver for virtio-gpu 3D (v2)"
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
src/gallium/drivers/virgl/virgl_encode.c

index d130e4059e69c71ea5441919c7ead7c56a2dda97..e86d0711a57df50f91a4fafea8e1ffb21eec40ca 100644 (file)
@@ -288,7 +288,7 @@ int virgl_encode_shader_state(struct virgl_context *ctx,
    while (left_bytes) {
       uint32_t length, offlen;
       int hdr_len = base_hdr_size + (first_pass ? strm_hdr_size : 0);
-      if (ctx->cbuf->cdw + hdr_len + 1 > VIRGL_MAX_CMDBUF_DWORDS)
+      if (ctx->cbuf->cdw + hdr_len + 1 >= VIRGL_MAX_CMDBUF_DWORDS)
          ctx->base.flush(&ctx->base, NULL, 0);
 
       thispass = (VIRGL_MAX_CMDBUF_DWORDS - ctx->cbuf->cdw - hdr_len - 1) * 4;