Skip to main content
Minor grammar fixes, markdown formatting
Source Link
liggiorgio
  • 5.5k
  • 6
  • 27
  • 38

d3d11 D3D11 CreateInputLayout error  : CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE

I created a simple shader, and it compiled, but when using the vs as input layout, it failed with CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE. I don't know why.

hereHere is the shader:

theThe shader file is saved using the western windows(code 1252)Windows-1252 code page, I also tried utf8UTF8, but the resultresult is the same.

d3d11 CreateInputLayout error  : CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE

I created a simple shader, it compiled, but when using the vs as input layout, it failed with CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE. I don't know why.

here is the shader:

the shader file is saved using western windows(code 1252) code page, I also tried utf8, but the result is the same.

D3D11 CreateInputLayout error: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE

I created a simple shader, and it compiled, but when using the vs as input layout, it failed with CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE. I don't know why.

Here is the shader:

The shader file is saved using the western Windows-1252 code page, I also tried UTF8, but the result is the same.

added 3 characters in body
Source Link

the shader file is saved asusing western windows(code 1252) code page, I also tried utf8, but the result is the same.

the shader file is saved as western windows(code 1252) code page, I also tried utf8, but the result is the same.

the shader file is saved using western windows(code 1252) code page, I also tried utf8, but the result is the same.

Source Link

d3d11 CreateInputLayout error : CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE

I created a simple shader, it compiled, but when using the vs as input layout, it failed with CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE. I don't know why.

here is the shader:


struct appdata
{
    float3 vertex : POSITION;
};

struct v2f
{
    float4 vertex : SV_POSITION;
    float2 uv : TEXCOORD0;
};

 v2f VSMain (appdata v)
 {
    v2f o;
    o.vertex = float4( v.vertex, 1);
    o.uv = float2(0.0,0.0);
    // o.uv = v.uv;
    return o;
 }

Texture2D _MainTex : register(t0);

SamplerState MeshTextureSampler : register(s0);

float4 PSMain (v2f i) : SV_Target
{
    // fixed4 col = tex2D(_MainTex, i.uv);
    // fixed4 col = _MainTex.Sample(_LinearClamp, i.uv);
    //fixed4 col = _MainTex.Sample(MeshTextureSampler, i.uv);
    float4 col ;
    col = float4(1.0, 1.0, 0.0, 1.0);
    return col;
}

Here is the InputLayout code:

HRESULT PreviewWindow::CreateBlitPSO(int shaderSourceLength, const char* shaderSource) {
    HRESULT hr;
    ComPtr<ID3DBlob> vs = nullptr;
    hr = CompileShader(shaderSourceLength, shaderSource, "VSMain", "vs_5_0", vs);
    if (FAILED(hr)) {
        return hr;
    }
    auto vsLength = vs->GetBufferSize();
    hr = m_pDevice->CreateVertexShader(vs->GetBufferPointer(), vsLength, nullptr, m_vs.ReleaseAndGetAddressOf());
    if (FAILED(hr)) {
        LogFormat("Create vertex shader from blob failed! hr = %08x\n", hr);
        return hr;
    }
    ComPtr<ID3DBlob> ps = nullptr;
    hr = CompileShader(shaderSourceLength, shaderSource, "PSMain", "ps_5_0", ps);
    if (FAILED(hr)) {
        return hr;
    }
    hr = m_pDevice->CreatePixelShader(ps->GetBufferPointer(), ps->GetBufferSize(), nullptr, m_ps.ReleaseAndGetAddressOf());
    if (FAILED(hr)) {
        LogFormat("Create pixel shader from blob failed! hr = %08x\n", hr);
        return hr;
    }
    D3D11_INPUT_ELEMENT_DESC ied[] = {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    };
    int length = _countof(ied);
    hr = m_pDevice->CreateInputLayout(ied, length, m_vs.Get(), vsLength, m_input.ReleaseAndGetAddressOf());
    if (FAILED(hr)) {
        //d3d11 debug layer reports "CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE" here
        LogFormat("create input layout failed! hr = %08x", hr);
        return hr;
    }
    return hr;
}

the shader file is saved as western windows(code 1252) code page, I also tried utf8, but the result is the same.