Jump to content
  • Advertisement
Sign in to follow this  
_void_

Ping-pong rendering using ExecuteIndirect

This topic is 595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys :-)

 

I am working on a render pass which produces output in one execution and then reads output in the next execution. And this has to be repeated a number of times.

I am thinking if I could actually implement this with one ExecuteIndirect call and using bindless resources. 

For each draw call I would generate indirect argument as encoded 32 bit constant containing information about the index of input/output texture. Please see code below.

Texture2D<float3> g_InTextures[] ...        // Contains Tex1, Tex2 as SRV
RWTexture2D<float3> g_OutTextures[] ...     // Contains Tex1, Tex2 as UAV

cbuffer IndirectArg32BitConstant : register(b0)
{
    // first 16 bits contain input texture index
    // second 16 bits contain output texture index
    uint g_TextureIndex;
}

void CS(...)
{
    uint2 texLoc = ...;
    g_OutTextures[outIndex][texLoc] = g_InTextures[inIndex][texLoc];
}

The drawback with such approach is that we need to transition our resources from read to write, write to read states between draw calls, which is not feasible with ExecuteIndirect arguments.

Instead, I thought that I could make InTextures and OutTexture to be RWTexture2D so that to avoid the need for resource transition.

RWTexture2D<float3> g_InTextures[] ...      // Contains Tex1, Tex2 as SRV
RWTexture2D<float3> g_OutTextures[] ...     // Contains Tex1, Tex2 as UAV

cbuffer IndirectArg32BitConstant : register(b0)
{
    // first 16 bits contain input texture index
    // second 16 bits contain output texture index
    uint g_TextureIndex;
}

void CS(...)
{
    uint2 texLoc = ...;
    g_OutTextures[outIndex][texLoc] = g_InTextures[inIndex][texLoc];
}

But now I do not know if this is sufficient from resource read/write sync point of view.

Could draw calls of ExecuteIndirect be overlapped by the driver? Could we start reading UAV while we are still writing to it from the previous draw?

Do you think it is a good idea to implement ping-pong rendering this way? Seems like a neat trick if possible :-)

Edited by _void_

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!