Programmer Ramblings – Screwing Around With std::thread

Next Steps and Thoughts

For a quick first pass on all this, I’m pretty happy with the results. At the very least I’ve gotten a quick look at setting up threads using the C++ standards, rather than the amalgamation of Boost-based nonsense or Unreal Engine-based threads I’ve used in the past. I’ve gotten a rough look at some quick changes to drastically improve the cost of generating the image via some quick changes to the threading setup I was using. All told, I’ve only spent about 6-8 hours on the total set of code in place so far, and that includes things like the core raytracing class framework, a rough unit testing framework for running these tests, then of course the individual threading tests in place.

So, for the next steps:

  • I need to get some sort of actual profiler working on my machine. AMD is allegedly fixing uProf for Win 10 in version 3.3, but who knows when that’s going to come out. I’ve had mixed success with Intel VTune on AMD in the past, but I’ll be looking at that a bit more if uProf updates don’t pan out. The basic VS profiling just isn’t cutting it.
  • My next plan as far as increasing the complexity of the actual work load is to add reflection and refraction into the threaded work. That’ll do a couple things. For one, it’s just more complex work that takes longer in isolation. The second is that it increases the work load in a non-fixed fashion. The ray count of a block heading to the background is fixed, but once the rays start interacting with shapes you get non-linear growth in ray count.
  • That presents the next thing, which is to add a message pump so I can spawn threads independent of the cluster of worker threads all finishing. I can spawn a bunch in a batch, then as individual work units finish I can spawn new threads instead of waiting.
  • It’s probably equally likely that just spawning threads as a percentage of the total image may be as quick as doing the message pump, and has a much lower complexity, which is nice. I’ll probably go with this path first, then assuming I have a profiler playing nice with me, check if there’s any real reason for me to thread things further.
  • Long term I want to add model loading, but that’s way off in the future. For now I at least want to add shapes other than spheres just for variety

One Reply to “Programmer Ramblings – Screwing Around With std::thread”

Comments are closed.