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 <jfonseca@vmware.com>
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,
system_values,
inputs,
outputs,
- sampler,
+ draw_sampler,
&llvm->draw->vs.vertex_shader->info,
NULL);