<p>When I use the CreateGraphicsPipelineState function in DX12, there's an error &quot;E_INVALIDARG One or more arguments are invalid.&quot; returned by the function, but there isn't detailed information on which argument is wrong. I'm sure I opened the debug layer, here is the code:</p>
<pre><code>#if defined(DEBUG) || defined(_DEBUG) 
    {
        ComPtr&lt;ID3D12Debug&gt; debugController;
        if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&amp;debugController))))
        {
            debugController-&gt;EnableDebugLayer();
        }
    }
#endif
</code></pre>
<p>I also opened the debug layer in the DirectX Control Panel. And it also has no detailed error information in the output window. I really can not find which argument is wrong. Here is my code:</p>
<pre><code>//
// PSO for shadow map pass.
//
D3D12_GRAPHICS_PIPELINE_STATE_DESC shadowPsoDesc = basePsoDesc;
shadowPsoDesc.RasterizerState.DepthBias = 100000;
shadowPsoDesc.RasterizerState.DepthBiasClamp = 0.0f;
shadowPsoDesc.RasterizerState.SlopeScaledDepthBias = 1.0f;
shadowPsoDesc.pRootSignature = mRootSignature.Get();
shadowPsoDesc.VS =
{
    reinterpret_cast&lt;BYTE*&gt;(mShaders[&quot;ShadowVS&quot;]-&gt;GetBufferPointer()),
    mShaders[&quot;ShadowVS&quot;]-&gt;GetBufferSize()
};
shadowPsoDesc.PS =
{
    reinterpret_cast&lt;BYTE*&gt;(mShaders[&quot;ShadowPS&quot;]-&gt;GetBufferPointer()),
    mShaders[&quot;ShadowPS&quot;]-&gt;GetBufferSize()
};

// Shadow map pass does not have a render target.
shadowPsoDesc.RTVFormats[0] = DXGI_FORMAT_UNKNOWN;
shadowPsoDesc.NumRenderTargets = 0;
HRESULT hr = md3dDevice-&gt;CreateGraphicsPipelineState(&amp;shadowPsoDesc, IID_PPV_ARGS(&amp;mPSOs[&quot;Shadow&quot;]));
ThrowIfFailed(hr);
</code></pre>
<p>basePsoDesc is used for creating test pso:</p>
<pre><code>D3D12_GRAPHICS_PIPELINE_STATE_DESC basePsoDesc;
    ZeroMemory(&amp;basePsoDesc, sizeof(D3D12_GRAPHICS_PIPELINE_STATE_DESC));
    basePsoDesc.InputLayout = { mLoadModelInputLayout.data(), (UINT)mLoadModelInputLayout.size() };
    basePsoDesc.pRootSignature = mRootSignature.Get();
    basePsoDesc.VS =
    {
        reinterpret_cast&lt;BYTE*&gt;(mShaders[&quot;testVS&quot;]-&gt;GetBufferPointer()),
        mShaders[&quot;testVS&quot;]-&gt;GetBufferSize()
    };
    basePsoDesc.PS =
    {
        reinterpret_cast&lt;BYTE*&gt;(mShaders[&quot;testPS&quot;]-&gt;GetBufferPointer()),
        mShaders[&quot;testPS&quot;]-&gt;GetBufferSize()
    };
    basePsoDesc.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT);
    basePsoDesc.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT);
    basePsoDesc.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT);
    basePsoDesc.SampleMask = UINT_MAX;
    basePsoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
    basePsoDesc.NumRenderTargets = 1;
    basePsoDesc.RTVFormats[0] = mBackBufferFormat;
    basePsoDesc.SampleDesc.Count = m4xMsaaState ? 4 : 1;
    basePsoDesc.SampleDesc.Quality = m4xMsaaState ? (m4xMsaaQuality - 1) : 0;
    basePsoDesc.DSVFormat = mDepthStencilFormat;
    ThrowIfFailed(md3dDevice-&gt;CreateGraphicsPipelineState(&amp;basePsoDesc, IID_PPV_ARGS(&amp;mPSOs[&quot;test&quot;]))); 
