Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Nov 2009
Offline Last Active Feb 21 2013 04:53 PM

Posts I've Made

In Topic: Shared resources (eg textures) between devices/threads

09 February 2013 - 05:15 PM

Sharing textures (and other resources) between devices/threads works just fine as advertised, when using D3D9Ex (and not D3D9). I wish Microsofts' documentation would state that more clearly.


The reason is that only D3D9Ex utilizes the features provided through WDDM display drivers, like eg sharing resources. So D3D9Ex was specifically introduced for people like me that want to stick with D3D9, but want to use some of the features that were introduced with Vista (and later). So thanks for that to Microsoft :)


So the actual fix was to use Direct3DCreate9Ex() and CreateDeviceEx() instead of their D3D9 predecessors. Everything else remains the same.

In Topic: C++ SIMD/SSE optimization

31 January 2012 - 05:05 AM

Zoner, thanks for the detailed explanation! I am quite happy with the current speed, if I should need to squeeze some more out of it I will fire up the dissasembler - but I doubt that will be necessary any time soon. Thanks again!

In Topic: C++ SIMD/SSE optimization

30 January 2012 - 04:40 PM

Awesome, this works right out of the box! This code is around 30% faster than the native c++ code. Thanks for the fast response Zoner!

The loop will likely need to be unrolled 2-4 more times as to pipeline better (i.e. use more registers until it starts spilling over onto the stack)

If the data is aligned, the load and store can use the aligned 'non-u' versions instead.

I am using the non-u version, but it didn't make much difference. Also unrolling the loop (4 times) didn't have a significant impact, although I re-used the same variables. By "use more registers" did you mean I should introduce more variables for each unrolled loop sequence?

In Topic: Render overlays using GDI+ on a Direct3D9 app

04 December 2009 - 11:10 AM

I just quickly tested with exactly the same code that you provided, and I do get a transparent texture with only a red line in it, and that texture displays just fine.

if (lock())
Gdiplus::Bitmap bitmap(mWidth, mHeight, mLockedRect.Pitch, PixelFormat32bppARGB , (BYTE*)mLockedRect.pBits);
Gdiplus::Graphics graphics( &bitmap );
graphics.Clear( Gdiplus::Color::Transparent );
Gdiplus::Pen pen( Gdiplus::Color::Red );
graphics.DrawLine(&pen, 10, 10, 120, 120);


So that part definitely works fine. What ever else problem you have must be related to your general rendering setup. For a test I would try to load a generic image with transparency in it and see if you manage to render that properly. Alternatively you could try to save the texture right after you created it with GDI+, and see if that is alright (it should, since the code up there produces the correct result for me).

Maybe your problem is also related to the fact that you are not creating a power-of-2 texture (yours is 300 x 300, I tested with 512 x 512).

In Topic: Seamless transition between 2D and 3D (Aero Flip)

03 December 2009 - 01:23 AM

In the meantime I found a clean solution:

float fov = Math::PI/4;
float aspect = 1.0f;
float nearClip = 1.0f;
float farClip = 100.0f;

Matrix p;
p.buildProjection(fov, aspect, nearClip, farClip);

// NOTE: at this point we should multiply the projection matrix with a camera look at matrix
// but offsetting the projection matrix with that distance is simpler

float distance = 1.0f / tan(fov*0.5f);

p._43 += distance;
p._44 += distance;