From 99105454b000c5c665dca1d4767450ac668a43e7 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 27 Aug 2014 01:39:44 +0200 Subject: [PATCH] draw: remove fishy num_samplers/num_sampler_views check in llvm path This was meant for softpipe to not crash at some point if vertex texturing was used. It is, however, fishy because it uses values from draw_set_samplers/draw_set_sampler_views and not from the shader key. Albeit we should still in all cases actually generate a new shader if this changes (because the samplers and views themselves are in the key) I don't want to think again wondering if that's really correct in the future. Besides, at least today, it does not actually work for softpipe, as this was relying on softpipe not actually calling draw_set_samplers/sampler_views at all - I've verified it crashes regardless (if there were a tex instruction in the vs, which normally should not happen anyway). For drivers which do indeed not call these functions because they don't support vertex texturing at all (r300), this should still not crash because the static texture data is all zero, which causes the sampling functions to take an early out (same as is done if no texture is bound at the slot used for sampling - verified with hacked up softpipe). Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/draw/draw_llvm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 467f07420e2..e8e837a9785 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -588,16 +588,12 @@ generate_vs(struct draw_llvm_variant *variant, draw_jit_context_vs_constants(variant->gallivm, context_ptr); LLVMValueRef num_consts_ptr = draw_jit_context_num_vs_constants(variant->gallivm, context_ptr); - struct lp_build_sampler_soa *sampler = 0; if (gallivm_debug & (GALLIVM_DEBUG_TGSI | GALLIVM_DEBUG_IR)) { tgsi_dump(tokens, 0); draw_llvm_dump_variant_key(&variant->key); } - if (llvm->draw->num_sampler_views && llvm->draw->num_samplers) - sampler = draw_sampler; - lp_build_tgsi_soa(variant->gallivm, tokens, vs_type, @@ -607,7 +603,7 @@ generate_vs(struct draw_llvm_variant *variant, system_values, inputs, outputs, - sampler, + draw_sampler, &llvm->draw->vs.vertex_shader->info, NULL); -- 2.30.2