Wednesday, May 7, 2014

vogl on Windows lives!


Disclaimer: vogl on Windows is not ready for anyone (other than me) to spend time on. The laundry list of things you cannot do with it yet is long. That said...


VOGL ON WINDOWS LIVES!!


As of now, you can actually capture a trace using vogl on Windows. The process is currently complicated, although it shouldn't remain this way for long. And you can't play the traces back anywhere, yet. You can dump the traces to JSON, but you need a Linux box to do so.

For posterity, I've included the current build and usage instructions below. I expect both of these to simplify pretty significantly in the near future.

Please note that everything here is subject to change, and so if you're viewing this page from the future it's probably a good idea to check with the official vogl website--the instructions and requirements below have probably changed significantly.

Someone set up us the Build

Requirements:
  • CMake 2.8 (I'm using 2.8.12.1) 
  • Visual Studio 2013 Update 1
    • I would expect that the Express version should work, but I haven't tested it).
  • git
Okay, with all these installed, our machine is ready to fetch source and go. 

Grabbing the source

vogl is currently contained in two separate repositories--one for the source for vogl itself and the other for support code for vogl. Open a command prompt to a suitable location, I will assume it's ${ROOT}.

git clone https://bitbucket.org/raddebugger/vogl_chroot.git
cd vogl_chroot
git clone https://github.com/ValveSoftware/vogl.git

Building x86

Open a command prompt.

cd ${ROOT}/vogl_chroot/vogl
mkdir _out
cd _out
cmake -G "Visual Studio 12" ..

Building x64

cd ${ROOT}/vogl_chroot/vogl
mkdir _out64
cd _out64
cmake -G "Visual Studio 12 Win64" ..

In either _out or _out64 there will now be a raddebugger.sln file, open this with Visual Studio 2013 and build as normal. The Debug and Release targets are supported--others are a byproduct of Cmake and are not (they will be removed at some point).

Capturing a trace

Capturing a trace is currently a manual process. The following things must be done:
  1. Copy ${ROOT}/vogl_chroot/vogl_build/bin/${Configuration}/vogltrace${BITS}.dll to opengl32.dll in the directory with your executable. Note that the destination is opengl32.dll, regardless of whether your application is 32- or 64- bits.
  2. Copy ${ROOT}/vogl_chroot/external/windows/pthreads.2/dll/${BITS}/pthreadVC2.dll to the directory that contains your executable.
  3. Set the following environment variable
    1. VOGL_CMD_LINE=-vogl_tracefile ${CAPTURE_LOCATION}\simpletrace.bin
Where CAPTURE_LOCATION is a suitable location, like C:\temp

Now simply run your application. You should wind up with a file at ${CAPTURE_LOCATION}\simpletrace.bin, which you can take to Linux to dump. 

This process will be radically simplified over the coming weeks. 

Todo

There's a ton of stuff left to do, but here's a list off the top of my head:
  • trace replay - single platform
    • What's better than dumping a trace to disk? Being able to actually replay it. 
    • This item would allow you to capture on windows and replay on windows.
  • trace replay - cross-platform
    • Longer term, we want to be able to take traces from one platform and replay them on other platforms.
  • vogltrace.exe
    • This will handle all of the injection into your process on your behalf. 
    • Linux doesn't need this, although it may benefit from such a system as well.
  • Code cleanup
    • Right now, the code is the least disruptive port it can possibly be. This means lots of code is copy-pasted from it's GLX friends. 
    • Longer term, we need to try and minimize the amount of code that is copy-pasted between platforms. 

7 comments:

  1. When building, I got error C1083: Cannot open include file: 'gl_enums.inc': No such file or directory (..\..\..\src\voglcommon\vogl_ctypes.cpp). It prints many times and then build failed. I got same error using 32 or 64 bit.
    Is it a bug? Do you know anything about it?

    ReplyDelete
  2. Yes, there's a problem with the steps above (which I will fix). Copy the correct flavor of pthreadsVC2.dll (${ROOT}/vogl_chroot/external/windows/pthreads.2/dll/${BITS}/pthreadVC2.dll) to the build output directory.

    voglgen requires voglcore which requires pthreads.

    I've fixed this in a later version of the code (by copying the DLL for you automatically), but the Pull Request for that hasn't gone through yet.

    ReplyDelete
  3. Thanks for fast response. It works! The project is now successfully built. Thanks again!
    One thing that bother me, now pthreadVC2.dll is copied themself after I manually delete it rebuilt the project again. Why that's happen?

    ReplyDelete
  4. So I definitely think the windows build is a bit wonky at the second. I'm not happy with what we're doing so far with Cmake, and plan on cleaning it up. This will probably happen Mon-Tues next week. (Sorry about it till then!)

    ReplyDelete
  5. Good luck then. Thanks for your hard work.

    ReplyDelete
  6. Not expecting you to help troubleshoot since I know you're already working on improving the build process, but I thought I'd share my experience of trying to use the voglbench_sdl2_port branch on your github page on windows 8.1:

    I was able to get the solution to build with vs 2013 express (it seemed hopeless with 2012 ultimate) without too much effort: The only errors I got were linker errors complaining about SDL2.lib missing. I copied SDL2.lib from vogl_chroot\external\SDL\VisualC\SDL\Win32\Debug to vogl_chroot\vogl_build\bin\Debug and the errors went away.

    After copying vogltrace32.dll to opengl32.dll in my app's directory, I was getting an error about turbojpeg not being installed on my system, so I downloaded the latest version of that to quiet the error. Now it's outputting trace files, but when I try voglbench32.exe with my trace as the only argument, nothing happens. When I try voglreplay32.exe with my trace as the only argument, I get the following output:

    voglreplay 32-bit Debug Built May 21 2014 14:21:32
    Replay mode.
    c:\users\soufi\documents\tanglesoft\tools\temp\vogl_windows\vogl_chroot\vogl\src\voglreplay\replay_tool_replay.cpp(38):
    Assertion failed: "!"impl tool_replay_mode""
    0 warning(s), 0 error(s)


    Anyway, I'm super excited about being able to use this tool, keep up the good work!

    ReplyDelete
    Replies
    1. Thanks! So the SDL issue is probably because you're using vogl_chroot and not vogl_binaries (which is my fork of vogl_chroot). I've got a pull request to fix that.

      I need to fix the libturbojpeg issue. Actually I'm somewhat inclined to just nuke the dependency.

      voglreplay is definitely not supported yet--I went with voglbench as the proving ground because it's a much smaller code base. If you step into voglbench32 while it's trying to play your trace, what happens? Put a breakpoint in tool_replay_mode and step through. Does it die somewhere? Just skip over your trace completely?

      Thanks for trying it out!

      Delete