Graphics Reference
In-Depth Information
HRESULT hr = m_pDevice->CreateBlendState( &Config, SpState );
if ( FAILED( hr ) )
{
Log::Get().Write( L"Failed to create blend state!" );
return( -1 );
}
Listing 1.1. A sample usage of the FAILED macro.
In general, any case in which this macro returns a true value should be treated as an
error and handled accordingly. If the macro returns a false value, the method has succeeded
and should be considered not to have produced an error. This makes testing the result of a
method invocation much simpler and can be handled in a relatively simple way.
1.5.2 Application Requirements
With the basics of COM and HRESULT values behind us, we can move on to examine
what exactly a Win32 application must do to use Direct3D 11. We will begin with an over-
view of the complete responsibilities of the application, which is then followed by a more
detailed look at each of the processes that it must implement.
Program Flow Overview
The Direct3D 11 application lifecycle follows quite a
similar sequence to most other Win32 applications. The
block diagram for this standard sequence is shown in
Figure 1.3.
From Figure 1.3, we can see that the application
begins with a one-time initialization action. This is used
to obtain references to the device and device context, as
well as to create any resources that will be used during
the runtime of the application. The resources will vary
widely from application to application, while the de-
vice and device context creation are normally the same
across multiple applications.
After the application has been initialized, it en-
ters the message loop. This loop consists of two phases.
First, all pending Windows messages are handled with
the application's message handler. After all available
messages have been processed, the actual application
Figure 1.3. The standard operations
performed in a Win32 application.
Search WWH ::




Custom Search