r600/shader: Initialize max_driver_temp_used correctly for the first time
authorGert Wollny <gw.fossdev@gmail.com>
Sun, 14 Jan 2018 17:13:31 +0000 (18:13 +0100)
committerDave Airlie <airlied@redhat.com>
Sun, 14 Jan 2018 23:14:22 +0000 (09:14 +1000)
Without this initialization the temp registers used in tgsi_declaration
may used random indices, and this may result in failing translation from TGSI
with an error message "GPR limit exceeded", because the random index is greater
then the allowed limit implying that the shader uses more temporary registers then
available.

Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/r600_shader.c

index f2bc34660f7961541761296b94a579d947e27c4e..ab18a6e08ea16c8bb8efd2995b7ee2a8515302dd 100644 (file)
@@ -3336,6 +3336,7 @@ static int r600_shader_from_tgsi(struct r600_context *rctx,
 
        ctx.nliterals = 0;
        ctx.literals = NULL;
+       ctx.max_driver_temp_used = 0;
 
        shader->fs_write_all = ctx.info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS] &&
                               ctx.info.colors_written == 1;