Module: Mesa
Branch: main
Commit: b6d874ade22dc029522500d51993601b8e6183c7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6d874ade22dc029522500d51993601b8e6183c7

Author: Alejandro PiƱeiro <[email protected]>
Date:   Wed May 24 10:43:55 2023 +0200

v3d: assert if v3d_compile returns NULL

Ideally we would like to trigger a compilation error like we do on
v3dv (VK_ERROR_UNKNOWN). But with v3d we can't really do that, as this
could happen on a draw call. Let's at least assert so debug builds
stops at this point.

Reviewed-by: Iago Toral Quiroga <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23203>

---

 src/gallium/drivers/v3d/v3d_program.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/drivers/v3d/v3d_program.c 
b/src/gallium/drivers/v3d/v3d_program.c
index 97535a1bcf3..32f0a7eb03c 100644
--- a/src/gallium/drivers/v3d/v3d_program.c
+++ b/src/gallium/drivers/v3d/v3d_program.c
@@ -407,6 +407,14 @@ v3d_get_compiled_shader(struct v3d_context *v3d,
                                         v3d_shader_debug_output,
                                         v3d,
                                         program_id, variant_id, &shader_size);
+
+                /* qpu_insts being NULL can happen if the register allocation
+                 * failed. At this point we can't really trigger an OpenGL API
+                 * error, as the final compilation could happen on the draw
+                 * call. So let's at least assert, so debug builds finish at
+                 * this point.
+                 */
+                assert(qpu_insts);
                 ralloc_steal(shader, shader->prog_data.base);
 
                 if (shader_size) {

Reply via email to