[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14463] trunk/blender: This is an expanded patch of this:

Kent Mein mein at cs.umn.edu
Fri Apr 18 21:11:09 CEST 2008


Revision: 14463
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14463
Author:   sirdude
Date:     2008-04-18 21:10:03 +0200 (Fri, 18 Apr 2008)

Log Message:
-----------
This is an expanded patch of this:

[#8067] external texture plugin thread-safe modifications
Submitted By: David Anderson (davywavy)

It makes it so the "result" array is passed in, instead of a global var.
I expanded the patch so it will play nice with older plugins  that are not
thread safe as well.

I also updated the existing plugins in the release, so they are thread safe.

---------------  What do people think of this.... ------------------
This should maybe be talked about in the functionality board or something,
but what do people think of adding in default texture/sequence plugins.
or making a seperate tree like lib for plugins.

The reason I ask is we have had a couple of upgrades to the plugin system.
(supporting float buffers for sequencer, and this one for textures)

http://www.cs.umn.edu/~mein/blender/plugins does not store revisions of 
plugins I just make sure they work with the latest version.  This is
getting messy.  I haven't upgraded a lot of them to use floats (I know,
I'm lazy, and now this will also make modifications to the plugins)
It would be nice to have some of the standard ones under revision control.

We also seem to be having an explosion of platforms supported.  It would
be nice to have platform maintainers compiling plugins as well for releases.
(Its getting to be more work for me to keep up with things...)

I'll go back to my corner now and be quite. ;)

Kent

Modified Paths:
--------------
    trunk/blender/release/plugins/texture/clouds2.c
    trunk/blender/release/plugins/texture/tiles.c
    trunk/blender/source/blender/blenkernel/BKE_plugin_types.h
    trunk/blender/source/blender/blenkernel/intern/texture.c
    trunk/blender/source/blender/blenpluginapi/externdef.h
    trunk/blender/source/blender/blenpluginapi/iff.h
    trunk/blender/source/blender/blenpluginapi/plugin.h
    trunk/blender/source/blender/render/intern/source/texture.c

Modified: trunk/blender/release/plugins/texture/clouds2.c
===================================================================
--- trunk/blender/release/plugins/texture/clouds2.c	2008-04-18 18:25:11 UTC (rev 14462)
+++ trunk/blender/release/plugins/texture/clouds2.c	2008-04-18 19:10:03 UTC (rev 14463)
@@ -73,7 +73,7 @@
 
 float cfra;
 
-int plugin_tex_doit(int, Cast*, float*, float*, float*);
+int plugin_tex_doit(int, Cast*, float*, float*, float*, float*);
 void plugin_instance_init(Cast*);
 
 /* ******************** Fixed functions ***************** */
@@ -114,7 +114,7 @@
 	info->varstr= varstr;
 
 	info->init= plugin_init;
-	info->tex_doit=  (TexDoit) plugin_tex_doit;
+	info->tex_doit= (TexDoit) plugin_tex_doit;
 	info->callback= plugin_but_changed;
 	info->instance_init= (void (*)(void *)) plugin_instance_init;
 }
@@ -122,7 +122,7 @@
 /* ********************* the texture ******************** */
 
 
-int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt)
+int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt, float *result)
 {
 	float val = 0.0;
 	float a = 1.0;

Modified: trunk/blender/release/plugins/texture/tiles.c
===================================================================
--- trunk/blender/release/plugins/texture/tiles.c	2008-04-18 18:25:11 UTC (rev 14462)
+++ trunk/blender/release/plugins/texture/tiles.c	2008-04-18 19:10:03 UTC (rev 14463)
@@ -62,7 +62,7 @@
 
 float cfra;
 
-int plugin_tex_doit(int, Cast *, float *, float *, float *);
+int plugin_tex_doit(int, Cast *, float *, float *, float *, float *);
 void plugin_instance_init(Cast*);
 
 /* ******************** Fixed functions ***************** */
@@ -150,7 +150,7 @@
 	return retval;
 }
 
-int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt)
+int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt, float *result)
 {
 	float xwave, ywave;
 	

Modified: trunk/blender/source/blender/blenkernel/BKE_plugin_types.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_plugin_types.h	2008-04-18 18:25:11 UTC (rev 14462)
+++ trunk/blender/source/blender/blenkernel/BKE_plugin_types.h	2008-04-18 19:10:03 UTC (rev 14463)
@@ -36,7 +36,8 @@
 
 struct ImBuf;
 
-typedef	int (*TexDoit)(int, void*, float*, float*, float*);
+typedef	int (*TexDoitold)(int stype, void *cast, float *texvec, float *dxt, float *dyt);
+typedef	int (*TexDoit)(int stype, void *cast, float *texvec, float *dxt, float *dyt, float *result );
 typedef void (*SeqDoit)(void*, float, float, int, int,
 						struct ImBuf*, struct ImBuf*,
 						struct ImBuf*, struct ImBuf*);
@@ -60,7 +61,7 @@
 
 	void (*init)(void);
 	void (*callback)(int);
-	TexDoit tex_doit;
+	void (*tex_doit)(void *);
 	SeqDoit seq_doit;
 	void (*instance_init)(void *);
 } PluginInfo;

