Fixed a bug where BufferStorage11 was unable to handle NULL data being set.

TRAC #22811 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2135 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 296c3f25
...@@ -160,12 +160,20 @@ void BufferStorage11::setData(const void* data, unsigned int size, unsigned int ...@@ -160,12 +160,20 @@ void BufferStorage11::setData(const void* data, unsigned int size, unsigned int
bufferDesc.MiscFlags = 0; bufferDesc.MiscFlags = 0;
bufferDesc.StructureByteStride = 0; bufferDesc.StructureByteStride = 0;
D3D11_SUBRESOURCE_DATA initialData; if (data)
initialData.pSysMem = data; {
initialData.SysMemPitch = size; D3D11_SUBRESOURCE_DATA initialData;
initialData.SysMemSlicePitch = 0; initialData.pSysMem = data;
initialData.SysMemPitch = size;
initialData.SysMemSlicePitch = 0;
result = device->CreateBuffer(&bufferDesc, &initialData, &mStagingBuffer);
}
else
{
result = device->CreateBuffer(&bufferDesc, NULL, &mStagingBuffer);
}
result = device->CreateBuffer(&bufferDesc, &initialData, &mStagingBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::error(GL_OUT_OF_MEMORY); return gl::error(GL_OUT_OF_MEMORY);
...@@ -211,12 +219,20 @@ void BufferStorage11::setData(const void* data, unsigned int size, unsigned int ...@@ -211,12 +219,20 @@ void BufferStorage11::setData(const void* data, unsigned int size, unsigned int
mBufferSize = 0; mBufferSize = 0;
} }
D3D11_SUBRESOURCE_DATA initialData; if (data)
initialData.pSysMem = data; {
initialData.SysMemPitch = size; D3D11_SUBRESOURCE_DATA initialData;
initialData.SysMemSlicePitch = 0; initialData.pSysMem = data;
initialData.SysMemPitch = size;
initialData.SysMemSlicePitch = 0;
result = device->CreateBuffer(&bufferDesc, &initialData, &mBuffer);
}
else
{
result = device->CreateBuffer(&bufferDesc, NULL, &mBuffer);
}
result = device->CreateBuffer(&bufferDesc, &initialData, &mBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::error(GL_OUT_OF_MEMORY); return gl::error(GL_OUT_OF_MEMORY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment