Confirmed users
138
edits
Line 143: | Line 143: | ||
This drawing model will only be valid on Windows Vista and higher in order to simplify hardware accelerated surface sharing for plugins wanting to use Direct3D 9Ex. | This drawing model will only be valid on Windows Vista and higher in order to simplify hardware accelerated surface sharing for plugins wanting to use Direct3D 9Ex. | ||
In this drawing model the plugin will be responsible for actual creation of the texture. The reason for this behavior is that textures created in Direct3D 10 cannot be shared using Direct3D 9/10 interop. Textures created with Direct3D 9 ''can'' be opened in Direct3D 10. In this model the plugin will create a texture using the CreateTexture call on a Direct3D 9Ex device. The <code>pSharedHandle</code> argument will be used to acquire a shared handle for that texture. This shared handle will then, along with all the other information, passed into the <code>NPAsyncSurface</code> structure, with the <code>data</code> member set to the shared handle. | In this drawing model the plugin will be responsible for actual creation of the texture. The reason for this behavior is that textures created in Direct3D 10 cannot be shared using Direct3D 9/10 interop. Textures created with Direct3D 9 ''can'' be opened in Direct3D 10. In this model the plugin will create a texture using the CreateTexture call on a Direct3D 9Ex device. The <code>pSharedHandle</code> argument will be used to acquire a shared handle for that texture. This shared handle will then, along with all the other information, be passed into the <code>NPAsyncSurface</code> structure, with the <code>data</code> member set to the shared handle. | ||
The return value of the NPN_CreateAsyncSurface call will indicate if the surface was successfully accessed by the host. When a surface is set current the plugin must make sure all drawing calls to that surface have finished execution. For Direct3D 9Ex this means making sure that the GPU has processed all graphics command queued to draw to that surface in order to prevent race condition with a host using another device. One way of doing this is do use a <code>D3DQUERYTYPE_EVENT</code> query to determine when the graphics pipeline has finished executing all events. Another method is to execute a blocking readback from a small (i.e. 1x1 pixel) portion of the texture, when the readback has successfully executed the GPU has finished the drawing calls to the surface. Failure to follow these guidelines may result in incomplete drawing of the contents of the texture. | The return value of the NPN_CreateAsyncSurface call will indicate if the surface was successfully accessed by the host. When a surface is set current the plugin must make sure all drawing calls to that surface have finished execution. For Direct3D 9Ex this means making sure that the GPU has processed all graphics command queued to draw to that surface in order to prevent race condition with a host using another device. One way of doing this is do use a <code>D3DQUERYTYPE_EVENT</code> query to determine when the graphics pipeline has finished executing all events. Another method is to execute a blocking readback from a small (i.e. 1x1 pixel) portion of the texture, when the readback has successfully executed the GPU has finished the drawing calls to the surface. Failure to follow these guidelines may result in incomplete drawing of the contents of the texture. |