Modified: trunk/blender/source/blender/blenkernel/intern/texture.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/texture.c	2008-04-18 18:25:11 UTC (rev 14462)
+++ trunk/blender/source/blender/blenkernel/intern/texture.c	2008-04-18 19:10:03 UTC (rev 14463)
@@ -126,7 +126,7 @@
 		
 		if (version != 0) {
 			pit->version= version();
-			if (pit->version>=2 && pit->version<=5) {
+			if( pit->version >= 2 && pit->version <=6) {
 				int (*info_func)(PluginInfo *);
 				PluginInfo *info= (PluginInfo*) MEM_mallocN(sizeof(PluginInfo), "plugin_info"); 
 

Modified: trunk/blender/source/blender/blenpluginapi/externdef.h
===================================================================
--- trunk/blender/source/blender/blenpluginapi/externdef.h	2008-04-18 18:25:11 UTC (rev 14462)
+++ trunk/blender/source/blender/blenpluginapi/externdef.h	2008-04-18 19:10:03 UTC (rev 14463)
@@ -33,11 +33,14 @@
 #ifdef WIN32
  #ifdef PLUGIN_INTERN
   #define LIBEXPORT	__declspec(dllexport)
+  #define LIBIMPORT	__declspec(dllexport)
  #else 
-  #define LIBEXPORT	extern __declspec(dllimport)
+  #define LIBEXPORT	__declspec(dllexport)
+  #define LIBIMPORT	extern __declspec(dllimport)
  #endif
 #elif !defined(WIN32)
 	#define LIBEXPORT extern
+	#define LIBIMPORT extern
 #endif
 
 #endif /* _EXTERNDEF_H */

Modified: trunk/blender/source/blender/blenpluginapi/iff.h
===================================================================
--- trunk/blender/source/blender/blenpluginapi/iff.h	2008-04-18 18:25:11 UTC (rev 14462)
+++ trunk/blender/source/blender/blenpluginapi/iff.h	2008-04-18 19:10:03 UTC (rev 14463)
@@ -167,49 +167,49 @@
 	struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /**< MipMap levels, a series of halved images */
 } ImBuf;
 
-LIBEXPORT struct ImBuf *allocImBuf(short,short,uchar,uint,uchar);
-LIBEXPORT struct ImBuf *dupImBuf(struct ImBuf *);
-LIBEXPORT void freeImBuf(struct ImBuf*);
+LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint,uchar);
+LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *);
+LIBIMPORT void freeImBuf(struct ImBuf*);
 
-LIBEXPORT short converttocmap(struct ImBuf* ibuf);
+LIBIMPORT short converttocmap(struct ImBuf* ibuf);
 
-LIBEXPORT short saveiff(struct ImBuf *,char *,int);
+LIBIMPORT short saveiff(struct ImBuf *,char *,int);
 
-LIBEXPORT struct ImBuf *loadiffmem(int *,int);
-LIBEXPORT struct ImBuf *loadifffile(int,int);
-LIBEXPORT struct ImBuf *loadiffname(char *,int);
-LIBEXPORT struct ImBuf *testiffname(char *,int);
+LIBIMPORT struct ImBuf *loadiffmem(int *,int);
+LIBIMPORT struct ImBuf *loadifffile(int,int);
+LIBIMPORT struct ImBuf *loadiffname(char *,int);
+LIBIMPORT struct ImBuf *testiffname(char *,int);
 
-LIBEXPORT struct ImBuf *onehalf(struct ImBuf *);
-LIBEXPORT struct ImBuf *onethird(struct ImBuf *);
-LIBEXPORT struct ImBuf *halflace(struct ImBuf *);
-LIBEXPORT struct ImBuf *half_x(struct ImBuf *);
-LIBEXPORT struct ImBuf *half_y(struct ImBuf *);
-LIBEXPORT struct ImBuf *double_x(struct ImBuf *);
-LIBEXPORT struct ImBuf *double_y(struct ImBuf *);
-LIBEXPORT struct ImBuf *double_fast_x(struct ImBuf *);
-LIBEXPORT struct ImBuf *double_fast_y(struct ImBuf *);
+LIBIMPORT struct ImBuf *onehalf(struct ImBuf *);
+LIBIMPORT struct ImBuf *onethird(struct ImBuf *);
+LIBIMPORT struct ImBuf *halflace(struct ImBuf *);
+LIBIMPORT struct ImBuf *half_x(struct ImBuf *);
+LIBIMPORT struct ImBuf *half_y(struct ImBuf *);
+LIBIMPORT struct ImBuf *double_x(struct ImBuf *);
+LIBIMPORT struct ImBuf *double_y(struct ImBuf *);
+LIBIMPORT struct ImBuf *double_fast_x(struct ImBuf *);
+LIBIMPORT struct ImBuf *double_fast_y(struct ImBuf *);
 
