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

天行健 君子當自強而不息

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>
            尤物yw午夜国产精品视频明星| 亚洲日韩欧美一区二区在线| 亚洲综合精品自拍| 一区二区三区精品国产| 欧美日韩国产综合视频在线| 一区二区三区精密机械公司| 亚洲少妇最新在线视频| 国产精品一区二区你懂得| 久久精品国产99| 久色成人在线| 夜久久久久久| 亚洲欧美在线磁力| 亚洲成人资源| 一本一本久久a久久精品综合妖精| 欧美视频国产精品| 久色成人在线| 欧美另类videos死尸| 欧美在线短视频| 乱中年女人伦av一区二区| 一本一本a久久| 亚洲欧美制服中文字幕| 亚洲高清不卡在线| 一区二区三欧美| 黄色成人小视频| 一区二区三区免费看| 狠狠综合久久| aⅴ色国产欧美| 一区二区视频在线观看| 亚洲精品久久久久久久久| 国产精品成人aaaaa网站| 久久久www成人免费无遮挡大片| 欧美电影电视剧在线观看| 午夜精品久久久久久久久| 久久久久久穴| 在线亚洲高清视频| 久久亚洲图片| 久久精品国产一区二区电影| 欧美日韩精选| 欧美黄色小视频| 国产午夜精品麻豆| 一区二区三区四区五区精品| 亚洲福利在线看| 久久精品91久久久久久再现| 亚洲一级片在线观看| 欧美va亚洲va日韩∨a综合色| 欧美一级大片在线观看| 欧美日韩久久精品| 亚洲电影一级黄| 一区在线播放视频| 亚洲欧美综合v| 亚洲视频一二三| 欧美人成免费网站| 欧美插天视频在线播放| 伊人色综合久久天天| 午夜视频在线观看一区| 亚洲欧美在线另类| 国产精品成人观看视频免费 | 亚洲国产精品va在线看黑人动漫| 亚洲女女女同性video| 亚洲主播在线| 国产精品理论片在线观看| 一区二区三区精品久久久| 夜夜躁日日躁狠狠久久88av| 老巨人导航500精品| 欧美.日韩.国产.一区.二区| 亚洲国产91| 美女精品一区| 亚洲国产精品va| 99re6热在线精品视频播放速度 | 亚洲男人的天堂在线观看| 亚洲欧美日韩一区二区在线| 国产精品视频1区| 亚洲欧美激情一区二区| 欧美一区二区大片| 国产欧美日韩精品丝袜高跟鞋| 亚洲自拍16p| 久久精品国内一区二区三区| 精品999在线观看| 欧美/亚洲一区| 亚洲破处大片| 午夜精品理论片| 国产午夜精品福利| 免费观看国产成人| 亚洲精品久久嫩草网站秘色| 亚洲在线播放电影| 国产农村妇女精品| 美女主播精品视频一二三四| 亚洲精品久久久久| 欧美一区二视频| 亚洲高清在线播放| 欧美日韩美女| 欧美在线1区| 亚洲激情六月丁香| 欧美一区二区三区四区在线观看| 一区二区亚洲精品| 欧美三级视频在线观看| 欧美伊人久久久久久午夜久久久久 | 国产精品资源在线观看| 久久亚洲一区二区三区四区| 亚洲精品视频一区二区三区| 久久国产精品亚洲77777| 亚洲高清在线观看| 国产美女搞久久| 欧美激情精品| 欧美主播一区二区三区美女 久久精品人| 免费观看不卡av| 亚洲欧美激情视频| 91久久一区二区| 国产日韩精品一区| 欧美成人免费视频| 欧美综合二区| 一区二区三区高清在线观看| 男人的天堂成人在线| 亚洲在线一区二区三区| 最新69国产成人精品视频免费| 国产精品美女久久久久av超清 | 国产日韩欧美自拍| 欧美日韩国产成人在线91| 欧美在线欧美在线| 亚洲视频免费在线| 91久久精品www人人做人人爽| 久久久久91| 欧美一区国产一区| 亚洲视频每日更新| 日韩视频免费大全中文字幕| 一区二区三区在线看| 国产一区白浆| 国产视频精品xxxx| 国产麻豆成人精品| 国产精品毛片在线看| 国产精品vip| 欧美日韩一本到| 欧美日韩hd| 欧美精品在线视频| 欧美激情在线狂野欧美精品| 模特精品在线| 久久亚洲私人国产精品va| 久久精品毛片| 久久视频国产精品免费视频在线| 午夜一区不卡| 欧美有码视频| 久久精品噜噜噜成人av农村| 久久激情一区| 开心色5月久久精品| 久久人人九九| 欧美黄污视频| 欧美日韩成人在线播放| 欧美日韩国产精品| 欧美三级不卡| 国产精品家庭影院| 国产美女搞久久| 精品成人在线观看| 亚洲欧洲三级电影| 99精品视频免费观看视频| 一区二区高清在线观看| 亚洲欧美日韩一区| 久久久国产视频91| 亚洲第一色在线| 日韩亚洲欧美成人| 亚洲欧美日韩在线不卡| 久久精品视频播放| 欧美电影在线免费观看网站| 欧美精品一区二区三区蜜桃| 欧美三日本三级少妇三2023| 国产精品日日做人人爱| 亚洲激情视频在线观看| 欧美激情一区二区三区全黄| 亚洲淫性视频| 欧美一区激情| 另类激情亚洲| 亚洲精品美女91| 亚洲小说欧美另类社区| 午夜精品久久久久| 久色成人在线| 国产精品成人一区二区三区夜夜夜| 国产精品久久久久国产a级| 激情五月***国产精品| 91久久精品日日躁夜夜躁欧美| 亚洲午夜精品一区二区三区他趣| 性欧美大战久久久久久久免费观看| 免播放器亚洲一区| 亚洲视频一起| 牛人盗摄一区二区三区视频| 国产精品久久999| 激情欧美一区二区| 亚洲曰本av电影| 亚洲第一搞黄网站| 欧美亚洲一区二区在线观看| 欧美另类在线播放| 精品动漫3d一区二区三区| 亚洲视频图片小说| 欧美成人免费在线| 亚洲欧美偷拍卡通变态| 欧美另类女人| 亚洲国产欧美一区二区三区久久| 亚洲尤物视频在线| 亚洲日本久久| 老牛嫩草一区二区三区日本| 国产免费观看久久| 亚洲在线免费观看|