[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11192] branches/soc-2007-joeedh/source/ blender: The evil bug where everything had to be transparent is now gone
Joseph Eagar
joeedh at gmail.com
Sun Jul 8 00:19:13 CEST 2007
Revision: 11192
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11192
Author: joeedh
Date: 2007-07-08 00:18:55 +0200 (Sun, 08 Jul 2007)
Log Message:
-----------
The evil bug where everything had to be transparent is now gone
(eh I might've already committed that part of it, can't remember).
I fixed that by making zbuf.c not use any globals, though I did
end up having to to the "R = *re" trick that was being used before
to something that was causing random crashes (I would've just
started out with that, however it wasn't still I de-globaled zbuf.c
that I found out about it).
In terms of major bugs, biggest one is that alpha still isn't being
properly accumulated. Also for some rendering having samples set to
1 in the lamp settings causes the shadows to not render :/
The code now also renders in >= 256 sized tiles, then dices to 35
sized tiles (necassary for caching), this speeds things up a bit.
One thing to note for users: If you set the rt button to something
high, like 500 or 600 it'll go a lot faster. This controls the threshold for an internal optimization; higher values are faster/take less disk space for caching, but are also potentially less accurate.
Modified Paths:
--------------
branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h
branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c
branches/soc-2007-joeedh/source/blender/render/intern/include/render_types.h
branches/soc-2007-joeedh/source/blender/render/intern/include/zbuf.h
branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c
branches/soc-2007-joeedh/source/blender/render/intern/source/rendercore.c
branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c
branches/soc-2007-joeedh/source/blender/render/intern/source/zbuf.c
Modified: branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h 2007-07-07 17:33:46 UTC (rev 11191)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h 2007-07-07 22:18:55 UTC (rev 11192)
@@ -10,6 +10,26 @@
int depth;
} DSMSample;
+#define MAX_DSMLAYERS 16
+
+/*ok heres how it works. A "layer"
+ is the total number of samples going from light
+ energy 1.0 to 0.0, then repeating.*/
+typedef struct DSMLayerArray {
+ /*complete total number of samples in
+ each layer*/
+ int totsamples;
+ int totlayers;
+ int zmin, zmax;
+ int layeroffsets[MAX_DSMLAYERS];
+
+ /*consequtive array of samples.
+ store DSMSample(depth is length of layer),
+ DSMSamples. . ., DSMSample (depth is length of
+ layer), DSMSamples. . ., etc.*/
+ DSMSample *samples;
+} DSMLayerArray;
+
/*Each tile has its own memarena to work better with caching.*/
typedef struct DSMTile {
TCS_Tile tile;
Modified: branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c 2007-07-07 17:33:46 UTC (rev 11191)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c 2007-07-07 22:18:55 UTC (rev 11192)
@@ -107,6 +107,10 @@
for (ty=0; ty<buf->getSizeY(buf)/buf->getTileSizeY(buf); ty++) {
for (tx=0; tx<buf->getSizeX(buf)/buf->getTileSizeX(buf); tx++) {
tile = buf->getTile(buf, tx, ty, 0);
+ if (!tile->pool) {
+ printf("tile lacks pool!\n");
+ continue;
+ }
BASSERT(tile);
if (tile->is_compressed && ! tile->is_written) BLI_remlink(&tile->pool->compressed_tiles, tile);
else if (tile->is_compressed == 0 && tile->is_written == 0) BLI_remlink(&tile->pool->tiles, tile);
Modified: branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c 2007-07-07 17:33:46 UTC (rev 11191)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c 2007-07-07 22:18:55 UTC (rev 11192)
@@ -236,144 +236,144 @@
/*Old code. Copied it from an example, but then discovered zlib's compress2
and decompress functions.*/
-/* modified zpipe.c: example of proper use of zlib's inflate() and deflate()
- Not copyrighted -- provided to the public domain
- Modified version, 29 June 2004 by Joseph Eagar, originally by Mark Adler.*/
-
-/* Version history:
- 1.0 30 Oct 2004 First version
- 1.1 8 Nov 2004 Add void casting for unused return values
- Use switch statement for inflate() return values
- 1.2 9 Nov 2004 Add assertions to document zlib guarantees
- 1.3 6 Apr 2005 Remove incorrect assertion in inf()
- 1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions
+/* modified zpipe.c: example of proper use of zlib's inflate() and deflate()
+ Not copyrighted -- provided to the public domain
+ Modified version, 29 June 2004 by Joseph Eagar, originally by Mark Adler.*/
+
+/* Version history:
+ 1.0 30 Oct 2004 First version
+ 1.1 8 Nov 2004 Add void casting for unused return values
+ Use switch statement for inflate() return values
+ 1.2 9 Nov 2004 Add assertions to document zlib guarantees
+ 1.3 6 Apr 2005 Remove incorrect assertion in inf()
+ 1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions
Avoid some compiler warnings for input and output buffers
- 1.5 29 June 2007 fork for using with the blender tiling system by Joseph Eagar
+ 1.5 29 June 2007 fork for using with the blender tiling system by Joseph Eagar
*/
-#define CHUNK 24*1024
-/* Compress from file source to file dest until EOF on source.
- def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
- allocated for processing, Z_STREAM_ERROR if an invalid compression
- level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
- version of the library linked do not match, or Z_ERRNO if there is
- an error reading or writing the files. */
-static int TCS_deflate(TCS_File *source, TCS_File *dest, int level)
-{
- int ret, flush;
- unsigned have;
- z_stream strm;
- unsigned char in[CHUNK];
- unsigned char out[CHUNK];
-
- /* allocate deflate state */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- ret = deflateInit(&strm, level);
- if (ret != Z_OK)
- return ret;
-
- /* compress until end of file */
- do {
+#define CHUNK 24*1024
+/* Compress from file source to file dest until EOF on source.
+ def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
+ allocated for processing, Z_STREAM_ERROR if an invalid compression
+ level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
+ version of the library linked do not match, or Z_ERRNO if there is
+ an error reading or writing the files. */
+static int TCS_deflate(TCS_File *source, TCS_File *dest, int level)
+{
+ int ret, flush;
+ unsigned have;
+ z_stream strm;
+ unsigned char in[CHUNK];
+ unsigned char out[CHUNK];
+
+ /* allocate deflate state */
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ ret = deflateInit(&strm, level);
+ if (ret != Z_OK)
+ return ret;
+
+ /* compress until end of file */
+ do {
strm.avail_in = TCS_fread(in, 1, CHUNK, source);
-
- if (source->error_occured) {
- (void)deflateEnd(&strm);
- return Z_ERRNO;
- }
- flush = source->cursor==source->length ? Z_FINISH : Z_NO_FLUSH;
- strm.next_in = in;
-
- /* run deflate() on input until output buffer not full, finish
- compression if all of source has been read in */
- do {
- strm.avail_out = CHUNK;
- strm.next_out = out;
- ret = deflate(&strm, flush); /* no bad return value */
+
+ if (source->error_occured) {
+ (void)deflateEnd(&strm);
+ return Z_ERRNO;
+ }
+ flush = source->cursor==source->length ? Z_FINISH : Z_NO_FLUSH;
+ strm.next_in = in;
+
+ /* run deflate() on input until output buffer not full, finish
+ compression if all of source has been read in */
+ do {
+ strm.avail_out = CHUNK;
+ strm.next_out = out;
+ ret = deflate(&strm, flush); /* no bad return value */
BASSERT(ret != Z_STREAM_ERROR); /* state not clobbered */
-
- have = CHUNK - strm.avail_out;
- if (TCS_fwrite(out, 1, have, dest) != have || dest->error_occured) {
- (void)deflateEnd(&strm);
- return Z_ERRNO;
- }
- } while (strm.avail_out == 0);
- BASSERT(strm.avail_in == 0); /* all input will be used */
-
- /* done when last data in file processed */
- } while (flush != Z_FINISH);
- BASSERT(ret == Z_STREAM_END); /* stream will be complete */
-
- /* clean up and return */
- (void)deflateEnd(&strm);
- return Z_OK;
-}
-
-/* Decompress from file source to file dest until stream ends or EOF.
- inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
- allocated for processing, Z_DATA_ERROR if the deflate data is
- invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
- the version of the library linked do not match, or Z_ERRNO if there
+
+ have = CHUNK - strm.avail_out;
+ if (TCS_fwrite(out, 1, have, dest) != have || dest->error_occured) {
+ (void)deflateEnd(&strm);
+ return Z_ERRNO;
+ }
+ } while (strm.avail_out == 0);
+ BASSERT(strm.avail_in == 0); /* all input will be used */
+
+ /* done when last data in file processed */
+ } while (flush != Z_FINISH);
+ BASSERT(ret == Z_STREAM_END); /* stream will be complete */
+
+ /* clean up and return */
+ (void)deflateEnd(&strm);
+ return Z_OK;
+}
+
+/* Decompress from file source to file dest until stream ends or EOF.
+ inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
+ allocated for processing, Z_DATA_ERROR if the deflate data is
+ invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
+ the version of the library linked do not match, or Z_ERRNO if there
is an error reading or writing the files. */
-static int TCS_inflate(TCS_File *source, TCS_File *dest, int len)
-{
- int ret, i=0;
- unsigned have;
- z_stream strm;
- unsigned char in[CHUNK];
- unsigned char out[CHUNK];
-
- /* allocate inflate state */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = 0;
- strm.next_in = Z_NULL;
- ret = inflateInit(&strm);
- if (ret != Z_OK)
- return ret;
-
- /* decompress until deflate stream ends or end of file */
- do {
+static int TCS_inflate(TCS_File *source, TCS_File *dest, int len)
+{
+ int ret, i=0;
+ unsigned have;
+ z_stream strm;
+ unsigned char in[CHUNK];
+ unsigned char out[CHUNK];
+
+ /* allocate inflate state */
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ strm.avail_in = 0;
+ strm.next_in = Z_NULL;
+ ret = inflateInit(&strm);
+ if (ret != Z_OK)
+ return ret;
+
+ /* decompress until deflate stream ends or end of file */
+ do {
strm.avail_in = TCS_fread(in, 1, CHUNK, source);
i += strm.avail_in;
if (i >= len) strm.avail_in -= i - len - 1;
-
- if (source->error_occured) {
- (void)inflateEnd(&strm);
- return Z_ERRNO;
- }
- if (strm.avail_in == 0)
- break;
- strm.next_in = in;
-
- /* run inflate() on input until output buffer not full */
- do {
- strm.avail_out = CHUNK;
- strm.next_out = out;
- ret = inflate(&strm, Z_NO_FLUSH);
- BASSERT(ret != Z_STREAM_ERROR); /* state not clobbered */
- switch (ret) {
- case Z_NEED_DICT:
- ret = Z_DATA_ERROR; /* and fall through */
- case Z_DATA_ERROR:
- case Z_MEM_ERROR:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list