Example #1
0
void CompositorRenderPass::Commit(CommitContext& context) {
	
	if (context.rsys->GetTicket() != this->renderSystemTicket)	{
		if (numTextureToResolve == 1) {
			TextureUnit tu;
			RenderTarget* target = context.GetTargetByName(_rtJustOne.name);
			if (target && target->GetRenderTargetType() == RenderTargetType::TEXTURE) {
				tu.texture = static_cast<RenderTexture*>(target);
				parameters.SetData(&tu, _rtJustOne.offset);
			}
		} else {
			for (uint32 i = 0; i < numTextureToResolve; ++i) {
				TextureUnit tu;
				RenderTarget* target = context.GetTargetByName(_rtBunchOf[i].name);
				if (target && target->GetRenderTargetType() == RenderTargetType::TEXTURE) {
					tu.texture = static_cast<RenderTexture*>(target);
					parameters.SetData(&tu, _rtBunchOf[i].offset);
				}
			}
		}
		this->renderSystemTicket = context.rsys->GetTicket();
	}

	BeginRender(context);
	RenderPrimitive(context, (uint32)(ptrdiff_t)this, &primitive);
	EndRender(context);
}