iris: Fix constant buffer sizes for non-UBOs
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 10 Sep 2019 16:04:20 +0000 (09:04 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 10 Sep 2019 17:53:15 +0000 (10:53 -0700)
Since the system value refactor, we've accidentally only been setting
cbuf->buffer_size in the UBO case, and not in the uploaded-constants
case.  We use cbuf->buffer_size to fill out the SURFACE_STATE entry,
so it needs to be initialized in both cases.

Fixes: 3b6d787e404 ("iris: move sysvals to their own constant buffer")
src/gallium/drivers/iris/iris_state.c

index a503f38d6ca511a9c19e05c34bb0a3c0ac472a8a..1c70b2ccbff6cc433d806647327146621847bd57 100644 (file)
@@ -2739,11 +2739,12 @@ iris_set_constant_buffer(struct pipe_context *ctx,
          pipe_resource_reference(&cbuf->buffer, input->buffer);
 
          cbuf->buffer_offset = input->buffer_offset;
-         cbuf->buffer_size =
-            MIN2(input->buffer_size,
-                 iris_resource_bo(cbuf->buffer)->size - cbuf->buffer_offset);
       }
 
+      cbuf->buffer_size =
+         MIN2(input->buffer_size,
+              iris_resource_bo(cbuf->buffer)->size - cbuf->buffer_offset);
+
       struct iris_resource *res = (void *) cbuf->buffer;
       res->bind_history |= PIPE_BIND_CONSTANT_BUFFER;