# DX12 compute signature

Can i have a root signature with 3 root parameters all being of the UAV type? Because what I am trying to do is, add two buffers and put the output of that in a output buffer.

In the following snippet I am trying to do the afroementioned. However, I get an error at the line calling D3DX12SerializeVersionedRootSignature()

Is it because I am not allowed to have 3 uav ranges?

CD3DX12_DESCRIPTOR_RANGE1 ranges_madhu[3];

CD3DX12_ROOT_PARAMETER1 rootParameters_madhu[ComputeRootParametersCount_madhu]; // this is 3   (thus all 3 ranges have been initialized as UAVs)

ComPtr<ID3DBlob> signature1;
ComPtr<ID3DBlob> error1;

ThrowIfFailed(m_device->CreateRootSignature(0, signature1->GetBufferPointer(), signature1->GetBufferSize(), IID_PPV_ARGS(&m_computeRootSignature1)));
NAME_D3D12_OBJECT(m_computeRootSignature1);

• What is the error you get? Do you have the debug layer turned on? – Nathan Reed Apr 10 '17 at 22:00
• Yes, I have debug layer enabled. when this is called : ThrowIfFailed(D3DX12SerializeVersionedRootSignature(&computeRootSignatureDesc_madhu, featureData_madhu.HighestVersion, &signature1, &error1)); an exception occures, stepping through the code I see that the handle returned into the signature is invalid – Madhu Apr 10 '17 at 22:38
• Ok. So is there any output from the debug layer about the error? If you're using Visual Studio, it would show up in the Output pane. Alternatively, is there any error message generated in the error1 blob? – Nathan Reed Apr 10 '17 at 22:44
• Not sure how to check the error from "error1" blob. But the return value is E_INVALIDARG- one or more arguments are invalid. – Madhu Apr 10 '17 at 22:50
• You can print the error blob to the output pane like this: if (error1) { OutputDebugStringA((char *)error1->GetBufferPointer()); } – Nathan Reed Apr 10 '17 at 23:04

ranges_madhu[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);

The baseShaderRegister value (the third parameter to these calls) indicates which descriptor slot to use. You have all of them set to 0, which won't work. They need to be distinct. For example, they could be 0, 1, and 2.