[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12560] branches/soc-2007-joeedh/source/ blender: A work-in-progress commit.
Joseph Eagar
joeedh at gmail.com
Mon Nov 12 02:10:58 CET 2007
Revision: 12560
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12560
Author: joeedh
Date: 2007-11-12 02:10:58 +0100 (Mon, 12 Nov 2007)
Log Message:
-----------
A work-in-progress commit.
Modified Paths:
--------------
branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h
branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h
branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_dsm.c
branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_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/dsm.c
branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c
branches/soc-2007-joeedh/source/blender/render/intern/source/shadeoutput.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-11-11 22:54:14 UTC (rev 12559)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_dsm.h 2007-11-12 01:10:58 UTC (rev 12560)
@@ -82,10 +82,11 @@
ListBase *buckets;
} DSMBuffer;
+//32 8 2
#define MAX_SAMPLELAYERS 32
-#define DSM_FINAL_TILESIZE 52
+#define DSM_FINAL_TILESIZE 32
#define DSM_TILE_MEMARENASIZE (1<<18)
-#define DSM_AASAMPLES 2
+#define DSM_AASAMPLES (G.rt>8 ? 1 : (G.rt==0 ? 1 : G.rt))
#define DSM_AAWIDTH 3.0f
/*little bit smaller memarena buffer size for the final diced
Modified: branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h 2007-11-11 22:54:14 UTC (rev 12559)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h 2007-11-12 01:10:58 UTC (rev 12560)
@@ -251,8 +251,12 @@
void TCS_fseek(TCS_File *file, unsigned long offset, int origin);
void TCS_fflush(TCS_File *file);
-#define BASSERT(eval) if (!(eval)) printf("\nassert \"%s\" in file:\n%s\n on line %d failed.\n\n", #eval, __FILE__, __LINE__)
-
#define TCSDEBUG
+#ifdef TCSDEBUG
+ #define BASSERT(eval) if (!(eval)) printf("\nassert \"%s\" in file:\n%s\n on line %d failed.\n\n", #eval, __FILE__, __LINE__)
+#else
+ #define BASSERT(eval)
+#endif
+
#endif /* BKE_TILE_H */
Modified: branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c 2007-11-11 22:54:14 UTC (rev 12559)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c 2007-11-12 01:10:58 UTC (rev 12560)
@@ -192,6 +192,7 @@
{
TCS_TileBuffer *buf = vbuf;
TCS_TilePool *pool = NULL;
+ int olock;
BASSERT(tile);
if (!tile) return NULL;
@@ -203,9 +204,16 @@
then it was never cached in the first place*/
if (!pool) return tile;
+ /*ensure the tile is locked while running the memcacher*/
+ olock = tile->locked;
+ tile->locked = 1;
+
/*run memory cacher on the pool if necassary*/
if (pool->memused > pool->maxmem) _TCS_RunCacher(pool, 0);
-
+
+ /*restore old lock value for the tile*/
+ tile->locked = olock;
+
if (tile->is_compressed != 0) {
//printf("comp: %p, file: %p, tile->compressed_memfile, tile->file);
@@ -298,8 +306,8 @@
BASSERT(vbuf);
tile = buf->getTile(buf, x, y, z);
+ tile->locked = 1;
_TCS_UncacheTile(vbuf, tile);
- tile->locked = 1;
/*unlock threads*/
BLI_unlock_thread(LOCK_CACHER);
@@ -421,7 +429,7 @@
/*calculate tile filesize on disk, if its not already calculated. . .*/
if (tile->len == 0) tile->len = tile->type->getTileLen(tile);
- if (tile->is_compressed) printf("YEEK! Tried to twice compress tile! %d\n", tile->is_compressed);
+ if (tile->is_compressed) printf("YEEK! Tried to twice compress a tile! %d\n", tile->is_compressed);
/*subtract memory used for this tile*/
mem -= tile->mem_used;
Modified: branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_dsm.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_dsm.c 2007-11-11 22:54:14 UTC (rev 12559)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_dsm.c 2007-11-12 01:10:58 UTC (rev 12560)
@@ -65,10 +65,12 @@
func = BLI_memarena_alloc(tile->arena, sizeof(DSMFunction));
func->samples = sample = BLI_memarena_alloc(tile->arena, sizeof(DSMLayerSample)*totsamples);
func->totsamples = totsamples;
+
+ TCS_fread(&func->zmin, sizeof(int), 1, file);
+ TCS_fread(&func->zmax, sizeof(int), 1, file);
for (i=0; i<totsamples; i++, sample++) {
- TCS_fread(&value, sizeof(unsigned short), 1, file);
- sample->value = ((float)value)/65535.0f;
+ TCS_fread(&sample->value, sizeof(float), 1, file);
TCS_fread(&sample->orig_totsamples, sizeof(unsigned short), 1, file);
TCS_fread(&sample->depth, sizeof(unsigned int), 1, file);
}
@@ -130,10 +132,14 @@
int i;
unsigned short value;
DSMLayerSample *sample = func->samples;
+
+ TCS_fwrite(&func->zmin, sizeof(int), 1, file);
+ TCS_fwrite(&func->zmax, sizeof(int), 1, file);
for (i=0; i<func->totsamples; i++, sample++) {
- value = sample->value * 65535.0f;
- TCS_fwrite(&value, sizeof(unsigned short), 1, file);
+ //value = sample->value * 65535.0f;
+ //TCS_fwrite(&value, sizeof(unsigned short), 1, file);
+ TCS_fwrite(&sample->value, sizeof(float), 1, file);
TCS_fwrite(&sample->orig_totsamples, sizeof(signed short), 1, file);
TCS_fwrite(&sample->depth, sizeof(int), 1, file);
}
@@ -143,7 +149,7 @@
{
DSMTile *self = (DSMTile*) tself;
unsigned long fend;
- int x, y, j, tot=0, num;
+ int x, y, zero=0, tot=0, tottst, num, pos;
BASSERT(tself);
BASSERT(file);
@@ -151,8 +157,9 @@
num = DSM_MAGICNUM;
TCS_fwrite(&num, sizeof(int), 1, file);
- /*seek (well write anyway) past total number of saved pixels int,
+ /*seek (well write) past total number of saved pixels int,
this is properly written later*/
+ pos = TCS_ftell(file);
TCS_fwrite(&tot, sizeof(int), 1, file);
BASSERT(file->error_occured == 0);
@@ -162,8 +169,6 @@
if (self->r_rect[y*self->sizex+x] || self->g_rect[y*self->sizex+x] || self->b_rect[y*self->sizex+x]) {
tot++;
- j = 0;
-
TCS_fwrite(&x, sizeof(int), 1, file);
TCS_fwrite(&y, sizeof(int), 1, file);
@@ -172,17 +177,17 @@
if (self->r_rect[y*self->sizex+x]) {
TCS_fwrite(&self->r_rect[y*self->sizex+x]->totsamples, sizeof(int), 1, file);
dsm_savefunction(file, self->r_rect[y*self->sizex+x]);
- } else TCS_fwrite(&j, sizeof(int), 1, file);
+ } else TCS_fwrite(&zero, sizeof(int), 1, file);
if (self->g_rect[y*self->sizex+x]) {
TCS_fwrite(&self->g_rect[y*self->sizex+x]->totsamples, sizeof(int), 1, file);
dsm_savefunction(file, self->g_rect[y*self->sizex+x]);
- } else TCS_fwrite(&j, sizeof(int), 1, file);
+ } else TCS_fwrite(&zero, sizeof(int), 1, file);
if (self->b_rect[y*self->sizex+x]) {
TCS_fwrite(&self->b_rect[y*self->sizex+x]->totsamples, sizeof(int), 1, file);
dsm_savefunction(file, self->b_rect[y*self->sizex+x]);
- } else TCS_fwrite(&j, sizeof(int), 1, file);
+ } else TCS_fwrite(&zero, sizeof(int), 1, file);
BASSERT(0 == file->error_occured);
}
@@ -193,17 +198,18 @@
/*seek back to first int and write total pixels*/
fend = TCS_ftell(file);
- TCS_fseek(file, curpos+sizeof(int), SEEK_SET);
- BASSERT(file->error_occured == 0);
+ TCS_fseek(file, pos, SEEK_SET);
TCS_fwrite(&tot, sizeof(int), 1, file);
+
BASSERT(file->error_occured == 0);
#ifdef TCSDEBUG
printf("pre read tot: %d\n", tot);
#endif
- TCS_fseek(file, curpos+sizeof(int), SEEK_SET);
- TCS_fread(&tot, sizeof(int), 1, file);
+ TCS_fseek(file, pos, SEEK_SET);
+ TCS_fread(&tottst, sizeof(int), 1, file);
+ BASSERT(tottst == tot);
/*seek back to tile end position*/
TCS_fseek(file, fend, SEEK_SET);
@@ -230,15 +236,15 @@
for (y=0; y<tile->sizey; y++) {
found = 0;
if (tile->r_rect[y*tile->sizex+x]) {
- len += sizeof(int) + (sizeof(short)*2+sizeof(int))*tile->r_rect[y*tile->sizex+x]->totsamples;
+ len += sizeof(int)*3 + (sizeof(short)+sizeof(float)+sizeof(int))*tile->r_rect[y*tile->sizex+x]->totsamples;
found++;
}
if (tile->g_rect[y*tile->sizex+x]) {
- len += sizeof(int) + (sizeof(short)*2+sizeof(int))*tile->g_rect[y*tile->sizex+x]->totsamples;
+ len += sizeof(int)*3 + (sizeof(short)+sizeof(float)+sizeof(int))*tile->g_rect[y*tile->sizex+x]->totsamples;
found++;
}
if (tile->b_rect[y*tile->sizex+x]) {
- len += sizeof(int) + (sizeof(short)*2+sizeof(int))*tile->b_rect[y*tile->sizex+x]->totsamples;
+ len += sizeof(int)*3 + (sizeof(short)+sizeof(float)+sizeof(int))*tile->b_rect[y*tile->sizex+x]->totsamples;
found++;
}
Modified: branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_types.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_types.h 2007-11-11 22:54:14 UTC (rev 12559)
+++ branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_types.h 2007-11-12 01:10:58 UTC (rev 12560)
@@ -145,6 +145,7 @@
#define LA_DEEPBUF_MAXSAMPLEWID 16
#define LA_DEEPBUF_MAXSAMPLES 256
+#define LA_DEEPBUF_MAXLAYERS 32
/* bufflag, auto clipping */
#define LA_SHADBUF_AUTO_START 1
Modified: branches/soc-2007-joeedh/source/blender/render/intern/include/zbuf.h
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/include/zbuf.h 2007-11-11 22:54:14 UTC (rev 12559)
+++ branches/soc-2007-joeedh/source/blender/render/intern/include/zbuf.h 2007-11-12 01:10:58 UTC (rev 12560)
@@ -96,7 +96,7 @@
void (*zbuflinefunc)(struct ZSpan *, int, float *, float *);
/*used by dsm to get linear Z*/
- void (*hoco_to_zco)(struct ZSpan *zspan, float *zco, float *hoco);
+ void (*hoco_to_zco)(struct ZSpan *zspan, float clipsta, float clipend, float *zco, float *hoco);
void *hoco_data;
/* maximum difference between depths of pixel samples.
@@ -108,23 +108,30 @@
#define MAX_VLACKBUCKET 4096
+typedef struct VlrEntry {
+ VlakRen *vlak;
+ int index;
+} VlrEntry;
+
typedef struct VlakBucket {
struct VlakBucket *next, *prev;
- VlakRen *nodes[MAX_VLACKBUCKET];
+ VlrEntry nodes[MAX_VLACKBUCKET];
int used; /*number of pointers currently in use*/
} VlakBucket;
/* exported to shadbuf.c */
-void zbufclip4(struct Render *re, struct ZSpan *zspan, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4);
+void zbufclip4(struct Render *re, struct ZSpan *zspan, float clipsta, float clipend, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4);
void zbuf_free_span(struct ZSpan *zspan);
/* to rendercore.c */
void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float) );
/* exported to edge render... */
-void zbufclip(struct Render *re, struct ZSpan *zspan, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list