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

天行健 君子當自強而不息

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 閱讀(1347) 評論(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>
            亚洲网站视频福利| 亚洲欧美中文字幕| 亚洲高清不卡在线| 亚洲一区二区免费看| 久久一本综合频道| 9i看片成人免费高清| 亚洲小说春色综合另类电影| 欧美成人精品三级在线观看| 国产一区二区三区黄| 最新69国产成人精品视频免费| 亚洲无线观看| 亚洲第一中文字幕在线观看| 日韩视频在线一区二区三区| 亚洲电影免费观看高清| 亚洲国产中文字幕在线观看| 欧美日韩高清不卡| 亚洲激情网址| 亚洲一级在线观看| 欧美国产欧美亚洲国产日韩mv天天看完整 | 亚洲三级影院| 欧美成人在线影院| 欧美成人一区二区| 蜜桃精品久久久久久久免费影院| 欧美精品在线播放| 久久亚洲免费| 韩日视频一区| 久久婷婷激情| 久久天天综合| 亚洲精品少妇30p| 美女主播精品视频一二三四| 国产一区在线看| 久久久久久久成人| 亚洲第一精品在线| 羞羞色国产精品| 国产偷国产偷亚洲高清97cao| 香蕉久久夜色精品| 欧美在线国产| 亚洲国产片色| 亚洲裸体在线观看| 国产精品久久久久9999吃药| 欧美一区亚洲| 久久久噜噜噜久久人人看| 亚洲高清视频一区| 亚洲精品美女在线观看| 国产精品麻豆va在线播放 | 午夜欧美大片免费观看| 免费看av成人| 一区二区三区精品久久久| 国产伦精品一区二区三区免费 | 亚洲欧美成人网| 国产精品s色| 在线视频亚洲欧美| 久久疯狂做爰流白浆xx| 久久爱另类一区二区小说| 国产精品专区第二| 久久久久久免费| 日韩一本二本av| 亚洲成色www久久网站| 午夜精品久久久久久久久久久久| 国产一区二区三区四区hd| 最新国产の精品合集bt伙计| 国产精品一区二区女厕厕| 国产美女精品视频免费观看| 黄色精品网站| 狠狠色狠狠色综合日日小说| 一区二区三区 在线观看视| 欧美一级免费视频| 亚洲高清在线观看一区| 欧美激情黄色片| 亚洲综合好骚| 久久伊人亚洲| 欧美一区2区三区4区公司二百| 欧美日韩一区国产| 欧美少妇一区| 国产网站欧美日韩免费精品在线观看| 欧美日韩黄色一区二区| 一本色道久久99精品综合| 99精品视频免费观看| 影音先锋亚洲一区| 久久精品视频播放| 国产精品第一区| 欧美色图天堂网| 一区二区三区成人精品| 亚洲天堂av图片| 六月天综合网| 国产日韩精品一区| 日韩天堂在线观看| 另类尿喷潮videofree | 欧美日韩不卡合集视频| 久久久久99| 欧美成人官网二区| 亚洲精品系列| 巨胸喷奶水www久久久免费动漫| 久久久久久久久久码影片| 久久久一二三| 欧美不卡激情三级在线观看| 久久亚洲综合| 欧美三级日本三级少妇99| 欧美日韩视频第一区| 国产精品国产三级国产aⅴ入口| 欧美午夜电影在线| 亚洲福利精品| 欧美一区二区三区播放老司机 | 亚洲一区不卡| 欧美韩日精品| 久久精品一区二区三区中文字幕| 精久久久久久| 亚洲欧美激情视频| 国产精品免费一区二区三区观看 | 久热综合在线亚洲精品| 国产伦理精品不卡| 日韩一区二区精品葵司在线| 亚洲一本大道在线| 欧美在线免费观看| 美女国产一区| 99re在线精品| 欧美日韩福利视频| 在线亚洲欧美| 亚洲综合清纯丝袜自拍| 国产区日韩欧美| 午夜精品福利一区二区三区av| 久久人91精品久久久久久不卡| 国产精品免费看片| 久久国产精品色婷婷| 亚洲女同同性videoxma| 国产精品婷婷午夜在线观看| 亚洲狼人综合| 亚洲影视综合| 国产欧美日韩高清| 老司机久久99久久精品播放免费| 欧美承认网站| 亚洲一级黄色av| 久久国产精品99久久久久久老狼 | 欧美成在线观看| 亚洲理伦电影| 亚洲人成在线观看网站高清| 免费在线成人av| 99视频有精品| 欧美日韩在线视频观看| 亚洲精品1区2区| 亚洲淫片在线视频| 国产日韩亚洲欧美综合| 葵司免费一区二区三区四区五区| 欧美大片免费久久精品三p| 国产一区二区日韩精品| 久久久久99| 亚洲精品一品区二品区三品区| 欧美国产精品日韩| 亚洲深夜激情| 国产精品永久入口久久久| 午夜精品一区二区三区四区| 久久免费国产精品1| 亚洲乱码久久| 国产日韩欧美一区二区三区在线观看| 欧美一区二区在线免费播放| 亚洲国产精品久久久久婷婷老年 | 亚洲少妇在线| 你懂的亚洲视频| 亚洲女人天堂av| 亚洲国产另类久久久精品极度| 美女被久久久| 99精品视频一区| 欧美88av| 午夜免费电影一区在线观看| 在线日韩精品视频| 国产精品福利在线观看| 免费人成精品欧美精品| 亚洲在线观看免费| 亚洲啪啪91| 亚洲国产va精品久久久不卡综合| 亚洲精品少妇| 国产精品一区二区三区久久久| 久久久久久久久久久成人| 亚洲美女黄色| 欧美激情综合色综合啪啪 | 国产视频在线观看一区| 亚洲人成高清| 蜜月aⅴ免费一区二区三区| 亚洲综合清纯丝袜自拍| 尤物九九久久国产精品的分类| 国内精品美女在线观看| 欧美日韩国产丝袜另类| 能在线观看的日韩av| 欧美一区二区三区四区在线观看 | 欧美激情精品久久久久久变态| 久久精品国产久精国产爱| 国产一区二区三区观看| 国产精品亚洲综合久久| 欧美视频在线不卡| 欧美日韩午夜剧场| 久久激五月天综合精品| 亚洲欧美怡红院| 亚洲一区二区三区四区中文| 欧美不卡一区| 麻豆91精品| 欧美在线视频全部完| 欧美一级久久久| 欧美一二区视频| 久久精品视频免费播放| 亚洲一区二区黄|