青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當自強而不息

DXUT框架剖析(5)

修改可用的設備

應用程序可以通過DXUTSetCallbackDeviceChanging()設置回調函數來修改Direct3D設備的創建設置:

Sets a callback function that allow the application to change the device settings before the device is created.

VOID DXUTSetCallbackDeviceChanging(
LPDXUTCALLBACKMODIFYDEVICESETTINGS pCallbackModifyDeviceSettings,
void* pUserContext
);

Parameters

pCallbackModifyDeviceSettings
[in] Pointer to a LPDXUTCALLBACKMODIFYDEVICESETTINGS callback function. If the callback function is supplied, it will be called before the Direct3D device is created. If NULL, DXUT will not notify the application about device changes.
pUserContext
[in] Pointer to a user-defined value which is passed to the callback function. Typically used by an application to pass a pointer to a data structure that provides context information for the callback function. The default value is NULL

Return Values

No return value.

Remarks

Before a device is created by DXUT, the LPDXUTCALLBACKMODIFYDEVICESETTINGS callback will be called to allow the application to examine or change the device settings before the device is created. This allows an application to modify the device creation settings as it sees fit.

This callback also allows applications to reject changing the device altogether. Returning false from inside this callback will notify DXUT to keep using the current device instead of changing to the new device.

LPDXUTCALLBACKMODIFYDEVICESETTINGS

Application-defined callback function, called by DXUT to allow changes in device settings before the device is created.

bool LPDXUTCALLBACKMODIFYDEVICESETTINGS(
DXUTDeviceSettings * pDeviceSettings,
void* pUserContext
);

Parameters

pDeviceSettings
[in] Pointer to a DXUTDeviceSettings structure that contains the settings for the new device.
pUserContext
[in] Pointer to a user-defined value which is passed to the callback function. Typically used by an application to pass a pointer to a data structure that provides context information for the callback function. The default value is NULL

Return Values

Program the application to return true to continue creating the device. If not, the application should return false to continue using the current device if one exists.

Remarks

Before a device is created by DXUT, the LPDXUTCALLBACKMODIFYDEVICESETTINGS callback will be called to allow the application to examine or change the device settings before the device is created. This allows an application to modify the device creation settings as it sees fit.

This callback also allows applications to reject changing the device altogether. Returning false from inside this callback will notify DXUT to keep using the current device instead of changing to the new device.

Anything in pDeviceSettings can be changed by the application. DXUT will not prevent the failure of device creation caused by changes to device settings.

DXUTDeviceSettings

A union of settings describing how to create the Direct3D 9 or Direct3D 10 device.

typedef struct DXUTDeviceSettings {
DXUTDeviceVersion ver;
union {
DXUTD3D9DeviceSettings d3d9;
DXUTD3D10DeviceSettings d3d10;
};
} DXUTDeviceSettings, *LPDXUTDeviceSettings;

Members

ver
Indicates whether the settings structure is for a Direct3D 9 or Direct3D 10 device.
d3d9
Device settings for Direct3D 9 device. Only valid if ver is DXUT_D3D9_DEVICE.
d3d10
Device settings for Direct3D 10 device. Only valid if ver is DXUT_D3D10_DEVICE.

Remarks

The DXUTDeviceSettings can only describe a single device because the DXUTD3D9DeviceSettings and DXUTD3D10DeviceSettings member variables are unioned together. The DXUTDeviceVersion indicates which of these structures is valid.

DXUTD3D9DeviceSettings

Describes the settings used to create a Direct3D 9 device.

typedef struct DXUTD3D9DeviceSettings {
UINT AdapterOrdinal;
D3DDEVTYPE DeviceType;
D3DFORMAT AdapterFormat;
DWORD BehaviorFlags;
D3DPRESENT_PARAMETERS pp;
} DXUTD3D9DeviceSettings, *LPDXUTD3D9DeviceSettings;

Members

AdapterOrdinal
Ordinal number that denotes the display adapter.
DeviceType
Enumerated type of the device.
AdapterFormat
Adapter surface format.
BehaviorFlags
Behavior flags. This member can be a combination of one or more of the D3DCREATE values.
pp
Presentation parameters structure.

DXUT fills this structure with valid values, and then passes the structure to the callback function where the application can modify it. Be sure to validate any changes your application makes in this callback function. Here is an example that changes the depth-stencil format.

bool CALLBACK ModifyDeviceSettings( 
DXUTDeviceSettings* pDeviceSettings,
void* pUserContext )
{
if( pDeviceSettings->ver == DXUT_D3D9_DEVICE )
{
IDirect3D9* pD3D = DXUTGetD3DObject();

if( SUCCEEDED( pD3D->CheckDeviceFormat(
pDeviceSettings->d3d9.AdapterOrdinal, pDeviceSettings->d3d9.DeviceType,
pDeviceSettings->d3d9.AdapterFormat, D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE, D3DFMT_D24S8 ) ) )
{
if( SUCCEEDED( pD3D->CheckDepthStencilMatch(
pDeviceSettings->d3d9.AdapterOrdinal, pDeviceSettings->d3d9.DeviceType,
pDeviceSettings->d3d9.AdapterFormat, pDeviceSettings->d3d9.pp.BackBufferFormat,
D3DFMT_D24S8 ) ) )
{
pDeviceSettings->d3d9.pp.AutoDepthStencilFormat = D3DFMT_D24S8;
}
}
}

return true;
}

如果應用程序需要的深度模板格式是D3DFMT_D24S8,那么程序需要確定設備支持它。

回調函數ModifyDeviceSettings()返回一個布爾值,如果應用程序返回TRUE,DXUT框架繼續像在正常情況下那樣進行設備創建。如果返回FALSE,框架不能改變設備,如果已有一個設備,則繼續使用當前設備。如果框架提出的請求是改變到一個應用程序不能使用的設備,應用程序可以拒絕該請求。例如,在一個多顯示器配置中,默認情況下在顯示器之間拖動窗口將使框架改變設備。但如果應用程序不能使用其他設備,它就必須拒絕這種改變并繼續使用當前設備。

 

降級到軟件頂點處理

Be careful if your hardware supports pixel processing (transforms and lighting) but does not support vertex processing. One common mistake is to reject devices based on the vertex shader version in the (LPDXUTCALLBACKISD3D9DEVICEACCEPTABLE or LPDXUTCALLBACKISD3D10DEVICEACCEPTABLE) callback functions. The correct solution is to implement the checking in the ModifyDeviceSettings callback function as shown here.

bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, 
void* pUserContext )
{
if( pDeviceSettings->ver == DXUT_D3D9_DEVICE )
{
D3DCAPS9 caps;
DXUTGetD3D9DeviceCaps( pDeviceSettings, &caps );

// If device doesn't support HW T&L or doesn't support 1.1 vertex
// shaders in HW, then switch to SWVP.
if( (pCaps->DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0 ||
pCaps->VertexShaderVersion < D3DVS_VERSION(1,1) )
{
pDeviceSettings->d3d9.BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
}

else
{
pDeviceSettings->d3d9.BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
}
}

return true;
}

posted on 2008-05-15 15:44 lovedday 閱讀(1348) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美日韩亚洲一区二区三区| 欧美日韩大片| 国产精品一区二区三区乱码| 一级成人国产| 一本色道久久| 国产精品福利网| 性欧美暴力猛交另类hd| 亚洲女人天堂成人av在线| 国产精品日韩在线| 久久蜜桃香蕉精品一区二区三区| 欧美亚洲视频| 亚洲黑丝在线| 亚洲精品乱码久久久久久按摩观| 欧美日韩第一区日日骚| 午夜在线精品偷拍| 久久精品国产一区二区三| 在线国产亚洲欧美| 亚洲精品日韩一| 国产人成一区二区三区影院| 蜜桃av一区二区三区| 欧美日本在线视频| 欧美中文在线字幕| 欧美成人国产一区二区| 亚洲天堂av电影| 久久九九免费视频| 亚洲一二三区在线观看| 亚洲一区日韩在线| 欧美在线1区| 一本久久综合亚洲鲁鲁| 欧美在线免费观看| 一本色道久久综合亚洲91| 午夜久久99| 亚洲美女视频在线观看| 欧美一区二区三区四区高清 | 亚洲美女黄网| 国产日韩av一区二区| 亚洲成人在线视频网站| 国产精品一区二区三区四区 | 久久精品成人欧美大片古装| 欧美aⅴ一区二区三区视频| 午夜欧美大尺度福利影院在线看| 日韩视频久久| 亚洲春色另类小说| 欧美夜福利tv在线| 中文一区字幕| 欧美jizzhd精品欧美巨大免费| 性欧美xxxx视频在线观看| 欧美精品18videos性欧美| 久久久久久免费| 国产精品你懂得| 99re热这里只有精品视频| 亚洲国产精品成人久久综合一区| 小黄鸭精品aⅴ导航网站入口| 一二三区精品| 欧美经典一区二区三区| 欧美成人国产一区二区| 激情国产一区二区| 欧美一区二区三区另类 | 一本色道久久加勒比精品| 欧美在线观看你懂的| 欧美在线免费观看| 国产精品视频导航| 亚洲一区二区三区四区视频| 亚洲女ⅴideoshd黑人| 欧美人与性动交cc0o| 亚洲欧洲日韩综合二区| 亚洲精品影视| 欧美激情一区二区三级高清视频| 欧美激情自拍| 亚洲精品日日夜夜| 欧美激情视频一区二区三区在线播放 | 欧美大片网址| 亚洲国产一区二区在线| 99国产精品自拍| 欧美精品18+| 一区二区高清| 欧美一区二区高清在线观看| 国产视频在线观看一区| 欧美激情一区二区| 亚洲精品一区在线观看香蕉| 欧美激情一区二区三区成人| 日韩视频中文| 欧美一级久久久久久久大片| 国产午夜亚洲精品不卡| 久久久久se| 亚洲国产精品t66y| 亚洲视频电影图片偷拍一区| 国产精品卡一卡二| 欧美一区国产在线| 欧美 日韩 国产在线| 99国产精品久久久久老师| 欧美日韩一区综合| 午夜精品视频一区| 欧美成人免费大片| 一个色综合av| 国产视频一区二区在线观看 | 亚洲久久视频| 性做久久久久久| 一区二区在线视频| 欧美日产国产成人免费图片| 亚洲欧美日韩区| 女人天堂亚洲aⅴ在线观看| 一区二区三区www| 国内精品福利| 欧美久久久久久久久| 校园春色综合网| 91久久精品国产91性色tv| 香蕉久久夜色精品| 亚洲精品久久久久久久久久久久久| 欧美性猛交xxxx免费看久久久| 欧美专区日韩专区| 一区二区三区欧美视频| 久久久亚洲国产美女国产盗摄| 99热这里只有成人精品国产| 国产午夜精品全部视频播放| 欧美极品一区| 久久综合久久综合久久综合| 亚洲一区二区四区| 亚洲人体一区| 农村妇女精品| 久久er99精品| 亚洲欧美网站| 99v久久综合狠狠综合久久| 国产视频一区三区| 国产精品久久国产愉拍| 欧美风情在线观看| 久久久国产一区二区三区| 亚洲午夜电影在线观看| 亚洲日本va午夜在线电影| 麻豆精品在线观看| 久久精品久久99精品久久| 亚洲综合色婷婷| 夜夜精品视频| 99国产一区二区三精品乱码| 91久久嫩草影院一区二区| 狠狠狠色丁香婷婷综合激情| 久久香蕉精品| 久久精品国产精品亚洲| 香蕉av777xxx色综合一区| 亚洲午夜精品久久久久久浪潮| 亚洲精品欧美一区二区三区| 亚洲国产精品久久久久| 欧美二区视频| 欧美韩日一区二区三区| 欧美激情在线播放| 欧美激情欧美狂野欧美精品| 欧美成人日韩| 亚洲国产欧美日韩另类综合| 欧美大色视频| 亚洲娇小video精品| 亚洲激情影院| 亚洲欧洲日韩在线| 日韩亚洲精品电影| 一本色道久久88综合亚洲精品ⅰ | 亚洲欧洲一区| 亚洲精品国产精品乱码不99按摩| 亚洲精品久久| 在线一区二区三区四区| 亚洲私人黄色宅男| 欧美一区二区日韩| 久久综合九色99| 欧美激情国产日韩| 国产精品久久久久久久久久免费| 国产精品资源在线观看| 国产主播一区二区三区| 亚洲第一页自拍| 99精品视频免费观看视频| 亚洲影音一区| 久久久精品一区二区三区| 欧美激情亚洲| 宅男在线国产精品| 久久动漫亚洲| 欧美激情视频网站| 国产精品专区h在线观看| 一区免费观看| 一区二区激情视频| 久久精品免视看| 亚洲福利在线视频| 亚洲一区二区三区视频播放| 久久精品在线免费观看| 欧美精品在线观看播放| 国产日韩欧美三区| 亚洲毛片网站| 久久久久9999亚洲精品| 亚洲精品小视频在线观看| 午夜欧美不卡精品aaaaa| 欧美成人一区二区三区在线观看| 国产精品久久久久久久久免费桃花 | 久久久久久精| 欧美三级视频在线播放| 欧美喷水视频| 国产综合精品| 中国亚洲黄色| 欧美二区在线看| 亚洲主播在线观看| 欧美日韩和欧美的一区二区| 黑人极品videos精品欧美裸| 亚洲永久免费视频| 亚洲第一中文字幕| 久久精品99无色码中文字幕|