@@ -18,12 +18,13 @@ static void Main(string[] args)
1818 //----------
1919 //more easier
2020 //----------
21- Ispc_SimpleExample ( ) ;
21+ // Ispc_SimpleExample();
2222 //Ispc_SortExample();
2323 //Ispc_MandelbrotExample();
2424 //Ispc_MandlebrotTaskExample();
25+ Ispc_DeferredShading ( ) ;
2526#if DEBUG
26- // dbugParseHeader(@"D:\projects\ispc-14-dev-windows\examples_build\ deferred\kernels_ispc.h");
27+ // dbugParseHeader(@"deferred\kernels_ispc.h");
2728#endif
2829 }
2930#if DEBUG
@@ -39,20 +40,21 @@ static void dbugParseHeader(string filename)
3940 static void Ispc_SimpleExample ( )
4041 {
4142 //from: ispc-14-dev-windows\examples\simple
42- string dllName = "simple.dll " ;
43+ string module = "simple" ;
4344
4445 //TODO: check if we need to rebuild or not
45- bool rebuild = NeedRebuild ( "simple" ) ;
46+ bool rebuild = NeedRebuild ( module ) ;
4647 if ( rebuild )
4748 {
4849 IspcBuilder ispcBuilder = new IspcBuilder ( ) ;
4950 ispcBuilder . ProjectConfigKind = BridgeBuilder . Vcx . ProjectConfigKind . Debug ;
50- ispcBuilder . IspcFilename = "simple .ispc";
51- ispcBuilder . AutoCsTargetFile = "..\\ ..\\ AutoGenBinders\\ simple .cs" ;
51+ ispcBuilder . IspcFilename = module + " .ispc";
52+ ispcBuilder . AutoCsTargetFile = $ "..\\ ..\\ AutoGenBinders\\ { module } .cs";
5253 ispcBuilder . RebuildLibraryAndAPI ( ) ;
5354
5455 }
5556
57+ string dllName = module + ".dll" ;
5658 IntPtr dllPtr = LoadLibrary ( dllName ) ;
5759
5860 if ( dllPtr == IntPtr . Zero ) { throw new NotSupportedException ( ) ; }
@@ -92,15 +94,15 @@ static void Ispc_SortExample()
9294 {
9395 //from: ispc-14-dev-windows\examples\sort
9496
95- string dllName = "sort.dll " ;
97+ string module = "sort" ;
9698 //TODO: check if we need to rebuild or not
97- bool rebuild = NeedRebuild ( "sort" ) ;
99+ bool rebuild = NeedRebuild ( module ) ;
98100 if ( rebuild )
99101 {
100102 IspcBuilder ispcBuilder = new IspcBuilder ( ) ;
101103 ispcBuilder . ProjectConfigKind = BridgeBuilder . Vcx . ProjectConfigKind . Debug ;
102- ispcBuilder . IspcFilename = "sort .ispc";
103- ispcBuilder . AutoCsTargetFile = "..\\ ..\\ AutoGenBinders\\ sort .cs" ;
104+ ispcBuilder . IspcFilename = module + " .ispc";
105+ ispcBuilder . AutoCsTargetFile = $ "..\\ ..\\ AutoGenBinders\\ { module } .cs";
104106
105107 string currentDir = Directory . GetCurrentDirectory ( ) ;
106108 ispcBuilder . AdditionalInputItems = new string [ ]
@@ -111,6 +113,7 @@ static void Ispc_SortExample()
111113
112114 }
113115
116+ string dllName = module + ".dll" ;
114117 IntPtr dllPtr = LoadLibrary ( dllName ) ;
115118
116119 if ( dllPtr == IntPtr . Zero ) { throw new NotSupportedException ( ) ; }
@@ -142,15 +145,15 @@ static void Ispc_SortExample()
142145 static void Ispc_MandelbrotExample ( )
143146 {
144147 //from: ispc-14-dev-windows\examples\mandelbrot
145- string dllName = "mandelbrot.dll" ;
148+ string module = "mandelbrot.dll" ;
146149 //TODO: check if we need to rebuild or not
147- bool rebuild = NeedRebuild ( "mandelbrot" ) ;
150+ bool rebuild = NeedRebuild ( module ) ;
148151 if ( rebuild )
149152 {
150153 IspcBuilder ispcBuilder = new IspcBuilder ( ) ;
151154 ispcBuilder . ProjectConfigKind = BridgeBuilder . Vcx . ProjectConfigKind . Debug ;
152- ispcBuilder . IspcFilename = "mandelbrot .ispc";
153- ispcBuilder . AutoCsTargetFile = "..\\ ..\\ AutoGenBinders\\ mandelbrot .cs" ;
155+ ispcBuilder . IspcFilename = module + " .ispc";
156+ ispcBuilder . AutoCsTargetFile = $ "..\\ ..\\ AutoGenBinders\\ { module } .cs";
154157
155158 string currentDir = Directory . GetCurrentDirectory ( ) ;
156159 ispcBuilder . AdditionalInputItems = new string [ ]
@@ -160,6 +163,7 @@ static void Ispc_MandelbrotExample()
160163 ispcBuilder . RebuildLibraryAndAPI ( ) ;
161164 }
162165
166+ string dllName = module + ".dll" ;
163167 IntPtr dllPtr = LoadLibrary ( dllName ) ;
164168
165169 if ( dllPtr == IntPtr . Zero ) { throw new NotSupportedException ( ) ; }
@@ -187,15 +191,16 @@ static void Ispc_MandelbrotExample()
187191 static void Ispc_MandlebrotTaskExample ( )
188192 {
189193 //from: ispc-14-dev-windows\examples\mandelbrot
190- string dllName = "mandelbrot_task.dll" ;
194+
191195 //TODO: check if we need to rebuild or not
192- bool rebuild = NeedRebuild ( "mandelbrot_task" ) ;
196+ string module = "mandelbrot_task" ;
197+ bool rebuild = NeedRebuild ( module ) ;
193198 if ( rebuild )
194199 {
195200 IspcBuilder ispcBuilder = new IspcBuilder ( ) ;
196201 ispcBuilder . ProjectConfigKind = BridgeBuilder . Vcx . ProjectConfigKind . Debug ;
197- ispcBuilder . IspcFilename = "mandelbrot_task .ispc";
198- ispcBuilder . AutoCsTargetFile = "..\\ ..\\ AutoGenBinders\\ mandelbrot_task .cs" ;
202+ ispcBuilder . IspcFilename = module + " .ispc";
203+ ispcBuilder . AutoCsTargetFile = $ "..\\ ..\\ AutoGenBinders\\ { module } .cs";
199204
200205 string currentDir = Directory . GetCurrentDirectory ( ) ;
201206 ispcBuilder . AdditionalInputItems = new string [ ]
@@ -205,6 +210,7 @@ static void Ispc_MandlebrotTaskExample()
205210 ispcBuilder . RebuildLibraryAndAPI ( ) ;
206211 }
207212
213+ string dllName = module + ".dll" ;
208214 IntPtr dllPtr = LoadLibrary ( dllName ) ;
209215
210216 if ( dllPtr == IntPtr . Zero ) { throw new NotSupportedException ( ) ; }
@@ -230,7 +236,33 @@ static void Ispc_MandlebrotTaskExample()
230236 SaveManelbrotImage ( buffer , width , height , "test_mandelbrot_task.png" ) ;
231237 }
232238
239+ static void Ispc_DeferredShading ( )
240+ {
241+ //from ispc-14-dev-windows\examples\deferred\kernels.ispc
242+
243+ //TODO: check if we need to rebuild or not
244+ string module = "kernels" ;
245+ bool rebuild = NeedRebuild ( module ) ;
246+ if ( rebuild )
247+ {
248+ IspcBuilder ispcBuilder = new IspcBuilder ( ) ;
249+ ispcBuilder . ProjectConfigKind = BridgeBuilder . Vcx . ProjectConfigKind . Debug ;
250+ ispcBuilder . IspcFilename = module + ".ispc" ;
251+ ispcBuilder . AutoCsTargetFile = $ "..\\ ..\\ AutoGenBinders\\ { module } .cs";
252+
253+ string currentDir = Directory . GetCurrentDirectory ( ) ;
254+ ispcBuilder . AdditionalInputItems = new string [ ]
255+ {
256+ currentDir + "\\ tasksys.cpp" ,
257+ currentDir + "\\ deferred.h"
258+ } ;
259+ ispcBuilder . RebuildLibraryAndAPI ( ) ;
260+ }
233261
262+ string dllName = module + ".dll" ;
263+ IntPtr dllPtr = LoadLibrary ( dllName ) ;
264+ if ( dllPtr == IntPtr . Zero ) { throw new NotSupportedException ( ) ; }
265+ }
234266
235267 static void SaveManelbrotImage ( int [ ] buffer , int width , int height , string filename )
236268 {
0 commit comments