Falcor icon indicating copy to clipboard operation
Falcor copied to clipboard

error by createGraphicsPipelineState

Open bryan05 opened this issue 7 years ago • 6 comments

My Input layout looks like this:

	input_layout = Falcor::VertexLayout::create();

	Falcor::VertexBufferLayout::SharedPtr pVbLayout = Falcor::VertexBufferLayout::create();
	pVbLayout->addElement("POSITION", 0, ResourceFormat::RGB32Float, 1, 0);
	pVbLayout->addElement("TEXCOORD", 12, ResourceFormat::RGBA32Float, 1, 1);
	pVbLayout->addElement("TEXCOORD", 28, ResourceFormat::RGBA16Float, 1, 2);
	input_layout->addBufferLayout(0, pVbLayout);

when I call createGraphicsPipelineState, I got an error: D3D12 ERROR: ID3D12Device::CreateInputLayout: Element[2] and Element[1] have the same Semantic (TEXCOORD 0). All Semantics in the Input Layout must be unique. This error is only printed on the first occurence detected. [ STATE_CREATION ERROR #62: CREATEINPUTLAYOUT_DUPLICATESEMANTIC]

bryan05 avatar Jul 03 '18 21:07 bryan05

This is not a bug, DirectX requires input layout elements to have unique semantic names per layout.

kyaoNV avatar Jul 03 '18 21:07 kyaoNV

If you have a texcoord array in your shader, the names should be TEXCOORD[0] and TEXCOORD[1]

nbentyNV avatar Jul 03 '18 21:07 nbentyNV

Does Falcor support using numbered semantics, e.g., COLOR0 and COLOR1?

In the bare D3D12 API, you would handle that case by specifying a separate "semantic name" and "semantic index" and the API only requires that the name+index be unique. If Falcor parses an integer suffix on the semantic name string, then that would work, but it might also surprise users coming from the bare D3D API.

tangent-vector avatar Jul 03 '18 21:07 tangent-vector

We do. @bryan05 Ignore my previous comment. pVbLayout->addElement() accepts an arraySize. You don't need to call it twice for TEXCOORD, just call it once and pass 2 as the array size.

nbentyNV avatar Jul 03 '18 21:07 nbentyNV

TEXCOORD 0 is ResourceFormat::RGBA32Float but TEXCOORD 1 is ResourceFormat::RGBA16Float, does the array still work?

bryan05 avatar Jul 03 '18 21:07 bryan05

No, Falcor doesn't support that :( Reopening the issue, we'll need to support it at some point, but it's low priority for now

nbentyNV avatar Jul 03 '18 21:07 nbentyNV