• Advertisement
Sign in to follow this  

Unused buffers bound to pipeline and performance.

This topic is 745 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

I found that some buffers are bound to pipeline after they are no longer needed.

For example, I used Geometry shader with constant buffer.

After Draw() call, I forgot to set it to null.

In all Draw() calls after that I see it bound to the pipeline.

 

I have 3 concerns:

  1. Performance penalties (the main concern)
  2. Harder to debug: (I see these buffers in debugger as Active)
  3. The code is not perfect smile.png

I wonder: should I strive to set all unused resources to null after I’ve used them?

Edited by Happy SDE

Share this post


Link to post
Share on other sites
Advertisement

Thank you Adam!

 

So, lets take an example:

I have 2 classes, that setup pipeline draw calls for rendering bounding box and vertex normals.

They use Geometry shader and different constant buffers.

 

Every frame each of them will bind its own constant buffer to geometry shader.

The only difference - 2x GSSetConstantBuffers(0,0,nullptr);

 

If I will forget to bind CB (GS CB == nullptr), I would probably have a runtime error.

If I will not unbind buffer, and will use data from previous renderer, I probably will have visual artifacts, that are harder to find than looking at error messages.

In this case it seems for me using different code paths for Debug/Release mode is not a very good idea =(

 

Is it possible to measure particular call penalty? (I use VS2015)

 

I am asking this question not because I want to improve performance in this particular Draw() call, but because I want to learn how to measure performance in DX without speculations/guessing. smile.png

 

BTW, I am using DX11. Would DX12 solve this problem automatically?

Edited by Happy SDE

Share this post


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

  • Advertisement