<p>You're trying to map all three UAVs to the same descriptor slot (slot 0).</p>

<pre><code>ranges_madhu[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
ranges_madhu[1].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
ranges_madhu[2].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
</code></pre>

<p>The <code>baseShaderRegister</code> 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.</p>

CC BY-SA 3.0
2017-04-10T23:24:46.677Z
2017-04-10T23:24:46.677Z
Nathan Reed
<p>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.</p>

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

<p>Is it because I am not allowed to have 3 uav ranges?</p>

<pre><code>CD3DX12_DESCRIPTOR_RANGE1 ranges_madhu[3];
ranges_madhu[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
ranges_madhu[1].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
ranges_madhu[2].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);

CD3DX12_ROOT_PARAMETER1 rootParameters_madhu[ComputeRootParametersCount_madhu]; // this is 3   (thus all 3 ranges have been initialized as UAVs)
rootParameters_madhu[ComputeRootUAVTable_in1].InitAsDescriptorTable(1, &amp;ranges_madhu[0], D3D12_SHADER_VISIBILITY_ALL);
rootParameters_madhu[ComputeRootUAVTable_in2].InitAsDescriptorTable(1, &amp;ranges_madhu[1], D3D12_SHADER_VISIBILITY_ALL);
rootParameters_madhu[ComputeRootUAVTable_outp1].InitAsDescriptorTable(1, &amp;ranges_madhu[2], D3D12_SHADER_VISIBILITY_ALL);

CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC computeRootSignatureDesc_madhu;
computeRootSignatureDesc_madhu.Init_1_1(_countof(rootParameters_madhu), rootParameters_madhu, 0, nullptr);

ComPtr&lt;ID3DBlob&gt; signature1;
ComPtr&lt;ID3DBlob&gt; error1;

ThrowIfFailed(D3DX12SerializeVersionedRootSignature(&amp;computeRootSignatureDesc_madhu, featureData_madhu.HighestVersion, &amp;signature1, &amp;error1));
ThrowIfFailed(m_device-&gt;CreateRootSignature(0, signature1-&gt;GetBufferPointer(), signature1-&gt;GetBufferSize(), IID_PPV_ARGS(&amp;m_computeRootSignature1)));
NAME_D3D12_OBJECT(m_computeRootSignature1);
</code></pre>

CC BY-SA 3.0
2017-04-10T22:00:24.873Z
What is the error you get? Do you have the debug layer turned on?
Nathan Reed
CC BY-SA 3.0
2017-04-10T22:38:55.377Z
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
CC BY-SA 3.0
2017-04-10T22:44:28.947Z
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
CC BY-SA 3.0
2017-04-10T22:50:55.130Z
Not sure how to check the error from "error1" blob.
But the return value is E_INVALIDARG- one or more arguments are invalid.
Madhu
CC BY-SA 3.0
2017-04-10T23:04:43.280Z
You can print the error blob to the output pane like this: `if (error1) { OutputDebugStringA((char *)error1->GetBufferPointer()); }`
Nathan Reed
CC BY-SA 3.0
2017-04-10T23:18:34.163Z
Shader register range of type UAV (root parameter [1], visibility ALL, descriptor table slot [0]) overlaps with another shader register range (root parameter[0], visibility ALL, descriptor table slot [0]).



This is the error that is printed. 
Is there something that I could do to manage this?
Madhu
<directx12>
DX12 compute signature
Madhu
# DX12 compute signature

(Asked by: username_0 on 2017-04-10)

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];
ranges_madhu[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
ranges_madhu[1].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
ranges_madhu[2].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);

CD3DX12_ROOT_PARAMETER1 rootParameters_madhu[ComputeRootParametersCount_madhu]; // this is 3   (thus all 3 ranges have been initialized as UAVs)
rootParameters_madhu[ComputeRootUAVTable_in1].InitAsDescriptorTable(1, &ranges_madhu[0], D3D12_SHADER_VISIBILITY_ALL);
rootParameters_madhu[ComputeRootUAVTable_in2].InitAsDescriptorTable(1, &ranges_madhu[1], D3D12_SHADER_VISIBILITY_ALL);
rootParameters_madhu[ComputeRootUAVTable_outp1].InitAsDescriptorTable(1, &ranges_madhu[2], D3D12_SHADER_VISIBILITY_ALL);

CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC computeRootSignatureDesc_madhu;
computeRootSignatureDesc_madhu.Init_1_1(_countof(rootParameters_madhu), rootParameters_madhu, 0, nullptr);

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

ThrowIfFailed(D3DX12SerializeVersionedRootSignature(&computeRootSignatureDesc_madhu, featureData_madhu.HighestVersion, &signature1, &error1));
ThrowIfFailed(m_device->CreateRootSignature(0, signature1->GetBufferPointer(), signature1->GetBufferSize(), IID_PPV_ARGS(&m_computeRootSignature1)));
NAME_D3D12_OBJECT(m_computeRootSignature1);

```

**Tags:** directx12

> **Comments:**
> **username_1**: What is the error you get? Do you have the debug layer turned on?  
> **username_0**: 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  
> **username_1**: 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?  
> **username_0**: Not sure how to check the error from "error1" blob. But the return value is E_INVALIDARG- one or more arguments are invalid.  
> **username_1**: You can print the error blob to the output pane like this: `if (error1) { OutputDebugStringA((char *)error1->GetBufferPointer()); }`  
> **username_0**: Shader register range of type UAV (root parameter [1], visibility ALL, descriptor table slot [0]) overlaps with another shader register range (root parameter[0], visibility ALL, descriptor table slot [0]).    This is the error that is printed.  Is there something that I could do to manage this?  

---

## 1 answers

### Answer by username_1 on 2017-04-10. Score: 2

You're trying to map all three UAVs to the same descriptor slot (slot 0).

```
ranges_madhu[0].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
ranges_madhu[1].Init(D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE);
ranges_madhu[2].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.


---

