I am working on optimizing barriers in our engine but for some reason can't wrap my head around split barriers.
Lets say for example, I have a shadow pass followed by a deferred pass followed by the shading pass. From what I have read, we can put a begin only split barrier for the shadow map texture after the shadow pass and an end only barrier before the shading pass. Here is how the code will look like in that case.
DrawShadowMapPass();
ResourceBarrier(BEGIN_ONLY, pTextureShadowMap, SHADER_READ);
DrawDeferredPass();
ResourceBarrier(END_ONLY, pTextureShadowMap, SHADER_READ);
// Uses shadow map for shadow calculations
DrawShadingPass();
Now if I just put one barrier before the shading pass, here is how the code looks.
DrawShadowMapPass();
DrawDeferredPass();
ResourceBarrier(NORMAL, pTextureShadowMap, SHADER_READ);
// Uses shadow map for shadow calculations
DrawShadingPass();
Whats the difference between the two?
Also if I have to use the render target immediately after a pass. For example: Using the albedo, normal textures as shader resource in the shading pass which is right after the deferred pass. Would we benefit from a split barrier in this case?
Maybe I am completely missing the point so any info on this would really help. The MSDN doc doesn't really help. Also, I read another topic
but it didn't really help either.
↧