The common helper api for the directx com interop layer
ComBase
00 Remarks
All of the native resource wrapper in this project is pure managed code: the directx api is imported via DllImportAttribute and the com interface is declared via ComImportAttribute, there is no any unmanaged code or c++/cli bridge required.
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| IsDeviceLost | 1 | does the hresult mean that the rendering device or the render target is not usable any more? |
| ThrowIfFailed | 1 | check the HRESULT value of a directx api call |
| SafeRelease | 1 | release a com runtime callable wrapper object in a safe manner |
| ComQuery | 1 | QueryInterface on a com object, the returned raw interface pointer holds one reference which is owned by the caller. |
| ComObject | 1 | Wrap a raw com interface pointer as a strongly typed runtime callable wrapper object. |
| Pack64 | 2 | pack a D2D1_POINT_2F structure into one 64 bit argument slot |
| Multiply | 1 | a * b, the result is applied on the render target after the a matrix |
| RotationMatrix | 1 | make a rotation transform matrix around the given center point |
03 Fields
| Name | Overloads | Summary |
|---|---|---|
| DXGI_ERROR_DEVICE_REMOVED | 1 | the gpu device has been removed, the whole device has to be recreated |
| DXGI_ERROR_DEVICE_RESET | 1 | the gpu device has been reset |
| DXGI_ERROR_WAS_STILL_DRAWING | 1 | the gpu is still busy with the previous frame |
04 Members
Int32)does the hresult mean that the rendering device or the render target is not usable any more?
when this is the case, the swap chain and the direct2d render target must be recreated before the next drawing command is submitted.
Int32, String)check the HRESULT value of a directx api call
Object)release a com runtime callable wrapper object in a safe manner
Object, Guid, String)QueryInterface on a com object, the returned raw interface pointer holds one reference which is owned by the caller.
IntPtr)Wrap a raw com interface pointer as a strongly typed runtime callable wrapper object.
A com object that is created through the out parameter of another com method is wrapped by the clr as an untyped System.__ComObject, and such an object can not be dispatched through the interface method stub (QueryInterface on an untyped rcw always fails). creating the runtime callable wrapper explicitly with the target interface type here makes the interface pointer cacheable so that the interface method can be dispatched correctly.
Int32, Int32)pack two 32 bit values into one 64 bit argument slot
A com interface method that takes a small struct (8 bytes or less) by value can not be declared correctly in the vb.net interop layer, such a parameter is declared as a 64 bit integer here and the two structure members are packed into it.
D2D1_POINT_2F)pack a D2D1_POINT_2F structure into one 64 bit argument slot
a b, the result is applied on the render target after the a* matrix
Single, Single, Single)make a rotation transform matrix around the given center point
the gpu device has been removed, the whole device has to be recreated
the gpu device has been reset
the gpu is still busy with the previous frame