Ii. Details changes
1. function parameter changes:
SetIndices removes the parameter BaseVertexIndex and is added to DrawIndexedPrimitive.
DrawIndexedPrimitive adds the second parameter BaseVertexIndex, the number of offsets of the first vertex relative to the first vertex buffer address.
CreateTexture
CreateVolumeTexture
CreateCubeTexture
CreateVertexBuffer
CreateIndexBuffer
CreateRenderTarget
CreateDepthStencilSurfacE. Add the last parameter pSharedHandle, Reserverd.
GetBackBuffer
The first parameter iSwapChain and switching chain are added to GetDisplayMode.
SetStreamSource adds the third parameter OffsetInBytes
GetGammaRamp
SetGammaRamp
GetAdapterModeCount
Add the second parameter D3DFORMART to EnumAdapterModes.
GetAdapterIdentifier: the default value of the second parameter is changed. The macro is opposite.
D8: GetAdapterIdentifier (D3DADAPTER_DEFAULT, D3DENUM_NO_WHQL_LEVEL, & identifier) =
D9: GetAdapterIdentifier (D3DADAPTER_DEFAULT, 0, & identifier)
D8: GetAdapterIdentifier (D3DADAPTER_DEFAULT, 0, & identifier) =
D9: GetAdapterIdentifier (D3DADAPTER_DEFAULT, D3DENUM_WHQL_LEVEL, & identifier)
CheckDeviceType
The GetDeviceCaps mode has changed. For details, see the SDK, for example:
// CheckDeviceType function differences, Use CheckDeviceType and GetDeviceCaps together to verify the support of the devices on the adapter for the desired features
# Ifdef D3DX8
If (FAILED (m_pD3D-> CheckDeviceType (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, currentmode. Format, currentmode. Format, true )))
Return E_FAIL;
If (FAILED (m_pD3D-> CheckDeviceType (D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, currentmode. Format, currentmode. Format, true )))
Return E_FAIL;
If (FAILED (m_pD3D-> CheckDeviceType (D3DADAPTER_DEFAULT, D3DDEVTYPE_SW, currentmode. Format, currentmode. Format, true )))
{
// Return E_FAIL; // call failed
}
# Endif
# Ifdef D3DX9
If (FAILED (m_pD3D-> CheckDeviceType (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, currentmode. Format, D3DFMT_UNKNOWN, true) // D3DFMT_UNKNOWN for window mode
Return E_FAIL;
If (FAILED (m_pD3D-> CheckDeviceType (D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, currentmode. Format, D3DFMT_UNKNOWN, true )))
Return E_FAIL;
If (FAILED (m_pD3D-> CheckDeviceType (D3DADAPTER_DEFAULT, D3DDEVTYPE_SW, currentmode. Format, D3DFMT_UNKNOWN, true )))
{
//Return E_FAIL; // failed. Is there a plug-in for the 3rd party?
}
If (FAILED (m_pD3D-> CheckDeviceType (D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, currentmode. Format, D3DFMT_UNKNOWN, true )))
{
//Return E_FAIL; // never fail
}
# Endif
// D3DDEVTYPE D9 is more of the D3DDEVTYPE_NULLREF type than D8, but the objects created by devices of this type are invalid, and the useless D3DDEVTYPE_SW type has a new role
D3dcaps caps;
# Ifdef D3DX8
If (FAILED (m_pD3D-> GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, & caps )))
Return E_FAIL;
If (FAILED (m_pD3D-> GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, & caps )))
Return E_FAIL;
If (FAILED (m_pD3D-> GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_SW, & caps) // meaningless in D8
{
//Return E_FAIL;
}
# Endif
# Ifdef D3DX9
If (FAILED (m_pD3D-> GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, & caps )))
Return E_FAIL;
If (FAILED (m_pD3D-> GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, & caps )))
Return E_FAIL;
If (FAILED (m_pD3D-> GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_SW, & caps) // the 3rd-party device plug-in registered by the IDirect3D9: RegisterSoftwareDevice
{
//Return E_FAIL; // The call fails if it is not registered.
}
If (FAILED (m_pD3D-> GetDeviceCaps (D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, & caps) // as described above, any call will fail.
{
//Return E_FAIL;
}
# Endif
CheckDeviceMultiSampleTyPe adds a parameter pQualityLevels, which can be NULL.
SetRenderTarget:
SetRenderTarget (pRenderTarget, pnewzstencer) → the function is divided into two functions.
SetRenderTarget (RenderTargetIndex, pRenderTarget)
SetDepthStencilSurface (pnewzstencel)
The GetRenderTarget parameter RenderTargetIndex is added.
The pDefines parameter is added to the D3DXAssembleShader parameter, and the order has also changed. For details, see the SDK.
2. The function name is changed. The same function is changed to other functions: D8 → D9.
CreateImageSurface →
CreateOffscreenPlainSurfAce
SetRenderState (D3DRS_SOFTWAREVERTEXPROCESSING, BOOL B) →
SetSoftwareVertexProcessIng (BOOL B)
SetTextureStageState (some parameters,) →
SetSamplerState (parameter, )
Parameters:
D3DTSS_ADDRESSU D3DTSS_ADDRESSV D3DTSS_ADDRESSW D3DTSS_BORDERCOLOR
D3DTSS_MAGFILTER D3DTSS_MINFILTER D3DTSS_MIPFILTER
D3DTSS_MIPMAPLODBIASD3DTSS_MAXMIPLEVEL D3DTSS_MAXANISOTROPY D3DTSS_FORCE_DWORD →
D3DSAMP _ prefixed
D3DSAMP_ADDRESSU = 1,
D3DSAMP_ADDRESSV = 2,
D3DSAMP_ADDRESSW = 3,
D3DSAMP_BORDERCOLOR = 4,
D3DSAMP_MAGFILTER = 5,
D3DSAMP_MINFILTER = 6,
D3DSAMP_MIPFILTER = 7,
D3DSAMP_MIPMAPLODBIAS = 8,
D3DSAMP_MAXMIPLEVEL = 9,
D3DSAMP_MAXANISOTROPY = 10,
D3DSAMP_SRGBTEXTURE = 11,No
D3DSAMP_ELEMENTINDEX = 12, no
D3DSAMP_DMAPOFFSET = 13, No
D3DSAMP_FORCE_DWORD = 0x7fffffff,
SetVertexShader →
① Fixed pipeline fixed-function pipeline, SetFVF
② VertexShader and SetVertexShader
Remark: D9 to use SHADER, you must first call SetVertexDeclaration and then call SetVertexShader.
Therefore, you must first create an IDirect3DVertexDeclarati instance through CreateVertexDeclaration ().On9 object
For example:
VertexElement = {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 };
CreateVertexDeclaration (VertexElement, & VertexDeclaration );
SetVertexShaderConstant →
SetVertexShaderConstantF
ResourceManagerDiscardByTes →
EvictManagedResources
3. Attribute and structure change:
The structure change of D3DPRESENT_PARAMETERS is as follows:
D3dpp. FullScreen_PresentationInterval →
D3dpp. PresentationInterval
GetAdapterDisplayMode (D3DADAPTER_DEFAULT, & d3ddm)
D3dpp. BackBufferFormat = d3ddm. Format →
D3dpp. BackBufferFormat = D3DFMT_UNKNOWNIf it is set to D3DFMT_UNKNOWN in D8, sometimes an error occurs and the current display mode cannot be obtained.
The structure of D3DRENDERSTATETYPE varies a lot. The SDK is used as an example.
D3DRS_ZBIAS → D3DRS_DEPTHBIAS
D3DTEXTUREFILTERTYPE has changed.
D3DTEXF_GAUSSIANCUBIC →
D3DTEXF_GAUSSIANQUAD