[Mesa-dev] [PATCH] virgl: don't send a shader create with no data.

Dave Airlie airlied at gmail.com
Tue Aug 28 22:34:03 UTC 2018


From: Dave Airlie <airlied at redhat.com>

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.
---
 src/gallium/drivers/virgl/virgl_encode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c
index b56e1f5e428..c1082791af5 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -284,11 +284,12 @@ 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;
 
+      fprintf(stderr, "this pass is %d %d %d\n", thispass, ctx->cbuf->cdw, hdr_len);
       length = MIN2(thispass, left_bytes);
       len = ((length + 3) / 4) + hdr_len;
 
-- 
2.14.3



More information about the mesa-dev mailing list