Fix replay of ID3D11Device::CreateInputLayout with no input elements

* ID3D11Device::CreateInputLayout will fail if we pass a NULL descriptor
  array pointer, even though 0xdeadbeef will work so it doesn't actually
  use the pointer at all.
This commit is contained in:
baldurk
2018-02-06 00:21:09 +00:00
parent cf317fcd24
commit 55ebe38044
+9 -3
View File
@@ -1242,9 +1242,14 @@ bool WrappedID3D11Device::Serialise_CreateInputLayout(
if(IsReplayingAndReading())
{
// for no explicable reason, CreateInputLayout requires a descriptor pointer even if
// NumElements==0.
D3D11_INPUT_ELEMENT_DESC dummy = {};
const D3D11_INPUT_ELEMENT_DESC *inputDescs = pInputElementDescs ? pInputElementDescs : &dummy;
ID3D11InputLayout *ret = NULL;
HRESULT hr = m_pDevice->CreateInputLayout(
pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, &ret);
inputDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, &ret);
if(FAILED(hr))
{
@@ -1260,8 +1265,9 @@ bool WrappedID3D11Device::Serialise_CreateInputLayout(
AddResource(pInputLayout, ResourceType::StateObject, "Input Layout");
m_LayoutDescs[ret] =
std::vector<D3D11_INPUT_ELEMENT_DESC>(pInputElementDescs, pInputElementDescs + NumElements);
if(NumElements > 0)
m_LayoutDescs[ret] = std::vector<D3D11_INPUT_ELEMENT_DESC>(pInputElementDescs,
pInputElementDescs + NumElements);
if(BytecodeLength > 0 && pShaderBytecodeWithInputSignature)
m_LayoutShaders[ret] =