1. The function [ IDirect3DDevice9::CololorFill() ] is removed, so use [ IDirect3DDevice9::Clear() ] and [ IDirect3DDevice9::Resolve() ] to get the same result.
2. Fixed pipeline is removed, so had batter use SetVertexDeclaration() to replace SetFVF() although part of SetFVF() is still reserved.
3. Textures that are created with flag:[D3DUSAGE_RENDERTARGET] cannot be used on XBOX360 as Render-Target. The flag [D3DUSAGE_RENDERTARGET] will be ignored automatically. So the code below would throw a exception on XBOX360:
4. IDirect3DDevice9::GetRenderTarget() will increase the reference count of the surface. So after using the surface, call Release() to decrease the reference count.
5. Only set PixelShader but not set VertexShader will causes XBOX360 to throw a exception.
6. Some math functions may do more strict validation than on PC, such as D3DXMatrixLookAtLH().
7. To avoid resource leak, put check of reference count in the cleanup function of all classes holding resources.
8. To trigger a breakpoint, use code: __asm{ int 3 } : This could only be used on X86.*
2. Fixed pipeline is removed, so had batter use SetVertexDeclaration() to replace SetFVF() although part of SetFVF() is still reserved.
3. Textures that are created with flag:[D3DUSAGE_RENDERTARGET] cannot be used on XBOX360 as Render-Target. The flag [D3DUSAGE_RENDERTARGET] will be ignored automatically. So the code below would throw a exception on XBOX360:
//------------------------------------------------
pTex->GetSurfaceLevel( 0, &pSurf );
pDevice->SetRenderTarget( 0, pSurf );
//------------------------------------------------
pTex->GetSurfaceLevel( 0, &pSurf );
pDevice->SetRenderTarget( 0, pSurf );
//------------------------------------------------
Use code below to create render-target for a texture . This could achicve the same effect.
//------------------------------------------------
//Validation
assert( pD3DDevice && "Input D3D device is invalid!" );
assert( pTexToGetSurfFrom && "Input texture is invalid!" );
#ifdef _WIN32
COM_RETURN( pTexToGetSurfFrom->GetSurfaceLevel( surfLevel, &pSurfGotFromTex ) );
#else
#pragma message( OUTPUTWARNING ( "Rendertarget surface changed. New target created." ) )
D3DSURFACE_DESC desc;
pTexToGetSurfFrom->GetLevelDesc( 0, &desc );
COM_RETURN( pD3DDevice->CreateRenderTarget( desc.Width,
desc.Height,
desc.Format,
desc.MultiSampleType, 0, 0,
&pSurfGotFromTex,
&renderTargetParameters ) );
#endif //_WIN32
return true;
}
//------------------------------------------------
inline bool CreateRenderTargetSurface( IDirect3DDevice9* pD3DDevice,
IDirect3DTexture9* pTexToGetSurfFrom,
u32 surfLevel,
IDirect3DSurface9* &pSurfGotFromTex )
{//Validation
assert( pD3DDevice && "Input D3D device is invalid!" );
assert( pTexToGetSurfFrom && "Input texture is invalid!" );
#ifdef _WIN32
COM_RETURN( pTexToGetSurfFrom->GetSurfaceLevel( surfLevel, &pSurfGotFromTex ) );
#else
#pragma message( OUTPUTWARNING ( "Rendertarget surface changed. New target created." ) )
D3DSURFACE_DESC desc;
pTexToGetSurfFrom->GetLevelDesc( 0, &desc );
UINT renderTargetSize = XGSurfaceSize( desc.Width, desc.Height,
desc.Format, desc.MultiSampleType );
COM_RETURN( pD3DDevice->CreateRenderTarget( desc.Width,
desc.Height,
desc.Format,
desc.MultiSampleType, 0, 0,
&pSurfGotFromTex,
&renderTargetParameters ) );
#endif //_WIN32
return true;
}
//------------------------------------------------
4. IDirect3DDevice9::GetRenderTarget() will increase the reference count of the surface. So after using the surface, call Release() to decrease the reference count.
5. Only set PixelShader but not set VertexShader will causes XBOX360 to throw a exception.
6. Some math functions may do more strict validation than on PC, such as D3DXMatrixLookAtLH().
7. To avoid resource leak, put check of reference count in the cleanup function of all classes holding resources.
8. To trigger a breakpoint, use code: __asm{ int 3 } : This could only be used on X86.*
-----------------------------------------------------------
每天进步一点