0
$\begingroup$

I have found the following from this link enter link description here

pData

Type: void*

Pointer to the data. When ID3D11DeviceContext::Map provides the pointer, the runtime ensures that the pointer has a specific alignment, depending on the following feature levels:

For D3D_FEATURE_LEVEL_10_0 and higher, the pointer is aligned to 16 bytes. For lower than D3D_FEATURE_LEVEL_10_0, the pointer is aligned to 4 bytes.

Would someone please explain if I can reinterpret cast the void pointer into OLE_COLOR* or not?

$\endgroup$
3
  • $\begingroup$ What's OLD_HANDLE ? $\endgroup$ – PaulHK Feb 9 '20 at 7:28
  • $\begingroup$ Sorry it should be OLE_COLOR*. I edited. $\endgroup$ – Tajuddin Khandaker Feb 9 '20 at 8:44
  • $\begingroup$ That should be fine. You need to take care of memory alignment. This should be fine for pointers allocated via 'new' or other memory allocators, but be careful passing subscripts (e.g. the 2nd element of an array, that may not be aligned to 16 bytes like the [0]th element) $\endgroup$ – PaulHK Feb 10 '20 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.