</code></pre>
<p>Shader input layout code:</p>
<pre><code>mLoadModelInputLayout =
    {
        { &quot;POSITION&quot;,     0, DXGI_FORMAT_R32G32B32_FLOAT,   0,   0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
        { &quot;NORMAL&quot;,       0, DXGI_FORMAT_R32G32B32_FLOAT,   1,   0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
        { &quot;TANGENT&quot;,      0, DXGI_FORMAT_R32G32B32_FLOAT,   2,   0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
        { &quot;TEXCOORD&quot;,     0, DXGI_FORMAT_R32G32_FLOAT,      3,   0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
    };
</code></pre>
<p>And the Shadow shader code:</p>
<pre><code>struct VertexIn
{
    float3 posL : POSITION;
};

struct VertexOut
{
    float4 posH : SV_POSITION;
};

VertexOut VS(VertexIn vin)
{
    VertexOut vout;
    float4 posW = mul(float4(vin.posL, 1.0f), mxWorld);
    vout.posH = mul(posW, mxViewProj);
    return vout;
}

void PS(VertexOut vout)
{

}
</code></pre>
<p>who can tell me why there is no detailed error information output or where the code is wrong? thanks</p>

CC BY-SA 4.0
2021-10-09T16:44:21.320Z
Just to be sure - you're looking in the Output pane in Visual Studio, with the VS debugger attached to the app? The debug layer output doesn't get printed to the console, but only to the debugger output.
Nathan Reed
CC BY-SA 4.0
2021-10-09T16:46:25.557Z
Also, one thing that might be amiss is that you have a pixel shader, but zero render targets for the shadow pass. Ordinarily in that case there would just not be a pixel shader (`shadowPsoDesc.PS = { nullptr, 0 }`). (Although you still could have a pixel shader if you wanted to use `discard` or modify the written depth, so this is not necessarily an error.)
Nathan Reed
CC BY-SA 4.0
2021-10-10T01:14:46.483Z
well, the output plane only displayed the "E_INVALIDARG" and "_com_error". It doesn't display detailed error information. I guess there may be a pointer error but I don't know which one it is.
typpe C
CC BY-SA 4.0
2021-10-10T01:49:09.160Z
Oh, I just remembered that on Windows 10 there's a special extra thing you have to turn on in order to get the debug layer: https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-layers - see "enable the "Graphics Tools" optional feature". Have you done that?
Nathan Reed
CC BY-SA 4.0
2021-10-10T02:11:17.217Z
yes, Graphics tools are already installed on my system.
typpe C
<directx12><debugging><render>
DX12 Debug Layer doesn't output detailed error information
typpe C
# DX12 Debug Layer doesn't output detailed error information

(Asked by: username_0 on 2021-10-09)

When I use the CreateGraphicsPipelineState function in DX12, there's an error "E\_INVALIDARG One or more arguments are invalid." returned by the function, but there isn't detailed information on which argument is wrong. I'm sure I opened the debug layer, here is the code:

```
#if defined(DEBUG) || defined(_DEBUG) 
    {
        ComPtr<ID3D12Debug> debugController;
        if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController))))
        {
            debugController->EnableDebugLayer();
        }
    }
#endif

```

I also opened the debug layer in the DirectX Control Panel. And it also has no detailed error information in the output window. I really can not find which argument is wrong. Here is my code:

```
//
// PSO for shadow map pass.
//
D3D12_GRAPHICS_PIPELINE_STATE_DESC shadowPsoDesc = basePsoDesc;
shadowPsoDesc.RasterizerState.DepthBias = 100000;
shadowPsoDesc.RasterizerState.DepthBiasClamp = 0.0f;
shadowPsoDesc.RasterizerState.SlopeScaledDepthBias = 1.0f;
shadowPsoDesc.pRootSignature = mRootSignature.Get();
shadowPsoDesc.VS =
{
    reinterpret_cast<BYTE*>(mShaders["ShadowVS"]->GetBufferPointer()),
    mShaders["ShadowVS"]->GetBufferSize()
};
shadowPsoDesc.PS =
{
    reinterpret_cast<BYTE*>(mShaders["ShadowPS"]->GetBufferPointer()),
    mShaders["ShadowPS"]->GetBufferSize()
};

// Shadow map pass does not have a render target.
shadowPsoDesc.RTVFormats[0] = DXGI_FORMAT_UNKNOWN;
shadowPsoDesc.NumRenderTargets = 0;
HRESULT hr = md3dDevice->CreateGraphicsPipelineState(&shadowPsoDesc, IID_PPV_ARGS(&mPSOs["Shadow"]));
ThrowIfFailed(hr);

```

basePsoDesc is used for creating test pso:

```
D3D12_GRAPHICS_PIPELINE_STATE_DESC basePsoDesc;
    ZeroMemory(&basePsoDesc, sizeof(D3D12_GRAPHICS_PIPELINE_STATE_DESC));
    basePsoDesc.InputLayout = { mLoadModelInputLayout.data(), (UINT)mLoadModelInputLayout.size() };
    basePsoDesc.pRootSignature = mRootSignature.Get();
    basePsoDesc.VS =
    {
        reinterpret_cast<BYTE*>(mShaders["testVS"]->GetBufferPointer()),
        mShaders["testVS"]->GetBufferSize()
    };
    basePsoDesc.PS =
    {
        reinterpret_cast<BYTE*>(mShaders["testPS"]->GetBufferPointer()),
        mShaders["testPS"]->GetBufferSize()
    };
    basePsoDesc.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT);
    basePsoDesc.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT);
    basePsoDesc.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT);
    basePsoDesc.SampleMask = UINT_MAX;
    basePsoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
    basePsoDesc.NumRenderTargets = 1;
    basePsoDesc.RTVFormats[0] = mBackBufferFormat;
    basePsoDesc.SampleDesc.Count = m4xMsaaState ? 4 : 1;
    basePsoDesc.SampleDesc.Quality = m4xMsaaState ? (m4xMsaaQuality - 1) : 0;
    basePsoDesc.DSVFormat = mDepthStencilFormat;
    ThrowIfFailed(md3dDevice->CreateGraphicsPipelineState(&basePsoDesc, IID_PPV_ARGS(&mPSOs["test"]))); 

```

Shader input layout code:

```
mLoadModelInputLayout =
    {
        { "POSITION",     0, DXGI_FORMAT_R32G32B32_FLOAT,   0,   0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
        { "NORMAL",       0, DXGI_FORMAT_R32G32B32_FLOAT,   1,   0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
        { "TANGENT",      0, DXGI_FORMAT_R32G32B32_FLOAT,   2,   0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
        { "TEXCOORD",     0, DXGI_FORMAT_R32G32_FLOAT,      3,   0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
    };

```

And the Shadow shader code:

```
struct VertexIn
{
    float3 posL : POSITION;
};

struct VertexOut
{
    float4 posH : SV_POSITION;
};

VertexOut VS(VertexIn vin)
{
    VertexOut vout;
    float4 posW = mul(float4(vin.posL, 1.0f), mxWorld);
    vout.posH = mul(posW, mxViewProj);
    return vout;
}

void PS(VertexOut vout)
{

}

```

who can tell me why there is no detailed error information output or where the code is wrong? thanks

**Tags:** directx12, debugging, render

> **Comments:**
> **username_1**: Just to be sure - you're looking in the Output pane in Visual Studio, with the VS debugger attached to the app? The debug layer output doesn't get printed to the console, but only to the debugger output.  
> **username_1**: Also, one thing that might be amiss is that you have a pixel shader, but zero render targets for the shadow pass. Ordinarily in that case there would just not be a pixel shader (`shadowPsoDesc.PS = { nullptr, 0 }`). (Although you still could have a pixel shader if you wanted to use `discard` or modify the written depth, so this is not necessarily an error.)  
> **username_0**: well, the output plane only displayed the "E_INVALIDARG" and "_com_error". It doesn't display detailed error information. I guess there may be a pointer error but I don't know which one it is.  
> **username_1**: Oh, I just remembered that on Windows 10 there's a special extra thing you have to turn on in order to get the debug layer: https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-layers - see "enable the "Graphics Tools" optional feature". Have you done that?  
> **username_0**: yes, Graphics tools are already installed on my system.  

---

## 0 answers

