PhysX Samples Broken on Win 8.1?

Hey,

I downloaded the latest PhysX SDK 3.3.2 and tried the samples.

I followed the readme and compiled the Source like PhysXExtensions before compiling the Samples but I’m encountering two issues:

  1. Once compiled, the x64 sample will fail completely and crash with an Invalid Access here: RendererWindow.h SampleFramework::SamplePlatform* getPlatform() { return m_platform; }

    Exception:
    First-chance exception at 0x00007FF6A9FACDFA in SamplesDEBUG.exe: 0xC0000005: Access violation reading location 0xFFFFFFFF8A827238.

    I’d assume the root cause is an uninitialized RendererWindow ptr in WindowsSamplePlatform.cpp windowProc:
    #if defined(RENDERER_64BIT)
    RendererWindow* window = (RendererWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
    #else
    RendererWindow* window = (RendererWindow*)LongToPtr(GetWindowLongPtr(hwnd, GWLP_USERDATA));
    #endif

  2. Compiling and running the x86 / win32 samples works for most samples but the Particles and the Cloth scene crash badly w/o even raising an excetpion in the debugger. This crash even happens with the pre-compiled binaries that ship in the SDK zip file. Changing the PhysX processor to the CPU in the NVIDIA Control Panel doesn't prevent the crash either.

I’m running a Win 8.1 x64 Lenovo W540 with a Quadro K2100M card. Using Visual Studio 2012 Ultimate. I’ve tried the debug and checked build configurations.

Thanks

  • Rene

I also have this problem.
I just fixed it by changing

bool WindowsPlatform::openWindow(physx::PxU32& width, 
								physx::PxU32& height,
								const char* title,
								bool fullscreen) 
{
...

SetWindowLongPtr(m_hwnd, GWLP_USERDATA, LONG_PTR(m_app));
...
}

The problem is SetWindowLongPtr(m_hwnd, GWLP_USERDATA, PtrToLong(m_app)); will set 32 bit address of m_app in 64 bit build ( LONG always be 32 bits while LONG_PTR is same as mem address bus size )

Thanks for pointing out the fix. Note that this was fixed in PhysX version 3.3.3.

Cheers,
Simon