const struct util_format_description *src_fmt,
struct lp_type src_type,
struct lp_type dst_type,
- LLVMValueRef* src,
- unsigned num_srcs,
- LLVMValueRef* dst)
+ LLVMValueRef* src, // and dst
+ unsigned num_srcs)
{
+ LLVMValueRef *dst = src;
LLVMBuilderRef builder = gallivm->builder;
struct lp_type blend_type;
struct lp_type mem_type;
unsigned pixels = 16 / num_srcs;
bool is_arith;
- memcpy(dst, src, sizeof(LLVMValueRef) * num_srcs);
-
lp_mem_type_from_format_desc(src_fmt, &mem_type);
lp_blend_type_from_format_desc(src_fmt, &blend_type);
const struct util_format_description *src_fmt,
struct lp_type src_type,
struct lp_type dst_type,
- LLVMValueRef* src,
- unsigned num_srcs,
- LLVMValueRef* dst)
+ LLVMValueRef* src, // and dst
+ unsigned num_srcs)
{
+ LLVMValueRef* dst = src;
unsigned i, j, k;
struct lp_type mem_type;
struct lp_type blend_type;
unsigned pixels = 16 / num_srcs;
bool is_arith;
- memcpy(dst, src, sizeof(LLVMValueRef) * num_srcs);
-
lp_mem_type_from_format_desc(src_fmt, &mem_type);
lp_blend_type_from_format_desc(src_fmt, &blend_type);
mask_type.length = fs_type.length;
/* Compute the alignment of the destination pointer in bytes */
+#if 0
dst_alignment = (block_width * out_format_desc->block.bits + 7)/(out_format_desc->block.width * 8);
+#else
+ /* FIXME -- currently we're fetching pixels one by one, instead of row by row */
+ dst_alignment = (1 * out_format_desc->block.bits + 7)/(out_format_desc->block.width * 8);
+#endif
/* Force power-of-two alignment by extracting only the least-significant-bit */
dst_alignment = 1 << (ffs(dst_alignment) - 1);
/* Resource base and stride pointers are aligned to 16 bytes, so that's the maximum alignment we can guarantee */
/*
* Blending
*/
- convert_to_blend_type(gallivm, out_format_desc, dst_type, row_type, dst, src_count, dst);
+ convert_to_blend_type(gallivm, out_format_desc, dst_type, row_type, dst, src_count);
for (i = 0; i < src_count; ++i) {
dst[i] = lp_build_blend_aos(gallivm,
pad_inline ? 4 : dst_channels);
}
- convert_from_blend_type(gallivm, out_format_desc, row_type, dst_type, dst, src_count, dst);
+ convert_from_blend_type(gallivm, out_format_desc, row_type, dst_type, dst, src_count);
/* Split the blend rows back to memory rows */
if (dst_count > src_count) {
if (llvmpipe->fs == fs)
return;
- draw_flush(llvmpipe->draw);
-
llvmpipe->fs = (struct lp_fragment_shader *) fs;
draw_bind_fragment_shader(llvmpipe->draw,
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
struct pipe_resource *constants = cb ? cb->buffer : NULL;
- unsigned size;
- const void *data;
-
- if (cb && cb->user_buffer) {
- constants = llvmpipe_user_buffer_create(pipe->screen,
- (void *) cb->user_buffer,
- cb->buffer_size,
- PIPE_BIND_CONSTANT_BUFFER);
- }
-
- size = constants ? constants->width0 : 0;
- data = constants ? llvmpipe_resource_data(constants) : NULL;
assert(shader < PIPE_SHADER_TYPES);
- assert(index < PIPE_MAX_CONSTANT_BUFFERS);
+ assert(index < Elements(llvmpipe->constants[shader]));
- if(llvmpipe->constants[shader][index] == constants)
- return;
+ /* note: reference counting */
+ util_copy_constant_buffer(&llvmpipe->constants[shader][index], cb);
- draw_flush(llvmpipe->draw);
+ if (shader == PIPE_SHADER_VERTEX ||
+ shader == PIPE_SHADER_GEOMETRY) {
+ /* Pass the constants to the 'draw' module */
+ const unsigned size = cb ? cb->buffer_size : 0;
+ const ubyte *data;
- /* note: reference counting */
- pipe_resource_reference(&llvmpipe->constants[shader][index], constants);
+ if (constants) {
+ data = (ubyte *) llvmpipe_resource_data(constants);
+ }
+ else if (cb && cb->user_buffer) {
+ data = (ubyte *) cb->user_buffer;
+ }
+ else {
+ data = NULL;
+ }
+
+ if (data)
+ data += cb->buffer_offset;
- if(shader == PIPE_SHADER_VERTEX ||
- shader == PIPE_SHADER_GEOMETRY) {
draw_set_mapped_constant_buffer(llvmpipe->draw, shader,
index, data, size);
}
/* alpha.ref_value is passed in jit_context */
key->flatshade = lp->rasterizer->flatshade;
- if (lp->active_query_count) {
+ if (lp->active_occlusion_query) {
key->occlusion_count = TRUE;
}