• Advertisement
Sign in to follow this  

CompuateShaders and Swap Chain for Present()

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

Hello,
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.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT/*DXGI_USAGE_UNORDERED_ACCESS*/;
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?

Thanks

Share this post


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

OutputWindow
HWND

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