From a3dc99f3d48df3da1e997d95961747daed0ba6b9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 26 May 2016 00:29:56 -0700 Subject: [PATCH] i965: Fix the passthrough TCS for isolines. We weren't setting up several of the uniform values for the patch header, so we'd crash when uploading push constants. We at least need to initialize them to zero. We also had the isoline parameters reversed, so it would also render incorrectly (if it didn't crash). Fixes a new Piglit test(*) (isoline-no-tcs), as well as crashes in GL44-CTS.tessellation_shader.single.max_patch_vertices. (*) https://lists.freedesktop.org/archives/piglit/2016-May/019866.html Signed-off-by: Kenneth Graunke Reviewed-by: Dave Airlie Cc: mesa-stable@lists.freedesktop.org --- src/mesa/drivers/dri/i965/brw_tcs.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index 5a514ef21e9..83fc15754e1 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -225,19 +225,24 @@ brw_codegen_tcs_prog(struct brw_context *brw, */ const float **param = (const float **) prog_data.base.base.param; static float zero = 0.0f; - for (int i = 0; i < 4; i++) { - param[7 - i] = &ctx->TessCtrlProgram.patch_default_outer_level[i]; - } + for (int i = 0; i < 8; i++) + param[i] = &zero; if (key->tes_primitive_mode == GL_QUADS) { + for (int i = 0; i < 4; i++) + param[7 - i] = &ctx->TessCtrlProgram.patch_default_outer_level[i]; + param[3] = &ctx->TessCtrlProgram.patch_default_inner_level[0]; param[2] = &ctx->TessCtrlProgram.patch_default_inner_level[1]; - param[1] = &zero; - param[0] = &zero; } else if (key->tes_primitive_mode == GL_TRIANGLES) { + for (int i = 0; i < 3; i++) + param[7 - i] = &ctx->TessCtrlProgram.patch_default_outer_level[i]; + param[4] = &ctx->TessCtrlProgram.patch_default_inner_level[0]; - for (int i = 0; i < 4; i++) - param[i] = &zero; + } else { + assert(key->tes_primitive_mode == GL_ISOLINES); + param[7] = &ctx->TessCtrlProgram.patch_default_outer_level[1]; + param[6] = &ctx->TessCtrlProgram.patch_default_outer_level[0]; } } -- 2.30.2