From 4314949277f95c2e796f3deb5ed33c68f565239a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Oct 2022 14:13:10 -0600 Subject: [PATCH] draw: fix vertex id offset bug The vertex_id_offset value needs to be used both for the elt and linear cases. As it was, if a long primitive was split, the vertex id seen in the VS was also getting to reset to zero for each batch of the split prim's vertices. This fixes at least five VMware test cases (dx11-dxsdk-FluidCS11, dx11-amd-TressFX-v1.0, dx10-win7-dxsdk-samples-nbodygravity, dx10-win7-dxsdk-samples-gpuboids, dx10-wide-points). Signed-off-by: Brian Paul Reviewed-by: Dave Airlie Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/draw/draw_llvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index bd0ac8cff65..1ecff33882f 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -2298,9 +2298,11 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) */ LLVMValueRef base_vertex = lp_build_select(&bld, have_elts, vertex_id_offset, lp_build_const_int32(gallivm, 0)); system_values.basevertex = lp_build_broadcast_scalar(&blduivec, base_vertex); + /* first vertex is for Vulkan base vertex support */ - LLVMValueRef first_vertex = lp_build_select(&bld, have_elts, vertex_id_offset, start); + LLVMValueRef first_vertex = vertex_id_offset; system_values.firstvertex = lp_build_broadcast_scalar(&blduivec, first_vertex); + system_values.vertex_id = true_index_array; system_values.vertex_id_nobase = LLVMBuildSub(builder, true_index_array, lp_build_broadcast_scalar(&blduivec, vertex_id_offset), "");