Jump to content
  • Advertisement
Sign in to follow this  

CompuateShaders and Swap Chain for Present()

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

First the context:
I am trying to profile a Compute Shader app ComputeShaderSort11 using Perf Studio 2.0. To be able to use Perf Studio 2.0 - I need to have an infinite loop with a Present() called on a Swap Chain.

Questions -

What does swap-chain for a compute device mean?

If I try to initialize the swap chain with following desc. and pass that to D3D11CreateDeviceAndSwapChain, the D3D11CreateDeviceAndSwapChain call fails.

// Populate the Swap chain desc.
void SetSwapChainDesc( DXGI_SWAP_CHAIN_DESC &swapChainDesc )
ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));
//set buffer dimensions and format
swapChainDesc.BufferCount = 2;
swapChainDesc.BufferDesc.Width = 1;
swapChainDesc.BufferDesc.Height = 1;
swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM/*DXGI_FORMAT_UNKNOWN*/;

//set refresh rate
swapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;

//sampling settings
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.SampleDesc.Count = 1;
//output window handle
swapChainDesc.OutputWindow = NULL;
swapChainDesc.Windowed = false;

As you can see in the commented part of the above code, I did try setting fields that I thought were appropriate for compute shader, but my D3D11CreateDeviceAndSwapChain still fails.

Any pointers on how to fix this?


Share this post

Link to post
Share on other sites
Like the docs say...


An HWND handle to the output window. This member must not be NULL.

The whole point of a swap chain is to manage a queue of buffers used for taking your final rendered output and copying it to a window. So it doesn't make any sense to have a swap chain without a window to bind it to.

You can just create a window as initially hidden and never show it, if you don't actually want to display anything.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!