Returning Error Codes Received from Runtime Functions
Calls to the Direct3D version 9 user-mode display driver-supplied functions must return error codes that they receive when they call the Direct3D runtime-supplied kernel-services accessing functions. For example, the runtime might call a user-mode display driver function, such as the CreateResource function. This, in turn, calls a runtime-supplied function, such as the pfnAllocateCb function, to perform a specific operation, in this case to allocate memory for the resource. If the user-mode display driver receives an error code from the call to the runtime-supplied function, it must return that error code back to the runtime.
Note There is one exception to the rule that a driver must pass a runtime error code back to the runtime. When the driver calls the pfnAllocateCb runtime-supplied function, to allocate video memory for optional resources when the video memory is already allocated, the rule does not apply. If pfnAllocateCb fails to allocate this video memory for optional resources that are only required to optimize performance, the driver should not report the out-of-memory error (E_OUTOFMEMORY) back to the runtime.