Hey Guys,
I have been working on a rendering engine lately for use with my game engine, as well as for learning graphics programming more thoroughly, and have set up my render system with a concurrent render loop which simply processes a queue of 'Render Operations'. I have been mulling over how I implemented the operation side of things however and would like to get some feedback, I could think of 2 ways to do the actual operations.
1. Pass an operation class which contains high level structures, for instance I have an operation meant for setting up and clearing a viewport. I really don't like this though but perhaps it is common to do it like this? Essentially the viewport has functions on it which activate its render target, set up the viewport and scissor area,set up the clear colours, and than clears the viewport. To me I think I am passing too much information to the render thread.
2. Pass granular operations to the render queue, which are built up from the main thread. These would be each individual operation that the first method would have used. I think this may also make it easier to sort and remove redundant operations.
Display All
What do you guys think, and what is more common? Rez I know I heard you talking about having a multithreaded render queue :D.
I have been working on a rendering engine lately for use with my game engine, as well as for learning graphics programming more thoroughly, and have set up my render system with a concurrent render loop which simply processes a queue of 'Render Operations'. I have been mulling over how I implemented the operation side of things however and would like to get some feedback, I could think of 2 ways to do the actual operations.
1. Pass an operation class which contains high level structures, for instance I have an operation meant for setting up and clearing a viewport. I really don't like this though but perhaps it is common to do it like this? Essentially the viewport has functions on it which activate its render target, set up the viewport and scissor area,set up the clear colours, and than clears the viewport. To me I think I am passing too much information to the render thread.
Source Code
- -- Main Thread
- -- Queue a Setup Viewport operation, passing the viewport in question
- -- Signal the render thread that things are ready to go
- -- Render Thread
- -- Wait for signal
- -- Grab the current queue, and begin processing it
- -- For each operation, call its 'apply' method
- -- Setup viewport operation, call the viewports 'clear' method
2. Pass granular operations to the render queue, which are built up from the main thread. These would be each individual operation that the first method would have used. I think this may also make it easier to sort and remove redundant operations.
Source Code
- -- Main Thread
- -- Queue the following operations for a viewport
- -- Activate render target
- -- Enable Scissor Test
- -- Set Viewport, passing it the dimensions of the viewport
- -- Set Scissor, passing it the dimensions of the viewport
- -- Set Clear Colour, passing it the colours to use
- -- Clear, passing the buffer bits
- -- Signal the render thread that things are ready to go
- -- Render Thread
- -- Wait for signal
- -- Grab the current queue, and begin processing it
- -- For each operation, call its 'apply' method
- -- Set Viewport
- -- Set Scissor
- -- Set Clear Colour
- -- Clear
What do you guys think, and what is more common? Rez I know I heard you talking about having a multithreaded render queue :D.
PC - Custom Built
CPU: 3rd Gen. Intel i7 3770 3.4Ghz
GPU: ATI Radeon HD 7959 3GB
RAM: 16GB
Laptop - Alienware M17x
CPU: 3rd Gen. Intel i7 - Ivy Bridge
GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
RAM: 8GB Dual Channel DDR3 @ 1600mhz
CPU: 3rd Gen. Intel i7 3770 3.4Ghz
GPU: ATI Radeon HD 7959 3GB
RAM: 16GB
Laptop - Alienware M17x
CPU: 3rd Gen. Intel i7 - Ivy Bridge
GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
RAM: 8GB Dual Channel DDR3 @ 1600mhz