Render queue texture clearing

Started by
14 comments, last by Juliean 11 years ago

Ah, so would it be somehow along those lines?


class Stage
{
SetRenderTarget(int, texture) { state.add<RenderTarget>(texture) }

private: 
StateGroup stageState;
}

class Model
{
AddRenderInstance(Stage&, Mesh&, Effect&, Material*) { m_vInstances.push_back(new RenderInstance(stage, mesh, effect, material); 
}
private:
vector<RenderInstance>
}

Then before the actual render loop, I'd have a scene graph thingy that holds pointer to all modes sort out the respective render instances to their stage bucket. After that I'd submit the buckets stage group, then submit all the render instances inside that bucket to the actual render queue. Correct? If so,

the bucket associated with each stage is sorted (if needed), the state group of that stage (containing the render target clearing/binding commands) is submitted

Do I need a seperate command for submitting a state group only for my render queue (because now I only support render instance submitting), or do you mean "submit" here more like explicitely set those states here?

Advertisement

@phantom:

So is this how your entire rendering architecture works, or is it some part put on top of everything? It doesn't seem like a bad idea, but it appears to not being really compatible to my current rendering architecture, which works by submitting a render instance (state changes + sort key + draw call), but I'm not sure...

Ah yes, I should have been a bit more clear about that; we build the same kind of list too and its that which is processed in side the "render each visible model" bit (by 'render' it means 'record these draw calls into a command list to execute on the device later'), this list is just established per unique camera in the world and used with the scenes which require it.

Do I need a seperate command for submitting a state group only for my render queue (because now I only support render instance submitting), or do you mean "submit" here more like explicitely set those states here?

Can't you simply submit the state group in a RenderItem with the draw call as null?
Or you could explicitely set those states... Anyway should work fine.

Ah yes, I should have been a bit more clear about that; we build the same kind of list too and its that which is processed in side the "render each visible model" bit (by 'render' it means 'record these draw calls into a command list to execute on the device later'), this list is just established per unique camera in the world and used with the scenes which require it.

So I see it right that you have one list per scene? Therefore one "render queue" that gets sorted and submitted one after another, completely independand of all the other stages lists/queues?

Can't you simply submit the state group in a RenderItem with the draw call as null?
Or you could explicitely set those states... Anyway should work fine.

Yeah, that would work, just need to add a check for null-draw calls. But I think I prefer to make a seperate "SetStageGroup"-method, since those commands (render target set/clear) etc... would probably need to be seperated somehow anyway. I'm quessing if I were to submit it as a normal RenderInstance with a null draw kell, I'll give it the highest possible sorting key, so it would always be executed first?

So I see it right that you have one list per scene? Therefore one "render queue" that gets sorted and submitted one after another, completely independand of all the other stages lists/queues?

Well, technically its per unique camera (scenes can share cameras) and then filtered per scene (using various masks such as 'techniques' to define groups of shaders) to get a final rendering list for that scene.

Hello,

so I've followed your advices and implemented a basic Stage class:


		class Stage
		{
		public:
			Stage(UINT queueId, render::IRenderer& renderer);
			~Stage(void);

			void SubmitInstance(const render::RenderInstance& instance) const;

			void SetRenderTarget(unsigned int index, const Texture* pTexture);
			void ClearTargetState(bool bClear);

			void Submit(void) const;

		private:

			render::StateGroup m_stageStates;
			render::IRenderQueue* m_pQueue;
		};

I'd still like to know what you say about some details:

- Since visibility has been mentioned, what is the best relationship between model, render instance and stage? Should I store the model in the stage, and pass the camera to the stage to cull the models? Or pass a render instance + a bounding volume pointer, still have culling in the stage? Or should I store a pointer to the stage inside the model/render instance, and have it submit to this stage after an external culling phase? Or something completely different?

- Where do you store your stages? Do you just create a stage wherever needed, or is there some "manager" or list, where all stages are held?

Thanks in advance!

This topic is closed to new replies.

Advertisement