summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_state_fs.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-10-13 14:28:51 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-10-13 15:25:15 +0100
commit95c18abb03b035c6fa029cd0852f07fb39951279 (patch)
tree04f0217e693b6ce202cc10e6bdeff78bace20f36 /src/gallium/drivers/llvmpipe/lp_state_fs.c
parentf9995b30756140724f41daf963fa06167912be7f (diff)
llvmpipe: Unbreak Z32_FLOAT.
Z32_FLOAT uses <4 x float> as intermediate/destination type, instead of <4 x i32>. The necessary bitcasts got removed with commit 5b7eb868fde98388d80601d8dea39e679828f42f Also use depth/stencil type and build contexts consistently, and make the depth pointer argument a ordinary <i8 *>, to catch this sort of issues in the future (and also to pave way for Z16 and Z32_FLOAT_S8_X24 support).
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_state_fs.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 6872f2d3c6..c09835635d 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -325,8 +325,9 @@ generate_fs(struct llvmpipe_context *lp,
&zs_value,
!simple_shader);
- if (depth_mode & EARLY_DEPTH_WRITE)
- LLVMBuildStore(builder, zs_value, depth_ptr);
+ if (depth_mode & EARLY_DEPTH_WRITE) {
+ lp_build_depth_write(builder, zs_format_desc, depth_ptr, zs_value);
+ }
}
lp_build_interp_soa_update_inputs(interp, i);
@@ -379,8 +380,9 @@ generate_fs(struct llvmpipe_context *lp,
&zs_value,
!simple_shader);
/* Late Z write */
- if (depth_mode & LATE_DEPTH_WRITE)
- LLVMBuildStore(builder, zs_value, depth_ptr);
+ if (depth_mode & LATE_DEPTH_WRITE) {
+ lp_build_depth_write(builder, zs_format_desc, depth_ptr, zs_value);
+ }
}
else if ((depth_mode & EARLY_DEPTH_TEST) &&
(depth_mode & LATE_DEPTH_WRITE))
@@ -534,6 +536,7 @@ generate_fragment(struct llvmpipe_context *lp,
LLVMValueRef blend_mask;
LLVMValueRef function;
LLVMValueRef facing;
+ const struct util_format_description *zs_format_desc;
unsigned num_fs;
unsigned i;
unsigned chan;
@@ -579,7 +582,7 @@ generate_fragment(struct llvmpipe_context *lp,
arg_types[5] = LLVMPointerType(fs_elem_type, 0); /* dadx */
arg_types[6] = LLVMPointerType(fs_elem_type, 0); /* dady */
arg_types[7] = LLVMPointerType(LLVMPointerType(blend_vec_type, 0), 0); /* color */
- arg_types[8] = LLVMPointerType(fs_int_vec_type, 0); /* depth */
+ arg_types[8] = LLVMPointerType(LLVMInt8Type(), 0); /* depth */
arg_types[9] = LLVMInt32Type(); /* mask_input */
arg_types[10] = LLVMPointerType(LLVMInt32Type(), 0);/* counter */
@@ -648,12 +651,16 @@ generate_fragment(struct llvmpipe_context *lp,
sampler = lp_llvm_sampler_soa_create(key->sampler, context_ptr);
/* loop over quads in the block */
+ zs_format_desc = util_format_description(key->zsbuf_format);
+
for(i = 0; i < num_fs; ++i) {
- LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+ LLVMValueRef depth_offset = LLVMConstInt(LLVMInt32Type(),
+ i*fs_type.length*zs_format_desc->block.bits/8,
+ 0);
LLVMValueRef out_color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS];
LLVMValueRef depth_ptr_i;
- depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &index, 1, "");
+ depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &depth_offset, 1, "");
generate_fs(lp, shader, key,
builder,