Benchmark Trilinear interpolation

I do a performance benchmark with a function that takes a lot of CPU time in my game which is a Trilinear interpolation function. This is used while generating voxel world.

Results (x86) for a 256x256x256 voxels array on Core I7 at 3.60 Ghz :

  • BlitzMax (GCC -O3 optimization) -> 112 ms
  • C++ (VS2015) -> 203 ms
  • C# .Net Native  -> 203 ms
  • BlitzMax (GCC -O2 optimization) -> 215 ms
  • C# .NetCore v1.0 RC2 -> 281 ms
  • C# .NetFramework v4.6.1 -> 422 ms
  • C# Mono 4.4 (-O=All) -> 625 ms

.Net Native for windows universal application is as fast as C++ and OpenSource .NetCore is very promising…

GCC is faster than MS compiler for my bench, good news for BlitzMax.

Source Code Here

 

BlitzMax NG

I still remember my many programs (games, demos …) coded in BlitzBasic in my room on my Amiga 1200 in 90s.

Mark Sibly, author of BlitzBasic language, made a PC version around 2000 and made several variants thereafter (Blitz3D, BlitzPlus, BlitzMax …) which allowed to easily make 2D and 3D on Windows, Linux and OSX.

Since 2011 he works on a cross-platform variant Monkey-X and put BlitzMax open source.

Brucey took over the code to create BlitzMax NG (NexT Generation).

The most interesting modification was made on the compiler of BlitzMax sources that not generates x86 ASM as the original, but C code!
C sources are then compiled and optimized by the GCC.

This solution allows extremely efficient code, my first bench shows that it is faster than my C# code, you can directly integrate third-party sources written in C and also port applications to other platforms like android, ios, raspberry…

There is a lots of modules for use SDL, OpenGL, LUA .. directly from BlitzMax and you can create your own modules.

The executable does not depend on framework, that allows small size executables.

Memory management with garbage collector can be stopped (see. GCSuspend ())  which is very useful when we develop games to remove lags triggered by the GC.

But we can also manage the memory as in C with MemAlloc(), MemFree() … and has also pointers access.

You’ll understand that this new version is very interesting and really oriented for video games development.

Missing now is to have a more modern editor with IntelliSense, snipped … and most advanced debugger as PureBasic or MonoDevelop:-)

If you want to try it :

http://www.bmx-ng.com/main/about/

 

Updated MonoGame Shader Editor and create voxel shader with it .

I have added textures slots into MonoGame shader editor !

MGShaderEditor2

I have created my first shader for CubeShooter game with my new editor.

Grid on voxels is now computed directly into pixels shader.

//Vertex Shader
 //Compute UV
float3 n = abs(input.vertexNormal.xyz);
float2 tileUV = float2( dot(n,  input.vertexPosition.zxx),
dot(-n, input.vertexPosition.yzy));
  output.uv0 = tileUV * 0.5;
//Pixel Shader
float4 tex0Color = tex2D(TexSamplerSlot0, input.uv0);
return (tex0Color * xGridPower) + input.color;

 

It’s sure now I gain enormously times with this editor.

VoxelGrid