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

Author Topic: Distributed Rendering  (Read 2178 times)

0 Members and 1 Guest are viewing this topic.

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Distributed Rendering
« on: January 30, 2015, 11:29:31 am »
Hi, I am experimenting with distributed rendering. Fortunately it works ;D But I'm not quite sure whether my approach is "right" or as any downsides.

Basic Idea: Rendering multiple views in parallel by drawing an array of sf::Drawables to a sf::RenderTexture. So I created a Camera-class holding the used view, a render texture and a C++11 Thread to perform drawing. On each frame the drawing-threads are restarted, the main thread is waiting for them and then it applies the render texture to the actual rendering target.

I know some basic stuff about concurrency, but I lack of experience about using in "real life". So I'm not sure whether..
  • .. there is something about concurrency I forgot considering
  • .. the entire idea is useful/efficient or not

It's just a theoretical aspect, but drawing in parallel should be more efficient. But I don't know how expensive the "merge" (getting texture from the render texture and applying it to window) is. :-\
Of course the scenes need to be much more complex ^^ Distributed rendering of two shapes seems overkill .. well, just some kind of minimal-code ^^

Well, here's my current code (btw using linux, so XInitThreads is used) :) (inside the spoiler)
(click to show/hide)

Kind regards
Glocke
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Distributed Rendering
« Reply #1 on: January 30, 2015, 11:51:59 am »
Your graphics driver and GPU are made for single threaded access. You won't gain anything by rendering in parallel from multiple threads, except unnecessary internal driver synchronization work.
Laurent Gomila - SFML developer

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: Distributed Rendering
« Reply #2 on: January 30, 2015, 11:54:29 am »
Your graphics driver and GPU are made for single threaded access. You won't gain anything by rendering in parallel from multiple threads, except unnecessary internal driver synchronization work.
As I expected xD Damn :-[ But thanks for correction :)
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Distributed Rendering
« Reply #3 on: January 30, 2015, 12:02:42 pm »
But since you have a working implementation, don't stop there, you should run a benchmark multi-threaded vs single-threaded (with more than 2 entities of course) ;)
Laurent Gomila - SFML developer

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: Distributed Rendering
« Reply #4 on: January 30, 2015, 01:51:53 pm »
But since you have a working implementation, don't stop there, you should run a benchmark multi-threaded vs single-threaded (with more than 2 entities of course) ;)
Well I just did that right now: No measurable difference. I wrote a single-threaded and a multi-threaded (2 threads) both using much more shapes ^^ . Boach approaches rendered within ~300ms per frame :D

But I think the process of culling visible objects could be parallelized for multiple views with measurable difference between single- and multi-threaded.
Current project: Racod's Lair - Rogue-inspired Coop Action RPG