c++ - E_INVALIDARG in D3D11 -
i have tried figure out why keep getting e_invalidarg error when running code.
id3d11buffer * cbperobjectbuffer; cbperobject cbperobj; cbperobjectbuffer = 0; d3d11_buffer_desc cbbd; zeromemory( & cbbd, sizeof(d3d11_buffer_desc)); cbbd.usage = d3d11_usage_default; cbbd.bytewidth = sizeof(cbperobject); cbbd.bindflags = d3d11_bind_constant_buffer; cbbd.cpuaccessflags = 0; cbbd.miscflags = 0; cbbd.structurebytestride = 0; hr = device - > createbuffer( & cbbd, null, & cbperobjectbuffer); if (hr == e_invalidarg) { messagebox(0, l "[cbperobjectbuffer] invalid parameter passed returning function.", l "error", mb_ok); return; } else if (hr == e_outofmemory) { messagebox(0, l "[cbperobjectbuffer] out of memory", l "error", mb_ok); return; } else if (failed(hr)) { messagebox(0, l "[cbperobjectbuffer] unknown error occured", l "error", mb_ok); return; }
i keep getting e_invalidarg error when running code. myself can't seem figure out why error. if point me in right direction i'd greatful! :)
my guess 'cbperobject' not multiple of 16 bytes. constant buffers must multiple of 16 bytes in size.