D3D11 constant buffer must align ByteWidth to 16 bytes

See remarks of:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff476092(v=vs.85).aspx

Most PC drivers don't seem to enforce this, but it will
crash the xb1 implementation if fed an unaligned value.
This commit is contained in:
Matthew Endsley 2015-01-06 11:23:50 +00:00
parent 85bf5493c3
commit 2680bd0608

View file

@ -2647,7 +2647,7 @@ namespace bgfx { namespace d3d11
if (0 < size)
{
D3D11_BUFFER_DESC desc;
desc.ByteWidth = size;
desc.ByteWidth = (size + 0xf) & ~0xf;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
desc.CPUAccessFlags = 0;