Jump to content
  • Advertisement
Sign in to follow this  
ngub05

DX12 [D3D12] What's wrong with this app design?

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

Here's the brief design of my d3d12 app which loads an image an displays it on screen.

 

After InitializeWindow(), I initialize D3D (InitD3D), then Render() and receive widow messages in a loop.

 

InitD3D()

debug layer
device create
create CQ
create SwapChain
RTv desc heap
point RTV to swap chainback buffers
create CA
creata and close CL
create fence per frame
create one fence event

 

 
Render()
wait for gpu to finish
reset CA
reset cL
UploadTexturedataFromFile()
resource barrier: present to RT
record CL = {get RTVhandle, OMsetrendertarget(), clearRTV}
resource barrier: RT to present
CL close()
CQ execute CL
CQ signal
swapchain->Present()
 
UploadTexturedataFromFile()
-loads an image using WIC
-copy pixels data
-created upload an default heaps.
-commandlist-copytexturearea from upload to default.

 

As you can see I haven't set up a root signature and pso. It's because I'm not calling DrawInstanced() in my render. My understanding is that if I point RTV to swap chainback buffers and call OMsetrendertarget(), I only need to call Present() to display my image.

Is this wrong? If yes, Is it necessary that I should set up a basic root signature and pso and call DrawInstanced() ?

PS: I started graphics programming recently with dx12. 

Edited by ngub05

Share this post


Link to post
Share on other sites
Advertisement

Can someone expain, what exactly will be happening when i call DrawInstanced(). Should it be called before ExecuteCommandLists()? Why? I'm missing some very important concepts here..

Share this post


Link to post
Share on other sites

you use the command list to create commands, which get stored in a list, called a command list. drawinstanced is a command, so when you call that, a draw command is put into the command list. you call executecommandlists to actually execute the commands in that list. So yes, you need to call drawinstanced before you call executecommandlists

Share this post


Link to post
Share on other sites


I haven't set up a root signature and pso. It's because

 

You need a root signature/pso to draw things with a shader. If you're just copyresourceing a texture onto the swap chain I suppose you don't... but at that point you're just making an image compositor. 

Share this post


Link to post
Share on other sites

i didn't even see that part. Yeah, if you want to use the pipeline, you need at least a pso and pso's need a root signature, even if its a default empty root signature. If you want to draw something onto a render target, you need at least a vertex and pixel shader in your pso. if you are only using the pipeline up to the stream output stage, you only need a vertex shader.

 

basically the only thing you can do without a pso is clear the render target, or manage and move around resources on the gpu, since thats not actually part of the graphics pipeline. If you want to use any part of the graphics pipeline though (input assembler to output merger stage (or to stream output stage)), you do need a pso (which again needs a root signature).

Edited by iedoc

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.

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!