Hello, there is a file missing : BKE_dsm.h<br><br>Regards.<br><br><div><span class="gmail_quote">2007/7/2, Joseph Eagar <<a href="mailto:joeedh@gmail.com">joeedh@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Revision: 11140<br> <a href="http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11140">http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11140
</a><br>Author: joeedh<br>Date: 2007-07-02 09:42:18 +0200 (Mon, 02 Jul 2007)<br><br>Log Message:<br>-----------<br>This commit is because my harddrive is being a little<br>weird (or perhaps notepad2 was acting up, or window's
<br>disk cache was being quirky, I'm not sure).<br><br>This has the initial tile cache interface. The tile<br>system is fully generic, and includes an API for<br>manipulating both files and memory buffers. This API<br>
nearly completely duplicates the stdlib file library.<br><br>The tiling system does not work yet, though. In<br>fact DSM in general is now broken by this. So don't<br>update until I get things working again. :)<br><br>
Modified Paths:<br>--------------<br> branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h<br> branches/soc-2007-joeedh/source/blender/render/intern/include/shadbuf.h<br> branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c
<br> branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c<br> branches/soc-2007-joeedh/source/blender/render/intern/source/zbuf.c<br><br>Added Paths:<br>-----------<br> branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
<br> branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_dsm.c<br> branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c<br> branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_image.c
<br><br>Removed Paths:<br>-------------<br> branches/soc-2007-joeedh/source/blender/blenkernel/intern/cache.c<br><br>Modified: branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h<br>===================================================================
<br>--- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h 2007-07-01 14:12:10 UTC (rev 11139)<br>+++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_tile.h 2007-07-02 07:42:18 UTC (rev 11140)
<br>@@ -71,17 +71,18 @@<br> typedef struct TCS_File {<br> struct TCS_File *next, *prev;<br> int is_mem;<br>+ int error_occured;<br> void *ptr; /*can be either a FILE handle or a piece of memory.*/
<br>+ char filename[256];<br><br> /*remember to make sure these are updated, even if using<br> a real FILE file instead of a memory block!*/<br>- unsigned long length, cursor;<br>+ unsigned long length, cursor, totallocated;
<br> } TCS_File;<br><br> typedef struct TCS_Tile {<br> struct TCS_Tile *next, *prev;<br>- void (*loadFromCache)(struct TCS_Tile *self, TCS_File *file,<br>- unsigned long start);<br>
+ void (*loadFromCache)(struct TCS_Tile *self, TCS_File *file);<br><br> /*should free client data after writing to disk, but not free<br> the TCS_Tile itself.<br>@@ -91,57 +92,70 @@<br> unsigned int (*saveToCache)(struct TCS_Tile *self, TCS_File *file,
<br> unsigned long current_position);<br><br>+ /*returns amount of memory the tile is using, in bytes*/<br>+ unsigned int (*getTileMem)(struct TCS_Tile *self);<br>+ void *(*getTilePixel)(struct TCS_Tile *self, int x, int y, int z);
<br>+<br> int is_cached; /*is 1 if either (or both) is_compressed or is_written is 1.*/<br><br> /*-privae variables, do not touch!-*/<br> int is_compressed, is_written, mem_used;<br>- TCS_File *file;
<br>- int filepos;<br>+ TCS_File *file, *compressed_memfile;<br>+<br>+ /*filepos is the cached tile position. this must *never* be messed up!*/<br>+ int filepos, len; /*len is for caching the tile len, to avoid constantly recalculating the size*/
<br><br> struct TCS_TilePool *pool;<br> struct TCS_TileBuffer *buffer; /*parent buffer*/<br> } TCS_Tile;<br><br>-/*List of files used by a tile pool*/<br>-typedef struct TCS_FileList {<br>- ListBase open_files; /*open files*/
<br>- unsigned long long len; /*length of all files, in bytes.*/<br>-} TCS_FileList;<br>-<br> /*pools manage tiles, but the the tiles themselves belong to TCS_TileBuffers.<br> This is a generic container structure, so it can hold any tile from
<br> any buffer, of any buffer type.*/<br> typedef struct TCS_TilePool {<br> struct TCS_TilePool *next, *prev;<br> ListBase tiles;<br>+<br>+ ListBase open_files; /*open files*/<br>+ unsigned long long len; /*length of all files, in bytes.*/
<br>+ int totfiles, curid; /*curid is used for naming files.*/<br>+ int max_file_len;<br><br> /*tiles which have been compressed, but not written to disk yet.*/<br> ListBase compressed_tiles;<br>
<br>- unsigned int tottiles;<br>+ //unsigned int tottiles;<br> unsigned long maxmem;<br> unsigned long memused; /*total amount of memory used at the moment.*/<br>+ unsigned long grace_period; /*margin, used to (hopefully) cache tiles in groups instead
<br>+ of one at a time.*/<br> } TCS_TilePool;<br><br> typedef struct TCS_TileBuffer {<br> struct TCS_TileBuffer *next, *prev;<br> struct TCS_TileBuffer *(*newBuffer)(int tilesizex, int tilesizey,
<br>- int sizex, int sizey);<br>-<br>- /*should make sure tiles reference cachepool.*/<br>- void (*makeTiles)(struct TCS_TileBuffer *self, TCS_TilePool *cachepool);<br>
-<br>+ int sizex, int sizey, void *data);<br> /*only frees direct data*/<br> void (*freeBuffer)(struct TCS_TileBuffer *self);<br>-<br>+<br> /*as may dimensions can be used as needed, others can just be passed in
<br> as 0.*/<br>- void (*getTile)(struct TCS_TileBuffer *self, int x, int y);<br>+ void *(*getTile)(struct TCS_TileBuffer *self, int x, int y, int z);<br>+ int (*getTileSizeX)(struct TCS_TileBuffer *self);
<br>+ int (*getTileSizeY)(struct TCS_TileBuffer *self);<br>+ int (*getSizeX)(struct TCS_TileBuffer *self);<br>+ int (*getSizeY)(struct TCS_TileBuffer *self);<br>+ unsigned int flags;<br><br>- /*should be set by TCS_MakePool, not the newBuffer funcion*/
<br>+ /*should be set by TCS_MakePool, not the newBuffer function*/<br> TCS_TilePool *pool;<br> } TCS_TileBuffer;<br><br>+/*TCS_TileBuffer .flags member flags*/<br>+/*Read only buffer means once a tile is written once, we
<br>+ never have to write it to disk again.*/<br>+#define TCS_READONLY 1<br>+<br> /*buffer type templates*/<br><br> /*I imagine these next three should each use a common set of implementation<br>@@ -159,11 +173,12 @@<br>
TCS_TilePool *TCS_MakePool(unsigned long max_mem_bytes);<br> void TCS_FreePool(TCS_TilePool *pool);<br><br>-TCS_TileBuffer *TCS_MakeBuffer(TCS_TileBuffer *type, void *data);<br>-void TCS_FreeBuffer(TCS_TileBuffer *type);
<br>-<br>+TCS_TileBuffer *TCS_MakeBuffer(TCS_TileBuffer *type, int tilesizex, int tilesizey,<br>+ int sizex, int sizey, void *data);<br>+void TCS_InitBuffer(TCS_TileBuffer *type, void *buffer);<br>+void TCS_FreeBuffer(void *buf);
<br> /*as may dimensions can be used as needed, others can just be passed in as 0.*/<br>-void *TCS_GetTile(TCS_TileBuffer *type, int x, int y, int z);<br>+void *TCS_GetTile(void *buf, int x, int y, int z);<br><br> /*hrm, not sure if this next one will be needed, its possible it can
<br> all be done from within TCS_GetTile(), perhaps even progressively*/<br>@@ -174,17 +189,28 @@<br><br> /*all these file functions (other then TCS_wrapmem) have the same interface<br> as their stdlib stdio counterparts.*/
<br>-void TCS_fread(void *ptr, unsigned long size, unsigned long count,<br>+<br>+int TCS_fread(void *ptr, unsigned long size, unsigned long count,<br> TCS_File *file);<br>-void TCS_fwrite(void *ptr, unsigned long size, unsigned long count,
<br>+int TCS_fwrite(void *ptr, unsigned long size, unsigned long count,<br> TCS_File *file);<br><br> /*these are actually private functions, never use them in cache implementations!*/<br>+<br>+/*closes a file, then deletes it if its a disk file. like TCS_fclose it frees file*/
<br>+void TCS_fdelete(TCS_File *file);<br>+<br>+TCS_File *TCS_openmemfile(int initial_size);<br> TCS_File *TCS_fopen(const char *path, const char *mode);<br>-TCS_File *TCS_fclose(const char *path, const char *mode);<br>+<br>
+/*closes a file and frees file (and memory buffers if its a mem file)*/<br>+void TCS_fclose(TCS_File *file);<br> TCS_File *TCS_wrapmem(void *mem, int len);<br> unsigned int TCS_ftell(TCS_File *file);<br> void TCS_rewind(TCS_File *file);
<br> void TCS_fseek(TCS_File *file, unsigned long offset, int origin);<br>+void TCS_fflush(TCS_File *file);<br><br>- #endif /* BKE_TILE_H */<br>+#define BASSERT(eval) if (!(eval)) printf("\nassert \"%s\" in file:\n%s\n on line %d failed.\n\n", #eval, __FILE__, __LINE__)
<br>+<br>+#endif /* BKE_TILE_H */<br><br>Deleted: branches/soc-2007-joeedh/source/blender/blenkernel/intern/cache.c<br>===================================================================<br>--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/cache.c 2007-07-01 14:12:10 UTC (rev 11139)
<br>+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/cache.c 2007-07-02 07:42:18 UTC (rev 11140)<br>@@ -1,214 +0,0 @@<br>-#if 0<br>-/**<br>- * $Id: cache.c 10648 2007-05-03 21:37:52Z blendix $<br>- *<br>- * ***** BEGIN GPL LICENSE BLOCK *****
<br>- *<br>- * This program is free software; you can redistribute it and/or<br>- * modify it under the terms of the GNU General Public License<br>- * as published by the Free Software Foundation; either version 2<br>- * of the License, or (at your option) any later version.
<br>- *<br>- * This program is distributed in the hope that it will be useful,<br>- * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
- * GNU General Public License for more details.<br>- *<br>- * You should have received a copy of the GNU General Public License<br>- * along with this program; if not, write to the Free Software Foundation,<br>- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<br>- *<br>- * The Original Code is Copyright (C) 2001-2002 by Joseph Eagar.<br>- *<br>- * Contributor(s): Joseph Eagar<br>- *<br>- * ***** END GPL/BL DUAL LICENSE BLOCK *****<br>- */<br>-<br>-#include "BKE_global.h"
<br>-#include "BKE_main.h"<br>-#include "BKE_tile.h"<br>-<br>-#include <stdio.h><br>-#include <stdlib.h><br>-#include <string.h><br>-<br>-/*Deep shadow buffer cache implementation*/<br>
-typedef struct DSMBuf {<br>- TCS_TileBuffer buf;<br>- int tottilex, tottiley;<br>- int tilesizex, tilesizey;<br>- int sizex, sizey;<br>- DSMTile *tiles;<br>-} DSMBuf;<br>-<br>-typedef struct DSMTile {
<br>- TCS_Tile tile;<br>- void *dsmdata;<br>- int x, y;<br>-} DSMTile;<br>-<br>-static void dsm_loadtile(TCS_Tile *self, FILE *file, unsigned long start)<br>-{<br>-}<br>-<br>-static void dsm_savetile(TCS_Tile *self, FILE *file, unsigned long curpos)
<br>-{<br>-}<br>-<br>-static void dsm_maketiles(TCS_TileBuffer *self, TCS_TilePool *pool)<br>-{<br>- DSMTile *tile;<br>- DSMBuf *buf = (DSMBuf*)self;<br>- int i;<br>-<br>- for (i=0, tile=buf->tiles; i<buf->tottilex*buf->tottiley; buf++, i++) {
<br>- buf->tile.loadFromCache = dsm_loadtile;<br>- buf->tile.saveToCache = dsm_savetile;<br>- buf->pool = pool;<br>- buf->buffer = self;<br>- }<br>
-}<br>-<br>-static void dsm_freebuffer(TCS_TileBuffer *self)<br>-{<br>- DSMBuf *buf = (DSMBuf*)self;<br>- MEM_freeN(buf->tiles);<br>-<br>- /*FIXMEGREP: ToDo: figure out if actual deep shadow map data<br>
- should be freed here or not<br>- */<br>-}<br>-<br>-static void dsm_gettile(TCS_TileBuffer *self, int x, int y)<br>-{<br>- DSMBuf *buf = (DSMBuf*)self;<br>- return buf->tiles[y*buf->sizex+x];
<br>-}<br>-<br>-static struct TCS_TileBuffer *dsm_newbuffer(int tsizex, tsizey, sizex, sizey)<br>-{<br>- DSMBuf *buf = MEM_callocN(sizeof(DSMBuf), "DSMBuf");<br>-<br>- buf->tottilex = sizex / tsizex;
<br>- buf->tottiley = sizey / tsizey;<br>-<br>- buf->tilesizex = tsizex;<br>- buf->tilesizey = tsizey;<br>-<br>- buf->sizex = sizex;<br>- buf->sizey = sizey;<br>-<br>- buf->tiles = MEM_callocN(sizeof(DSMTile)*buf->tottilex*buf->tottiley, "DSMTile array");
<br>-}<br>-<br>-TCS_TileBuffer TCS_DeepShadowBuffer = {<br>- NULL, NULL,<br>- dsm_newbuffer,<br>- dsm_maketiles,<br>- dsm_freebuffer,<br>- dsm_gettile,<br>- 0<br>-};<br>-<br>-/*Image buffer implementation*/
<br>-<br>-#define TYPE_UBYTE1 0<br>-#define TYPE_UBYTE3 1<br>-#define TYPE_UBYTE4 2<br>-#define TYPE_FLOAT1 3<br>-#define TYPE_FLOAT3 4<br>-#define TYPE_FLOAT4 5<br>-<br>-int type_totchannels[] = {<br>- 1,
<br>- 3,<br>- 4,<br>- 1,<br>- 3,<br>- 4<br>-};<br>-<br>-int type_sizes[] = {<br>- 1,<br>- 3,<br>- 4,<br>- sizeof(float),<br>- sizeof(float)*3,<br>- sizeof(float)*4)
<br>-};<br>-<br>-#define GETARRAY_PIXPTR(width, x, y, arr, type, channels) ((type*)&((char*)arr)[(sizeof(type)*y*sizex+sizeof(type)*x)*sizeof(type)*channels])<br>-<br>-/*<br>- Utility inline function to fetch a pixel from any image buffer type,
<br>- convert it to a float if necassary, then copy the result into a float<br>- array called varname. Note that the code limits what's copied to<br>- sizeof(varname).<br>-<br>- heh, this would make a wonderful inline function, I'm sure, but I have no idea how
<br><br>@@ Diff output truncated at 10240 characters. @@<br><br>_______________________________________________<br>Bf-blender-cvs mailing list<br><a href="mailto:Bf-blender-cvs@blender.org">Bf-blender-cvs@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/bf-blender-cvs">http://lists.blender.org/mailman/listinfo/bf-blender-cvs</a><br></blockquote></div><br>