mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-25 09:20:30 +01:00
draw: Respect pipe_vertex_buffer::max_index in llvm generated code.
Everybody should respect max_index, specially llvm generated code, which likes to eat vertices 4 at a time, so it may end up chew a bit a bit more than actually exists.
This commit is contained in:
parent
2cd128ab44
commit
4dd1a56840
2 changed files with 13 additions and 4 deletions
|
|
@ -286,10 +286,16 @@ generate_fetch(LLVMBuilderRef builder,
|
|||
LLVMValueRef vbuffer_ptr = LLVMBuildGEP(builder, vbuffers_ptr,
|
||||
&indices, 1, "");
|
||||
LLVMValueRef vb_stride = draw_jit_vbuffer_stride(builder, vbuf);
|
||||
LLVMValueRef vb_max_index = draw_jit_vbuffer_max_index(builder, vbuf);
|
||||
LLVMValueRef vb_buffer_offset = draw_jit_vbuffer_offset(builder, vbuf);
|
||||
LLVMValueRef stride = LLVMBuildMul(builder,
|
||||
vb_stride,
|
||||
index, "");
|
||||
LLVMValueRef cond;
|
||||
LLVMValueRef stride;
|
||||
|
||||
cond = LLVMBuildICmp(builder, LLVMIntULE, index, vb_max_index, "");
|
||||
|
||||
index = LLVMBuildSelect(builder, cond, index, vb_max_index, "");
|
||||
|
||||
stride = LLVMBuildMul(builder, vb_stride, index, "");
|
||||
|
||||
vbuffer_ptr = LLVMBuildLoad(builder, vbuffer_ptr, "vbuffer");
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,10 @@ struct draw_jit_context
|
|||
#define draw_jit_vbuffer_stride(_builder, _ptr) \
|
||||
lp_build_struct_get(_builder, _ptr, 0, "stride")
|
||||
|
||||
#define draw_jit_vbuffer_offset(_builder, _ptr) \
|
||||
#define draw_jit_vbuffer_max_index(_builder, _ptr) \
|
||||
lp_build_struct_get(_builder, _ptr, 1, "max_index")
|
||||
|
||||
#define draw_jit_vbuffer_offset(_builder, _ptr) \
|
||||
lp_build_struct_get(_builder, _ptr, 2, "buffer_offset")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue