Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DavidKarlas

Pages: [1]
1
DotNet / Re: Transform speedup
« on: May 29, 2013, 04:29:30 am »
This is why I didn't go straigth for pull request and made forum topic instead. So you could evaluate performance boost vs "problems" and check source code before commiting. Btw that class is copy paste ready just needs massive replace MyTransformable to Transformable.

Well i hope you add  this because im rly not fan of having fork :)

2
DotNet / Re: Transform speedup
« on: May 28, 2013, 09:18:24 pm »
Well from what i see Transform struct is already pure C# struct but it just calls C++ functions to mainpulate it. I don't think its decleared inside C++. But instead always passed from C# to C++ when needed.

3
DotNet / Transform speedup
« on: May 28, 2013, 09:00:55 pm »
Hi all,

i started making 2D engine based on SFML.Net and i came to point where i started handling Mouse events.
Soon i ended up in Transform.cs file and saw that is calling C++ implementation. And i was wondering how costy is Managed <-> Unmanaged barrier for something like TransformPoint so i started checking and found out following:

Transform TransformPoint:1111
MyTransform TransformPoint:119
Transform TransformRect:1312
MyTransform TransformRect:419
Transform Multiply(Identity):1603
MyTransform Multiply(Identity):401
Transform Multiply:553
MyTransform Multiply:545
Transform Rotate:1823
MyTransform Rotate:1043
Transform Translate:1389
MyTransform Translate:262
Transform Scale:524
MyTransform Scale:513
Transform Inverse:1913
MyTransform Inverse:897

Program used for comparison:
https://gist.github.com/DavidKarlas/c3abb1fcb5a26fd1c5e4

MyTransform:
https://gist.github.com/DavidKarlas/931b090e2c8a05c52aa9

What i found out during testing this code is that C# is slower then C++ when it comes to wierd float values like mutiplying NaN or Infinity values. That is why Scale and Multiply are so close. Because after few loops Infinity numbers appear and C# goes slower but that probably wont happend in real case but speedup wont be better then 4x(Multiply(Identity)) either.

Most important to me is TransformPoint 10x speed up because i will have alot of nested drawables and will have to calculate mouse hit point.

I also tested what this means in general rendering...
I created 188.000 small sprites with random rotation, scale and positions(doesn't matter but wanted abit more complex matrix) and i came from 16 fps to 20fps just by switching Transform to MyTransform inside SFML.net.

I also noticed that GetInverse and Rotate could use double instead of float for better accurarcy without any speed loss.

Laurent is there any chance you could take a look at this and implement it?

4
DotNet / Re: RenderWindow fails on Linux
« on: May 18, 2013, 12:19:10 pm »
Hello again,

i found what was problem. It was wrong costructor being called.
I made fork and pull request https://github.com/SFML/SFML.Net/pull/18.

Regards,
David

5
DotNet / RenderWindow fails on Linux
« on: May 18, 2013, 10:43:21 am »
Hello all,

first i would like to thank Laurent for this amazing library.

Now to problem... I believe ever since this commit: https://github.com/SFML/SFML.Net/commit/62b70062549feee97123ee13735b634f5f88400f
RenderWindow class is not working on Linux. It writes this in console and exit program when i start shader.cs(example program).
Code: [Select]
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  8 (X_MapWindow)
  Resource id in failed request:  0x0
  Serial number of failed request:  50
  Current serial number in output stream:  51

On windows it's working just fine. I also tried to create C program and call sfWindow_createFromHandle(0, &cS); and throws same error.

Now i'm not sure what sfWindow_createFromHandle(IntPtr.Zero, contextSettings) is ment to do. Ignore parameter and create new window or...
Is this bug in CSFML/SFML for not working same on Linux/Windows?
I would fork and fix this but i'm really not sure what proper solution is.. :(

Best regards,
David

Pages: [1]
anything