summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_bld_depth.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-08-22 22:26:55 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-08-29 09:21:40 +0100
commit5811ed87d732101ab8cfbd087bc99d8c6c963f30 (patch)
treed0167369e347bd22ccb6be7d668d5fd878593d5d /src/gallium/drivers/llvmpipe/lp_bld_depth.c
parent3f36f4b0519f7a568d6de9919de1001880ab5c8a (diff)
llvmpipe: Add a bunch of comments.
Description/rationale/to-do items, while I still remember them...
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_depth.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_depth.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
index 118c7c5213..6018feda1c 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
@@ -26,8 +26,34 @@
**************************************************************************/
/**
+ * @file
* Depth/stencil testing to LLVM IR translation.
*
+ * To be done accurately/efficiently the depth/stencil test must be done with
+ * the same type/format of the depth/stencil buffer, which implies massaging
+ * the incoming depths to fit into place. Using a more straightforward
+ * type/format for depth/stencil values internally and only convert when
+ * flushing would avoid this, but it would most likely result in depth fighting
+ * artifacts.
+ *
+ * We are free to use a different pixel layout though. Since our basic
+ * processing unit is a quad (2x2 pixel block) we store the depth/stencil
+ * values tiled, a quad at time. That is, a depth buffer containing
+ *
+ * Z11 Z12 Z13 Z14 ...
+ * Z21 Z22 Z23 Z24 ...
+ * Z31 Z32 Z33 Z34 ...
+ * Z41 Z42 Z43 Z44 ...
+ * ... ... ... ... ...
+ *
+ * will actually be stored in memory as
+ *
+ * Z11 Z12 Z21 Z22 Z13 Z14 Z23 Z24 ...
+ * Z31 Z32 Z41 Z42 Z33 Z34 Z43 Z44 ...
+ * ... ... ... ... ... ... ... ... ...
+ *
+ * FIXME: Code generate stencil test
+ *
* @author Jose Fonseca <jfonseca@vmware.com>
*/
@@ -42,6 +68,9 @@
#include "lp_bld_depth.h"
+/**
+ * Return a type appropriate for depth/stencil testing.
+ */
union lp_type
lp_depth_type(const struct util_format_description *format_desc,
unsigned length)
@@ -79,6 +108,9 @@ lp_depth_type(const struct util_format_description *format_desc,
}
+/**
+ * Depth test.
+ */
void
lp_build_depth_test(LLVMBuilderRef builder,
const struct pipe_depth_state *state,