Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Writing to render target with compute shader?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 NotTakenSN   Members   

149
Like
0Likes
Like

Posted 06 February 2013 - 10:48 PM

What's the best way to go about displaying an image calculated in a compute shader to the screen? Is it possible to write directly to a render target from the compute shader? Or would you have to write the results to a 2D UAV texture, then somehow swap that into the back buffer? I suppose writing to a RWTexture2D<float4> is the way to go, but how exactly would you set up the swap chain for this?

 

The only way I can get it working right now is to write into a 2D UAV texture, then render a rectangle to activate the pixel shader, which then reads from the texture and writes those values to the render target. Obviously, I would like to avoid this method because it requires unnecessary switching between the compute shader and pixel shader, which impacts performance.


Edited by NotTakenSN, 06 February 2013 - 11:01 PM.


#2 MJP   Moderators   

19468
Like
6Likes
Like

Posted 07 February 2013 - 12:17 AM

*
POPULAR

When you create your swap chain, specify DXGI_USAGE_UNORDERED_ACCESS as your BufferUsage. If you do that, you'll be able to create an unordered access view from the back buffer texture that you get from that swap chain.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.