CreateInputLayout Help
Can you post some code where you set the parameters to pass to CreateInputLayout?
VOID
CreateInputLayout( ID3D10Device* Device )
{
HRESULT hr;
ID3D10Blob *compiledFx = 0, *errorMsgs = 0;
ID3D10Effect *effect;
ID3D10EffectPass* effectPass;
ID3D10EffectTechnique* effectTechnique;
D3D10_PASS_DESC passDesc;
D3D10_INPUT_ELEMENT_DESC layoutDesc[ ] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0, 20, D3D10_INPUT_PER_VERTEX_DATA, 0 }
};
CHAR effectFile[ ] = \
"Texture2D SpriteTex;"
"SamplerState samLinear {"
" Filter = MIN_MAG_MIP_LINEAR;"
" AddressU = WRAP;"
" AddressV = WRAP;"
"};"
"struct VertexIn {"
" float3 PosNdc : POSITION;"
" float2 Tex : TEXCOORD;"
" float4 Color : COLOR;"
"};"
"struct VertexOut {"
" float4 PosNdc : SV_POSITION;"
" float2 Tex : TEXCOORD;"
" float4 Color : COLOR;"
"};"
"VertexOut VS(VertexIn vin) {"
" VertexOut vout;"
" vout.PosNdc = float4(vin.PosNdc, 1.0f);"
" vout.Tex = vin.Tex;"
" vout.Color = vin.Color;"
" return vout;"
"};"
"float4 PS(VertexOut pin) : SV_Target {"
" return pin.Color*SpriteTex.Sample(samLinear, pin.Tex);"
"};"
"technique10 SpriteTech {"
" pass P0 {"
" SetVertexShader( CompileShader( vs_4_0, VS() ) );"
" SetGeometryShader( NULL );"
" SetPixelShader( CompileShader( ps_4_0, PS() ) );"
" }"
"}";
D3DCompile(
effectFile,
strlen( effectFile ),
0,
0,
0,
"SpriteTech",
"fx_4_0",
0,
0,
&compiledFx,
&errorMsgs
);
D3D10CreateEffectFromMemory(
compiledFx->GetBufferPointer(),
compiledFx->GetBufferSize(),
0,
Device,
NULL,
&effect
);
compiledFx->Release();
effectTechnique = effect->GetTechniqueByName( "SpriteTech" );
effectPass = effectTechnique->GetPassByIndex(0);
effectPass->GetDesc(&passDesc);
hr = device->CreateInputLayout(
layoutDesc,
sizeof( layoutDesc ) / sizeof( layoutDesc[ 0 ] ),
passDesc.pIAInputSignature,
passDesc.IAInputSignatureSize,
&inputLayout
);
if (FAILED(hr))
{
OutputDebugStringW(L"ID3D10Device::CreateInputLayout failed!");
//return;
}
} I can't make it any simpler than this
{ "COLOR", 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0, 20, D3D10_INPUT_PER_VERTEX_DATA, 0 }
According to this page, it would seem that DXGI_FORMAT_B8G8R8A8_UNORM is not available for D3D10. I'd guess that you'd have no trouble not using a 10.1 device if you used the R8G8B8A8_UNORM (or something similar that's acceptable for your needs) format instead.
{ "COLOR", 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0, 20, D3D10_INPUT_PER_VERTEX_DATA, 0 }According to this page, it would seem that DXGI_FORMAT_B8G8R8A8_UNORM is not available for D3D10. I'd guess that you'd have no trouble not using a 10.1 device if you used the R8G8B8A8_UNORM (or something similar that's acceptable for your needs) format instead.
That worked. A big thanks to you both.
If you create your device using the D3D10_CREATE_DEVICE_DEBUG flag, then you will get helpful messages in the debugger output window telling exactly why failures like this are occuring. It will also tell you about runtime errors that normally just cause silent failures, such as binding a texture as both a shader resource view and a render target view simultaneously. I always enable it for debug builds, since it can catch a lot of bugs.
If you create your device using the D3D10_CREATE_DEVICE_DEBUG flag, then you will get helpful messages in the debugger output window telling exactly why failures like this are occuring. It will also tell you about runtime errors that normally just cause silent failures, such as binding a texture as both a shader resource view and a render target view simultaneously. I always enable it for debug builds, since it can catch a lot of bugs.
Also: I found you needed the newer Windows SDK on Windows 8 because of Direct3D11.1 and so the debug layer would not work.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.