-LIBEXPORT int ispic(char *);
+LIBIMPORT int ispic(char *);
 
-LIBEXPORT void dit2(struct ImBuf *, short, short);
-LIBEXPORT void dit0(struct ImBuf *, short, short);
+LIBIMPORT void dit2(struct ImBuf *, short, short);
+LIBIMPORT void dit0(struct ImBuf *, short, short);
 
-LIBEXPORT struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
-LIBEXPORT struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
-LIBEXPORT struct ImBuf *scalefieldImBuf(struct ImBuf *, short, short);
-LIBEXPORT struct ImBuf *scalefastfieldImBuf(struct ImBuf *, short, short);
+LIBIMPORT struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
+LIBIMPORT struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
+LIBIMPORT struct ImBuf *scalefieldImBuf(struct ImBuf *, short, short);
+LIBIMPORT struct ImBuf *scalefastfieldImBuf(struct ImBuf *, short, short);
 
-LIBEXPORT void de_interlace(struct ImBuf *ib);
-LIBEXPORT void interlace(struct ImBuf *ib);
-LIBEXPORT void gamwarp(struct ImBuf *ibuf, double gamma);
+LIBIMPORT void de_interlace(struct ImBuf *ib);
+LIBIMPORT void interlace(struct ImBuf *ib);
+LIBIMPORT void gamwarp(struct ImBuf *ibuf, double gamma);
 
-LIBEXPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf, 
+LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf, 
 	int destx, int desty, int srcx, int srcy, int width, int height);
 
-LIBEXPORT void IMB_rectfill(struct ImBuf *drect, float col[4]);
-LIBEXPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
-LIBEXPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2);
+LIBIMPORT void IMB_rectfill(struct ImBuf *drect, float col[4]);
+LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
+LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2);
 
 #endif /* IFF_H */
 

Modified: trunk/blender/source/blender/blenpluginapi/plugin.h
===================================================================
--- trunk/blender/source/blender/blenpluginapi/plugin.h	2008-04-18 18:25:11 UTC (rev 14462)
+++ trunk/blender/source/blender/blenpluginapi/plugin.h	2008-04-18 19:10:03 UTC (rev 14463)
@@ -36,9 +36,10 @@
 #include "util.h"
 #include "floatpatch.h"
 
-#define B_PLUGIN_VERSION	5
+#define B_PLUGIN_VERSION	6
 
-typedef	int (*TexDoit)(int, void*, float*, float*, float*);
+typedef	int (*TexDoit)(int, void*, float*, float*, float*, float*);
+typedef	int (*TexDoitold)(int, void*, float*, float*, float*);
 typedef void (*SeqDoit)(void*, float, float, int, int, ImBuf*, ImBuf*, ImBuf*, ImBuf*);
 
 typedef struct VarStruct {
@@ -66,9 +67,9 @@
 	void (*instance_init)(void *);
 } PluginInfo;
 
-int plugin_tex_getversion(void);
-int plugin_seq_getversion(void);
-void plugin_getinfo(PluginInfo *);
+LIBEXPORT int plugin_tex_getversion(void);
+LIBEXPORT int plugin_seq_getversion(void);
+LIBEXPORT void plugin_getinfo(PluginInfo *);
 
 /* *************** defines for button types ************** */
 
@@ -90,14 +91,14 @@
 /* *************** API functions ******************** */
 
 	/* derived from the famous Perlin noise */
-LIBEXPORT float hnoise(float noisesize, float x, float y, float z);
+LIBIMPORT float hnoise(float noisesize, float x, float y, float z);
 	/* the original Perlin noise */
-LIBEXPORT float hnoisep(float noisesize, float x, float y, float z);
+LIBIMPORT float hnoisep(float noisesize, float x, float y, float z);
 
 	/* soft turbulence */
-LIBEXPORT float turbulence(float noisesize, float x, float y, float z, int depth);
+LIBIMPORT float turbulence(float noisesize, float x, float y, float z, int depth);
 	/* hard turbulence */
-LIBEXPORT float turbulence1(float noisesize, float x, float y, float z, int depth);
+LIBIMPORT float turbulence1(float noisesize, float x, float y, float z, int depth);
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list