summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-04-02 14:30:16 +0200
committerMarek Olšák <[email protected]>2017-05-10 19:00:16 +0200
commitc24c3b94ed29ecd99b1101c74c6c4606f9b5580e (patch)
tree81f6966bc59a68d9867693c65d35fae9bb1d9819 /src/gallium/auxiliary/draw
parentfe437882ea2d60e91c244cc95beb4b79c615af49 (diff)
gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.h2
3 files changed, 13 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 8f1189a6bda..0eee0751069 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -206,9 +206,8 @@ void draw_destroy( struct draw_context *draw )
}
}
- for (i = 0; i < draw->pt.nr_vertex_buffers; i++) {
- pipe_resource_reference(&draw->pt.vertex_buffer[i].buffer, NULL);
- }
+ for (i = 0; i < draw->pt.nr_vertex_buffers; i++)
+ pipe_vertex_buffer_unreference(&draw->pt.vertex_buffer[i]);
/* Not so fast -- we're just borrowing this at the moment.
*
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index bb08f665064..203572010fc 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -352,9 +352,9 @@ create_jit_vertex_buffer_type(struct gallivm_state *gallivm,
LLVMTypeRef elem_types[4];
LLVMTypeRef vb_type;
- elem_types[0] =
- elem_types[1] = LLVMInt32TypeInContext(gallivm->context);
- elem_types[2] =
+ elem_types[0] = LLVMInt16TypeInContext(gallivm->context);
+ elem_types[1] = LLVMInt8TypeInContext(gallivm->context);
+ elem_types[2] = LLVMInt32TypeInContext(gallivm->context);
elem_types[3] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0);
vb_type = LLVMStructTypeInContext(gallivm->context, elem_types,
@@ -363,8 +363,12 @@ create_jit_vertex_buffer_type(struct gallivm_state *gallivm,
(void) target; /* silence unused var warning for non-debug build */
LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, stride,
target, vb_type, 0);
- LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer_offset,
+ LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, is_user_buffer,
target, vb_type, 1);
+ LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer_offset,
+ target, vb_type, 2);
+ LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer.resource,
+ target, vb_type, 3);
LP_CHECK_STRUCT_SIZE(struct pipe_vertex_buffer, target, vb_type);
@@ -1699,6 +1703,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
vbuffer_ptr = LLVMBuildGEP(builder, vbuffers_ptr, &vb_index, 1, "");
vb_info = LLVMBuildGEP(builder, vb_ptr, &vb_index, 1, "");
vb_stride[j] = draw_jit_vbuffer_stride(gallivm, vb_info);
+ vb_stride[j] = LLVMBuildZExt(gallivm->builder, vb_stride[j],
+ LLVMInt32TypeInContext(context), "");
vb_buffer_offset = draw_jit_vbuffer_offset(gallivm, vb_info);
map_ptr[j] = draw_jit_dvbuffer_map(gallivm, vbuffer_ptr);
buffer_size = draw_jit_dvbuffer_size(gallivm, vbuffer_ptr);
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index 57c9e72c04c..a968be01f81 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -172,7 +172,7 @@ enum {
lp_build_struct_get(_gallivm, _ptr, 0, "stride")
#define draw_jit_vbuffer_offset(_gallivm, _ptr) \
- lp_build_struct_get(_gallivm, _ptr, 1, "buffer_offset")
+ lp_build_struct_get(_gallivm, _ptr, 2, "buffer_offset")
enum {
DRAW_JIT_DVBUFFER_MAP = 0,