Confirmed users, Bureaucrats and Sysops emeriti
1,680
edits
Line 145: | Line 145: | ||
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 | 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 interoperability. 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 should be set as the <code>data</code> member of the <code>NPAsyncSurface</code> structure before <code>NPN_InitAsyncSurface</code> is called to initialize the surface. The plugin must also set the <code>stride</code> member of <code>NPAsyncSurface</code> before calling <code>NPN_InitAsyncSurface</code>. | ||
The return value of the <code> | The return value of the <code>NPN_InitAsyncSurface</code> 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 then 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. | ||
Code | Plugins should finalize surfaces by calling <code>NPN_FinalizeAsyncSurface</code>. | ||
(Code sample coming soon) | |||
= Open Issues = | = Open Issues = | ||
* Add accelerated Linux drawing model. | * Add accelerated Linux drawing model. |