diff options
author | José Fonseca <[email protected]> | 2013-04-25 18:51:17 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2013-04-26 12:15:39 +0100 |
commit | c5e8573762e3f72d6fcfe7cc4056803ebea89c7c (patch) | |
tree | d2b67cce5969182a708df0858f47d0d1d0a4f52c /src/gallium/auxiliary/draw | |
parent | 5816a471afc2e98968bb332cd96526c42d429285 (diff) |
Revert "draw: Yield zeros for LLVM fetches of non-existing vertex elements."
After more thought/discussion, it seems it is better to handle this sort
of stuff in the state tracker.
So this reverts commit 12096f334b82340dc165ed15e6f8f44d4cf94df4, except the
variant->key -> key shorthands.
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 594b0ec72a3..71e2c32f4c3 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1525,7 +1525,6 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, lp_build_loop_begin(&lp_loop, gallivm, start); { - unsigned nr_vertex_elements = vs_info->file_max[TGSI_FILE_INPUT] + 1; LLVMValueRef inputs[PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS]; LLVMValueRef aos_attribs[PIPE_MAX_SHADER_INPUTS][LP_MAX_VECTOR_WIDTH / 32] = { { 0 } }; LLVMValueRef io; @@ -1564,22 +1563,18 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, system_values.vertex_id = LLVMBuildInsertElement(gallivm->builder, system_values.vertex_id, true_index, lp_build_const_int32(gallivm, i), ""); - for (j = 0; j < nr_vertex_elements; ++j) { + for (j = 0; j < draw->pt.nr_vertex_elements; ++j) { struct pipe_vertex_element *velem = &draw->pt.vertex_element[j]; - if (j < draw->pt.nr_vertex_elements) { - LLVMValueRef vb_index = - lp_build_const_int32(gallivm, velem->vertex_buffer_index); - LLVMValueRef vb = LLVMBuildGEP(builder, vb_ptr, &vb_index, 1, ""); - generate_fetch(gallivm, vbuffers_ptr, - &aos_attribs[j][i], velem, vb, true_index, - system_values.instance_id); - } else { - aos_attribs[j][i] = lp_build_zero(gallivm, lp_float32_vec4_type()); - } + LLVMValueRef vb_index = + lp_build_const_int32(gallivm, velem->vertex_buffer_index); + LLVMValueRef vb = LLVMBuildGEP(builder, vb_ptr, &vb_index, 1, ""); + generate_fetch(gallivm, vbuffers_ptr, + &aos_attribs[j][i], velem, vb, true_index, + system_values.instance_id); } } convert_to_soa(gallivm, aos_attribs, inputs, - nr_vertex_elements, vs_type); + draw->pt.nr_vertex_elements, vs_type); ptr_aos = (const LLVMValueRef (*)[TGSI_NUM_CHANNELS]) inputs; generate_vs(variant, @@ -1667,9 +1662,8 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store) * here, not the number of provided elements to match keysize * (and the offset of sampler state in the key). */ - key->nr_vertex_elements = - MIN2(llvm->draw->vs.vertex_shader->info.file_max[TGSI_FILE_INPUT] + 1, - llvm->draw->pt.nr_vertex_elements); + key->nr_vertex_elements = llvm->draw->vs.vertex_shader->info.file_max[TGSI_FILE_INPUT] + 1; + assert(key->nr_vertex_elements <= llvm->draw->pt.nr_vertex_elements); /* will have to rig this up properly later */ key->clip_xy = llvm->draw->clip_xy; |