v3d: Fix segfault when failing to compile a program.
authorEric Anholt <eric@anholt.net>
Mon, 31 Dec 2018 19:51:01 +0000 (11:51 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 2 Jan 2019 22:12:29 +0000 (14:12 -0800)
We'll still fail at draw time, but this avoids a regression in shader-db
execution once I enable TLB writes in precompiles.

Fixes: b38e4d313fc2 ("v3d: Create a state uploader for packing our shaders together.")
src/gallium/drivers/v3d/v3d_program.c

index 759fac117f2adf75ffcf26a869659caccadcb5dd..ef80069baab5f1025a6e70b4635dece8fd1f199e 100644 (file)
@@ -373,8 +373,10 @@ v3d_get_compiled_shader(struct v3d_context *v3d, struct v3d_key *key)
 
         v3d_set_shader_uniform_dirty_flags(shader);
 
-        u_upload_data(v3d->state_uploader, 0, shader_size, 8,
-                      qpu_insts, &shader->offset, &shader->resource);
+        if (shader_size) {
+                u_upload_data(v3d->state_uploader, 0, shader_size, 8,
+                              qpu_insts, &shader->offset, &shader->resource);
+        }
 
         free(qpu_insts);