HRESULT IDXGIFactory1New::EnumAdapters1(UINT Adapter, IDXGIAdapter1 **ppAdapter) { dbg("dxgif: EnumAdapters1 %d", Adapter); return EnumAdapters(Adapter, (IDXGIAdapter**)ppAdapter); // EnumAdapters will handle this just fine - it creates Adapter1 anyway }
//-------------------------------------------------------------------------------------- // Enumerate for each adapter all of the supported display modes, // device types, adapter formats, back buffer formats, window/full screen support, // depth stencil formats, multisampling types/qualities, and presentations intervals. // // For each combination of device type (HAL/REF), adapter format, back buffer format, and // IsWindowed it will call the app's ConfirmDevice callback. This allows the app // to reject or allow that combination based on its caps/etc. It also allows the // app to change the BehaviorFlags. The BehaviorFlags defaults non-pure HWVP // if supported otherwise it will default to SWVP, however the app can change this // through the ConfirmDevice callback. //-------------------------------------------------------------------------------------- _Use_decl_annotations_ HRESULT CD3D11Enumeration::Enumerate( LPDXUTCALLBACKISD3D11DEVICEACCEPTABLE IsD3D11DeviceAcceptableFunc, void* pIsD3D11DeviceAcceptableFuncUserContext ) { CDXUTPerfEventGenerator eventGenerator( DXUT_PERFEVENTCOLOR, L"DXUT D3D11 Enumeration" ); HRESULT hr; auto pFactory = DXUTGetDXGIFactory(); if( !pFactory ) return E_FAIL; m_bHasEnumerated = true; m_IsD3D11DeviceAcceptableFunc = IsD3D11DeviceAcceptableFunc; m_pIsD3D11DeviceAcceptableFuncUserContext = pIsD3D11DeviceAcceptableFuncUserContext; ClearAdapterInfoList(); for( int index = 0; ; ++index ) { IDXGIAdapter* pAdapter = nullptr; hr = pFactory->EnumAdapters( index, &pAdapter ); if( FAILED( hr ) ) // DXGIERR_NOT_FOUND is expected when the end of the list is hit break; IDXGIAdapter2* pAdapter2 = nullptr; if ( SUCCEEDED( pAdapter->QueryInterface( __uuidof(IDXGIAdapter2), ( LPVOID* )&pAdapter2 ) ) ) { // Succeeds on DirectX 11.1 Runtime systems DXGI_ADAPTER_DESC2 desc; hr = pAdapter2->GetDesc2( &desc ); pAdapter2->Release(); if ( SUCCEEDED(hr) && ( desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE ) ) { // Skip "always there" Microsoft Basics Display Driver pAdapter->Release(); continue; } } auto pAdapterInfo = new (std::nothrow) CD3D11EnumAdapterInfo; if( !pAdapterInfo ) { SAFE_RELEASE( pAdapter ); return E_OUTOFMEMORY; } pAdapterInfo->AdapterOrdinal = index; pAdapter->GetDesc( &pAdapterInfo->AdapterDesc ); pAdapterInfo->m_pAdapter = pAdapter; // Enumerate the device driver types on the adapter. hr = EnumerateDevices( pAdapterInfo ); if( FAILED( hr ) ) { delete pAdapterInfo; continue; } hr = EnumerateOutputs( pAdapterInfo ); if( FAILED( hr ) || pAdapterInfo->outputInfoList.empty() ) { delete pAdapterInfo; continue; } // Get info for each devicecombo on this device if( FAILED( hr = EnumerateDeviceCombos( pAdapterInfo ) ) ) { delete pAdapterInfo; continue; } m_AdapterInfoList.push_back( pAdapterInfo ); } // If we did not get an adapter then we should still enumerate WARP and Ref. if (m_AdapterInfoList.size() == 0) { auto pAdapterInfo = new (std::nothrow) CD3D11EnumAdapterInfo; if( !pAdapterInfo ) { return E_OUTOFMEMORY; } pAdapterInfo->bAdapterUnavailable = true; hr = EnumerateDevices( pAdapterInfo ); // Get info for each devicecombo on this device if( FAILED( hr = EnumerateDeviceCombosNoAdapter( pAdapterInfo ) ) ) { delete pAdapterInfo; } if (SUCCEEDED(hr)) m_AdapterInfoList.push_back( pAdapterInfo ); } // // Check for 2 or more adapters with the same name. Append the name // with some instance number if that's the case to help distinguish // them. // bool bUniqueDesc = true; for( size_t i = 0; i < m_AdapterInfoList.size(); i++ ) { auto pAdapterInfo1 = m_AdapterInfoList[ i ]; for( size_t j = i + 1; j < m_AdapterInfoList.size(); j++ ) { auto pAdapterInfo2 = m_AdapterInfoList[ j ]; if( wcsncmp( pAdapterInfo1->AdapterDesc.Description, pAdapterInfo2->AdapterDesc.Description, DXGI_MAX_DEVICE_IDENTIFIER_STRING ) == 0 ) { bUniqueDesc = false; break; } } if( !bUniqueDesc ) break; } for( auto it = m_AdapterInfoList.begin(); it != m_AdapterInfoList.end(); ++it ) { wcscpy_s((*it)->szUniqueDescription, DXGI_MAX_DEVICE_IDENTIFIER_STRING, (*it)->AdapterDesc.Description); if( !bUniqueDesc ) { WCHAR sz[32]; swprintf_s( sz, 32, L" (#%u)", (*it)->AdapterOrdinal ); wcscat_s( (*it)->szUniqueDescription, DXGI_MAX_DEVICE_IDENTIFIER_STRING, sz ); } } // Check WARP max feature level { static const D3D_FEATURE_LEVEL fLvlWarp[] = { #ifdef USE_DIRECT3D11_3 D3D_FEATURE_LEVEL_12_1, D3D_FEATURE_LEVEL_12_0, #endif D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1 }; ID3D11Device* pDevice = nullptr; hr = DXUT_Dynamic_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_WARP, 0, 0, fLvlWarp, _countof(fLvlWarp), D3D11_SDK_VERSION, &pDevice, &m_warpFL, nullptr ); if ( hr == E_INVALIDARG ) { #ifdef USE_DIRECT3D11_3 // DirectX 11.1 runtime will not recognize FL 12.x, so try without it hr = DXUT_Dynamic_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_WARP, 0, 0, &fLvlWarp[2], _countof(fLvlWarp) - 2, D3D11_SDK_VERSION, &pDevice, &m_warpFL, nullptr); if (hr == E_INVALIDARG) { // DirectX 11.0 runtime will not recognize FL 11.1+, so try without it hr = DXUT_Dynamic_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_WARP, 0, 0, &fLvlWarp[3], _countof(fLvlWarp) - 3, D3D11_SDK_VERSION, &pDevice, &m_warpFL, nullptr); } #else // DirectX 11.0 runtime will not recognize FL 11.1, so try without it hr = DXUT_Dynamic_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_WARP, 0, 0, &fLvlWarp[1], _countof(fLvlWarp) - 1, D3D11_SDK_VERSION, &pDevice, &m_warpFL, nullptr ); #endif } if ( SUCCEEDED(hr) ) { pDevice->Release(); } else m_warpFL = D3D_FEATURE_LEVEL_10_1; } // Check REF max feature level { static const D3D_FEATURE_LEVEL fLvlRef[] = { D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1 }; ID3D11Device* pDevice = nullptr; hr = DXUT_Dynamic_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_REFERENCE, 0, 0, fLvlRef, _countof(fLvlRef), D3D11_SDK_VERSION, &pDevice, &m_refFL, nullptr ); if ( hr == E_INVALIDARG ) { // DirectX 11.0 runtime will not recognize FL 11.1, so try without it hr = DXUT_Dynamic_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_REFERENCE, 0, 0, &fLvlRef[1], _countof(fLvlRef) - 1, D3D11_SDK_VERSION, &pDevice, &m_refFL, nullptr ); } if ( SUCCEEDED(hr) ) { pDevice->Release(); } else m_refFL = D3D_FEATURE_LEVEL_11_0; } return S_OK; }
/** * Enumerates all available display modes and fills the given combo * boxes with corresponding values. * -> IN: HWND - combobox to receive available adapters * HWND - combobox used for display modes * HWND - combobox used for device types * HWND - combobox used for adapter formats * HWND - combobox used for backbuffer formats * HWND - radiobutton windowed * HWND - radiobutton fullscreen * FILE - already open log file */ HRESULT ZFXD3DEnum::Enum(HWND hAdapter, HWND hMode, HWND hDevice, HWND hAdapterFmt, HWND hBackFmt, HWND hWnd, HWND hFull, FILE *pLog) { HRESULT hr; if (pLog) m_pLog = pLog; // create main Direct3D object m_pD3D = Direct3DCreate9(D3D_SDK_VERSION); if(m_pD3D == NULL){ return ZFX_CREATEAPI; } // save handles to comboboxes m_hADAPTER = hAdapter; m_hMODE = hMode; m_hDEVICE = hDevice; m_hADAPTERFMT = hAdapterFmt; m_hBACKFMT = hBackFmt; m_hWND = hWnd; m_hFULL = hFull; // nothing yet m_dwNumAdapters = 0; // set misc values m_nMinWidth = 800; m_nMinHeight = 600; m_nMinBits = 16; // set allowed bpp formats m_fmtAdapter[0] = D3DFMT_X8R8G8B8; // 32 Bit m_fmtAdapter[1] = D3DFMT_X1R5G5B5; // 15 Bit m_fmtAdapter[2] = D3DFMT_R5G6B5; // 16 Bit m_nNumFmt = 3; // get current adapters display mode if (FAILED(m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &m_dspmd))) { if (m_pLog) { fprintf(m_pLog, "Enum: GetAdapterDisplayMode() failed \n"); fflush(m_pLog); } } // enumerate available adapters hr = EnumAdapters(); // we don't need this for now m_pD3D->Release(); m_pD3D = NULL; if(FAILED(hr) || !hAdapter) return ZFX_FAIL; // list the found graphics adapter SendMessage(m_hADAPTER,CB_RESETCONTENT,0,0); for (UINT a=0; a<m_dwNumAdapters; a++) { AddItem(m_hADAPTER, m_xAdapterInfo[a]. d3dAdapterIdentifier.Description, &m_xAdapterInfo[a]); } // treat enum like adapter change SendMessage(m_hADAPTER, CB_SETCURSEL, (WPARAM)0, 0); ChangedAdapter(); // select first entry from each combo SendMessage(m_hADAPTER, CB_SETCURSEL, (WPARAM)0, 0); SendMessage(m_hMODE, CB_SETCURSEL, (WPARAM)0, 0); SendMessage(m_hDEVICE, CB_SETCURSEL, (WPARAM)0, 0); SendMessage(m_hBACKFMT, CB_SETCURSEL, (WPARAM)0, 0); SendMessage(m_hADAPTERFMT, CB_SETCURSEL, (WPARAM)0, 0); return ZFX_OK; } // Enum
int D3DM_InitDevices( HWND hwnd, int w, int h, int full, HMENU menu ) { char buf[256]; int i,j; LPDIRECTDRAW7 pDD = NULL; HRESULT hr; if( FAILED( hr = DirectDrawCreateEx( NULL, (VOID**)&pDD, IID_IDirectDraw7, NULL ) ) ) return DDENUMRET_CANCEL; D3DCapsStruct.m_ddCaps.dwSize = sizeof(DDCAPS); pDD->GetCaps( &D3DCapsStruct.m_ddCaps, NULL ); if(pDD) { pDD->Release(); pDD = NULL; } ZeroMemory( d3dTexture, sizeof(D3DD_TEXTURE)*D3DD_MAX_TEXTURE_AMOUNT ); ZeroMemory( d3dText, sizeof(D3DD_TEXT)*D3DD_MAX_TEXT_AMOUNT ); ZeroMemory( d3dDisp, sizeof(D3DD_DISP)*D3DD_MAX_DISP_AMOUNT ); pD3D = Direct3DCreate8(D3D_SDK_VERSION); if(pD3D == NULL){ MessageBox(NULL,"Direct3Dオブジェクトの生成に失敗しました。[DirectX8.1が入っていない?]","致命的なエラー", MB_OK | MB_ICONSTOP); return FALSE; } if( FAILED(pD3D->GetDeviceCaps( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &D3DCapsStruct.m_d3dCaps)) ){ MessageBox(NULL,"デバイス能力の取得に失敗しました","致命的なエラー", MB_OK | MB_ICONSTOP); return FALSE; } EnumAdapters(D3DADAPTER_DEFAULT); if( (int)D3DCapsStruct.m_d3dCaps.MaxTextureWidth < D3DD_TEXTURE_CONTROL_SIZE ){ DebugBox( NULL, "このビデオカードは、幅 %d pixel 以上のサイズのテクスチャを生成できません。[%s]", D3DD_TEXTURE_CONTROL_SIZE); return FALSE; }else if( (int)D3DCapsStruct.m_d3dCaps.MaxTextureHeight < D3DD_TEXTURE_CONTROL_SIZE ){ DebugBox( NULL, "このビデオカードは、高さ %d pixel 以上のサイズのテクスチャを生成できません。[%s]", D3DD_TEXTURE_CONTROL_SIZE ); return FALSE; } if( !(D3DCapsStruct.m_d3dCaps.ShadeCaps&D3DPSHADECAPS_ALPHAGOURAUDBLEND) ){ MessageBox(NULL,"このビデオデバイスはグーロブレンディングに対応していません。\nゲームの画像が乱れることがあります","警告", MB_OK | MB_ICONSTOP); } if( !(D3DCapsStruct.m_d3dCaps.ShadeCaps&D3DPSHADECAPS_COLORGOURAUDRGB) ){ MessageBox(NULL,"このビデオデバイスはグーロシェーディングに対応していません。\nゲームの画像が乱れることがあります","警告", MB_OK | MB_ICONSTOP); } if( D3DCapsStruct.m_d3dCaps.TextureCaps&D3DPTEXTURECAPS_SQUAREONLY ){ DebugBox( NULL, "このビデオカードは長方形テクスチャを生成できません。[デバッグ用ダイアログ]" ); } if( FAILED(pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&D3DCapsStruct.m_NowDisplayMode)) ){ MessageBox(NULL,"ディスプレイモードの取得に失敗しました。[なにゆえ?]","致命的なエラー", MB_OK | MB_ICONSTOP); return FALSE; } D3DCapsStruct.m_WindowDisplayMode = D3DCapsStruct.m_NowDisplayMode; D3DMain.m_DrawHwnd = hwnd; D3DMain.m_MenuHwnd = menu; if( GetSystemMetrics(SM_CXFULLSCREEN)<=800 || GetSystemMetrics(SM_CYFULLSCREEN)<=600){ D3DMain.m_FullScreenOnly = TRUE; D3DMain.m_WindowMode = FALSE; }else{ D3DMain.m_FullScreenOnly = FALSE; D3DMain.m_WindowMode = !full; } ZeroMemory(&d3dppApp,sizeof(d3dppApp)); WinWidth = w; WinHeight = h; d3dppApp.SwapEffect = D3DSWAPEFFECT_COPY; d3dppApp.BackBufferFormat = D3DCapsStruct.m_NowDisplayMode.Format; d3dppApp.BackBufferCount = 1; d3dppApp.BackBufferWidth = WinWidth; d3dppApp.BackBufferHeight = WinHeight; d3dppApp.Windowed = TRUE; d3dppApp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; HRESULT ret; ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ D3DMain.m_FullScreenOnly = TRUE; } } if(D3DMain.m_FullScreenOnly==TRUE){ RELEASE_3D(pD3DDevice); D3DMain.m_WindowMode = FALSE; ZeroMemory(&d3dppApp,sizeof(d3dppApp)); for(i=0;i<D3DCapsStruct.m_DisplayModeNum;i++){ if( D3DCapsStruct.m_DisplayMode[i].Width == 800 && D3DCapsStruct.m_DisplayMode[i].Height == 600 ){ switch( D3DCapsStruct.m_DisplayMode[i].Format ){ case D3DFMT_R5G6B5: case D3DFMT_X1R5G5B5: case D3DFMT_A1R5G5B5: case D3DFMT_A4R4G4B4: case D3DFMT_X4R4G4B4: D3DCapsStruct.m_FullModeNum=i; d3dppApp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; d3dppApp.Windowed = D3DMain.m_WindowMode; d3dppApp.SwapEffect = FULL_FLIP; d3dppApp.BackBufferFormat = D3DCapsStruct.m_DisplayMode[i].Format; d3dppApp.BackBufferCount = 1; d3dppApp.BackBufferWidth = WinWidth; d3dppApp.BackBufferHeight = WinHeight; break; } } if(d3dppApp.SwapEffect) break; } if(!full){ wsprintf( buf, "このビデオカードの現在のモードではゲームを実行できません。フルスクリーン化しますか?\n[%d]", D3DCapsStruct.m_DisplayMode[i].RefreshRate ); if( MessageBox( NULL, buf, "問い合わせ", MB_YESNO )==IDNO ){ RELEASE_3D(pD3D); return FALSE; } } ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ switch(ret){ default: case D3DERR_OUTOFVIDEOMEMORY: DebugBox( NULL, "Direct3D が処理を行うのに十分なディスプレイ メモリがありません。" ); RELEASE_3D(pD3D); return FALSE; case D3DERR_INVALIDCALL: DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_INVALIDCALL]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" ); RELEASE_3D(pD3D); return FALSE; case D3DERR_NOTAVAILABLE: DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_NOTAVAILABLE]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" ); RELEASE_3D(pD3D); return FALSE; } } } }else{ if(D3DMain.m_WindowMode){ }else{ RELEASE_3D(pD3DDevice); ZeroMemory(&d3dppApp,sizeof(d3dppApp)); d3dppApp.SwapEffect = FULL_FLIP; d3dppApp.BackBufferCount = 1; d3dppApp.BackBufferWidth = WinWidth; d3dppApp.BackBufferHeight = WinHeight; d3dppApp.Windowed = FALSE; d3dppApp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; if(DrawSetting.full_16bit){ d3dppApp.BackBufferFormat=D3DFMT_UNKNOWN; for(i=0;i<D3DCapsStruct.m_DisplayModeNum;i++){ if( D3DCapsStruct.m_DisplayMode[i].Width == 800 && D3DCapsStruct.m_DisplayMode[i].Height == 600 ){ switch( D3DCapsStruct.m_DisplayMode[i].Format ){ case D3DFMT_R5G6B5: case D3DFMT_X1R5G5B5: case D3DFMT_A1R5G5B5: case D3DFMT_A4R4G4B4: case D3DFMT_X4R4G4B4: D3DCapsStruct.m_FullModeNum=i; d3dppApp.BackBufferFormat = D3DCapsStruct.m_DisplayMode[i].Format; break; } } if(d3dppApp.BackBufferFormat!=D3DFMT_UNKNOWN) break; } }else{ d3dppApp.BackBufferFormat = D3DCapsStruct.m_NowDisplayMode.Format; } ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice); if( FAILED(ret) ){ switch(ret){ default: case D3DERR_OUTOFVIDEOMEMORY: DebugBox( NULL, "Direct3D が処理を行うのに十分なディスプレイ メモリがありません。" ); RELEASE_3D(pD3D); return FALSE; case D3DERR_INVALIDCALL: DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_INVALIDCALL]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" ); RELEASE_3D(pD3D); return FALSE; case D3DERR_NOTAVAILABLE: DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_NOTAVAILABLE]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" ); RELEASE_3D(pD3D); return FALSE; } } } } } if( FAILED(pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&D3DCapsStruct.m_NowDisplayMode)) ){ MessageBox(NULL,"ディスプレイモードの取得に失敗しました。[なにゆえ?]","致命的なエラー", MB_OK | MB_ICONSTOP); RELEASE_3D(pD3D); return FALSE; } D3DCapsStruct.m_ttCaps.m_R8G8B8 = IsTextureFormatOk( D3DFMT_R8G8B8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_X8R8G8B8 = IsTextureFormatOk( D3DFMT_X8R8G8B8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A8R8G8B8 = IsTextureFormatOk( D3DFMT_A8R8G8B8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_R5G6B5 = IsTextureFormatOk( D3DFMT_R5G6B5, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_X1R5G5B5 = IsTextureFormatOk( D3DFMT_X1R5G5B5, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A1R5G5B5 = IsTextureFormatOk( D3DFMT_A1R5G5B5, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_X4R4G4B4 = IsTextureFormatOk( D3DFMT_X4R4G4B4, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A4R4G4B4 = IsTextureFormatOk( D3DFMT_A4R4G4B4, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A8P8 = IsTextureFormatOk( D3DFMT_A8P8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_P8 = IsTextureFormatOk( D3DFMT_P8, D3DCapsStruct.m_NowDisplayMode.Format); D3DCapsStruct.m_ttCaps.m_A8 = IsTextureFormatOk( D3DFMT_A8, D3DCapsStruct.m_NowDisplayMode.Format); D3DD_SetBackBuffer( WinWidth, WinHeight ); pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_ARGB(0,0,0,0),1.0,0); if(0){ char buf2[512]; wsprintf( buf, "実行ディスプレイモード[%s]\n", TxFmtMode[ LIM(d3dppApp.BackBufferFormat,0,D3DFMT_D3DD_MAX-1) ] ); MBS_CPY(buf2,buf); MBS_CAT(buf2,"使用可能テクスチャ列挙\n"); for(i=1;i<D3DFMT_D3DD_MAX-1;i++){ if( TxFmtMode[i] ){ j = IsTextureFormatOk( (D3DFORMAT)i, D3DCapsStruct.m_NowDisplayMode.Format); if(j){ wsprintf(buf,"%-15s[%s]\n", TxFmtMode[i], (j==2)?"OK":"OK(NotRenderTarget)" ); MBS_CAT(buf2,buf); }else{ wsprintf(buf,"%-15s[%s]\n", TxFmtMode[i], "--Not--" ); MBS_CAT(buf2,buf); } } } DebugBox(NULL,buf2); } D3DD_CreateTable(); return TRUE; }