From c64afadcffab6bb57f7e15cdb52046383d4b1a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Fri, 6 May 2016 11:52:17 -0500 Subject: [PATCH] radeonsi: workaround for tesselation on SI We request more than 32KB of LDS here, which SI doesn't have. Since LLVM recently started checking the size of LDS allocations, all shaders involved in tesselation fail to compile on SI. Note that the entire calculation here seems wrong: each input/output of each vertex actually occupies 16 bytes rather than just 4, so this will fail for large vertices on CI+ as well. A proper solution is clearly needed, but this patch should serve as a band-aid for SI in the meantime. --- src/gallium/drivers/radeonsi/si_shader.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 49c498d..c9d3a95 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -4952,6 +4952,16 @@ static void declare_tess_lds(struct si_shader_context *ctx) unsigned patch_dw_size = vertex_data_dw_size*2 + patch_data_dw_size; unsigned lds_dwords = patch_dw_size; + if (ctx->screen->b.chip_class <= SI) { + /* This is a horrible temporary workaround to make tesselation + * not be completely broken on SI now that LLVM checks that + * the declared LDS size fits into the device maximum of 32KB. + * + * The real long term solution requires off-chip tesselation. + */ + patch_dw_size = 8 * 1024; + } + /* The actual size is computed outside of the shader to reduce * the number of shader variants. */ ctx->lds = -- 2.7.4