Jump to content
  • Advertisement
Sign in to follow this  
0xfeedbacc

[D3D12] Color Picking Questions

This topic is 900 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 posted these questions questions on Stack Overflow, but I didn't get any response yet and not many views, so I figured I would cross-post here, hoping to have better luck.

 

I'd like to implement color picking in DirectX 12. So basically what I am trying to do is render to two render targets simultaneously. The first render target should contain the normal rendering, while the second should contain the objectID.

 

To render to two render targets, I think all you need to do is set them with OMSetRenderTargets.

 

Question 1: How do you specify which shader or pipeline state object should be used for a specific render target? Like how do you say render_target_0 should be rendered with shader_0, render_target_1 should be rendered with shader_1?

 

Question 2: How do you read a pixel from the frame buffer after it has been rendered? Is it like in DirectX 11 by using CopySubresourceRegion then Map? Do you need to use a readback heap? Do you need to use a resource barrier or fence or some sort synchronisation primitive to avoid the CPU and GPU using the frame buffer resource at the same time?

 

I tried googling for the answers but didn't get very far because DirectX 12 is pretty new and there aren't a lot of examples, tutorials, or open source projects for DirectX 12 yet.

 

Thanks for your help in advance.

 

Extra special bonus points for code examples.

Share this post


Link to post
Share on other sites
Advertisement

How did you create read_back_texture? It's a texture in a readback heap, yes?

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!