From 2b97f55618b120aab6fb04ac871d19e91f59b515 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Sun, 28 Jun 2020 15:43:46 -0700 Subject: [PATCH] Code cleanup --- CMakeLists.txt | 68 + CMakeSettings.json | 76 + ddraw.cpp | 1660 ++++---- dxg.cpp | 3097 +++++++------- dxgi.cpp | 9989 ++++++++++++++++++++++---------------------- dxprint.cpp | 1220 +++--- dxview.cpp | 1506 +++---- dxview.h | 47 +- dxview.rc | 83 +- resource.h | 1 - 10 files changed, 8737 insertions(+), 9010 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 CMakeSettings.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d4a2bfc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,68 @@ +# DirectX Capabilities Viewer +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +# +# https://github.com/walbourn/dxcapsviewer + +cmake_minimum_required (VERSION 3.11) + +project (dxcapsviewer LANGUAGES CXX) + +option(ENABLE_CODE_ANALYSIS "Use Static Code Analysis on build" ON) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/CMake") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/CMake") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/CMake") + +if(MSVC) + # Use max Warning Level + string(REPLACE "/W3 " "/W4 " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + string(REPLACE "/W3 " "/W4 " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) + string(REPLACE "/W3 " "/W4 " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) + + # Not using typeid or dynamic_cast, so disable RTTI to save binary size + string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) + string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) +endif() + +add_executable(${PROJECT_NAME} WIN32 + ddraw.cpp + dxg.cpp + dxgi.cpp + dxprint.cpp + dxview.h + dxview.cpp + resource.h + dxview.rc) + +target_link_libraries(${PROJECT_NAME} PRIVATE dxguid.lib comctl32.lib version.lib) + +if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) + target_compile_options(${PROJECT_NAME} PRIVATE + "-Wpedantic" "-Wextra" + "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" + "-Wno-language-extension-token" "-Wno-switch" + "-Wno-missing-field-initializers") + target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsEXE}) +endif() +if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) + target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus) + + if(ENABLE_CODE_ANALYSIS) + target_compile_options(${PROJECT_NAME} PRIVATE /analyze) + endif() + + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) + endif() +endif() + +if(WIN32) + target_compile_definitions(${PROJECT_NAME} PRIVATE _MBCS _WIN32_WINNT=0x0601) +endif() diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 0000000..36af85a --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,76 @@ +{ + "configurations": [ + { + "name": "x86-Clang-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "inheritEnvironments": [ "clang_cl_x86" ], + "variables": [] + }, + { + "name": "x86-Clang-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "inheritEnvironments": [ "clang_cl_x86" ], + "variables": [] + }, + { + "name": "x64-Clang-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "inheritEnvironments": [ "clang_cl_x64" ], + "variables": [] + }, + { + "name": "x64-Clang-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "inheritEnvironments": [ "clang_cl_x64" ], + "variables": [] + }, + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "Release", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] + } + ] +} \ No newline at end of file diff --git a/ddraw.cpp b/ddraw.cpp index a8e841b..7fcc27d 100644 --- a/ddraw.cpp +++ b/ddraw.cpp @@ -1,105 +1,107 @@ //----------------------------------------------------------------------------- -// Name: DDraw.cpp +// Name: ddraw.cpp // -// Desc: DDraw stuff for DirectX caps viewer +// Desc: DirectX Capabilities Viewer for DirectDraw // // Copyright (c) Microsoft Corporation. All Rights Reserved. //----------------------------------------------------------------------------- #include "dxview.h" + #include #include -extern VOID DisplayErrorMessage( const CHAR* strError ); -extern HRESULT Int2Str( __out_bcount(nDestLen) LPTSTR pszDest, __in UINT nDestLen, __in DWORD i ); -extern HRESULT PrintValueLine( const char * szText, DWORD dwValue, PRINTCBINFO *lpInfo ); +extern HRESULT Int2Str(_Out_writes_bytes_(nDestLen) LPTSTR pszDest, UINT nDestLen, DWORD i); +namespace +{ + using LPDIRECTDRAWCREATEEX = HRESULT(WINAPI*)(GUID FAR* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown FAR* pUnkOuter); -LPDIRECTDRAW7 g_pDD = NULL; // DirectDraw object -GUID* g_pDDGUID; + LPDIRECTDRAW7 g_pDD = nullptr; + HMODULE g_hInstDDraw = nullptr; + GUID* g_pDDGUID; + LPDIRECTDRAWCREATEEX g_directDrawCreateEx = nullptr; + LPDIRECTDRAWENUMERATEEXA g_directDrawEnumerateEx = nullptr; -HRESULT DDDisplayVidMem( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ); -HRESULT DDDisplayCaps( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pInfo ); -HRESULT DDDisplayVideoModes( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pInfo ); -HRESULT DDDisplayFourCCFormat( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pInfo ); - + HRESULT DDDisplayVidMem(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pPrintInfo); + HRESULT DDDisplayCaps(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pInfo); + HRESULT DDDisplayVideoModes(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pInfo); + HRESULT DDDisplayFourCCFormat(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pInfo); #define DDCAPDEFex(name,val,flag) {name, FIELD_OFFSET(DDCAPS,val), flag, DXV_9EXCAP} #define DDCAPDEF(name,val,flag) {name, FIELD_OFFSET(DDCAPS,val), flag} #define DDVALDEF(name,val) {name, FIELD_OFFSET(DDCAPS,val), 0} #define DDHEXDEF(name,val) {name, FIELD_OFFSET(DDCAPS,val), 0xFFFFFFFF} -#define ROPDEF(name,dwRops,rop) DDCAPDEF(name,dwRops[((rop>>16)&0xFF)/32],(1<<((rop>>16)&0xFF)%32)) +#define ROPDEF(name,dwRops,rop) DDCAPDEF(name,dwRops[((rop>>16)&0xFF)/32],static_cast((1<<((rop>>16)&0xFF)%32))) #define MAKEMODE(xres,yres,bpp) (((DWORD)xres << 20) | ((DWORD)yres << 8) | bpp) -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF OtherInfoDefs[] = -{ - DDVALDEF("dwVidMemTotal", dwVidMemTotal), - DDVALDEF("dwVidMemFree", dwVidMemFree), - DDHEXDEF("dwAlphaBltConstBitDepths", dwAlphaBltConstBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaBltConstBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaBltConstBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaBltConstBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaBltConstBitDepths, DDBD_32), - DDHEXDEF("dwAlphaBltPixelBitDepths", dwAlphaBltPixelBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaBltPixelBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaBltPixelBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaBltPixelBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaBltPixelBitDepths, DDBD_32), - DDHEXDEF("dwAlphaBltSurfaceBitDepths", dwAlphaBltSurfaceBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaBltSurfaceBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaBltSurfaceBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaBltSurfaceBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaBltSurfaceBitDepths, DDBD_32), - DDHEXDEF("dwAlphaOverlayConstBitDepths", dwAlphaOverlayConstBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaOverlayConstBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaOverlayConstBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaOverlayConstBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaOverlayConstBitDepths, DDBD_32), - DDHEXDEF("dwAlphaOverlayPixelBitDepths", dwAlphaOverlayPixelBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaOverlayPixelBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaOverlayPixelBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaOverlayPixelBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaOverlayPixelBitDepths, DDBD_32), - DDHEXDEF("dwAlphaOverlaySurfaceBitDepths", dwAlphaOverlaySurfaceBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaOverlaySurfaceBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaOverlaySurfaceBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaOverlaySurfaceBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaOverlaySurfaceBitDepths, DDBD_32), - DDHEXDEF("dwZBufferBitDepths", dwZBufferBitDepths), - DDCAPDEF(" DDBD_8", dwZBufferBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwZBufferBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwZBufferBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwZBufferBitDepths, DDBD_32), - DDVALDEF("dwMaxVisibleOverlays", dwMaxVisibleOverlays), - DDVALDEF("dwCurrVisibleOverlays", dwCurrVisibleOverlays), - DDVALDEF("dwNumFourCCCodes", dwNumFourCCCodes), - DDVALDEF("dwAlignBoundarySrc", dwAlignBoundarySrc), - DDVALDEF("dwAlignSizeSrc", dwAlignSizeSrc), - DDVALDEF("dwAlignBoundaryDest", dwAlignBoundaryDest), - DDVALDEF("dwAlignSizeDest", dwAlignSizeDest), - DDVALDEF("dwAlignStrideAlign", dwAlignStrideAlign), - DDVALDEF("dwMinOverlayStretch", dwMinOverlayStretch), - DDVALDEF("dwMaxOverlayStretch", dwMaxOverlayStretch), - DDVALDEF("dwMinLiveVideoStretch", dwMinLiveVideoStretch), - DDVALDEF("dwMaxLiveVideoStretch", dwMaxLiveVideoStretch), - DDVALDEF("dwMinHwCodecStretch", dwMinHwCodecStretch), - DDVALDEF("dwMaxHwCodecStretch", dwMaxHwCodecStretch), + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF OtherInfoDefs[] = + { + DDVALDEF("dwVidMemTotal", dwVidMemTotal), + DDVALDEF("dwVidMemFree", dwVidMemFree), + DDHEXDEF("dwAlphaBltConstBitDepths", dwAlphaBltConstBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaBltConstBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaBltConstBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaBltConstBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaBltConstBitDepths, DDBD_32), + DDHEXDEF("dwAlphaBltPixelBitDepths", dwAlphaBltPixelBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaBltPixelBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaBltPixelBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaBltPixelBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaBltPixelBitDepths, DDBD_32), + DDHEXDEF("dwAlphaBltSurfaceBitDepths", dwAlphaBltSurfaceBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaBltSurfaceBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaBltSurfaceBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaBltSurfaceBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaBltSurfaceBitDepths, DDBD_32), + DDHEXDEF("dwAlphaOverlayConstBitDepths", dwAlphaOverlayConstBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaOverlayConstBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaOverlayConstBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaOverlayConstBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaOverlayConstBitDepths, DDBD_32), + DDHEXDEF("dwAlphaOverlayPixelBitDepths", dwAlphaOverlayPixelBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaOverlayPixelBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaOverlayPixelBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaOverlayPixelBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaOverlayPixelBitDepths, DDBD_32), + DDHEXDEF("dwAlphaOverlaySurfaceBitDepths", dwAlphaOverlaySurfaceBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaOverlaySurfaceBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaOverlaySurfaceBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaOverlaySurfaceBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaOverlaySurfaceBitDepths, DDBD_32), + DDHEXDEF("dwZBufferBitDepths", dwZBufferBitDepths), + DDCAPDEF(" DDBD_8", dwZBufferBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwZBufferBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwZBufferBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwZBufferBitDepths, DDBD_32), + DDVALDEF("dwMaxVisibleOverlays", dwMaxVisibleOverlays), + DDVALDEF("dwCurrVisibleOverlays", dwCurrVisibleOverlays), + DDVALDEF("dwNumFourCCCodes", dwNumFourCCCodes), + DDVALDEF("dwAlignBoundarySrc", dwAlignBoundarySrc), + DDVALDEF("dwAlignSizeSrc", dwAlignSizeSrc), + DDVALDEF("dwAlignBoundaryDest", dwAlignBoundaryDest), + DDVALDEF("dwAlignSizeDest", dwAlignSizeDest), + DDVALDEF("dwAlignStrideAlign", dwAlignStrideAlign), + DDVALDEF("dwMinOverlayStretch", dwMinOverlayStretch), + DDVALDEF("dwMaxOverlayStretch", dwMaxOverlayStretch), + DDVALDEF("dwMinLiveVideoStretch", dwMinLiveVideoStretch), + DDVALDEF("dwMaxLiveVideoStretch", dwMaxLiveVideoStretch), + DDVALDEF("dwMinHwCodecStretch", dwMinHwCodecStretch), + DDVALDEF("dwMaxHwCodecStretch", dwMaxHwCodecStretch), - //DDHEXDEF("dwCaps", dwCaps), - DDVALDEF("dwMaxVideoPorts", dwMaxVideoPorts), - DDVALDEF("dwCurrVideoPorts", dwCurrVideoPorts), - //DDVALDEF("dwSVBCaps2", dwSVBCaps2), - { "", 0, 0 } -}; + //DDHEXDEF("dwCaps", dwCaps), + DDVALDEF("dwMaxVideoPorts", dwMaxVideoPorts), + DDVALDEF("dwCurrVideoPorts", dwCurrVideoPorts), + //DDVALDEF("dwSVBCaps2", dwSVBCaps2), + { "", 0, 0 } + }; - - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- #define GEN_BLTCAPS(dwCaps) \ @@ -127,94 +129,94 @@ CAPDEF OtherInfoDefs[] = //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -CAPDEF GenCaps[] = -{ - // GEN_CAPS(dwCaps) - DDCAPDEF("DDCAPS_3D", dwCaps, DDCAPS_3D), - DDCAPDEF("DDCAPS_ALIGNBOUNDARYDEST", dwCaps, DDCAPS_ALIGNBOUNDARYDEST), - DDCAPDEF("DDCAPS_ALIGNSIZEDEST", dwCaps, DDCAPS_ALIGNSIZEDEST), - DDCAPDEF("DDCAPS_ALIGNBOUNDARYSRC", dwCaps, DDCAPS_ALIGNBOUNDARYSRC), - DDCAPDEF("DDCAPS_ALIGNSIZESRC", dwCaps, DDCAPS_ALIGNSIZESRC), - DDCAPDEF("DDCAPS_ALIGNSTRIDE", dwCaps, DDCAPS_ALIGNSTRIDE), - DDCAPDEF("DDCAPS_GDI", dwCaps, DDCAPS_GDI), - DDCAPDEF("DDCAPS_OVERLAY", dwCaps, DDCAPS_OVERLAY), - DDCAPDEF("DDCAPS_OVERLAYCANTCLIP", dwCaps, DDCAPS_OVERLAYCANTCLIP), - DDCAPDEF("DDCAPS_OVERLAYFOURCC", dwCaps, DDCAPS_OVERLAYFOURCC), - DDCAPDEF("DDCAPS_OVERLAYSTRETCH", dwCaps, DDCAPS_OVERLAYSTRETCH), - DDCAPDEF("DDCAPS_PALETTE", dwCaps, DDCAPS_PALETTE), - DDCAPDEF("DDCAPS_PALETTEVSYNC", dwCaps, DDCAPS_PALETTEVSYNC), - DDCAPDEF("DDCAPS_READSCANLINE", dwCaps, DDCAPS_READSCANLINE), - DDCAPDEF("DDCAPS_VBI", dwCaps, DDCAPS_VBI), - DDCAPDEF("DDCAPS_ZOVERLAYS", dwCaps, DDCAPS_ZOVERLAYS), - DDCAPDEF("DDCAPS_NOHARDWARE", dwCaps, DDCAPS_NOHARDWARE), - DDCAPDEF("DDCAPS_BANKSWITCHED", dwCaps, DDCAPS_BANKSWITCHED), + CAPDEF GenCaps[] = + { + // GEN_CAPS(dwCaps) + DDCAPDEF("DDCAPS_3D", dwCaps, DDCAPS_3D), + DDCAPDEF("DDCAPS_ALIGNBOUNDARYDEST", dwCaps, DDCAPS_ALIGNBOUNDARYDEST), + DDCAPDEF("DDCAPS_ALIGNSIZEDEST", dwCaps, DDCAPS_ALIGNSIZEDEST), + DDCAPDEF("DDCAPS_ALIGNBOUNDARYSRC", dwCaps, DDCAPS_ALIGNBOUNDARYSRC), + DDCAPDEF("DDCAPS_ALIGNSIZESRC", dwCaps, DDCAPS_ALIGNSIZESRC), + DDCAPDEF("DDCAPS_ALIGNSTRIDE", dwCaps, DDCAPS_ALIGNSTRIDE), + DDCAPDEF("DDCAPS_GDI", dwCaps, DDCAPS_GDI), + DDCAPDEF("DDCAPS_OVERLAY", dwCaps, DDCAPS_OVERLAY), + DDCAPDEF("DDCAPS_OVERLAYCANTCLIP", dwCaps, DDCAPS_OVERLAYCANTCLIP), + DDCAPDEF("DDCAPS_OVERLAYFOURCC", dwCaps, DDCAPS_OVERLAYFOURCC), + DDCAPDEF("DDCAPS_OVERLAYSTRETCH", dwCaps, DDCAPS_OVERLAYSTRETCH), + DDCAPDEF("DDCAPS_PALETTE", dwCaps, DDCAPS_PALETTE), + DDCAPDEF("DDCAPS_PALETTEVSYNC", dwCaps, DDCAPS_PALETTEVSYNC), + DDCAPDEF("DDCAPS_READSCANLINE", dwCaps, DDCAPS_READSCANLINE), + DDCAPDEF("DDCAPS_VBI", dwCaps, DDCAPS_VBI), + DDCAPDEF("DDCAPS_ZOVERLAYS", dwCaps, DDCAPS_ZOVERLAYS), + DDCAPDEF("DDCAPS_NOHARDWARE", dwCaps, DDCAPS_NOHARDWARE), + DDCAPDEF("DDCAPS_BANKSWITCHED", dwCaps, DDCAPS_BANKSWITCHED), - // GEN_CAPS2(dwCaps2) - DDCAPDEF("DDCAPS2_CERTIFIED", dwCaps2,DDCAPS2_CERTIFIED), - DDCAPDEF("DDCAPS2_NO2DDURING3DSCENE", dwCaps2,DDCAPS2_NO2DDURING3DSCENE), - DDCAPDEF("DDCAPS2_VIDEOPORT", dwCaps2,DDCAPS2_VIDEOPORT), - DDCAPDEF("DDCAPS2_AUTOFLIPOVERLAY", dwCaps2,DDCAPS2_AUTOFLIPOVERLAY), - DDCAPDEF("DDCAPS2_CANBOBINTERLEAVED", dwCaps2,DDCAPS2_CANBOBINTERLEAVED), - DDCAPDEF("DDCAPS2_CANBOBNONINTERLEAVED", dwCaps2,DDCAPS2_CANBOBNONINTERLEAVED), - DDCAPDEF("DDCAPS2_COLORCONTROLOVERLAY", dwCaps2,DDCAPS2_COLORCONTROLOVERLAY), - DDCAPDEF("DDCAPS2_COLORCONTROLPRIMARY", dwCaps2,DDCAPS2_COLORCONTROLPRIMARY), - DDCAPDEF("DDCAPS2_NONLOCALVIDMEM", dwCaps2,DDCAPS2_NONLOCALVIDMEM), - DDCAPDEF("DDCAPS2_NONLOCALVIDMEMCAPS", dwCaps2,DDCAPS2_NONLOCALVIDMEMCAPS), - DDCAPDEF("DDCAPS2_WIDESURFACES", dwCaps2,DDCAPS2_WIDESURFACES), - DDCAPDEF("DDCAPS2_NOPAGELOCKREQUIRED", dwCaps2,DDCAPS2_NOPAGELOCKREQUIRED), - DDCAPDEF("DDCAPS2_CANRENDERWINDOWED", dwCaps2,DDCAPS2_CANRENDERWINDOWED), - DDCAPDEF("DDCAPS2_COPYFOURCC", dwCaps2,DDCAPS2_COPYFOURCC), - DDCAPDEF("DDCAPS2_PRIMARYGAMMA", dwCaps2,DDCAPS2_PRIMARYGAMMA), - DDCAPDEF("DDCAPS2_CANCALIBRATEGAMMA", dwCaps2,DDCAPS2_CANCALIBRATEGAMMA), - DDCAPDEF("DDCAPS2_FLIPINTERVAL", dwCaps2,DDCAPS2_FLIPINTERVAL), - DDCAPDEF("DDCAPS2_FLIPNOVSYNC", dwCaps2,DDCAPS2_FLIPNOVSYNC), - DDCAPDEF("DDCAPS2_CANMANAGETEXTURE", dwCaps2,DDCAPS2_CANMANAGETEXTURE), - DDCAPDEF("DDCAPS2_TEXMANINNONLOCALVIDMEM", dwCaps2,DDCAPS2_TEXMANINNONLOCALVIDMEM), - DDCAPDEF("DDCAPS2_STEREO", dwCaps2,DDCAPS2_STEREO), - DDCAPDEFex("DDCAPS2_CANSHARERESOURCE", dwCaps2,DDCAPS2_CANSHARERESOURCE), + // GEN_CAPS2(dwCaps2) + DDCAPDEF("DDCAPS2_CERTIFIED", dwCaps2,DDCAPS2_CERTIFIED), + DDCAPDEF("DDCAPS2_NO2DDURING3DSCENE", dwCaps2,DDCAPS2_NO2DDURING3DSCENE), + DDCAPDEF("DDCAPS2_VIDEOPORT", dwCaps2,DDCAPS2_VIDEOPORT), + DDCAPDEF("DDCAPS2_AUTOFLIPOVERLAY", dwCaps2,DDCAPS2_AUTOFLIPOVERLAY), + DDCAPDEF("DDCAPS2_CANBOBINTERLEAVED", dwCaps2,DDCAPS2_CANBOBINTERLEAVED), + DDCAPDEF("DDCAPS2_CANBOBNONINTERLEAVED", dwCaps2,DDCAPS2_CANBOBNONINTERLEAVED), + DDCAPDEF("DDCAPS2_COLORCONTROLOVERLAY", dwCaps2,DDCAPS2_COLORCONTROLOVERLAY), + DDCAPDEF("DDCAPS2_COLORCONTROLPRIMARY", dwCaps2,DDCAPS2_COLORCONTROLPRIMARY), + DDCAPDEF("DDCAPS2_NONLOCALVIDMEM", dwCaps2,DDCAPS2_NONLOCALVIDMEM), + DDCAPDEF("DDCAPS2_NONLOCALVIDMEMCAPS", dwCaps2,DDCAPS2_NONLOCALVIDMEMCAPS), + DDCAPDEF("DDCAPS2_WIDESURFACES", dwCaps2,DDCAPS2_WIDESURFACES), + DDCAPDEF("DDCAPS2_NOPAGELOCKREQUIRED", dwCaps2,DDCAPS2_NOPAGELOCKREQUIRED), + DDCAPDEF("DDCAPS2_CANRENDERWINDOWED", dwCaps2,DDCAPS2_CANRENDERWINDOWED), + DDCAPDEF("DDCAPS2_COPYFOURCC", dwCaps2,DDCAPS2_COPYFOURCC), + DDCAPDEF("DDCAPS2_PRIMARYGAMMA", dwCaps2,DDCAPS2_PRIMARYGAMMA), + DDCAPDEF("DDCAPS2_CANCALIBRATEGAMMA", dwCaps2,DDCAPS2_CANCALIBRATEGAMMA), + DDCAPDEF("DDCAPS2_FLIPINTERVAL", dwCaps2,DDCAPS2_FLIPINTERVAL), + DDCAPDEF("DDCAPS2_FLIPNOVSYNC", dwCaps2,DDCAPS2_FLIPNOVSYNC), + DDCAPDEF("DDCAPS2_CANMANAGETEXTURE", dwCaps2,DDCAPS2_CANMANAGETEXTURE), + DDCAPDEF("DDCAPS2_TEXMANINNONLOCALVIDMEM", dwCaps2,DDCAPS2_TEXMANINNONLOCALVIDMEM), + DDCAPDEF("DDCAPS2_STEREO", dwCaps2,DDCAPS2_STEREO), + DDCAPDEFex("DDCAPS2_CANSHARERESOURCE", dwCaps2,DDCAPS2_CANSHARERESOURCE), - { "", 0, 0 } -}; + { "", 0, 0 } + }; -// -// NOTE GenCaps and CapsDefs are the same -// because some are blt caps that apply to VRAM->VRAM blts and -// some are "general" caps... -// -CAPDEF CapsDefs[] = -{ - GEN_BLTCAPS(dwCaps) - GEN_BLTCAPS2(dwCaps2) - { "", 0, 0 } -}; -CAPDEF SVBCapsDefs[] = -{ - GEN_BLTCAPS(dwSVBCaps) - GEN_BLTCAPS2(dwSVBCaps2) - { "", 0, 0 } -}; -CAPDEF VSBCapsDefs[] = -{ - GEN_BLTCAPS(dwVSBCaps) -// GEN_BLTCAPS2(dwVSBCaps2) - { "", 0, 0 } -}; -CAPDEF SSBCapsDefs[] = -{ - GEN_BLTCAPS(dwSSBCaps) -// GEN_BLTCAPS2(dwSSBCaps2) - { "", 0, 0 } -}; -CAPDEF NLVBCapsDefs[] = -{ - GEN_BLTCAPS(dwNLVBCaps) - GEN_BLTCAPS2(dwNLVBCaps2) - { "", 0, 0 } -}; + // + // NOTE GenCaps and CapsDefs are the same + // because some are blt caps that apply to VRAM->VRAM blts and + // some are "general" caps... + // + CAPDEF CapsDefs[] = + { + GEN_BLTCAPS(dwCaps) + GEN_BLTCAPS2(dwCaps2) + { "", 0, 0 } + }; + CAPDEF SVBCapsDefs[] = + { + GEN_BLTCAPS(dwSVBCaps) + GEN_BLTCAPS2(dwSVBCaps2) + { "", 0, 0 } + }; + CAPDEF VSBCapsDefs[] = + { + GEN_BLTCAPS(dwVSBCaps) + // GEN_BLTCAPS2(dwVSBCaps2) + { "", 0, 0 } + }; + CAPDEF SSBCapsDefs[] = + { + GEN_BLTCAPS(dwSSBCaps) + // GEN_BLTCAPS2(dwSSBCaps2) + { "", 0, 0 } + }; + CAPDEF NLVBCapsDefs[] = + { + GEN_BLTCAPS(dwNLVBCaps) + GEN_BLTCAPS2(dwNLVBCaps2) + { "", 0, 0 } + }; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- #define GEN_CKCAPS(dwCKeyCaps) \ DDCAPDEF("DDCKEYCAPS_DESTBLT", dwCKeyCaps, DDCKEYCAPS_DESTBLT), \ DDCAPDEF("DDCKEYCAPS_DESTBLTCLRSPACE", dwCKeyCaps, DDCKEYCAPS_DESTBLTCLRSPACE), \ @@ -236,35 +238,30 @@ CAPDEF NLVBCapsDefs[] = DDCAPDEF("DDCKEYCAPS_SRCOVERLAYONEACTIVE", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYONEACTIVE), \ DDCAPDEF("DDCKEYCAPS_SRCOVERLAYYUV", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYYUV), -CAPDEF CKeyCapsDefs[] = -{ - GEN_CKCAPS(dwCKeyCaps) - { "", 0, 0} -}; -CAPDEF VSBCKeyCapsDefs[] = -{ - GEN_CKCAPS(dwVSBCKeyCaps) - { "", 0, 0} -}; -CAPDEF SVBCKeyCapsDefs[] = -{ - GEN_CKCAPS(dwSVBCKeyCaps) - { "", 0, 0} -}; -CAPDEF SSBCKeyCapsDefs[] = -{ - GEN_CKCAPS(dwSSBCKeyCaps) - { "", 0, 0} -}; -CAPDEF NLVBCKeyCapsDefs[] = -{ - GEN_CKCAPS(dwNLVBCKeyCaps) - { "", 0, 0} -}; + CAPDEF CKeyCapsDefs[] = + { + GEN_CKCAPS(dwCKeyCaps) + { "", 0, 0 } + }; + CAPDEF SVBCKeyCapsDefs[] = + { + GEN_CKCAPS(dwSVBCKeyCaps) + { "", 0, 0 } + }; + CAPDEF SSBCKeyCapsDefs[] = + { + GEN_CKCAPS(dwSSBCKeyCaps) + { "", 0, 0 } + }; + CAPDEF NLVBCKeyCapsDefs[] = + { + GEN_CKCAPS(dwNLVBCKeyCaps) + { "", 0, 0 } + }; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- #define GEN_FXCAPS(dwFXCaps) \ DDCAPDEF("DDFXCAPS_BLTALPHA", dwFXCaps, DDFXCAPS_BLTALPHA), \ DDCAPDEF("DDFXCAPS_BLTARITHSTRETCHY", dwFXCaps, DDFXCAPS_BLTARITHSTRETCHY), \ @@ -297,34 +294,30 @@ CAPDEF NLVBCKeyCapsDefs[] = DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHY", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHY), \ DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHYN", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHYN), -CAPDEF FXCapsDefs[] = -{ - GEN_FXCAPS(dwFXCaps) - { "", 0, 0} -}; -CAPDEF VSBFXCapsDefs[] = -{ - GEN_FXCAPS(dwVSBFXCaps) - { "", 0, 0} -}; -CAPDEF SVBFXCapsDefs[] = -{ - GEN_FXCAPS(dwSVBFXCaps) - { "", 0, 0} -}; -CAPDEF SSBFXCapsDefs[] = -{ - GEN_FXCAPS(dwSSBFXCaps) - { "", 0, 0} -}; -CAPDEF NLVBFXCapsDefs[] = -{ - GEN_FXCAPS(dwNLVBFXCaps) - { "", 0, 0} -}; + CAPDEF FXCapsDefs[] = + { + GEN_FXCAPS(dwFXCaps) + { "", 0, 0 } + }; + CAPDEF SVBFXCapsDefs[] = + { + GEN_FXCAPS(dwSVBFXCaps) + { "", 0, 0 } + }; + CAPDEF SSBFXCapsDefs[] = + { + GEN_FXCAPS(dwSSBFXCaps) + { "", 0, 0 } + }; + CAPDEF NLVBFXCapsDefs[] = + { + GEN_FXCAPS(dwNLVBFXCaps) + { "", 0, 0 } + }; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- #define GEN_FXALPHACAPS(dwFXAlphaCaps) \ DDCAPDEF("DDFXALPHACAPS_BLTALPHAEDGEBLEND", dwFXAlphaCaps, DDFXALPHACAPS_BLTALPHAEDGEBLEND), \ DDCAPDEF("DDFXALPHACAPS_BLTALPHAPIXELS", dwFXAlphaCaps, DDFXALPHACAPS_BLTALPHAPIXELS), \ @@ -337,84 +330,88 @@ CAPDEF NLVBFXCapsDefs[] = DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHASURFACES", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHASURFACES), \ DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHASURFACESNEG", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHASURFACESNEG), -CAPDEF FXAlphaCapsDefs[] = -{ - GEN_FXALPHACAPS(dwFXAlphaCaps) - { "", 0, 0} -}; + CAPDEF FXAlphaCapsDefs[] = + { + GEN_FXALPHACAPS(dwFXAlphaCaps) + { "", 0, 0 } + }; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF PalCapsDefs[] = -{ - DDCAPDEF("DDPCAPS_1BIT", dwPalCaps, DDPCAPS_1BIT), - DDCAPDEF("DDPCAPS_2BIT", dwPalCaps, DDPCAPS_2BIT), - DDCAPDEF("DDPCAPS_4BIT", dwPalCaps, DDPCAPS_4BIT), - DDCAPDEF("DDPCAPS_8BITENTRIES", dwPalCaps, DDPCAPS_8BITENTRIES), - DDCAPDEF("DDPCAPS_8BIT", dwPalCaps, DDPCAPS_8BIT), - DDCAPDEF("DDPCAPS_ALLOW256", dwPalCaps, DDPCAPS_ALLOW256), - DDCAPDEF("DDPCAPS_ALPHA", dwPalCaps, DDPCAPS_ALPHA), - DDCAPDEF("DDPCAPS_PRIMARYSURFACE", dwPalCaps, DDPCAPS_PRIMARYSURFACE), - DDCAPDEF("DDPCAPS_PRIMARYSURFACELEFT",dwPalCaps, DDPCAPS_PRIMARYSURFACELEFT), - DDCAPDEF("DDPCAPS_VSYNC", dwPalCaps, DDPCAPS_VSYNC), - { "", 0, 0} -}; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF SurfCapsDefs[] = -{ - DDCAPDEF("DDSCAPS_3DDEVICE", ddsCaps.dwCaps, DDSCAPS_3DDEVICE), - DDCAPDEF("DDSCAPS_ALPHA", ddsCaps.dwCaps, DDSCAPS_ALPHA), - DDCAPDEF("DDSCAPS_BACKBUFFER", ddsCaps.dwCaps, DDSCAPS_BACKBUFFER), - DDCAPDEF("DDSCAPS_COMPLEX", ddsCaps.dwCaps, DDSCAPS_COMPLEX), - DDCAPDEF("DDSCAPS_FLIP", ddsCaps.dwCaps, DDSCAPS_FLIP), - DDCAPDEF("DDSCAPS_FRONTBUFFER", ddsCaps.dwCaps, DDSCAPS_FRONTBUFFER), - DDCAPDEF("DDSCAPS_HWCODEC", ddsCaps.dwCaps, DDSCAPS_HWCODEC), - DDCAPDEF("DDSCAPS_LIVEVIDEO", ddsCaps.dwCaps, DDSCAPS_LIVEVIDEO), - DDCAPDEF("DDSCAPS_MIPMAP", ddsCaps.dwCaps, DDSCAPS_MIPMAP), - DDCAPDEF("DDSCAPS_MODEX", ddsCaps.dwCaps, DDSCAPS_MODEX), - DDCAPDEF("DDSCAPS_OFFSCREENPLAIN", ddsCaps.dwCaps, DDSCAPS_OFFSCREENPLAIN), - DDCAPDEF("DDSCAPS_OVERLAY", ddsCaps.dwCaps, DDSCAPS_OVERLAY), - DDCAPDEF("DDSCAPS_OWNDC", ddsCaps.dwCaps, DDSCAPS_OWNDC), - DDCAPDEF("DDSCAPS_PALETTE", ddsCaps.dwCaps, DDSCAPS_PALETTE), - DDCAPDEF("DDSCAPS_PRIMARYSURFACE", ddsCaps.dwCaps, DDSCAPS_PRIMARYSURFACE), - DDCAPDEF("DDSCAPS_SYSTEMMEMORY", ddsCaps.dwCaps, DDSCAPS_SYSTEMMEMORY), - DDCAPDEF("DDSCAPS_TEXTURE", ddsCaps.dwCaps, DDSCAPS_TEXTURE), - DDCAPDEF("DDSCAPS_VIDEOMEMORY", ddsCaps.dwCaps, DDSCAPS_VIDEOMEMORY), - DDCAPDEF("DDSCAPS_VIDEOPORT", ddsCaps.dwCaps, DDSCAPS_VIDEOPORT), - DDCAPDEF("DDSCAPS_VISIBLE", ddsCaps.dwCaps, DDSCAPS_VISIBLE), - DDCAPDEF("DDSCAPS_WRITEONLY", ddsCaps.dwCaps, DDSCAPS_WRITEONLY), - DDCAPDEF("DDSCAPS_ZBUFFER", ddsCaps.dwCaps, DDSCAPS_ZBUFFER), - DDCAPDEF("DDSCAPS_ALLOCONLOAD", ddsCaps.dwCaps, DDSCAPS_ALLOCONLOAD), - DDCAPDEF("DDSCAPS_LOCALVIDMEM", ddsCaps.dwCaps, DDSCAPS_LOCALVIDMEM), - DDCAPDEF("DDSCAPS_NONLOCALVIDMEM", ddsCaps.dwCaps, DDSCAPS_NONLOCALVIDMEM), - DDCAPDEF("DDSCAPS_STANDARDVGAMODE", ddsCaps.dwCaps, DDSCAPS_STANDARDVGAMODE), - DDCAPDEF("DDSCAPS_OPTIMIZED", ddsCaps.dwCaps, DDSCAPS_OPTIMIZED), - DDCAPDEF("DDSCAPS2_HARDWAREDEINTERLACE", ddsCaps.dwCaps2, DDSCAPS2_HARDWAREDEINTERLACE), - DDCAPDEF("DDSCAPS2_HINTDYNAMIC", ddsCaps.dwCaps2, DDSCAPS2_HINTDYNAMIC), - DDCAPDEF("DDSCAPS2_HINTSTATIC", ddsCaps.dwCaps2, DDSCAPS2_HINTSTATIC), - DDCAPDEF("DDSCAPS2_TEXTUREMANAGE", ddsCaps.dwCaps2, DDSCAPS2_TEXTUREMANAGE), - DDCAPDEF("DDSCAPS2_OPAQUE", ddsCaps.dwCaps2, DDSCAPS2_OPAQUE), - DDCAPDEF("DDSCAPS2_HINTANTIALIASING", ddsCaps.dwCaps2, DDSCAPS2_HINTANTIALIASING), - DDCAPDEF("DDSCAPS2_CUBEMAP", ddsCaps.dwCaps2, DDSCAPS2_CUBEMAP), - DDCAPDEF("DDSCAPS2_MIPMAPSUBLEVEL", ddsCaps.dwCaps2, DDSCAPS2_MIPMAPSUBLEVEL), - DDCAPDEF("DDSCAPS2_D3DTEXTUREMANAGE", ddsCaps.dwCaps2, DDSCAPS2_D3DTEXTUREMANAGE), - DDCAPDEF("DDSCAPS2_DONOTPERSIST", ddsCaps.dwCaps2, DDSCAPS2_DONOTPERSIST), - DDCAPDEF("DDSCAPS2_STEREOSURFACELEFT", ddsCaps.dwCaps2, DDSCAPS2_STEREOSURFACELEFT), - { "", 0, 0} -}; + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF PalCapsDefs[] = + { + DDCAPDEF("DDPCAPS_1BIT", dwPalCaps, DDPCAPS_1BIT), + DDCAPDEF("DDPCAPS_2BIT", dwPalCaps, DDPCAPS_2BIT), + DDCAPDEF("DDPCAPS_4BIT", dwPalCaps, DDPCAPS_4BIT), + DDCAPDEF("DDPCAPS_8BITENTRIES", dwPalCaps, DDPCAPS_8BITENTRIES), + DDCAPDEF("DDPCAPS_8BIT", dwPalCaps, DDPCAPS_8BIT), + DDCAPDEF("DDPCAPS_ALLOW256", dwPalCaps, DDPCAPS_ALLOW256), + DDCAPDEF("DDPCAPS_ALPHA", dwPalCaps, DDPCAPS_ALPHA), + DDCAPDEF("DDPCAPS_PRIMARYSURFACE", dwPalCaps, DDPCAPS_PRIMARYSURFACE), + DDCAPDEF("DDPCAPS_PRIMARYSURFACELEFT",dwPalCaps, DDPCAPS_PRIMARYSURFACELEFT), + DDCAPDEF("DDPCAPS_VSYNC", dwPalCaps, DDPCAPS_VSYNC), + { "", 0, 0} + }; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF SVisionCapsDefs[] = -{ - DDCAPDEF("DDSVCAPS_STEREOSEQUENTIAL", dwSVCaps, DDSVCAPS_STEREOSEQUENTIAL), - { "", 0, 0} -}; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF SurfCapsDefs[] = + { + DDCAPDEF("DDSCAPS_3DDEVICE", ddsCaps.dwCaps, DDSCAPS_3DDEVICE), + DDCAPDEF("DDSCAPS_ALPHA", ddsCaps.dwCaps, DDSCAPS_ALPHA), + DDCAPDEF("DDSCAPS_BACKBUFFER", ddsCaps.dwCaps, DDSCAPS_BACKBUFFER), + DDCAPDEF("DDSCAPS_COMPLEX", ddsCaps.dwCaps, DDSCAPS_COMPLEX), + DDCAPDEF("DDSCAPS_FLIP", ddsCaps.dwCaps, DDSCAPS_FLIP), + DDCAPDEF("DDSCAPS_FRONTBUFFER", ddsCaps.dwCaps, DDSCAPS_FRONTBUFFER), + DDCAPDEF("DDSCAPS_HWCODEC", ddsCaps.dwCaps, DDSCAPS_HWCODEC), + DDCAPDEF("DDSCAPS_LIVEVIDEO", ddsCaps.dwCaps, DDSCAPS_LIVEVIDEO), + DDCAPDEF("DDSCAPS_MIPMAP", ddsCaps.dwCaps, DDSCAPS_MIPMAP), + DDCAPDEF("DDSCAPS_MODEX", ddsCaps.dwCaps, DDSCAPS_MODEX), + DDCAPDEF("DDSCAPS_OFFSCREENPLAIN", ddsCaps.dwCaps, DDSCAPS_OFFSCREENPLAIN), + DDCAPDEF("DDSCAPS_OVERLAY", ddsCaps.dwCaps, DDSCAPS_OVERLAY), + DDCAPDEF("DDSCAPS_OWNDC", ddsCaps.dwCaps, DDSCAPS_OWNDC), + DDCAPDEF("DDSCAPS_PALETTE", ddsCaps.dwCaps, DDSCAPS_PALETTE), + DDCAPDEF("DDSCAPS_PRIMARYSURFACE", ddsCaps.dwCaps, DDSCAPS_PRIMARYSURFACE), + DDCAPDEF("DDSCAPS_SYSTEMMEMORY", ddsCaps.dwCaps, DDSCAPS_SYSTEMMEMORY), + DDCAPDEF("DDSCAPS_TEXTURE", ddsCaps.dwCaps, DDSCAPS_TEXTURE), + DDCAPDEF("DDSCAPS_VIDEOMEMORY", ddsCaps.dwCaps, DDSCAPS_VIDEOMEMORY), + DDCAPDEF("DDSCAPS_VIDEOPORT", ddsCaps.dwCaps, DDSCAPS_VIDEOPORT), + DDCAPDEF("DDSCAPS_VISIBLE", ddsCaps.dwCaps, DDSCAPS_VISIBLE), + DDCAPDEF("DDSCAPS_WRITEONLY", ddsCaps.dwCaps, DDSCAPS_WRITEONLY), + DDCAPDEF("DDSCAPS_ZBUFFER", ddsCaps.dwCaps, DDSCAPS_ZBUFFER), + DDCAPDEF("DDSCAPS_ALLOCONLOAD", ddsCaps.dwCaps, DDSCAPS_ALLOCONLOAD), + DDCAPDEF("DDSCAPS_LOCALVIDMEM", ddsCaps.dwCaps, DDSCAPS_LOCALVIDMEM), + DDCAPDEF("DDSCAPS_NONLOCALVIDMEM", ddsCaps.dwCaps, DDSCAPS_NONLOCALVIDMEM), + DDCAPDEF("DDSCAPS_STANDARDVGAMODE", ddsCaps.dwCaps, DDSCAPS_STANDARDVGAMODE), + DDCAPDEF("DDSCAPS_OPTIMIZED", ddsCaps.dwCaps, DDSCAPS_OPTIMIZED), + DDCAPDEF("DDSCAPS2_HARDWAREDEINTERLACE", ddsCaps.dwCaps2, DDSCAPS2_HARDWAREDEINTERLACE), + DDCAPDEF("DDSCAPS2_HINTDYNAMIC", ddsCaps.dwCaps2, DDSCAPS2_HINTDYNAMIC), + DDCAPDEF("DDSCAPS2_HINTSTATIC", ddsCaps.dwCaps2, DDSCAPS2_HINTSTATIC), + DDCAPDEF("DDSCAPS2_TEXTUREMANAGE", ddsCaps.dwCaps2, DDSCAPS2_TEXTUREMANAGE), + DDCAPDEF("DDSCAPS2_OPAQUE", ddsCaps.dwCaps2, DDSCAPS2_OPAQUE), + DDCAPDEF("DDSCAPS2_HINTANTIALIASING", ddsCaps.dwCaps2, DDSCAPS2_HINTANTIALIASING), + DDCAPDEF("DDSCAPS2_CUBEMAP", ddsCaps.dwCaps2, DDSCAPS2_CUBEMAP), + DDCAPDEF("DDSCAPS2_MIPMAPSUBLEVEL", ddsCaps.dwCaps2, DDSCAPS2_MIPMAPSUBLEVEL), + DDCAPDEF("DDSCAPS2_D3DTEXTUREMANAGE", ddsCaps.dwCaps2, DDSCAPS2_D3DTEXTUREMANAGE), + DDCAPDEF("DDSCAPS2_DONOTPERSIST", ddsCaps.dwCaps2, DDSCAPS2_DONOTPERSIST), + DDCAPDEF("DDSCAPS2_STEREOSURFACELEFT", ddsCaps.dwCaps2, DDSCAPS2_STEREOSURFACELEFT), + { "", 0, 0} + }; + + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF SVisionCapsDefs[] = + { + DDCAPDEF("DDSVCAPS_STEREOSEQUENTIAL", dwSVCaps, DDSVCAPS_STEREOSEQUENTIAL), + { "", 0, 0} + }; + + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- #define GEN_ROPS(dwRops) \ ROPDEF("SRCCOPY", dwRops, SRCCOPY), \ ROPDEF("SRCPAINT", dwRops, SRCPAINT), \ @@ -432,637 +429,594 @@ CAPDEF SVisionCapsDefs[] = ROPDEF("BLACKNESS", dwRops, BLACKNESS), \ ROPDEF("WHITENESS", dwRops, WHITENESS), -CAPDEF ROPCapsDefs[] = -{ - GEN_ROPS(dwRops) - {"", 0, 0} -}; -CAPDEF VSBROPCapsDefs[] = -{ - GEN_ROPS(dwVSBRops) - {"", 0, 0} -}; -CAPDEF SVBROPCapsDefs[] = -{ - GEN_ROPS(dwSVBRops) - {"", 0, 0} -}; -CAPDEF SSBROPCapsDefs[] = -{ - GEN_ROPS(dwSSBRops) - {"", 0, 0} -}; -CAPDEF NLVBROPCapsDefs[] = -{ - GEN_ROPS(dwNLVBRops) - {"", 0, 0} -}; + CAPDEF ROPCapsDefs[] = + { + GEN_ROPS(dwRops) + { "", 0, 0 } + }; + CAPDEF VSBROPCapsDefs[] = + { + GEN_ROPS(dwVSBRops) + { "", 0, 0 } + }; + CAPDEF SVBROPCapsDefs[] = + { + GEN_ROPS(dwSVBRops) + { "", 0, 0 } + }; + CAPDEF SSBROPCapsDefs[] = + { + GEN_ROPS(dwSSBRops) + { "", 0, 0 } + }; + CAPDEF NLVBROPCapsDefs[] = + { + GEN_ROPS(dwNLVBRops) + { "", 0, 0 } + }; + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF OverlayCapsDefs[] = + { + DDCAPDEF("DDCAPS_OVERLAY", dwCaps, DDCAPS_OVERLAY), + + DDCAPDEF("DDCAPS_ALIGNBOUNDARYDEST", dwCaps, DDCAPS_ALIGNBOUNDARYDEST), + DDVALDEF(" dwAlignBoundaryDest", dwAlignBoundaryDest), + DDCAPDEF("DDCAPS_ALIGNSIZEDEST", dwCaps, DDCAPS_ALIGNSIZEDEST), + DDVALDEF(" dwAlignSizeDest", dwAlignSizeDest), + DDCAPDEF("DDCAPS_ALIGNBOUNDARYSRC", dwCaps, DDCAPS_ALIGNBOUNDARYSRC), + DDVALDEF(" dwAlignBoundarySrc", dwAlignBoundarySrc), + DDCAPDEF("DDCAPS_ALIGNSIZESRC", dwCaps, DDCAPS_ALIGNSIZESRC), + DDVALDEF(" dwAlignSizeSrc", dwAlignSizeSrc), + DDCAPDEF("DDCAPS_ALIGNSTRIDE", dwCaps, DDCAPS_ALIGNSTRIDE), + DDVALDEF(" dwAlignStrideAlign", dwAlignStrideAlign), + + DDCAPDEF("DDCAPS_OVERLAYCANTCLIP", dwCaps, DDCAPS_OVERLAYCANTCLIP), + DDCAPDEF("DDCAPS_OVERLAYFOURCC", dwCaps, DDCAPS_OVERLAYFOURCC), + DDCAPDEF("DDCAPS_OVERLAYSTRETCH", dwCaps, DDCAPS_OVERLAYSTRETCH), + DDCAPDEF("DDCAPS_ZOVERLAYS", dwCaps, DDCAPS_ZOVERLAYS), + DDCAPDEF("DDCAPS2_AUTOFLIPOVERLAY", dwCaps2,DDCAPS2_AUTOFLIPOVERLAY), + DDCAPDEF("DDCAPS2_CANBOBINTERLEAVED", dwCaps2,DDCAPS2_CANBOBINTERLEAVED), + DDCAPDEF("DDCAPS2_CANBOBNONINTERLEAVED", dwCaps2,DDCAPS2_CANBOBNONINTERLEAVED), + DDCAPDEF("DDCAPS2_COLORCONTROLOVERLAY", dwCaps2,DDCAPS2_COLORCONTROLOVERLAY), + DDCAPDEF("DDCKEYCAPS_DESTOVERLAY", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAY), + DDCAPDEF("DDCKEYCAPS_DESTOVERLAYCLRSPACE", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYCLRSPACE), + DDCAPDEF("DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV), + DDCAPDEF("DDCKEYCAPS_DESTOVERLAYONEACTIVE", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYONEACTIVE), + DDCAPDEF("DDCKEYCAPS_DESTOVERLAYYUV", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYYUV), + DDCAPDEF("DDCKEYCAPS_SRCOVERLAY", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAY), + DDCAPDEF("DDCKEYCAPS_SRCOVERLAYCLRSPACE", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYCLRSPACE), + DDCAPDEF("DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV), + DDCAPDEF("DDCKEYCAPS_SRCOVERLAYONEACTIVE", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYONEACTIVE), + DDCAPDEF("DDCKEYCAPS_SRCOVERLAYYUV", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYYUV), + DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND), + DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHAPIXELS", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHAPIXELS), + DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG), + DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHASURFACES", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHASURFACES), + DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHASURFACESNEG", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHASURFACESNEG), + DDCAPDEF("DDFXCAPS_OVERLAYALPHA", dwFXCaps, DDFXCAPS_OVERLAYALPHA), + DDCAPDEF("DDFXCAPS_OVERLAYARITHSTRETCHY", dwFXCaps, DDFXCAPS_OVERLAYARITHSTRETCHY), + DDCAPDEF("DDFXCAPS_OVERLAYARITHSTRETCHYN", dwFXCaps, DDFXCAPS_OVERLAYARITHSTRETCHYN), + DDCAPDEF("DDFXCAPS_OVERLAYFILTER", dwFXCaps, DDFXCAPS_OVERLAYFILTER), + DDCAPDEF("DDFXCAPS_OVERLAYMIRRORLEFTRIGHT", dwFXCaps, DDFXCAPS_OVERLAYMIRRORLEFTRIGHT), + DDCAPDEF("DDFXCAPS_OVERLAYMIRRORUPDOWN", dwFXCaps, DDFXCAPS_OVERLAYMIRRORUPDOWN), + DDCAPDEF("DDFXCAPS_OVERLAYSHRINKX", dwFXCaps, DDFXCAPS_OVERLAYSHRINKX), + DDCAPDEF("DDFXCAPS_OVERLAYSHRINKXN", dwFXCaps, DDFXCAPS_OVERLAYSHRINKXN), + DDCAPDEF("DDFXCAPS_OVERLAYSHRINKY", dwFXCaps, DDFXCAPS_OVERLAYSHRINKY), + DDCAPDEF("DDFXCAPS_OVERLAYSHRINKYN", dwFXCaps, DDFXCAPS_OVERLAYSHRINKYN), + DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHX", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHX), + DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHXN", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHXN), + DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHY", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHY), + DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHYN", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHYN), + DDHEXDEF("dwAlphaOverlayConstBitDepths", dwAlphaOverlayConstBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaOverlayConstBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaOverlayConstBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaOverlayConstBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaOverlayConstBitDepths, DDBD_32), + DDHEXDEF("dwAlphaOverlayPixelBitDepths", dwAlphaOverlayPixelBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaOverlayPixelBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaOverlayPixelBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaOverlayPixelBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaOverlayPixelBitDepths, DDBD_32), + DDHEXDEF("dwAlphaOverlaySurfaceBitDepths", dwAlphaOverlaySurfaceBitDepths), + DDCAPDEF(" DDBD_8", dwAlphaOverlaySurfaceBitDepths, DDBD_8), + DDCAPDEF(" DDBD_16", dwAlphaOverlaySurfaceBitDepths, DDBD_16), + DDCAPDEF(" DDBD_24", dwAlphaOverlaySurfaceBitDepths, DDBD_24), + DDCAPDEF(" DDBD_32", dwAlphaOverlaySurfaceBitDepths, DDBD_32), + DDVALDEF("dwMaxVisibleOverlays", dwMaxVisibleOverlays), + DDVALDEF("dwCurrVisibleOverlays", dwCurrVisibleOverlays), + DDVALDEF("dwMinOverlayStretch", dwMinOverlayStretch), + DDVALDEF("dwMaxOverlayStretch", dwMaxOverlayStretch), + { "", 0, 0} + }; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF OverlayCapsDefs[] = -{ - DDCAPDEF("DDCAPS_OVERLAY", dwCaps, DDCAPS_OVERLAY), - - DDCAPDEF("DDCAPS_ALIGNBOUNDARYDEST", dwCaps, DDCAPS_ALIGNBOUNDARYDEST), - DDVALDEF(" dwAlignBoundaryDest", dwAlignBoundaryDest), - DDCAPDEF("DDCAPS_ALIGNSIZEDEST", dwCaps, DDCAPS_ALIGNSIZEDEST), - DDVALDEF(" dwAlignSizeDest", dwAlignSizeDest), - DDCAPDEF("DDCAPS_ALIGNBOUNDARYSRC", dwCaps, DDCAPS_ALIGNBOUNDARYSRC), - DDVALDEF(" dwAlignBoundarySrc", dwAlignBoundarySrc), - DDCAPDEF("DDCAPS_ALIGNSIZESRC", dwCaps, DDCAPS_ALIGNSIZESRC), - DDVALDEF(" dwAlignSizeSrc", dwAlignSizeSrc), - DDCAPDEF("DDCAPS_ALIGNSTRIDE", dwCaps, DDCAPS_ALIGNSTRIDE), - DDVALDEF(" dwAlignStrideAlign", dwAlignStrideAlign), - - DDCAPDEF("DDCAPS_OVERLAYCANTCLIP", dwCaps, DDCAPS_OVERLAYCANTCLIP), - DDCAPDEF("DDCAPS_OVERLAYFOURCC", dwCaps, DDCAPS_OVERLAYFOURCC), - DDCAPDEF("DDCAPS_OVERLAYSTRETCH", dwCaps, DDCAPS_OVERLAYSTRETCH), - DDCAPDEF("DDCAPS_ZOVERLAYS", dwCaps, DDCAPS_ZOVERLAYS), - DDCAPDEF("DDCAPS2_AUTOFLIPOVERLAY", dwCaps2,DDCAPS2_AUTOFLIPOVERLAY), - DDCAPDEF("DDCAPS2_CANBOBINTERLEAVED", dwCaps2,DDCAPS2_CANBOBINTERLEAVED), - DDCAPDEF("DDCAPS2_CANBOBNONINTERLEAVED", dwCaps2,DDCAPS2_CANBOBNONINTERLEAVED), - DDCAPDEF("DDCAPS2_COLORCONTROLOVERLAY", dwCaps2,DDCAPS2_COLORCONTROLOVERLAY), - DDCAPDEF("DDCKEYCAPS_DESTOVERLAY", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAY), - DDCAPDEF("DDCKEYCAPS_DESTOVERLAYCLRSPACE", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYCLRSPACE), - DDCAPDEF("DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV), - DDCAPDEF("DDCKEYCAPS_DESTOVERLAYONEACTIVE", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYONEACTIVE), - DDCAPDEF("DDCKEYCAPS_DESTOVERLAYYUV", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYYUV), - DDCAPDEF("DDCKEYCAPS_SRCOVERLAY", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAY), - DDCAPDEF("DDCKEYCAPS_SRCOVERLAYCLRSPACE", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYCLRSPACE), - DDCAPDEF("DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV), - DDCAPDEF("DDCKEYCAPS_SRCOVERLAYONEACTIVE", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYONEACTIVE), - DDCAPDEF("DDCKEYCAPS_SRCOVERLAYYUV", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYYUV), - DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND), - DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHAPIXELS", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHAPIXELS), - DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG), - DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHASURFACES", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHASURFACES), - DDCAPDEF("DDFXALPHACAPS_OVERLAYALPHASURFACESNEG", dwFXAlphaCaps, DDFXALPHACAPS_OVERLAYALPHASURFACESNEG), - DDCAPDEF("DDFXCAPS_OVERLAYALPHA", dwFXCaps, DDFXCAPS_OVERLAYALPHA), - DDCAPDEF("DDFXCAPS_OVERLAYARITHSTRETCHY", dwFXCaps, DDFXCAPS_OVERLAYARITHSTRETCHY), - DDCAPDEF("DDFXCAPS_OVERLAYARITHSTRETCHYN", dwFXCaps, DDFXCAPS_OVERLAYARITHSTRETCHYN), - DDCAPDEF("DDFXCAPS_OVERLAYFILTER", dwFXCaps, DDFXCAPS_OVERLAYFILTER), - DDCAPDEF("DDFXCAPS_OVERLAYMIRRORLEFTRIGHT", dwFXCaps, DDFXCAPS_OVERLAYMIRRORLEFTRIGHT), - DDCAPDEF("DDFXCAPS_OVERLAYMIRRORUPDOWN", dwFXCaps, DDFXCAPS_OVERLAYMIRRORUPDOWN), - DDCAPDEF("DDFXCAPS_OVERLAYSHRINKX", dwFXCaps, DDFXCAPS_OVERLAYSHRINKX), - DDCAPDEF("DDFXCAPS_OVERLAYSHRINKXN", dwFXCaps, DDFXCAPS_OVERLAYSHRINKXN), - DDCAPDEF("DDFXCAPS_OVERLAYSHRINKY", dwFXCaps, DDFXCAPS_OVERLAYSHRINKY), - DDCAPDEF("DDFXCAPS_OVERLAYSHRINKYN", dwFXCaps, DDFXCAPS_OVERLAYSHRINKYN), - DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHX", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHX), - DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHXN", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHXN), - DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHY", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHY), - DDCAPDEF("DDFXCAPS_OVERLAYSTRETCHYN", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHYN), - DDHEXDEF("dwAlphaOverlayConstBitDepths", dwAlphaOverlayConstBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaOverlayConstBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaOverlayConstBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaOverlayConstBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaOverlayConstBitDepths, DDBD_32), - DDHEXDEF("dwAlphaOverlayPixelBitDepths", dwAlphaOverlayPixelBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaOverlayPixelBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaOverlayPixelBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaOverlayPixelBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaOverlayPixelBitDepths, DDBD_32), - DDHEXDEF("dwAlphaOverlaySurfaceBitDepths", dwAlphaOverlaySurfaceBitDepths), - DDCAPDEF(" DDBD_8", dwAlphaOverlaySurfaceBitDepths, DDBD_8), - DDCAPDEF(" DDBD_16", dwAlphaOverlaySurfaceBitDepths, DDBD_16), - DDCAPDEF(" DDBD_24", dwAlphaOverlaySurfaceBitDepths, DDBD_24), - DDCAPDEF(" DDBD_32", dwAlphaOverlaySurfaceBitDepths, DDBD_32), - DDVALDEF("dwMaxVisibleOverlays", dwMaxVisibleOverlays), - DDVALDEF("dwCurrVisibleOverlays", dwCurrVisibleOverlays), - DDVALDEF("dwMinOverlayStretch", dwMinOverlayStretch), - DDVALDEF("dwMaxOverlayStretch", dwMaxOverlayStretch), - { "", 0, 0} -}; + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF VideoPortCapsDefs[] = + { + DDCAPDEF("DDCAPS2_VIDEOPORT", dwCaps2,DDCAPS2_VIDEOPORT), + DDCAPDEF("DDSCAPS_VIDEOPORT", ddsCaps.dwCaps, DDSCAPS_VIDEOPORT), + DDCAPDEF("DDSCAPS_LIVEVIDEO", ddsCaps.dwCaps, DDSCAPS_LIVEVIDEO), + DDCAPDEF("DDSCAPS2_HARDWAREDEINTERLACE", dwCaps2,DDSCAPS2_HARDWAREDEINTERLACE), + DDCAPDEF("DDSCAPS2_AUTOFLIPOVERLAY", dwCaps2,DDCAPS2_AUTOFLIPOVERLAY), + DDVALDEF("dwMinLiveVideoStretch", dwMinLiveVideoStretch), + DDVALDEF("dwMaxLiveVideoStretch", dwMaxLiveVideoStretch), + DDVALDEF("dwMaxVideoPorts", dwMaxVideoPorts), + DDVALDEF("dwCurrVideoPorts", dwCurrVideoPorts), + { "", 0, 0} + }; + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEFS DDCapDefs[] = + { + {"", nullptr, (LPARAM)0, }, + {"Memory", DDDisplayVidMem, (LPARAM)0, }, -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF VideoPortCapsDefs[] = -{ - DDCAPDEF("DDCAPS2_VIDEOPORT", dwCaps2,DDCAPS2_VIDEOPORT), - DDCAPDEF("DDSCAPS_VIDEOPORT", ddsCaps.dwCaps, DDSCAPS_VIDEOPORT), - DDCAPDEF("DDSCAPS_LIVEVIDEO", ddsCaps.dwCaps, DDSCAPS_LIVEVIDEO), - DDCAPDEF("DDSCAPS2_HARDWAREDEINTERLACE", dwCaps2,DDSCAPS2_HARDWAREDEINTERLACE), - DDCAPDEF("DDSCAPS2_AUTOFLIPOVERLAY", dwCaps2,DDCAPS2_AUTOFLIPOVERLAY), - DDVALDEF("dwMinLiveVideoStretch", dwMinLiveVideoStretch), - DDVALDEF("dwMaxLiveVideoStretch", dwMaxLiveVideoStretch), - DDVALDEF("dwMaxVideoPorts", dwMaxVideoPorts), - DDVALDEF("dwCurrVideoPorts", dwCurrVideoPorts), - { "", 0, 0} -}; + {"+Caps", nullptr, (LPARAM)0, }, + {"General", DDDisplayCaps, (LPARAM)GenCaps, }, + {"FX Alpha Caps", DDDisplayCaps, (LPARAM)FXAlphaCapsDefs, }, + {"Palette Caps", DDDisplayCaps, (LPARAM)PalCapsDefs, }, + {"Overlay Caps", DDDisplayCaps, (LPARAM)OverlayCapsDefs, }, + {"Surface Caps", DDDisplayCaps, (LPARAM)SurfCapsDefs, }, + {"Stereo Vision Caps", DDDisplayCaps, (LPARAM)SVisionCapsDefs, }, + {"Video Port Caps", DDDisplayCaps, (LPARAM)VideoPortCapsDefs, }, + + {"+BLT Caps", nullptr, (LPARAM)0, }, + + {"+Video - Video", nullptr, (LPARAM)0, }, + {"General", DDDisplayCaps, (LPARAM)CapsDefs, }, + {"Color Key", DDDisplayCaps, (LPARAM)CKeyCapsDefs, }, + {"FX", DDDisplayCaps, (LPARAM)FXCapsDefs, }, + {"ROPS", DDDisplayCaps, (LPARAM)ROPCapsDefs, }, + {"-", nullptr, (LPARAM)0, }, + + {"+System - Video", nullptr, (LPARAM)0, }, + {"General", DDDisplayCaps, (LPARAM)SVBCapsDefs, }, + {"Color Key", DDDisplayCaps, (LPARAM)SVBCKeyCapsDefs, }, + {"FX", DDDisplayCaps, (LPARAM)SVBFXCapsDefs, }, + {"ROPS", DDDisplayCaps, (LPARAM)SVBROPCapsDefs, }, + {"-", nullptr, (LPARAM)0, }, + + {"+Video - System", nullptr, (LPARAM)0, }, + {"General", DDDisplayCaps, (LPARAM)VSBCapsDefs, }, + {"Color Key", DDDisplayCaps, (LPARAM)SSBCKeyCapsDefs, }, + {"FX", DDDisplayCaps, (LPARAM)SSBFXCapsDefs, }, + {"ROPS", DDDisplayCaps, (LPARAM)VSBROPCapsDefs, }, + {"-", nullptr, (LPARAM)0, }, + + {"+System - System", nullptr, (LPARAM)0, }, + {"General", DDDisplayCaps, (LPARAM)SSBCapsDefs, }, + {"Color Key", DDDisplayCaps, (LPARAM)SSBCKeyCapsDefs, }, + {"FX", DDDisplayCaps, (LPARAM)SSBFXCapsDefs, }, + {"ROPS", DDDisplayCaps, (LPARAM)SSBROPCapsDefs, }, + {"-", nullptr, (LPARAM)0, }, + + {"+NonLocal - Video", nullptr, (LPARAM)0, }, + {"General", DDDisplayCaps, (LPARAM)NLVBCapsDefs, }, + {"Color Key", DDDisplayCaps, (LPARAM)NLVBCKeyCapsDefs, }, + {"FX", DDDisplayCaps, (LPARAM)NLVBFXCapsDefs, }, + {"ROPS", DDDisplayCaps, (LPARAM)NLVBROPCapsDefs, }, + {"-", nullptr, (LPARAM)0, }, + + {"-", nullptr, (LPARAM)0, }, + {"-", nullptr, (LPARAM)0, }, + + {"Video Modes", DDDisplayVideoModes,(LPARAM)0, }, + {"FourCC Formats", DDDisplayFourCCFormat,(LPARAM)0, }, + {"Other", DDDisplayCaps, (LPARAM)OtherInfoDefs, }, + + { nullptr, 0, 0 } + }; + //----------------------------------------------------------------------------- + HRESULT DDCreate(GUID* pGUID) + { + if (pGUID == (GUID*)-2) + return E_FAIL; -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEFS DDCapDefs[] = -{ - {"", NULL, (LPARAM)0, }, - {"Memory", DDDisplayVidMem, (LPARAM)0, }, + if (g_pDD && pGUID == g_pDDGUID) + return S_OK; - {"+Caps", NULL, (LPARAM)0, }, - {"General", DDDisplayCaps, (LPARAM)GenCaps, }, - {"FX Alpha Caps", DDDisplayCaps, (LPARAM)FXAlphaCapsDefs, }, - {"Palette Caps", DDDisplayCaps, (LPARAM)PalCapsDefs, }, - {"Overlay Caps", DDDisplayCaps, (LPARAM)OverlayCapsDefs, }, - {"Surface Caps", DDDisplayCaps, (LPARAM)SurfCapsDefs, }, - {"Stereo Vision Caps", DDDisplayCaps, (LPARAM)SVisionCapsDefs, }, - {"Video Port Caps", DDDisplayCaps, (LPARAM)VideoPortCapsDefs, }, + SAFE_RELEASE(g_pDD) - {"+BLT Caps", NULL, (LPARAM)0, }, + // There is no need to create DirectDraw emulation-only just to get + // the HEL caps. In fact, this will fail if there is another DirectDraw + // app running and using the hardware. + if (pGUID == (GUID*)DDCREATE_EMULATIONONLY) + pGUID = nullptr; - {"+Video - Video", NULL, (LPARAM)0, }, - {"General", DDDisplayCaps, (LPARAM)CapsDefs, }, - {"Color Key", DDDisplayCaps, (LPARAM)CKeyCapsDefs, }, - {"FX", DDDisplayCaps, (LPARAM)FXCapsDefs, }, - {"ROPS", DDDisplayCaps, (LPARAM)ROPCapsDefs, }, - {"-", NULL, (LPARAM)0, }, + if (!g_directDrawCreateEx) + return E_FAIL; - {"+System - Video", NULL, (LPARAM)0, }, - {"General", DDDisplayCaps, (LPARAM)SVBCapsDefs, }, - {"Color Key", DDDisplayCaps, (LPARAM)SVBCKeyCapsDefs, }, - {"FX", DDDisplayCaps, (LPARAM)SVBFXCapsDefs, }, - {"ROPS", DDDisplayCaps, (LPARAM)SVBROPCapsDefs, }, - {"-", NULL, (LPARAM)0, }, + if (SUCCEEDED(g_directDrawCreateEx(pGUID, (VOID**)&g_pDD, IID_IDirectDraw7, nullptr))) + { + g_pDDGUID = pGUID; + return S_OK; + } - {"+Video - System", NULL, (LPARAM)0, }, - {"General", DDDisplayCaps, (LPARAM)VSBCapsDefs, }, - {"Color Key", DDDisplayCaps, (LPARAM)SSBCKeyCapsDefs, }, - {"FX", DDDisplayCaps, (LPARAM)SSBFXCapsDefs, }, - {"ROPS", DDDisplayCaps, (LPARAM)VSBROPCapsDefs, }, - {"-", NULL, (LPARAM)0, }, - - {"+System - System", NULL, (LPARAM)0, }, - {"General", DDDisplayCaps, (LPARAM)SSBCapsDefs, }, - {"Color Key", DDDisplayCaps, (LPARAM)SSBCKeyCapsDefs, }, - {"FX", DDDisplayCaps, (LPARAM)SSBFXCapsDefs, }, - {"ROPS", DDDisplayCaps, (LPARAM)SSBROPCapsDefs, }, - {"-", NULL, (LPARAM)0, }, - - {"+NonLocal - Video", NULL, (LPARAM)0, }, - {"General", DDDisplayCaps, (LPARAM)NLVBCapsDefs, }, - {"Color Key", DDDisplayCaps, (LPARAM)NLVBCKeyCapsDefs, }, - {"FX", DDDisplayCaps, (LPARAM)NLVBFXCapsDefs, }, - {"ROPS", DDDisplayCaps, (LPARAM)NLVBROPCapsDefs, }, - {"-", NULL, (LPARAM)0, }, - - {"-", NULL, (LPARAM)0, }, - {"-", NULL, (LPARAM)0, }, - - {"Video Modes", DDDisplayVideoModes,(LPARAM)0, }, - {"FourCC Formats", DDDisplayFourCCFormat,(LPARAM)0, }, - {"Other", DDDisplayCaps, (LPARAM)OtherInfoDefs, }, - - { NULL, 0, 0 } -}; - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HRESULT DDCreate( GUID* pGUID ) -{ - if( pGUID == (GUID *)-2 ) return E_FAIL; - - if( g_pDD && pGUID == g_pDDGUID ) - return S_OK; - - if( g_pDD ) - g_pDD->Release(); - g_pDD = NULL; - - // There is no need to create DirectDraw emulation-only just to get - // the HEL caps. In fact, this will fail if there is another DirectDraw - // app running and using the hardware. - if( pGUID == (GUID *)DDCREATE_EMULATIONONLY ) - pGUID = NULL; - - if( SUCCEEDED( DirectDrawCreateEx( pGUID, (VOID**)&g_pDD, IID_IDirectDraw7, NULL ) ) ) - { - g_pDDGUID = pGUID; - return S_OK; } - DisplayErrorMessage( "DirectDrawCreate failed." ); - - return E_FAIL; -} - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HRESULT DDDisplayVidMem( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ) -{ - if( SUCCEEDED( DDCreate( (GUID*)lParam1 ) ) ) + //----------------------------------------------------------------------------- + HRESULT DDDisplayVidMem(LPARAM lParam1, LPARAM /*lParam2*/, _In_opt_ PRINTCBINFO* pPrintInfo) { - DWORD dwTotalVidMem = 0, dwFreeVidMem = 0; - DWORD dwTotalLocMem = 0, dwFreeLocMem = 0; - DWORD dwTotalAGPMem = 0, dwFreeAGPMem = 0; - DWORD dwTotalTexMem = 0, dwFreeTexMem = 0; - - DDSCAPS2 ddsCaps2; - ZeroMemory( &ddsCaps2, sizeof(ddsCaps2) ); - - ddsCaps2.dwCaps = DDSCAPS_VIDEOMEMORY; - HRESULT hr = g_pDD->GetAvailableVidMem( &ddsCaps2, &dwTotalVidMem, &dwFreeVidMem ); - if (FAILED(hr)) + if (SUCCEEDED(DDCreate((GUID*)lParam1))) { - dwTotalVidMem = 0; - dwFreeVidMem = 0; - } + DWORD dwTotalVidMem = 0, dwFreeVidMem = 0; + DWORD dwTotalLocMem = 0, dwFreeLocMem = 0; + DWORD dwTotalAGPMem = 0, dwFreeAGPMem = 0; + DWORD dwTotalTexMem = 0, dwFreeTexMem = 0; - ddsCaps2.dwCaps = DDSCAPS_LOCALVIDMEM; - hr = g_pDD->GetAvailableVidMem( &ddsCaps2, &dwTotalLocMem, &dwFreeLocMem ); - if (FAILED(hr)) - { - dwTotalLocMem = 0; - dwFreeLocMem = 0; - } + DDSCAPS2 ddsCaps2 = {}; - ddsCaps2.dwCaps = DDSCAPS_NONLOCALVIDMEM; - hr = g_pDD->GetAvailableVidMem( &ddsCaps2, &dwTotalAGPMem, &dwFreeAGPMem ); - if (FAILED(hr)) - { - dwTotalAGPMem = 0; - dwFreeAGPMem = 0; - } + ddsCaps2.dwCaps = DDSCAPS_VIDEOMEMORY; + HRESULT hr = g_pDD->GetAvailableVidMem(&ddsCaps2, &dwTotalVidMem, &dwFreeVidMem); + if (FAILED(hr)) + { + dwTotalVidMem = 0; + dwFreeVidMem = 0; + } - ddsCaps2.dwCaps = DDSCAPS_TEXTURE; - hr = g_pDD->GetAvailableVidMem( &ddsCaps2, &dwTotalTexMem, &dwFreeTexMem ); - if (FAILED(hr)) - { - dwTotalTexMem = 0; - dwFreeTexMem = 0; - } - - if( pPrintInfo ) - { - PrintValueLine( "dwTotalVidMem", dwTotalVidMem, pPrintInfo ); - PrintValueLine( "dwFreeVidMem", dwFreeVidMem, pPrintInfo ); - PrintValueLine( "dwTotalLocMem", dwTotalLocMem, pPrintInfo ); - PrintValueLine( "dwFreeLocMem", dwFreeLocMem, pPrintInfo ); - PrintValueLine( "dwTotalAGPMem", dwTotalAGPMem, pPrintInfo ); - PrintValueLine( "dwFreeAGPMem", dwFreeAGPMem, pPrintInfo ); - PrintValueLine( "dwTotalTexMem", dwTotalTexMem, pPrintInfo ); - PrintValueLine( "dwFreeTexMem", dwFreeTexMem, pPrintInfo ); - } - else - { - CHAR strBuff[64]; + ddsCaps2.dwCaps = DDSCAPS_LOCALVIDMEM; + hr = g_pDD->GetAvailableVidMem(&ddsCaps2, &dwTotalLocMem, &dwFreeLocMem); + if (FAILED(hr)) + { + dwTotalLocMem = 0; + dwFreeLocMem = 0; + } - LVAddColumn( g_hwndLV, 0, "Type", 24 ); - LVAddColumn( g_hwndLV, 1, "Total", 10 ); - LVAddColumn( g_hwndLV, 2, "Free", 10 ); + ddsCaps2.dwCaps = DDSCAPS_NONLOCALVIDMEM; + hr = g_pDD->GetAvailableVidMem(&ddsCaps2, &dwTotalAGPMem, &dwFreeAGPMem); + if (FAILED(hr)) + { + dwTotalAGPMem = 0; + dwFreeAGPMem = 0; + } - LVAddText( g_hwndLV, 0, "Video" ); - Int2Str( strBuff, 64, dwTotalVidMem ); - LVAddText( g_hwndLV, 1, "%s", strBuff ); - Int2Str( strBuff, 64, dwFreeVidMem ); - LVAddText( g_hwndLV, 2, "%s", strBuff ); + ddsCaps2.dwCaps = DDSCAPS_TEXTURE; + hr = g_pDD->GetAvailableVidMem(&ddsCaps2, &dwTotalTexMem, &dwFreeTexMem); + if (FAILED(hr)) + { + dwTotalTexMem = 0; + dwFreeTexMem = 0; + } - LVAddText( g_hwndLV, 0, "Video (local)" ); - Int2Str( strBuff, 64, dwTotalLocMem ); - LVAddText( g_hwndLV, 1, "%s", strBuff ); - Int2Str( strBuff, 64, dwFreeLocMem ); - LVAddText( g_hwndLV, 2, "%s", strBuff ); - - LVAddText( g_hwndLV, 0, "Video (non-local)" ); - Int2Str( strBuff, 64, dwTotalAGPMem ); - LVAddText( g_hwndLV, 1, "%s", strBuff ); - Int2Str( strBuff, 64, dwFreeAGPMem ); - LVAddText( g_hwndLV, 2, "%s", strBuff ); - - LVAddText( g_hwndLV, 0, "Texture" ); - Int2Str( strBuff, 64, dwTotalTexMem ); - LVAddText( g_hwndLV, 1, "%s", strBuff ); - Int2Str( strBuff, 64, dwFreeTexMem ); - LVAddText( g_hwndLV, 2, "%s", strBuff ); - } - } - - return S_OK; -} - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HRESULT DDDisplayCaps( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ) -{ - // lParam1 is the GUID for the driver we should open - // lParam2 is the CAPDEF table we should use - if( SUCCEEDED( DDCreate( (GUID*)lParam1 ) ) ) - { - DDCAPS ddcaps; - ZeroMemory( &ddcaps, sizeof(ddcaps) ); - ddcaps.dwSize = sizeof(ddcaps); - - HRESULT hr; - if( lParam1 == DDCREATE_EMULATIONONLY ) - hr = g_pDD->GetCaps( NULL, &ddcaps); - else - hr = g_pDD->GetCaps( &ddcaps, NULL); - if ( FAILED(hr) ) - ZeroMemory( &ddcaps, sizeof(ddcaps) ); - - if( pPrintInfo ) - return PrintCapsToDC( (CAPDEF*)lParam2, (VOID*)&ddcaps, pPrintInfo ); - else - AddCapsToLV((CAPDEF *)lParam2, (LPVOID)&ddcaps); - } - - // Keep printing, even if an error occurred - return S_OK; -} - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HRESULT DDDisplayFourCCFormat( LPARAM lParam1, LPARAM lParam2, - PRINTCBINFO* pPrintInfo ) -{ - HRESULT hr; - DWORD dwNumOfCodes; - DWORD* FourCC; - - if( NULL == g_pDD ) - return S_OK; - - if( FAILED( hr = g_pDD->GetFourCCCodes( &dwNumOfCodes, NULL ) ) ) - return E_FAIL; - - if( NULL == ( FourCC = (DWORD*)GlobalAlloc(GPTR,(sizeof(DWORD)*dwNumOfCodes) ) ) ) - return E_FAIL; - - if( FAILED( hr = g_pDD->GetFourCCCodes( &dwNumOfCodes, FourCC ) ) ) - return E_FAIL; - - // Add columns - if( NULL == pPrintInfo ) - { - LVAddColumn(g_hwndLV, 0, "Codes", 24); - LVAddColumn(g_hwndLV, 1, "", 24); - } - - // Assume all FourCC values are ascii strings - for( DWORD dwCount = 0; dwCount < dwNumOfCodes; dwCount++ ) - { - CHAR strText[5]={0,0,0,0,0}; - memcpy( strText, &FourCC[dwCount], 4 ); - - if( NULL == pPrintInfo ) - { - LVAddText( g_hwndLV, 0, "%s", strText ); - } - else - { - int xCode = ( pPrintInfo->dwCurrIndent * DEF_TAB_SIZE * pPrintInfo->dwCharWidth ); - int yLine = ( pPrintInfo->dwCurrLine * pPrintInfo->dwLineHeight ); - - // Print Code - if( FAILED( PrintLine( xCode, yLine, strText, 4, pPrintInfo ) ) ) - return E_FAIL; - - if( FAILED( PrintNextLine(pPrintInfo) ) ) - return E_FAIL; - } - } - - return S_OK; -} - - - - -//----------------------------------------------------------------------------- -// Name: DisplayEnumModes() -// Desc: -//----------------------------------------------------------------------------- -HRESULT CALLBACK EnumDisplayModesCallback( DDSURFACEDESC2* pddsd, VOID* Context ) -{ - if( pddsd->ddsCaps.dwCaps & DDSCAPS_STANDARDVGAMODE ) - { - LVAddText( g_hwndLV, 0, "%dx%dx%d (StandardVGA)", - pddsd->dwWidth, pddsd->dwHeight, - pddsd->ddpfPixelFormat.dwRGBBitCount ); - } - else if( pddsd->ddsCaps.dwCaps & DDSCAPS_MODEX ) - { - LVAddText( g_hwndLV, 0, "%dx%dx%d (ModeX)", - pddsd->dwWidth, pddsd->dwHeight, - pddsd->ddpfPixelFormat.dwRGBBitCount ); - } - else - { - LVAddText( g_hwndLV, 0, "%dx%dx%d ", - pddsd->dwWidth, pddsd->dwHeight, - pddsd->ddpfPixelFormat.dwRGBBitCount ); - } - - return DDENUMRET_OK; -} - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HRESULT CALLBACK EnumDisplayModesCallbackPrint( DDSURFACEDESC2* pddsd, VOID* Context ) -{ - TCHAR szBuff[80]; - DWORD cchLen; - PRINTCBINFO* lpInfo = (PRINTCBINFO*)Context; - int xMode, yLine; - - if (! lpInfo) - return FALSE; - - xMode = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth); - yLine = (lpInfo->dwCurrLine * lpInfo->dwLineHeight); - - if(pddsd->ddsCaps.dwCaps & DDSCAPS_STANDARDVGAMODE) - { - sprintf_s(szBuff, sizeof(szBuff), TEXT("%dx%dx%d (StandardVGA)"), pddsd->dwWidth, pddsd->dwHeight, pddsd->ddpfPixelFormat.dwRGBBitCount); - }else if(pddsd->ddsCaps.dwCaps & DDSCAPS_MODEX) - { - sprintf_s(szBuff, sizeof(szBuff), TEXT("%dx%dx%d (ModeX)"), pddsd->dwWidth, pddsd->dwHeight, pddsd->ddpfPixelFormat.dwRGBBitCount); - }else - { - sprintf_s(szBuff, sizeof(szBuff), TEXT("%dx%dx%d "), pddsd->dwWidth, pddsd->dwHeight, pddsd->ddpfPixelFormat.dwRGBBitCount); - } - // Print Mode Info - cchLen = _tcslen (szBuff); - if( FAILED( PrintLine (xMode, yLine, szBuff, cchLen, lpInfo) ) ) - return DDENUMRET_CANCEL; - // Advance to next line - if( FAILED( PrintNextLine(lpInfo) ) ) - return DDENUMRET_CANCEL; - - return DDENUMRET_OK; -} - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HRESULT DDDisplayVideoModes( LPARAM lParam1, LPARAM lParam2, - PRINTCBINFO* pPrintInfo ) -{ - DWORD mode; - DDSURFACEDESC2 ddsd; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Mode", 24); - LVAddColumn(g_hwndLV, 1, "", 24); - } - - // lParam1 is the GUID for the driver we should open - // lParam2 is not used - - if( SUCCEEDED( DDCreate((GUID*)lParam1)) ) - { - // Get the current mode mode for this driver - ddsd.dwSize = sizeof(DDSURFACEDESC2); - HRESULT hr = g_pDD->GetDisplayMode( &ddsd ); - if ( SUCCEEDED( hr ) ) - { - mode = MAKEMODE(ddsd.dwWidth, ddsd.dwHeight, ddsd.ddpfPixelFormat.dwRGBBitCount); - - // Get Mode with ModeX - g_pDD->SetCooperativeLevel( g_hwndMain, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | - DDSCL_ALLOWMODEX | DDSCL_NOWINDOWCHANGES ); - - if( pPrintInfo ) - g_pDD->EnumDisplayModes( DDEDM_STANDARDVGAMODES, NULL, (VOID*)pPrintInfo, - EnumDisplayModesCallbackPrint ); + if (pPrintInfo) + { + PrintValueLine("dwTotalVidMem", dwTotalVidMem, pPrintInfo); + PrintValueLine("dwFreeVidMem", dwFreeVidMem, pPrintInfo); + PrintValueLine("dwTotalLocMem", dwTotalLocMem, pPrintInfo); + PrintValueLine("dwFreeLocMem", dwFreeLocMem, pPrintInfo); + PrintValueLine("dwTotalAGPMem", dwTotalAGPMem, pPrintInfo); + PrintValueLine("dwFreeAGPMem", dwFreeAGPMem, pPrintInfo); + PrintValueLine("dwTotalTexMem", dwTotalTexMem, pPrintInfo); + PrintValueLine("dwFreeTexMem", dwFreeTexMem, pPrintInfo); + } else - g_pDD->EnumDisplayModes( DDEDM_STANDARDVGAMODES, NULL, UIntToPtr(mode), - EnumDisplayModesCallback ); + { + CHAR strBuff[64]; - g_pDD->SetCooperativeLevel( g_hwndMain, DDSCL_NORMAL); + LVAddColumn(g_hwndLV, 0, "Type", 24); + LVAddColumn(g_hwndLV, 1, "Total", 10); + LVAddColumn(g_hwndLV, 2, "Free", 10); + + LVAddText(g_hwndLV, 0, "Video"); + Int2Str(strBuff, 64, dwTotalVidMem); + LVAddText(g_hwndLV, 1, "%s", strBuff); + Int2Str(strBuff, 64, dwFreeVidMem); + LVAddText(g_hwndLV, 2, "%s", strBuff); + + LVAddText(g_hwndLV, 0, "Video (local)"); + Int2Str(strBuff, 64, dwTotalLocMem); + LVAddText(g_hwndLV, 1, "%s", strBuff); + Int2Str(strBuff, 64, dwFreeLocMem); + LVAddText(g_hwndLV, 2, "%s", strBuff); + + LVAddText(g_hwndLV, 0, "Video (non-local)"); + Int2Str(strBuff, 64, dwTotalAGPMem); + LVAddText(g_hwndLV, 1, "%s", strBuff); + Int2Str(strBuff, 64, dwFreeAGPMem); + LVAddText(g_hwndLV, 2, "%s", strBuff); + + LVAddText(g_hwndLV, 0, "Texture"); + Int2Str(strBuff, 64, dwTotalTexMem); + LVAddText(g_hwndLV, 1, "%s", strBuff); + Int2Str(strBuff, 64, dwFreeTexMem); + LVAddText(g_hwndLV, 2, "%s", strBuff); + } } + + return S_OK; } - return S_OK; -} - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -BOOL CALLBACK DDEnumCallBack( __in GUID* pid, __in_z LPSTR lpDriverDesc, - __in_z_opt LPSTR lpDriverName, __in_opt VOID* lpContext, __in_opt HMONITOR ) -{ - HTREEITEM hParent = (HTREEITEM)lpContext; - TCHAR szText[256]; - - if (pid != (GUID *)-2) - if (HIWORD(pid) != 0) + //----------------------------------------------------------------------------- + HRESULT DDDisplayCaps(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pPrintInfo) + { + // lParam1 is the GUID for the driver we should open + // lParam2 is the CAPDEF table we should use + if (SUCCEEDED(DDCreate((GUID*)lParam1))) { - GUID temp = *pid; - pid = (GUID *)LocalAlloc(LPTR, sizeof(GUID)); - if( pid != NULL ) - *pid = temp; + DDCAPS ddcaps = {}; + ddcaps.dwSize = sizeof(ddcaps); + + HRESULT hr; + if (lParam1 == DDCREATE_EMULATIONONLY) + hr = g_pDD->GetCaps(nullptr, &ddcaps); + else + hr = g_pDD->GetCaps(&ddcaps, nullptr); + if (FAILED(hr)) + { + ddcaps = {}; + } + + if (pPrintInfo) + return PrintCapsToDC((CAPDEF*)lParam2, (VOID*)&ddcaps, pPrintInfo); + else + AddCapsToLV((CAPDEF*)lParam2, (LPVOID)&ddcaps); } - // Add subnode to treeview - if (lpDriverName && *lpDriverName) - sprintf_s(szText, sizeof(szText), "%s (%s)", lpDriverDesc, lpDriverName); - else - strcpy_s(szText, sizeof(szText), lpDriverDesc); - szText[255] = TEXT('\0'); + // Keep printing, even if an error occurred + return S_OK; + } - DDCapDefs[0].strName = szText; - AddCapsToTV(hParent, DDCapDefs, (LPARAM)pid); - return(DDENUMRET_OK); + //----------------------------------------------------------------------------- + HRESULT DDDisplayFourCCFormat(LPARAM /*lParam1*/, LPARAM /*lParam2*/, + _In_opt_ PRINTCBINFO* pPrintInfo) + { + if (!g_pDD) + return S_OK; + + DWORD dwNumOfCodes; + HRESULT hr = g_pDD->GetFourCCCodes(&dwNumOfCodes, nullptr); + if (FAILED(hr)) + return E_FAIL; + + auto FourCC = static_cast(GlobalAlloc(GPTR, (sizeof(DWORD) * dwNumOfCodes))); + if (!FourCC) + return E_OUTOFMEMORY; + + hr = g_pDD->GetFourCCCodes(&dwNumOfCodes, FourCC); + if (FAILED(hr)) + return E_FAIL; + + // Add columns + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Codes", 24); + LVAddColumn(g_hwndLV, 1, "", 24); + } + + // Assume all FourCC values are ascii strings + for (DWORD dwCount = 0; dwCount < dwNumOfCodes; dwCount++) + { + CHAR strText[5] = {}; + memcpy(strText, &FourCC[dwCount], 4); + + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "%s", strText); + } + else + { + int xCode = (pPrintInfo->dwCurrIndent * DEF_TAB_SIZE * pPrintInfo->dwCharWidth); + int yLine = (pPrintInfo->dwCurrLine * pPrintInfo->dwLineHeight); + + // Print Code + if (FAILED(PrintLine(xCode, yLine, strText, 4, pPrintInfo))) + return E_FAIL; + + if (FAILED(PrintNextLine(pPrintInfo))) + return E_FAIL; + } + } + + GlobalFree(FourCC); + + return S_OK; + } + + + //----------------------------------------------------------------------------- + HRESULT CALLBACK EnumDisplayModesCallback(DDSURFACEDESC2* pddsd, VOID*) + { + if (pddsd->ddsCaps.dwCaps & DDSCAPS_STANDARDVGAMODE) + { + LVAddText(g_hwndLV, 0, "%dx%dx%d (StandardVGA)", + pddsd->dwWidth, pddsd->dwHeight, + pddsd->ddpfPixelFormat.dwRGBBitCount); + } + else if (pddsd->ddsCaps.dwCaps & DDSCAPS_MODEX) + { + LVAddText(g_hwndLV, 0, "%dx%dx%d (ModeX)", + pddsd->dwWidth, pddsd->dwHeight, + pddsd->ddpfPixelFormat.dwRGBBitCount); + } + else + { + LVAddText(g_hwndLV, 0, "%dx%dx%d ", + pddsd->dwWidth, pddsd->dwHeight, + pddsd->ddpfPixelFormat.dwRGBBitCount); + } + + return DDENUMRET_OK; + } + + + //----------------------------------------------------------------------------- + HRESULT CALLBACK EnumDisplayModesCallbackPrint(DDSURFACEDESC2* pddsd, VOID* Context) + { + TCHAR szBuff[80]; + DWORD cchLen; + auto lpInfo = reinterpret_cast(Context); + int xMode, yLine; + + if (!lpInfo) + return FALSE; + + xMode = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth); + yLine = (lpInfo->dwCurrLine * lpInfo->dwLineHeight); + + if (pddsd->ddsCaps.dwCaps & DDSCAPS_STANDARDVGAMODE) + { + sprintf_s(szBuff, sizeof(szBuff), TEXT("%ux%ux%u (StandardVGA)"), pddsd->dwWidth, pddsd->dwHeight, pddsd->ddpfPixelFormat.dwRGBBitCount); + } + else if (pddsd->ddsCaps.dwCaps & DDSCAPS_MODEX) + { + sprintf_s(szBuff, sizeof(szBuff), TEXT("%ux%ux%u (ModeX)"), pddsd->dwWidth, pddsd->dwHeight, pddsd->ddpfPixelFormat.dwRGBBitCount); + } + else + { + sprintf_s(szBuff, sizeof(szBuff), TEXT("%ux%ux%u "), pddsd->dwWidth, pddsd->dwHeight, pddsd->ddpfPixelFormat.dwRGBBitCount); + } + // Print Mode Info + cchLen = static_cast(_tcslen(szBuff)); + if (FAILED(PrintLine(xMode, yLine, szBuff, cchLen, lpInfo))) + return DDENUMRET_CANCEL; + // Advance to next line + if (FAILED(PrintNextLine(lpInfo))) + return DDENUMRET_CANCEL; + + return DDENUMRET_OK; + } + + + //----------------------------------------------------------------------------- + HRESULT DDDisplayVideoModes(LPARAM lParam1, LPARAM /*lParam2*/, + _In_opt_ PRINTCBINFO* pPrintInfo) + { + DWORD mode; + DDSURFACEDESC2 ddsd; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Mode", 24); + LVAddColumn(g_hwndLV, 1, "", 24); + } + + // lParam1 is the GUID for the driver we should open + // lParam2 is not used + + if (SUCCEEDED(DDCreate((GUID*)lParam1))) + { + // Get the current mode mode for this driver + ddsd.dwSize = sizeof(DDSURFACEDESC2); + HRESULT hr = g_pDD->GetDisplayMode(&ddsd); + if (SUCCEEDED(hr)) + { + mode = MAKEMODE(ddsd.dwWidth, ddsd.dwHeight, ddsd.ddpfPixelFormat.dwRGBBitCount); + + // Get Mode with ModeX + g_pDD->SetCooperativeLevel(g_hwndMain, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | + DDSCL_ALLOWMODEX | DDSCL_NOWINDOWCHANGES); + + if (pPrintInfo) + g_pDD->EnumDisplayModes(DDEDM_STANDARDVGAMODES, nullptr, (VOID*)pPrintInfo, + EnumDisplayModesCallbackPrint); + else + g_pDD->EnumDisplayModes(DDEDM_STANDARDVGAMODES, nullptr, UIntToPtr(mode), + EnumDisplayModesCallback); + + g_pDD->SetCooperativeLevel(g_hwndMain, DDSCL_NORMAL); + } + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + BOOL CALLBACK DDEnumCallBack(_In_ GUID* pid, _In_z_ LPSTR lpDriverDesc, + _In_opt_ LPSTR lpDriverName, _In_opt_ VOID* lpContext, _In_opt_ HMONITOR) + { + HTREEITEM hParent = (HTREEITEM)lpContext; + TCHAR szText[256]; + + if (pid != (GUID*)-2) + if (HIWORD(pid) != 0) + { + GUID temp = *pid; + pid = (GUID*)LocalAlloc(LPTR, sizeof(GUID)); + if (pid) + *pid = temp; + } + + // Add subnode to treeview + if (lpDriverName && *lpDriverName) + sprintf_s(szText, sizeof(szText), "%s (%s)", lpDriverDesc, lpDriverName); + else + strcpy_s(szText, sizeof(szText), lpDriverDesc); + szText[255] = TEXT('\0'); + + DDCapDefs[0].strName = szText; + AddCapsToTV(hParent, DDCapDefs, (LPARAM)pid); + + return(DDENUMRET_OK); + } } - - - //----------------------------------------------------------------------------- // Name: DD_Init() -// Desc: //----------------------------------------------------------------------------- VOID DD_Init() { + g_hInstDDraw = LoadLibraryEx("ddraw.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (g_hInstDDraw) + { + g_directDrawCreateEx = reinterpret_cast(GetProcAddress(g_hInstDDraw, "DirectDrawCreateEx")); + g_directDrawEnumerateEx = reinterpret_cast(GetProcAddress(g_hInstDDraw, "DirectDrawEnumerateExA")); + } } - - //----------------------------------------------------------------------------- // Name: DD_FillTree() -// Desc: //----------------------------------------------------------------------------- -VOID DD_FillTree( HWND hwndTV ) +VOID DD_FillTree(HWND hwndTV) { + if (!g_directDrawEnumerateEx) + return; + HTREEITEM hTree; // Add DirectDraw devices - hTree = TVAddNode( TVI_ROOT, "DirectDraw Devices", TRUE, IDI_DIRECTX, - NULL, 0, 0 ); + hTree = TVAddNode(TVI_ROOT, "DirectDraw Devices", TRUE, IDI_DIRECTX, + nullptr, 0, 0); // Add Display Driver node(s) and capability nodes to treeview - DirectDrawEnumerateEx( DDEnumCallBack, hTree, - DDENUM_ATTACHEDSECONDARYDEVICES | - DDENUM_DETACHEDSECONDARYDEVICES | - DDENUM_NONDISPLAYDEVICES ); + g_directDrawEnumerateEx(DDEnumCallBack, hTree, + DDENUM_ATTACHEDSECONDARYDEVICES | + DDENUM_DETACHEDSECONDARYDEVICES | + DDENUM_NONDISPLAYDEVICES); // Hardware Emulation Layer (HEL) not supported on Windows 8, // so we no longer show it - TreeView_Expand( hwndTV, hTree, TVE_EXPAND ); + TreeView_Expand(hwndTV, hTree, TVE_EXPAND); } - - //----------------------------------------------------------------------------- // Name: DD_CleanUp() -// Desc: //----------------------------------------------------------------------------- VOID DD_CleanUp() { - if( g_pDD ) - g_pDD->Release(); - g_pDD = NULL; + SAFE_RELEASE(g_pDD); + + if (g_hInstDDraw) + { + g_directDrawCreateEx = nullptr; + g_directDrawEnumerateEx = nullptr; + + FreeLibrary(g_hInstDDraw); + g_hInstDDraw = nullptr; + } } - - - - - - - - - diff --git a/dxg.cpp b/dxg.cpp index ff5e49f..4807f29 100644 --- a/dxg.cpp +++ b/dxg.cpp @@ -1,7 +1,7 @@ //----------------------------------------------------------------------------- -// Name: DXG.cpp +// Name: dxg.cpp // -// Desc: DX Graphics stuff for DirectX caps viewer +// Desc: DirectX Capabilities Viewer for Direct3D // // Copyright (c) Microsoft Corporation. All Rights Reserved. //----------------------------------------------------------------------------- @@ -22,29 +22,20 @@ #define D3DPTFILTERCAPS_CONVOLUTIONMONO 0x00040000L /* Min and Mag for the convolution mono filter */ -typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT SDKVersion, IDirect3D9**); +namespace +{ + using LPDIRECT3D9CREATE9 = IDirect3D9 * (WINAPI*)(UINT SDKVersion); + using LPDIRECT3D9CREATE9EX = HRESULT(WINAPI*)(UINT SDKVersion, IDirect3D9**); + LPDIRECT3D9 g_pD3D = nullptr; + LPDIRECT3D9CREATE9 g_direct3DCreate9 = nullptr; + LPDIRECT3D9CREATE9EX g_direct3DCreate9Ex = nullptr; + HMODULE g_hInstD3D = nullptr; -extern HRESULT PrintValueLine( const CHAR* szText, DWORD dwValue, PRINTCBINFO *lpInfo ); -extern HRESULT PrintHexValueLine( const CHAR* szText, DWORD dwValue, PRINTCBINFO *lpInfo ); -extern HRESULT PrintStringValueLine( const CHAR* szText, const CHAR* szText2, PRINTCBINFO *lpInfo ); -extern HRESULT PrintStringLine( const CHAR* szText, PRINTCBINFO *lpInfo ); + BOOL g_is9Ex = FALSE; -LPDIRECT3D9 g_pD3D = NULL; // Direct3D object -BOOL g_is9Ex = FALSE; - -BOOL IsBBFmt(D3DFORMAT fmt); -BOOL IsDeviceTypeAvailable(UINT iAdapter, D3DDEVTYPE devType); -BOOL IsAdapterFmtAvailable(UINT iAdapter, D3DDEVTYPE devType, D3DFORMAT fmtAdapter, BOOL bWindowed); -HRESULT DXGDisplayModes( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pInfo ); -HRESULT DXGDisplayCaps( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pInfo ); -HRESULT DXGDisplayMultiSample( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pInfo ); -HRESULT DXGDisplayBackBuffer( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pInfo ); -HRESULT DXGDisplayRenderTarget( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pInfo ); -HRESULT DXGDisplayDepthStencil( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pInfo ); -HRESULT DXGDisplayPlainSurface( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pInfo ); -HRESULT DXGDisplayResource( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pInfo ); -HRESULT DXGCheckDSQualityLevels( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pInfo ); + BOOL IsAdapterFmtAvailable(UINT iAdapter, D3DDEVTYPE devType, D3DFORMAT fmtAdapter, BOOL bWindowed); + HRESULT DXGDisplayCaps(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pInfo); #define CAPSVALDEFex(name,val) {name, FIELD_OFFSET(D3DCAPS9,val), 0, DXV_9EXCAP} #define CAPSVALDEF(name,val) {name, FIELD_OFFSET(D3DCAPS9,val), 0} @@ -57,1648 +48,1568 @@ HRESULT DXGCheckDSQualityLevels( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, #define PRIMCAPSVALDEF(name,val) {name, FIELD_OFFSET(D3DPRIMCAPS9,val), 0} #define PRIMCAPSFLAGDEF(name,val,flag) {name, FIELD_OFFSET(D3DPRIMCAPS9,val), flag} - -// NOTE: Remember to update FormatName() when you update this list!! -D3DFORMAT AllFormatArray[] = -{ - D3DFMT_R8G8B8, - D3DFMT_A8R8G8B8, - D3DFMT_X8R8G8B8, - D3DFMT_R5G6B5, - D3DFMT_X1R5G5B5, - D3DFMT_A1R5G5B5, - D3DFMT_A4R4G4B4, - D3DFMT_R3G3B2, - D3DFMT_A8, - D3DFMT_A8R3G3B2, - D3DFMT_X4R4G4B4, - D3DFMT_A2B10G10R10, - D3DFMT_A8B8G8R8, - D3DFMT_X8B8G8R8, - D3DFMT_G16R16, - D3DFMT_A2R10G10B10, - D3DFMT_A16B16G16R16, - - D3DFMT_A8P8, - D3DFMT_P8, - - D3DFMT_L8, - D3DFMT_A8L8, - D3DFMT_A4L4, - - D3DFMT_V8U8, - D3DFMT_L6V5U5, - D3DFMT_X8L8V8U8, - D3DFMT_Q8W8V8U8, - D3DFMT_V16U16, - D3DFMT_A2W10V10U10, - - D3DFMT_UYVY, - D3DFMT_R8G8_B8G8, - D3DFMT_YUY2, - D3DFMT_G8R8_G8B8, - D3DFMT_DXT1, - D3DFMT_DXT2, - D3DFMT_DXT3, - D3DFMT_DXT4, - D3DFMT_DXT5, - - D3DFMT_D16_LOCKABLE, - D3DFMT_D32, - D3DFMT_D15S1, - D3DFMT_D24S8, - D3DFMT_D24X8, - D3DFMT_D24X4S4, - D3DFMT_D16, - - D3DFMT_D32F_LOCKABLE, - D3DFMT_D24FS8, - - D3DFMT_L16, - - D3DFMT_VERTEXDATA, - D3DFMT_INDEX16, - D3DFMT_INDEX32, - - D3DFMT_Q16W16V16U16, - - D3DFMT_MULTI2_ARGB8, - - D3DFMT_R16F, - D3DFMT_G16R16F, - D3DFMT_A16B16G16R16F, - - D3DFMT_R32F, - D3DFMT_G32R32F, - D3DFMT_A32B32G32R32F, - - D3DFMT_CxV8U8, - - (D3DFORMAT)D3DFMT_D32_LOCKABLE, - (D3DFORMAT)D3DFMT_S8_LOCKABLE, - (D3DFORMAT)D3DFMT_A1, -}; -int NumFormats = sizeof(AllFormatArray) / sizeof(AllFormatArray[0]); - -// A subset of AllFormatArray...it's those D3DFMTs that could possibly be -// adapter (display) formats. -D3DFORMAT AdapterFormatArray[] = -{ - D3DFMT_A2R10G10B10, - D3DFMT_X8R8G8B8, - D3DFMT_R8G8B8, - D3DFMT_X1R5G5B5, - D3DFMT_R5G6B5, -}; -int NumAdapterFormats = sizeof(AdapterFormatArray) / sizeof(AdapterFormatArray[0]); - -// A subset of AllFormatArray...it's those D3DFMTs that could possibly be -// back buffer formats. -D3DFORMAT BBFormatArray[] = -{ - D3DFMT_A2R10G10B10, - D3DFMT_A8R8G8B8, - D3DFMT_X8R8G8B8, - D3DFMT_A1R5G5B5, - D3DFMT_X1R5G5B5, - D3DFMT_R5G6B5, -}; -int NumBBFormats = sizeof(BBFormatArray) / sizeof(BBFormatArray[0]); - -// A subset of AllFormatArray...it's those D3DFMTs that could possibly be -// depth/stencil formats. -D3DFORMAT DSFormatArray[] = -{ - D3DFMT_D16_LOCKABLE, - D3DFMT_D32, - D3DFMT_D15S1, - D3DFMT_D24S8, - D3DFMT_D24X8, - D3DFMT_D24X4S4, - D3DFMT_D16, - D3DFMT_D32F_LOCKABLE, - D3DFMT_D24FS8, -}; -int NumDSFormats = sizeof(DSFormatArray) / sizeof(DSFormatArray[0]); - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF DXGGenCaps[] = -{ - CAPSVALDEF("DeviceType", DeviceType), - CAPSVALDEF("AdapterOrdinal", AdapterOrdinal), - - CAPSVALDEF("MaxTextureWidth", MaxTextureWidth), - CAPSVALDEF("MaxTextureHeight", MaxTextureHeight), - CAPSVALDEF("MaxVolumeExtent", MaxVolumeExtent), - - CAPSVALDEF("MaxTextureRepeat", MaxTextureRepeat), - CAPSVALDEF("MaxTextureAspectRatio", MaxTextureAspectRatio), - CAPSVALDEF("MaxAnisotropy", MaxAnisotropy), - CAPSFLOATDEF("MaxVertexW", MaxVertexW), - - CAPSFLOATDEF("GuardBandLeft", GuardBandLeft), - CAPSFLOATDEF("GuardBandTop", GuardBandTop), - CAPSFLOATDEF("GuardBandRight", GuardBandRight), - CAPSFLOATDEF("GuardBandBottom", GuardBandBottom), - - CAPSFLOATDEF("ExtentsAdjust", ExtentsAdjust), - - CAPSVALDEF("MaxTextureBlendStages", MaxTextureBlendStages), - CAPSVALDEF("MaxSimultaneousTextures", MaxSimultaneousTextures), - - CAPSVALDEF("MaxActiveLights", MaxActiveLights), - CAPSVALDEF("MaxUserClipPlanes", MaxUserClipPlanes), - CAPSVALDEF("MaxVertexBlendMatrices", MaxVertexBlendMatrices), - CAPSVALDEF("MaxVertexBlendMatrixIndex", MaxVertexBlendMatrixIndex), - - CAPSFLOATDEF("MaxPointSize", MaxPointSize), - - CAPSVALDEF("MaxPrimitiveCount", MaxPrimitiveCount), - CAPSVALDEF("MaxVertexIndex", MaxVertexIndex), - CAPSVALDEF("MaxStreams", MaxStreams), - CAPSVALDEF("MaxStreamStride", MaxStreamStride), - - CAPSSHADERDEF("VertexShaderVersion", VertexShaderVersion), - CAPSVALDEF("MaxVertexShaderConst", MaxVertexShaderConst), - - CAPSSHADERDEF("PixelShaderVersion", PixelShaderVersion), - CAPSFLOATDEF("PixelShader1xMaxValue", PixelShader1xMaxValue), - - CAPSFLOATDEF("MaxNpatchTessellationLevel", MaxNpatchTessellationLevel), - - CAPSVALDEF("MasterAdapterOrdinal", MasterAdapterOrdinal), - CAPSVALDEF("AdapterOrdinalInGroup", AdapterOrdinalInGroup), - CAPSVALDEF("NumberOfAdaptersInGroup", NumberOfAdaptersInGroup), - CAPSVALDEF("NumSimultaneousRTs", NumSimultaneousRTs), - CAPSVALDEF("MaxVShaderInstructionsExecuted", MaxVShaderInstructionsExecuted), - CAPSVALDEF("MaxPShaderInstructionsExecuted", MaxPShaderInstructionsExecuted), - CAPSVALDEF("MaxVertexShader30InstructionSlots", MaxVertexShader30InstructionSlots), - CAPSVALDEF("MaxPixelShader30InstructionSlots", MaxPixelShader30InstructionSlots), - - { NULL, 0, 0 } -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsCaps[] = -{ - CAPSFLAGDEF("D3DCAPS_READ_SCANLINE", Caps, D3DCAPS_READ_SCANLINE), - CAPSFLAGDEFex("D3DCAPS_OVERLAY", Caps, D3DCAPS_OVERLAY), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsCaps2[] = -{ - CAPSFLAGDEF("D3DCAPS2_CANCALIBRATEGAMMA", Caps2, D3DCAPS2_CANCALIBRATEGAMMA), - CAPSFLAGDEF("D3DCAPS2_FULLSCREENGAMMA", Caps2, D3DCAPS2_FULLSCREENGAMMA), - CAPSFLAGDEF("D3DCAPS2_CANMANAGERESOURCE", Caps2, D3DCAPS2_CANMANAGERESOURCE), - CAPSFLAGDEF("D3DCAPS2_DYNAMICTEXTURES", Caps2, D3DCAPS2_DYNAMICTEXTURES), - CAPSFLAGDEF("D3DCAPS2_CANAUTOGENMIPMAP", Caps2, D3DCAPS2_CANAUTOGENMIPMAP), - CAPSFLAGDEFex("D3DCAPS2_CANSHARERESOURCE", Caps2, D3DCAPS2_CANSHARERESOURCE), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsCaps3[] = -{ - CAPSFLAGDEF("D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD", Caps3, D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD), - CAPSFLAGDEF("D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION", Caps3, D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION), - CAPSFLAGDEF("D3DCAPS3_COPY_TO_VIDMEM", Caps3, D3DCAPS3_COPY_TO_VIDMEM), - CAPSFLAGDEF("D3DCAPS3_COPY_TO_SYSTEMMEM", Caps3, D3DCAPS3_COPY_TO_SYSTEMMEM), - CAPSFLAGDEFex("D3DCAPS3_DXVAHD", Caps3, D3DCAPS3_DXVAHD), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsPresentationIntervals[] = -{ - CAPSFLAGDEF("D3DPRESENT_INTERVAL_ONE", PresentationIntervals, D3DPRESENT_INTERVAL_ONE), - CAPSFLAGDEF("D3DPRESENT_INTERVAL_TWO", PresentationIntervals, D3DPRESENT_INTERVAL_TWO), - CAPSFLAGDEF("D3DPRESENT_INTERVAL_THREE", PresentationIntervals, D3DPRESENT_INTERVAL_THREE), - CAPSFLAGDEF("D3DPRESENT_INTERVAL_FOUR", PresentationIntervals, D3DPRESENT_INTERVAL_FOUR), - CAPSFLAGDEF("D3DPRESENT_INTERVAL_IMMEDIATE", PresentationIntervals, D3DPRESENT_INTERVAL_IMMEDIATE), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsCursorCaps[] = -{ - CAPSFLAGDEF("D3DCURSORCAPS_COLOR", CursorCaps, D3DCURSORCAPS_COLOR), - CAPSFLAGDEF("D3DCURSORCAPS_LOWRES", CursorCaps, D3DCURSORCAPS_LOWRES), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsDevCaps[] = -{ - CAPSFLAGDEF("D3DDEVCAPS_EXECUTESYSTEMMEMORY", DevCaps, D3DDEVCAPS_EXECUTESYSTEMMEMORY), - CAPSFLAGDEF("D3DDEVCAPS_EXECUTEVIDEOMEMORY", DevCaps, D3DDEVCAPS_EXECUTEVIDEOMEMORY), - CAPSFLAGDEF("D3DDEVCAPS_TLVERTEXSYSTEMMEMORY", DevCaps, D3DDEVCAPS_TLVERTEXSYSTEMMEMORY), - CAPSFLAGDEF("D3DDEVCAPS_TLVERTEXVIDEOMEMORY", DevCaps, D3DDEVCAPS_TLVERTEXVIDEOMEMORY), - CAPSFLAGDEF("D3DDEVCAPS_TEXTURESYSTEMMEMORY", DevCaps, D3DDEVCAPS_TEXTURESYSTEMMEMORY), - CAPSFLAGDEF("D3DDEVCAPS_TEXTUREVIDEOMEMORY", DevCaps, D3DDEVCAPS_TEXTUREVIDEOMEMORY), - CAPSFLAGDEF("D3DDEVCAPS_DRAWPRIMTLVERTEX", DevCaps, D3DDEVCAPS_DRAWPRIMTLVERTEX), - CAPSFLAGDEF("D3DDEVCAPS_CANRENDERAFTERFLIP", DevCaps, D3DDEVCAPS_CANRENDERAFTERFLIP), - CAPSFLAGDEF("D3DDEVCAPS_TEXTURENONLOCALVIDMEM", DevCaps, D3DDEVCAPS_TEXTURENONLOCALVIDMEM), - CAPSFLAGDEF("D3DDEVCAPS_DRAWPRIMITIVES2", DevCaps, D3DDEVCAPS_DRAWPRIMITIVES2), - CAPSFLAGDEF("D3DDEVCAPS_SEPARATETEXTUREMEMORIES", DevCaps, D3DDEVCAPS_SEPARATETEXTUREMEMORIES), - CAPSFLAGDEF("D3DDEVCAPS_DRAWPRIMITIVES2EX", DevCaps, D3DDEVCAPS_DRAWPRIMITIVES2EX), - CAPSFLAGDEF("D3DDEVCAPS_HWTRANSFORMANDLIGHT", DevCaps, D3DDEVCAPS_HWTRANSFORMANDLIGHT), - CAPSFLAGDEF("D3DDEVCAPS_CANBLTSYSTONONLOCAL", DevCaps, D3DDEVCAPS_CANBLTSYSTONONLOCAL), - CAPSFLAGDEF("D3DDEVCAPS_HWRASTERIZATION", DevCaps, D3DDEVCAPS_HWRASTERIZATION), - CAPSFLAGDEF("D3DDEVCAPS_PUREDEVICE", DevCaps, D3DDEVCAPS_PUREDEVICE), - CAPSFLAGDEF("D3DDEVCAPS_QUINTICRTPATCHES", DevCaps, D3DDEVCAPS_QUINTICRTPATCHES), - CAPSFLAGDEF("D3DDEVCAPS_RTPATCHES", DevCaps, D3DDEVCAPS_RTPATCHES), - CAPSFLAGDEF("D3DDEVCAPS_RTPATCHHANDLEZERO", DevCaps, D3DDEVCAPS_RTPATCHHANDLEZERO), - CAPSFLAGDEF("D3DDEVCAPS_NPATCHES", DevCaps, D3DDEVCAPS_NPATCHES), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsLineCaps[] = -{ - CAPSFLAGDEF("D3DLINECAPS_TEXTURE", LineCaps, D3DLINECAPS_TEXTURE ), - CAPSFLAGDEF("D3DLINECAPS_ZTEST", LineCaps, D3DLINECAPS_ZTEST ), - CAPSFLAGDEF("D3DLINECAPS_BLEND", LineCaps, D3DLINECAPS_BLEND ), - CAPSFLAGDEF("D3DLINECAPS_ALPHACMP", LineCaps, D3DLINECAPS_ALPHACMP), - CAPSFLAGDEF("D3DLINECAPS_FOG", LineCaps, D3DLINECAPS_FOG ), - CAPSFLAGDEF("D3DLINECAPS_ANTIALIAS", LineCaps, D3DLINECAPS_ANTIALIAS), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsStencilCaps[] = -{ - CAPSFLAGDEF("D3DSTENCILCAPS_KEEP", StencilCaps, D3DSTENCILCAPS_KEEP), - CAPSFLAGDEF("D3DSTENCILCAPS_ZERO", StencilCaps, D3DSTENCILCAPS_ZERO), - CAPSFLAGDEF("D3DSTENCILCAPS_REPLACE", StencilCaps, D3DSTENCILCAPS_REPLACE), - CAPSFLAGDEF("D3DSTENCILCAPS_INCRSAT", StencilCaps, D3DSTENCILCAPS_INCRSAT), - CAPSFLAGDEF("D3DSTENCILCAPS_DECRSAT", StencilCaps, D3DSTENCILCAPS_DECRSAT), - CAPSFLAGDEF("D3DSTENCILCAPS_INVERT", StencilCaps, D3DSTENCILCAPS_INVERT), - CAPSFLAGDEF("D3DSTENCILCAPS_INCR", StencilCaps, D3DSTENCILCAPS_INCR), - CAPSFLAGDEF("D3DSTENCILCAPS_DECR", StencilCaps, D3DSTENCILCAPS_DECR), - CAPSFLAGDEF("D3DSTENCILCAPS_TWOSIDED", StencilCaps, D3DSTENCILCAPS_TWOSIDED), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsFVFCaps[] = -{ - CAPSFLAGDEF("D3DFVFCAPS_DONOTSTRIPELEMENTS", FVFCaps, D3DFVFCAPS_DONOTSTRIPELEMENTS), - CAPSMASK16DEF("D3DFVFCAPS_TEXCOORDCOUNTMASK", FVFCaps), - CAPSFLAGDEF("D3DFVFCAPS_PSIZE", FVFCaps, D3DFVFCAPS_PSIZE), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsTextureOpCaps[] = -{ - CAPSFLAGDEF("D3DTEXOPCAPS_DISABLE", TextureOpCaps, D3DTEXOPCAPS_DISABLE ), - CAPSFLAGDEF("D3DTEXOPCAPS_SELECTARG1", TextureOpCaps, D3DTEXOPCAPS_SELECTARG1 ), - CAPSFLAGDEF("D3DTEXOPCAPS_SELECTARG2", TextureOpCaps, D3DTEXOPCAPS_SELECTARG2 ), - CAPSFLAGDEF("D3DTEXOPCAPS_MODULATE", TextureOpCaps, D3DTEXOPCAPS_MODULATE ), - CAPSFLAGDEF("D3DTEXOPCAPS_MODULATE2X", TextureOpCaps, D3DTEXOPCAPS_MODULATE2X ), - CAPSFLAGDEF("D3DTEXOPCAPS_MODULATE4X", TextureOpCaps, D3DTEXOPCAPS_MODULATE4X ), - CAPSFLAGDEF("D3DTEXOPCAPS_ADD", TextureOpCaps, D3DTEXOPCAPS_ADD ), - CAPSFLAGDEF("D3DTEXOPCAPS_ADDSIGNED", TextureOpCaps, D3DTEXOPCAPS_ADDSIGNED ), - CAPSFLAGDEF("D3DTEXOPCAPS_ADDSIGNED2X", TextureOpCaps, D3DTEXOPCAPS_ADDSIGNED2X ), - CAPSFLAGDEF("D3DTEXOPCAPS_SUBTRACT", TextureOpCaps, D3DTEXOPCAPS_SUBTRACT ), - CAPSFLAGDEF("D3DTEXOPCAPS_ADDSMOOTH", TextureOpCaps, D3DTEXOPCAPS_ADDSMOOTH ), - CAPSFLAGDEF("D3DTEXOPCAPS_BLENDDIFFUSEALPHA", TextureOpCaps, D3DTEXOPCAPS_BLENDDIFFUSEALPHA ), - CAPSFLAGDEF("D3DTEXOPCAPS_BLENDTEXTUREALPHA", TextureOpCaps, D3DTEXOPCAPS_BLENDTEXTUREALPHA ), - CAPSFLAGDEF("D3DTEXOPCAPS_BLENDFACTORALPHA", TextureOpCaps, D3DTEXOPCAPS_BLENDFACTORALPHA ), - CAPSFLAGDEF("D3DTEXOPCAPS_BLENDTEXTUREALPHAPM", TextureOpCaps, D3DTEXOPCAPS_BLENDTEXTUREALPHAPM ), - CAPSFLAGDEF("D3DTEXOPCAPS_BLENDCURRENTALPHA", TextureOpCaps, D3DTEXOPCAPS_BLENDCURRENTALPHA ), - CAPSFLAGDEF("D3DTEXOPCAPS_PREMODULATE", TextureOpCaps, D3DTEXOPCAPS_PREMODULATE ), - CAPSFLAGDEF("D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR", TextureOpCaps, D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR ), - CAPSFLAGDEF("D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA", TextureOpCaps, D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA ), - CAPSFLAGDEF("D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR", TextureOpCaps, D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR ), - CAPSFLAGDEF("D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA", TextureOpCaps, D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA ), - CAPSFLAGDEF("D3DTEXOPCAPS_BUMPENVMAP", TextureOpCaps, D3DTEXOPCAPS_BUMPENVMAP ), - CAPSFLAGDEF("D3DTEXOPCAPS_BUMPENVMAPLUMINANCE", TextureOpCaps, D3DTEXOPCAPS_BUMPENVMAPLUMINANCE ), - CAPSFLAGDEF("D3DTEXOPCAPS_DOTPRODUCT3", TextureOpCaps, D3DTEXOPCAPS_DOTPRODUCT3 ), - CAPSFLAGDEF("D3DTEXOPCAPS_MULTIPLYADD", TextureOpCaps, D3DTEXOPCAPS_MULTIPLYADD ), - CAPSFLAGDEF("D3DTEXOPCAPS_LERP", TextureOpCaps, D3DTEXOPCAPS_LERP ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsVertexProcessingCaps[] = -{ - CAPSFLAGDEF("D3DVTXPCAPS_DIRECTIONALLIGHTS", VertexProcessingCaps, D3DVTXPCAPS_DIRECTIONALLIGHTS), - CAPSFLAGDEF("D3DVTXPCAPS_LOCALVIEWER", VertexProcessingCaps, D3DVTXPCAPS_LOCALVIEWER), - CAPSFLAGDEF("D3DVTXPCAPS_MATERIALSOURCE7", VertexProcessingCaps, D3DVTXPCAPS_MATERIALSOURCE7), - CAPSFLAGDEF("D3DVTXPCAPS_POSITIONALLIGHTS", VertexProcessingCaps, D3DVTXPCAPS_POSITIONALLIGHTS), - CAPSFLAGDEF("D3DVTXPCAPS_TEXGEN", VertexProcessingCaps, D3DVTXPCAPS_TEXGEN), - CAPSFLAGDEF("D3DVTXPCAPS_TWEENING", VertexProcessingCaps, D3DVTXPCAPS_TWEENING), - CAPSFLAGDEF("D3DVTXPCAPS_TEXGEN_SPHEREMAP", VertexProcessingCaps, D3DVTXPCAPS_TEXGEN_SPHEREMAP), - CAPSFLAGDEF("D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER", VertexProcessingCaps, D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF PrimCaps[] = -{ - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsPrimMiscCaps[] = -{ - CAPSFLAGDEF("D3DPMISCCAPS_MASKZ", PrimitiveMiscCaps, D3DPMISCCAPS_MASKZ), - CAPSFLAGDEF("D3DPMISCCAPS_CULLNONE", PrimitiveMiscCaps, D3DPMISCCAPS_CULLNONE), - CAPSFLAGDEF("D3DPMISCCAPS_CULLCW", PrimitiveMiscCaps, D3DPMISCCAPS_CULLCW), - CAPSFLAGDEF("D3DPMISCCAPS_CULLCCW", PrimitiveMiscCaps, D3DPMISCCAPS_CULLCCW), - CAPSFLAGDEF("D3DPMISCCAPS_COLORWRITEENABLE", PrimitiveMiscCaps, D3DPMISCCAPS_COLORWRITEENABLE), - CAPSFLAGDEF("D3DPMISCCAPS_CLIPPLANESCALEDPOINTS", PrimitiveMiscCaps, D3DPMISCCAPS_CLIPPLANESCALEDPOINTS), - CAPSFLAGDEF("D3DPMISCCAPS_CLIPTLVERTS", PrimitiveMiscCaps, D3DPMISCCAPS_CLIPTLVERTS), - CAPSFLAGDEF("D3DPMISCCAPS_TSSARGTEMP", PrimitiveMiscCaps, D3DPMISCCAPS_TSSARGTEMP), - CAPSFLAGDEF("D3DPMISCCAPS_BLENDOP", PrimitiveMiscCaps, D3DPMISCCAPS_BLENDOP), - CAPSFLAGDEF("D3DPMISCCAPS_NULLREFERENCE", PrimitiveMiscCaps, D3DPMISCCAPS_NULLREFERENCE), - CAPSFLAGDEF("D3DPMISCCAPS_INDEPENDENTWRITEMASKS", PrimitiveMiscCaps, D3DPMISCCAPS_INDEPENDENTWRITEMASKS), - CAPSFLAGDEF("D3DPMISCCAPS_PERSTAGECONSTANT", PrimitiveMiscCaps, D3DPMISCCAPS_PERSTAGECONSTANT), - CAPSFLAGDEF("D3DPMISCCAPS_FOGANDSPECULARALPHA", PrimitiveMiscCaps, D3DPMISCCAPS_FOGANDSPECULARALPHA), - CAPSFLAGDEF("D3DPMISCCAPS_SEPARATEALPHABLEND", PrimitiveMiscCaps, D3DPMISCCAPS_SEPARATEALPHABLEND), - CAPSFLAGDEF("D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS", PrimitiveMiscCaps, D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS), - CAPSFLAGDEF("D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING", PrimitiveMiscCaps, D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING), - CAPSFLAGDEF("D3DPMISCCAPS_FOGVERTEXCLAMPED", PrimitiveMiscCaps, D3DPMISCCAPS_FOGVERTEXCLAMPED), - CAPSFLAGDEFex("D3DPMISCCAPS_POSTBLENDSRGBCONVERT", PrimitiveMiscCaps, D3DPMISCCAPS_POSTBLENDSRGBCONVERT), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsRasterCaps[] = -{ - CAPSFLAGDEF("D3DPRASTERCAPS_DITHER", RasterCaps, D3DPRASTERCAPS_DITHER), - CAPSFLAGDEF("D3DPRASTERCAPS_ZTEST", RasterCaps, D3DPRASTERCAPS_ZTEST), - CAPSFLAGDEF("D3DPRASTERCAPS_FOGVERTEX", RasterCaps, D3DPRASTERCAPS_FOGVERTEX), - CAPSFLAGDEF("D3DPRASTERCAPS_FOGTABLE", RasterCaps, D3DPRASTERCAPS_FOGTABLE), -// CAPSFLAGDEF("D3DPRASTERCAPS_ANTIALIASEDGES", RasterCaps, D3DPRASTERCAPS_ANTIALIASEDGES), - CAPSFLAGDEF("D3DPRASTERCAPS_MIPMAPLODBIAS", RasterCaps, D3DPRASTERCAPS_MIPMAPLODBIAS), -// CAPSFLAGDEF("D3DPRASTERCAPS_ZBIAS", RasterCaps, D3DPRASTERCAPS_ZBIAS), - CAPSFLAGDEF("D3DPRASTERCAPS_ZBUFFERLESSHSR", RasterCaps, D3DPRASTERCAPS_ZBUFFERLESSHSR), - CAPSFLAGDEF("D3DPRASTERCAPS_FOGRANGE", RasterCaps, D3DPRASTERCAPS_FOGRANGE), - CAPSFLAGDEF("D3DPRASTERCAPS_ANISOTROPY", RasterCaps, D3DPRASTERCAPS_ANISOTROPY), - CAPSFLAGDEF("D3DPRASTERCAPS_WBUFFER", RasterCaps, D3DPRASTERCAPS_WBUFFER), - CAPSFLAGDEF("D3DPRASTERCAPS_WFOG", RasterCaps, D3DPRASTERCAPS_WFOG), - CAPSFLAGDEF("D3DPRASTERCAPS_ZFOG", RasterCaps, D3DPRASTERCAPS_ZFOG), - CAPSFLAGDEF("D3DPRASTERCAPS_COLORPERSPECTIVE", RasterCaps, D3DPRASTERCAPS_COLORPERSPECTIVE), -// CAPSFLAGDEF("D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE", RasterCaps, D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE), - CAPSFLAGDEF("D3DPRASTERCAPS_SCISSORTEST", RasterCaps, D3DPRASTERCAPS_SCISSORTEST), - CAPSFLAGDEF("D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS", RasterCaps, D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS), - CAPSFLAGDEF("D3DPRASTERCAPS_DEPTHBIAS", RasterCaps, D3DPRASTERCAPS_DEPTHBIAS), - CAPSFLAGDEF("D3DPRASTERCAPS_MULTISAMPLE_TOGGLE",RasterCaps, D3DPRASTERCAPS_MULTISAMPLE_TOGGLE), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsZCmpCaps[] = -{ - CAPSFLAGDEF("D3DPCMPCAPS_NEVER", ZCmpCaps, D3DPCMPCAPS_NEVER ), - CAPSFLAGDEF("D3DPCMPCAPS_LESS", ZCmpCaps, D3DPCMPCAPS_LESS ), - CAPSFLAGDEF("D3DPCMPCAPS_EQUAL", ZCmpCaps, D3DPCMPCAPS_EQUAL ), - CAPSFLAGDEF("D3DPCMPCAPS_LESSEQUAL", ZCmpCaps, D3DPCMPCAPS_LESSEQUAL ), - CAPSFLAGDEF("D3DPCMPCAPS_GREATER", ZCmpCaps, D3DPCMPCAPS_GREATER ), - CAPSFLAGDEF("D3DPCMPCAPS_NOTEQUAL", ZCmpCaps, D3DPCMPCAPS_NOTEQUAL ), - CAPSFLAGDEF("D3DPCMPCAPS_GREATEREQUAL", ZCmpCaps, D3DPCMPCAPS_GREATEREQUAL ), - CAPSFLAGDEF("D3DPCMPCAPS_ALWAYS", ZCmpCaps, D3DPCMPCAPS_ALWAYS ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsSrcBlendCaps[] = -{ - CAPSFLAGDEF("D3DPBLENDCAPS_ZERO", SrcBlendCaps, D3DPBLENDCAPS_ZERO ), - CAPSFLAGDEF("D3DPBLENDCAPS_ONE", SrcBlendCaps, D3DPBLENDCAPS_ONE ), - CAPSFLAGDEF("D3DPBLENDCAPS_SRCCOLOR", SrcBlendCaps, D3DPBLENDCAPS_SRCCOLOR ), - CAPSFLAGDEF("D3DPBLENDCAPS_INVSRCCOLOR", SrcBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR ), - CAPSFLAGDEF("D3DPBLENDCAPS_SRCALPHA", SrcBlendCaps, D3DPBLENDCAPS_SRCALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_INVSRCALPHA", SrcBlendCaps, D3DPBLENDCAPS_INVSRCALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_DESTALPHA", SrcBlendCaps, D3DPBLENDCAPS_DESTALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_INVDESTALPHA", SrcBlendCaps, D3DPBLENDCAPS_INVDESTALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_DESTCOLOR", SrcBlendCaps, D3DPBLENDCAPS_DESTCOLOR ), - CAPSFLAGDEF("D3DPBLENDCAPS_INVDESTCOLOR", SrcBlendCaps, D3DPBLENDCAPS_INVDESTCOLOR ), - CAPSFLAGDEF("D3DPBLENDCAPS_SRCALPHASAT", SrcBlendCaps, D3DPBLENDCAPS_SRCALPHASAT ), - CAPSFLAGDEF("D3DPBLENDCAPS_BOTHSRCALPHA", SrcBlendCaps, D3DPBLENDCAPS_BOTHSRCALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_BOTHINVSRCALPHA", SrcBlendCaps, D3DPBLENDCAPS_BOTHINVSRCALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_BLENDFACTOR", SrcBlendCaps, D3DPBLENDCAPS_BLENDFACTOR ), - CAPSFLAGDEFex("D3DPBLENDCAPS_SRCCOLOR2", SrcBlendCaps, D3DPBLENDCAPS_SRCCOLOR2 ), - CAPSFLAGDEFex("D3DPBLENDCAPS_INVSRCCOLOR2", SrcBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR2 ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsDestBlendCaps[] = -{ - CAPSFLAGDEF("D3DPBLENDCAPS_ZERO", DestBlendCaps, D3DPBLENDCAPS_ZERO ), - CAPSFLAGDEF("D3DPBLENDCAPS_ONE", DestBlendCaps, D3DPBLENDCAPS_ONE ), - CAPSFLAGDEF("D3DPBLENDCAPS_SRCCOLOR", DestBlendCaps, D3DPBLENDCAPS_SRCCOLOR ), - CAPSFLAGDEF("D3DPBLENDCAPS_INVSRCCOLOR", DestBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR ), - CAPSFLAGDEF("D3DPBLENDCAPS_SRCALPHA", DestBlendCaps, D3DPBLENDCAPS_SRCALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_INVSRCALPHA", DestBlendCaps, D3DPBLENDCAPS_INVSRCALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_DESTALPHA", DestBlendCaps, D3DPBLENDCAPS_DESTALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_INVDESTALPHA", DestBlendCaps, D3DPBLENDCAPS_INVDESTALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_DESTCOLOR", DestBlendCaps, D3DPBLENDCAPS_DESTCOLOR ), - CAPSFLAGDEF("D3DPBLENDCAPS_INVDESTCOLOR", DestBlendCaps, D3DPBLENDCAPS_INVDESTCOLOR ), - CAPSFLAGDEF("D3DPBLENDCAPS_SRCALPHASAT", DestBlendCaps, D3DPBLENDCAPS_SRCALPHASAT ), - CAPSFLAGDEF("D3DPBLENDCAPS_BOTHSRCALPHA", DestBlendCaps, D3DPBLENDCAPS_BOTHSRCALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_BOTHINVSRCALPHA", DestBlendCaps, D3DPBLENDCAPS_BOTHINVSRCALPHA ), - CAPSFLAGDEF("D3DPBLENDCAPS_BLENDFACTOR", DestBlendCaps, D3DPBLENDCAPS_BLENDFACTOR ), - CAPSFLAGDEFex("D3DPBLENDCAPS_SRCCOLOR2", DestBlendCaps, D3DPBLENDCAPS_SRCCOLOR2 ), - CAPSFLAGDEFex("D3DPBLENDCAPS_INVSRCCOLOR2", DestBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR2 ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsAlphaCmpCaps[] = -{ - CAPSFLAGDEF("D3DPCMPCAPS_NEVER", AlphaCmpCaps, D3DPCMPCAPS_NEVER ), - CAPSFLAGDEF("D3DPCMPCAPS_LESS", AlphaCmpCaps, D3DPCMPCAPS_LESS ), - CAPSFLAGDEF("D3DPCMPCAPS_EQUAL", AlphaCmpCaps, D3DPCMPCAPS_EQUAL ), - CAPSFLAGDEF("D3DPCMPCAPS_LESSEQUAL", AlphaCmpCaps, D3DPCMPCAPS_LESSEQUAL ), - CAPSFLAGDEF("D3DPCMPCAPS_GREATER", AlphaCmpCaps, D3DPCMPCAPS_GREATER ), - CAPSFLAGDEF("D3DPCMPCAPS_NOTEQUAL", AlphaCmpCaps, D3DPCMPCAPS_NOTEQUAL ), - CAPSFLAGDEF("D3DPCMPCAPS_GREATEREQUAL", AlphaCmpCaps, D3DPCMPCAPS_GREATEREQUAL ), - CAPSFLAGDEF("D3DPCMPCAPS_ALWAYS", AlphaCmpCaps, D3DPCMPCAPS_ALWAYS ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsShadeCaps[] = -{ - CAPSFLAGDEF("D3DPSHADECAPS_COLORGOURAUDRGB", ShadeCaps, D3DPSHADECAPS_COLORGOURAUDRGB ), - CAPSFLAGDEF("D3DPSHADECAPS_SPECULARGOURAUDRGB", ShadeCaps, D3DPSHADECAPS_SPECULARGOURAUDRGB ), - CAPSFLAGDEF("D3DPSHADECAPS_ALPHAGOURAUDBLEND", ShadeCaps, D3DPSHADECAPS_ALPHAGOURAUDBLEND ), - CAPSFLAGDEF("D3DPSHADECAPS_FOGGOURAUD", ShadeCaps, D3DPSHADECAPS_FOGGOURAUD ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsTextureCaps[] = -{ - CAPSFLAGDEF("D3DPTEXTURECAPS_PERSPECTIVE", TextureCaps, D3DPTEXTURECAPS_PERSPECTIVE ), - CAPSFLAGDEF("D3DPTEXTURECAPS_POW2", TextureCaps, D3DPTEXTURECAPS_POW2 ), - CAPSFLAGDEF("D3DPTEXTURECAPS_ALPHA", TextureCaps, D3DPTEXTURECAPS_ALPHA ), - CAPSFLAGDEF("D3DPTEXTURECAPS_SQUAREONLY", TextureCaps, D3DPTEXTURECAPS_SQUAREONLY ), - CAPSFLAGDEF("D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE", TextureCaps, D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE), - CAPSFLAGDEF("D3DPTEXTURECAPS_ALPHAPALETTE", TextureCaps, D3DPTEXTURECAPS_ALPHAPALETTE ), - CAPSFLAGDEF("D3DPTEXTURECAPS_NONPOW2CONDITIONAL", TextureCaps, D3DPTEXTURECAPS_NONPOW2CONDITIONAL ), - CAPSFLAGDEF("D3DPTEXTURECAPS_PROJECTED", TextureCaps, D3DPTEXTURECAPS_PROJECTED ), - CAPSFLAGDEF("D3DPTEXTURECAPS_CUBEMAP", TextureCaps, D3DPTEXTURECAPS_CUBEMAP), - CAPSFLAGDEF("D3DPTEXTURECAPS_VOLUMEMAP", TextureCaps, D3DPTEXTURECAPS_VOLUMEMAP), - CAPSFLAGDEF("D3DPTEXTURECAPS_MIPMAP", TextureCaps, D3DPTEXTURECAPS_MIPMAP), - CAPSFLAGDEF("D3DPTEXTURECAPS_MIPVOLUMEMAP", TextureCaps, D3DPTEXTURECAPS_MIPVOLUMEMAP), - CAPSFLAGDEF("D3DPTEXTURECAPS_MIPCUBEMAP", TextureCaps, D3DPTEXTURECAPS_MIPCUBEMAP), - CAPSFLAGDEF("D3DPTEXTURECAPS_CUBEMAP_POW2", TextureCaps, D3DPTEXTURECAPS_CUBEMAP_POW2), - CAPSFLAGDEF("D3DPTEXTURECAPS_VOLUMEMAP_POW2", TextureCaps, D3DPTEXTURECAPS_VOLUMEMAP_POW2), - CAPSFLAGDEF("D3DPTEXTURECAPS_NOPROJECTEDBUMPENV", TextureCaps, D3DPTEXTURECAPS_NOPROJECTEDBUMPENV), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsTextureFilterCaps[] = -{ - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", TextureFilterCaps, D3DPTFILTERCAPS_MINFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", TextureFilterCaps, D3DPTFILTERCAPS_MINFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", TextureFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", TextureFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", TextureFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", TextureFilterCaps, D3DPTFILTERCAPS_MIPFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", TextureFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", TextureFilterCaps, D3DPTFILTERCAPS_MAGFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", TextureFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", TextureFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", TextureFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", TextureFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD ), - CAPSFLAGDEFex("D3DPTFILTERCAPS_CONVOLUTIONMONO", TextureFilterCaps, D3DPTFILTERCAPS_CONVOLUTIONMONO ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsCubeTextureFilterCaps[] = -{ - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", CubeTextureFilterCaps, D3DPTFILTERCAPS_MIPFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", CubeTextureFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsVolumeTextureFilterCaps[] = -{ - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MIPFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsStretchRectFilterCaps[] = -{ - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", StretchRectFilterCaps, D3DPTFILTERCAPS_MIPFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", StretchRectFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsTextureAddressCaps[] = -{ - CAPSFLAGDEF("D3DPTADDRESSCAPS_WRAP", TextureAddressCaps, D3DPTADDRESSCAPS_WRAP ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_MIRROR", TextureAddressCaps, D3DPTADDRESSCAPS_MIRROR ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_CLAMP", TextureAddressCaps, D3DPTADDRESSCAPS_CLAMP ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_BORDER", TextureAddressCaps, D3DPTADDRESSCAPS_BORDER ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_INDEPENDENTUV", TextureAddressCaps, D3DPTADDRESSCAPS_INDEPENDENTUV ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_MIRRORONCE", TextureAddressCaps, D3DPTADDRESSCAPS_MIRRORONCE ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsVolumeTextureAddressCaps[] = -{ - CAPSFLAGDEF("D3DPTADDRESSCAPS_WRAP", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_WRAP ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_MIRROR", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_MIRROR ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_CLAMP", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_CLAMP ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_BORDER", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_BORDER ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_INDEPENDENTUV", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_INDEPENDENTUV ), - CAPSFLAGDEF("D3DPTADDRESSCAPS_MIRRORONCE", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_MIRRORONCE ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsDevCaps2[] = -{ - CAPSFLAGDEF("D3DDEVCAPS2_STREAMOFFSET", DevCaps2, D3DDEVCAPS2_STREAMOFFSET ), - CAPSFLAGDEF("D3DDEVCAPS2_DMAPNPATCH", DevCaps2, D3DDEVCAPS2_DMAPNPATCH ), - CAPSFLAGDEF("D3DDEVCAPS2_ADAPTIVETESSRTPATCH", DevCaps2, D3DDEVCAPS2_ADAPTIVETESSRTPATCH ), - CAPSFLAGDEF("D3DDEVCAPS2_ADAPTIVETESSNPATCH", DevCaps2, D3DDEVCAPS2_ADAPTIVETESSNPATCH ), - CAPSFLAGDEF("D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES", DevCaps2, D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES ), - CAPSFLAGDEF("D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH", DevCaps2, D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH ), - CAPSFLAGDEF("D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET", DevCaps2, D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsDeclTypes[] = -{ - CAPSFLAGDEF("D3DDTCAPS_UBYTE4", DeclTypes, D3DDTCAPS_UBYTE4 ), - CAPSFLAGDEF("D3DDTCAPS_UBYTE4N", DeclTypes, D3DDTCAPS_UBYTE4N ), - CAPSFLAGDEF("D3DDTCAPS_SHORT2N", DeclTypes, D3DDTCAPS_SHORT2N ), - CAPSFLAGDEF("D3DDTCAPS_SHORT4N", DeclTypes, D3DDTCAPS_SHORT4N ), - CAPSFLAGDEF("D3DDTCAPS_USHORT2N", DeclTypes, D3DDTCAPS_USHORT2N ), - CAPSFLAGDEF("D3DDTCAPS_USHORT4N", DeclTypes, D3DDTCAPS_USHORT4N ), - CAPSFLAGDEF("D3DDTCAPS_UDEC3", DeclTypes, D3DDTCAPS_UDEC3 ), - CAPSFLAGDEF("D3DDTCAPS_DEC3N", DeclTypes, D3DDTCAPS_DEC3N ), - CAPSFLAGDEF("D3DDTCAPS_FLOAT16_2", DeclTypes, D3DDTCAPS_FLOAT16_2 ), - CAPSFLAGDEF("D3DDTCAPS_FLOAT16_4", DeclTypes, D3DDTCAPS_FLOAT16_4 ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsVS20Caps[] = -{ - CAPSFLAGDEF("D3DVS20CAPS_PREDICATION", VS20Caps.Caps, D3DVS20CAPS_PREDICATION ), - CAPSVALDEF("DynamicFlowControlDepth", VS20Caps.DynamicFlowControlDepth ), - CAPSVALDEF("NumTemps", VS20Caps.NumTemps ), - CAPSVALDEF("StaticFlowControlDepth", VS20Caps.StaticFlowControlDepth ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsPS20Caps[] = -{ - CAPSFLAGDEF("D3DPS20CAPS_ARBITRARYSWIZZLE", PS20Caps.Caps, D3DPS20CAPS_ARBITRARYSWIZZLE ), - CAPSFLAGDEF("D3DPS20CAPS_GRADIENTINSTRUCTIONS", PS20Caps.Caps, D3DPS20CAPS_GRADIENTINSTRUCTIONS ), - CAPSFLAGDEF("D3DPS20CAPS_PREDICATION", PS20Caps.Caps, D3DPS20CAPS_PREDICATION ), - CAPSFLAGDEF("D3DPS20CAPS_NODEPENDENTREADLIMIT", PS20Caps.Caps, D3DPS20CAPS_NODEPENDENTREADLIMIT ), - CAPSFLAGDEF("D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT", PS20Caps.Caps, D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT ), - CAPSVALDEF("DynamicFlowControlDepth", PS20Caps.DynamicFlowControlDepth ), - CAPSVALDEF("NumTemps", PS20Caps.NumTemps ), - CAPSVALDEF("StaticFlowControlDepth", PS20Caps.StaticFlowControlDepth ), - CAPSVALDEF("NumInstructionSlots", PS20Caps.NumInstructionSlots ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEF CapsVertexTextureFilterCaps[] = -{ - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", VertexTextureFilterCaps, D3DPTFILTERCAPS_MIPFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", VertexTextureFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFPOINT ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD ), - CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD ), - {"",0,0} -}; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -CAPDEFS DXGCapDefs[] = -{ - {"", NULL, (LPARAM)0, }, - {"+Caps", DXGDisplayCaps, (LPARAM)DXGGenCaps, }, - {"Caps", DXGDisplayCaps, (LPARAM)CapsCaps, }, - {"Caps2", DXGDisplayCaps, (LPARAM)CapsCaps2, }, - {"Caps3", DXGDisplayCaps, (LPARAM)CapsCaps3, }, - {"PresentationIntervals", DXGDisplayCaps, (LPARAM)CapsPresentationIntervals, }, - {"CursorCaps", DXGDisplayCaps, (LPARAM)CapsCursorCaps, }, - {"DevCaps", DXGDisplayCaps, (LPARAM)CapsDevCaps, }, - {"PrimitiveMiscCaps", DXGDisplayCaps, (LPARAM)CapsPrimMiscCaps }, - {"RasterCaps", DXGDisplayCaps, (LPARAM)CapsRasterCaps }, - {"ZCmpCaps", DXGDisplayCaps, (LPARAM)CapsZCmpCaps }, - {"SrcBlendCaps", DXGDisplayCaps, (LPARAM)CapsSrcBlendCaps }, - {"DestBlendCaps", DXGDisplayCaps, (LPARAM)CapsDestBlendCaps }, - {"AlphaCmpCaps", DXGDisplayCaps, (LPARAM)CapsAlphaCmpCaps }, - {"ShadeCaps", DXGDisplayCaps, (LPARAM)CapsShadeCaps }, - {"TextureCaps", DXGDisplayCaps, (LPARAM)CapsTextureCaps }, - - {"TextureFilterCaps", DXGDisplayCaps, (LPARAM)CapsTextureFilterCaps }, - {"CubeTextureFilterCaps", DXGDisplayCaps, (LPARAM)CapsCubeTextureFilterCaps }, - {"VolumeTextureFilterCaps", DXGDisplayCaps, (LPARAM)CapsVolumeTextureFilterCaps }, - {"TextureAddressCaps", DXGDisplayCaps, (LPARAM)CapsTextureAddressCaps }, - {"VolumeTextureAddressCaps", DXGDisplayCaps, (LPARAM)CapsVolumeTextureAddressCaps }, - - {"LineCaps", DXGDisplayCaps, (LPARAM)CapsLineCaps }, - {"StencilCaps", DXGDisplayCaps, (LPARAM)CapsStencilCaps, }, - {"FVFCaps", DXGDisplayCaps, (LPARAM)CapsFVFCaps, }, - {"TextureOpCaps", DXGDisplayCaps, (LPARAM)CapsTextureOpCaps, }, - {"VertexProcessingCaps", DXGDisplayCaps, (LPARAM)CapsVertexProcessingCaps, }, - {"DevCaps2", DXGDisplayCaps, (LPARAM)CapsDevCaps2, }, - {"DeclTypes", DXGDisplayCaps, (LPARAM)CapsDeclTypes, }, - {"StretchRectFilterCaps", DXGDisplayCaps, (LPARAM)CapsStretchRectFilterCaps, }, - {"VS20Caps", DXGDisplayCaps, (LPARAM)CapsVS20Caps, }, - {"PS20Caps", DXGDisplayCaps, (LPARAM)CapsPS20Caps, }, - {"VertexTextureFilterCaps",DXGDisplayCaps, (LPARAM)CapsVertexTextureFilterCaps, }, - - {"-", NULL, (LPARAM)0, }, - { NULL, 0, 0 } -}; - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -TCHAR* FormatName(D3DFORMAT format) -{ - switch(format) + // NOTE: Remember to update FormatName() when you update this list!! + D3DFORMAT AllFormatArray[] = { - case D3DFMT_UNKNOWN: return TEXT("D3DFMT_UNKNOWN"); - case D3DFMT_R8G8B8: return TEXT("D3DFMT_R8G8B8"); - case D3DFMT_A8R8G8B8: return TEXT("D3DFMT_A8R8G8B8"); - case D3DFMT_X8R8G8B8: return TEXT("D3DFMT_X8R8G8B8"); - case D3DFMT_R5G6B5: return TEXT("D3DFMT_R5G6B5"); - case D3DFMT_X1R5G5B5: return TEXT("D3DFMT_X1R5G5B5"); - case D3DFMT_A1R5G5B5: return TEXT("D3DFMT_A1R5G5B5"); - case D3DFMT_A4R4G4B4: return TEXT("D3DFMT_A4R4G4B4"); - case D3DFMT_R3G3B2: return TEXT("D3DFMT_R3G3B2"); - case D3DFMT_A8: return TEXT("D3DFMT_A8"); - case D3DFMT_A8R3G3B2: return TEXT("D3DFMT_A8R3G3B2"); - case D3DFMT_X4R4G4B4: return TEXT("D3DFMT_X4R4G4B4"); - case D3DFMT_A2B10G10R10: return TEXT("D3DFMT_A2B10G10R10"); - case D3DFMT_A8B8G8R8: return TEXT("D3DFMT_A8B8G8R8"); - case D3DFMT_X8B8G8R8: return TEXT("D3DFMT_X8B8G8R8"); - case D3DFMT_G16R16: return TEXT("D3DFMT_G16R16"); - case D3DFMT_A2R10G10B10: return TEXT("D3DFMT_A2R10G10B10"); - case D3DFMT_A16B16G16R16: return TEXT("D3DFMT_A16B16G16R16"); - - case D3DFMT_A8P8: return TEXT("D3DFMT_A8P8"); - case D3DFMT_P8: return TEXT("D3DFMT_P8"); - - case D3DFMT_L8: return TEXT("D3DFMT_L8"); - case D3DFMT_A8L8: return TEXT("D3DFMT_A8L8"); - case D3DFMT_A4L4: return TEXT("D3DFMT_A4L4"); - - case D3DFMT_V8U8: return TEXT("D3DFMT_V8U8"); - case D3DFMT_L6V5U5: return TEXT("D3DFMT_L6V5U5"); - case D3DFMT_X8L8V8U8: return TEXT("D3DFMT_X8L8V8U8"); - case D3DFMT_Q8W8V8U8: return TEXT("D3DFMT_Q8W8V8U8"); - case D3DFMT_V16U16: return TEXT("D3DFMT_V16U16"); - case D3DFMT_A2W10V10U10: return TEXT("D3DFMT_A2W10V10U10"); - - case D3DFMT_UYVY: return TEXT("D3DFMT_UYVY"); - case D3DFMT_R8G8_B8G8: return TEXT("D3DFMT_R8G8_B8G8"); - case D3DFMT_YUY2: return TEXT("D3DFMT_YUY2"); - case D3DFMT_G8R8_G8B8: return TEXT("D3DFMT_G8R8_G8B8"); - case D3DFMT_DXT1: return TEXT("D3DFMT_DXT1"); - case D3DFMT_DXT2: return TEXT("D3DFMT_DXT2"); - case D3DFMT_DXT3: return TEXT("D3DFMT_DXT3"); - case D3DFMT_DXT4: return TEXT("D3DFMT_DXT4"); - case D3DFMT_DXT5: return TEXT("D3DFMT_DXT5"); - - case D3DFMT_D16_LOCKABLE: return TEXT("D3DFMT_D16_LOCKABLE"); - case D3DFMT_D32: return TEXT("D3DFMT_D32"); - case D3DFMT_D15S1: return TEXT("D3DFMT_D15S1"); - case D3DFMT_D24S8: return TEXT("D3DFMT_D24S8"); - case D3DFMT_D24X8: return TEXT("D3DFMT_D24X8"); - case D3DFMT_D24X4S4: return TEXT("D3DFMT_D24X4S4"); - case D3DFMT_D16: return TEXT("D3DFMT_D16"); - case D3DFMT_D32F_LOCKABLE: return TEXT("D3DFMT_D32F_LOCKABLE"); - case D3DFMT_D24FS8: return TEXT("D3DFMT_D24FS8"); - - case D3DFMT_L16: return TEXT("D3DFMT_L16"); - - case D3DFMT_VERTEXDATA: return TEXT("D3DFMT_VERTEXDATA"); - case D3DFMT_INDEX16: return TEXT("D3DFMT_INDEX16"); - case D3DFMT_INDEX32: return TEXT("D3DFMT_INDEX32"); - - case D3DFMT_Q16W16V16U16: return TEXT("D3DFMT_Q16W16V16U16"); - - case D3DFMT_MULTI2_ARGB8: return TEXT("D3DFMT_MULTI2_ARGB8"); - - case D3DFMT_R16F: return TEXT("D3DFMT_R16F"); - case D3DFMT_G16R16F: return TEXT("D3DFMT_G16R16F"); - case D3DFMT_A16B16G16R16F: return TEXT("D3DFMT_A16B16G16R16F"); - - case D3DFMT_R32F: return TEXT("D3DFMT_R32F"); - case D3DFMT_G32R32F: return TEXT("D3DFMT_G32R32F"); - case D3DFMT_A32B32G32R32F: return TEXT("D3DFMT_A32B32G32R32F"); - - case D3DFMT_CxV8U8: return TEXT("D3DFMT_CxV8U8"); - - case D3DFMT_D32_LOCKABLE: return TEXT("D3DFMT_D32_LOCKABLE"); - case D3DFMT_S8_LOCKABLE: return TEXT("D3DFMT_S8_LOCKABLE"); - case D3DFMT_A1: return TEXT("D3DFMT_A1"); - - default: return TEXT("Unknown format"); - } -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -TCHAR* MultiSampleTypeName(D3DMULTISAMPLE_TYPE msType) -{ - switch(msType) - { - case D3DMULTISAMPLE_NONE: return TEXT("D3DMULTISAMPLE_NONE"); - case D3DMULTISAMPLE_NONMASKABLE: return TEXT("D3DMULTISAMPLE_NONMASKABLE"); - case D3DMULTISAMPLE_2_SAMPLES: return TEXT("D3DMULTISAMPLE_2_SAMPLES"); - case D3DMULTISAMPLE_3_SAMPLES: return TEXT("D3DMULTISAMPLE_3_SAMPLES"); - case D3DMULTISAMPLE_4_SAMPLES: return TEXT("D3DMULTISAMPLE_4_SAMPLES"); - case D3DMULTISAMPLE_5_SAMPLES: return TEXT("D3DMULTISAMPLE_5_SAMPLES"); - case D3DMULTISAMPLE_6_SAMPLES: return TEXT("D3DMULTISAMPLE_6_SAMPLES"); - case D3DMULTISAMPLE_7_SAMPLES: return TEXT("D3DMULTISAMPLE_7_SAMPLES"); - case D3DMULTISAMPLE_8_SAMPLES: return TEXT("D3DMULTISAMPLE_8_SAMPLES"); - case D3DMULTISAMPLE_9_SAMPLES: return TEXT("D3DMULTISAMPLE_9_SAMPLES"); - case D3DMULTISAMPLE_10_SAMPLES: return TEXT("D3DMULTISAMPLE_10_SAMPLES"); - case D3DMULTISAMPLE_11_SAMPLES: return TEXT("D3DMULTISAMPLE_11_SAMPLES"); - case D3DMULTISAMPLE_12_SAMPLES: return TEXT("D3DMULTISAMPLE_12_SAMPLES"); - case D3DMULTISAMPLE_13_SAMPLES: return TEXT("D3DMULTISAMPLE_13_SAMPLES"); - case D3DMULTISAMPLE_14_SAMPLES: return TEXT("D3DMULTISAMPLE_14_SAMPLES"); - case D3DMULTISAMPLE_15_SAMPLES: return TEXT("D3DMULTISAMPLE_15_SAMPLES"); - case D3DMULTISAMPLE_16_SAMPLES: return TEXT("D3DMULTISAMPLE_16_SAMPLES"); - default: return TEXT("Unknown type"); - } -} - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter -// lParam2 is not used -//----------------------------------------------------------------------------- -HRESULT DXGDisplayAdapterInfo( LPARAM lParam1, LPARAM lParam2, - PRINTCBINFO* pPrintInfo ) -{ - HRESULT hr; - UINT iAdapter = (UINT)lParam1; - D3DADAPTER_IDENTIFIER9 identifier; - GUID guid; - TCHAR szGuid[50]; - TCHAR szVersion[50]; - - if (g_pD3D == NULL) - return S_OK; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Name", 15); - LVAddColumn(g_hwndLV, 1, "Value", 40); - } - - if (FAILED(hr = g_pD3D->GetAdapterIdentifier(iAdapter, D3DENUM_WHQL_LEVEL, &identifier))) - return hr; - - guid = identifier.DeviceIdentifier; - sprintf_s(szGuid, sizeof(szGuid), TEXT("{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"), - guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], - guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); - - sprintf_s(szVersion, sizeof(szVersion), TEXT("0x%08X-%08X"), identifier.DriverVersion.HighPart, - identifier.DriverVersion.LowPart); - - if ( pPrintInfo == NULL) - { - LVAddText( g_hwndLV, 0, "Driver"); - LVAddText( g_hwndLV, 1, "%s", identifier.Driver); - - LVAddText( g_hwndLV, 0, "Description"); - LVAddText( g_hwndLV, 1, "%s", identifier.Description); - - LVAddText( g_hwndLV, 0, "DeviceName"); - LVAddText( g_hwndLV, 1, "%s", identifier.DeviceName); - - LVAddText( g_hwndLV, 0, "DriverVersion"); - LVAddText( g_hwndLV, 1, "%s", szVersion); - - LVAddText( g_hwndLV, 0, "VendorId"); - LVAddText( g_hwndLV, 1, "0x%08x", identifier.VendorId); - - LVAddText( g_hwndLV, 0, "DeviceId"); - LVAddText( g_hwndLV, 1, "0x%08x", identifier.DeviceId); - - LVAddText( g_hwndLV, 0, "SubSysId"); - LVAddText( g_hwndLV, 1, "0x%08x", identifier.SubSysId); - - LVAddText( g_hwndLV, 0, "Revision"); - LVAddText( g_hwndLV, 1, "%d", identifier.Revision); - - LVAddText( g_hwndLV, 0, "DeviceIdentifier"); - LVAddText( g_hwndLV, 1, szGuid); - - LVAddText( g_hwndLV, 0, "WHQLLevel"); - LVAddText( g_hwndLV, 1, "%d", identifier.WHQLLevel); - } - else - { - PrintStringValueLine( "Driver", identifier.Driver, pPrintInfo ); - PrintStringValueLine( "Description", identifier.Description, pPrintInfo ); - PrintStringValueLine( "DriverVersion", szVersion, pPrintInfo ); - PrintHexValueLine( "VendorId", identifier.VendorId, pPrintInfo ); - PrintHexValueLine( "DeviceId", identifier.DeviceId, pPrintInfo ); - PrintHexValueLine( "SubSysId", identifier.SubSysId, pPrintInfo ); - PrintValueLine( "Revision", identifier.Revision, pPrintInfo ); - PrintStringValueLine( "DeviceIdentifier", szGuid, pPrintInfo ); - PrintValueLine( "WHQLLevel", identifier.WHQLLevel, pPrintInfo ); - } - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter -// lParam2 is not used -//----------------------------------------------------------------------------- -HRESULT DXGDisplayModes( LPARAM lParam1, LPARAM lParam2, - PRINTCBINFO* pPrintInfo ) -{ - UINT iAdapter = (UINT)lParam1; - INT iFormat; - UINT iMode; - D3DFORMAT fmt; - D3DDISPLAYMODE mode; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Resolution", 10); - LVAddColumn(g_hwndLV, 1, "Pixel Format", 15); - LVAddColumn(g_hwndLV, 2, "Refresh Rate", 10); - } - - for (iFormat = 0; iFormat < NumAdapterFormats; iFormat++) - { - fmt = AdapterFormatArray[iFormat]; - UINT numModes = g_pD3D->GetAdapterModeCount(iAdapter, fmt); - for (iMode = 0; iMode < numModes; iMode++) - { - g_pD3D->EnumAdapterModes(iAdapter, fmt, iMode, &mode); - if (pPrintInfo == NULL) - { - LVAddText( g_hwndLV, 0, "%d x %d", mode.Width, mode.Height); - LVAddText( g_hwndLV, 1, FormatName(mode.Format)); - LVAddText( g_hwndLV, 2, "%d", mode.RefreshRate); - } - else - { - char szBuff[80]; - DWORD cchLen; - int x1, x2, x3, yLine; - - // Calculate Name and Value column x offsets - x1 = (pPrintInfo->dwCurrIndent * DEF_TAB_SIZE * pPrintInfo->dwCharWidth); - x2 = x1 + (20 * pPrintInfo->dwCharWidth); - x3 = x2 + (20 * pPrintInfo->dwCharWidth); - yLine = (pPrintInfo->dwCurrLine * pPrintInfo->dwLineHeight); - - sprintf_s (szBuff, sizeof(szBuff), "%d x %d", mode.Width, mode.Height); - cchLen = _tcslen (szBuff); - if( FAILED( PrintLine (x1, yLine, szBuff, cchLen, pPrintInfo) ) ) - return E_FAIL; - - strcpy_s (szBuff, sizeof(szBuff), FormatName(mode.Format)); - cchLen = _tcslen (szBuff); - if( FAILED( PrintLine (x2, yLine, szBuff, cchLen, pPrintInfo) ) ) - return E_FAIL; - - sprintf_s (szBuff, sizeof(szBuff), "%d", mode.RefreshRate); - cchLen = _tcslen (szBuff); - if( FAILED( PrintLine (x3, yLine, szBuff, cchLen, pPrintInfo) ) ) - return E_FAIL; - - // Advance to next line on page - if( FAILED( PrintNextLine(pPrintInfo) ) ) - return E_FAIL; - } - } - } - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the caps pointer -// lParam2 is the CAPDEF table we should use -//----------------------------------------------------------------------------- -HRESULT DXGDisplayCaps( LPARAM lParam1, LPARAM lParam2, - PRINTCBINFO* pPrintInfo ) -{ - D3DCAPS9* pCaps = (D3DCAPS9*)lParam1; - CAPDEF* pCapDef = (CAPDEF*)lParam2; - - if( pPrintInfo ) - return PrintCapsToDC( pCapDef, (VOID*)pCaps, pPrintInfo ); - else - AddCapsToLV(pCapDef, (LPVOID)pCaps); - - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter and device type -// lParam2 is bWindowed and the msType -// lParam3 is the render format -//----------------------------------------------------------------------------- -HRESULT DXGDisplayMultiSample( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - UINT iAdapter = LOWORD(lParam1); - D3DDEVTYPE devType = (D3DDEVTYPE)HIWORD(lParam1); - BOOL bWindowed = (BOOL)LOWORD(lParam2); - D3DMULTISAMPLE_TYPE msType = (D3DMULTISAMPLE_TYPE)HIWORD(lParam2); - D3DFORMAT fmt = (D3DFORMAT)lParam3; - DWORD dwNumQualityLevels; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Quality Levels", 30); - } - - if (SUCCEEDED(g_pD3D->CheckDeviceMultiSampleType(iAdapter, devType, fmt, bWindowed, msType, &dwNumQualityLevels))) - { - TCHAR str[100]; - if( dwNumQualityLevels == 1 ) - sprintf_s( str, sizeof(str), "%d quality level", dwNumQualityLevels); - else - sprintf_s( str, sizeof(str), "%d quality levels", dwNumQualityLevels); - if (pPrintInfo == NULL) - { - LVAddText( g_hwndLV, 0, str); - } - else - { - PrintStringLine(str, pPrintInfo); - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter and device type -// lParam2 is the adapter fmt -// lParam3 is bWindowed -//----------------------------------------------------------------------------- -HRESULT DXGDisplayBackBuffer( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - UINT iAdapter = LOWORD(lParam1); - D3DDEVTYPE devType = (D3DDEVTYPE)HIWORD(lParam1); - D3DFORMAT fmtAdapter = (D3DFORMAT)lParam2; - BOOL bWindowed = (BOOL)lParam3; - D3DFORMAT fmt; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Back Buffer Formats", 20); - } - - for (int iFmt = 0; iFmt < NumBBFormats; iFmt++) - { - fmt = BBFormatArray[iFmt]; - if (SUCCEEDED(g_pD3D->CheckDeviceType(iAdapter, devType, fmtAdapter, fmt, bWindowed))) - { - if (pPrintInfo == NULL) - { - LVAddText( g_hwndLV, 0, "%s", FormatName(fmt)); - } - else - { - PrintStringLine(FormatName(fmt), pPrintInfo); - } - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter and device type -// lParam2 is the adapter fmt -// lParam3 is unused -//----------------------------------------------------------------------------- -HRESULT DXGDisplayRenderTarget( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - UINT iAdapter = LOWORD(lParam1); - D3DDEVTYPE devType = (D3DDEVTYPE)HIWORD(lParam1); - D3DFORMAT fmtAdapter = (D3DFORMAT)lParam2; - D3DFORMAT fmt; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Render Target Formats", 20); - } - - for (int iFmt = 0; iFmt < NumFormats; iFmt++) - { - fmt = AllFormatArray[iFmt]; - if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, D3DUSAGE_RENDERTARGET, - D3DRTYPE_SURFACE, fmt))) - { - if (pPrintInfo == NULL) - { - LVAddText( g_hwndLV, 0, "%s", FormatName(fmt)); - } - else - { - PrintStringLine(FormatName(fmt), pPrintInfo); - } - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter and device type -// lParam2 is the adapter fmt -// lParam3 is unused -//----------------------------------------------------------------------------- -HRESULT DXGDisplayDepthStencil( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - UINT iAdapter = LOWORD(lParam1); - D3DDEVTYPE devType = (D3DDEVTYPE)HIWORD(lParam1); - D3DFORMAT fmtAdapter = (D3DFORMAT)lParam2; - D3DFORMAT fmt; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Depth/Stencil Formats", 20); - } - - for (int iFmt = 0; iFmt < NumDSFormats; iFmt++) - { - fmt = DSFormatArray[iFmt]; - - if (!g_is9Ex && ((fmt == D3DFMT_D32_LOCKABLE) || (fmt == D3DFMT_S8_LOCKABLE))) - continue; - - if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, D3DUSAGE_DEPTHSTENCIL, - D3DRTYPE_SURFACE, fmt))) - { - if (pPrintInfo == NULL) - { - LVAddText( g_hwndLV, 0, "%s", FormatName(fmt)); - } - else - { - PrintStringLine(FormatName(fmt), pPrintInfo); - } - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter and device type -// lParam2 is the depth/stencil fmt -// lParam3 is the msType -//----------------------------------------------------------------------------- -HRESULT DXGCheckDSQualityLevels( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - UINT iAdapter = LOWORD(lParam1); - D3DDEVTYPE devType = (D3DDEVTYPE)HIWORD(lParam1); - D3DFORMAT fmtDS = (D3DFORMAT)lParam2; - D3DMULTISAMPLE_TYPE msType = (D3DMULTISAMPLE_TYPE)lParam3; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Quality Levels", 20); - } - - DWORD dwNumQualityLevels; - if (SUCCEEDED(g_pD3D->CheckDeviceMultiSampleType(iAdapter, devType, fmtDS, FALSE, msType, &dwNumQualityLevels))) - { - TCHAR str[100]; - if( dwNumQualityLevels == 1 ) - sprintf_s( str, sizeof(str), "%d quality level", dwNumQualityLevels); - else - sprintf_s( str, sizeof(str), "%d quality levels", dwNumQualityLevels); - if (pPrintInfo == NULL) - { - LVAddText( g_hwndLV, 0, str); - } - else - { - PrintStringLine(str, pPrintInfo); - } - } - - return S_OK; -} - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter and device type -// lParam2 is the adapter fmt -// lParam3 is unused -//----------------------------------------------------------------------------- -HRESULT DXGDisplayPlainSurface( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - UINT iAdapter = LOWORD(lParam1); - D3DDEVTYPE devType = (D3DDEVTYPE)HIWORD(lParam1); - D3DFORMAT fmtAdapter = (D3DFORMAT)lParam2; - D3DFORMAT fmt; - - if( pPrintInfo == NULL ) - { - LVAddColumn(g_hwndLV, 0, "Plain Surface Formats", 20); - } - - for (int iFmt = 0; iFmt < NumFormats; iFmt++) - { - fmt = AllFormatArray[iFmt]; - - if (!g_is9Ex && ((fmt == D3DFMT_A1) || (fmt == D3DFMT_D32_LOCKABLE) || (fmt == D3DFMT_S8_LOCKABLE))) - continue; - - if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, 0, - D3DRTYPE_SURFACE, fmt))) - { - if (pPrintInfo == NULL) - { - LVAddText( g_hwndLV, 0, "%s", FormatName(fmt)); - } - else - { - PrintStringLine(FormatName(fmt), pPrintInfo); - } - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -// lParam1 is the iAdapter and device type -// lParam2 is the fmt of the swap chain -// lParam3 is the D3DRESOURCETYPE -//----------------------------------------------------------------------------- -HRESULT DXGDisplayResource( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - UINT iAdapter = LOWORD(lParam1); - D3DDEVTYPE devType = (D3DDEVTYPE)HIWORD(lParam1); - D3DFORMAT fmtAdapter = (D3DFORMAT)lParam2; - D3DRESOURCETYPE RType = (D3DRESOURCETYPE)lParam3; - D3DFORMAT fmt; - TCHAR* pstr; - HRESULT hr; - D3DCAPS9 Caps; - UINT col = 0; - - g_pD3D->GetDeviceCaps( iAdapter, devType, &Caps ); - - if( pPrintInfo == NULL ) - { - switch( RType ) - { - case D3DRTYPE_SURFACE: - LVAddColumn(g_hwndLV, col++, "Surface Formats", 20); - break; - case D3DRTYPE_VOLUME: - LVAddColumn(g_hwndLV, col++, "Volume Formats", 20); - break; - case D3DRTYPE_TEXTURE: - LVAddColumn(g_hwndLV, col++, "Texture Formats", 20); - break; - case D3DRTYPE_VOLUMETEXTURE: - LVAddColumn(g_hwndLV, col++, "Volume Texture Formats", 20); - break; - case D3DRTYPE_CUBETEXTURE: - LVAddColumn(g_hwndLV, col++, "Cube Texture Formats", 20); - break; - default: - return E_FAIL; - } - LVAddColumn(g_hwndLV, col++, "0 (Plain)", 22); - if( RType != D3DRTYPE_VOLUMETEXTURE ) - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_RENDERTARGET", 22); -// LVAddColumn(g_hwndLV, col++, "D3DUSAGE_DEPTHSTENCIL", 22); - if( RType != D3DRTYPE_SURFACE ) - { - if( RType != D3DRTYPE_VOLUMETEXTURE ) - { - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_AUTOGENMIPMAP", 22); - if( RType != D3DRTYPE_CUBETEXTURE ) - { - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_DMAP", 22); - } - } - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_LEGACYBUMPMAP", 22); - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_SRGBREAD", 18); - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_FILTER", 15); - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_SRGBWRITE", 18); - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING", 18); - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_VERTEXTEXTURE", 18); - LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_WRAPANDMIP", 18); - } - } - const DWORD usageArray[] = - { - 0, - D3DUSAGE_RENDERTARGET, -// D3DUSAGE_DEPTHSTENCIL, - D3DUSAGE_AUTOGENMIPMAP, - D3DUSAGE_DMAP, - D3DUSAGE_QUERY_LEGACYBUMPMAP, - D3DUSAGE_QUERY_SRGBREAD, - D3DUSAGE_QUERY_FILTER, - D3DUSAGE_QUERY_SRGBWRITE, - D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, - D3DUSAGE_QUERY_VERTEXTEXTURE, - D3DUSAGE_QUERY_WRAPANDMIP, + D3DFMT_R8G8B8, + D3DFMT_A8R8G8B8, + D3DFMT_X8R8G8B8, + D3DFMT_R5G6B5, + D3DFMT_X1R5G5B5, + D3DFMT_A1R5G5B5, + D3DFMT_A4R4G4B4, + D3DFMT_R3G3B2, + D3DFMT_A8, + D3DFMT_A8R3G3B2, + D3DFMT_X4R4G4B4, + D3DFMT_A2B10G10R10, + D3DFMT_A8B8G8R8, + D3DFMT_X8B8G8R8, + D3DFMT_G16R16, + D3DFMT_A2R10G10B10, + D3DFMT_A16B16G16R16, + + D3DFMT_A8P8, + D3DFMT_P8, + + D3DFMT_L8, + D3DFMT_A8L8, + D3DFMT_A4L4, + + D3DFMT_V8U8, + D3DFMT_L6V5U5, + D3DFMT_X8L8V8U8, + D3DFMT_Q8W8V8U8, + D3DFMT_V16U16, + D3DFMT_A2W10V10U10, + + D3DFMT_UYVY, + D3DFMT_R8G8_B8G8, + D3DFMT_YUY2, + D3DFMT_G8R8_G8B8, + D3DFMT_DXT1, + D3DFMT_DXT2, + D3DFMT_DXT3, + D3DFMT_DXT4, + D3DFMT_DXT5, + + D3DFMT_D16_LOCKABLE, + D3DFMT_D32, + D3DFMT_D15S1, + D3DFMT_D24S8, + D3DFMT_D24X8, + D3DFMT_D24X4S4, + D3DFMT_D16, + + D3DFMT_D32F_LOCKABLE, + D3DFMT_D24FS8, + + D3DFMT_L16, + + D3DFMT_VERTEXDATA, + D3DFMT_INDEX16, + D3DFMT_INDEX32, + + D3DFMT_Q16W16V16U16, + + D3DFMT_MULTI2_ARGB8, + + D3DFMT_R16F, + D3DFMT_G16R16F, + D3DFMT_A16B16G16R16F, + + D3DFMT_R32F, + D3DFMT_G32R32F, + D3DFMT_A32B32G32R32F, + + D3DFMT_CxV8U8, + + (D3DFORMAT)D3DFMT_D32_LOCKABLE, + (D3DFORMAT)D3DFMT_S8_LOCKABLE, + (D3DFORMAT)D3DFMT_A1, }; - const DWORD numUsages = sizeof(usageArray) / sizeof(usageArray[0]); - BOOL bFoundSuccess; - for (int iFmt = 0; iFmt < NumFormats; iFmt++) + const int NumFormats = sizeof(AllFormatArray) / sizeof(AllFormatArray[0]); + + // A subset of AllFormatArray...it's those D3DFMTs that could possibly be + // adapter (display) formats. + D3DFORMAT AdapterFormatArray[] = { - fmt = AllFormatArray[iFmt]; + D3DFMT_A2R10G10B10, + D3DFMT_X8R8G8B8, + D3DFMT_R8G8B8, + D3DFMT_X1R5G5B5, + D3DFMT_R5G6B5, + }; + const int NumAdapterFormats = sizeof(AdapterFormatArray) / sizeof(AdapterFormatArray[0]); - if (!g_is9Ex && ((fmt == D3DFMT_A1) || (fmt == D3DFMT_D32_LOCKABLE) || (fmt == D3DFMT_S8_LOCKABLE))) - continue; + // A subset of AllFormatArray...it's those D3DFMTs that could possibly be + // back buffer formats. + D3DFORMAT BBFormatArray[] = + { + D3DFMT_A2R10G10B10, + D3DFMT_A8R8G8B8, + D3DFMT_X8R8G8B8, + D3DFMT_A1R5G5B5, + D3DFMT_X1R5G5B5, + D3DFMT_R5G6B5, + }; + const int NumBBFormats = sizeof(BBFormatArray) / sizeof(BBFormatArray[0]); - // First pass: see if CDF succeeds for any usage - bFoundSuccess = FALSE; - for( UINT iUsage = 0; iUsage < numUsages; iUsage++ ) + // A subset of AllFormatArray...it's those D3DFMTs that could possibly be + // depth/stencil formats. + D3DFORMAT DSFormatArray[] = + { + D3DFMT_D16_LOCKABLE, + D3DFMT_D32, + D3DFMT_D15S1, + D3DFMT_D24S8, + D3DFMT_D24X8, + D3DFMT_D24X4S4, + D3DFMT_D16, + D3DFMT_D32F_LOCKABLE, + D3DFMT_D24FS8, + }; + const int NumDSFormats = sizeof(DSFormatArray) / sizeof(DSFormatArray[0]); + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF DXGGenCaps[] = + { + CAPSVALDEF("DeviceType", DeviceType), + CAPSVALDEF("AdapterOrdinal", AdapterOrdinal), + + CAPSVALDEF("MaxTextureWidth", MaxTextureWidth), + CAPSVALDEF("MaxTextureHeight", MaxTextureHeight), + CAPSVALDEF("MaxVolumeExtent", MaxVolumeExtent), + + CAPSVALDEF("MaxTextureRepeat", MaxTextureRepeat), + CAPSVALDEF("MaxTextureAspectRatio", MaxTextureAspectRatio), + CAPSVALDEF("MaxAnisotropy", MaxAnisotropy), + CAPSFLOATDEF("MaxVertexW", MaxVertexW), + + CAPSFLOATDEF("GuardBandLeft", GuardBandLeft), + CAPSFLOATDEF("GuardBandTop", GuardBandTop), + CAPSFLOATDEF("GuardBandRight", GuardBandRight), + CAPSFLOATDEF("GuardBandBottom", GuardBandBottom), + + CAPSFLOATDEF("ExtentsAdjust", ExtentsAdjust), + + CAPSVALDEF("MaxTextureBlendStages", MaxTextureBlendStages), + CAPSVALDEF("MaxSimultaneousTextures", MaxSimultaneousTextures), + + CAPSVALDEF("MaxActiveLights", MaxActiveLights), + CAPSVALDEF("MaxUserClipPlanes", MaxUserClipPlanes), + CAPSVALDEF("MaxVertexBlendMatrices", MaxVertexBlendMatrices), + CAPSVALDEF("MaxVertexBlendMatrixIndex", MaxVertexBlendMatrixIndex), + + CAPSFLOATDEF("MaxPointSize", MaxPointSize), + + CAPSVALDEF("MaxPrimitiveCount", MaxPrimitiveCount), + CAPSVALDEF("MaxVertexIndex", MaxVertexIndex), + CAPSVALDEF("MaxStreams", MaxStreams), + CAPSVALDEF("MaxStreamStride", MaxStreamStride), + + CAPSSHADERDEF("VertexShaderVersion", VertexShaderVersion), + CAPSVALDEF("MaxVertexShaderConst", MaxVertexShaderConst), + + CAPSSHADERDEF("PixelShaderVersion", PixelShaderVersion), + CAPSFLOATDEF("PixelShader1xMaxValue", PixelShader1xMaxValue), + + CAPSFLOATDEF("MaxNpatchTessellationLevel", MaxNpatchTessellationLevel), + + CAPSVALDEF("MasterAdapterOrdinal", MasterAdapterOrdinal), + CAPSVALDEF("AdapterOrdinalInGroup", AdapterOrdinalInGroup), + CAPSVALDEF("NumberOfAdaptersInGroup", NumberOfAdaptersInGroup), + CAPSVALDEF("NumSimultaneousRTs", NumSimultaneousRTs), + CAPSVALDEF("MaxVShaderInstructionsExecuted", MaxVShaderInstructionsExecuted), + CAPSVALDEF("MaxPShaderInstructionsExecuted", MaxPShaderInstructionsExecuted), + CAPSVALDEF("MaxVertexShader30InstructionSlots", MaxVertexShader30InstructionSlots), + CAPSVALDEF("MaxPixelShader30InstructionSlots", MaxPixelShader30InstructionSlots), + + { nullptr, 0, 0 } + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsCaps[] = + { + CAPSFLAGDEF("D3DCAPS_READ_SCANLINE", Caps, D3DCAPS_READ_SCANLINE), + CAPSFLAGDEFex("D3DCAPS_OVERLAY", Caps, D3DCAPS_OVERLAY), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsCaps2[] = + { + CAPSFLAGDEF("D3DCAPS2_CANCALIBRATEGAMMA", Caps2, D3DCAPS2_CANCALIBRATEGAMMA), + CAPSFLAGDEF("D3DCAPS2_FULLSCREENGAMMA", Caps2, D3DCAPS2_FULLSCREENGAMMA), + CAPSFLAGDEF("D3DCAPS2_CANMANAGERESOURCE", Caps2, D3DCAPS2_CANMANAGERESOURCE), + CAPSFLAGDEF("D3DCAPS2_DYNAMICTEXTURES", Caps2, D3DCAPS2_DYNAMICTEXTURES), + CAPSFLAGDEF("D3DCAPS2_CANAUTOGENMIPMAP", Caps2, D3DCAPS2_CANAUTOGENMIPMAP), + CAPSFLAGDEFex("D3DCAPS2_CANSHARERESOURCE", Caps2, D3DCAPS2_CANSHARERESOURCE), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsCaps3[] = + { + CAPSFLAGDEF("D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD", Caps3, D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD), + CAPSFLAGDEF("D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION", Caps3, D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION), + CAPSFLAGDEF("D3DCAPS3_COPY_TO_VIDMEM", Caps3, D3DCAPS3_COPY_TO_VIDMEM), + CAPSFLAGDEF("D3DCAPS3_COPY_TO_SYSTEMMEM", Caps3, D3DCAPS3_COPY_TO_SYSTEMMEM), + CAPSFLAGDEFex("D3DCAPS3_DXVAHD", Caps3, D3DCAPS3_DXVAHD), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsPresentationIntervals[] = + { + CAPSFLAGDEF("D3DPRESENT_INTERVAL_ONE", PresentationIntervals, D3DPRESENT_INTERVAL_ONE), + CAPSFLAGDEF("D3DPRESENT_INTERVAL_TWO", PresentationIntervals, D3DPRESENT_INTERVAL_TWO), + CAPSFLAGDEF("D3DPRESENT_INTERVAL_THREE", PresentationIntervals, D3DPRESENT_INTERVAL_THREE), + CAPSFLAGDEF("D3DPRESENT_INTERVAL_FOUR", PresentationIntervals, D3DPRESENT_INTERVAL_FOUR), + CAPSFLAGDEF("D3DPRESENT_INTERVAL_IMMEDIATE", PresentationIntervals, D3DPRESENT_INTERVAL_IMMEDIATE), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsCursorCaps[] = + { + CAPSFLAGDEF("D3DCURSORCAPS_COLOR", CursorCaps, D3DCURSORCAPS_COLOR), + CAPSFLAGDEF("D3DCURSORCAPS_LOWRES", CursorCaps, D3DCURSORCAPS_LOWRES), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsDevCaps[] = + { + CAPSFLAGDEF("D3DDEVCAPS_EXECUTESYSTEMMEMORY", DevCaps, D3DDEVCAPS_EXECUTESYSTEMMEMORY), + CAPSFLAGDEF("D3DDEVCAPS_EXECUTEVIDEOMEMORY", DevCaps, D3DDEVCAPS_EXECUTEVIDEOMEMORY), + CAPSFLAGDEF("D3DDEVCAPS_TLVERTEXSYSTEMMEMORY", DevCaps, D3DDEVCAPS_TLVERTEXSYSTEMMEMORY), + CAPSFLAGDEF("D3DDEVCAPS_TLVERTEXVIDEOMEMORY", DevCaps, D3DDEVCAPS_TLVERTEXVIDEOMEMORY), + CAPSFLAGDEF("D3DDEVCAPS_TEXTURESYSTEMMEMORY", DevCaps, D3DDEVCAPS_TEXTURESYSTEMMEMORY), + CAPSFLAGDEF("D3DDEVCAPS_TEXTUREVIDEOMEMORY", DevCaps, D3DDEVCAPS_TEXTUREVIDEOMEMORY), + CAPSFLAGDEF("D3DDEVCAPS_DRAWPRIMTLVERTEX", DevCaps, D3DDEVCAPS_DRAWPRIMTLVERTEX), + CAPSFLAGDEF("D3DDEVCAPS_CANRENDERAFTERFLIP", DevCaps, D3DDEVCAPS_CANRENDERAFTERFLIP), + CAPSFLAGDEF("D3DDEVCAPS_TEXTURENONLOCALVIDMEM", DevCaps, D3DDEVCAPS_TEXTURENONLOCALVIDMEM), + CAPSFLAGDEF("D3DDEVCAPS_DRAWPRIMITIVES2", DevCaps, D3DDEVCAPS_DRAWPRIMITIVES2), + CAPSFLAGDEF("D3DDEVCAPS_SEPARATETEXTUREMEMORIES", DevCaps, D3DDEVCAPS_SEPARATETEXTUREMEMORIES), + CAPSFLAGDEF("D3DDEVCAPS_DRAWPRIMITIVES2EX", DevCaps, D3DDEVCAPS_DRAWPRIMITIVES2EX), + CAPSFLAGDEF("D3DDEVCAPS_HWTRANSFORMANDLIGHT", DevCaps, D3DDEVCAPS_HWTRANSFORMANDLIGHT), + CAPSFLAGDEF("D3DDEVCAPS_CANBLTSYSTONONLOCAL", DevCaps, D3DDEVCAPS_CANBLTSYSTONONLOCAL), + CAPSFLAGDEF("D3DDEVCAPS_HWRASTERIZATION", DevCaps, D3DDEVCAPS_HWRASTERIZATION), + CAPSFLAGDEF("D3DDEVCAPS_PUREDEVICE", DevCaps, D3DDEVCAPS_PUREDEVICE), + CAPSFLAGDEF("D3DDEVCAPS_QUINTICRTPATCHES", DevCaps, D3DDEVCAPS_QUINTICRTPATCHES), + CAPSFLAGDEF("D3DDEVCAPS_RTPATCHES", DevCaps, D3DDEVCAPS_RTPATCHES), + CAPSFLAGDEF("D3DDEVCAPS_RTPATCHHANDLEZERO", DevCaps, D3DDEVCAPS_RTPATCHHANDLEZERO), + CAPSFLAGDEF("D3DDEVCAPS_NPATCHES", DevCaps, D3DDEVCAPS_NPATCHES), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsLineCaps[] = + { + CAPSFLAGDEF("D3DLINECAPS_TEXTURE", LineCaps, D3DLINECAPS_TEXTURE), + CAPSFLAGDEF("D3DLINECAPS_ZTEST", LineCaps, D3DLINECAPS_ZTEST), + CAPSFLAGDEF("D3DLINECAPS_BLEND", LineCaps, D3DLINECAPS_BLEND), + CAPSFLAGDEF("D3DLINECAPS_ALPHACMP", LineCaps, D3DLINECAPS_ALPHACMP), + CAPSFLAGDEF("D3DLINECAPS_FOG", LineCaps, D3DLINECAPS_FOG), + CAPSFLAGDEF("D3DLINECAPS_ANTIALIAS", LineCaps, D3DLINECAPS_ANTIALIAS), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsStencilCaps[] = + { + CAPSFLAGDEF("D3DSTENCILCAPS_KEEP", StencilCaps, D3DSTENCILCAPS_KEEP), + CAPSFLAGDEF("D3DSTENCILCAPS_ZERO", StencilCaps, D3DSTENCILCAPS_ZERO), + CAPSFLAGDEF("D3DSTENCILCAPS_REPLACE", StencilCaps, D3DSTENCILCAPS_REPLACE), + CAPSFLAGDEF("D3DSTENCILCAPS_INCRSAT", StencilCaps, D3DSTENCILCAPS_INCRSAT), + CAPSFLAGDEF("D3DSTENCILCAPS_DECRSAT", StencilCaps, D3DSTENCILCAPS_DECRSAT), + CAPSFLAGDEF("D3DSTENCILCAPS_INVERT", StencilCaps, D3DSTENCILCAPS_INVERT), + CAPSFLAGDEF("D3DSTENCILCAPS_INCR", StencilCaps, D3DSTENCILCAPS_INCR), + CAPSFLAGDEF("D3DSTENCILCAPS_DECR", StencilCaps, D3DSTENCILCAPS_DECR), + CAPSFLAGDEF("D3DSTENCILCAPS_TWOSIDED", StencilCaps, D3DSTENCILCAPS_TWOSIDED), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsFVFCaps[] = + { + CAPSFLAGDEF("D3DFVFCAPS_DONOTSTRIPELEMENTS", FVFCaps, D3DFVFCAPS_DONOTSTRIPELEMENTS), + CAPSMASK16DEF("D3DFVFCAPS_TEXCOORDCOUNTMASK", FVFCaps), + CAPSFLAGDEF("D3DFVFCAPS_PSIZE", FVFCaps, D3DFVFCAPS_PSIZE), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsTextureOpCaps[] = + { + CAPSFLAGDEF("D3DTEXOPCAPS_DISABLE", TextureOpCaps, D3DTEXOPCAPS_DISABLE), + CAPSFLAGDEF("D3DTEXOPCAPS_SELECTARG1", TextureOpCaps, D3DTEXOPCAPS_SELECTARG1), + CAPSFLAGDEF("D3DTEXOPCAPS_SELECTARG2", TextureOpCaps, D3DTEXOPCAPS_SELECTARG2), + CAPSFLAGDEF("D3DTEXOPCAPS_MODULATE", TextureOpCaps, D3DTEXOPCAPS_MODULATE), + CAPSFLAGDEF("D3DTEXOPCAPS_MODULATE2X", TextureOpCaps, D3DTEXOPCAPS_MODULATE2X), + CAPSFLAGDEF("D3DTEXOPCAPS_MODULATE4X", TextureOpCaps, D3DTEXOPCAPS_MODULATE4X), + CAPSFLAGDEF("D3DTEXOPCAPS_ADD", TextureOpCaps, D3DTEXOPCAPS_ADD), + CAPSFLAGDEF("D3DTEXOPCAPS_ADDSIGNED", TextureOpCaps, D3DTEXOPCAPS_ADDSIGNED), + CAPSFLAGDEF("D3DTEXOPCAPS_ADDSIGNED2X", TextureOpCaps, D3DTEXOPCAPS_ADDSIGNED2X), + CAPSFLAGDEF("D3DTEXOPCAPS_SUBTRACT", TextureOpCaps, D3DTEXOPCAPS_SUBTRACT), + CAPSFLAGDEF("D3DTEXOPCAPS_ADDSMOOTH", TextureOpCaps, D3DTEXOPCAPS_ADDSMOOTH), + CAPSFLAGDEF("D3DTEXOPCAPS_BLENDDIFFUSEALPHA", TextureOpCaps, D3DTEXOPCAPS_BLENDDIFFUSEALPHA), + CAPSFLAGDEF("D3DTEXOPCAPS_BLENDTEXTUREALPHA", TextureOpCaps, D3DTEXOPCAPS_BLENDTEXTUREALPHA), + CAPSFLAGDEF("D3DTEXOPCAPS_BLENDFACTORALPHA", TextureOpCaps, D3DTEXOPCAPS_BLENDFACTORALPHA), + CAPSFLAGDEF("D3DTEXOPCAPS_BLENDTEXTUREALPHAPM", TextureOpCaps, D3DTEXOPCAPS_BLENDTEXTUREALPHAPM), + CAPSFLAGDEF("D3DTEXOPCAPS_BLENDCURRENTALPHA", TextureOpCaps, D3DTEXOPCAPS_BLENDCURRENTALPHA), + CAPSFLAGDEF("D3DTEXOPCAPS_PREMODULATE", TextureOpCaps, D3DTEXOPCAPS_PREMODULATE), + CAPSFLAGDEF("D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR", TextureOpCaps, D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR), + CAPSFLAGDEF("D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA", TextureOpCaps, D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA), + CAPSFLAGDEF("D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR", TextureOpCaps, D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR), + CAPSFLAGDEF("D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA", TextureOpCaps, D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA), + CAPSFLAGDEF("D3DTEXOPCAPS_BUMPENVMAP", TextureOpCaps, D3DTEXOPCAPS_BUMPENVMAP), + CAPSFLAGDEF("D3DTEXOPCAPS_BUMPENVMAPLUMINANCE", TextureOpCaps, D3DTEXOPCAPS_BUMPENVMAPLUMINANCE), + CAPSFLAGDEF("D3DTEXOPCAPS_DOTPRODUCT3", TextureOpCaps, D3DTEXOPCAPS_DOTPRODUCT3), + CAPSFLAGDEF("D3DTEXOPCAPS_MULTIPLYADD", TextureOpCaps, D3DTEXOPCAPS_MULTIPLYADD), + CAPSFLAGDEF("D3DTEXOPCAPS_LERP", TextureOpCaps, D3DTEXOPCAPS_LERP), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsVertexProcessingCaps[] = + { + CAPSFLAGDEF("D3DVTXPCAPS_DIRECTIONALLIGHTS", VertexProcessingCaps, D3DVTXPCAPS_DIRECTIONALLIGHTS), + CAPSFLAGDEF("D3DVTXPCAPS_LOCALVIEWER", VertexProcessingCaps, D3DVTXPCAPS_LOCALVIEWER), + CAPSFLAGDEF("D3DVTXPCAPS_MATERIALSOURCE7", VertexProcessingCaps, D3DVTXPCAPS_MATERIALSOURCE7), + CAPSFLAGDEF("D3DVTXPCAPS_POSITIONALLIGHTS", VertexProcessingCaps, D3DVTXPCAPS_POSITIONALLIGHTS), + CAPSFLAGDEF("D3DVTXPCAPS_TEXGEN", VertexProcessingCaps, D3DVTXPCAPS_TEXGEN), + CAPSFLAGDEF("D3DVTXPCAPS_TWEENING", VertexProcessingCaps, D3DVTXPCAPS_TWEENING), + CAPSFLAGDEF("D3DVTXPCAPS_TEXGEN_SPHEREMAP", VertexProcessingCaps, D3DVTXPCAPS_TEXGEN_SPHEREMAP), + CAPSFLAGDEF("D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER", VertexProcessingCaps, D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsPrimMiscCaps[] = + { + CAPSFLAGDEF("D3DPMISCCAPS_MASKZ", PrimitiveMiscCaps, D3DPMISCCAPS_MASKZ), + CAPSFLAGDEF("D3DPMISCCAPS_CULLNONE", PrimitiveMiscCaps, D3DPMISCCAPS_CULLNONE), + CAPSFLAGDEF("D3DPMISCCAPS_CULLCW", PrimitiveMiscCaps, D3DPMISCCAPS_CULLCW), + CAPSFLAGDEF("D3DPMISCCAPS_CULLCCW", PrimitiveMiscCaps, D3DPMISCCAPS_CULLCCW), + CAPSFLAGDEF("D3DPMISCCAPS_COLORWRITEENABLE", PrimitiveMiscCaps, D3DPMISCCAPS_COLORWRITEENABLE), + CAPSFLAGDEF("D3DPMISCCAPS_CLIPPLANESCALEDPOINTS", PrimitiveMiscCaps, D3DPMISCCAPS_CLIPPLANESCALEDPOINTS), + CAPSFLAGDEF("D3DPMISCCAPS_CLIPTLVERTS", PrimitiveMiscCaps, D3DPMISCCAPS_CLIPTLVERTS), + CAPSFLAGDEF("D3DPMISCCAPS_TSSARGTEMP", PrimitiveMiscCaps, D3DPMISCCAPS_TSSARGTEMP), + CAPSFLAGDEF("D3DPMISCCAPS_BLENDOP", PrimitiveMiscCaps, D3DPMISCCAPS_BLENDOP), + CAPSFLAGDEF("D3DPMISCCAPS_NULLREFERENCE", PrimitiveMiscCaps, D3DPMISCCAPS_NULLREFERENCE), + CAPSFLAGDEF("D3DPMISCCAPS_INDEPENDENTWRITEMASKS", PrimitiveMiscCaps, D3DPMISCCAPS_INDEPENDENTWRITEMASKS), + CAPSFLAGDEF("D3DPMISCCAPS_PERSTAGECONSTANT", PrimitiveMiscCaps, D3DPMISCCAPS_PERSTAGECONSTANT), + CAPSFLAGDEF("D3DPMISCCAPS_FOGANDSPECULARALPHA", PrimitiveMiscCaps, D3DPMISCCAPS_FOGANDSPECULARALPHA), + CAPSFLAGDEF("D3DPMISCCAPS_SEPARATEALPHABLEND", PrimitiveMiscCaps, D3DPMISCCAPS_SEPARATEALPHABLEND), + CAPSFLAGDEF("D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS", PrimitiveMiscCaps, D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS), + CAPSFLAGDEF("D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING", PrimitiveMiscCaps, D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING), + CAPSFLAGDEF("D3DPMISCCAPS_FOGVERTEXCLAMPED", PrimitiveMiscCaps, D3DPMISCCAPS_FOGVERTEXCLAMPED), + CAPSFLAGDEFex("D3DPMISCCAPS_POSTBLENDSRGBCONVERT", PrimitiveMiscCaps, D3DPMISCCAPS_POSTBLENDSRGBCONVERT), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsRasterCaps[] = + { + CAPSFLAGDEF("D3DPRASTERCAPS_DITHER", RasterCaps, D3DPRASTERCAPS_DITHER), + CAPSFLAGDEF("D3DPRASTERCAPS_ZTEST", RasterCaps, D3DPRASTERCAPS_ZTEST), + CAPSFLAGDEF("D3DPRASTERCAPS_FOGVERTEX", RasterCaps, D3DPRASTERCAPS_FOGVERTEX), + CAPSFLAGDEF("D3DPRASTERCAPS_FOGTABLE", RasterCaps, D3DPRASTERCAPS_FOGTABLE), + // CAPSFLAGDEF("D3DPRASTERCAPS_ANTIALIASEDGES", RasterCaps, D3DPRASTERCAPS_ANTIALIASEDGES), + CAPSFLAGDEF("D3DPRASTERCAPS_MIPMAPLODBIAS", RasterCaps, D3DPRASTERCAPS_MIPMAPLODBIAS), + // CAPSFLAGDEF("D3DPRASTERCAPS_ZBIAS", RasterCaps, D3DPRASTERCAPS_ZBIAS), + CAPSFLAGDEF("D3DPRASTERCAPS_ZBUFFERLESSHSR", RasterCaps, D3DPRASTERCAPS_ZBUFFERLESSHSR), + CAPSFLAGDEF("D3DPRASTERCAPS_FOGRANGE", RasterCaps, D3DPRASTERCAPS_FOGRANGE), + CAPSFLAGDEF("D3DPRASTERCAPS_ANISOTROPY", RasterCaps, D3DPRASTERCAPS_ANISOTROPY), + CAPSFLAGDEF("D3DPRASTERCAPS_WBUFFER", RasterCaps, D3DPRASTERCAPS_WBUFFER), + CAPSFLAGDEF("D3DPRASTERCAPS_WFOG", RasterCaps, D3DPRASTERCAPS_WFOG), + CAPSFLAGDEF("D3DPRASTERCAPS_ZFOG", RasterCaps, D3DPRASTERCAPS_ZFOG), + CAPSFLAGDEF("D3DPRASTERCAPS_COLORPERSPECTIVE", RasterCaps, D3DPRASTERCAPS_COLORPERSPECTIVE), + // CAPSFLAGDEF("D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE", RasterCaps, D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE), + CAPSFLAGDEF("D3DPRASTERCAPS_SCISSORTEST", RasterCaps, D3DPRASTERCAPS_SCISSORTEST), + CAPSFLAGDEF("D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS", RasterCaps, D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS), + CAPSFLAGDEF("D3DPRASTERCAPS_DEPTHBIAS", RasterCaps, D3DPRASTERCAPS_DEPTHBIAS), + CAPSFLAGDEF("D3DPRASTERCAPS_MULTISAMPLE_TOGGLE",RasterCaps, D3DPRASTERCAPS_MULTISAMPLE_TOGGLE), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsZCmpCaps[] = + { + CAPSFLAGDEF("D3DPCMPCAPS_NEVER", ZCmpCaps, D3DPCMPCAPS_NEVER), + CAPSFLAGDEF("D3DPCMPCAPS_LESS", ZCmpCaps, D3DPCMPCAPS_LESS), + CAPSFLAGDEF("D3DPCMPCAPS_EQUAL", ZCmpCaps, D3DPCMPCAPS_EQUAL), + CAPSFLAGDEF("D3DPCMPCAPS_LESSEQUAL", ZCmpCaps, D3DPCMPCAPS_LESSEQUAL), + CAPSFLAGDEF("D3DPCMPCAPS_GREATER", ZCmpCaps, D3DPCMPCAPS_GREATER), + CAPSFLAGDEF("D3DPCMPCAPS_NOTEQUAL", ZCmpCaps, D3DPCMPCAPS_NOTEQUAL), + CAPSFLAGDEF("D3DPCMPCAPS_GREATEREQUAL", ZCmpCaps, D3DPCMPCAPS_GREATEREQUAL), + CAPSFLAGDEF("D3DPCMPCAPS_ALWAYS", ZCmpCaps, D3DPCMPCAPS_ALWAYS), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsSrcBlendCaps[] = + { + CAPSFLAGDEF("D3DPBLENDCAPS_ZERO", SrcBlendCaps, D3DPBLENDCAPS_ZERO), + CAPSFLAGDEF("D3DPBLENDCAPS_ONE", SrcBlendCaps, D3DPBLENDCAPS_ONE), + CAPSFLAGDEF("D3DPBLENDCAPS_SRCCOLOR", SrcBlendCaps, D3DPBLENDCAPS_SRCCOLOR), + CAPSFLAGDEF("D3DPBLENDCAPS_INVSRCCOLOR", SrcBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR), + CAPSFLAGDEF("D3DPBLENDCAPS_SRCALPHA", SrcBlendCaps, D3DPBLENDCAPS_SRCALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_INVSRCALPHA", SrcBlendCaps, D3DPBLENDCAPS_INVSRCALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_DESTALPHA", SrcBlendCaps, D3DPBLENDCAPS_DESTALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_INVDESTALPHA", SrcBlendCaps, D3DPBLENDCAPS_INVDESTALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_DESTCOLOR", SrcBlendCaps, D3DPBLENDCAPS_DESTCOLOR), + CAPSFLAGDEF("D3DPBLENDCAPS_INVDESTCOLOR", SrcBlendCaps, D3DPBLENDCAPS_INVDESTCOLOR), + CAPSFLAGDEF("D3DPBLENDCAPS_SRCALPHASAT", SrcBlendCaps, D3DPBLENDCAPS_SRCALPHASAT), + CAPSFLAGDEF("D3DPBLENDCAPS_BOTHSRCALPHA", SrcBlendCaps, D3DPBLENDCAPS_BOTHSRCALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_BOTHINVSRCALPHA", SrcBlendCaps, D3DPBLENDCAPS_BOTHINVSRCALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_BLENDFACTOR", SrcBlendCaps, D3DPBLENDCAPS_BLENDFACTOR), + CAPSFLAGDEFex("D3DPBLENDCAPS_SRCCOLOR2", SrcBlendCaps, D3DPBLENDCAPS_SRCCOLOR2), + CAPSFLAGDEFex("D3DPBLENDCAPS_INVSRCCOLOR2", SrcBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR2), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsDestBlendCaps[] = + { + CAPSFLAGDEF("D3DPBLENDCAPS_ZERO", DestBlendCaps, D3DPBLENDCAPS_ZERO), + CAPSFLAGDEF("D3DPBLENDCAPS_ONE", DestBlendCaps, D3DPBLENDCAPS_ONE), + CAPSFLAGDEF("D3DPBLENDCAPS_SRCCOLOR", DestBlendCaps, D3DPBLENDCAPS_SRCCOLOR), + CAPSFLAGDEF("D3DPBLENDCAPS_INVSRCCOLOR", DestBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR), + CAPSFLAGDEF("D3DPBLENDCAPS_SRCALPHA", DestBlendCaps, D3DPBLENDCAPS_SRCALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_INVSRCALPHA", DestBlendCaps, D3DPBLENDCAPS_INVSRCALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_DESTALPHA", DestBlendCaps, D3DPBLENDCAPS_DESTALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_INVDESTALPHA", DestBlendCaps, D3DPBLENDCAPS_INVDESTALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_DESTCOLOR", DestBlendCaps, D3DPBLENDCAPS_DESTCOLOR), + CAPSFLAGDEF("D3DPBLENDCAPS_INVDESTCOLOR", DestBlendCaps, D3DPBLENDCAPS_INVDESTCOLOR), + CAPSFLAGDEF("D3DPBLENDCAPS_SRCALPHASAT", DestBlendCaps, D3DPBLENDCAPS_SRCALPHASAT), + CAPSFLAGDEF("D3DPBLENDCAPS_BOTHSRCALPHA", DestBlendCaps, D3DPBLENDCAPS_BOTHSRCALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_BOTHINVSRCALPHA", DestBlendCaps, D3DPBLENDCAPS_BOTHINVSRCALPHA), + CAPSFLAGDEF("D3DPBLENDCAPS_BLENDFACTOR", DestBlendCaps, D3DPBLENDCAPS_BLENDFACTOR), + CAPSFLAGDEFex("D3DPBLENDCAPS_SRCCOLOR2", DestBlendCaps, D3DPBLENDCAPS_SRCCOLOR2), + CAPSFLAGDEFex("D3DPBLENDCAPS_INVSRCCOLOR2", DestBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR2), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsAlphaCmpCaps[] = + { + CAPSFLAGDEF("D3DPCMPCAPS_NEVER", AlphaCmpCaps, D3DPCMPCAPS_NEVER), + CAPSFLAGDEF("D3DPCMPCAPS_LESS", AlphaCmpCaps, D3DPCMPCAPS_LESS), + CAPSFLAGDEF("D3DPCMPCAPS_EQUAL", AlphaCmpCaps, D3DPCMPCAPS_EQUAL), + CAPSFLAGDEF("D3DPCMPCAPS_LESSEQUAL", AlphaCmpCaps, D3DPCMPCAPS_LESSEQUAL), + CAPSFLAGDEF("D3DPCMPCAPS_GREATER", AlphaCmpCaps, D3DPCMPCAPS_GREATER), + CAPSFLAGDEF("D3DPCMPCAPS_NOTEQUAL", AlphaCmpCaps, D3DPCMPCAPS_NOTEQUAL), + CAPSFLAGDEF("D3DPCMPCAPS_GREATEREQUAL", AlphaCmpCaps, D3DPCMPCAPS_GREATEREQUAL), + CAPSFLAGDEF("D3DPCMPCAPS_ALWAYS", AlphaCmpCaps, D3DPCMPCAPS_ALWAYS), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsShadeCaps[] = + { + CAPSFLAGDEF("D3DPSHADECAPS_COLORGOURAUDRGB", ShadeCaps, D3DPSHADECAPS_COLORGOURAUDRGB), + CAPSFLAGDEF("D3DPSHADECAPS_SPECULARGOURAUDRGB", ShadeCaps, D3DPSHADECAPS_SPECULARGOURAUDRGB), + CAPSFLAGDEF("D3DPSHADECAPS_ALPHAGOURAUDBLEND", ShadeCaps, D3DPSHADECAPS_ALPHAGOURAUDBLEND), + CAPSFLAGDEF("D3DPSHADECAPS_FOGGOURAUD", ShadeCaps, D3DPSHADECAPS_FOGGOURAUD), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsTextureCaps[] = + { + CAPSFLAGDEF("D3DPTEXTURECAPS_PERSPECTIVE", TextureCaps, D3DPTEXTURECAPS_PERSPECTIVE), + CAPSFLAGDEF("D3DPTEXTURECAPS_POW2", TextureCaps, D3DPTEXTURECAPS_POW2), + CAPSFLAGDEF("D3DPTEXTURECAPS_ALPHA", TextureCaps, D3DPTEXTURECAPS_ALPHA), + CAPSFLAGDEF("D3DPTEXTURECAPS_SQUAREONLY", TextureCaps, D3DPTEXTURECAPS_SQUAREONLY), + CAPSFLAGDEF("D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE", TextureCaps, D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE), + CAPSFLAGDEF("D3DPTEXTURECAPS_ALPHAPALETTE", TextureCaps, D3DPTEXTURECAPS_ALPHAPALETTE), + CAPSFLAGDEF("D3DPTEXTURECAPS_NONPOW2CONDITIONAL", TextureCaps, D3DPTEXTURECAPS_NONPOW2CONDITIONAL), + CAPSFLAGDEF("D3DPTEXTURECAPS_PROJECTED", TextureCaps, D3DPTEXTURECAPS_PROJECTED), + CAPSFLAGDEF("D3DPTEXTURECAPS_CUBEMAP", TextureCaps, D3DPTEXTURECAPS_CUBEMAP), + CAPSFLAGDEF("D3DPTEXTURECAPS_VOLUMEMAP", TextureCaps, D3DPTEXTURECAPS_VOLUMEMAP), + CAPSFLAGDEF("D3DPTEXTURECAPS_MIPMAP", TextureCaps, D3DPTEXTURECAPS_MIPMAP), + CAPSFLAGDEF("D3DPTEXTURECAPS_MIPVOLUMEMAP", TextureCaps, D3DPTEXTURECAPS_MIPVOLUMEMAP), + CAPSFLAGDEF("D3DPTEXTURECAPS_MIPCUBEMAP", TextureCaps, D3DPTEXTURECAPS_MIPCUBEMAP), + CAPSFLAGDEF("D3DPTEXTURECAPS_CUBEMAP_POW2", TextureCaps, D3DPTEXTURECAPS_CUBEMAP_POW2), + CAPSFLAGDEF("D3DPTEXTURECAPS_VOLUMEMAP_POW2", TextureCaps, D3DPTEXTURECAPS_VOLUMEMAP_POW2), + CAPSFLAGDEF("D3DPTEXTURECAPS_NOPROJECTEDBUMPENV", TextureCaps, D3DPTEXTURECAPS_NOPROJECTEDBUMPENV), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsTextureFilterCaps[] = + { + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", TextureFilterCaps, D3DPTFILTERCAPS_MINFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", TextureFilterCaps, D3DPTFILTERCAPS_MINFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", TextureFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", TextureFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", TextureFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", TextureFilterCaps, D3DPTFILTERCAPS_MIPFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", TextureFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", TextureFilterCaps, D3DPTFILTERCAPS_MAGFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", TextureFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", TextureFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", TextureFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", TextureFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD), + CAPSFLAGDEFex("D3DPTFILTERCAPS_CONVOLUTIONMONO", TextureFilterCaps, D3DPTFILTERCAPS_CONVOLUTIONMONO), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsCubeTextureFilterCaps[] = + { + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", CubeTextureFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", CubeTextureFilterCaps, D3DPTFILTERCAPS_MIPFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", CubeTextureFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", CubeTextureFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsVolumeTextureFilterCaps[] = + { + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MIPFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", VolumeTextureFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsStretchRectFilterCaps[] = + { + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", StretchRectFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", StretchRectFilterCaps, D3DPTFILTERCAPS_MIPFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", StretchRectFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", StretchRectFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsTextureAddressCaps[] = + { + CAPSFLAGDEF("D3DPTADDRESSCAPS_WRAP", TextureAddressCaps, D3DPTADDRESSCAPS_WRAP), + CAPSFLAGDEF("D3DPTADDRESSCAPS_MIRROR", TextureAddressCaps, D3DPTADDRESSCAPS_MIRROR), + CAPSFLAGDEF("D3DPTADDRESSCAPS_CLAMP", TextureAddressCaps, D3DPTADDRESSCAPS_CLAMP), + CAPSFLAGDEF("D3DPTADDRESSCAPS_BORDER", TextureAddressCaps, D3DPTADDRESSCAPS_BORDER), + CAPSFLAGDEF("D3DPTADDRESSCAPS_INDEPENDENTUV", TextureAddressCaps, D3DPTADDRESSCAPS_INDEPENDENTUV), + CAPSFLAGDEF("D3DPTADDRESSCAPS_MIRRORONCE", TextureAddressCaps, D3DPTADDRESSCAPS_MIRRORONCE), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsVolumeTextureAddressCaps[] = + { + CAPSFLAGDEF("D3DPTADDRESSCAPS_WRAP", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_WRAP), + CAPSFLAGDEF("D3DPTADDRESSCAPS_MIRROR", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_MIRROR), + CAPSFLAGDEF("D3DPTADDRESSCAPS_CLAMP", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_CLAMP), + CAPSFLAGDEF("D3DPTADDRESSCAPS_BORDER", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_BORDER), + CAPSFLAGDEF("D3DPTADDRESSCAPS_INDEPENDENTUV", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_INDEPENDENTUV), + CAPSFLAGDEF("D3DPTADDRESSCAPS_MIRRORONCE", VolumeTextureAddressCaps, D3DPTADDRESSCAPS_MIRRORONCE), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsDevCaps2[] = + { + CAPSFLAGDEF("D3DDEVCAPS2_STREAMOFFSET", DevCaps2, D3DDEVCAPS2_STREAMOFFSET), + CAPSFLAGDEF("D3DDEVCAPS2_DMAPNPATCH", DevCaps2, D3DDEVCAPS2_DMAPNPATCH), + CAPSFLAGDEF("D3DDEVCAPS2_ADAPTIVETESSRTPATCH", DevCaps2, D3DDEVCAPS2_ADAPTIVETESSRTPATCH), + CAPSFLAGDEF("D3DDEVCAPS2_ADAPTIVETESSNPATCH", DevCaps2, D3DDEVCAPS2_ADAPTIVETESSNPATCH), + CAPSFLAGDEF("D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES", DevCaps2, D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES), + CAPSFLAGDEF("D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH", DevCaps2, D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH), + CAPSFLAGDEF("D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET", DevCaps2, D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsDeclTypes[] = + { + CAPSFLAGDEF("D3DDTCAPS_UBYTE4", DeclTypes, D3DDTCAPS_UBYTE4), + CAPSFLAGDEF("D3DDTCAPS_UBYTE4N", DeclTypes, D3DDTCAPS_UBYTE4N), + CAPSFLAGDEF("D3DDTCAPS_SHORT2N", DeclTypes, D3DDTCAPS_SHORT2N), + CAPSFLAGDEF("D3DDTCAPS_SHORT4N", DeclTypes, D3DDTCAPS_SHORT4N), + CAPSFLAGDEF("D3DDTCAPS_USHORT2N", DeclTypes, D3DDTCAPS_USHORT2N), + CAPSFLAGDEF("D3DDTCAPS_USHORT4N", DeclTypes, D3DDTCAPS_USHORT4N), + CAPSFLAGDEF("D3DDTCAPS_UDEC3", DeclTypes, D3DDTCAPS_UDEC3), + CAPSFLAGDEF("D3DDTCAPS_DEC3N", DeclTypes, D3DDTCAPS_DEC3N), + CAPSFLAGDEF("D3DDTCAPS_FLOAT16_2", DeclTypes, D3DDTCAPS_FLOAT16_2), + CAPSFLAGDEF("D3DDTCAPS_FLOAT16_4", DeclTypes, D3DDTCAPS_FLOAT16_4), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsVS20Caps[] = + { + CAPSFLAGDEF("D3DVS20CAPS_PREDICATION", VS20Caps.Caps, D3DVS20CAPS_PREDICATION), + CAPSVALDEF("DynamicFlowControlDepth", VS20Caps.DynamicFlowControlDepth), + CAPSVALDEF("NumTemps", VS20Caps.NumTemps), + CAPSVALDEF("StaticFlowControlDepth", VS20Caps.StaticFlowControlDepth), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsPS20Caps[] = + { + CAPSFLAGDEF("D3DPS20CAPS_ARBITRARYSWIZZLE", PS20Caps.Caps, D3DPS20CAPS_ARBITRARYSWIZZLE), + CAPSFLAGDEF("D3DPS20CAPS_GRADIENTINSTRUCTIONS", PS20Caps.Caps, D3DPS20CAPS_GRADIENTINSTRUCTIONS), + CAPSFLAGDEF("D3DPS20CAPS_PREDICATION", PS20Caps.Caps, D3DPS20CAPS_PREDICATION), + CAPSFLAGDEF("D3DPS20CAPS_NODEPENDENTREADLIMIT", PS20Caps.Caps, D3DPS20CAPS_NODEPENDENTREADLIMIT), + CAPSFLAGDEF("D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT", PS20Caps.Caps, D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT), + CAPSVALDEF("DynamicFlowControlDepth", PS20Caps.DynamicFlowControlDepth), + CAPSVALDEF("NumTemps", PS20Caps.NumTemps), + CAPSVALDEF("StaticFlowControlDepth", PS20Caps.StaticFlowControlDepth), + CAPSVALDEF("NumInstructionSlots", PS20Caps.NumInstructionSlots), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEF CapsVertexTextureFilterCaps[] = + { + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPOINT", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFLINEAR", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFANISOTROPIC", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MINFGAUSSIANQUAD", VertexTextureFilterCaps, D3DPTFILTERCAPS_MINFGAUSSIANQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFPOINT", VertexTextureFilterCaps, D3DPTFILTERCAPS_MIPFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MIPFLINEAR", VertexTextureFilterCaps, D3DPTFILTERCAPS_MIPFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPOINT", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFPOINT), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFLINEAR", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFLINEAR), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFANISOTROPIC", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFANISOTROPIC), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD), + CAPSFLAGDEF("D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", VertexTextureFilterCaps, D3DPTFILTERCAPS_MAGFGAUSSIANQUAD), + {"",0,0} + }; + + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + CAPDEFS DXGCapDefs[] = + { + {"", nullptr, (LPARAM)0, }, + {"+Caps", DXGDisplayCaps, (LPARAM)DXGGenCaps, }, + {"Caps", DXGDisplayCaps, (LPARAM)CapsCaps, }, + {"Caps2", DXGDisplayCaps, (LPARAM)CapsCaps2, }, + {"Caps3", DXGDisplayCaps, (LPARAM)CapsCaps3, }, + {"PresentationIntervals", DXGDisplayCaps, (LPARAM)CapsPresentationIntervals, }, + {"CursorCaps", DXGDisplayCaps, (LPARAM)CapsCursorCaps, }, + {"DevCaps", DXGDisplayCaps, (LPARAM)CapsDevCaps, }, + {"PrimitiveMiscCaps", DXGDisplayCaps, (LPARAM)CapsPrimMiscCaps }, + {"RasterCaps", DXGDisplayCaps, (LPARAM)CapsRasterCaps }, + {"ZCmpCaps", DXGDisplayCaps, (LPARAM)CapsZCmpCaps }, + {"SrcBlendCaps", DXGDisplayCaps, (LPARAM)CapsSrcBlendCaps }, + {"DestBlendCaps", DXGDisplayCaps, (LPARAM)CapsDestBlendCaps }, + {"AlphaCmpCaps", DXGDisplayCaps, (LPARAM)CapsAlphaCmpCaps }, + {"ShadeCaps", DXGDisplayCaps, (LPARAM)CapsShadeCaps }, + {"TextureCaps", DXGDisplayCaps, (LPARAM)CapsTextureCaps }, + + {"TextureFilterCaps", DXGDisplayCaps, (LPARAM)CapsTextureFilterCaps }, + {"CubeTextureFilterCaps", DXGDisplayCaps, (LPARAM)CapsCubeTextureFilterCaps }, + {"VolumeTextureFilterCaps", DXGDisplayCaps, (LPARAM)CapsVolumeTextureFilterCaps }, + {"TextureAddressCaps", DXGDisplayCaps, (LPARAM)CapsTextureAddressCaps }, + {"VolumeTextureAddressCaps", DXGDisplayCaps, (LPARAM)CapsVolumeTextureAddressCaps }, + + {"LineCaps", DXGDisplayCaps, (LPARAM)CapsLineCaps }, + {"StencilCaps", DXGDisplayCaps, (LPARAM)CapsStencilCaps, }, + {"FVFCaps", DXGDisplayCaps, (LPARAM)CapsFVFCaps, }, + {"TextureOpCaps", DXGDisplayCaps, (LPARAM)CapsTextureOpCaps, }, + {"VertexProcessingCaps", DXGDisplayCaps, (LPARAM)CapsVertexProcessingCaps, }, + {"DevCaps2", DXGDisplayCaps, (LPARAM)CapsDevCaps2, }, + {"DeclTypes", DXGDisplayCaps, (LPARAM)CapsDeclTypes, }, + {"StretchRectFilterCaps", DXGDisplayCaps, (LPARAM)CapsStretchRectFilterCaps, }, + {"VS20Caps", DXGDisplayCaps, (LPARAM)CapsVS20Caps, }, + {"PS20Caps", DXGDisplayCaps, (LPARAM)CapsPS20Caps, }, + {"VertexTextureFilterCaps",DXGDisplayCaps, (LPARAM)CapsVertexTextureFilterCaps, }, + + {"-", nullptr, (LPARAM)0, }, + { nullptr, 0, 0 } + }; + + //----------------------------------------------------------------------------- + const TCHAR* FormatName(D3DFORMAT format) + { + switch (format) { - if( RType == D3DRTYPE_SURFACE ) + case D3DFMT_UNKNOWN: return TEXT("D3DFMT_UNKNOWN"); + case D3DFMT_R8G8B8: return TEXT("D3DFMT_R8G8B8"); + case D3DFMT_A8R8G8B8: return TEXT("D3DFMT_A8R8G8B8"); + case D3DFMT_X8R8G8B8: return TEXT("D3DFMT_X8R8G8B8"); + case D3DFMT_R5G6B5: return TEXT("D3DFMT_R5G6B5"); + case D3DFMT_X1R5G5B5: return TEXT("D3DFMT_X1R5G5B5"); + case D3DFMT_A1R5G5B5: return TEXT("D3DFMT_A1R5G5B5"); + case D3DFMT_A4R4G4B4: return TEXT("D3DFMT_A4R4G4B4"); + case D3DFMT_R3G3B2: return TEXT("D3DFMT_R3G3B2"); + case D3DFMT_A8: return TEXT("D3DFMT_A8"); + case D3DFMT_A8R3G3B2: return TEXT("D3DFMT_A8R3G3B2"); + case D3DFMT_X4R4G4B4: return TEXT("D3DFMT_X4R4G4B4"); + case D3DFMT_A2B10G10R10: return TEXT("D3DFMT_A2B10G10R10"); + case D3DFMT_A8B8G8R8: return TEXT("D3DFMT_A8B8G8R8"); + case D3DFMT_X8B8G8R8: return TEXT("D3DFMT_X8B8G8R8"); + case D3DFMT_G16R16: return TEXT("D3DFMT_G16R16"); + case D3DFMT_A2R10G10B10: return TEXT("D3DFMT_A2R10G10B10"); + case D3DFMT_A16B16G16R16: return TEXT("D3DFMT_A16B16G16R16"); + + case D3DFMT_A8P8: return TEXT("D3DFMT_A8P8"); + case D3DFMT_P8: return TEXT("D3DFMT_P8"); + + case D3DFMT_L8: return TEXT("D3DFMT_L8"); + case D3DFMT_A8L8: return TEXT("D3DFMT_A8L8"); + case D3DFMT_A4L4: return TEXT("D3DFMT_A4L4"); + + case D3DFMT_V8U8: return TEXT("D3DFMT_V8U8"); + case D3DFMT_L6V5U5: return TEXT("D3DFMT_L6V5U5"); + case D3DFMT_X8L8V8U8: return TEXT("D3DFMT_X8L8V8U8"); + case D3DFMT_Q8W8V8U8: return TEXT("D3DFMT_Q8W8V8U8"); + case D3DFMT_V16U16: return TEXT("D3DFMT_V16U16"); + case D3DFMT_A2W10V10U10: return TEXT("D3DFMT_A2W10V10U10"); + + case D3DFMT_UYVY: return TEXT("D3DFMT_UYVY"); + case D3DFMT_R8G8_B8G8: return TEXT("D3DFMT_R8G8_B8G8"); + case D3DFMT_YUY2: return TEXT("D3DFMT_YUY2"); + case D3DFMT_G8R8_G8B8: return TEXT("D3DFMT_G8R8_G8B8"); + case D3DFMT_DXT1: return TEXT("D3DFMT_DXT1"); + case D3DFMT_DXT2: return TEXT("D3DFMT_DXT2"); + case D3DFMT_DXT3: return TEXT("D3DFMT_DXT3"); + case D3DFMT_DXT4: return TEXT("D3DFMT_DXT4"); + case D3DFMT_DXT5: return TEXT("D3DFMT_DXT5"); + + case D3DFMT_D16_LOCKABLE: return TEXT("D3DFMT_D16_LOCKABLE"); + case D3DFMT_D32: return TEXT("D3DFMT_D32"); + case D3DFMT_D15S1: return TEXT("D3DFMT_D15S1"); + case D3DFMT_D24S8: return TEXT("D3DFMT_D24S8"); + case D3DFMT_D24X8: return TEXT("D3DFMT_D24X8"); + case D3DFMT_D24X4S4: return TEXT("D3DFMT_D24X4S4"); + case D3DFMT_D16: return TEXT("D3DFMT_D16"); + case D3DFMT_D32F_LOCKABLE: return TEXT("D3DFMT_D32F_LOCKABLE"); + case D3DFMT_D24FS8: return TEXT("D3DFMT_D24FS8"); + + case D3DFMT_L16: return TEXT("D3DFMT_L16"); + + case D3DFMT_VERTEXDATA: return TEXT("D3DFMT_VERTEXDATA"); + case D3DFMT_INDEX16: return TEXT("D3DFMT_INDEX16"); + case D3DFMT_INDEX32: return TEXT("D3DFMT_INDEX32"); + + case D3DFMT_Q16W16V16U16: return TEXT("D3DFMT_Q16W16V16U16"); + + case D3DFMT_MULTI2_ARGB8: return TEXT("D3DFMT_MULTI2_ARGB8"); + + case D3DFMT_R16F: return TEXT("D3DFMT_R16F"); + case D3DFMT_G16R16F: return TEXT("D3DFMT_G16R16F"); + case D3DFMT_A16B16G16R16F: return TEXT("D3DFMT_A16B16G16R16F"); + + case D3DFMT_R32F: return TEXT("D3DFMT_R32F"); + case D3DFMT_G32R32F: return TEXT("D3DFMT_G32R32F"); + case D3DFMT_A32B32G32R32F: return TEXT("D3DFMT_A32B32G32R32F"); + + case D3DFMT_CxV8U8: return TEXT("D3DFMT_CxV8U8"); + + case D3DFMT_D32_LOCKABLE: return TEXT("D3DFMT_D32_LOCKABLE"); + case D3DFMT_S8_LOCKABLE: return TEXT("D3DFMT_S8_LOCKABLE"); + case D3DFMT_A1: return TEXT("D3DFMT_A1"); + + default: return TEXT("Unknown format"); + } + } + + + //----------------------------------------------------------------------------- + const TCHAR* MultiSampleTypeName(D3DMULTISAMPLE_TYPE msType) + { + switch (msType) + { + case D3DMULTISAMPLE_NONE: return TEXT("D3DMULTISAMPLE_NONE"); + case D3DMULTISAMPLE_NONMASKABLE: return TEXT("D3DMULTISAMPLE_NONMASKABLE"); + case D3DMULTISAMPLE_2_SAMPLES: return TEXT("D3DMULTISAMPLE_2_SAMPLES"); + case D3DMULTISAMPLE_3_SAMPLES: return TEXT("D3DMULTISAMPLE_3_SAMPLES"); + case D3DMULTISAMPLE_4_SAMPLES: return TEXT("D3DMULTISAMPLE_4_SAMPLES"); + case D3DMULTISAMPLE_5_SAMPLES: return TEXT("D3DMULTISAMPLE_5_SAMPLES"); + case D3DMULTISAMPLE_6_SAMPLES: return TEXT("D3DMULTISAMPLE_6_SAMPLES"); + case D3DMULTISAMPLE_7_SAMPLES: return TEXT("D3DMULTISAMPLE_7_SAMPLES"); + case D3DMULTISAMPLE_8_SAMPLES: return TEXT("D3DMULTISAMPLE_8_SAMPLES"); + case D3DMULTISAMPLE_9_SAMPLES: return TEXT("D3DMULTISAMPLE_9_SAMPLES"); + case D3DMULTISAMPLE_10_SAMPLES: return TEXT("D3DMULTISAMPLE_10_SAMPLES"); + case D3DMULTISAMPLE_11_SAMPLES: return TEXT("D3DMULTISAMPLE_11_SAMPLES"); + case D3DMULTISAMPLE_12_SAMPLES: return TEXT("D3DMULTISAMPLE_12_SAMPLES"); + case D3DMULTISAMPLE_13_SAMPLES: return TEXT("D3DMULTISAMPLE_13_SAMPLES"); + case D3DMULTISAMPLE_14_SAMPLES: return TEXT("D3DMULTISAMPLE_14_SAMPLES"); + case D3DMULTISAMPLE_15_SAMPLES: return TEXT("D3DMULTISAMPLE_15_SAMPLES"); + case D3DMULTISAMPLE_16_SAMPLES: return TEXT("D3DMULTISAMPLE_16_SAMPLES"); + default: return TEXT("Unknown type"); + } + } + + + //----------------------------------------------------------------------------- + // lParam1 is the adapter index + //----------------------------------------------------------------------------- + HRESULT DXGDisplayAdapterInfo(LPARAM lParam1, LPARAM /*lParam2*/, + _In_opt_ PRINTCBINFO* pPrintInfo) + { + auto iAdapter = static_cast(lParam1); + + if (!g_pD3D) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 15); + LVAddColumn(g_hwndLV, 1, "Value", 40); + } + + D3DADAPTER_IDENTIFIER9 identifier; + HRESULT hr = g_pD3D->GetAdapterIdentifier(iAdapter, D3DENUM_WHQL_LEVEL, &identifier); + if (FAILED(hr)) + return hr; + + GUID guid = identifier.DeviceIdentifier; + TCHAR szGuid[50]; + sprintf_s(szGuid, sizeof(szGuid), TEXT("{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"), + guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], + guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); + + TCHAR szVersion[50]; + sprintf_s(szVersion, sizeof(szVersion), TEXT("0x%08X-%08X"), identifier.DriverVersion.HighPart, + identifier.DriverVersion.LowPart); + + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "Driver"); + LVAddText(g_hwndLV, 1, "%s", identifier.Driver); + + LVAddText(g_hwndLV, 0, "Description"); + LVAddText(g_hwndLV, 1, "%s", identifier.Description); + + LVAddText(g_hwndLV, 0, "DeviceName"); + LVAddText(g_hwndLV, 1, "%s", identifier.DeviceName); + + LVAddText(g_hwndLV, 0, "DriverVersion"); + LVAddText(g_hwndLV, 1, "%s", szVersion); + + LVAddText(g_hwndLV, 0, "VendorId"); + LVAddText(g_hwndLV, 1, "0x%08x", identifier.VendorId); + + LVAddText(g_hwndLV, 0, "DeviceId"); + LVAddText(g_hwndLV, 1, "0x%08x", identifier.DeviceId); + + LVAddText(g_hwndLV, 0, "SubSysId"); + LVAddText(g_hwndLV, 1, "0x%08x", identifier.SubSysId); + + LVAddText(g_hwndLV, 0, "Revision"); + LVAddText(g_hwndLV, 1, "%d", identifier.Revision); + + LVAddText(g_hwndLV, 0, "DeviceIdentifier"); + LVAddText(g_hwndLV, 1, szGuid); + + LVAddText(g_hwndLV, 0, "WHQLLevel"); + LVAddText(g_hwndLV, 1, "%d", identifier.WHQLLevel); + } + else + { + PrintStringValueLine("Driver", identifier.Driver, pPrintInfo); + PrintStringValueLine("Description", identifier.Description, pPrintInfo); + PrintStringValueLine("DriverVersion", szVersion, pPrintInfo); + PrintHexValueLine("VendorId", identifier.VendorId, pPrintInfo); + PrintHexValueLine("DeviceId", identifier.DeviceId, pPrintInfo); + PrintHexValueLine("SubSysId", identifier.SubSysId, pPrintInfo); + PrintValueLine("Revision", identifier.Revision, pPrintInfo); + PrintStringValueLine("DeviceIdentifier", szGuid, pPrintInfo); + PrintValueLine("WHQLLevel", identifier.WHQLLevel, pPrintInfo); + } + return S_OK; + } + + + //----------------------------------------------------------------------------- + // lParam1 is the adapter index + //----------------------------------------------------------------------------- + HRESULT DXGDisplayModes(LPARAM lParam1, LPARAM /*lParam2*/, _In_opt_ PRINTCBINFO* pPrintInfo) + { + auto iAdapter = static_cast(lParam1); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Resolution", 10); + LVAddColumn(g_hwndLV, 1, "Pixel Format", 15); + LVAddColumn(g_hwndLV, 2, "Refresh Rate", 10); + } + + for (INT iFormat = 0; iFormat < NumAdapterFormats; iFormat++) + { + D3DFORMAT fmt = AdapterFormatArray[iFormat]; + UINT numModes = g_pD3D->GetAdapterModeCount(iAdapter, fmt); + for (UINT iMode = 0; iMode < numModes; iMode++) { - if( usageArray[iUsage] != 0 && - usageArray[iUsage] != D3DUSAGE_DEPTHSTENCIL && - usageArray[iUsage] != D3DUSAGE_RENDERTARGET ) + D3DDISPLAYMODE mode; + g_pD3D->EnumAdapterModes(iAdapter, fmt, iMode, &mode); + if (!pPrintInfo) { - continue; + LVAddText(g_hwndLV, 0, "%d x %d", mode.Width, mode.Height); + LVAddText(g_hwndLV, 1, FormatName(mode.Format)); + LVAddText(g_hwndLV, 2, "%d", mode.RefreshRate); } - } - if( RType == D3DRTYPE_VOLUMETEXTURE ) - { - if( usageArray[iUsage] == D3DUSAGE_DEPTHSTENCIL || - usageArray[iUsage] == D3DUSAGE_RENDERTARGET || - usageArray[iUsage] == D3DUSAGE_AUTOGENMIPMAP || - usageArray[iUsage] == D3DUSAGE_DMAP ) + else { - continue; + char szBuff[80]; + DWORD cchLen; + int x1, x2, x3, yLine; + + // Calculate Name and Value column x offsets + x1 = (pPrintInfo->dwCurrIndent * DEF_TAB_SIZE * pPrintInfo->dwCharWidth); + x2 = x1 + (20 * pPrintInfo->dwCharWidth); + x3 = x2 + (20 * pPrintInfo->dwCharWidth); + yLine = (pPrintInfo->dwCurrLine * pPrintInfo->dwLineHeight); + + sprintf_s(szBuff, sizeof(szBuff), "%u x %u", mode.Width, mode.Height); + cchLen = static_cast(_tcslen(szBuff)); + if (FAILED(PrintLine(x1, yLine, szBuff, cchLen, pPrintInfo))) + return E_FAIL; + + strcpy_s(szBuff, sizeof(szBuff), FormatName(mode.Format)); + cchLen = static_cast(_tcslen(szBuff)); + if (FAILED(PrintLine(x2, yLine, szBuff, cchLen, pPrintInfo))) + return E_FAIL; + + sprintf_s(szBuff, sizeof(szBuff), "%u", mode.RefreshRate); + cchLen = static_cast(_tcslen(szBuff)); + if (FAILED(PrintLine(x3, yLine, szBuff, cchLen, pPrintInfo))) + return E_FAIL; + + // Advance to next line on page + if (FAILED(PrintNextLine(pPrintInfo))) + return E_FAIL; } } - if( RType == D3DRTYPE_CUBETEXTURE ) - { - if( usageArray[iUsage] == D3DUSAGE_DMAP ) - { - continue; - } - } - if( usageArray[iUsage] == D3DUSAGE_DMAP ) - { - if( (Caps.DevCaps2 & D3DDEVCAPS2_DMAPNPATCH) == 0 && - (Caps.DevCaps2 & D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH) == 0 ) - { - continue; - } - } - if( fmt == D3DFMT_MULTI2_ARGB8 && usageArray[iUsage] == D3DUSAGE_AUTOGENMIPMAP ) - { - continue; - } - if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, - usageArray[iUsage], RType, fmt))) - { - bFoundSuccess = TRUE; - break; - } } - if( bFoundSuccess ) - { - col = 0; - // Add list item for this format - if (pPrintInfo == NULL) - LVAddText( g_hwndLV, col++, "%s", FormatName(fmt)); - else - PrintStringLine(FormatName(fmt), pPrintInfo); + return S_OK; + } - // Show which usages it is compatible with - for( UINT iUsage = 0; iUsage < numUsages; iUsage++ ) + //----------------------------------------------------------------------------- + // lParam1 is the caps pointer + // lParam2 is the CAPDEF table we should use + //----------------------------------------------------------------------------- + HRESULT DXGDisplayCaps(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pPrintInfo) + { + auto pCaps = reinterpret_cast(lParam1); + auto pCapDef = reinterpret_cast(lParam2); + + if (pPrintInfo) + return PrintCapsToDC(pCapDef, (VOID*)pCaps, pPrintInfo); + else + AddCapsToLV(pCapDef, (LPVOID)pCaps); + + return S_OK; + } + + //----------------------------------------------------------------------------- + // lParam1 is the iAdapter and device type + // lParam2 is bWindowed and the msType + // lParam3 is the render format + //----------------------------------------------------------------------------- + HRESULT DXGDisplayMultiSample(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, _In_opt_ PRINTCBINFO* pPrintInfo) + { + UINT iAdapter = LOWORD(lParam1); + auto devType = static_cast(HIWORD(lParam1)); + BOOL bWindowed = (BOOL)LOWORD(lParam2); + auto msType = static_cast(HIWORD(lParam2)); + auto fmt = static_cast(lParam3); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Quality Levels", 30); + } + + DWORD dwNumQualityLevels; + if (SUCCEEDED(g_pD3D->CheckDeviceMultiSampleType(iAdapter, devType, fmt, bWindowed, msType, &dwNumQualityLevels))) + { + TCHAR str[100]; + if (dwNumQualityLevels == 1) + sprintf_s(str, sizeof(str), "%u quality level", dwNumQualityLevels); + else + sprintf_s(str, sizeof(str), "%u quality levels", dwNumQualityLevels); + if (!pPrintInfo) { - if( RType == D3DRTYPE_SURFACE ) + LVAddText(g_hwndLV, 0, str); + } + else + { + PrintStringLine(str, pPrintInfo); + } + } + + return S_OK; + } + + //----------------------------------------------------------------------------- + // lParam1 is the iAdapter and device type + // lParam2 is the adapter fmt + // lParam3 is bWindowed + //----------------------------------------------------------------------------- + HRESULT DXGDisplayBackBuffer(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, _In_opt_ PRINTCBINFO* pPrintInfo) + { + UINT iAdapter = LOWORD(lParam1); + auto devType = static_cast(HIWORD(lParam1)); + auto fmtAdapter = static_cast(lParam2); + auto bWindowed = static_cast(lParam3); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Back Buffer Formats", 20); + } + + for (int iFmt = 0; iFmt < NumBBFormats; iFmt++) + { + D3DFORMAT fmt = BBFormatArray[iFmt]; + if (SUCCEEDED(g_pD3D->CheckDeviceType(iAdapter, devType, fmtAdapter, fmt, bWindowed))) + { + if (!pPrintInfo) { - if( usageArray[iUsage] != 0 && + LVAddText(g_hwndLV, 0, "%s", FormatName(fmt)); + } + else + { + PrintStringLine(FormatName(fmt), pPrintInfo); + } + } + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + // lParam1 is the iAdapter and device type + // lParam2 is the adapter fmt + // lParam3 is unused + //----------------------------------------------------------------------------- + HRESULT DXGDisplayRenderTarget(LPARAM lParam1, LPARAM lParam2, LPARAM /*lParam3*/, _In_opt_ PRINTCBINFO* pPrintInfo) + { + UINT iAdapter = LOWORD(lParam1); + auto devType = static_cast(HIWORD(lParam1)); + auto fmtAdapter = static_cast(lParam2); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Render Target Formats", 20); + } + + for (int iFmt = 0; iFmt < NumFormats; iFmt++) + { + D3DFORMAT fmt = AllFormatArray[iFmt]; + if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, D3DUSAGE_RENDERTARGET, + D3DRTYPE_SURFACE, fmt))) + { + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "%s", FormatName(fmt)); + } + else + { + PrintStringLine(FormatName(fmt), pPrintInfo); + } + } + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + // lParam1 is the iAdapter and device type + // lParam2 is the adapter fmt + // lParam3 is unused + //----------------------------------------------------------------------------- + HRESULT DXGDisplayDepthStencil(LPARAM lParam1, LPARAM lParam2, LPARAM /*lParam3*/, _In_opt_ PRINTCBINFO* pPrintInfo) + { + UINT iAdapter = LOWORD(lParam1); + auto devType = static_cast(HIWORD(lParam1)); + auto fmtAdapter = static_cast(lParam2); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Depth/Stencil Formats", 20); + } + + for (int iFmt = 0; iFmt < NumDSFormats; iFmt++) + { + D3DFORMAT fmt = DSFormatArray[iFmt]; + + if (!g_is9Ex && ((fmt == D3DFMT_D32_LOCKABLE) || (fmt == D3DFMT_S8_LOCKABLE))) + continue; + + if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, D3DUSAGE_DEPTHSTENCIL, + D3DRTYPE_SURFACE, fmt))) + { + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "%s", FormatName(fmt)); + } + else + { + PrintStringLine(FormatName(fmt), pPrintInfo); + } + } + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + // lParam1 is the iAdapter and device type + // lParam2 is the depth/stencil fmt + // lParam3 is the msType + //----------------------------------------------------------------------------- + HRESULT DXGCheckDSQualityLevels(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, _In_opt_ PRINTCBINFO* pPrintInfo) + { + UINT iAdapter = LOWORD(lParam1); + auto devType = static_cast(HIWORD(lParam1)); + auto fmtDS = static_cast(lParam2); + auto msType = static_cast(lParam3); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Quality Levels", 20); + } + + DWORD dwNumQualityLevels; + if (SUCCEEDED(g_pD3D->CheckDeviceMultiSampleType(iAdapter, devType, fmtDS, FALSE, msType, &dwNumQualityLevels))) + { + TCHAR str[100]; + if (dwNumQualityLevels == 1) + sprintf_s(str, sizeof(str), "%u quality level", dwNumQualityLevels); + else + sprintf_s(str, sizeof(str), "%u quality levels", dwNumQualityLevels); + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, str); + } + else + { + PrintStringLine(str, pPrintInfo); + } + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + // lParam1 is the iAdapter and device type + // lParam2 is the adapter fmt + // lParam3 is unused + //----------------------------------------------------------------------------- + HRESULT DXGDisplayPlainSurface(LPARAM lParam1, LPARAM lParam2, LPARAM /*lParam3*/, _In_opt_ PRINTCBINFO* pPrintInfo) + { + UINT iAdapter = LOWORD(lParam1); + auto devType = static_cast(HIWORD(lParam1)); + D3DFORMAT fmtAdapter = static_cast(lParam2); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Plain Surface Formats", 20); + } + + for (int iFmt = 0; iFmt < NumFormats; iFmt++) + { + D3DFORMAT fmt = AllFormatArray[iFmt]; + + if (!g_is9Ex && ((fmt == D3DFMT_A1) || (fmt == D3DFMT_D32_LOCKABLE) || (fmt == D3DFMT_S8_LOCKABLE))) + continue; + + if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, 0, + D3DRTYPE_SURFACE, fmt))) + { + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "%s", FormatName(fmt)); + } + else + { + PrintStringLine(FormatName(fmt), pPrintInfo); + } + } + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + // lParam1 is the iAdapter and device type + // lParam2 is the fmt of the swap chain + // lParam3 is the D3DRESOURCETYPE + //----------------------------------------------------------------------------- + HRESULT DXGDisplayResource(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, _In_opt_ PRINTCBINFO* pPrintInfo) + { + UINT iAdapter = LOWORD(lParam1); + auto devType = static_cast(HIWORD(lParam1)); + auto fmtAdapter = static_cast(lParam2); + auto RType = static_cast(lParam3); + const TCHAR* pstr; + HRESULT hr; + UINT col = 0; + + D3DCAPS9 Caps; + g_pD3D->GetDeviceCaps(iAdapter, devType, &Caps); + + if (!pPrintInfo) + { + switch (RType) + { + case D3DRTYPE_SURFACE: + LVAddColumn(g_hwndLV, col++, "Surface Formats", 20); + break; + case D3DRTYPE_VOLUME: + LVAddColumn(g_hwndLV, col++, "Volume Formats", 20); + break; + case D3DRTYPE_TEXTURE: + LVAddColumn(g_hwndLV, col++, "Texture Formats", 20); + break; + case D3DRTYPE_VOLUMETEXTURE: + LVAddColumn(g_hwndLV, col++, "Volume Texture Formats", 20); + break; + case D3DRTYPE_CUBETEXTURE: + LVAddColumn(g_hwndLV, col++, "Cube Texture Formats", 20); + break; + default: + return E_FAIL; + } + LVAddColumn(g_hwndLV, col++, "0 (Plain)", 22); + if (RType != D3DRTYPE_VOLUMETEXTURE) + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_RENDERTARGET", 22); + // LVAddColumn(g_hwndLV, col++, "D3DUSAGE_DEPTHSTENCIL", 22); + if (RType != D3DRTYPE_SURFACE) + { + if (RType != D3DRTYPE_VOLUMETEXTURE) + { + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_AUTOGENMIPMAP", 22); + if (RType != D3DRTYPE_CUBETEXTURE) + { + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_DMAP", 22); + } + } + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_LEGACYBUMPMAP", 22); + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_SRGBREAD", 18); + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_FILTER", 15); + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_SRGBWRITE", 18); + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING", 18); + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_VERTEXTEXTURE", 18); + LVAddColumn(g_hwndLV, col++, "D3DUSAGE_QUERY_WRAPANDMIP", 18); + } + } + const DWORD usageArray[] = + { + 0, + D3DUSAGE_RENDERTARGET, + // D3DUSAGE_DEPTHSTENCIL, + D3DUSAGE_AUTOGENMIPMAP, + D3DUSAGE_DMAP, + D3DUSAGE_QUERY_LEGACYBUMPMAP, + D3DUSAGE_QUERY_SRGBREAD, + D3DUSAGE_QUERY_FILTER, + D3DUSAGE_QUERY_SRGBWRITE, + D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, + D3DUSAGE_QUERY_VERTEXTEXTURE, + D3DUSAGE_QUERY_WRAPANDMIP, + }; + const DWORD numUsages = sizeof(usageArray) / sizeof(usageArray[0]); + BOOL bFoundSuccess; + for (int iFmt = 0; iFmt < NumFormats; iFmt++) + { + D3DFORMAT fmt = AllFormatArray[iFmt]; + + if (!g_is9Ex && ((fmt == D3DFMT_A1) || (fmt == D3DFMT_D32_LOCKABLE) || (fmt == D3DFMT_S8_LOCKABLE))) + continue; + + // First pass: see if CDF succeeds for any usage + bFoundSuccess = FALSE; + for (UINT iUsage = 0; iUsage < numUsages; iUsage++) + { + if (RType == D3DRTYPE_SURFACE) + { + if (usageArray[iUsage] != 0 && usageArray[iUsage] != D3DUSAGE_DEPTHSTENCIL && - usageArray[iUsage] != D3DUSAGE_RENDERTARGET ) + usageArray[iUsage] != D3DUSAGE_RENDERTARGET) { continue; } } - if( RType == D3DRTYPE_VOLUMETEXTURE ) + if (RType == D3DRTYPE_VOLUMETEXTURE) { - if( usageArray[iUsage] == D3DUSAGE_DEPTHSTENCIL || + if (usageArray[iUsage] == D3DUSAGE_DEPTHSTENCIL || usageArray[iUsage] == D3DUSAGE_RENDERTARGET || usageArray[iUsage] == D3DUSAGE_AUTOGENMIPMAP || - usageArray[iUsage] == D3DUSAGE_DMAP ) + usageArray[iUsage] == D3DUSAGE_DMAP) { continue; } } - if( RType == D3DRTYPE_CUBETEXTURE ) + if (RType == D3DRTYPE_CUBETEXTURE) { - if( usageArray[iUsage] == D3DUSAGE_DMAP ) + if (usageArray[iUsage] == D3DUSAGE_DMAP) { continue; } } - hr = S_OK; - if( usageArray[iUsage] == D3DUSAGE_DMAP ) + if (usageArray[iUsage] == D3DUSAGE_DMAP) { - if( (Caps.DevCaps2 & D3DDEVCAPS2_DMAPNPATCH) == 0 && - (Caps.DevCaps2 & D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH) == 0 ) + if ((Caps.DevCaps2 & D3DDEVCAPS2_DMAPNPATCH) == 0 && + (Caps.DevCaps2 & D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH) == 0) + { + continue; + } + } + if (fmt == D3DFMT_MULTI2_ARGB8 && usageArray[iUsage] == D3DUSAGE_AUTOGENMIPMAP) + { + continue; + } + if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, + usageArray[iUsage], RType, fmt))) + { + bFoundSuccess = TRUE; + break; + } + } + if (bFoundSuccess) + { + col = 0; + // Add list item for this format + if (!pPrintInfo) + LVAddText(g_hwndLV, col++, "%s", FormatName(fmt)); + else + PrintStringLine(FormatName(fmt), pPrintInfo); + + // Show which usages it is compatible with + for (UINT iUsage = 0; iUsage < numUsages; iUsage++) + { + if (RType == D3DRTYPE_SURFACE) + { + if (usageArray[iUsage] != 0 && + usageArray[iUsage] != D3DUSAGE_DEPTHSTENCIL && + usageArray[iUsage] != D3DUSAGE_RENDERTARGET) + { + continue; + } + } + if (RType == D3DRTYPE_VOLUMETEXTURE) + { + if (usageArray[iUsage] == D3DUSAGE_DEPTHSTENCIL || + usageArray[iUsage] == D3DUSAGE_RENDERTARGET || + usageArray[iUsage] == D3DUSAGE_AUTOGENMIPMAP || + usageArray[iUsage] == D3DUSAGE_DMAP) + { + continue; + } + } + if (RType == D3DRTYPE_CUBETEXTURE) + { + if (usageArray[iUsage] == D3DUSAGE_DMAP) + { + continue; + } + } + hr = S_OK; + if (usageArray[iUsage] == D3DUSAGE_DMAP) + { + if ((Caps.DevCaps2 & D3DDEVCAPS2_DMAPNPATCH) == 0 && + (Caps.DevCaps2 & D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH) == 0) + { + hr = E_FAIL; + } + } + if (fmt == D3DFMT_MULTI2_ARGB8 && usageArray[iUsage] == D3DUSAGE_AUTOGENMIPMAP) { hr = E_FAIL; } + if (SUCCEEDED(hr)) + { + hr = g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, + usageArray[iUsage], RType, fmt); + } + if (hr == D3DOK_NOAUTOGEN) + pstr = TEXT("No"); + else if (SUCCEEDED(hr)) + pstr = TEXT("Yes"); + else + pstr = TEXT("No"); + if (!pPrintInfo) + LVAddText(g_hwndLV, col++, pstr); + else + PrintStringLine(pstr, pPrintInfo); } - if( fmt == D3DFMT_MULTI2_ARGB8 && usageArray[iUsage] == D3DUSAGE_AUTOGENMIPMAP ) - { - hr = E_FAIL; - } - if( SUCCEEDED( hr ) ) - { - hr = g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, - usageArray[iUsage], RType, fmt); - } - if( hr == D3DOK_NOAUTOGEN ) - pstr = TEXT("No"); - else if(SUCCEEDED(hr)) - pstr = TEXT("Yes"); - else - pstr = TEXT("No"); - if (pPrintInfo == NULL) - LVAddText( g_hwndLV, col++, pstr); - else - PrintStringLine(pstr, pPrintInfo); } } + + return S_OK; } - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -BOOL IsBBFmt(D3DFORMAT fmt) -{ - D3DFORMAT fmtBackBuffer; - for (int iFmtBackBuffer = 0; iFmtBackBuffer < NumBBFormats; iFmtBackBuffer++) + //----------------------------------------------------------------------------- + BOOL IsBBFmt(D3DFORMAT fmt) { - fmtBackBuffer = BBFormatArray[iFmtBackBuffer]; - if( fmt == fmtBackBuffer ) - return TRUE; - } - return FALSE; -} - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -BOOL IsDeviceTypeAvailable(UINT iAdapter, D3DDEVTYPE devType) -{ - D3DFORMAT fmtAdapter; - for (int iFmtAdapter = 0; iFmtAdapter < NumAdapterFormats; iFmtAdapter++) - { - fmtAdapter = AdapterFormatArray[iFmtAdapter]; - if( IsAdapterFmtAvailable( iAdapter, devType, fmtAdapter, TRUE ) || - IsAdapterFmtAvailable( iAdapter, devType, fmtAdapter, FALSE ) ) + for (int iFmtBackBuffer = 0; iFmtBackBuffer < NumBBFormats; iFmtBackBuffer++) { - return TRUE; + D3DFORMAT fmtBackBuffer = BBFormatArray[iFmtBackBuffer]; + if (fmt == fmtBackBuffer) + return TRUE; } + return FALSE; } - return FALSE; -} - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -BOOL IsAdapterFmtAvailable(UINT iAdapter, D3DDEVTYPE devType, D3DFORMAT fmtAdapter, BOOL bWindowed) -{ - if( fmtAdapter == D3DFMT_A2R10G10B10 && bWindowed ) - return FALSE; // D3D extended primary formats are only avaiable for fullscreen mode - - D3DFORMAT fmtBackBuffer; - for (int iFmtBackBuffer = 0; iFmtBackBuffer < NumBBFormats; iFmtBackBuffer++) + //----------------------------------------------------------------------------- + BOOL IsDeviceTypeAvailable(UINT iAdapter, D3DDEVTYPE devType) { - fmtBackBuffer = BBFormatArray[iFmtBackBuffer]; - if (SUCCEEDED(g_pD3D->CheckDeviceType(iAdapter, devType, fmtAdapter, fmtBackBuffer, bWindowed))) + for (int iFmtAdapter = 0; iFmtAdapter < NumAdapterFormats; iFmtAdapter++) { - return TRUE; + D3DFORMAT fmtAdapter = AdapterFormatArray[iFmtAdapter]; + if (IsAdapterFmtAvailable(iAdapter, devType, fmtAdapter, TRUE) || + IsAdapterFmtAvailable(iAdapter, devType, fmtAdapter, FALSE)) + { + return TRUE; + } } + return FALSE; + } + + + //----------------------------------------------------------------------------- + BOOL IsAdapterFmtAvailable(UINT iAdapter, D3DDEVTYPE devType, D3DFORMAT fmtAdapter, BOOL bWindowed) + { + if (fmtAdapter == D3DFMT_A2R10G10B10 && bWindowed) + return FALSE; // D3D extended primary formats are only avaiable for fullscreen mode + + for (int iFmtBackBuffer = 0; iFmtBackBuffer < NumBBFormats; iFmtBackBuffer++) + { + D3DFORMAT fmtBackBuffer = BBFormatArray[iFmtBackBuffer]; + if (SUCCEEDED(g_pD3D->CheckDeviceType(iAdapter, devType, fmtAdapter, fmtBackBuffer, bWindowed))) + { + return TRUE; + } + } + return FALSE; } - return FALSE; } //----------------------------------------------------------------------------- // Name: DXG_Init() -// Desc: //----------------------------------------------------------------------------- VOID DXG_Init() { g_is9Ex = FALSE; - Direct3DCreate9ExFunc Direct3DCreate9Ex = NULL; - - HMODULE d3d9 = LoadLibraryEx("d3d9.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); - if (d3d9 != NULL) + g_hInstD3D = LoadLibraryEx("d3d9.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (g_hInstD3D) { - Direct3DCreate9Ex = (Direct3DCreate9ExFunc)GetProcAddress(d3d9, "Direct3DCreate9Ex"); - if (Direct3DCreate9Ex != NULL) + g_direct3DCreate9 = reinterpret_cast(GetProcAddress(g_hInstD3D, "Direct3DCreate9")); + g_direct3DCreate9Ex = reinterpret_cast(GetProcAddress(g_hInstD3D, "Direct3DCreate9Ex")); + + if (g_direct3DCreate9Ex) { - g_is9Ex = SUCCEEDED(Direct3DCreate9Ex(D3D_SDK_VERSION, &g_pD3D)); + g_is9Ex = SUCCEEDED(g_direct3DCreate9Ex(D3D_SDK_VERSION, &g_pD3D)); } - FreeLibrary(d3d9); - d3d9 = NULL; + if (!g_is9Ex && g_direct3DCreate9) + g_pD3D = g_direct3DCreate9(D3D_SDK_VERSION); } - - if (!g_is9Ex) - g_pD3D = Direct3DCreate9(D3D_SDK_VERSION); } - - //----------------------------------------------------------------------------- // Name: DXG_FillTree() -// Desc: //----------------------------------------------------------------------------- -VOID DXG_FillTree( HWND hwndTV ) +VOID DXG_FillTree(HWND hwndTV) { HRESULT hr; - HTREEITEM hTree; - HTREEITEM hTree2; - HTREEITEM hTree3; - HTREEITEM hTree4; - HTREEITEM hTree5; - HTREEITEM hTree6; - HTREEITEM hTree7; - HTREEITEM hTree8; - HTREEITEM hTree9; - HTREEITEM hTree10; - UINT numAdapters; - UINT iAdapter; - D3DADAPTER_IDENTIFIER9 identifier; D3DDEVTYPE deviceTypeArray[] = { D3DDEVTYPE_HAL, D3DDEVTYPE_SW, D3DDEVTYPE_REF }; D3DDEVTYPE devType; - TCHAR *deviceNameArray[] = { "HAL", "Software", "Reference" }; - UINT numDeviceTypes = sizeof(deviceTypeArray) / sizeof(deviceTypeArray[0]); UINT iDevice; D3DCAPS9 caps; D3DCAPS9* pCapsCopy; - if (g_pD3D == NULL) + static const TCHAR* deviceNameArray[] = { "HAL", "Software", "Reference" }; + static const UINT numDeviceTypes = sizeof(deviceTypeArray) / sizeof(deviceTypeArray[0]); + + if (!g_pD3D) return; - hTree = TVAddNode( TVI_ROOT, "Direct3D9 Devices", TRUE, IDI_DIRECTX, - NULL, 0, 0 ); + HTREEITEM hTree = TVAddNode(TVI_ROOT, "Direct3D9 Devices", TRUE, IDI_DIRECTX, + nullptr, 0, 0); - numAdapters = g_pD3D->GetAdapterCount(); - for (iAdapter = 0; iAdapter < numAdapters; iAdapter++) + UINT numAdapters = g_pD3D->GetAdapterCount(); + for (UINT iAdapter = 0; iAdapter < numAdapters; iAdapter++) { + D3DADAPTER_IDENTIFIER9 identifier; if (SUCCEEDED(g_pD3D->GetAdapterIdentifier(iAdapter, 0, &identifier))) { - hTree2 = TVAddNode(hTree, identifier.Description, TRUE, IDI_CAPS, - DXGDisplayAdapterInfo, iAdapter, 0 ); - (void)TVAddNode( hTree2, "Display Modes", FALSE, IDI_CAPS, - DXGDisplayModes, iAdapter, 0 ); - hTree3 = TVAddNode( hTree2, "D3D Device Types", TRUE, IDI_CAPS, - NULL, 0, 0 ); + HTREEITEM hTree2 = TVAddNode(hTree, identifier.Description, TRUE, IDI_CAPS, + DXGDisplayAdapterInfo, iAdapter, 0); + (void)TVAddNode(hTree2, "Display Modes", FALSE, IDI_CAPS, + DXGDisplayModes, iAdapter, 0); + HTREEITEM hTree3 = TVAddNode(hTree2, "D3D Device Types", TRUE, IDI_CAPS, + nullptr, 0, 0); for (iDevice = 0; iDevice < numDeviceTypes; iDevice++) { devType = deviceTypeArray[iDevice]; - if( devType == D3DDEVTYPE_SW ) + if (devType == D3DDEVTYPE_SW) continue; // we don't register a SW device, so just skip it if (!IsDeviceTypeAvailable(iAdapter, devType)) @@ -1707,28 +1618,28 @@ VOID DXG_FillTree( HWND hwndTV ) // Add caps for each device hr = g_pD3D->GetDeviceCaps(iAdapter, devType, &caps); if (FAILED(hr)) - memset(&caps,0,sizeof(caps)); + memset(&caps, 0, sizeof(caps)); pCapsCopy = new D3DCAPS9; - if (pCapsCopy == NULL) + if (!pCapsCopy) continue; *pCapsCopy = caps; - hTree4 = TVAddNode(hTree3, deviceNameArray[iDevice], TRUE, IDI_CAPS, NULL, 0, 0); + HTREEITEM hTree4 = TVAddNode(hTree3, deviceNameArray[iDevice], TRUE, IDI_CAPS, nullptr, 0, 0); AddCapsToTV(hTree4, DXGCapDefs, (LPARAM)pCapsCopy); // List adapter formats for each device - hTree5 = TVAddNode(hTree4, "Adapter Formats", TRUE, IDI_CAPS, NULL, 0, 0); + HTREEITEM hTree5 = TVAddNode(hTree4, "Adapter Formats", TRUE, IDI_CAPS, nullptr, 0, 0); D3DFORMAT fmtAdapter; for (int iFmtAdapter = 0; iFmtAdapter < NumAdapterFormats; iFmtAdapter++) { fmtAdapter = AdapterFormatArray[iFmtAdapter]; - for( BOOL bWindowed = FALSE; bWindowed < 2; bWindowed++ ) + for (BOOL bWindowed = FALSE; bWindowed < 2; bWindowed++) { if (!IsAdapterFmtAvailable(iAdapter, devType, fmtAdapter, bWindowed)) continue; - + TCHAR sz[100]; sprintf_s(sz, sizeof(sz), "%s %s", FormatName(fmtAdapter), bWindowed ? "(Windowed)" : "(Fullscreen)"); - hTree6 = TVAddNode(hTree5, sz, TRUE, IDI_CAPS, NULL, 0, 0); + HTREEITEM hTree6 = TVAddNode(hTree5, sz, TRUE, IDI_CAPS, nullptr, 0, 0); TVAddNodeEx(hTree6, "Back Buffer Formats", FALSE, IDI_CAPS, DXGDisplayBackBuffer, MAKELPARAM(iAdapter, (UINT)devType), (LPARAM)fmtAdapter, (LPARAM)bWindowed); TVAddNodeEx(hTree6, "Render Target Formats", FALSE, IDI_CAPS, DXGDisplayRenderTarget, MAKELPARAM(iAdapter, (UINT)devType), (LPARAM)fmtAdapter, (LPARAM)0); TVAddNodeEx(hTree6, "Depth/Stencil Formats", FALSE, IDI_CAPS, DXGDisplayDepthStencil, MAKELPARAM(iAdapter, (UINT)devType), (LPARAM)fmtAdapter, (LPARAM)0); @@ -1736,21 +1647,21 @@ VOID DXG_FillTree( HWND hwndTV ) TVAddNodeEx(hTree6, "Texture Formats", FALSE, IDI_CAPS, DXGDisplayResource, MAKELPARAM(iAdapter, (UINT)devType), (LPARAM)fmtAdapter, (LPARAM)D3DRTYPE_TEXTURE); TVAddNodeEx(hTree6, "Cube Texture Formats", FALSE, IDI_CAPS, DXGDisplayResource, MAKELPARAM(iAdapter, (UINT)devType), (LPARAM)fmtAdapter, (LPARAM)D3DRTYPE_CUBETEXTURE); TVAddNodeEx(hTree6, "Volume Texture Formats", FALSE, IDI_CAPS, DXGDisplayResource, MAKELPARAM(iAdapter, (UINT)devType), (LPARAM)fmtAdapter, (LPARAM)D3DRTYPE_VOLUMETEXTURE); - hTree7 = TVAddNode(hTree6, "Render Format Compatibility", TRUE, IDI_CAPS, NULL, 0, 0); + HTREEITEM hTree7 = TVAddNode(hTree6, "Render Format Compatibility", TRUE, IDI_CAPS, nullptr, 0, 0); D3DFORMAT fmtRender; for (int iFmtRender = 0; iFmtRender < NumFormats; iFmtRender++) { fmtRender = AllFormatArray[iFmtRender]; - if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, fmtRender)) || - IsBBFmt(fmtRender) && SUCCEEDED(g_pD3D->CheckDeviceType(iAdapter, devType, fmtAdapter, fmtRender, bWindowed))) + if (SUCCEEDED(g_pD3D->CheckDeviceFormat(iAdapter, devType, fmtAdapter, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, fmtRender)) + || (IsBBFmt(fmtRender) && SUCCEEDED(g_pD3D->CheckDeviceType(iAdapter, devType, fmtAdapter, fmtRender, bWindowed)))) { - hTree8 = TVAddNode(hTree7, FormatName(fmtRender), TRUE, IDI_CAPS, NULL, 0, 0); + HTREEITEM hTree8 = TVAddNode(hTree7, FormatName(fmtRender), TRUE, IDI_CAPS, nullptr, 0, 0); for (D3DMULTISAMPLE_TYPE msType = D3DMULTISAMPLE_NONE; msType <= D3DMULTISAMPLE_16_SAMPLES; msType = (D3DMULTISAMPLE_TYPE)((UINT)msType + 1)) { - if (SUCCEEDED(g_pD3D->CheckDeviceMultiSampleType(iAdapter, devType, fmtRender, bWindowed, msType, NULL))) + if (SUCCEEDED(g_pD3D->CheckDeviceMultiSampleType(iAdapter, devType, fmtRender, bWindowed, msType, nullptr))) { - hTree9 = TVAddNodeEx(hTree8, MultiSampleTypeName(msType), TRUE, IDI_CAPS, DXGDisplayMultiSample, MAKELPARAM(iAdapter, (UINT)devType), MAKELPARAM(bWindowed, (UINT)msType), (LPARAM)fmtRender); - hTree10 = TVAddNode(hTree9, "Compatible Depth/Stencil Formats", TRUE, IDI_CAPS, NULL, 0, 0); + HTREEITEM hTree9 = TVAddNodeEx(hTree8, MultiSampleTypeName(msType), TRUE, IDI_CAPS, DXGDisplayMultiSample, MAKELPARAM(iAdapter, (UINT)devType), MAKELPARAM(bWindowed, (UINT)msType), (LPARAM)fmtRender); + HTREEITEM hTree10 = TVAddNode(hTree9, "Compatible Depth/Stencil Formats", TRUE, IDI_CAPS, nullptr, 0, 0); D3DFORMAT DSFmt; for (int iFmt = 0; iFmt < NumDSFormats; iFmt++) { @@ -1760,7 +1671,7 @@ VOID DXG_FillTree( HWND hwndTV ) { if (SUCCEEDED(g_pD3D->CheckDepthStencilMatch(iAdapter, devType, fmtAdapter, fmtRender, DSFmt))) { - if (SUCCEEDED(g_pD3D->CheckDeviceMultiSampleType(iAdapter, devType, DSFmt, bWindowed, msType, NULL))) + if (SUCCEEDED(g_pD3D->CheckDeviceMultiSampleType(iAdapter, devType, DSFmt, bWindowed, msType, nullptr))) { (void)TVAddNodeEx(hTree10, FormatName(DSFmt), FALSE, IDI_CAPS, DXGCheckDSQualityLevels, MAKELPARAM(iAdapter, (UINT)devType), (LPARAM)DSFmt, (LPARAM)msType); } @@ -1777,24 +1688,24 @@ VOID DXG_FillTree( HWND hwndTV ) } } - TreeView_Expand( hwndTV, hTree, TVE_EXPAND ); + TreeView_Expand(hwndTV, hTree, TVE_EXPAND); } - - //----------------------------------------------------------------------------- // Name: DXG_CleanUp() // Desc: //----------------------------------------------------------------------------- VOID DXG_CleanUp() { - if( g_pD3D ) + if (g_pD3D) g_pD3D->Release(); + + // TODO - } BOOL DXG_Is9Ex() { - return (BOOL)g_is9Ex; + return g_is9Ex; } diff --git a/dxgi.cpp b/dxgi.cpp index 2cbd8ac..f534f91 100644 --- a/dxgi.cpp +++ b/dxgi.cpp @@ -1,16 +1,15 @@ //----------------------------------------------------------------------------- -// Name: DXGI.cpp +// Name: dxgi.cpp // -// Desc: DX Graphics stuff for Direct3D 10.x / 11.x / 12.0 +// Desc: DirectX Capabilities Viewer for DXGI (Direct3D 10.x / 11.x / 12.0) // // Copyright Microsoft Corporation. All Rights Reserved. //----------------------------------------------------------------------------- #include "dxview.h" + #include -#include #include #include -#include #include #include @@ -21,9 +20,9 @@ enum FLMASK { - FLMASK_9_1 = 0x1, - FLMASK_9_2 = 0x2, - FLMASK_9_3 = 0x4, + FLMASK_9_1 = 0x1, + FLMASK_9_2 = 0x2, + FLMASK_9_3 = 0x4, FLMASK_10_0 = 0x8, FLMASK_10_1 = 0x10, FLMASK_11_0 = 0x20, @@ -41,7 +40,7 @@ namespace const char* D3D11_NOTE1 = "Most Direct3D 11.1 features are required. Tool only shows optional features."; const char* D3D11_NOTE2 = "Most Direct3D 11.2 features are required. Tool only shows optional features."; const char* D3D11_NOTE3 = "Most Direct3D 11.3 features are required. Tool only shows optional features."; - const char* D3D11_NOTE4 = "Most Direct3D 11.3/11.4 features are required. Tool only shows optional features."; + const char* D3D11_NOTE4 = "Most Direct3D 11.x features are required. Tool only shows optional features."; const char* _10L9_NOTE = "Most 10level9 features are required. Tool only shows optional features."; const char* SEE_D3D10 = "See Direct3D 10 node for device details."; const char* SEE_D3D10_1 = "See Direct3D 10.1 node for device details."; @@ -49,16 +48,25 @@ namespace const char* SEE_D3D11_1 = "See Direct3D 11.1 node for device details."; const char* FL_NOTE = "This feature summary is derived from hardware feature level"; -} -//----------------------------------------------------------------------------- + static_assert(sizeof(D3D10_NOTE) < 80, "String too long"); + static_assert(sizeof(D3D10_NOTE1) < 80, "String too long"); + static_assert(sizeof(D3D11_NOTE) < 80, "String too long"); + static_assert(sizeof(D3D11_NOTE1) < 80, "String too long"); + static_assert(sizeof(D3D11_NOTE2) < 80, "String too long"); + static_assert(sizeof(D3D11_NOTE3) < 80, "String too long"); + static_assert(sizeof(D3D11_NOTE4) < 80, "String too long"); + static_assert(sizeof(_10L9_NOTE) < 80, "String too long"); + static_assert(sizeof(SEE_D3D10) < 80, "String too long"); + static_assert(sizeof(SEE_D3D10_1) < 80, "String too long"); + static_assert(sizeof(SEE_D3D11) < 80, "String too long"); + static_assert(sizeof(SEE_D3D11_1) < 80, "String too long"); -typedef HRESULT ( WINAPI* LPCREATEDXGIFACTORY )( REFIID, void** ); -typedef HRESULT ( WINAPI* LPD3D10CREATEDEVICE )( IDXGIAdapter*, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT32, - ID3D10Device** ); + //----------------------------------------------------------------------------- + + using LPCREATEDXGIFACTORY = HRESULT(WINAPI*)(REFIID, void**); + using LPD3D10CREATEDEVICE = HRESULT(WINAPI*)(IDXGIAdapter*, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT32, ID3D10Device**); -namespace -{ IDXGIFactory* g_DXGIFactory = nullptr; IDXGIFactory1* g_DXGIFactory1 = nullptr; IDXGIFactory2* g_DXGIFactory2 = nullptr; @@ -80,16 +88,10 @@ namespace HMODULE g_d3d12 = nullptr; } -extern HRESULT PrintValueLine( const CHAR* szText, DWORD dwValue, PRINTCBINFO *lpInfo ); -extern HRESULT PrintHexValueLine( const CHAR* szText, DWORD dwValue, PRINTCBINFO *lpInfo ); -extern HRESULT PrintStringValueLine( const CHAR* szText, const CHAR* szText2, PRINTCBINFO *lpInfo ); -extern HRESULT PrintStringLine( const CHAR * szText, PRINTCBINFO *lpInfo ); - extern DWORD g_dwViewState; -extern char c_szYes[]; -extern char c_szNo[]; - -char c_szNA[] = "n/a"; +extern const char c_szYes[]; +extern const char c_szNo[]; +extern const char c_szNA[]; namespace { @@ -103,15 +105,15 @@ namespace }; // The DXGI formats that can be used as display devices - DXGI_FORMAT AdapterFormatArray[] = + const DXGI_FORMAT AdapterFormatArray[] = { - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, - DXGI_FORMAT_R8G8B8A8_UNORM, - DXGI_FORMAT_R16G16B16A16_FLOAT, - DXGI_FORMAT_R10G10B10A2_UNORM, - DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, // DXGI 1.1 - DXGI_FORMAT_B8G8R8A8_UNORM, // DXGI 1.1 - DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, // DXGI 1.1 + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R10G10B10A2_UNORM, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, // DXGI 1.1 + DXGI_FORMAT_B8G8R8A8_UNORM, // DXGI 1.1 + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, // DXGI 1.1 }; const UINT NumAdapterFormats = sizeof(AdapterFormatArray) / sizeof(AdapterFormatArray[0]); @@ -253,7 +255,7 @@ namespace D3D_FEATURE_LEVEL_9_1 }; - D3D_FEATURE_LEVEL GetD3D12FeatureLevel(_In_ ID3D12Device *device) + D3D_FEATURE_LEVEL GetD3D12FeatureLevel(_In_ ID3D12Device* device) { D3D12_FEATURE_DATA_FEATURE_LEVELS flData = {}; flData.NumFeatureLevels = 4; // D3D12 requires FL 11.0 or greater @@ -264,6 +266,4706 @@ namespace return static_cast(0); } + + //----------------------------------------------------------------------------- +#define ENUMNAME(a) case a: return TEXT(#a) + + const TCHAR* FormatName(DXGI_FORMAT format) + { + switch (format) + { + ENUMNAME(DXGI_FORMAT_R32G32B32A32_TYPELESS); + ENUMNAME(DXGI_FORMAT_R32G32B32A32_FLOAT); + ENUMNAME(DXGI_FORMAT_R32G32B32A32_UINT); + ENUMNAME(DXGI_FORMAT_R32G32B32A32_SINT); + ENUMNAME(DXGI_FORMAT_R32G32B32_TYPELESS); + ENUMNAME(DXGI_FORMAT_R32G32B32_FLOAT); + ENUMNAME(DXGI_FORMAT_R32G32B32_UINT); + ENUMNAME(DXGI_FORMAT_R32G32B32_SINT); + ENUMNAME(DXGI_FORMAT_R16G16B16A16_TYPELESS); + ENUMNAME(DXGI_FORMAT_R16G16B16A16_FLOAT); + ENUMNAME(DXGI_FORMAT_R16G16B16A16_UNORM); + ENUMNAME(DXGI_FORMAT_R16G16B16A16_UINT); + ENUMNAME(DXGI_FORMAT_R16G16B16A16_SNORM); + ENUMNAME(DXGI_FORMAT_R16G16B16A16_SINT); + ENUMNAME(DXGI_FORMAT_R32G32_TYPELESS); + ENUMNAME(DXGI_FORMAT_R32G32_FLOAT); + ENUMNAME(DXGI_FORMAT_R32G32_UINT); + ENUMNAME(DXGI_FORMAT_R32G32_SINT); + ENUMNAME(DXGI_FORMAT_R32G8X24_TYPELESS); + ENUMNAME(DXGI_FORMAT_D32_FLOAT_S8X24_UINT); + ENUMNAME(DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS); + ENUMNAME(DXGI_FORMAT_X32_TYPELESS_G8X24_UINT); + ENUMNAME(DXGI_FORMAT_R10G10B10A2_TYPELESS); + ENUMNAME(DXGI_FORMAT_R10G10B10A2_UNORM); + ENUMNAME(DXGI_FORMAT_R10G10B10A2_UINT); + ENUMNAME(DXGI_FORMAT_R11G11B10_FLOAT); + ENUMNAME(DXGI_FORMAT_R8G8B8A8_TYPELESS); + ENUMNAME(DXGI_FORMAT_R8G8B8A8_UNORM); + ENUMNAME(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB); + ENUMNAME(DXGI_FORMAT_R8G8B8A8_UINT); + ENUMNAME(DXGI_FORMAT_R8G8B8A8_SNORM); + ENUMNAME(DXGI_FORMAT_R8G8B8A8_SINT); + ENUMNAME(DXGI_FORMAT_R16G16_TYPELESS); + ENUMNAME(DXGI_FORMAT_R16G16_FLOAT); + ENUMNAME(DXGI_FORMAT_R16G16_UNORM); + ENUMNAME(DXGI_FORMAT_R16G16_UINT); + ENUMNAME(DXGI_FORMAT_R16G16_SNORM); + ENUMNAME(DXGI_FORMAT_R16G16_SINT); + ENUMNAME(DXGI_FORMAT_R32_TYPELESS); + ENUMNAME(DXGI_FORMAT_D32_FLOAT); + ENUMNAME(DXGI_FORMAT_R32_FLOAT); + ENUMNAME(DXGI_FORMAT_R32_UINT); + ENUMNAME(DXGI_FORMAT_R32_SINT); + ENUMNAME(DXGI_FORMAT_R24G8_TYPELESS); + ENUMNAME(DXGI_FORMAT_D24_UNORM_S8_UINT); + ENUMNAME(DXGI_FORMAT_R24_UNORM_X8_TYPELESS); + ENUMNAME(DXGI_FORMAT_X24_TYPELESS_G8_UINT); + ENUMNAME(DXGI_FORMAT_R8G8_TYPELESS); + ENUMNAME(DXGI_FORMAT_R8G8_UNORM); + ENUMNAME(DXGI_FORMAT_R8G8_UINT); + ENUMNAME(DXGI_FORMAT_R8G8_SNORM); + ENUMNAME(DXGI_FORMAT_R8G8_SINT); + ENUMNAME(DXGI_FORMAT_R16_TYPELESS); + ENUMNAME(DXGI_FORMAT_R16_FLOAT); + ENUMNAME(DXGI_FORMAT_D16_UNORM); + ENUMNAME(DXGI_FORMAT_R16_UNORM); + ENUMNAME(DXGI_FORMAT_R16_UINT); + ENUMNAME(DXGI_FORMAT_R16_SNORM); + ENUMNAME(DXGI_FORMAT_R16_SINT); + ENUMNAME(DXGI_FORMAT_R8_TYPELESS); + ENUMNAME(DXGI_FORMAT_R8_UNORM); + ENUMNAME(DXGI_FORMAT_R8_UINT); + ENUMNAME(DXGI_FORMAT_R8_SNORM); + ENUMNAME(DXGI_FORMAT_R8_SINT); + ENUMNAME(DXGI_FORMAT_A8_UNORM); + ENUMNAME(DXGI_FORMAT_R1_UNORM); + ENUMNAME(DXGI_FORMAT_R9G9B9E5_SHAREDEXP); + ENUMNAME(DXGI_FORMAT_R8G8_B8G8_UNORM); + ENUMNAME(DXGI_FORMAT_G8R8_G8B8_UNORM); + ENUMNAME(DXGI_FORMAT_BC1_TYPELESS); + ENUMNAME(DXGI_FORMAT_BC1_UNORM); + ENUMNAME(DXGI_FORMAT_BC1_UNORM_SRGB); + ENUMNAME(DXGI_FORMAT_BC2_TYPELESS); + ENUMNAME(DXGI_FORMAT_BC2_UNORM); + ENUMNAME(DXGI_FORMAT_BC2_UNORM_SRGB); + ENUMNAME(DXGI_FORMAT_BC3_TYPELESS); + ENUMNAME(DXGI_FORMAT_BC3_UNORM); + ENUMNAME(DXGI_FORMAT_BC3_UNORM_SRGB); + ENUMNAME(DXGI_FORMAT_BC4_TYPELESS); + ENUMNAME(DXGI_FORMAT_BC4_UNORM); + ENUMNAME(DXGI_FORMAT_BC4_SNORM); + ENUMNAME(DXGI_FORMAT_BC5_TYPELESS); + ENUMNAME(DXGI_FORMAT_BC5_UNORM); + ENUMNAME(DXGI_FORMAT_BC5_SNORM); + ENUMNAME(DXGI_FORMAT_B5G6R5_UNORM); + ENUMNAME(DXGI_FORMAT_B5G5R5A1_UNORM); + ENUMNAME(DXGI_FORMAT_B8G8R8A8_UNORM); + ENUMNAME(DXGI_FORMAT_B8G8R8X8_UNORM); + ENUMNAME(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM); + ENUMNAME(DXGI_FORMAT_B8G8R8A8_TYPELESS); + ENUMNAME(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); + ENUMNAME(DXGI_FORMAT_B8G8R8X8_TYPELESS); + ENUMNAME(DXGI_FORMAT_B8G8R8X8_UNORM_SRGB); + ENUMNAME(DXGI_FORMAT_BC6H_TYPELESS); + ENUMNAME(DXGI_FORMAT_BC6H_UF16); + ENUMNAME(DXGI_FORMAT_BC6H_SF16); + ENUMNAME(DXGI_FORMAT_BC7_TYPELESS); + ENUMNAME(DXGI_FORMAT_BC7_UNORM); + ENUMNAME(DXGI_FORMAT_BC7_UNORM_SRGB); + ENUMNAME(DXGI_FORMAT_AYUV); + ENUMNAME(DXGI_FORMAT_Y410); + ENUMNAME(DXGI_FORMAT_Y416); + ENUMNAME(DXGI_FORMAT_NV12); + ENUMNAME(DXGI_FORMAT_P010); + ENUMNAME(DXGI_FORMAT_P016); + ENUMNAME(DXGI_FORMAT_420_OPAQUE); + ENUMNAME(DXGI_FORMAT_YUY2); + ENUMNAME(DXGI_FORMAT_Y210); + ENUMNAME(DXGI_FORMAT_Y216); + ENUMNAME(DXGI_FORMAT_NV11); + ENUMNAME(DXGI_FORMAT_AI44); + ENUMNAME(DXGI_FORMAT_IA44); + ENUMNAME(DXGI_FORMAT_P8); + ENUMNAME(DXGI_FORMAT_A8P8); + ENUMNAME(DXGI_FORMAT_B4G4R4A4_UNORM); + ENUMNAME(DXGI_FORMAT_P208); + ENUMNAME(DXGI_FORMAT_V208); + ENUMNAME(DXGI_FORMAT_V408); + + default: + return TEXT("DXGI_FORMAT_UNKNOWN"); + } + } + + const TCHAR* FLName(D3D10_FEATURE_LEVEL1 lvl) + { + switch (lvl) + { + ENUMNAME(D3D10_FEATURE_LEVEL_10_0); + ENUMNAME(D3D10_FEATURE_LEVEL_10_1); + ENUMNAME(D3D10_FEATURE_LEVEL_9_1); + ENUMNAME(D3D10_FEATURE_LEVEL_9_2); + ENUMNAME(D3D10_FEATURE_LEVEL_9_3); + + default: + return TEXT("D3D10_FEATURE_LEVEL_UNKNOWN"); + } + } + + const TCHAR* FLName(D3D_FEATURE_LEVEL lvl) + { + switch (lvl) + { + ENUMNAME(D3D_FEATURE_LEVEL_9_1); + ENUMNAME(D3D_FEATURE_LEVEL_9_2); + ENUMNAME(D3D_FEATURE_LEVEL_9_3); + ENUMNAME(D3D_FEATURE_LEVEL_10_0); + ENUMNAME(D3D_FEATURE_LEVEL_10_1); + ENUMNAME(D3D_FEATURE_LEVEL_11_0); + ENUMNAME(D3D_FEATURE_LEVEL_11_1); + ENUMNAME(D3D_FEATURE_LEVEL_12_0); + ENUMNAME(D3D_FEATURE_LEVEL_12_1); + + default: + return TEXT("D3D_FEATURE_LEVEL_UNKNOWN"); + } + } + + //----------------------------------------------------------------------------- + UINT RefreshRate(const DXGI_RATIONAL& Rate) + { + if (Rate.Numerator == 0) + return 0; + else if (Rate.Denominator == 0) + return 0; + else if (Rate.Denominator == 1) + return Rate.Numerator; + else + return (UINT)(float(Rate.Numerator) / float(Rate.Denominator)); + } + + //----------------------------------------------------------------------------- + HRESULT DXGIAdapterInfo(LPARAM /*lParam1*/, LPARAM lParam2, PRINTCBINFO* pPrintInfo) + { + auto pAdapter = reinterpret_cast(lParam2); + if (!pAdapter) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 50); + } + + DXGI_ADAPTER_DESC desc; + HRESULT hr = pAdapter->GetDesc(&desc); + if (FAILED(hr)) + return hr; + + DWORD dvm = (DWORD)(desc.DedicatedVideoMemory / (1024 * 1024)); + DWORD dsm = (DWORD)(desc.DedicatedSystemMemory / (1024 * 1024)); + DWORD ssm = (DWORD)(desc.SharedSystemMemory / (1024 * 1024)); + + char szDesc[128]; + + wcstombs_s(nullptr, szDesc, desc.Description, 128); + + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "Description"); + LVAddText(g_hwndLV, 1, "%s", szDesc); + + LVAddText(g_hwndLV, 0, "VendorId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.VendorId); + + LVAddText(g_hwndLV, 0, "DeviceId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.DeviceId); + + LVAddText(g_hwndLV, 0, "SubSysId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.SubSysId); + + LVAddText(g_hwndLV, 0, "Revision"); + LVAddText(g_hwndLV, 1, "%d", desc.Revision); + + LVAddText(g_hwndLV, 0, "DedicatedVideoMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", dvm); + + LVAddText(g_hwndLV, 0, "DedicatedSystemMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", dsm); + + LVAddText(g_hwndLV, 0, "SharedSystemMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", ssm); + } + else + { + PrintStringValueLine("Description", szDesc, pPrintInfo); + PrintHexValueLine("VendorId", desc.VendorId, pPrintInfo); + PrintHexValueLine("DeviceId", desc.DeviceId, pPrintInfo); + PrintHexValueLine("SubSysId", desc.SubSysId, pPrintInfo); + PrintValueLine("Revision", desc.Revision, pPrintInfo); + PrintValueLine("DedicatedVideoMemory (MB)", dvm, pPrintInfo); + PrintValueLine("DedicatedSystemMemory (MB)", dsm, pPrintInfo); + PrintValueLine("SharedSystemMemory (MB)", ssm, pPrintInfo); + } + + return S_OK; + } + + HRESULT DXGIAdapterInfo1(LPARAM /*lParam1*/, LPARAM lParam2, PRINTCBINFO* pPrintInfo) + { + auto pAdapter = reinterpret_cast(lParam2); + if (!pAdapter) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 50); + } + + DXGI_ADAPTER_DESC1 desc; + HRESULT hr = pAdapter->GetDesc1(&desc); + if (FAILED(hr)) + return hr; + + auto dvm = static_cast(desc.DedicatedVideoMemory / (1024 * 1024)); + auto dsm = static_cast(desc.DedicatedSystemMemory / (1024 * 1024)); + auto ssm = static_cast(desc.SharedSystemMemory / (1024 * 1024)); + + char szDesc[128]; + + wcstombs_s(nullptr, szDesc, desc.Description, 128); + + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "Description"); + LVAddText(g_hwndLV, 1, "%s", szDesc); + + LVAddText(g_hwndLV, 0, "VendorId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.VendorId); + + LVAddText(g_hwndLV, 0, "DeviceId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.DeviceId); + + LVAddText(g_hwndLV, 0, "SubSysId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.SubSysId); + + LVAddText(g_hwndLV, 0, "Revision"); + LVAddText(g_hwndLV, 1, "%d", desc.Revision); + + LVAddText(g_hwndLV, 0, "DedicatedVideoMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", dvm); + + LVAddText(g_hwndLV, 0, "DedicatedSystemMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", dsm); + + LVAddText(g_hwndLV, 0, "SharedSystemMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", ssm); + + LVAddText(g_hwndLV, 0, "Remote"); + LVAddText(g_hwndLV, 1, (desc.Flags & DXGI_ADAPTER_FLAG_REMOTE) ? c_szYes : c_szNo); + } + else + { + PrintStringValueLine("Description", szDesc, pPrintInfo); + PrintHexValueLine("VendorId", desc.VendorId, pPrintInfo); + PrintHexValueLine("DeviceId", desc.DeviceId, pPrintInfo); + PrintHexValueLine("SubSysId", desc.SubSysId, pPrintInfo); + PrintValueLine("Revision", desc.Revision, pPrintInfo); + PrintValueLine("DedicatedVideoMemory (MB)", dvm, pPrintInfo); + PrintValueLine("DedicatedSystemMemory (MB)", dsm, pPrintInfo); + PrintValueLine("SharedSystemMemory (MB)", ssm, pPrintInfo); + PrintStringValueLine("Remote", (desc.Flags & DXGI_ADAPTER_FLAG_REMOTE) ? c_szYes : c_szNo, pPrintInfo); + } + + return S_OK; + } + + HRESULT DXGIAdapterInfo2(LPARAM /*lParam1*/, LPARAM lParam2, PRINTCBINFO* pPrintInfo) + { + auto pAdapter = reinterpret_cast(lParam2); + if (!pAdapter) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 50); + } + + DXGI_ADAPTER_DESC2 desc; + HRESULT hr = pAdapter->GetDesc2(&desc); + if (FAILED(hr)) + return hr; + + auto dvm = static_cast(desc.DedicatedVideoMemory / (1024 * 1024)); + auto dsm = static_cast(desc.DedicatedSystemMemory / (1024 * 1024)); + auto ssm = static_cast(desc.SharedSystemMemory / (1024 * 1024)); + + char szDesc[128]; + + wcstombs_s(nullptr, szDesc, desc.Description, 128); + + const char* gpg = nullptr; + const char* cpg = nullptr; + + switch (desc.GraphicsPreemptionGranularity) + { + case DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY: gpg = "DMA Buffer"; break; + case DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY: gpg = "Primitive"; break; + case DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY: gpg = "Triangle"; break; + case DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY: gpg = "Pixel"; break; + case DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY: gpg = "Instruction"; break; + default: gpg = "Unknown"; break; + } + + switch (desc.ComputePreemptionGranularity) + { + case DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY: cpg = "DMA Buffer"; break; + case DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY: cpg = "Dispatch"; break; + case DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY: cpg = "Thread Group"; break; + case DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY: cpg = "Thread"; break; + case DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY: cpg = "Instruction"; break; + default: cpg = "Unknown"; break; + } + + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "Description"); + LVAddText(g_hwndLV, 1, "%s", szDesc); + + LVAddText(g_hwndLV, 0, "VendorId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.VendorId); + + LVAddText(g_hwndLV, 0, "DeviceId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.DeviceId); + + LVAddText(g_hwndLV, 0, "SubSysId"); + LVAddText(g_hwndLV, 1, "0x%08x", desc.SubSysId); + + LVAddText(g_hwndLV, 0, "Revision"); + LVAddText(g_hwndLV, 1, "%d", desc.Revision); + + LVAddText(g_hwndLV, 0, "DedicatedVideoMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", dvm); + + LVAddText(g_hwndLV, 0, "DedicatedSystemMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", dsm); + + LVAddText(g_hwndLV, 0, "SharedSystemMemory (MB)"); + LVAddText(g_hwndLV, 1, "%d", ssm); + + LVAddText(g_hwndLV, 0, "Remote"); + LVAddText(g_hwndLV, 1, (desc.Flags & DXGI_ADAPTER_FLAG_REMOTE) ? c_szYes : c_szNo); + + LVAddText(g_hwndLV, 0, "Graphics Preemption Granularity"); + LVAddText(g_hwndLV, 1, gpg); + + LVAddText(g_hwndLV, 0, "Compute Preemption Granularity"); + LVAddText(g_hwndLV, 1, cpg); + } + else + { + PrintStringValueLine("Description", szDesc, pPrintInfo); + PrintHexValueLine("VendorId", desc.VendorId, pPrintInfo); + PrintHexValueLine("DeviceId", desc.DeviceId, pPrintInfo); + PrintHexValueLine("SubSysId", desc.SubSysId, pPrintInfo); + PrintValueLine("Revision", desc.Revision, pPrintInfo); + PrintValueLine("DedicatedVideoMemory (MB)", dvm, pPrintInfo); + PrintValueLine("DedicatedSystemMemory (MB)", dsm, pPrintInfo); + PrintValueLine("SharedSystemMemory (MB)", ssm, pPrintInfo); + PrintStringValueLine("Remote", (desc.Flags & DXGI_ADAPTER_FLAG_REMOTE) ? c_szYes : c_szNo, pPrintInfo); + PrintStringValueLine("Graphics Preemption Granularity", gpg, pPrintInfo); + PrintStringValueLine("Compute Preemption Granularity", cpg, pPrintInfo); + } + + return S_OK; + } + + //----------------------------------------------------------------------------- + HRESULT DXGIOutputInfo(LPARAM /*lParam1*/, LPARAM lParam2, PRINTCBINFO* pPrintInfo) + { + auto pOutput = reinterpret_cast(lParam2); + if (!pOutput) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 30); + } + + DXGI_OUTPUT_DESC desc; + HRESULT hr = pOutput->GetDesc(&desc); + if (FAILED(hr)) + return hr; + + char szDevName[32]; + + wcstombs_s(nullptr, szDevName, desc.DeviceName, 32); + + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "DeviceName"); + LVAddText(g_hwndLV, 1, "%s", szDevName); + + LVAddText(g_hwndLV, 0, "AttachedToDesktop"); + LVAddText(g_hwndLV, 1, desc.AttachedToDesktop ? c_szYes : c_szNo); + + LVAddText(g_hwndLV, 0, "Rotation"); + LVAddText(g_hwndLV, 1, szRotation[desc.Rotation]); + } + else + { + PrintStringValueLine("DeviceName", szDevName, pPrintInfo); + PrintStringValueLine("AttachedToDesktop", desc.AttachedToDesktop ? c_szYes : c_szNo, pPrintInfo); + PrintStringValueLine("Rotation", szRotation[desc.Rotation], pPrintInfo); + } + + return S_OK; + } + + //----------------------------------------------------------------------------- + HRESULT DXGIOutputModes(LPARAM /*lParam1*/, LPARAM lParam2, PRINTCBINFO* pPrintInfo) + { + auto pOutput = reinterpret_cast(lParam2); + if (!pOutput) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Resolution", 10); + LVAddColumn(g_hwndLV, 1, "Pixel Format", 30); + LVAddColumn(g_hwndLV, 2, "Refresh Rate", 10); + } + + for (UINT iFormat = 0; iFormat < NumAdapterFormats; ++iFormat) + { + DXGI_FORMAT fmt = AdapterFormatArray[iFormat]; + + if (!g_DXGIFactory1) + { + switch (fmt) + { + case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + continue; + } + } + + UINT num = 0; + const DWORD flags = 0; + HRESULT hr = pOutput->GetDisplayModeList(fmt, flags, &num, 0); + + if (SUCCEEDED(hr) && num > 0) + { + DXGI_MODE_DESC* pDescs = new DXGI_MODE_DESC[num]; + + hr = pOutput->GetDisplayModeList(fmt, flags, &num, pDescs); + + if (SUCCEEDED(hr)) + { + for (UINT iMode = 0; iMode < num; ++iMode) + { + const DXGI_MODE_DESC* pDesc = &pDescs[iMode]; + if (!pPrintInfo) + { + LVAddText(g_hwndLV, 0, "%d x %d", pDesc->Width, pDesc->Height); + LVAddText(g_hwndLV, 1, FormatName(pDesc->Format)); + LVAddText(g_hwndLV, 2, "%d", RefreshRate(pDesc->RefreshRate)); + } + else + { + char szBuff[80]; + DWORD cchLen; + + // Calculate Name and Value column x offsets + int x1 = (pPrintInfo->dwCurrIndent * DEF_TAB_SIZE * pPrintInfo->dwCharWidth); + int x2 = x1 + (30 * pPrintInfo->dwCharWidth); + int x3 = x2 + (20 * pPrintInfo->dwCharWidth); + int yLine = (pPrintInfo->dwCurrLine * pPrintInfo->dwLineHeight); + + sprintf_s(szBuff, sizeof(szBuff), "%u x %u", pDesc->Width, pDesc->Height); + cchLen = static_cast(_tcslen(szBuff)); + if (FAILED(PrintLine(x1, yLine, szBuff, cchLen, pPrintInfo))) + return E_FAIL; + + strcpy_s(szBuff, sizeof(szBuff), FormatName(pDesc->Format)); + cchLen = static_cast(_tcslen(szBuff)); + if (FAILED(PrintLine(x2, yLine, szBuff, cchLen, pPrintInfo))) + return E_FAIL; + + sprintf_s(szBuff, sizeof(szBuff), "%u", RefreshRate(pDesc->RefreshRate)); + cchLen = static_cast(_tcslen(szBuff)); + if (FAILED(PrintLine(x3, yLine, szBuff, cchLen, pPrintInfo))) + return E_FAIL; + + // Advance to next line on page + if (FAILED(PrintNextLine(pPrintInfo))) + return E_FAIL; + } + } + } + + delete[] pDescs; + } + } + + return S_OK; + } + + //----------------------------------------------------------------------------- +#define LVYESNO(a,b) \ + if ( g_dwViewState == IDM_VIEWALL || (b) ) \ + { \ + LVAddText( g_hwndLV, 0, a ); \ + LVAddText( g_hwndLV, 1, (b) ? c_szYes : c_szNo ); \ + } + +#define PRINTYESNO(a,b) \ + PrintStringValueLine( a, (b) ? c_szYes : c_szNo, pPrintInfo ); + +#define LVLINE(a,b) \ + if ( g_dwViewState == IDM_VIEWALL || (b != c_szNA && b != c_szNo) ) \ + { \ + LVAddText( g_hwndLV, 0, a ); \ + LVAddText( g_hwndLV, 1, b ); \ + } + +#define PRINTLINE(a,b) \ + if ( g_dwViewState == IDM_VIEWALL || (b != c_szNA && b != c_szNo) ) \ + { \ + PrintStringValueLine( a, b, pPrintInfo ); \ + } + +#define XTOSTRING(a) #a TOSTRING(a) +#define TOSTRING(a) #a + +#define XTOSTRING2(a) #a TOSTRING2(a) +#define TOSTRING2(a) "( " #a " )" + + //----------------------------------------------------------------------------- + HRESULT DXGIFeatures(LPARAM /*lParam1*/, LPARAM /*lParam2*/, PRINTCBINFO* pPrintInfo) + { + if (g_DXGIFactory5) + { + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + + BOOL allowTearing = FALSE; + HRESULT hr = g_DXGIFactory5->CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING, &allowTearing, sizeof(BOOL)); + if (FAILED(hr)) + allowTearing = FALSE; + + if (!pPrintInfo) + { + LVYESNO("Allow tearing", allowTearing); + } + else + { + PRINTYESNO("Allow tearing", allowTearing); + } + } + + return S_OK; + } + + bool IsMSAAPowerOf2(UINT value) + { + // only supports values 0..32 + if (value <= 1) + return true; + + if (value & 0x1) + return false; + + for (UINT mask = 0x2; mask < 0x100; mask <<= 1) + { + if ((value & ~mask) == 0) + return true; + } + + return false; + } + + + //----------------------------------------------------------------------------- + void CheckExtendedFormats(ID3D10Device* pDevice, BOOL& ext, BOOL& x2) + { + ext = x2 = FALSE; + + // DXGI 1.1 required for extended formats + if (!g_DXGIFactory1) + return; + + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(DXGI_FORMAT_B8G8R8A8_UNORM, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (fmtSupport & D3D10_FORMAT_SUPPORT_RENDER_TARGET) + ext = TRUE; + + hr = pDevice->CheckFormatSupport(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (fmtSupport & D3D10_FORMAT_SUPPORT_DISPLAY) + x2 = TRUE; + } + + void CheckExtendedFormats(ID3D11Device* pDevice, BOOL& ext, BOOL& x2, BOOL& bpp565) + { + ext = x2 = bpp565 = FALSE; + + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(DXGI_FORMAT_B8G8R8A8_UNORM, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (fmtSupport & D3D11_FORMAT_SUPPORT_RENDER_TARGET) + ext = TRUE; + + fmtSupport = 0; + hr = pDevice->CheckFormatSupport(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (fmtSupport & D3D11_FORMAT_SUPPORT_DISPLAY) + x2 = TRUE; + + // DXGI 1.2 is required for 16bpp support + if (g_DXGIFactory2) + { + fmtSupport = 0; + hr = pDevice->CheckFormatSupport(DXGI_FORMAT_B5G6R5_UNORM, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (fmtSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) + bpp565 = TRUE; + } + } + + + //----------------------------------------------------------------------------- + void CheckD3D11Ops(ID3D11Device* pDevice, bool& logicOps, bool& cbPartial, bool& cbOffsetting) + { + D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11opts = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &d3d11opts, sizeof(d3d11opts)); + if (FAILED(hr)) + memset(&d3d11opts, 0, sizeof(d3d11opts)); + + logicOps = (d3d11opts.OutputMergerLogicOp) ? true : false; + cbPartial = (d3d11opts.ConstantBufferPartialUpdate) ? true : false; + cbOffsetting = (d3d11opts.ConstantBufferOffsetting) ? true : false; + } + + + //----------------------------------------------------------------------------- + void CheckD3D11Ops1(ID3D11Device* pDevice, D3D11_TILED_RESOURCES_TIER& tiled, bool& minmaxfilter, bool& mapdefaultbuff) + { + D3D11_FEATURE_DATA_D3D11_OPTIONS1 d3d11opts1 = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS1, &d3d11opts1, sizeof(d3d11opts1)); + if (FAILED(hr)) + memset(&d3d11opts1, 0, sizeof(d3d11opts1)); + + tiled = d3d11opts1.TiledResourcesTier; + minmaxfilter = (d3d11opts1.MinMaxFiltering) ? true : false; + mapdefaultbuff = (d3d11opts1.MapOnDefaultBuffers) ? true : false; + } + + + //----------------------------------------------------------------------------- + void CheckD3D11Ops2(ID3D11Device* pDevice, D3D11_TILED_RESOURCES_TIER& tiled, D3D11_CONSERVATIVE_RASTERIZATION_TIER& crast, + bool& rovs, bool& pssref) + { + D3D11_FEATURE_DATA_D3D11_OPTIONS2 d3d11opts2 = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &d3d11opts2, sizeof(d3d11opts2)); + if (FAILED(hr)) + memset(&d3d11opts2, 0, sizeof(d3d11opts2)); + + crast = d3d11opts2.ConservativeRasterizationTier; + tiled = d3d11opts2.TiledResourcesTier; + rovs = (d3d11opts2.ROVsSupported) ? true : false; + pssref = (d3d11opts2.PSSpecifiedStencilRefSupported) ? true : false; + } + + + //----------------------------------------------------------------------------- + void CheckD3D9Ops(ID3D11Device* pDevice, bool& nonpow2, bool& shadows) + { + D3D11_FEATURE_DATA_D3D9_OPTIONS d3d9opts = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_OPTIONS, &d3d9opts, sizeof(d3d9opts)); + if (FAILED(hr)) + memset(&d3d9opts, 0, sizeof(d3d9opts)); + + nonpow2 = (d3d9opts.FullNonPow2TextureSupport) ? true : false; + + D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT d3d9shadows = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_SHADOW_SUPPORT, &d3d9shadows, sizeof(d3d9shadows)); + if (FAILED(hr)) + memset(&d3d9shadows, 0, sizeof(d3d9shadows)); + + shadows = (d3d9shadows.SupportsDepthAsTextureWithLessEqualComparisonFilter) ? true : false; + } + + + //----------------------------------------------------------------------------- + void CheckD3D9Ops1(ID3D11Device* pDevice, bool& nonpow2, bool& shadows, bool& instancing, bool& cubemapRT) + { + D3D11_FEATURE_DATA_D3D9_OPTIONS1 d3d9opts = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_OPTIONS1, &d3d9opts, sizeof(d3d9opts)); + if (FAILED(hr)) + { + memset(&d3d9opts, 0, sizeof(d3d9opts)); + + // Handle Windows 8.1 Preview by falling back to D3D9_OPTIONS, D3D9_SHADOW_SUPPORT, and D3D9_SIMPLE_INSTANCING_SUPPORT + CheckD3D9Ops(pDevice, nonpow2, shadows); + + D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT d3d9si = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT, &d3d9si, sizeof(d3d9si)); + if (FAILED(hr)) + memset(&d3d9si, 0, sizeof(d3d9si)); + + instancing = (d3d9si.SimpleInstancingSupported) ? true : false; + + cubemapRT = false; + + return; + } + + nonpow2 = (d3d9opts.FullNonPow2TextureSupported) ? true : false; + + shadows = (d3d9opts.DepthAsTextureWithLessEqualComparisonFilterSupported) ? true : false; + + instancing = (d3d9opts.SimpleInstancingSupported) ? true : false; + + cubemapRT = (d3d9opts.TextureCubeFaceRenderTargetWithNonCubeDepthStencilSupported) ? true : false; + } + +//----------------------------------------------------------------------------- +#define D3D_FL_LPARAM3_D3D10( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 0 ) +#define D3D_FL_LPARAM3_D3D10_1( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 1 ) +#define D3D_FL_LPARAM3_D3D11( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 2 ) +#define D3D_FL_LPARAM3_D3D11_1( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 3 ) +#define D3D_FL_LPARAM3_D3D11_2( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 4 ) +#define D3D_FL_LPARAM3_D3D11_3( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 5 ) +#define D3D_FL_LPARAM3_D3D12( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 10 ) + + HRESULT D3D_FeatureLevel(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + auto fl = static_cast(lParam1); + if (lParam2 == 0) + return S_OK; + + ID3D10Device* pD3D10 = nullptr; + ID3D10Device1* pD3D10_1 = nullptr; + ID3D11Device* pD3D11 = nullptr; + ID3D11Device1* pD3D11_1 = nullptr; + ID3D11Device2* pD3D11_2 = nullptr; + ID3D11Device3* pD3D11_3 = nullptr; + ID3D12Device* pD3D12 = nullptr; + + auto d3dVer = static_cast(lParam3 & 0xff); + auto d3dType = static_cast((lParam3 & 0xff00) >> 8); + + if (d3dVer == 10) + { + pD3D12 = reinterpret_cast(lParam2); + } + else if (d3dVer == 5) + { + pD3D11_3 = reinterpret_cast(lParam2); + } + else + { + if (fl > D3D_FEATURE_LEVEL_11_1) + fl = D3D_FEATURE_LEVEL_11_1; + + if (d3dVer == 4) + { + pD3D11_2 = reinterpret_cast(lParam2); + } + else if (d3dVer == 3) + { + pD3D11_1 = reinterpret_cast(lParam2); + } + else + { + if (fl > D3D_FEATURE_LEVEL_11_0) + fl = D3D_FEATURE_LEVEL_11_0; + + if (d3dVer == 2) + { + pD3D11 = reinterpret_cast(lParam2); + } + else + { + if (fl > D3D_FEATURE_LEVEL_10_1) + fl = D3D_FEATURE_LEVEL_10_1; + + if (d3dVer == 1) + { + pD3D10_1 = reinterpret_cast(lParam2); + } + else + { + if (fl > D3D_FEATURE_LEVEL_10_0) + fl = D3D_FEATURE_LEVEL_10_0; + + pD3D10 = reinterpret_cast(lParam2); + } + } + } + } + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + + const char* shaderModel = nullptr; + const char* computeShader = c_szNo; + const char* maxTexDim = nullptr; + const char* maxCubeDim = nullptr; + const char* maxVolDim = nullptr; + const char* maxTexRepeat = nullptr; + const char* maxAnisotropy = nullptr; + const char* maxPrimCount = "4294967296"; + const char* maxInputSlots = nullptr; + const char* mrt = nullptr; + const char* extFormats = nullptr; + const char* x2_10BitFormat = nullptr; + const char* logic_ops = c_szNo; + const char* cb_partial = c_szNA; + const char* cb_offsetting = c_szNA; + const char* uavSlots = nullptr; + const char* uavEveryStage = nullptr; + const char* uavOnlyRender = nullptr; + const char* nonpow2 = nullptr; + const char* bpp16 = c_szNo; + const char* shadows = nullptr; + const char* cubeRT = nullptr; + const char* tiled_rsc = nullptr; + const char* binding_rsc = nullptr; + const char* minmaxfilter = nullptr; + const char* mapdefaultbuff = nullptr; + const char* consrv_rast = nullptr; + const char* rast_ordered_views = nullptr; + const char* ps_stencil_ref = nullptr; + const char* instancing = nullptr; + + BOOL _10level9 = FALSE; + + switch (fl) + { + case D3D_FEATURE_LEVEL_12_1: + case D3D_FEATURE_LEVEL_12_0: + shaderModel = "5.0"; + computeShader = "Yes (CS 5.0)"; + extFormats = c_szYes; + x2_10BitFormat = c_szYes; + logic_ops = c_szYes; + cb_partial = c_szYes; + cb_offsetting = c_szYes; + uavEveryStage = c_szYes; + uavOnlyRender = "16"; + nonpow2 = "Full"; + bpp16 = c_szYes; + instancing = c_szYes; + + if (pD3D12) + { + maxTexDim = XTOSTRING(D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING(D3D12_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING(D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING(D3D12_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION); + maxAnisotropy = XTOSTRING(D3D12_REQ_MAXANISOTROPY); + maxInputSlots = XTOSTRING(D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING(D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT); + uavSlots = XTOSTRING(D3D12_UAV_SLOT_COUNT); + + D3D12_FEATURE_DATA_SHADER_MODEL shaderModelOpt = {}; + shaderModelOpt.HighestShaderModel = D3D_SHADER_MODEL_6_5; + HRESULT hr = pD3D12->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &shaderModelOpt, sizeof(shaderModelOpt)); + while (hr == E_INVALIDARG && shaderModelOpt.HighestShaderModel > D3D_SHADER_MODEL_6_0) + { + shaderModelOpt.HighestShaderModel = static_cast(static_cast(shaderModelOpt.HighestShaderModel) - 1); + hr = pD3D12->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &shaderModelOpt, sizeof(shaderModelOpt)); + } + if (FAILED(hr)) + { + shaderModelOpt.HighestShaderModel = D3D_SHADER_MODEL_5_1; + } + + switch (shaderModelOpt.HighestShaderModel) + { + case D3D_SHADER_MODEL_6_5: + shaderModel = "6.5"; + computeShader = "Yes (CS 6.5)"; + break; + case D3D_SHADER_MODEL_6_4: + shaderModel = "6.4"; + computeShader = "Yes (CS 6.4)"; + break; + case D3D_SHADER_MODEL_6_3: + shaderModel = "6.3"; + computeShader = "Yes (CS 6.3)"; + break; + case D3D_SHADER_MODEL_6_2: + shaderModel = "6.2"; + computeShader = "Yes (CS 6.2)"; + break; + case D3D_SHADER_MODEL_6_1: + shaderModel = "6.1"; + computeShader = "Yes (CS 6.1)"; + break; + case D3D_SHADER_MODEL_6_0: + shaderModel = "6.0"; + computeShader = "Yes (CS 6.0)"; + break; + default: + shaderModel = "5.1"; + computeShader = "Yes (CS 5.1)"; + break; + } + + D3D12_FEATURE_DATA_D3D12_OPTIONS d3d12opts = {}; + hr = pD3D12->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &d3d12opts, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS)); + if (FAILED(hr)) + memset(&d3d12opts, 0, sizeof(d3d12opts)); + + switch (d3d12opts.TiledResourcesTier) + { + // 12.0 & 12.1 should be T2 or greater + case D3D12_TILED_RESOURCES_TIER_2: tiled_rsc = "Yes - Tier 2"; break; + case D3D12_TILED_RESOURCES_TIER_3: tiled_rsc = "Yes - Tier 3"; break; + case D3D12_TILED_RESOURCES_TIER_4: tiled_rsc = "Yes - Tier 4"; break; + default: tiled_rsc = "Yes"; break; + } + + switch (d3d12opts.ResourceBindingTier) + { + // 12.0 & 12.1 should be T2 or greater + case D3D12_RESOURCE_BINDING_TIER_2: binding_rsc = "Yes - Tier 2"; break; + case D3D12_RESOURCE_BINDING_TIER_3: binding_rsc = "Yes - Tier 3"; break; + default: binding_rsc = "Yes"; break; + } + + if (fl >= D3D_FEATURE_LEVEL_12_1) + { + switch (d3d12opts.ConservativeRasterizationTier) + { + // 12.1 requires T1 + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Yes - Tier 1"; break; + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Yes - Tier 2"; break; + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Yes - Tier 3"; break; + default: consrv_rast = "Yes"; break; + } + + rast_ordered_views = c_szYes; + } + else + { + switch (d3d12opts.ConservativeRasterizationTier) + { + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED: consrv_rast = "Optional (No)"; break; + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Optional (Yes - Tier 1)"; break; + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Optional (Yes - Tier 2)"; break; + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Optional (Yes - Tier 3)"; break; + default: consrv_rast = "Optional (Yes)"; break; + } + + rast_ordered_views = (d3d12opts.ROVsSupported) ? "Optional (Yes)" : "Optional (No)"; + } + + ps_stencil_ref = (d3d12opts.PSSpecifiedStencilRefSupported) ? "Optional (Yes)" : "Optional (No)"; + minmaxfilter = c_szYes; + mapdefaultbuff = c_szYes; + } + else if (pD3D11_3) + { + maxTexDim = XTOSTRING(D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING(D3D11_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING(D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING(D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION); + maxAnisotropy = XTOSTRING(D3D11_REQ_MAXANISOTROPY); + maxInputSlots = XTOSTRING(D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT); + uavSlots = XTOSTRING(D3D11_1_UAV_SLOT_COUNT); + + D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; + bool bMinMaxFilter, bMapDefaultBuff; + CheckD3D11Ops1(pD3D11_3, tiled, bMinMaxFilter, bMapDefaultBuff); + + D3D11_CONSERVATIVE_RASTERIZATION_TIER crast = D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED; + bool rovs, pssref; + CheckD3D11Ops2(pD3D11_3, tiled, crast, rovs, pssref); + + switch (tiled) + { + // 12.0 & 12.1 should be T2 or greater + case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Yes - Tier 2"; break; + case D3D11_TILED_RESOURCES_TIER_3: tiled_rsc = "Yes - Tier 3"; break; + default: tiled_rsc = "Yes"; break; + } + + if (fl >= D3D_FEATURE_LEVEL_12_1) + { + switch (crast) + { + // 12.1 requires T1 + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Yes - Tier 1"; break; + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Yes - Tier 2"; break; + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Yes - Tier 3"; break; + default: consrv_rast = "Yes"; break; + } + + rast_ordered_views = c_szYes; + } + else + { + switch (crast) + { + case D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED: consrv_rast = "Optional (No)"; break; + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Optional (Yes - Tier 1)"; break; + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Optional (Yes - Tier 2)"; break; + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Optional (Yes - Tier 3)"; break; + default: consrv_rast = "Optional (Yes)"; break; + } + + rast_ordered_views = (rovs) ? "Optional (Yes)" : "Optional (No)"; + } + + ps_stencil_ref = (pssref) ? "Optional (Yes)" : "Optional (No)"; + minmaxfilter = c_szYes; + mapdefaultbuff = c_szYes; + } + break; + + case D3D_FEATURE_LEVEL_11_1: + shaderModel = "5.0"; + computeShader = "Yes (CS 5.0)"; + maxTexDim = XTOSTRING(D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING(D3D11_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING(D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING(D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION); + maxAnisotropy = XTOSTRING(D3D11_REQ_MAXANISOTROPY); + maxInputSlots = XTOSTRING(D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT); + extFormats = c_szYes; + x2_10BitFormat = c_szYes; + logic_ops = c_szYes; + cb_partial = c_szYes; + cb_offsetting = c_szYes; + uavSlots = XTOSTRING(D3D11_1_UAV_SLOT_COUNT); + uavEveryStage = c_szYes; + uavOnlyRender = "16"; + nonpow2 = "Full"; + bpp16 = c_szYes; + instancing = c_szYes; + + if (pD3D12) + { + shaderModel = "5.1"; + computeShader = "Yes (CS 5.1)"; + + D3D12_FEATURE_DATA_D3D12_OPTIONS d3d12opts = {}; + HRESULT hr = pD3D12->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &d3d12opts, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS)); + if (FAILED(hr)) + memset(&d3d12opts, 0, sizeof(d3d12opts)); + + switch (d3d12opts.TiledResourcesTier) + { + case D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; + case D3D12_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; + case D3D12_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; + case D3D12_TILED_RESOURCES_TIER_3: tiled_rsc = "Optional (Yes - Tier 3)"; break; + case D3D12_TILED_RESOURCES_TIER_4: tiled_rsc = "Optional (Yes - Tier 4)"; break; + default: tiled_rsc = "Optional (Yes)"; break; + } + + switch (d3d12opts.ConservativeRasterizationTier) + { + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED: consrv_rast = "Optional (No)"; break; + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Optional (Yes - Tier 1)"; break; + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Optional (Yes - Tier 2)"; break; + case D3D12_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Optional (Yes - Tier 3)"; break; + default: consrv_rast = "Optional (Yes)"; break; + } + + rast_ordered_views = (d3d12opts.ROVsSupported) ? "Optional (Yes)" : "Optional (No)"; + ps_stencil_ref = (d3d12opts.PSSpecifiedStencilRefSupported) ? "Optional (Yes)" : "Optional (No)"; + minmaxfilter = c_szYes; + mapdefaultbuff = c_szYes; + } + else if (pD3D11_3) + { + D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; + bool bMinMaxFilter, bMapDefaultBuff; + CheckD3D11Ops1(pD3D11_3, tiled, bMinMaxFilter, bMapDefaultBuff); + + D3D11_CONSERVATIVE_RASTERIZATION_TIER crast = D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED; + bool rovs, pssref; + CheckD3D11Ops2(pD3D11_3, tiled, crast, rovs, pssref); + + switch (tiled) + { + case D3D11_TILED_RESOURCES_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; + case D3D11_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; + case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; + case D3D11_TILED_RESOURCES_TIER_3: tiled_rsc = "Optional (Yes - Tier 3)"; break; + default: tiled_rsc = "Optional (Yes)"; break; + } + + switch (crast) + { + case D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED: consrv_rast = "Optional (No)"; break; + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Optional (Yes - Tier 1)"; break; + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Optional (Yes - Tier 2)"; break; + case D3D11_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Optional (Yes - Tier 3)"; break; + default: consrv_rast = "Optional (Yes)"; break; + } + + rast_ordered_views = (rovs) ? "Optional (Yes)" : "Optional (No)"; + ps_stencil_ref = (pssref) ? "Optional (Yes)" : "Optional (No)"; + minmaxfilter = bMinMaxFilter ? "Optional (Yes)" : "Optional (No)"; + mapdefaultbuff = bMapDefaultBuff ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D11_2) + { + D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; + bool bMinMaxFilter, bMapDefaultBuff; + CheckD3D11Ops1(pD3D11_2, tiled, bMinMaxFilter, bMapDefaultBuff); + + switch (tiled) + { + case D3D11_TILED_RESOURCES_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; + case D3D11_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; + case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; + default: tiled_rsc = "Optional (Yes)"; break; + } + + minmaxfilter = bMinMaxFilter ? "Optional (Yes)" : "Optional (No)"; + mapdefaultbuff = bMapDefaultBuff ? "Optional (Yes)" : "Optional (No)"; + } + break; + + case D3D_FEATURE_LEVEL_11_0: + shaderModel = "5.0"; + computeShader = "Yes (CS 5.0)"; + maxTexDim = XTOSTRING(D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING(D3D11_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING(D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING(D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION); + maxAnisotropy = XTOSTRING(D3D11_REQ_MAXANISOTROPY); + maxInputSlots = XTOSTRING(D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT); + extFormats = c_szYes; + x2_10BitFormat = c_szYes; + instancing = c_szYes; + + if (pD3D12) + { + shaderModel = "5.1"; + computeShader = "Yes (CS 5.1)"; + + D3D12_FEATURE_DATA_D3D12_OPTIONS d3d12opts = {}; + HRESULT hr = pD3D12->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &d3d12opts, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS)); + if (FAILED(hr)) + memset(&d3d12opts, 0, sizeof(d3d12opts)); + + switch (d3d12opts.TiledResourcesTier) + { + case D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; + case D3D12_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; + case D3D12_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; + case D3D12_TILED_RESOURCES_TIER_3: tiled_rsc = "Optional (Yes - Tier 3)"; break; + case D3D12_TILED_RESOURCES_TIER_4: tiled_rsc = "Optional (Yes - Tier 4)"; break; + default: tiled_rsc = "Optional (Yes)"; break; + } + + logic_ops = d3d12opts.OutputMergerLogicOp ? "Optional (Yes)" : "Optional (No)"; + consrv_rast = rast_ordered_views = ps_stencil_ref = minmaxfilter = c_szNo; + mapdefaultbuff = c_szYes; + + uavSlots = "8"; + uavEveryStage = c_szNo; + uavOnlyRender = "8"; + nonpow2 = "Full"; + } + else if (pD3D11_3) + { + D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; + bool bMinMaxFilter, bMapDefaultBuff; + CheckD3D11Ops1(pD3D11_3, tiled, bMinMaxFilter, bMapDefaultBuff); + + D3D11_FEATURE_DATA_D3D11_OPTIONS2 d3d11opts2 = {}; + HRESULT hr = pD3D11_3->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &d3d11opts2, sizeof(d3d11opts2)); + if (SUCCEEDED(hr)) + { + // D3D11_FEATURE_DATA_D3D11_OPTIONS1 caps this at Tier 2 + tiled = d3d11opts2.TiledResourcesTier; + } + + switch (tiled) + { + case D3D11_TILED_RESOURCES_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; + case D3D11_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; + case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; + case D3D11_TILED_RESOURCES_TIER_3: tiled_rsc = "Optional (Yes - Tier 3)"; break; + default: tiled_rsc = "Optional (Yes)"; break; + } + + consrv_rast = rast_ordered_views = ps_stencil_ref = minmaxfilter = c_szNo; + mapdefaultbuff = bMapDefaultBuff ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D11_2) + { + D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; + bool bMinMaxFilter, bMapDefaultBuff; + CheckD3D11Ops1(pD3D11_2, tiled, bMinMaxFilter, bMapDefaultBuff); + + switch (tiled) + { + case D3D11_TILED_RESOURCES_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; + case D3D11_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; + case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; + default: tiled_rsc = "Optional (Yes)"; break; + } + + minmaxfilter = c_szNo; + mapdefaultbuff = bMapDefaultBuff ? "Optional (Yes)" : "Optional (No)"; + } + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : ((pD3D11_2) ? pD3D11_2 : pD3D11_1); + + bool bLogicOps, bCBpartial, bCBoffsetting; + CheckD3D11Ops(pD3D, bLogicOps, bCBpartial, bCBoffsetting); + logic_ops = bLogicOps ? "Optional (Yes)" : "Optional (No)"; + cb_partial = bCBpartial ? "Optional (Yes)" : "Optional (No)"; + cb_offsetting = bCBoffsetting ? "Optional (Yes)" : "Optional (No)"; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D, ext, x2, bpp565); + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + + uavSlots = "8"; + uavEveryStage = c_szNo; + uavOnlyRender = "8"; + nonpow2 = "Full"; + } + break; + + case D3D_FEATURE_LEVEL_10_1: + shaderModel = "4.x"; + instancing = c_szYes; + + if (pD3D11_3) + { + consrv_rast = rast_ordered_views = ps_stencil_ref = c_szNo; + } + + if (pD3D11_2 || pD3D11_3) + { + tiled_rsc = minmaxfilter = mapdefaultbuff = c_szNo; + } + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : ((pD3D11_2) ? pD3D11_2 : pD3D11_1); + + D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {}; + HRESULT hr = pD3D->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw)); + if (FAILED(hr)) + memset(&d3d10xhw, 0, sizeof(d3d10xhw)); + + if (d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) + { + computeShader = "Optional (Yes - CS 4.x)"; + uavSlots = "1"; + uavEveryStage = c_szNo; + uavOnlyRender = c_szNo; + } + else + { + computeShader = "Optional (No)"; + } + + bool bLogicOps, bCBpartial, bCBoffsetting; + CheckD3D11Ops(pD3D, bLogicOps, bCBpartial, bCBoffsetting); + logic_ops = bLogicOps ? "Optional (Yes)" : "Optional (No)"; + cb_partial = bCBpartial ? "Optional (Yes)" : "Optional (No)"; + cb_offsetting = bCBoffsetting ? "Optional (Yes)" : "Optional (No)"; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D, ext, x2, bpp565); + + extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; + x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; + nonpow2 = "Full"; + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D11) + { + D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {}; + HRESULT hr = pD3D11->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw)); + if (FAILED(hr)) + memset(&d3d10xhw, 0, sizeof(d3d10xhw)); + + computeShader = (d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) ? "Optional (Yes - CS 4.x)" : "Optional (No)"; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D11, ext, x2, bpp565); + + extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; + x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D10_1) + { + BOOL ext, x2; + CheckExtendedFormats(pD3D10_1, ext, x2); + + extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; + x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D10) + { + BOOL ext, x2; + CheckExtendedFormats(pD3D10, ext, x2); + + extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; + x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; + } + + maxTexDim = XTOSTRING(D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING(D3D10_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING(D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING(D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION); + maxAnisotropy = XTOSTRING(D3D10_REQ_MAXANISOTROPY); + maxInputSlots = XTOSTRING(D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING(D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT); + break; + + case D3D_FEATURE_LEVEL_10_0: + shaderModel = "4.0"; + instancing = c_szYes; + + if (pD3D11_3) + { + consrv_rast = rast_ordered_views = ps_stencil_ref = c_szNo; + } + + if (pD3D11_2 || pD3D11_3) + { + tiled_rsc = minmaxfilter = mapdefaultbuff = c_szNo; + } + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : ((pD3D11_2) ? pD3D11_2 : pD3D11_1); + + D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {}; + HRESULT hr = pD3D->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw)); + if (FAILED(hr)) + memset(&d3d10xhw, 0, sizeof(d3d10xhw)); + + if (d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) + { + computeShader = "Optional (Yes - CS 4.x)"; + uavSlots = "1"; + uavEveryStage = c_szNo; + uavOnlyRender = c_szNo; + } + else + { + computeShader = "Optional (No)"; + } + + bool bLogicOps, bCBpartial, bCBoffsetting; + CheckD3D11Ops(pD3D, bLogicOps, bCBpartial, bCBoffsetting); + logic_ops = bLogicOps ? "Optional (Yes)" : "Optional (No)"; + cb_partial = bCBpartial ? "Optional (Yes)" : "Optional (No)"; + cb_offsetting = bCBoffsetting ? "Optional (Yes)" : "Optional (No)"; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D, ext, x2, bpp565); + + extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; + x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; + nonpow2 = "Full"; + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D11) + { + D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {}; + HRESULT hr = pD3D11->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw)); + if (FAILED(hr)) + memset(&d3d10xhw, 0, sizeof(d3d10xhw)); + + computeShader = (d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) ? "Optional (Yes - CS 4.0)" : "Optional (No)"; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D11, ext, x2, bpp565); + + extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; + x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D10_1) + { + BOOL ext, x2; + CheckExtendedFormats(pD3D10_1, ext, x2); + + extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; + x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D10) + { + BOOL ext, x2; + CheckExtendedFormats(pD3D10, ext, x2); + + extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; + x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; + } + + maxTexDim = XTOSTRING(D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING(D3D10_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING(D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING(D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION); + maxAnisotropy = XTOSTRING(D3D10_REQ_MAXANISOTROPY); + maxInputSlots = XTOSTRING(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING(D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT); + break; + + case D3D_FEATURE_LEVEL_9_3: + _10level9 = TRUE; + shaderModel = "2.0 (4_0_level_9_3) [vs_2_a/ps_2_b]"; + computeShader = c_szNA; + maxTexDim = XTOSTRING2(D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING2(D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING2(D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING2(D3D_FL9_3_MAX_TEXTURE_REPEAT); + maxAnisotropy = XTOSTRING(D3D11_REQ_MAXANISOTROPY); + maxPrimCount = XTOSTRING2(D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT); + maxInputSlots = XTOSTRING(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING2(D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT); + extFormats = c_szYes; + instancing = c_szYes; + + if (pD3D11_2 || pD3D11_3) + { + ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : pD3D11_2; + + cb_partial = c_szYes; + cb_offsetting = c_szYes; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D, ext, x2, bpp565); + + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + + bool bNonPow2, bShadows, bInstancing, bCubeRT; + CheckD3D9Ops1(pD3D, bNonPow2, bShadows, bInstancing, bCubeRT); + nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; + shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; + cubeRT = bCubeRT ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D11_1) + { + cb_partial = c_szYes; + cb_offsetting = c_szYes; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D11_1, ext, x2, bpp565); + + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + + bool bNonPow2, bShadows; + CheckD3D9Ops(pD3D11_1, bNonPow2, bShadows); + nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; + shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; + } + break; + + case D3D_FEATURE_LEVEL_9_2: + _10level9 = TRUE; + shaderModel = "2.0 (4_0_level_9_1)"; + computeShader = c_szNA; + maxTexDim = XTOSTRING2(D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING2(D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING2(D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING2(D3D_FL9_2_MAX_TEXTURE_REPEAT); + maxAnisotropy = XTOSTRING(D3D11_REQ_MAXANISOTROPY); + maxPrimCount = XTOSTRING2(D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT); + maxInputSlots = XTOSTRING(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING2(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT); + extFormats = c_szYes; + instancing = c_szNo; + + if (pD3D11_2 || pD3D11_3) + { + ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : pD3D11_2; + + cb_partial = c_szYes; + cb_offsetting = c_szYes; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D, ext, x2, bpp565); + + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + + bool bNonPow2, bShadows, bInstancing, bCubeRT; + CheckD3D9Ops1(pD3D, bNonPow2, bShadows, bInstancing, bCubeRT); + nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; + shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; + instancing = bInstancing ? "Optional (Simple)" : "Optional (No)"; + cubeRT = bCubeRT ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D11_1) + { + cb_partial = c_szYes; + cb_offsetting = c_szYes; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D11_1, ext, x2, bpp565); + + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + + bool bNonPow2, bShadows; + CheckD3D9Ops(pD3D11_1, bNonPow2, bShadows); + nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; + shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; + } + break; + + case D3D_FEATURE_LEVEL_9_1: + _10level9 = TRUE; + shaderModel = "2.0 (4_0_level_9_1)"; + computeShader = c_szNA; + maxTexDim = XTOSTRING2(D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION); + maxCubeDim = XTOSTRING2(D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION); + maxVolDim = XTOSTRING2(D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + maxTexRepeat = XTOSTRING2(D3D_FL9_1_MAX_TEXTURE_REPEAT); + maxAnisotropy = XTOSTRING2(D3D_FL9_1_DEFAULT_MAX_ANISOTROPY); + maxPrimCount = XTOSTRING2(D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT); + maxInputSlots = XTOSTRING(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT); + mrt = XTOSTRING2(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT); + extFormats = c_szYes; + instancing = c_szNo; + + if (pD3D11_2 || pD3D11_3) + { + ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : pD3D11_2; + + cb_partial = c_szYes; + cb_offsetting = c_szYes; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D, ext, x2, bpp565); + + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + + bool bNonPow2, bShadows, bInstancing, bCubeRT; + CheckD3D9Ops1(pD3D, bNonPow2, bShadows, bInstancing, bCubeRT); + nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; + shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; + instancing = bInstancing ? "Optional (Simple)" : "Optional (No)"; + cubeRT = bCubeRT ? "Optional (Yes)" : "Optional (No)"; + } + else if (pD3D11_1) + { + cb_partial = c_szYes; + cb_offsetting = c_szYes; + + BOOL ext, x2, bpp565; + CheckExtendedFormats(pD3D11_1, ext, x2, bpp565); + + bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; + + bool bNonPow2, bShadows; + CheckD3D9Ops(pD3D11_1, bNonPow2, bShadows); + nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; + shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; + } + break; + + default: + return E_FAIL; + } + + if (d3dType == D3D_DRIVER_TYPE_WARP) + { + maxTexDim = (pD3D12 || pD3D11_3 || pD3D11_2 || pD3D11_1) ? "16777216" : "65536"; + } + + if (!pPrintInfo) + { + LVLINE("Shader Model", shaderModel); + LVYESNO("Geometry Shader", (fl >= D3D_FEATURE_LEVEL_10_0)); + LVYESNO("Stream Out", (fl >= D3D_FEATURE_LEVEL_10_0)); + + if (pD3D12 || pD3D11_3 || pD3D11_2 || pD3D11_1 || pD3D11) + { + if (g_dwViewState == IDM_VIEWALL || computeShader != c_szNo) + { + LVLINE("DirectCompute", computeShader); + } + + LVYESNO("Hull & Domain Shaders", (fl >= D3D_FEATURE_LEVEL_11_0)); + } + + LVYESNO("Texture Resource Arrays", (fl >= D3D_FEATURE_LEVEL_10_0)); + + if (d3dVer != 0) + { + LVYESNO("Cubemap Resource Arrays", (fl >= D3D_FEATURE_LEVEL_10_1)); + } + + LVYESNO("BC4/BC5 Compression", (fl >= D3D_FEATURE_LEVEL_10_0)); + + if (pD3D12 || pD3D11_3 || pD3D11_2 || pD3D11_1 || pD3D11) + { + LVYESNO("BC6H/BC7 Compression", (fl >= D3D_FEATURE_LEVEL_11_0)); + } + + LVYESNO("Alpha-to-coverage", (fl >= D3D_FEATURE_LEVEL_10_0)); + + if (pD3D11_1 || pD3D11_2 || pD3D11_3 || pD3D12) + { + LVLINE("Logic Ops (Output Merger)", logic_ops); + } + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + LVLINE("Constant Buffer Partial Updates", cb_partial); + LVLINE("Constant Buffer Offsetting", cb_offsetting); + + if (uavEveryStage) + { + LVLINE("UAVs at Every Stage", uavEveryStage); + } + + if (uavOnlyRender) + { + LVLINE("UAV-only rendering", uavOnlyRender); + } + } + + if (pD3D11_2 || pD3D11_3 || pD3D12) + { + if (tiled_rsc) + { + LVLINE("Tiled Resources", tiled_rsc); + } + } + + if (pD3D11_2 || pD3D11_3) + { + if (minmaxfilter) + { + LVLINE("Min/Max Filtering", minmaxfilter); + } + + if (mapdefaultbuff) + { + LVLINE("Map DEFAULT Buffers", mapdefaultbuff); + } + } + + if (pD3D11_3 || pD3D12) + { + if (consrv_rast) + { + LVLINE("Conservative Rasterization", consrv_rast); + } + + if (ps_stencil_ref) + { + LVLINE("PS-Specified Stencil Ref", ps_stencil_ref); + } + + if (rast_ordered_views) + { + LVLINE("Rasterizer Ordered Views", rast_ordered_views); + } + } + + if (pD3D12) + { + if (binding_rsc) + { + LVLINE("Resource Binding", binding_rsc); + } + } + + if (g_DXGIFactory1 && !pD3D12) + { + LVLINE("Extended Formats (BGRA, etc.)", extFormats); + + if (x2_10BitFormat && (g_dwViewState == IDM_VIEWALL || x2_10BitFormat != c_szNo)) + { + LVLINE("10-bit XR High Color Format", x2_10BitFormat); + } + } + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + LVLINE("16-bit Formats (565/5551/4444)", bpp16); + } + + if (nonpow2 && !pD3D12) + { + LVLINE("Non-Power-of-2 Textures", nonpow2); + } + + LVLINE("Max Texture Dimension", maxTexDim); + LVLINE("Max Cubemap Dimension", maxCubeDim); + + if (maxVolDim) + { + LVLINE("Max Volume Extent", maxVolDim); + } + + if (maxTexRepeat) + { + LVLINE("Max Texture Repeat", maxTexRepeat); + } + + LVLINE("Max Input Slots", maxInputSlots); + + if (uavSlots) + { + LVLINE("UAV Slots", uavSlots); + } + + if (maxAnisotropy) + { + LVLINE("Max Anisotropy", maxAnisotropy); + } + + LVLINE("Max Primitive Count", maxPrimCount); + + if (mrt) + { + LVLINE("Simultaneous Render Targets", mrt); + } + + if (_10level9) + { + LVYESNO("Occlusion Queries", (fl >= D3D_FEATURE_LEVEL_9_2)); + LVYESNO("Separate Alpha Blend", (fl >= D3D_FEATURE_LEVEL_9_2)); + LVYESNO("Mirror Once", (fl >= D3D_FEATURE_LEVEL_9_2)); + LVYESNO("Overlapping Vertex Elements", (fl >= D3D_FEATURE_LEVEL_9_2)); + LVYESNO("Independant Write Masks", (fl >= D3D_FEATURE_LEVEL_9_3)); + + LVLINE("Instancing", instancing); + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + LVLINE("Shadow Support", shadows); + } + + if (pD3D11_2 || pD3D11_3) + { + LVLINE("Cubemap Render w/ non-Cube Depth", cubeRT); + } + } + + LVLINE("Note", FL_NOTE); + } + else + { + PRINTLINE("Shader Model", shaderModel); + PRINTYESNO("Geometry Shader", (fl >= D3D_FEATURE_LEVEL_10_0)); + PRINTYESNO("Stream Out", (fl >= D3D_FEATURE_LEVEL_10_0)); + + if (pD3D12 || pD3D11_3 || pD3D11_2 || pD3D11_1 || pD3D11) + { + PRINTLINE("DirectCompute", computeShader); + PRINTYESNO("Hull & Domain Shaders", (fl >= D3D_FEATURE_LEVEL_11_0)); + } + + PRINTYESNO("Texture Resource Arrays", (fl >= D3D_FEATURE_LEVEL_10_0)); + + if (d3dVer != 0) + { + PRINTYESNO("Cubemap Resource Arrays", (fl >= D3D_FEATURE_LEVEL_10_1)); + } + + PRINTYESNO("BC4/BC5 Compression", (fl >= D3D_FEATURE_LEVEL_10_0)); + + if (pD3D11_3 || pD3D11_2 || pD3D11_1 || pD3D11) + { + PRINTYESNO("BC6H/BC7 Compression", (fl >= D3D_FEATURE_LEVEL_11_0)); + } + + PRINTYESNO("Alpha-to-coverage", (fl >= D3D_FEATURE_LEVEL_10_0)); + + if (pD3D11_1 || pD3D11_2 || pD3D11_3 || pD3D12) + { + PRINTLINE("Logic Ops (Output Merger)", logic_ops); + } + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + PRINTLINE("Constant Buffer Partial Updates", cb_partial); + PRINTLINE("Constant Buffer Offsetting", cb_offsetting); + + if (uavEveryStage) + { + PRINTLINE("UAVs at Every Stage", uavEveryStage); + } + + if (uavOnlyRender) + { + PRINTLINE("UAV-only rendering", uavOnlyRender); + } + } + + if (pD3D11_2 || pD3D11_3 || pD3D12) + { + if (tiled_rsc) + { + PRINTLINE("Tiled Resources", tiled_rsc); + } + } + + if (pD3D11_2 || pD3D11_3) + { + if (minmaxfilter) + { + PRINTLINE("Min/Max Filtering", minmaxfilter); + } + + if (mapdefaultbuff) + { + PRINTLINE("Map DEFAULT Buffers", mapdefaultbuff); + } + } + + if (pD3D11_3 || pD3D12) + { + if (consrv_rast) + { + PRINTLINE("Conservative Rasterization", consrv_rast); + } + + if (ps_stencil_ref) + { + PRINTLINE("PS-Specified Stencil Ref ", ps_stencil_ref); + } + + if (rast_ordered_views) + { + PRINTLINE("Rasterizer Ordered Views", rast_ordered_views); + } + } + + if (pD3D12) + { + if (binding_rsc) + { + PRINTLINE("Resource Binding", binding_rsc); + } + } + + if (g_DXGIFactory1 && !pD3D12) + { + PRINTLINE("Extended Formats (BGRA, etc.)", extFormats); + + if (x2_10BitFormat) + { + PRINTLINE("10-bit XR High Color Format", x2_10BitFormat); + } + } + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + PRINTLINE("16-bit Formats (565/5551/4444)", bpp16); + } + + if (nonpow2) + { + PRINTLINE("Non-Power-of-2 Textures", nonpow2); + } + + PRINTLINE("Max Texture Dimension", maxTexDim); + PRINTLINE("Max Cubemap Dimension", maxCubeDim); + + if (maxVolDim) + { + PRINTLINE("Max Volume Extent", maxVolDim); + } + + if (maxTexRepeat) + { + PRINTLINE("Max Texture Repeat", maxTexRepeat); + } + + PRINTLINE("Max Input Slots", maxInputSlots); + + if (uavSlots) + { + PRINTLINE("UAV Slots", uavSlots); + } + + if (maxAnisotropy) + { + PRINTLINE("Max Anisotropy", maxAnisotropy); + } + + PRINTLINE("Max Primitive Count", maxPrimCount); + + if (mrt) + { + PRINTLINE("Simultaneous Render Targets", mrt); + } + + if (_10level9) + { + PRINTYESNO("Occlusion Queries", (fl >= D3D_FEATURE_LEVEL_9_2)); + PRINTYESNO("Separate Alpha Blend", (fl >= D3D_FEATURE_LEVEL_9_2)); + PRINTYESNO("Mirror Once", (fl >= D3D_FEATURE_LEVEL_9_2)); + PRINTYESNO("Overlapping Vertex Elements", (fl >= D3D_FEATURE_LEVEL_9_2)); + PRINTYESNO("Independant Write Masks", (fl >= D3D_FEATURE_LEVEL_9_3)); + + PRINTLINE("Instancing", instancing); + + if (pD3D11_1 || pD3D11_2 || pD3D11_3) + { + PRINTLINE("Shadow Support", shadows); + } + + if (pD3D11_2 || pD3D11_3) + { + PRINTLINE("Cubemap Render w/ non-Cube Depth", cubeRT); + } + } + + PRINTLINE("Note", FL_NOTE); + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + HRESULT D3D10Info(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + if (!pDevice) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + + if (lParam2 == D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) + { + LVAddColumn(g_hwndLV, 1, "Value", 25); + LVAddColumn(g_hwndLV, 2, "Quality Level", 25); + } + else + { + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + } + + if (!lParam2) + { + // General Direct3D 10.0 device information + + BOOL ext, x2; + CheckExtendedFormats(pDevice, ext, x2); + + if (!pPrintInfo) + { + if (g_DXGIFactory1) + { + LVYESNO("Extended Formats (BGRA, etc.)", ext); + LVYESNO("10-bit XR High Color Format", x2); + } + + LVLINE("Note", D3D10_NOTE); + } + else + { + if (g_DXGIFactory1) + { + PRINTYESNO("Extended Formats (BGRA, etc.)", ext); + PRINTYESNO("10-bit XR High Color Format", x2); + } + + PRINTLINE("Note", D3D10_NOTE); + } + + return S_OK; + } + + // Use CheckFormatSupport for format usage defined as optional for Direct3D 10 devices + static const DXGI_FORMAT cfsShaderSample[] = + { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32_FLOAT, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, + DXGI_FORMAT_R32_FLOAT, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS + }; + + static const DXGI_FORMAT cfsMipAutoGen[] = + { + DXGI_FORMAT_R32G32B32_FLOAT + }; + + static const DXGI_FORMAT cfsRenderTarget[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R32G32B32_SINT + }; + + static const DXGI_FORMAT cfsBlendableRT[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R16G16B16A16_UNORM, + DXGI_FORMAT_R16G16_UNORM, + DXGI_FORMAT_R16_UNORM + }; + + UINT count = 0; + const DXGI_FORMAT* array = nullptr; + BOOL skips = FALSE; + + switch (lParam2) + { + case D3D10_FORMAT_SUPPORT_SHADER_SAMPLE: + count = sizeof(cfsShaderSample) / sizeof(DXGI_FORMAT); + array = cfsShaderSample; + break; + + case D3D10_FORMAT_SUPPORT_MIP_AUTOGEN: + count = sizeof(cfsMipAutoGen) / sizeof(DXGI_FORMAT); + array = cfsMipAutoGen; + break; + + case D3D10_FORMAT_SUPPORT_RENDER_TARGET: + count = sizeof(cfsRenderTarget) / sizeof(DXGI_FORMAT); + array = cfsRenderTarget; + break; + + case D3D10_FORMAT_SUPPORT_BLENDABLE: + count = sizeof(cfsBlendableRT) / sizeof(DXGI_FORMAT); + array = cfsBlendableRT; + break; + + case D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET: + count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); + array = g_cfsMSAA_10; + break; + + case D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD: + count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); + array = g_cfsMSAA_10; + skips = TRUE; + break; + + default: + return E_FAIL; + } + + for (UINT i = 0; i < count; ++i) + { + DXGI_FORMAT fmt = array[i]; + + if (skips) + { + // Special logic to let us reuse the MSAA array twice with a few special cases that are skipped + switch (fmt) + { + case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_D24_UNORM_S8_UINT: + case DXGI_FORMAT_D16_UNORM: + continue; + } + } + + if (lParam2 == D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) + { + UINT quality; + HRESULT hr = pDevice->CheckMultisampleQualityLevels(fmt, (UINT)lParam3, &quality); + + BOOL msaa = (SUCCEEDED(hr) && quality > 0) != 0; + + if (!pPrintInfo) + { + if (g_dwViewState == IDM_VIEWALL || msaa) + { + LVAddText(g_hwndLV, 0, FormatName(fmt)); + LVAddText(g_hwndLV, 1, msaa ? c_szYes : c_szNo); \ + + TCHAR strBuffer[16]; + sprintf_s(strBuffer, 16, "%u", msaa ? quality : 0); + LVAddText(g_hwndLV, 2, strBuffer); + } + } + else + { + TCHAR strBuffer[32]; + if (msaa) + sprintf_s(strBuffer, 32, "Yes (%u)", quality); + else + strcpy_s(strBuffer, 32, c_szNo); + + PrintStringValueLine(FormatName(fmt), strBuffer, pPrintInfo); + } + } + else + { + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(fmt, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + else + { + PRINTYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + } + } + + return S_OK; + } + + HRESULT D3D10Info1(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + if (!pDevice) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + + if (lParam2 == D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) + { + LVAddColumn(g_hwndLV, 1, "Value", 25); + LVAddColumn(g_hwndLV, 2, "Quality Level", 25); + } + else + { + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + } + + if (!lParam2) + { + // General Direct3D 10.1 device information + D3D10_FEATURE_LEVEL1 fl = pDevice->GetFeatureLevel(); + + const char* szNote = nullptr; + + switch (fl) + { + case D3D10_FEATURE_LEVEL_10_0: + szNote = SEE_D3D10; + break; + + case D3D10_FEATURE_LEVEL_9_3: + case D3D10_FEATURE_LEVEL_9_2: + case D3D10_FEATURE_LEVEL_9_1: + szNote = _10L9_NOTE; + break; + + default: + szNote = D3D10_NOTE1; + break; + } + + BOOL ext, x2; + CheckExtendedFormats(pDevice, ext, x2); + + if (!pPrintInfo) + { + LVLINE("Feature Level", FLName(fl)); + + if (g_DXGIFactory1 != nullptr && (fl >= D3D10_FEATURE_LEVEL_10_0)) + { + LVYESNO("Extended Formats (BGRA, etc.)", ext); + LVYESNO("10-bit XR High Color Format", x2); + } + + LVLINE("Note", szNote); + } + else + { + PRINTLINE("Feature Level", FLName(fl)); + + if (g_DXGIFactory1 != nullptr && (fl >= D3D10_FEATURE_LEVEL_10_0)) + { + PRINTYESNO("Extended Formats (BGRA, etc.)", ext); + PRINTYESNO("10-bit XR High Color Format", x2); + } + + PRINTLINE("Note", szNote); + } + + return S_OK; + } + + // Use CheckFormatSupport for format usage defined as optional for Direct3D 10.1 devices + static const DXGI_FORMAT cfsShaderSample[] = + { + DXGI_FORMAT_R32G32B32_FLOAT + }; + + static const DXGI_FORMAT cfsMipAutoGen[] = + { + DXGI_FORMAT_R32G32B32_FLOAT + }; + + static const DXGI_FORMAT cfsRenderTarget[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R32G32B32_SINT + }; + + // Most RT formats are required to support 4x MSAA for 10.1 devices + static const DXGI_FORMAT cfsMSAA4x[] = + { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32A32_SINT, + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R32G32B32_SINT, + }; + + UINT count = 0; + const DXGI_FORMAT* array = nullptr; + + switch (lParam2) + { + case D3D10_FORMAT_SUPPORT_SHADER_SAMPLE: + count = sizeof(cfsShaderSample) / sizeof(DXGI_FORMAT); + array = cfsShaderSample; + break; + + case D3D10_FORMAT_SUPPORT_MIP_AUTOGEN: + count = sizeof(cfsMipAutoGen) / sizeof(DXGI_FORMAT); + array = cfsMipAutoGen; + break; + + case D3D10_FORMAT_SUPPORT_RENDER_TARGET: + count = sizeof(cfsRenderTarget) / sizeof(DXGI_FORMAT); + array = cfsRenderTarget; + break; + + case D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET: + if (pDevice->GetFeatureLevel() <= D3D10_FEATURE_LEVEL_9_3) + { + count = sizeof(g_cfsMSAA_10level9) / sizeof(DXGI_FORMAT); + array = g_cfsMSAA_10level9; + } + else if (g_dwViewState != IDM_VIEWALL && lParam3 == 4) + { + count = sizeof(cfsMSAA4x) / sizeof(DXGI_FORMAT); + array = cfsMSAA4x; + } + else + { + count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); + array = g_cfsMSAA_10; + } + break; + + default: + return E_FAIL; + } + + for (UINT i = 0; i < count; ++i) + { + DXGI_FORMAT fmt = array[i]; + + if (lParam2 == D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) + { + UINT quality; + HRESULT hr = pDevice->CheckMultisampleQualityLevels(fmt, (UINT)lParam3, &quality); + + BOOL msaa = (SUCCEEDED(hr) && quality > 0) != 0; + + if (!pPrintInfo) + { + if (g_dwViewState == IDM_VIEWALL || msaa) + { + LVAddText(g_hwndLV, 0, FormatName(fmt)); + LVAddText(g_hwndLV, 1, msaa ? c_szYes : c_szNo); \ + + TCHAR strBuffer[16]; + sprintf_s(strBuffer, 16, "%u", msaa ? quality : 0); + LVAddText(g_hwndLV, 2, strBuffer); + } + } + else + { + TCHAR strBuffer[32]; + if (msaa) + sprintf_s(strBuffer, 32, "Yes (%u)", quality); + else + strcpy_s(strBuffer, 32, c_szNo); + + PrintStringValueLine(FormatName(fmt), strBuffer, pPrintInfo); + } + } + else + { + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(fmt, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), fmtSupport& (UINT)lParam2); + } + else + { + PRINTYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + } + } + + return S_OK; + } + + + HRESULT D3D10InfoMSAA(LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + if (!pDevice) + return S_OK; + + auto sampCount = reinterpret_cast(lParam2); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + + UINT column = 1; + for (UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + if (!sampCount[samples - 1] && !IsMSAAPowerOf2(samples)) + continue; + + TCHAR strBuffer[8]; + sprintf_s(strBuffer, 8, "%ux", samples); + LVAddColumn(g_hwndLV, column, strBuffer, 8); + ++column; + } + } + + const UINT count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); + + for (UINT i = 0; i < count; ++i) + { + DXGI_FORMAT fmt = g_cfsMSAA_10[i]; + + UINT sampQ[D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT]; + memset(sampQ, 0, sizeof(sampQ)); + + BOOL any = FALSE; + for (UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + UINT quality; + HRESULT hr = pDevice->CheckMultisampleQualityLevels(fmt, samples, &quality); + + if (SUCCEEDED(hr) && quality > 0) + { + sampQ[samples - 1] = quality; + any = TRUE; + } + } + + if (!pPrintInfo) + { + if (g_dwViewState != IDM_VIEWALL && !any) + continue; + + LVAddText(g_hwndLV, 0, FormatName(fmt)); + + UINT column = 1; + for (UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + if (!sampCount[samples - 1] && !IsMSAAPowerOf2(samples)) + continue; + + if (sampQ[samples - 1] > 0) + { + TCHAR strBuffer[32]; + sprintf_s(strBuffer, 32, "Yes (%u)", sampQ[samples - 1]); + LVAddText(g_hwndLV, column, strBuffer); + } + else + LVAddText(g_hwndLV, column, c_szNo); + + ++column; + } + } + else + { + TCHAR buff[1024]; + *buff = 0; + + for (UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + if (!sampCount[samples - 1] && !IsMSAAPowerOf2(samples)) + continue; + + TCHAR strBuffer[32]; + if (sampQ[samples - 1] > 0) + sprintf_s(strBuffer, 32, "%ux: Yes (%u) ", samples, sampQ[samples - 1]); + else + sprintf_s(strBuffer, 32, "%ux: No ", samples); + + strcat_s(buff, 1024, strBuffer); + } + + PrintStringValueLine(FormatName(fmt), buff, pPrintInfo); + } + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + HRESULT D3D11Info(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + if (!pDevice) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + + if (lParam2 == D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) + { + LVAddColumn(g_hwndLV, 1, "Value", 25); + LVAddColumn(g_hwndLV, 2, "Quality Level", 25); + } + else + { + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + } + + if (!lParam2) + { + // General Direct3D 11 device information + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + if (fl > D3D_FEATURE_LEVEL_11_0) + fl = D3D_FEATURE_LEVEL_11_0; + + // CheckFeatureSupport + D3D11_FEATURE_DATA_THREADING threading = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_THREADING, &threading, sizeof(threading)); + if (FAILED(hr)) + memset(&threading, 0, sizeof(threading)); + + D3D11_FEATURE_DATA_DOUBLES doubles = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_DOUBLES, &doubles, sizeof(doubles)); + if (FAILED(hr)) + memset(&doubles, 0, sizeof(doubles)); + + D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw)); + if (FAILED(hr)) + memset(&d3d10xhw, 0, sizeof(d3d10xhw)); + + // Setup note + const char* szNote = nullptr; + + switch (fl) + { + case D3D_FEATURE_LEVEL_10_0: + szNote = SEE_D3D10; + break; + + case D3D_FEATURE_LEVEL_10_1: + case D3D_FEATURE_LEVEL_9_3: + case D3D_FEATURE_LEVEL_9_2: + case D3D_FEATURE_LEVEL_9_1: + szNote = SEE_D3D10_1; + break; + + default: + szNote = D3D11_NOTE; + break; + } + + if (!pPrintInfo) + { + LVLINE("Feature Level", FLName(fl)); + + LVYESNO("Driver Concurrent Creates", threading.DriverConcurrentCreates); + LVYESNO("Driver Command Lists", threading.DriverCommandLists); + LVYESNO("Double-precision Shaders", doubles.DoublePrecisionFloatShaderOps); + LVYESNO("DirectCompute CS 4.x", d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x); + + LVLINE("Note", szNote); + } + else + { + PRINTLINE("Feature Level", FLName(fl)); + + PRINTYESNO("Driver Concurrent Creates", threading.DriverConcurrentCreates); + PRINTYESNO("Driver Command Lists", threading.DriverCommandLists); + PRINTYESNO("Double-precision Shaders", doubles.DoublePrecisionFloatShaderOps); + PRINTYESNO("DirectCompute CS 4.x", d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x); + + PRINTLINE("Note", szNote); + } + + return S_OK; + } + + // Use CheckFormatSupport for format usage defined as optional for Direct3D 11 devices + static const DXGI_FORMAT cfsShaderSample[] = + { + DXGI_FORMAT_R32G32B32_FLOAT + }; + + static const DXGI_FORMAT cfsShaderGather[] = + { + DXGI_FORMAT_R32G32B32_FLOAT + }; + + static const DXGI_FORMAT cfsMipAutoGen[] = + { + DXGI_FORMAT_R32G32B32_FLOAT + }; + + static const DXGI_FORMAT cfsRenderTarget[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R32G32B32_SINT + }; + + // Most RT formats are required to support 8x MSAA for 11 devices + static const DXGI_FORMAT cfsMSAA8x[] = + { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32A32_SINT + }; + + UINT count = 0; + const DXGI_FORMAT* array = nullptr; + + switch (lParam2) + { + case D3D11_FORMAT_SUPPORT_SHADER_SAMPLE: + count = sizeof(cfsShaderSample) / sizeof(DXGI_FORMAT); + array = cfsShaderSample; + break; + + case D3D11_FORMAT_SUPPORT_SHADER_GATHER: + count = sizeof(cfsShaderGather) / sizeof(DXGI_FORMAT); + array = cfsShaderGather; + break; + + case D3D11_FORMAT_SUPPORT_MIP_AUTOGEN: + count = sizeof(cfsMipAutoGen) / sizeof(DXGI_FORMAT); + array = cfsMipAutoGen; + break; + + case D3D11_FORMAT_SUPPORT_RENDER_TARGET: + count = sizeof(cfsRenderTarget) / sizeof(DXGI_FORMAT); + array = cfsRenderTarget; + break; + + case D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET: + if (g_dwViewState != IDM_VIEWALL && lParam3 == 8) + { + count = sizeof(cfsMSAA8x) / sizeof(DXGI_FORMAT); + array = cfsMSAA8x; + } + else if (g_dwViewState != IDM_VIEWALL && lParam3 == 4) + { + count = 0; + } + else + { + count = _countof(g_cfsMSAA_11); + array = g_cfsMSAA_11; + } + break; + + default: + return E_FAIL; + } + + for (UINT i = 0; i < count; ++i) + { + DXGI_FORMAT fmt = array[i]; + + if (lParam2 == D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) + { + // Skip 16 bits-per-pixel formats for DX 11.0 + if (fmt == DXGI_FORMAT_B5G6R5_UNORM || fmt == DXGI_FORMAT_B5G5R5A1_UNORM || fmt == DXGI_FORMAT_B4G4R4A4_UNORM) + continue; + + UINT quality; + HRESULT hr = pDevice->CheckMultisampleQualityLevels(fmt, (UINT)lParam3, &quality); + + BOOL msaa = (SUCCEEDED(hr) && quality > 0) != 0; + + if (!pPrintInfo) + { + if (g_dwViewState == IDM_VIEWALL || msaa) + { + LVAddText(g_hwndLV, 0, FormatName(fmt)); + LVAddText(g_hwndLV, 1, msaa ? c_szYes : c_szNo); \ + + TCHAR strBuffer[16]; + sprintf_s(strBuffer, 16, "%u", msaa ? quality : 0); + LVAddText(g_hwndLV, 2, strBuffer); + } + } + else + { + TCHAR strBuffer[32]; + if (msaa) + sprintf_s(strBuffer, 32, "Yes (%u)", quality); + else + strcpy_s(strBuffer, 32, c_szNo); + + PrintStringValueLine(FormatName(fmt), strBuffer, pPrintInfo); + } + } + else + { + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(fmt, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + else + { + PRINTYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + } + } + + return S_OK; + } + + void D3D11FeatureSupportInfo1(ID3D11Device1* pDevice, bool bDev2, PRINTCBINFO* pPrintInfo) + { + if (!pDevice) + return; + + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + + // CheckFeatureSupport + D3D11_FEATURE_DATA_THREADING threading = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_THREADING, &threading, sizeof(threading)); + if (FAILED(hr)) + memset(&threading, 0, sizeof(threading)); + + D3D11_FEATURE_DATA_DOUBLES doubles = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_DOUBLES, &doubles, sizeof(doubles)); + if (FAILED(hr)) + memset(&doubles, 0, sizeof(doubles)); + + D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw)); + if (FAILED(hr)) + memset(&d3d10xhw, 0, sizeof(d3d10xhw)); + + D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11opts = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &d3d11opts, sizeof(d3d11opts)); + if (FAILED(hr)) + memset(&d3d11opts, 0, sizeof(d3d11opts)); + + D3D11_FEATURE_DATA_D3D9_OPTIONS d3d9opts = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_OPTIONS, &d3d9opts, sizeof(d3d9opts)); + if (FAILED(hr)) + memset(&d3d9opts, 0, sizeof(d3d9opts)); + + D3D11_FEATURE_DATA_ARCHITECTURE_INFO d3d11arch = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_ARCHITECTURE_INFO, &d3d11arch, sizeof(d3d11arch)); + if (FAILED(hr)) + memset(&d3d11arch, 0, sizeof(d3d11arch)); + + D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT minprecis = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT, &minprecis, sizeof(minprecis)); + if (FAILED(hr)) + memset(&minprecis, 0, sizeof(minprecis)); + + D3D11_FEATURE_DATA_D3D11_OPTIONS1 d3d11opts1 = {}; + memset(&d3d11opts1, 0, sizeof(d3d11opts1)); + if (bDev2) + { + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS1, &d3d11opts1, sizeof(d3d11opts1)); + if (FAILED(hr)) + memset(&d3d11opts1, 0, sizeof(d3d11opts1)); + } + + const char* clearview = nullptr; + if (d3d11opts.ClearView) + { + clearview = d3d11opts1.ClearViewAlsoSupportsDepthOnlyFormats ? "RTV, UAV, and Depth (Driver sees)" : "RTV and UAV (Driver sees)"; + } + else + { + clearview = d3d11opts1.ClearViewAlsoSupportsDepthOnlyFormats ? "RTV, UAV, and Depth (Driver doesn't see)" : "RTV and UAV (Driver doesn't see)"; + } + + const char* double_shaders = nullptr; + if (d3d11opts.ExtendedDoublesShaderInstructions) + { + double_shaders = "Extended"; + } + else if (doubles.DoublePrecisionFloatShaderOps) + { + double_shaders = c_szYes; + } + else + { + double_shaders = c_szNo; + } + + const char* ps_precis = nullptr; + switch (minprecis.PixelShaderMinPrecision & (D3D11_SHADER_MIN_PRECISION_16_BIT | D3D11_SHADER_MIN_PRECISION_10_BIT)) + { + case 0: ps_precis = "Full"; break; + case D3D11_SHADER_MIN_PRECISION_16_BIT: ps_precis = "16/32-bit"; break; + case D3D11_SHADER_MIN_PRECISION_10_BIT: ps_precis = "10/32-bit"; break; + default: ps_precis = "10/16/32-bit"; break; + } + + const char* other_precis = nullptr; + switch (minprecis.AllOtherShaderStagesMinPrecision & (D3D11_SHADER_MIN_PRECISION_16_BIT | D3D11_SHADER_MIN_PRECISION_10_BIT)) + { + case 0: other_precis = "Full"; break; + case D3D11_SHADER_MIN_PRECISION_16_BIT: other_precis = "16/32-bit"; break; + case D3D11_SHADER_MIN_PRECISION_10_BIT: other_precis = "10/32-bit"; break; + default: other_precis = "10/16/32-bit"; break; + } + + const char* nonpow2 = (d3d9opts.FullNonPow2TextureSupport) ? "Full" : "Conditional"; + + if (!pPrintInfo) + { + LVLINE("Feature Level", FLName(fl)); + + LVYESNO("Driver Concurrent Creates", threading.DriverConcurrentCreates); + LVYESNO("Driver Command Lists", threading.DriverCommandLists); + LVLINE("Double-precision Shaders", double_shaders); + LVYESNO("DirectCompute CS 4.x", d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x); + + LVYESNO("Driver sees DiscardResource/View", d3d11opts.DiscardAPIsSeenByDriver); + LVYESNO("Driver sees COPY_FLAGS", d3d11opts.FlagsForUpdateAndCopySeenByDriver); + LVLINE("ClearView", clearview); + LVYESNO("Copy w/ Overlapping Rect", d3d11opts.CopyWithOverlap); + LVYESNO("CB Partial Update", d3d11opts.ConstantBufferPartialUpdate); + LVYESNO("CB Offsetting", d3d11opts.ConstantBufferOffsetting); + LVYESNO("Map NO_OVERWRITE on Dynamic CB", d3d11opts.MapNoOverwriteOnDynamicConstantBuffer); + + if (fl >= D3D_FEATURE_LEVEL_10_0) + { + LVYESNO("Map NO_OVERWRITE on Dynamic SRV", d3d11opts.MapNoOverwriteOnDynamicBufferSRV); + LVYESNO("MSAA with ForcedSampleCount=1", d3d11opts.MultisampleRTVWithForcedSampleCountOne); + LVYESNO("Extended resource sharing", d3d11opts.ExtendedResourceSharing); + } + + if (fl >= D3D_FEATURE_LEVEL_11_0) + { + LVYESNO("Saturating Add Instruction", d3d11opts.SAD4ShaderInstructions); + } + + LVYESNO("Tile-based Deferred Renderer", d3d11arch.TileBasedDeferredRenderer); + + LVLINE("Non-Power-of-2 Textures", nonpow2); + + LVLINE("Pixel Shader Precision", ps_precis); + LVLINE("Other Stage Precision", other_precis); + } + else + { + PRINTLINE("Feature Level", FLName(fl)); + + PRINTYESNO("Driver Concurrent Creates", threading.DriverConcurrentCreates); + PRINTYESNO("Driver Command Lists", threading.DriverCommandLists); + PRINTLINE("Double-precision Shaders", double_shaders); + PRINTYESNO("DirectCompute CS 4.x", d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x); + + PRINTYESNO("Driver sees DiscardResource/View", d3d11opts.DiscardAPIsSeenByDriver); + PRINTYESNO("Driver sees COPY_FLAGS", d3d11opts.FlagsForUpdateAndCopySeenByDriver); + PRINTLINE("ClearView", clearview); + PRINTYESNO("Copy w/ Overlapping Rect", d3d11opts.CopyWithOverlap); + PRINTYESNO("CB Partial Update", d3d11opts.ConstantBufferPartialUpdate); + PRINTYESNO("CB Offsetting", d3d11opts.ConstantBufferOffsetting); + PRINTYESNO("Map NO_OVERWRITE on Dynamic CB", d3d11opts.MapNoOverwriteOnDynamicConstantBuffer); + + if (fl >= D3D_FEATURE_LEVEL_10_0) + { + PRINTYESNO("Map NO_OVERWRITE on Dynamic SRV", d3d11opts.MapNoOverwriteOnDynamicBufferSRV); + PRINTYESNO("MSAA with ForcedSampleCount=1", d3d11opts.MultisampleRTVWithForcedSampleCountOne); + PRINTYESNO("Extended resource sharing", d3d11opts.ExtendedResourceSharing); + } + + if (fl >= D3D_FEATURE_LEVEL_11_0) + { + PRINTYESNO("Saturating Add Instruction", d3d11opts.SAD4ShaderInstructions); + } + + PRINTYESNO("Tile-based Deferred Renderer", d3d11arch.TileBasedDeferredRenderer); + + PRINTLINE("Non-Power-of-2 Textures", nonpow2); + + PRINTLINE("Pixel Shader Precision", ps_precis); + PRINTLINE("Other Stage Precision", other_precis); + } + } + + HRESULT D3D11Info1(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + if (!pDevice) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + + if (lParam2 == D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) + { + LVAddColumn(g_hwndLV, 1, "Value", 25); + LVAddColumn(g_hwndLV, 2, "Quality Level", 25); + } + else + { + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + } + + // General Direct3D 11.1 device information + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + + if (!lParam2) + { + D3D11FeatureSupportInfo1(pDevice, false, pPrintInfo); + + // Setup note + const char* szNote = nullptr; + + switch (fl) + { + case D3D_FEATURE_LEVEL_10_0: + szNote = SEE_D3D10; + break; + + case D3D_FEATURE_LEVEL_10_1: + case D3D_FEATURE_LEVEL_9_3: + case D3D_FEATURE_LEVEL_9_2: + case D3D_FEATURE_LEVEL_9_1: + szNote = SEE_D3D10_1; + break; + + case D3D_FEATURE_LEVEL_11_0: + szNote = SEE_D3D11; + break; + + default: + szNote = D3D11_NOTE1; + break; + } + + if (!pPrintInfo) + { + LVLINE("Note", szNote); + } + else + { + PRINTLINE("Note", szNote); + } + + return S_OK; + } + + // Use CheckFormatSupport for format usage defined as optional for Direct3D 11.1 devices + + static const DXGI_FORMAT cfs16bpp[] = + { + DXGI_FORMAT_B5G6R5_UNORM, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B4G4R4A4_UNORM, + }; + + static const DXGI_FORMAT cfs16bpp2[] = + { + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B4G4R4A4_UNORM, + }; + + static const DXGI_FORMAT cfsShaderSample[] = + { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32_FLOAT, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, + DXGI_FORMAT_R32_FLOAT, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS + }; + + static const DXGI_FORMAT cfsShaderSample10_1[] = + { + DXGI_FORMAT_R32G32B32_FLOAT + }; + + static const DXGI_FORMAT cfsShaderGather[] = + { + DXGI_FORMAT_R32G32B32_FLOAT + }; + + static const DXGI_FORMAT cfsMipAutoGen[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_B5G6R5_UNORM, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B4G4R4A4_UNORM, + }; + + static const DXGI_FORMAT cfsMipAutoGen11_1[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B4G4R4A4_UNORM, + }; + + static const DXGI_FORMAT cfsRenderTarget[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R32G32B32_SINT, + DXGI_FORMAT_B5G6R5_UNORM, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B4G4R4A4_UNORM, + }; + + static const DXGI_FORMAT cfsRenderTarget11_1[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R32G32B32_SINT, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B4G4R4A4_UNORM, + }; + + static const DXGI_FORMAT cfsBlendableRT[] = + { + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R16G16B16A16_UNORM, + DXGI_FORMAT_R16G16_UNORM, + DXGI_FORMAT_R16_UNORM, + DXGI_FORMAT_B5G6R5_UNORM, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B4G4R4A4_UNORM, + }; + + static const DXGI_FORMAT cfsLogicOps[] = + { + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R16G16B16A16_UINT, + DXGI_FORMAT_R32G32_UINT, + DXGI_FORMAT_R10G10B10A2_UINT, + DXGI_FORMAT_R8G8B8A8_UINT, + DXGI_FORMAT_R16G16_UINT, + DXGI_FORMAT_R32_UINT, + DXGI_FORMAT_R8G8_UINT, + DXGI_FORMAT_R16_UINT, + DXGI_FORMAT_R8_UINT, + }; + + // Most RT formats are required to support 8x MSAA for 11.x devices + static const DXGI_FORMAT cfsMSAA8x[] = + { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32A32_SINT, + DXGI_FORMAT_B5G6R5_UNORM, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B4G4R4A4_UNORM, + }; + + UINT count = 0; + const DXGI_FORMAT* array = nullptr; + BOOL skips = FALSE; + + switch (lParam2) + { + case D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER: + count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); + array = cfs16bpp; + break; + + case D3D11_FORMAT_SUPPORT_SHADER_SAMPLE: + if (fl >= D3D_FEATURE_LEVEL_10_1) + { + count = sizeof(cfsShaderSample10_1) / sizeof(DXGI_FORMAT); + array = cfsShaderSample10_1; + } + else + { + count = sizeof(cfsShaderSample) / sizeof(DXGI_FORMAT); + array = cfsShaderSample; + } + break; + + case D3D11_FORMAT_SUPPORT_SHADER_GATHER: + count = sizeof(cfsShaderGather) / sizeof(DXGI_FORMAT); + array = cfsShaderGather; + break; + + case D3D11_FORMAT_SUPPORT_MIP_AUTOGEN: + if (fl >= D3D_FEATURE_LEVEL_11_1) + { + count = sizeof(cfsMipAutoGen11_1) / sizeof(DXGI_FORMAT); + array = cfsMipAutoGen11_1; + } + else + { + count = sizeof(cfsMipAutoGen) / sizeof(DXGI_FORMAT); + array = cfsMipAutoGen; + } + break; + + case D3D11_FORMAT_SUPPORT_RENDER_TARGET: + if (fl >= D3D_FEATURE_LEVEL_11_1) + { + count = sizeof(cfsRenderTarget11_1) / sizeof(DXGI_FORMAT); + array = cfsRenderTarget11_1; + } + else + { + count = sizeof(cfsRenderTarget) / sizeof(DXGI_FORMAT); + array = cfsRenderTarget; + } + break; + + case D3D11_FORMAT_SUPPORT_BLENDABLE: + if (fl >= D3D_FEATURE_LEVEL_10_0) + { + count = sizeof(cfs16bpp2) / sizeof(DXGI_FORMAT); + array = cfs16bpp2; + } + else + { + count = sizeof(cfsBlendableRT) / sizeof(DXGI_FORMAT); + array = cfsBlendableRT; + } + break; + + case D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET: + if (g_dwViewState != IDM_VIEWALL && lParam3 == 8) + { + count = sizeof(cfsMSAA8x) / sizeof(DXGI_FORMAT); + array = cfsMSAA8x; + } + else if (g_dwViewState != IDM_VIEWALL && (lParam3 == 2 || lParam3 == 4)) + { + count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); + array = cfs16bpp; + } + else + { + count = sizeof(g_cfsMSAA_11) / sizeof(DXGI_FORMAT); + array = g_cfsMSAA_11; + } + break; + + case D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD: + if (fl >= D3D_FEATURE_LEVEL_10_1) + { + count = sizeof(cfs16bpp2) / sizeof(DXGI_FORMAT); + array = cfs16bpp2; + } + else if (fl >= D3D_FEATURE_LEVEL_10_0) + { + count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); + array = cfs16bpp; + } + else + { + count = sizeof(g_cfsMSAA_11) / sizeof(DXGI_FORMAT); + array = g_cfsMSAA_11; + } + skips = TRUE; + break; + + case D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW: + count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); + array = cfs16bpp; + break; + + case LPARAM(-1): // D3D11_FORMAT_SUPPORT2 + switch (lParam3) + { + case D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP: + count = sizeof(cfsLogicOps) / sizeof(DXGI_FORMAT); + array = cfsLogicOps; + break; + + case D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE: + count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); + array = cfs16bpp; + break; + + default: + return E_FAIL; + } + break; + + default: + return E_FAIL; + } + + for (UINT i = 0; i < count; ++i) + { + DXGI_FORMAT fmt = array[i]; + + if (skips) + { + // Special logic to let us reuse the MSAA array twice with a few special cases that are skipped + switch (fmt) + { + case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_D24_UNORM_S8_UINT: + case DXGI_FORMAT_D16_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: + continue; + } + } + + if (lParam2 == D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) + { + if (g_dwViewState != IDM_VIEWALL && fmt == DXGI_FORMAT_B5G6R5_UNORM) + continue; + + UINT quality; + HRESULT hr = pDevice->CheckMultisampleQualityLevels(fmt, (UINT)lParam3, &quality); + + BOOL msaa = (SUCCEEDED(hr) && quality > 0) != 0; + + if (!pPrintInfo) + { + if (g_dwViewState == IDM_VIEWALL || msaa) + { + LVAddText(g_hwndLV, 0, FormatName(fmt)); + LVAddText(g_hwndLV, 1, msaa ? c_szYes : c_szNo); \ + + TCHAR strBuffer[16]; + sprintf_s(strBuffer, 16, "%u", msaa ? quality : 0); + LVAddText(g_hwndLV, 2, strBuffer); + } + } + else + { + TCHAR strBuffer[32]; + if (msaa) + sprintf_s(strBuffer, 32, "Yes (%u)", quality); + else + strcpy_s(strBuffer, 32, c_szNo); + + PrintStringValueLine(FormatName(fmt), strBuffer, pPrintInfo); + } + } + else if (lParam2 != LPARAM(-1)) + { + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(fmt, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + else + { + PRINTYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + } + else + { + D3D11_FEATURE_DATA_FORMAT_SUPPORT2 cfs2; + cfs2.InFormat = fmt; + cfs2.OutFormatSupport2 = 0; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT2, &cfs2, sizeof(cfs2)); + if (FAILED(hr)) + cfs2.OutFormatSupport2 = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3); + } + else + { + PRINTYESNO(FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3); + } + } + } + + return S_OK; + } + + HRESULT D3D11Info2(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + if (!pDevice) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + + // General Direct3D 11.2 device information + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + + if (!lParam2) + { + D3D11FeatureSupportInfo1(pDevice, true, pPrintInfo); + + D3D11_FEATURE_DATA_MARKER_SUPPORT marker = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_MARKER_SUPPORT, &marker, sizeof(marker)); + if (FAILED(hr)) + memset(&marker, 0, sizeof(marker)); + + // Setup note + const char* szNote = nullptr; + + switch (fl) + { + case D3D_FEATURE_LEVEL_10_0: + szNote = SEE_D3D10; + break; + + case D3D_FEATURE_LEVEL_10_1: + case D3D_FEATURE_LEVEL_9_3: + case D3D_FEATURE_LEVEL_9_2: + case D3D_FEATURE_LEVEL_9_1: + szNote = SEE_D3D10_1; + break; + + case D3D_FEATURE_LEVEL_11_0: + szNote = SEE_D3D11; + break; + + case D3D_FEATURE_LEVEL_11_1: + szNote = SEE_D3D11_1; + break; + + default: + szNote = D3D11_NOTE2; + break; + } + + if (!pPrintInfo) + { + LVYESNO("Profile Marker Support", marker.Profile); + + LVLINE("Note", szNote); + } + else + { + PRINTYESNO("Profile Marker Support", marker.Profile); + + PRINTLINE("Note", szNote); + } + + return S_OK; + } + + // Use CheckFormatSupport for format usage defined as optional for Direct3D 11.2 devices + + static const DXGI_FORMAT cfsShareable[] = + { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32A32_SINT, + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R16G16B16A16_UNORM, + DXGI_FORMAT_R16G16B16A16_UINT, + DXGI_FORMAT_R16G16B16A16_SNORM, + DXGI_FORMAT_R16G16B16A16_SINT, + DXGI_FORMAT_R10G10B10A2_UNORM, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, + DXGI_FORMAT_R10G10B10A2_UINT, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UINT, + DXGI_FORMAT_R8G8B8A8_SNORM, + DXGI_FORMAT_R8G8B8A8_SINT, + DXGI_FORMAT_R32_FLOAT, + DXGI_FORMAT_R32_UINT, + DXGI_FORMAT_R32_SINT, + DXGI_FORMAT_R8G8_UNORM, + DXGI_FORMAT_R16_FLOAT, + DXGI_FORMAT_R16_UNORM, + DXGI_FORMAT_R16_UINT, + DXGI_FORMAT_R16_SNORM, + DXGI_FORMAT_R16_SINT, + DXGI_FORMAT_R8_UNORM, + DXGI_FORMAT_R8_UINT, + DXGI_FORMAT_R8_SNORM, + DXGI_FORMAT_R8_SINT, + DXGI_FORMAT_A8_UNORM, + DXGI_FORMAT_BC1_UNORM, + DXGI_FORMAT_BC1_UNORM_SRGB, + DXGI_FORMAT_BC2_UNORM, + DXGI_FORMAT_BC2_UNORM_SRGB, + DXGI_FORMAT_BC3_UNORM, + DXGI_FORMAT_BC3_UNORM_SRGB, + DXGI_FORMAT_B8G8R8A8_UNORM, + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, + DXGI_FORMAT_B8G8R8X8_UNORM, + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, + }; + + UINT count = 0; + const DXGI_FORMAT* array = nullptr; + + switch (lParam2) + { + case LPARAM(-1): // D3D11_FORMAT_SUPPORT2 + switch (lParam3) + { + case D3D11_FORMAT_SUPPORT2_SHAREABLE: + count = _countof(cfsShareable); + array = cfsShareable; + break; + + default: + return E_FAIL; + } + break; + + default: + return E_FAIL; + } + + for (UINT i = 0; i < count; ++i) + { + DXGI_FORMAT fmt = array[i]; + + if (lParam2 != LPARAM(-1)) + { + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(fmt, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + else + { + PRINTYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + } + else + { + D3D11_FEATURE_DATA_FORMAT_SUPPORT2 cfs2; + cfs2.InFormat = fmt; + cfs2.OutFormatSupport2 = 0; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT2, &cfs2, sizeof(cfs2)); + if (FAILED(hr)) + cfs2.OutFormatSupport2 = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3); + } + else + { + PRINTYESNO(FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3); + } + } + } + + return S_OK; + } + + HRESULT D3D11Info3(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + ID3D11Device3* pDevice = reinterpret_cast(lParam1); + + if (!pDevice) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + + // General Direct3D 11.3/11.4 device information + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + + if (!lParam2) + { + D3D11FeatureSupportInfo1(pDevice, true, pPrintInfo); + + D3D11_FEATURE_DATA_MARKER_SUPPORT marker = {}; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_MARKER_SUPPORT, &marker, sizeof(marker)); + if (FAILED(hr)) + memset(&marker, 0, sizeof(marker)); + + D3D11_FEATURE_DATA_D3D11_OPTIONS2 d3d11opts2 = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &d3d11opts2, sizeof(d3d11opts2)); + if (FAILED(hr)) + memset(&d3d11opts2, 0, sizeof(d3d11opts2)); + + D3D11_FEATURE_DATA_D3D11_OPTIONS3 d3d11opts3 = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS3, &d3d11opts3, sizeof(d3d11opts3)); + if (FAILED(hr)) + memset(&d3d11opts3, 0, sizeof(d3d11opts3)); + + D3D11_FEATURE_DATA_D3D11_OPTIONS4 d3d11opts4 = {}; + hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS4, &d3d11opts4, sizeof(d3d11opts4)); + if (FAILED(hr)) + memset(&d3d11opts4, 0, sizeof(d3d11opts4)); + + // Setup note + const char* szNote = nullptr; + + switch (fl) + { + case D3D_FEATURE_LEVEL_10_0: + szNote = SEE_D3D10; + break; + + case D3D_FEATURE_LEVEL_10_1: + case D3D_FEATURE_LEVEL_9_3: + case D3D_FEATURE_LEVEL_9_2: + case D3D_FEATURE_LEVEL_9_1: + szNote = SEE_D3D10_1; + break; + + case D3D_FEATURE_LEVEL_11_0: + szNote = SEE_D3D11; + break; + + case D3D_FEATURE_LEVEL_11_1: + szNote = SEE_D3D11_1; + break; + + default: + szNote = (lParam3 != 0) ? D3D11_NOTE4 : D3D11_NOTE3; + break; + } + + char tiled_rsc[16]; + if (d3d11opts2.TiledResourcesTier == D3D11_TILED_RESOURCES_NOT_SUPPORTED) + strcpy_s(tiled_rsc, "Not supported"); + else + sprintf_s(tiled_rsc, "Tier %d", d3d11opts2.TiledResourcesTier); + + char consrv_rast[16]; + if (d3d11opts2.ConservativeRasterizationTier == D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED) + strcpy_s(consrv_rast, "Not supported"); + else + sprintf_s(consrv_rast, "Tier %d", d3d11opts2.ConservativeRasterizationTier); + + if (!pPrintInfo) + { + LVYESNO("Profile Marker Support", marker.Profile); + + LVYESNO("Map DEFAULT Textures", d3d11opts2.MapOnDefaultTextures); + LVYESNO("Standard Swizzle", d3d11opts2.StandardSwizzle); + LVYESNO("UMA", d3d11opts2.UnifiedMemoryArchitecture); + LVYESNO("Extended formats TypedUAVLoad", d3d11opts2.TypedUAVLoadAdditionalFormats); + + LVLINE("Conservative Rasterization", consrv_rast); + LVLINE("Tiled Resources", tiled_rsc); + LVYESNO("PS-Specified Stencil Ref", d3d11opts2.PSSpecifiedStencilRefSupported); + LVYESNO("Rasterizer Ordered Views", d3d11opts2.ROVsSupported); + + LVYESNO("VP/RT f/ Rast-feeding Shader", d3d11opts3.VPAndRTArrayIndexFromAnyShaderFeedingRasterizer); + + if (lParam3 != 0) + { + LVYESNO("Extended Shared NV12", d3d11opts4.ExtendedNV12SharedTextureSupported); + } + + LVLINE("Note", szNote); + } + else + { + PRINTYESNO("Profile Marker Support", marker.Profile); + + PRINTYESNO("Map DEFAULT Textures", d3d11opts2.MapOnDefaultTextures); + PRINTYESNO("Standard Swizzle", d3d11opts2.StandardSwizzle); + PRINTYESNO("UMA", d3d11opts2.UnifiedMemoryArchitecture); + PRINTYESNO("Extended formats TypedUAVLoad", d3d11opts2.TypedUAVLoadAdditionalFormats); + + PRINTLINE("Conservative Rasterization", consrv_rast); + PRINTLINE("Tiled Resources", tiled_rsc); + PRINTYESNO("PS-Specified Stencil Ref", d3d11opts2.PSSpecifiedStencilRefSupported); + PRINTYESNO("Rasterizer Ordered Views", d3d11opts2.ROVsSupported); + + PRINTYESNO("VP/RT f/ Rast-feeding Shader", d3d11opts3.VPAndRTArrayIndexFromAnyShaderFeedingRasterizer); + + if (lParam3 != 0) + { + PRINTYESNO("Extended Shared NV12", d3d11opts4.ExtendedNV12SharedTextureSupported); + } + + PRINTLINE("Note", szNote); + } + + return S_OK; + } + + // Use CheckFormatSupport for format usage defined as optional for Direct3D 11.3/11.4 devices + + static const DXGI_FORMAT cfsUAVTypedLoad[] = + { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32A32_SINT, + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R16G16B16A16_UNORM, + DXGI_FORMAT_R16G16B16A16_UINT, + DXGI_FORMAT_R16G16B16A16_SNORM, + DXGI_FORMAT_R16G16B16A16_SINT, + DXGI_FORMAT_R32G32_FLOAT, + DXGI_FORMAT_R32G32_UINT, + DXGI_FORMAT_R32G32_SINT, + DXGI_FORMAT_R10G10B10A2_UNORM, + DXGI_FORMAT_R10G10B10A2_UINT, + DXGI_FORMAT_R11G11B10_FLOAT, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UINT, + DXGI_FORMAT_R8G8B8A8_SNORM, + DXGI_FORMAT_R8G8B8A8_SINT, + DXGI_FORMAT_R16G16_FLOAT, + DXGI_FORMAT_R16G16_UNORM, + DXGI_FORMAT_R16G16_UINT, + DXGI_FORMAT_R16G16_SNORM, + DXGI_FORMAT_R16G16_SINT, + DXGI_FORMAT_R32_FLOAT, // req + DXGI_FORMAT_R32_UINT, // req + DXGI_FORMAT_R32_SINT, // req + DXGI_FORMAT_R8G8_UNORM, + DXGI_FORMAT_R8G8_UINT, + DXGI_FORMAT_R8G8_SNORM, + DXGI_FORMAT_R8G8_SINT, + DXGI_FORMAT_R16_FLOAT, + DXGI_FORMAT_R16_UNORM, + DXGI_FORMAT_R16_UINT, + DXGI_FORMAT_R16_SNORM, + DXGI_FORMAT_R16_SINT, + DXGI_FORMAT_R8_UNORM, + DXGI_FORMAT_R8_UINT, + DXGI_FORMAT_R8_SNORM, + DXGI_FORMAT_R8_SINT, + DXGI_FORMAT_A8_UNORM, + }; + + UINT count = 0; + const DXGI_FORMAT* array = nullptr; + + switch (lParam2) + { + case LPARAM(-1): // D3D11_FORMAT_SUPPORT2 + switch (lParam3) + { + case D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD: + count = _countof(cfsUAVTypedLoad); + array = cfsUAVTypedLoad; + break; + + default: + return E_FAIL; + } + break; + + default: + return E_FAIL; + } + + for (UINT i = 0; i < count; ++i) + { + DXGI_FORMAT fmt = array[i]; + + if (lParam2 != LPARAM(-1)) + { + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(fmt, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + else + { + PRINTYESNO(FormatName(fmt), fmtSupport & (UINT)lParam2); + } + } + else + { + D3D11_FEATURE_DATA_FORMAT_SUPPORT2 cfs2; + cfs2.InFormat = fmt; + cfs2.OutFormatSupport2 = 0; + HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT2, &cfs2, sizeof(cfs2)); + if (FAILED(hr)) + cfs2.OutFormatSupport2 = 0; + + if (!pPrintInfo) + { + LVYESNO(FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3); + } + else + { + PRINTYESNO(FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3); + } + } + } + + return S_OK; + } + + HRESULT D3D11InfoMSAA(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + if (!pDevice) + return S_OK; + + auto sampCount = reinterpret_cast(lParam2); + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + + UINT column = 1; + for (UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + if (!sampCount[samples - 1] && !IsMSAAPowerOf2(samples)) + continue; + + TCHAR strBuffer[8]; + sprintf_s(strBuffer, 8, "%ux", samples); + LVAddColumn(g_hwndLV, column, strBuffer, 8); + ++column; + } + } + + const UINT count = sizeof(g_cfsMSAA_11) / sizeof(DXGI_FORMAT); + + for (UINT i = 0; i < count; ++i) + { + DXGI_FORMAT fmt = g_cfsMSAA_11[i]; + + // Skip 16 bits-per-pixel formats for DX 11.0 + if (lParam3 == 0 + && (fmt == DXGI_FORMAT_B5G6R5_UNORM || fmt == DXGI_FORMAT_B5G5R5A1_UNORM || fmt == DXGI_FORMAT_B4G4R4A4_UNORM)) + continue; + + UINT sampQ[D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT]; + memset(sampQ, 0, sizeof(sampQ)); + + BOOL any = FALSE; + for (UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + UINT quality; + HRESULT hr = pDevice->CheckMultisampleQualityLevels(fmt, samples, &quality); + + if (SUCCEEDED(hr) && quality > 0) + { + sampQ[samples - 1] = quality; + any = TRUE; + } + } + + if (!pPrintInfo) + { + if (g_dwViewState != IDM_VIEWALL && !any) + continue; + + LVAddText(g_hwndLV, 0, FormatName(fmt)); + + UINT column = 1; + for (UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + if (!sampCount[samples - 1] && !IsMSAAPowerOf2(samples)) + continue; + + if (sampQ[samples - 1] > 0) + { + TCHAR strBuffer[32]; + sprintf_s(strBuffer, 32, "Yes (%u)", sampQ[samples - 1]); + LVAddText(g_hwndLV, column, strBuffer); + } + else + LVAddText(g_hwndLV, column, c_szNo); + + ++column; + } + } + else + { + TCHAR buff[1024]; + *buff = 0; + + for (UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + if (!sampCount[samples - 1] && !IsMSAAPowerOf2(samples)) + continue; + + TCHAR strBuffer[32]; + if (sampQ[samples - 1] > 0) + sprintf_s(strBuffer, 32, "%ux: Yes (%u) ", samples, sampQ[samples - 1]); + else + sprintf_s(strBuffer, 32, "%ux: No ", samples); + + strcat_s(buff, 1024, strBuffer); + } + + PrintStringValueLine(FormatName(fmt), buff, pPrintInfo); + } + } + + return S_OK; + } + + void FillMSAASampleTable(ID3D10Device* pDevice, BOOL sampCount[], BOOL _10level9) + { + memset(sampCount, 0, sizeof(BOOL) * D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT); + sampCount[0] = TRUE; // sample count of 1 is always required + + UINT count = 0; + const DXGI_FORMAT* array = nullptr; + + if (_10level9) + { + count = sizeof(g_cfsMSAA_10level9) / sizeof(DXGI_FORMAT); + array = g_cfsMSAA_10level9; + } + else + { + count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); + array = g_cfsMSAA_10; + } + + for (UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + for (UINT i = 0; i < count; ++i) + { + UINT quality; + HRESULT hr = pDevice->CheckMultisampleQualityLevels(array[i], samples, &quality); + + if (SUCCEEDED(hr) && quality > 0) + { + sampCount[samples - 1] = TRUE; + break; + } + } + } + } + + void FillMSAASampleTable(ID3D11Device* pDevice, BOOL sampCount[]) + { + memset(sampCount, 0, sizeof(BOOL) * D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT); + sampCount[0] = TRUE; // sample count of 1 is always required + + for (UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) + { + const UINT count = sizeof(g_cfsMSAA_11) / sizeof(DXGI_FORMAT); + + for (UINT i = 0; i < count; ++i) + { + UINT quality; + HRESULT hr = pDevice->CheckMultisampleQualityLevels(g_cfsMSAA_11[i], samples, &quality); + + if (SUCCEEDED(hr) && quality > 0) + { + sampCount[samples - 1] = TRUE; + break; + } + } + } + } + + //----------------------------------------------------------------------------- + HRESULT D3D11InfoVideo(LPARAM lParam1, LPARAM /*lParam2*/, LPARAM /*lParam3*/, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + if (!pDevice) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Texture2D", 15); + LVAddColumn(g_hwndLV, 2, "Input", 15); + LVAddColumn(g_hwndLV, 3, "Output", 15); + LVAddColumn(g_hwndLV, 4, "Encoder", 15); + } + + static const DXGI_FORMAT cfsVideo[] = + { + DXGI_FORMAT_NV12, + DXGI_FORMAT_420_OPAQUE, + DXGI_FORMAT_YUY2, + DXGI_FORMAT_AYUV, + DXGI_FORMAT_Y410, + DXGI_FORMAT_Y416, + DXGI_FORMAT_P010, + DXGI_FORMAT_P016, + DXGI_FORMAT_Y210, + DXGI_FORMAT_Y216, + DXGI_FORMAT_NV11, + DXGI_FORMAT_AI44, + DXGI_FORMAT_IA44, + DXGI_FORMAT_P8, + DXGI_FORMAT_A8P8, + }; + + for (UINT i = 0; i < _countof(cfsVideo); ++i) + { + DXGI_FORMAT fmt = cfsVideo[i]; + + UINT fmtSupport = 0; + HRESULT hr = pDevice->CheckFormatSupport(fmt, &fmtSupport); + if (FAILED(hr)) + fmtSupport = 0; + + bool any = (fmtSupport & (D3D11_FORMAT_SUPPORT_TEXTURE2D + | D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT + | D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT + | D3D11_FORMAT_SUPPORT_VIDEO_ENCODER)) ? true : false; + + if (!pPrintInfo) + { + if (g_dwViewState != IDM_VIEWALL && !any) + continue; + + LVAddText(g_hwndLV, 0, FormatName(fmt)); + + LVAddText(g_hwndLV, 1, (fmtSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) ? c_szYes : c_szNo); + LVAddText(g_hwndLV, 2, (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT) ? c_szYes : c_szNo); + LVAddText(g_hwndLV, 3, (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT) ? c_szYes : c_szNo); + LVAddText(g_hwndLV, 4, (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_ENCODER) ? c_szYes : c_szNo); + } + else + { + TCHAR buff[1024]; + + sprintf_s(buff, "Texture2D: %-3s Input: %-3s Output: %-3s Encoder: %-3s", + (fmtSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) ? c_szYes : c_szNo, + (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT) ? c_szYes : c_szNo, + (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT) ? c_szYes : c_szNo, + (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_ENCODER) ? c_szYes : c_szNo); + + PrintStringValueLine(FormatName(fmt), buff, pPrintInfo); + } + } + + return S_OK; + } + + //----------------------------------------------------------------------------- + HRESULT D3D12Info(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo) + { + auto pDevice = reinterpret_cast(lParam1); + auto fl = (D3D_FEATURE_LEVEL)lParam2; + + if (!pDevice) + return S_OK; + + if (!pPrintInfo) + { + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 60); + } + + D3D12_FEATURE_DATA_SHADER_MODEL shaderModelOpt = {}; + shaderModelOpt.HighestShaderModel = D3D_SHADER_MODEL_6_5; + HRESULT hr = pDevice->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &shaderModelOpt, sizeof(shaderModelOpt)); + while (hr == E_INVALIDARG && shaderModelOpt.HighestShaderModel > D3D_SHADER_MODEL_6_0) + { + shaderModelOpt.HighestShaderModel = static_cast(static_cast(shaderModelOpt.HighestShaderModel) - 1); + hr = pDevice->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &shaderModelOpt, sizeof(shaderModelOpt)); + } + if (FAILED(hr)) + { + shaderModelOpt.HighestShaderModel = D3D_SHADER_MODEL_5_1; + } + + D3D12_FEATURE_DATA_ROOT_SIGNATURE rootSigOpt = {}; + rootSigOpt.HighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_1; + hr = pDevice->CheckFeatureSupport(D3D12_FEATURE_ROOT_SIGNATURE, &rootSigOpt, sizeof(rootSigOpt)); + if (FAILED(hr)) + { + rootSigOpt.HighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_0; + } + + D3D12_FEATURE_DATA_D3D12_OPTIONS d3d12opts = {}; + hr = pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &d3d12opts, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS)); + if (FAILED(hr)) + memset(&d3d12opts, 0, sizeof(d3d12opts)); + + D3D12_FEATURE_DATA_D3D12_OPTIONS1 d3d12opts1 = {}; + hr = pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1, &d3d12opts1, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS1)); + if (FAILED(hr)) + memset(&d3d12opts1, 0, sizeof(d3d12opts1)); + + D3D12_FEATURE_DATA_ARCHITECTURE d3d12arch = {}; + hr = pDevice->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &d3d12arch, sizeof(D3D12_FEATURE_DATA_ARCHITECTURE)); + if (FAILED(hr)) + memset(&d3d12arch, 0, sizeof(d3d12arch)); + + D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT d3d12vm = {}; + hr = pDevice->CheckFeatureSupport(D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT, &d3d12vm, sizeof(D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT)); + if (FAILED(hr)) + memset(&d3d12vm, 0, sizeof(d3d12vm)); + + const char* shaderModel = "Unknown"; + switch (shaderModelOpt.HighestShaderModel) + { + case D3D_SHADER_MODEL_6_5: shaderModel = "6.5"; break; + case D3D_SHADER_MODEL_6_4: shaderModel = "6.4"; break; + case D3D_SHADER_MODEL_6_3: shaderModel = "6.3"; break; + case D3D_SHADER_MODEL_6_2: shaderModel = "6.2"; break; + case D3D_SHADER_MODEL_6_1: shaderModel = "6.1"; break; + case D3D_SHADER_MODEL_6_0: shaderModel = "6.0"; break; + case D3D_SHADER_MODEL_5_1: shaderModel = "5.1"; break; + } + + const char* rootSig = "Unknown"; + switch (rootSigOpt.HighestVersion) + { + case D3D_ROOT_SIGNATURE_VERSION_1_0: rootSig = "1.0"; break; + case D3D_ROOT_SIGNATURE_VERSION_1_1: rootSig = "1.1"; break; + } + + char vmRes[16]; + sprintf_s(vmRes, 16, "%u", d3d12vm.MaxGPUVirtualAddressBitsPerResource); + + char vmProcess[16]; + sprintf_s(vmProcess, 16, "%u", d3d12vm.MaxGPUVirtualAddressBitsPerProcess); + + const char* precis = nullptr; + switch (d3d12opts.MinPrecisionSupport & (D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT | D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT)) + { + case 0: precis = "Full"; break; + case D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT: precis = "16/32-bit"; break; + case D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT: precis = "10/32-bit"; break; + default: precis = "10/16/32-bit"; break; + } + + const char* sharing = nullptr; + switch (d3d12opts.CrossNodeSharingTier) + { + case D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED: sharing = c_szNo; break; + case D3D12_CROSS_NODE_SHARING_TIER_1_EMULATED: sharing = "Yes - Tier 1 (Emulated)"; break; + case D3D12_CROSS_NODE_SHARING_TIER_1: sharing = "Yes - Tier 1"; break; + case D3D12_CROSS_NODE_SHARING_TIER_2: sharing = "Yes - Tier 2"; break; + default: sharing = "Yes"; break; + } + + char heap[16]; + sprintf_s(heap, "Tier %d", d3d12opts.ResourceHeapTier); + + char tiled_rsc[16]; + if (d3d12opts.TiledResourcesTier == D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED) + strcpy_s(tiled_rsc, "Not supported"); + else + sprintf_s(tiled_rsc, "Tier %d", d3d12opts.TiledResourcesTier); + + char consrv_rast[16]; + if (d3d12opts.ConservativeRasterizationTier == D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED) + strcpy_s(consrv_rast, "Not supported"); + else + sprintf_s(consrv_rast, "Tier %d", d3d12opts.ConservativeRasterizationTier); + + char binding_rsc[16]; + sprintf_s(binding_rsc, "Tier %d", d3d12opts.ResourceBindingTier); + + char lane_count[16]; + sprintf_s(lane_count, "%u", d3d12opts1.TotalLaneCount); + + char wave_lane_count[16]; + sprintf_s(wave_lane_count, "%u/%u", d3d12opts1.WaveLaneCountMin, d3d12opts1.WaveLaneCountMax); + + if (!pPrintInfo) + { + LVLINE("Feature Level", FLName(fl)); + LVLINE("Shader Model", shaderModel); + LVLINE("Root Signature", rootSig); + + LVYESNO("Double-precision Shaders", d3d12opts.DoublePrecisionFloatShaderOps); + LVYESNO("Standard Swizzle 64KB", d3d12opts.StandardSwizzle64KBSupported); + LVYESNO("Extended formats TypedUAVLoad", d3d12opts.TypedUAVLoadAdditionalFormats); + + LVLINE("Conservative Rasterization", consrv_rast); + LVLINE("Resource Binding", binding_rsc); + LVLINE("Tiled Resources", tiled_rsc); + LVLINE("Resource Heap", heap); + LVYESNO("PS-Specified Stencil Ref", d3d12opts.PSSpecifiedStencilRefSupported); + LVYESNO("Rasterizer Ordered Views", d3d12opts.ROVsSupported); + + LVYESNO("VP/RT without GS Emulation", d3d12opts.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation); + LVYESNO("Cross-adapter RM Texture", d3d12opts.CrossAdapterRowMajorTextureSupported); + LVLINE("Cross-node Sharing", sharing); + + LVYESNO("Tile-based Renderer", d3d12arch.TileBasedRenderer); + LVYESNO("UMA", d3d12arch.UMA); + LVYESNO("Cache Coherent UMA", d3d12arch.CacheCoherentUMA); + + LVLINE("Max GPU VM bits per resource", vmRes); + LVLINE("Max GPU VM bits per process", vmProcess); + + LVLINE("Minimum Precision", precis); + + if (lParam3 != 0) + { + LVYESNO("Wave operations", d3d12opts1.WaveOps); + LVLINE("Wave lane count", wave_lane_count); + LVLINE("Total lane count", lane_count); + LVYESNO("Expanded compute resource states", d3d12opts1.ExpandedComputeResourceStates); + } + } + else + { + PRINTLINE("Feature Level", FLName(fl)); + PRINTLINE("Shader Model", shaderModel); + PRINTLINE("Root Signature", rootSig); + + PRINTYESNO("Double-precision Shaders", d3d12opts.DoublePrecisionFloatShaderOps); + PRINTYESNO("Standard Swizzle 64KB", d3d12opts.StandardSwizzle64KBSupported); + PRINTYESNO("Extended formats TypedUAVLoad", d3d12opts.TypedUAVLoadAdditionalFormats); + + PRINTLINE("Conservative Rasterization", consrv_rast); + PRINTLINE("Resource Binding", binding_rsc); + PRINTLINE("Tiled Resources", tiled_rsc); + PRINTLINE("Resource Heap", heap); + PRINTYESNO("PS-Specified Stencil Ref", d3d12opts.PSSpecifiedStencilRefSupported); + PRINTYESNO("Rasterizer Ordered Views", d3d12opts.ROVsSupported); + + PRINTYESNO("VP/RT without GS Emulation", d3d12opts.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation); + PRINTYESNO("Cross-adapter RM Texture", d3d12opts.CrossAdapterRowMajorTextureSupported); + PRINTLINE("Cross-node Sharing", sharing); + + PRINTYESNO("Tile-based Renderer", d3d12arch.TileBasedRenderer); + PRINTYESNO("UMA", d3d12arch.UMA); + PRINTYESNO("Cache Coherent UMA", d3d12arch.CacheCoherentUMA); + + PRINTLINE("Max GPU VM bits per resource", vmRes); + PRINTLINE("Max GPU VM bits per process", vmProcess); + + PRINTLINE("Minimum Precision", precis); + + if (lParam3 != 0) + { + PRINTYESNO("Wave operations", d3d12opts1.WaveOps); + PRINTLINE("Wave lane count", wave_lane_count); + PRINTLINE("Total lane count", lane_count); + PRINTYESNO("Expanded compute resource states", d3d12opts1.ExpandedComputeResourceStates); + } + } + + return S_OK; + } + + //----------------------------------------------------------------------------- + void D3D10_FillTree(HTREEITEM hTree, ID3D10Device* pDevice, D3D_DRIVER_TYPE devType) + { + HTREEITEM hTreeD3D = TVAddNodeEx(hTree, "Direct3D 10", TRUE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, 0, 0); + + TVAddNodeEx(hTreeD3D, "Features", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10(devType)); + + TVAddNodeEx(hTreeD3D, "Shader sample (any filter)", FALSE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_SHADER_SAMPLE, 0); + + TVAddNodeEx(hTreeD3D, "Mipmap Auto-Generation", FALSE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MIP_AUTOGEN, 0); + + TVAddNodeEx(hTreeD3D, "Render Target", FALSE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_RENDER_TARGET, 0); + + TVAddNodeEx(hTreeD3D, "Blendable Render Target", FALSE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_BLENDABLE, 0); + + // MSAA + FillMSAASampleTable(pDevice, g_sampCount10, FALSE); + + TVAddNodeEx(hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2); + + TVAddNodeEx(hTreeD3D, "4x MSAA", FALSE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4); + + TVAddNodeEx(hTreeD3D, "8x MSAA", FALSE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 8); + + TVAddNode(hTreeD3D, "Other MSAA", FALSE, IDI_CAPS, D3D10InfoMSAA, (LPARAM)pDevice, (LPARAM)g_sampCount10); + + TVAddNodeEx(hTreeD3D, "MSAA Load", FALSE, IDI_CAPS, D3D10Info, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD, 0); + } + + void D3D10_FillTree1(HTREEITEM hTree, ID3D10Device1* pDevice, DWORD flMask, D3D_DRIVER_TYPE devType) + { + D3D10_FEATURE_LEVEL1 fl = pDevice->GetFeatureLevel(); + + HTREEITEM hTreeD3D = TVAddNodeEx(hTree, "Direct3D 10.1", TRUE, + IDI_CAPS, D3D10Info1, (LPARAM)pDevice, 0, 0); + + TVAddNodeEx(hTreeD3D, FLName(fl), FALSE, IDI_CAPS, D3D_FeatureLevel, (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1(devType)); + + if ((g_DXGIFactory1 != nullptr && fl != D3D10_FEATURE_LEVEL_9_1) + || (g_DXGIFactory1 == nullptr && fl != D3D10_FEATURE_LEVEL_10_0)) + { + HTREEITEM hTreeF = TVAddNode(hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0); + + switch (fl) + { + case D3D10_FEATURE_LEVEL_10_1: + if (flMask & FLMASK_10_0) + { + TVAddNodeEx(hTreeF, "D3D10_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1(devType)); + } + // Fall thru + + case D3D10_FEATURE_LEVEL_10_0: + if (flMask & FLMASK_9_3) + { + TVAddNodeEx(hTreeF, "D3D10_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1(devType)); + } + // Fall thru + + case D3D10_FEATURE_LEVEL_9_3: + if (flMask & FLMASK_9_2) + { + TVAddNodeEx(hTreeF, "D3D10_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1(devType)); + } + // Fall thru + + case D3D10_FEATURE_LEVEL_9_2: + if (flMask & FLMASK_9_1) + { + TVAddNodeEx(hTreeF, "D3D10_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1(devType)); + } + break; + } + } + + // Only display for 10.1 devices. 10 and 11 devices are handled in their "native" node + // Nothing optional about 10level9 feature levels + if (fl == D3D10_FEATURE_LEVEL_10_1) + { + TVAddNodeEx(hTreeD3D, "Shader sample (any filter)", FALSE, IDI_CAPS, D3D10Info1, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_SHADER_SAMPLE, 0); + + TVAddNodeEx(hTreeD3D, "Mipmap Auto-Generation", FALSE, IDI_CAPS, D3D10Info1, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MIP_AUTOGEN, 0); + + TVAddNodeEx(hTreeD3D, "Render Target", FALSE, IDI_CAPS, D3D10Info1, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_RENDER_TARGET, 0); + } + + // MSAA (for all but 10 devices, which are handled in their "native" node) + if (fl != D3D10_FEATURE_LEVEL_10_0) + { + FillMSAASampleTable(pDevice, g_sampCount10_1, (fl != D3D10_FEATURE_LEVEL_10_1)); + + if (fl == D3D10_FEATURE_LEVEL_10_1) + { + TVAddNodeEx(hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D10Info1, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2); + + TVAddNodeEx(hTreeD3D, "4x MSAA (most required)", FALSE, IDI_CAPS, D3D10Info1, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4); + + TVAddNodeEx(hTreeD3D, "8x MSAA", FALSE, IDI_CAPS, D3D10Info1, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 8); + + TVAddNode(hTreeD3D, "Other MSAA", FALSE, IDI_CAPS, D3D10InfoMSAA, (LPARAM)pDevice, (LPARAM)g_sampCount10_1); + } + else // 10level9 + { + TVAddNodeEx(hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D10Info1, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2); + + if (fl >= D3D10_FEATURE_LEVEL_9_3) + { + TVAddNodeEx(hTreeD3D, "4x MSAA", FALSE, IDI_CAPS, D3D10Info1, + (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4); + } + } + } + } + + + //----------------------------------------------------------------------------- + void D3D11_FillTree(HTREEITEM hTree, ID3D11Device* pDevice, DWORD flMask, D3D_DRIVER_TYPE devType) + { + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + if (fl > D3D_FEATURE_LEVEL_11_0) + fl = D3D_FEATURE_LEVEL_11_0; + + HTREEITEM hTreeD3D = TVAddNodeEx(hTree, "Direct3D 11", TRUE, + IDI_CAPS, D3D11Info, (LPARAM)pDevice, 0, 0); + + TVAddNodeEx(hTreeD3D, FLName(fl), FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11(devType)); + + if (fl != D3D_FEATURE_LEVEL_9_1) + { + HTREEITEM hTreeF = TVAddNode(hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0); + + switch (fl) + { + case D3D_FEATURE_LEVEL_11_0: + if (flMask & FLMASK_10_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_10_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_10_1: + if (flMask & FLMASK_10_0) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_10_0: + if (flMask & FLMASK_9_3) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_9_3: + if (flMask & FLMASK_9_2) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_9_2: + if (flMask & FLMASK_9_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11(devType)); + } + break; + } + } + + if (fl >= D3D_FEATURE_LEVEL_11_0) + { + TVAddNodeEx(hTreeD3D, "Shader sample (any filter)", FALSE, IDI_CAPS, D3D11Info, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_SHADER_SAMPLE, 0); + + TVAddNodeEx(hTreeD3D, "Shader gather4", FALSE, IDI_CAPS, D3D11Info, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_SHADER_GATHER, 0); + + TVAddNodeEx(hTreeD3D, "Mipmap Auto-Generation", FALSE, IDI_CAPS, D3D11Info, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MIP_AUTOGEN, 0); + + TVAddNodeEx(hTreeD3D, "Render Target", FALSE, IDI_CAPS, D3D11Info, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_RENDER_TARGET, 0); + + // MSAA (MSAA data for 10level9 is shown under the 10.1 node) + FillMSAASampleTable(pDevice, g_sampCount11); + + TVAddNodeEx(hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D11Info, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2); + + TVAddNodeEx(hTreeD3D, "4x MSAA (all required)", FALSE, IDI_CAPS, D3D11Info, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4); + + TVAddNodeEx(hTreeD3D, "8x MSAA (most required)", FALSE, IDI_CAPS, D3D11Info, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 8); + + TVAddNodeEx(hTreeD3D, "Other MSAA", FALSE, IDI_CAPS, D3D11InfoMSAA, + (LPARAM)pDevice, (LPARAM)g_sampCount11, 0); + } + } + + void D3D11_FillTree1(HTREEITEM hTree, ID3D11Device1* pDevice, DWORD flMask, D3D_DRIVER_TYPE devType) + { + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + if (fl > D3D_FEATURE_LEVEL_11_1) + fl = D3D_FEATURE_LEVEL_11_1; + + HTREEITEM hTreeD3D = TVAddNodeEx(hTree, "Direct3D 11.1", TRUE, + IDI_CAPS, D3D11Info1, (LPARAM)pDevice, 0, 0); + + TVAddNodeEx(hTreeD3D, FLName(fl), FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1(devType)); + + if (fl != D3D_FEATURE_LEVEL_9_1) + { + HTREEITEM hTreeF = TVAddNode(hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0); + + switch (fl) + { + case D3D_FEATURE_LEVEL_11_1: + if (flMask & FLMASK_11_0) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_11_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_11_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_11_0: + if (flMask & FLMASK_10_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_10_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_10_1: + if (flMask & FLMASK_10_0) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_10_0: + if (flMask & FLMASK_9_3) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_9_3: + if (flMask & FLMASK_9_2) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_9_2: + if (flMask & FLMASK_9_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1(devType)); + } + break; + } + } + + if (fl >= D3D_FEATURE_LEVEL_10_0) + { + TVAddNodeEx(hTreeD3D, "IA Vertex Buffer", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER, 0); + + TVAddNodeEx(hTreeD3D, "Shader sample (any filter)", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_SHADER_SAMPLE, 0); + + if (fl >= D3D_FEATURE_LEVEL_11_0) + { + TVAddNodeEx(hTreeD3D, "Shader gather4", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_SHADER_GATHER, 0); + } + + TVAddNodeEx(hTreeD3D, "Mipmap Auto-Generation", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MIP_AUTOGEN, 0); + + TVAddNodeEx(hTreeD3D, "Render Target", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_RENDER_TARGET, 0); + + TVAddNodeEx(hTreeD3D, "Blendable Render Target", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_BLENDABLE, 0); + + if (fl < D3D_FEATURE_LEVEL_11_1) + { + // This is required for 11.1, but is optional for 10.x and 11.0 + TVAddNodeEx(hTreeD3D, "OM Logic Ops", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)-1, (LPARAM)D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP); + } + + if (fl >= D3D_FEATURE_LEVEL_11_0) + { + TVAddNodeEx(hTreeD3D, "Typed UAV (most required)", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW, 0); + + TVAddNodeEx(hTreeD3D, "UAV Typed Store (most required)", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)-1, (LPARAM)D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE); + } + + // MSAA (MSAA data for 10level9 is shown under the 10.1 node) + FillMSAASampleTable(pDevice, g_sampCount11_1); + + TVAddNodeEx(hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2); + + TVAddNodeEx(hTreeD3D, "4x MSAA (all required)", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4); + + TVAddNodeEx(hTreeD3D, "8x MSAA (most required)", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 8); + + TVAddNodeEx(hTreeD3D, "Other MSAA", FALSE, IDI_CAPS, D3D11InfoMSAA, + (LPARAM)pDevice, (LPARAM)g_sampCount11_1, 1); + + TVAddNodeEx(hTreeD3D, "MSAA Load", FALSE, IDI_CAPS, D3D11Info1, + (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD, 0); + } + + if (devType != D3D_DRIVER_TYPE_REFERENCE) + { + TVAddNodeEx(hTreeD3D, "Video", FALSE, IDI_CAPS, D3D11InfoVideo, (LPARAM)pDevice, 0, 1); + } + } + + void D3D11_FillTree2(HTREEITEM hTree, ID3D11Device2* pDevice, DWORD flMask, D3D_DRIVER_TYPE devType) + { + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + if (fl > D3D_FEATURE_LEVEL_11_1) + fl = D3D_FEATURE_LEVEL_11_1; + + HTREEITEM hTreeD3D = TVAddNodeEx(hTree, "Direct3D 11.2", TRUE, + IDI_CAPS, D3D11Info2, (LPARAM)pDevice, 0, 0); + + TVAddNodeEx(hTreeD3D, FLName(fl), FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2(devType)); + + if (fl != D3D_FEATURE_LEVEL_9_1) + { + HTREEITEM hTreeF = TVAddNode(hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0); + + switch (fl) + { + case D3D_FEATURE_LEVEL_11_1: + if (flMask & FLMASK_11_0) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_11_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_11_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_11_0: + if (flMask & FLMASK_10_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_10_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_10_1: + if (flMask & FLMASK_10_0) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_10_0: + if (flMask & FLMASK_9_3) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_9_3: + if (flMask & FLMASK_9_2) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_9_2: + if (flMask & FLMASK_9_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2(devType)); + } + break; + } + } + + // The majority of this data is already shown under the DirectX 11.1 node, so we only show the 'new' info + + TVAddNodeEx(hTreeD3D, "Shareable", FALSE, IDI_CAPS, D3D11Info2, + (LPARAM)pDevice, (LPARAM)-1, (LPARAM)D3D11_FORMAT_SUPPORT2_SHAREABLE); + } + + void D3D11_FillTree3(HTREEITEM hTree, ID3D11Device3* pDevice, ID3D11Device4* pDevice4, DWORD flMask, D3D_DRIVER_TYPE devType) + { + D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); + + HTREEITEM hTreeD3D = TVAddNodeEx(hTree, (pDevice4) ? "Direct3D 11.3/11.4" : "Direct3D 11.3", TRUE, + IDI_CAPS, D3D11Info3, (LPARAM)pDevice, 0, (LPARAM)pDevice4); + + TVAddNodeEx(hTreeD3D, FLName(fl), FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + + if (fl != D3D_FEATURE_LEVEL_9_1) + { + HTREEITEM hTreeF = TVAddNode(hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0); + + switch (fl) + { + case D3D_FEATURE_LEVEL_12_1: + if (flMask & FLMASK_12_0) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_12_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_12_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_12_0: + if (flMask & FLMASK_11_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_11_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_11_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_11_1: + if (flMask & FLMASK_11_0) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_11_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_11_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_11_0: + if (flMask & FLMASK_10_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_10_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_10_1: + if (flMask & FLMASK_10_0) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_10_0: + if (flMask & FLMASK_9_3) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_9_3: + if (flMask & FLMASK_9_2) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + } + // Fall thru + + case D3D_FEATURE_LEVEL_9_2: + if (flMask & FLMASK_9_1) + { + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3(devType)); + } + break; + } + } + + // The majority of this data is already shown under the DirectX 11.1 or 11.2 node, so we only show the 'new' info + + TVAddNodeEx(hTreeD3D, "UAV Typed Load", FALSE, IDI_CAPS, D3D11Info3, + (LPARAM)pDevice, (LPARAM)-1, (LPARAM)D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD); + + // TODO - Hardware JPEG information + } + + //----------------------------------------------------------------------------- + void D3D12_FillTree(HTREEITEM hTree, ID3D12Device* pDevice, ID3D12Device1* pDevice1, D3D_DRIVER_TYPE devType) + { + D3D_FEATURE_LEVEL fl = GetD3D12FeatureLevel(pDevice); + + HTREEITEM hTreeD3D = TVAddNodeEx(hTree, "Direct3D 12", TRUE, IDI_CAPS, D3D12Info, (LPARAM)pDevice, (LPARAM)fl, (LPARAM)pDevice1); + + TVAddNodeEx(hTreeD3D, FLName(fl), FALSE, IDI_CAPS, D3D_FeatureLevel, (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D12(devType)); + + if (fl != D3D_FEATURE_LEVEL_11_0) + { + HTREEITEM hTreeF = TVAddNode(hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0); + + switch (fl) + { + case D3D_FEATURE_LEVEL_12_1: + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_12_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_12_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D12(devType)); + // Fall thru + + case D3D_FEATURE_LEVEL_12_0: + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_11_1", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_11_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D12(devType)); + // Fall thru + + case D3D_FEATURE_LEVEL_11_1: + TVAddNodeEx(hTreeF, "D3D_FEATURE_LEVEL_11_0", FALSE, IDI_CAPS, D3D_FeatureLevel, + (LPARAM)D3D_FEATURE_LEVEL_11_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D12(devType)); + break; + } + } + } } //----------------------------------------------------------------------------- @@ -272,11 +4974,11 @@ namespace VOID DXGI_Init() { // DXGI - g_dxgi = LoadLibraryEx( "dxgi.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 ); - if ( g_dxgi != 0 ) + g_dxgi = LoadLibraryEx("dxgi.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (g_dxgi) { - auto fpCreateDXGIFactory = reinterpret_cast( GetProcAddress( g_dxgi, "CreateDXGIFactory1" ) ); - if ( fpCreateDXGIFactory ) + auto fpCreateDXGIFactory = reinterpret_cast(GetProcAddress(g_dxgi, "CreateDXGIFactory1")); + if (fpCreateDXGIFactory) { // DXGI 1.5 HRESULT hr = fpCreateDXGIFactory(IID_PPV_ARGS(&g_DXGIFactory5)); @@ -342,4832 +5044,96 @@ VOID DXGI_Init() else { // DXGI 1.0 - fpCreateDXGIFactory = reinterpret_cast( GetProcAddress( g_dxgi, "CreateDXGIFactory" ) ); + fpCreateDXGIFactory = reinterpret_cast(GetProcAddress(g_dxgi, "CreateDXGIFactory")); - if ( fpCreateDXGIFactory != 0 ) + if (fpCreateDXGIFactory != 0) { - HRESULT hr = fpCreateDXGIFactory( IID_PPV_ARGS( &g_DXGIFactory ) ); - if ( FAILED(hr) ) + HRESULT hr = fpCreateDXGIFactory(IID_PPV_ARGS(&g_DXGIFactory)); + if (FAILED(hr)) g_DXGIFactory = nullptr; } } } // Direct3D 10.x - g_d3d10_1 = LoadLibraryEx( "d3d10_1.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 ); - if ( g_d3d10_1 != nullptr ) + g_d3d10_1 = LoadLibraryEx("d3d10_1.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (g_d3d10_1) { - g_D3D10CreateDevice1 = reinterpret_cast( GetProcAddress( g_d3d10_1, "D3D10CreateDevice1" ) ); + g_D3D10CreateDevice1 = reinterpret_cast(GetProcAddress(g_d3d10_1, "D3D10CreateDevice1")); } else { - g_d3d10 = LoadLibraryEx( "d3d10.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 ); - if ( g_d3d10 != nullptr ) + g_d3d10 = LoadLibraryEx("d3d10.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (g_d3d10) { - g_D3D10CreateDevice = reinterpret_cast( GetProcAddress( g_d3d10, "D3D10CreateDevice" ) ); + g_D3D10CreateDevice = reinterpret_cast(GetProcAddress(g_d3d10, "D3D10CreateDevice")); } } // Direct3D 11 - g_d3d11 = LoadLibraryEx( "d3d11.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 ); - if ( g_d3d11 != nullptr ) + g_d3d11 = LoadLibraryEx("d3d11.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (g_d3d11) { - g_D3D11CreateDevice = reinterpret_cast( GetProcAddress( g_d3d11, "D3D11CreateDevice" ) ); + g_D3D11CreateDevice = reinterpret_cast(GetProcAddress(g_d3d11, "D3D11CreateDevice")); } // Direct3D 12 - g_d3d12 = LoadLibraryEx( "d3d12.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32 ); - if ( g_d3d12 != 0 ) + g_d3d12 = LoadLibraryEx("d3d12.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32); + if (g_d3d12) { - g_D3D12CreateDevice = reinterpret_cast( GetProcAddress( g_d3d12, "D3D12CreateDevice" ) ); + g_D3D12CreateDevice = reinterpret_cast(GetProcAddress(g_d3d12, "D3D12CreateDevice")); } } -//----------------------------------------------------------------------------- -#define ENUMNAME(a) case a: return TEXT(#a); - -namespace -{ - const TCHAR* FormatName(DXGI_FORMAT format) - { - switch (format) - { - ENUMNAME(DXGI_FORMAT_R32G32B32A32_TYPELESS) - ENUMNAME(DXGI_FORMAT_R32G32B32A32_FLOAT) - ENUMNAME(DXGI_FORMAT_R32G32B32A32_UINT) - ENUMNAME(DXGI_FORMAT_R32G32B32A32_SINT) - ENUMNAME(DXGI_FORMAT_R32G32B32_TYPELESS) - ENUMNAME(DXGI_FORMAT_R32G32B32_FLOAT) - ENUMNAME(DXGI_FORMAT_R32G32B32_UINT) - ENUMNAME(DXGI_FORMAT_R32G32B32_SINT) - ENUMNAME(DXGI_FORMAT_R16G16B16A16_TYPELESS) - ENUMNAME(DXGI_FORMAT_R16G16B16A16_FLOAT) - ENUMNAME(DXGI_FORMAT_R16G16B16A16_UNORM) - ENUMNAME(DXGI_FORMAT_R16G16B16A16_UINT) - ENUMNAME(DXGI_FORMAT_R16G16B16A16_SNORM) - ENUMNAME(DXGI_FORMAT_R16G16B16A16_SINT) - ENUMNAME(DXGI_FORMAT_R32G32_TYPELESS) - ENUMNAME(DXGI_FORMAT_R32G32_FLOAT) - ENUMNAME(DXGI_FORMAT_R32G32_UINT) - ENUMNAME(DXGI_FORMAT_R32G32_SINT) - ENUMNAME(DXGI_FORMAT_R32G8X24_TYPELESS) - ENUMNAME(DXGI_FORMAT_D32_FLOAT_S8X24_UINT) - ENUMNAME(DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS) - ENUMNAME(DXGI_FORMAT_X32_TYPELESS_G8X24_UINT) - ENUMNAME(DXGI_FORMAT_R10G10B10A2_TYPELESS) - ENUMNAME(DXGI_FORMAT_R10G10B10A2_UNORM) - ENUMNAME(DXGI_FORMAT_R10G10B10A2_UINT) - ENUMNAME(DXGI_FORMAT_R11G11B10_FLOAT) - ENUMNAME(DXGI_FORMAT_R8G8B8A8_TYPELESS) - ENUMNAME(DXGI_FORMAT_R8G8B8A8_UNORM) - ENUMNAME(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB) - ENUMNAME(DXGI_FORMAT_R8G8B8A8_UINT) - ENUMNAME(DXGI_FORMAT_R8G8B8A8_SNORM) - ENUMNAME(DXGI_FORMAT_R8G8B8A8_SINT) - ENUMNAME(DXGI_FORMAT_R16G16_TYPELESS) - ENUMNAME(DXGI_FORMAT_R16G16_FLOAT) - ENUMNAME(DXGI_FORMAT_R16G16_UNORM) - ENUMNAME(DXGI_FORMAT_R16G16_UINT) - ENUMNAME(DXGI_FORMAT_R16G16_SNORM) - ENUMNAME(DXGI_FORMAT_R16G16_SINT) - ENUMNAME(DXGI_FORMAT_R32_TYPELESS) - ENUMNAME(DXGI_FORMAT_D32_FLOAT) - ENUMNAME(DXGI_FORMAT_R32_FLOAT) - ENUMNAME(DXGI_FORMAT_R32_UINT) - ENUMNAME(DXGI_FORMAT_R32_SINT) - ENUMNAME(DXGI_FORMAT_R24G8_TYPELESS) - ENUMNAME(DXGI_FORMAT_D24_UNORM_S8_UINT) - ENUMNAME(DXGI_FORMAT_R24_UNORM_X8_TYPELESS) - ENUMNAME(DXGI_FORMAT_X24_TYPELESS_G8_UINT) - ENUMNAME(DXGI_FORMAT_R8G8_TYPELESS) - ENUMNAME(DXGI_FORMAT_R8G8_UNORM) - ENUMNAME(DXGI_FORMAT_R8G8_UINT) - ENUMNAME(DXGI_FORMAT_R8G8_SNORM) - ENUMNAME(DXGI_FORMAT_R8G8_SINT) - ENUMNAME(DXGI_FORMAT_R16_TYPELESS) - ENUMNAME(DXGI_FORMAT_R16_FLOAT) - ENUMNAME(DXGI_FORMAT_D16_UNORM) - ENUMNAME(DXGI_FORMAT_R16_UNORM) - ENUMNAME(DXGI_FORMAT_R16_UINT) - ENUMNAME(DXGI_FORMAT_R16_SNORM) - ENUMNAME(DXGI_FORMAT_R16_SINT) - ENUMNAME(DXGI_FORMAT_R8_TYPELESS) - ENUMNAME(DXGI_FORMAT_R8_UNORM) - ENUMNAME(DXGI_FORMAT_R8_UINT) - ENUMNAME(DXGI_FORMAT_R8_SNORM) - ENUMNAME(DXGI_FORMAT_R8_SINT) - ENUMNAME(DXGI_FORMAT_A8_UNORM) - ENUMNAME(DXGI_FORMAT_R1_UNORM) - ENUMNAME(DXGI_FORMAT_R9G9B9E5_SHAREDEXP) - ENUMNAME(DXGI_FORMAT_R8G8_B8G8_UNORM) - ENUMNAME(DXGI_FORMAT_G8R8_G8B8_UNORM) - ENUMNAME(DXGI_FORMAT_BC1_TYPELESS) - ENUMNAME(DXGI_FORMAT_BC1_UNORM) - ENUMNAME(DXGI_FORMAT_BC1_UNORM_SRGB) - ENUMNAME(DXGI_FORMAT_BC2_TYPELESS) - ENUMNAME(DXGI_FORMAT_BC2_UNORM) - ENUMNAME(DXGI_FORMAT_BC2_UNORM_SRGB) - ENUMNAME(DXGI_FORMAT_BC3_TYPELESS) - ENUMNAME(DXGI_FORMAT_BC3_UNORM) - ENUMNAME(DXGI_FORMAT_BC3_UNORM_SRGB) - ENUMNAME(DXGI_FORMAT_BC4_TYPELESS) - ENUMNAME(DXGI_FORMAT_BC4_UNORM) - ENUMNAME(DXGI_FORMAT_BC4_SNORM) - ENUMNAME(DXGI_FORMAT_BC5_TYPELESS) - ENUMNAME(DXGI_FORMAT_BC5_UNORM) - ENUMNAME(DXGI_FORMAT_BC5_SNORM) - ENUMNAME(DXGI_FORMAT_B5G6R5_UNORM) - ENUMNAME(DXGI_FORMAT_B5G5R5A1_UNORM) - ENUMNAME(DXGI_FORMAT_B8G8R8A8_UNORM) - ENUMNAME(DXGI_FORMAT_B8G8R8X8_UNORM) - ENUMNAME(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM) - ENUMNAME(DXGI_FORMAT_B8G8R8A8_TYPELESS) - ENUMNAME(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB) - ENUMNAME(DXGI_FORMAT_B8G8R8X8_TYPELESS) - ENUMNAME(DXGI_FORMAT_B8G8R8X8_UNORM_SRGB) - ENUMNAME(DXGI_FORMAT_BC6H_TYPELESS) - ENUMNAME(DXGI_FORMAT_BC6H_UF16) - ENUMNAME(DXGI_FORMAT_BC6H_SF16) - ENUMNAME(DXGI_FORMAT_BC7_TYPELESS) - ENUMNAME(DXGI_FORMAT_BC7_UNORM) - ENUMNAME(DXGI_FORMAT_BC7_UNORM_SRGB) - ENUMNAME(DXGI_FORMAT_AYUV) - ENUMNAME(DXGI_FORMAT_Y410) - ENUMNAME(DXGI_FORMAT_Y416) - ENUMNAME(DXGI_FORMAT_NV12) - ENUMNAME(DXGI_FORMAT_P010) - ENUMNAME(DXGI_FORMAT_P016) - ENUMNAME(DXGI_FORMAT_420_OPAQUE) - ENUMNAME(DXGI_FORMAT_YUY2) - ENUMNAME(DXGI_FORMAT_Y210) - ENUMNAME(DXGI_FORMAT_Y216) - ENUMNAME(DXGI_FORMAT_NV11) - ENUMNAME(DXGI_FORMAT_AI44) - ENUMNAME(DXGI_FORMAT_IA44) - ENUMNAME(DXGI_FORMAT_P8) - ENUMNAME(DXGI_FORMAT_A8P8) - ENUMNAME(DXGI_FORMAT_B4G4R4A4_UNORM) - ENUMNAME(DXGI_FORMAT_P208) - ENUMNAME(DXGI_FORMAT_V208) - ENUMNAME(DXGI_FORMAT_V408) - - default: - return TEXT("DXGI_FORMAT_UNKNOWN"); - } - } - - const TCHAR* FLName(D3D10_FEATURE_LEVEL1 lvl) - { - switch (lvl) - { - ENUMNAME(D3D10_FEATURE_LEVEL_10_0) - ENUMNAME(D3D10_FEATURE_LEVEL_10_1) - ENUMNAME(D3D10_FEATURE_LEVEL_9_1) - ENUMNAME(D3D10_FEATURE_LEVEL_9_2) - ENUMNAME(D3D10_FEATURE_LEVEL_9_3) - default: - return TEXT("D3D10_FEATURE_LEVEL_UNKNOWN"); - } - } - - const TCHAR* FLName(D3D_FEATURE_LEVEL lvl) - { - switch (lvl) - { - ENUMNAME(D3D_FEATURE_LEVEL_9_1) - ENUMNAME(D3D_FEATURE_LEVEL_9_2) - ENUMNAME(D3D_FEATURE_LEVEL_9_3) - ENUMNAME(D3D_FEATURE_LEVEL_10_0) - ENUMNAME(D3D_FEATURE_LEVEL_10_1) - ENUMNAME(D3D_FEATURE_LEVEL_11_0) - ENUMNAME(D3D_FEATURE_LEVEL_11_1) - ENUMNAME(D3D_FEATURE_LEVEL_12_0) - ENUMNAME(D3D_FEATURE_LEVEL_12_1) - default: - return TEXT("D3D_FEATURE_LEVEL_UNKNOWN"); - } - } - - //----------------------------------------------------------------------------- - UINT RefreshRate(const DXGI_RATIONAL& Rate) - { - if (Rate.Numerator == 0) - return 0; - else if (Rate.Denominator == 0) - return 0; - else if (Rate.Denominator == 1) - return Rate.Numerator; - else - return (UINT)(float(Rate.Numerator) / float(Rate.Denominator)); - } -} - - -//----------------------------------------------------------------------------- -static HRESULT DXGIAdapterInfo( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ) -{ - HRESULT hr; - auto pAdapter = reinterpret_cast(lParam2); - - if ( pAdapter == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 50); - } - - DXGI_ADAPTER_DESC desc; - hr = pAdapter->GetDesc( &desc ); - - if ( FAILED(hr) ) - return hr; - - DWORD dvm = (DWORD)(desc.DedicatedVideoMemory / (1024*1024)); - DWORD dsm = (DWORD)(desc.DedicatedSystemMemory / (1024*1024)); - DWORD ssm = (DWORD)(desc.SharedSystemMemory / (1024*1024)); - - char szDesc[128]; - - wcstombs( szDesc, desc.Description, 128 ); - - if ( pPrintInfo == nullptr) - { - LVAddText( g_hwndLV, 0, "Description"); - LVAddText( g_hwndLV, 1, "%s", szDesc); - - LVAddText( g_hwndLV, 0, "VendorId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.VendorId); - - LVAddText( g_hwndLV, 0, "DeviceId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.DeviceId); - - LVAddText( g_hwndLV, 0, "SubSysId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.SubSysId); - - LVAddText( g_hwndLV, 0, "Revision"); - LVAddText( g_hwndLV, 1, "%d", desc.Revision); - - LVAddText( g_hwndLV, 0, "DedicatedVideoMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", dvm); - - LVAddText( g_hwndLV, 0, "DedicatedSystemMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", dsm); - - LVAddText( g_hwndLV, 0, "SharedSystemMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", ssm); - } - else - { - PrintStringValueLine( "Description", szDesc, pPrintInfo ); - PrintHexValueLine( "VendorId", desc.VendorId, pPrintInfo ); - PrintHexValueLine( "DeviceId", desc.DeviceId, pPrintInfo ); - PrintHexValueLine( "SubSysId", desc.SubSysId, pPrintInfo ); - PrintValueLine( "Revision", desc.Revision, pPrintInfo ); - PrintValueLine( "DedicatedVideoMemory (MB)", dvm, pPrintInfo ); - PrintValueLine( "DedicatedSystemMemory (MB)", dsm, pPrintInfo ); - PrintValueLine( "SharedSystemMemory (MB)", ssm, pPrintInfo ); - } - - return S_OK; -} - -static HRESULT DXGIAdapterInfo1( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ) -{ - HRESULT hr; - auto pAdapter = reinterpret_cast(lParam2); - - if ( pAdapter == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 50); - } - - DXGI_ADAPTER_DESC1 desc; - hr = pAdapter->GetDesc1( &desc ); - - if ( FAILED(hr) ) - return hr; - - DWORD dvm = (DWORD)(desc.DedicatedVideoMemory / (1024*1024)); - DWORD dsm = (DWORD)(desc.DedicatedSystemMemory / (1024*1024)); - DWORD ssm = (DWORD)(desc.SharedSystemMemory / (1024*1024)); - - char szDesc[128]; - - wcstombs( szDesc, desc.Description, 128 ); - - if ( pPrintInfo == nullptr) - { - LVAddText( g_hwndLV, 0, "Description"); - LVAddText( g_hwndLV, 1, "%s", szDesc); - - LVAddText( g_hwndLV, 0, "VendorId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.VendorId); - - LVAddText( g_hwndLV, 0, "DeviceId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.DeviceId); - - LVAddText( g_hwndLV, 0, "SubSysId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.SubSysId); - - LVAddText( g_hwndLV, 0, "Revision"); - LVAddText( g_hwndLV, 1, "%d", desc.Revision); - - LVAddText( g_hwndLV, 0, "DedicatedVideoMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", dvm); - - LVAddText( g_hwndLV, 0, "DedicatedSystemMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", dsm); - - LVAddText( g_hwndLV, 0, "SharedSystemMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", ssm); - - LVAddText( g_hwndLV, 0, "Remote" ); - LVAddText( g_hwndLV, 1, (desc.Flags & DXGI_ADAPTER_FLAG_REMOTE) ? c_szYes : c_szNo ); - } - else - { - PrintStringValueLine( "Description", szDesc, pPrintInfo ); - PrintHexValueLine( "VendorId", desc.VendorId, pPrintInfo ); - PrintHexValueLine( "DeviceId", desc.DeviceId, pPrintInfo ); - PrintHexValueLine( "SubSysId", desc.SubSysId, pPrintInfo ); - PrintValueLine( "Revision", desc.Revision, pPrintInfo ); - PrintValueLine( "DedicatedVideoMemory (MB)", dvm, pPrintInfo ); - PrintValueLine( "DedicatedSystemMemory (MB)", dsm, pPrintInfo ); - PrintValueLine( "SharedSystemMemory (MB)", ssm, pPrintInfo ); - PrintStringValueLine( "Remote", (desc.Flags & DXGI_ADAPTER_FLAG_REMOTE) ? c_szYes : c_szNo, pPrintInfo ); - } - - return S_OK; -} - -static HRESULT DXGIAdapterInfo2( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ) -{ - HRESULT hr; - auto pAdapter = reinterpret_cast(lParam2); - - if ( !pAdapter ) - return S_OK; - - if( !pPrintInfo ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 50); - } - - DXGI_ADAPTER_DESC2 desc; - hr = pAdapter->GetDesc2( &desc ); - - if ( FAILED(hr) ) - return hr; - - DWORD dvm = (DWORD)(desc.DedicatedVideoMemory / (1024*1024)); - DWORD dsm = (DWORD)(desc.DedicatedSystemMemory / (1024*1024)); - DWORD ssm = (DWORD)(desc.SharedSystemMemory / (1024*1024)); - - char szDesc[128]; - - wcstombs( szDesc, desc.Description, 128 ); - - const char *gpg = nullptr; - const char *cpg = nullptr; - - switch ( desc.GraphicsPreemptionGranularity ) - { - case DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY: gpg = "DMA Buffer"; break; - case DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY: gpg = "Primitive"; break; - case DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY: gpg = "Triangle"; break; - case DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY: gpg = "Pixel"; break; - case DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY: gpg = "Instruction"; break; - default: gpg = "Unknown"; break; - } - - switch ( desc.ComputePreemptionGranularity ) - { - case DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY: cpg = "DMA Buffer"; break; - case DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY: cpg = "Dispatch"; break; - case DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY: cpg = "Thread Group"; break; - case DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY: cpg = "Thread"; break; - case DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY: cpg = "Instruction"; break; - default: cpg = "Unknown"; break; - } - - if ( !pPrintInfo ) - { - LVAddText( g_hwndLV, 0, "Description"); - LVAddText( g_hwndLV, 1, "%s", szDesc); - - LVAddText( g_hwndLV, 0, "VendorId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.VendorId); - - LVAddText( g_hwndLV, 0, "DeviceId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.DeviceId); - - LVAddText( g_hwndLV, 0, "SubSysId"); - LVAddText( g_hwndLV, 1, "0x%08x", desc.SubSysId); - - LVAddText( g_hwndLV, 0, "Revision"); - LVAddText( g_hwndLV, 1, "%d", desc.Revision); - - LVAddText( g_hwndLV, 0, "DedicatedVideoMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", dvm); - - LVAddText( g_hwndLV, 0, "DedicatedSystemMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", dsm); - - LVAddText( g_hwndLV, 0, "SharedSystemMemory (MB)"); - LVAddText( g_hwndLV, 1, "%d", ssm); - - LVAddText( g_hwndLV, 0, "Remote" ); - LVAddText( g_hwndLV, 1, (desc.Flags & DXGI_ADAPTER_FLAG_REMOTE) ? c_szYes : c_szNo ); - - LVAddText( g_hwndLV, 0, "Graphics Preemption Granularity" ); - LVAddText( g_hwndLV, 1, gpg ); - - LVAddText( g_hwndLV, 0, "Compute Preemption Granularity" ); - LVAddText( g_hwndLV, 1, cpg ); - } - else - { - PrintStringValueLine( "Description", szDesc, pPrintInfo ); - PrintHexValueLine( "VendorId", desc.VendorId, pPrintInfo ); - PrintHexValueLine( "DeviceId", desc.DeviceId, pPrintInfo ); - PrintHexValueLine( "SubSysId", desc.SubSysId, pPrintInfo ); - PrintValueLine( "Revision", desc.Revision, pPrintInfo ); - PrintValueLine( "DedicatedVideoMemory (MB)", dvm, pPrintInfo ); - PrintValueLine( "DedicatedSystemMemory (MB)", dsm, pPrintInfo ); - PrintValueLine( "SharedSystemMemory (MB)", ssm, pPrintInfo ); - PrintStringValueLine( "Remote", (desc.Flags & DXGI_ADAPTER_FLAG_REMOTE) ? c_szYes : c_szNo, pPrintInfo ); - PrintStringValueLine( "Graphics Preemption Granularity", gpg, pPrintInfo ); - PrintStringValueLine( "Compute Preemption Granularity", cpg, pPrintInfo ); - } - - return S_OK; -} - -//----------------------------------------------------------------------------- -static HRESULT DXGIOutputInfo( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ) -{ - HRESULT hr; - auto pOutput = reinterpret_cast(lParam2); - - if ( pOutput == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 30); - } - - DXGI_OUTPUT_DESC desc; - hr = pOutput->GetDesc( &desc ); - - if ( FAILED(hr) ) - return hr; - - char szDevName[32]; - - wcstombs( szDevName, desc.DeviceName, 32 ); - - if ( pPrintInfo == nullptr) - { - LVAddText( g_hwndLV, 0, "DeviceName"); - LVAddText( g_hwndLV, 1, "%s", szDevName); - - LVAddText( g_hwndLV, 0, "AttachedToDesktop"); - LVAddText( g_hwndLV, 1, desc.AttachedToDesktop ? c_szYes : c_szNo ); - - LVAddText( g_hwndLV, 0, "Rotation"); - LVAddText( g_hwndLV, 1, szRotation[ desc.Rotation ]); - } - else - { - PrintStringValueLine( "DeviceName", szDevName, pPrintInfo ); - PrintStringValueLine( "AttachedToDesktop", desc.AttachedToDesktop ? c_szYes : c_szNo, pPrintInfo ); - PrintStringValueLine( "Rotation", szRotation[ desc.Rotation ], pPrintInfo ); - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -static HRESULT DXGIOutputModes( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ) -{ - HRESULT hr; - auto pOutput = reinterpret_cast(lParam2); - - if ( pOutput == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Resolution", 10); - LVAddColumn(g_hwndLV, 1, "Pixel Format", 30); - LVAddColumn(g_hwndLV, 2, "Refresh Rate", 10); - } - - for (UINT iFormat = 0; iFormat < NumAdapterFormats; ++iFormat) - { - DXGI_FORMAT fmt = AdapterFormatArray[iFormat]; - - if ( !g_DXGIFactory1 ) - { - switch (fmt) - { - case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: - case DXGI_FORMAT_B8G8R8A8_UNORM: - case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: - continue; - } - } - - UINT num = 0; - const DWORD flags = 0; - hr = pOutput->GetDisplayModeList( fmt, flags, &num, 0 ); - - if ( SUCCEEDED(hr) && num > 0 ) - { - DXGI_MODE_DESC* pDescs = new DXGI_MODE_DESC[num]; - - hr = pOutput->GetDisplayModeList( fmt, flags, &num, pDescs ); - - if ( SUCCEEDED(hr) ) - { - for( UINT iMode = 0; iMode < num; ++iMode ) - { - const DXGI_MODE_DESC* pDesc = &pDescs[ iMode ]; - if (pPrintInfo == nullptr) - { - LVAddText( g_hwndLV, 0, "%d x %d", pDesc->Width, pDesc->Height); - LVAddText( g_hwndLV, 1, FormatName(pDesc->Format)); - LVAddText( g_hwndLV, 2, "%d", RefreshRate( pDesc->RefreshRate ) ); - } - else - { - char szBuff[80]; - DWORD cchLen; - - // Calculate Name and Value column x offsets - int x1 = (pPrintInfo->dwCurrIndent * DEF_TAB_SIZE * pPrintInfo->dwCharWidth); - int x2 = x1 + (30 * pPrintInfo->dwCharWidth); - int x3 = x2 + (20 * pPrintInfo->dwCharWidth); - int yLine = (pPrintInfo->dwCurrLine * pPrintInfo->dwLineHeight); - - sprintf_s (szBuff, sizeof(szBuff), "%d x %d", pDesc->Width, pDesc->Height); - cchLen = _tcslen (szBuff); - if( FAILED( PrintLine (x1, yLine, szBuff, cchLen, pPrintInfo) ) ) - return E_FAIL; - - strcpy_s (szBuff, sizeof(szBuff), FormatName(pDesc->Format)); - cchLen = _tcslen (szBuff); - if( FAILED( PrintLine (x2, yLine, szBuff, cchLen, pPrintInfo) ) ) - return E_FAIL; - - sprintf_s (szBuff, sizeof(szBuff), "%d", RefreshRate( pDesc->RefreshRate ) ); - cchLen = _tcslen (szBuff); - if( FAILED( PrintLine (x3, yLine, szBuff, cchLen, pPrintInfo) ) ) - return E_FAIL; - - // Advance to next line on page - if( FAILED( PrintNextLine(pPrintInfo) ) ) - return E_FAIL; - } - } - } - - delete [] pDescs; - } - } - - return S_OK; -} - -//----------------------------------------------------------------------------- -#define LVYESNO(a,b) \ - if ( g_dwViewState == IDM_VIEWALL || (b) ) \ - { \ - LVAddText( g_hwndLV, 0, a ); \ - LVAddText( g_hwndLV, 1, (b) ? c_szYes : c_szNo ); \ - } - -#define PRINTYESNO(a,b) \ - PrintStringValueLine( a, (b) ? c_szYes : c_szNo, pPrintInfo ); - -#define LVLINE(a,b) \ - if ( g_dwViewState == IDM_VIEWALL || (b != c_szNA && b != c_szNo) ) \ - { \ - LVAddText( g_hwndLV, 0, a ); \ - LVAddText( g_hwndLV, 1, b ); \ - } - -#define PRINTLINE(a,b) \ - if ( g_dwViewState == IDM_VIEWALL || (b != c_szNA && b != c_szNo) ) \ - { \ - PrintStringValueLine( a, b, pPrintInfo ); \ - } - -#define XTOSTRING(a) #a TOSTRING(a) -#define TOSTRING(a) #a - -#define XTOSTRING2(a) #a TOSTRING2(a) -#define TOSTRING2(a) "( " #a " )" - - -//----------------------------------------------------------------------------- -static HRESULT DXGIFeatures(LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo) -{ - if (g_DXGIFactory5) - { - if (!pPrintInfo) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - - BOOL allowTearing = FALSE; - HRESULT hr = g_DXGIFactory5->CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING, &allowTearing, sizeof(BOOL)); - if (FAILED(hr)) - allowTearing = FALSE; - - if (pPrintInfo == nullptr) - { - LVYESNO("Allow tearing", allowTearing) - } - else - { - PRINTYESNO("Allow tearing", allowTearing) - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -namespace -{ - bool IsMSAAPowerOf2(UINT value) - { - // only supports values 0..32 - if (value <= 1) - return true; - - if (value & 0x1) - return false; - - for (UINT mask = 0x2; mask < 0x100; mask <<= 1) - { - if ((value & ~mask) == 0) - return true; - } - - return false; - } - - //----------------------------------------------------------------------------- - void CheckExtendedFormats(ID3D10Device* pDevice, BOOL& ext, BOOL& x2) - { - ext = x2 = FALSE; - - // DXGI 1.1 required for extended formats - if (!g_DXGIFactory1) - return; - - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport(DXGI_FORMAT_B8G8R8A8_UNORM, &fmtSupport); - if (FAILED(hr)) - fmtSupport = 0; - - if (fmtSupport & D3D10_FORMAT_SUPPORT_RENDER_TARGET) - ext = TRUE; - - hr = pDevice->CheckFormatSupport(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, &fmtSupport); - if (FAILED(hr)) - fmtSupport = 0; - - if (fmtSupport & D3D10_FORMAT_SUPPORT_DISPLAY) - x2 = TRUE; - } - - void CheckExtendedFormats(ID3D11Device* pDevice, BOOL& ext, BOOL& x2, BOOL& bpp565) - { - ext = x2 = bpp565 = FALSE; - - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport(DXGI_FORMAT_B8G8R8A8_UNORM, &fmtSupport); - if (FAILED(hr)) - fmtSupport = 0; - - if (fmtSupport & D3D11_FORMAT_SUPPORT_RENDER_TARGET) - ext = TRUE; - - fmtSupport = 0; - hr = pDevice->CheckFormatSupport(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, &fmtSupport); - if (FAILED(hr)) - fmtSupport = 0; - - if (fmtSupport & D3D11_FORMAT_SUPPORT_DISPLAY) - x2 = TRUE; - - // DXGI 1.2 is required for 16bpp support - if (g_DXGIFactory2) - { - fmtSupport = 0; - hr = pDevice->CheckFormatSupport(DXGI_FORMAT_B5G6R5_UNORM, &fmtSupport); - if (FAILED(hr)) - fmtSupport = 0; - - if (fmtSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) - bpp565 = TRUE; - } - } - - - //----------------------------------------------------------------------------- - void CheckD3D11Ops(ID3D11Device* pDevice, bool &logicOps, bool &cbPartial, bool& cbOffsetting) - { - D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11opts = { 0 }; - HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &d3d11opts, sizeof(d3d11opts)); - if (FAILED(hr)) - memset(&d3d11opts, 0, sizeof(d3d11opts)); - - logicOps = (d3d11opts.OutputMergerLogicOp) ? true : false; - cbPartial = (d3d11opts.ConstantBufferPartialUpdate) ? true : false; - cbOffsetting = (d3d11opts.ConstantBufferOffsetting) ? true : false; - } - - - //----------------------------------------------------------------------------- - void CheckD3D11Ops1(ID3D11Device* pDevice, D3D11_TILED_RESOURCES_TIER &tiled, bool &minmaxfilter, bool& mapdefaultbuff) - { - D3D11_FEATURE_DATA_D3D11_OPTIONS1 d3d11opts1 = {}; - HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS1, &d3d11opts1, sizeof(d3d11opts1)); - if (FAILED(hr)) - memset(&d3d11opts1, 0, sizeof(d3d11opts1)); - - tiled = d3d11opts1.TiledResourcesTier; - minmaxfilter = (d3d11opts1.MinMaxFiltering) ? true : false; - mapdefaultbuff = (d3d11opts1.MapOnDefaultBuffers) ? true : false; - } - - - //----------------------------------------------------------------------------- - void CheckD3D11Ops2(ID3D11Device* pDevice, D3D11_TILED_RESOURCES_TIER &tiled, D3D11_CONSERVATIVE_RASTERIZATION_TIER& crast, - bool& rovs, bool& pssref) - { - D3D11_FEATURE_DATA_D3D11_OPTIONS2 d3d11opts2 = { 0 }; - HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &d3d11opts2, sizeof(d3d11opts2)); - if (FAILED(hr)) - memset(&d3d11opts2, 0, sizeof(d3d11opts2)); - - crast = d3d11opts2.ConservativeRasterizationTier; - tiled = d3d11opts2.TiledResourcesTier; - rovs = (d3d11opts2.ROVsSupported) ? true : false; - pssref = (d3d11opts2.PSSpecifiedStencilRefSupported) ? true : false; - } - - - //----------------------------------------------------------------------------- - void CheckD3D9Ops(ID3D11Device* pDevice, bool& nonpow2, bool &shadows) - { - D3D11_FEATURE_DATA_D3D9_OPTIONS d3d9opts = { 0 }; - HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_OPTIONS, &d3d9opts, sizeof(d3d9opts)); - if (FAILED(hr)) - memset(&d3d9opts, 0, sizeof(d3d9opts)); - - nonpow2 = (d3d9opts.FullNonPow2TextureSupport) ? true : false; - - D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT d3d9shadows = { 0 }; - hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_SHADOW_SUPPORT, &d3d9shadows, sizeof(d3d9shadows)); - if (FAILED(hr)) - memset(&d3d9shadows, 0, sizeof(d3d9shadows)); - - shadows = (d3d9shadows.SupportsDepthAsTextureWithLessEqualComparisonFilter) ? true : false; - } - - - //----------------------------------------------------------------------------- - void CheckD3D9Ops1(ID3D11Device* pDevice, bool& nonpow2, bool &shadows, bool& instancing, bool& cubemapRT) - { - D3D11_FEATURE_DATA_D3D9_OPTIONS1 d3d9opts = { 0 }; - HRESULT hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_OPTIONS1, &d3d9opts, sizeof(d3d9opts)); - if (FAILED(hr)) - { - memset(&d3d9opts, 0, sizeof(d3d9opts)); - - // Handle Windows 8.1 Preview by falling back to D3D9_OPTIONS, D3D9_SHADOW_SUPPORT, and D3D9_SIMPLE_INSTANCING_SUPPORT - CheckD3D9Ops(pDevice, nonpow2, shadows); - - D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT d3d9si = { 0 }; - hr = pDevice->CheckFeatureSupport(D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT, &d3d9si, sizeof(d3d9si)); - if (FAILED(hr)) - memset(&d3d9si, 0, sizeof(d3d9si)); - - instancing = (d3d9si.SimpleInstancingSupported) ? true : false; - - cubemapRT = false; - - return; - } - - nonpow2 = (d3d9opts.FullNonPow2TextureSupported) ? true : false; - - shadows = (d3d9opts.DepthAsTextureWithLessEqualComparisonFilterSupported) ? true : false; - - instancing = (d3d9opts.SimpleInstancingSupported) ? true : false; - - cubemapRT = (d3d9opts.TextureCubeFaceRenderTargetWithNonCubeDepthStencilSupported) ? true : false; - } -} - - -//----------------------------------------------------------------------------- -#define D3D_FL_LPARAM3_D3D10( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 0 ) -#define D3D_FL_LPARAM3_D3D10_1( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 1 ) -#define D3D_FL_LPARAM3_D3D11( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 2 ) -#define D3D_FL_LPARAM3_D3D11_1( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 3 ) -#define D3D_FL_LPARAM3_D3D11_2( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 4 ) -#define D3D_FL_LPARAM3_D3D11_3( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 5 ) -#define D3D_FL_LPARAM3_D3D12( d3dType ) ( ( (d3dType & 0xff) << 8 ) | 10 ) -static HRESULT D3D_FeatureLevel( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - D3D_FEATURE_LEVEL fl = (D3D_FEATURE_LEVEL)lParam1; - - if ( lParam2 == 0 ) - return S_OK; - - ID3D10Device* pD3D10 = nullptr; - ID3D10Device1* pD3D10_1 = nullptr; - ID3D11Device* pD3D11 = nullptr; - ID3D11Device1* pD3D11_1 = nullptr; - ID3D11Device2* pD3D11_2 = nullptr; - ID3D11Device3* pD3D11_3 = nullptr; - ID3D12Device* pD3D12 = nullptr; - - auto d3dVer = static_cast( lParam3 & 0xff ); - auto d3dType = static_cast( ( lParam3 & 0xff00 ) >> 8 ); - - if ( d3dVer == 10 ) - { - pD3D12 = reinterpret_cast(lParam2); - } - else if ( d3dVer == 5 ) - { - pD3D11_3 = reinterpret_cast(lParam2); - } - else - { - if ( fl > D3D_FEATURE_LEVEL_11_1 ) - fl = D3D_FEATURE_LEVEL_11_1; - - if ( d3dVer == 4 ) - { - pD3D11_2 = reinterpret_cast(lParam2); - } - else if ( d3dVer == 3 ) - { - pD3D11_1 = reinterpret_cast(lParam2); - } - else - { - if ( fl > D3D_FEATURE_LEVEL_11_0 ) - fl = D3D_FEATURE_LEVEL_11_0; - - if ( d3dVer == 2 ) - { - pD3D11 = reinterpret_cast(lParam2); - } - else - { - if ( fl > D3D_FEATURE_LEVEL_10_1 ) - fl = D3D_FEATURE_LEVEL_10_1; - - if ( d3dVer == 1 ) - { - pD3D10_1 = reinterpret_cast(lParam2); - } - else - { - if ( fl > D3D_FEATURE_LEVEL_10_0 ) - fl = D3D_FEATURE_LEVEL_10_0; - - pD3D10 = reinterpret_cast(lParam2); - } - } - } - } - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - - const char *shaderModel = nullptr; - const char *computeShader = c_szNo; - const char *maxTexDim = nullptr; - const char *maxCubeDim = nullptr; - const char *maxVolDim = nullptr; - const char *maxTexRepeat = nullptr; - const char *maxAnisotropy = nullptr; - const char *maxPrimCount = "4294967296"; - const char *maxInputSlots = nullptr; - const char *mrt = nullptr; - const char *extFormats = nullptr; - const char *x2_10BitFormat = nullptr; - const char *logic_ops = c_szNo; - const char *cb_partial = c_szNA; - const char *cb_offsetting = c_szNA; - const char *uavSlots = nullptr; - const char *uavEveryStage = nullptr; - const char *uavOnlyRender = nullptr; - const char *nonpow2 = nullptr; - const char *bpp16 = c_szNo; - const char *shadows = nullptr; - const char *cubeRT = nullptr; - const char *tiled_rsc = nullptr; - const char *binding_rsc = nullptr; - const char *minmaxfilter = nullptr; - const char *mapdefaultbuff = nullptr; - const char *consrv_rast = nullptr; - const char *rast_ordered_views = nullptr; - const char *ps_stencil_ref = nullptr; - const char *instancing = nullptr; - - BOOL _10level9 = FALSE; - - switch( fl ) - { - case D3D_FEATURE_LEVEL_12_1: - case D3D_FEATURE_LEVEL_12_0: - shaderModel = "5.0"; - computeShader = "Yes (CS 5.0)"; - extFormats = c_szYes; - x2_10BitFormat = c_szYes; - logic_ops = c_szYes; - cb_partial = c_szYes; - cb_offsetting = c_szYes; - uavEveryStage = c_szYes; - uavOnlyRender = "16"; - nonpow2 = "Full"; - bpp16 = c_szYes; - instancing = c_szYes; - - if (pD3D12) - { - maxTexDim = XTOSTRING( D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING( D3D12_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING( D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING( D3D12_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ); - maxAnisotropy = XTOSTRING( D3D12_REQ_MAXANISOTROPY ); - maxInputSlots = XTOSTRING( D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING( D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT ); - uavSlots = XTOSTRING( D3D12_UAV_SLOT_COUNT ); - - D3D12_FEATURE_DATA_SHADER_MODEL shaderModelOpt = {}; - shaderModelOpt.HighestShaderModel = D3D_SHADER_MODEL_6_5; - HRESULT hr = pD3D12->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &shaderModelOpt, sizeof(shaderModelOpt)); - while(hr == E_INVALIDARG && shaderModelOpt.HighestShaderModel > D3D_SHADER_MODEL_6_0) - { - shaderModelOpt.HighestShaderModel = static_cast(static_cast(shaderModelOpt.HighestShaderModel) - 1); - hr = pD3D12->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &shaderModelOpt, sizeof(shaderModelOpt)); - } - if (FAILED(hr)) - { - shaderModelOpt.HighestShaderModel = D3D_SHADER_MODEL_5_1; - } - - switch (shaderModelOpt.HighestShaderModel) - { - case D3D_SHADER_MODEL_6_5: - shaderModel = "6.5"; - computeShader = "Yes (CS 6.5)"; - break; - case D3D_SHADER_MODEL_6_4: - shaderModel = "6.4"; - computeShader = "Yes (CS 6.4)"; - break; - case D3D_SHADER_MODEL_6_3: - shaderModel = "6.3"; - computeShader = "Yes (CS 6.3)"; - break; - case D3D_SHADER_MODEL_6_2: - shaderModel = "6.2"; - computeShader = "Yes (CS 6.2)"; - break; - case D3D_SHADER_MODEL_6_1: - shaderModel = "6.1"; - computeShader = "Yes (CS 6.1)"; - break; - case D3D_SHADER_MODEL_6_0: - shaderModel = "6.0"; - computeShader = "Yes (CS 6.0)"; - break; - default: - shaderModel = "5.1"; - computeShader = "Yes (CS 5.1)"; - break; - } - - D3D12_FEATURE_DATA_D3D12_OPTIONS d3d12opts = {0}; - hr = pD3D12->CheckFeatureSupport( D3D12_FEATURE_D3D12_OPTIONS, &d3d12opts, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS) ); - if ( FAILED(hr) ) - memset( &d3d12opts, 0, sizeof(d3d12opts) ); - - switch ( d3d12opts.TiledResourcesTier ) - { - // 12.0 & 12.1 should be T2 or greater - case D3D12_TILED_RESOURCES_TIER_2: tiled_rsc = "Yes - Tier 2"; break; - case D3D12_TILED_RESOURCES_TIER_3: tiled_rsc = "Yes - Tier 3"; break; - case D3D12_TILED_RESOURCES_TIER_4: tiled_rsc = "Yes - Tier 4"; break; - default: tiled_rsc = "Yes"; break; - } - - switch ( d3d12opts.ResourceBindingTier ) - { - // 12.0 & 12.1 should be T2 or greater - case D3D12_RESOURCE_BINDING_TIER_2: binding_rsc = "Yes - Tier 2"; break; - case D3D12_RESOURCE_BINDING_TIER_3: binding_rsc = "Yes - Tier 3"; break; - default: binding_rsc = "Yes"; break; - } - - if ( fl >= D3D_FEATURE_LEVEL_12_1 ) - { - switch( d3d12opts.ConservativeRasterizationTier ) - { - // 12.1 requires T1 - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Yes - Tier 1"; break; - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Yes - Tier 2"; break; - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Yes - Tier 3"; break; - default: consrv_rast = "Yes"; break; - } - - rast_ordered_views = c_szYes; - } - else - { - switch( d3d12opts.ConservativeRasterizationTier ) - { - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED: consrv_rast = "Optional (No)"; break; - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Optional (Yes - Tier 1)"; break; - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Optional (Yes - Tier 2)"; break; - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Optional (Yes - Tier 3)"; break; - default: consrv_rast = "Optional (Yes)"; break; - } - - rast_ordered_views = (d3d12opts.ROVsSupported) ? "Optional (Yes)" : "Optional (No)"; - } - - ps_stencil_ref = (d3d12opts.PSSpecifiedStencilRefSupported) ? "Optional (Yes)" : "Optional (No)"; - minmaxfilter = c_szYes; - mapdefaultbuff = c_szYes; - } - else if (pD3D11_3) - { - maxTexDim = XTOSTRING( D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING( D3D11_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING( D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING( D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ); - maxAnisotropy = XTOSTRING( D3D11_REQ_MAXANISOTROPY ); - maxInputSlots = XTOSTRING( D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING( D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ); - uavSlots = XTOSTRING( D3D11_1_UAV_SLOT_COUNT ); - - D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; - bool bMinMaxFilter, bMapDefaultBuff; - CheckD3D11Ops1( pD3D11_3, tiled, bMinMaxFilter, bMapDefaultBuff ); - - D3D11_CONSERVATIVE_RASTERIZATION_TIER crast = D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED; - bool rovs, pssref; - CheckD3D11Ops2( pD3D11_3, tiled, crast, rovs, pssref ); - - switch (tiled) - { - // 12.0 & 12.1 should be T2 or greater - case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Yes - Tier 2"; break; - case D3D11_TILED_RESOURCES_TIER_3: tiled_rsc = "Yes - Tier 3"; break; - default: tiled_rsc = "Yes"; break; - } - - if ( fl >= D3D_FEATURE_LEVEL_12_1 ) - { - switch(crast) - { - // 12.1 requires T1 - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Yes - Tier 1"; break; - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Yes - Tier 2"; break; - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Yes - Tier 3"; break; - default: consrv_rast = "Yes"; break; - } - - rast_ordered_views = c_szYes; - } - else - { - switch(crast) - { - case D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED: consrv_rast = "Optional (No)"; break; - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Optional (Yes - Tier 1)"; break; - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Optional (Yes - Tier 2)"; break; - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Optional (Yes - Tier 3)"; break; - default: consrv_rast = "Optional (Yes)"; break; - } - - rast_ordered_views = (rovs) ? "Optional (Yes)" : "Optional (No)"; - } - - ps_stencil_ref = (pssref) ? "Optional (Yes)" : "Optional (No)"; - minmaxfilter = c_szYes; - mapdefaultbuff = c_szYes; - } - break; - - case D3D_FEATURE_LEVEL_11_1: - shaderModel = "5.0"; - computeShader = "Yes (CS 5.0)"; - maxTexDim = XTOSTRING( D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING( D3D11_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING( D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING( D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ); - maxAnisotropy = XTOSTRING( D3D11_REQ_MAXANISOTROPY ); - maxInputSlots = XTOSTRING( D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING( D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ); - extFormats = c_szYes; - x2_10BitFormat = c_szYes; - logic_ops = c_szYes; - cb_partial = c_szYes; - cb_offsetting = c_szYes; - uavSlots = XTOSTRING( D3D11_1_UAV_SLOT_COUNT ); - uavEveryStage = c_szYes; - uavOnlyRender = "16"; - nonpow2 = "Full"; - bpp16 = c_szYes; - instancing = c_szYes; - - if (pD3D12) - { - shaderModel = "5.1"; - computeShader = "Yes (CS 5.1)"; - - D3D12_FEATURE_DATA_D3D12_OPTIONS d3d12opts = {0}; - HRESULT hr = pD3D12->CheckFeatureSupport( D3D12_FEATURE_D3D12_OPTIONS, &d3d12opts, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS) ); - if ( FAILED(hr) ) - memset( &d3d12opts, 0, sizeof(d3d12opts) ); - - switch ( d3d12opts.TiledResourcesTier ) - { - case D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; - case D3D12_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; - case D3D12_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; - case D3D12_TILED_RESOURCES_TIER_3: tiled_rsc = "Optional (Yes - Tier 3)"; break; - case D3D12_TILED_RESOURCES_TIER_4: tiled_rsc = "Optional (Yes - Tier 4)"; break; - default: tiled_rsc = "Optional (Yes)"; break; - } - - switch( d3d12opts.ConservativeRasterizationTier ) - { - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED: consrv_rast = "Optional (No)"; break; - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Optional (Yes - Tier 1)"; break; - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Optional (Yes - Tier 2)"; break; - case D3D12_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Optional (Yes - Tier 3)"; break; - default: consrv_rast = "Optional (Yes)"; break; - } - - rast_ordered_views = (d3d12opts.ROVsSupported) ? "Optional (Yes)" : "Optional (No)"; - ps_stencil_ref = (d3d12opts.PSSpecifiedStencilRefSupported) ? "Optional (Yes)" : "Optional (No)"; - minmaxfilter = c_szYes; - mapdefaultbuff = c_szYes; - } - else if (pD3D11_3) - { - D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; - bool bMinMaxFilter, bMapDefaultBuff; - CheckD3D11Ops1( pD3D11_3, tiled, bMinMaxFilter, bMapDefaultBuff ); - - D3D11_CONSERVATIVE_RASTERIZATION_TIER crast = D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED; - bool rovs, pssref; - CheckD3D11Ops2( pD3D11_3, tiled, crast, rovs, pssref ); - - switch (tiled) - { - case D3D11_TILED_RESOURCES_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; - case D3D11_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; - case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; - case D3D11_TILED_RESOURCES_TIER_3: tiled_rsc = "Optional (Yes - Tier 3)"; break; - default: tiled_rsc = "Optional (Yes)"; break; - } - - switch(crast) - { - case D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED: consrv_rast = "Optional (No)"; break; - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_1: consrv_rast = "Optional (Yes - Tier 1)"; break; - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_2: consrv_rast = "Optional (Yes - Tier 2)"; break; - case D3D11_CONSERVATIVE_RASTERIZATION_TIER_3: consrv_rast = "Optional (Yes - Tier 3)"; break; - default: consrv_rast = "Optional (Yes)"; break; - } - - rast_ordered_views = (rovs) ? "Optional (Yes)" : "Optional (No)"; - ps_stencil_ref = (pssref) ? "Optional (Yes)" : "Optional (No)"; - minmaxfilter = bMinMaxFilter ? "Optional (Yes)" : "Optional (No)"; - mapdefaultbuff = bMapDefaultBuff ? "Optional (Yes)" : "Optional (No)"; - } - else if (pD3D11_2) - { - D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; - bool bMinMaxFilter, bMapDefaultBuff; - CheckD3D11Ops1( pD3D11_2, tiled, bMinMaxFilter, bMapDefaultBuff ); - - switch (tiled) - { - case D3D11_TILED_RESOURCES_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; - case D3D11_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; - case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; - default: tiled_rsc = "Optional (Yes)"; break; - } - - minmaxfilter = bMinMaxFilter ? "Optional (Yes)" : "Optional (No)"; - mapdefaultbuff = bMapDefaultBuff ? "Optional (Yes)" : "Optional (No)"; - } - break; - - case D3D_FEATURE_LEVEL_11_0: - shaderModel = "5.0"; - computeShader = "Yes (CS 5.0)"; - maxTexDim = XTOSTRING( D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING( D3D11_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING( D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING( D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ); - maxAnisotropy = XTOSTRING( D3D11_REQ_MAXANISOTROPY ); - maxInputSlots = XTOSTRING( D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING( D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ); - extFormats = c_szYes; - x2_10BitFormat = c_szYes; - instancing = c_szYes; - - if (pD3D12) - { - shaderModel = "5.1"; - computeShader = "Yes (CS 5.1)"; - - D3D12_FEATURE_DATA_D3D12_OPTIONS d3d12opts = {0}; - HRESULT hr = pD3D12->CheckFeatureSupport( D3D12_FEATURE_D3D12_OPTIONS, &d3d12opts, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS) ); - if ( FAILED(hr) ) - memset( &d3d12opts, 0, sizeof(d3d12opts) ); - - switch ( d3d12opts.TiledResourcesTier ) - { - case D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; - case D3D12_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; - case D3D12_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; - case D3D12_TILED_RESOURCES_TIER_3: tiled_rsc = "Optional (Yes - Tier 3)"; break; - case D3D12_TILED_RESOURCES_TIER_4: tiled_rsc = "Optional (Yes - Tier 4)"; break; - default: tiled_rsc = "Optional (Yes)"; break; - } - - logic_ops = d3d12opts.OutputMergerLogicOp ? "Optional (Yes)" : "Optional (No)"; - consrv_rast = rast_ordered_views = ps_stencil_ref = minmaxfilter = c_szNo; - mapdefaultbuff = c_szYes; - - uavSlots = "8"; - uavEveryStage = c_szNo; - uavOnlyRender = "8"; - nonpow2 = "Full"; - } - else if (pD3D11_3) - { - D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; - bool bMinMaxFilter, bMapDefaultBuff; - CheckD3D11Ops1( pD3D11_3, tiled, bMinMaxFilter, bMapDefaultBuff ); - - D3D11_FEATURE_DATA_D3D11_OPTIONS2 d3d11opts2 = {0}; - HRESULT hr = pD3D11_3->CheckFeatureSupport( D3D11_FEATURE_D3D11_OPTIONS2, &d3d11opts2, sizeof(d3d11opts2) ); - if ( SUCCEEDED(hr) ) - { - // D3D11_FEATURE_DATA_D3D11_OPTIONS1 caps this at Tier 2 - tiled = d3d11opts2.TiledResourcesTier; - } - - switch (tiled) - { - case D3D11_TILED_RESOURCES_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; - case D3D11_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; - case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; - case D3D11_TILED_RESOURCES_TIER_3: tiled_rsc = "Optional (Yes - Tier 3)"; break; - default: tiled_rsc = "Optional (Yes)"; break; - } - - consrv_rast = rast_ordered_views = ps_stencil_ref = minmaxfilter = c_szNo; - mapdefaultbuff = bMapDefaultBuff ? "Optional (Yes)" : "Optional (No)"; - } - else if (pD3D11_2) - { - D3D11_TILED_RESOURCES_TIER tiled = D3D11_TILED_RESOURCES_NOT_SUPPORTED; - bool bMinMaxFilter, bMapDefaultBuff; - CheckD3D11Ops1( pD3D11_2, tiled, bMinMaxFilter, bMapDefaultBuff ); - - switch (tiled) - { - case D3D11_TILED_RESOURCES_NOT_SUPPORTED: tiled_rsc = "Optional (No)"; break; - case D3D11_TILED_RESOURCES_TIER_1: tiled_rsc = "Optional (Yes - Tier 1)"; break; - case D3D11_TILED_RESOURCES_TIER_2: tiled_rsc = "Optional (Yes - Tier 2)"; break; - default: tiled_rsc = "Optional (Yes)"; break; - } - - minmaxfilter = c_szNo; - mapdefaultbuff = bMapDefaultBuff ? "Optional (Yes)" : "Optional (No)"; - } - - if (pD3D11_1 || pD3D11_2 || pD3D11_3) - { - ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : ( (pD3D11_2) ? pD3D11_2 : pD3D11_1 ); - - bool bLogicOps, bCBpartial, bCBoffsetting; - CheckD3D11Ops( pD3D, bLogicOps, bCBpartial, bCBoffsetting ); - logic_ops = bLogicOps ? "Optional (Yes)" : "Optional (No)"; - cb_partial = bCBpartial ? "Optional (Yes)" : "Optional (No)"; - cb_offsetting = bCBoffsetting ? "Optional (Yes)" : "Optional (No)"; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D, ext, x2, bpp565 ); - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - - uavSlots = "8"; - uavEveryStage = c_szNo; - uavOnlyRender = "8"; - nonpow2 = "Full"; - } - break; - - case D3D_FEATURE_LEVEL_10_1: - shaderModel = "4.x"; - instancing = c_szYes; - - if (pD3D11_3) - { - consrv_rast = rast_ordered_views = ps_stencil_ref = c_szNo; - } - - if (pD3D11_2 || pD3D11_3) - { - tiled_rsc = minmaxfilter = mapdefaultbuff = c_szNo; - } - - if (pD3D11_1 || pD3D11_2 || pD3D11_3) - { - ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : ( (pD3D11_2) ? pD3D11_2 : pD3D11_1 ); - - D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {0}; - HRESULT hr = pD3D->CheckFeatureSupport( D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw) ); - if ( FAILED(hr) ) - memset( &d3d10xhw, 0, sizeof(d3d10xhw) ); - - if (d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) - { - computeShader = "Optional (Yes - CS 4.x)"; - uavSlots = "1"; - uavEveryStage = c_szNo; - uavOnlyRender = c_szNo; - } - else - { - computeShader = "Optional (No)"; - } - - bool bLogicOps, bCBpartial, bCBoffsetting; - CheckD3D11Ops( pD3D, bLogicOps, bCBpartial, bCBoffsetting ); - logic_ops = bLogicOps ? "Optional (Yes)" : "Optional (No)"; - cb_partial = bCBpartial ? "Optional (Yes)" : "Optional (No)"; - cb_offsetting = bCBoffsetting ? "Optional (Yes)" : "Optional (No)"; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D, ext, x2, bpp565 ); - - extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; - x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; - nonpow2 = "Full"; - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - } - else if (pD3D11 != nullptr) - { - D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {0}; - HRESULT hr = pD3D11->CheckFeatureSupport( D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw) ); - if ( FAILED(hr) ) - memset( &d3d10xhw, 0, sizeof(d3d10xhw) ); - - computeShader = (d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) ? "Optional (Yes - CS 4.x)": "Optional (No)"; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D11, ext, x2, bpp565 ); - - extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; - x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; - } - else if ( pD3D10_1 != nullptr ) - { - BOOL ext, x2; - CheckExtendedFormats( pD3D10_1, ext, x2 ); - - extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; - x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; - } - else if ( pD3D10 != nullptr ) - { - BOOL ext, x2; - CheckExtendedFormats( pD3D10, ext, x2 ); - - extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; - x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; - } - - maxTexDim = XTOSTRING( D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING( D3D10_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING( D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING( D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ); - maxAnisotropy = XTOSTRING( D3D10_REQ_MAXANISOTROPY ); - maxInputSlots = XTOSTRING( D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING( D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ); - break; - - case D3D_FEATURE_LEVEL_10_0: - shaderModel = "4.0"; - instancing = c_szYes; - - if (pD3D11_3) - { - consrv_rast = rast_ordered_views = ps_stencil_ref = c_szNo; - } - - if (pD3D11_2 || pD3D11_3) - { - tiled_rsc = minmaxfilter = mapdefaultbuff = c_szNo; - } - - if (pD3D11_1 || pD3D11_2 || pD3D11_3) - { - ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : ( (pD3D11_2) ? pD3D11_2 : pD3D11_1 ); - - D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {0}; - HRESULT hr = pD3D->CheckFeatureSupport( D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw) ); - if ( FAILED(hr) ) - memset( &d3d10xhw, 0, sizeof(d3d10xhw) ); - - if (d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) - { - computeShader = "Optional (Yes - CS 4.x)"; - uavSlots = "1"; - uavEveryStage = c_szNo; - uavOnlyRender = c_szNo; - } - else - { - computeShader = "Optional (No)"; - } - - bool bLogicOps, bCBpartial, bCBoffsetting; - CheckD3D11Ops( pD3D, bLogicOps, bCBpartial, bCBoffsetting ); - logic_ops = bLogicOps ? "Optional (Yes)" : "Optional (No)"; - cb_partial = bCBpartial ? "Optional (Yes)" : "Optional (No)"; - cb_offsetting = bCBoffsetting ? "Optional (Yes)" : "Optional (No)"; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D, ext, x2, bpp565 ); - - extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; - x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; - nonpow2 = "Full"; - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - } - else if (pD3D11 != nullptr) - { - D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {0}; - HRESULT hr = pD3D11->CheckFeatureSupport( D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw) ); - if ( FAILED(hr) ) - memset( &d3d10xhw, 0, sizeof(d3d10xhw) ); - - computeShader = (d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) ? "Optional (Yes - CS 4.0)": "Optional (No)"; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D11, ext, x2, bpp565 ); - - extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; - x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; - } - else if ( pD3D10_1 != nullptr ) - { - BOOL ext, x2; - CheckExtendedFormats( pD3D10_1, ext, x2 ); - - extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; - x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; - } - else if ( pD3D10 != nullptr ) - { - BOOL ext, x2; - CheckExtendedFormats( pD3D10, ext, x2 ); - - extFormats = (ext) ? "Optional (Yes)" : "Optional (No)"; - x2_10BitFormat = (x2) ? "Optional (Yes)" : "Optional (No)"; - } - - maxTexDim = XTOSTRING( D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING( D3D10_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING( D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING( D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ); - maxAnisotropy = XTOSTRING( D3D10_REQ_MAXANISOTROPY ); - maxInputSlots = XTOSTRING( D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING( D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ); - break; - - case D3D_FEATURE_LEVEL_9_3: - _10level9 = TRUE; - shaderModel = "2.0 (4_0_level_9_3) [vs_2_a/ps_2_b]"; - computeShader = c_szNA; - maxTexDim = XTOSTRING2( D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING2( D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING2( D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING2( D3D_FL9_3_MAX_TEXTURE_REPEAT ); - maxAnisotropy = XTOSTRING( D3D11_REQ_MAXANISOTROPY ); - maxPrimCount = XTOSTRING2( D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT ); - maxInputSlots = XTOSTRING( D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING2( D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT ); - extFormats = c_szYes; - instancing = c_szYes; - - if (pD3D11_2 || pD3D11_3) - { - ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : pD3D11_2; - - cb_partial = c_szYes; - cb_offsetting = c_szYes; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D, ext, x2, bpp565 ); - - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - - bool bNonPow2, bShadows, bInstancing, bCubeRT; - CheckD3D9Ops1( pD3D, bNonPow2, bShadows, bInstancing, bCubeRT ); - nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; - shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; - cubeRT = bCubeRT ? "Optional (Yes)" : "Optional (No)"; - } - else if (pD3D11_1) - { - cb_partial = c_szYes; - cb_offsetting = c_szYes; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D11_1, ext, x2, bpp565 ); - - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - - bool bNonPow2, bShadows; - CheckD3D9Ops( pD3D11_1, bNonPow2, bShadows ); - nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; - shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; - } - break; - - case D3D_FEATURE_LEVEL_9_2: - _10level9 = TRUE; - shaderModel = "2.0 (4_0_level_9_1)"; - computeShader = c_szNA; - maxTexDim = XTOSTRING2( D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING2( D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING2( D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING2( D3D_FL9_2_MAX_TEXTURE_REPEAT ); - maxAnisotropy = XTOSTRING( D3D11_REQ_MAXANISOTROPY ); - maxPrimCount = XTOSTRING2( D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT ); - maxInputSlots = XTOSTRING( D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING2( D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT ); - extFormats = c_szYes; - instancing = c_szNo; - - if (pD3D11_2 || pD3D11_3) - { - ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : pD3D11_2; - - cb_partial = c_szYes; - cb_offsetting = c_szYes; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D, ext, x2, bpp565 ); - - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - - bool bNonPow2, bShadows, bInstancing, bCubeRT; - CheckD3D9Ops1( pD3D, bNonPow2, bShadows, bInstancing, bCubeRT ); - nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; - shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; - instancing = bInstancing ? "Optional (Simple)" : "Optional (No)"; - cubeRT = bCubeRT ? "Optional (Yes)" : "Optional (No)"; - } - else if (pD3D11_1) - { - cb_partial = c_szYes; - cb_offsetting = c_szYes; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D11_1, ext, x2, bpp565 ); - - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - - bool bNonPow2, bShadows; - CheckD3D9Ops( pD3D11_1, bNonPow2, bShadows ); - nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; - shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; - } - break; - - case D3D_FEATURE_LEVEL_9_1: - _10level9 = TRUE; - shaderModel = "2.0 (4_0_level_9_1)"; - computeShader = c_szNA; - maxTexDim = XTOSTRING2( D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION ); - maxCubeDim = XTOSTRING2( D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION ); - maxVolDim = XTOSTRING2( D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ); - maxTexRepeat = XTOSTRING2( D3D_FL9_1_MAX_TEXTURE_REPEAT ); - maxAnisotropy = XTOSTRING2( D3D_FL9_1_DEFAULT_MAX_ANISOTROPY ); - maxPrimCount = XTOSTRING2( D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT ); - maxInputSlots = XTOSTRING( D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ); - mrt = XTOSTRING2( D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT ); - extFormats = c_szYes; - instancing = c_szNo; - - if (pD3D11_2 || pD3D11_3) - { - ID3D11Device* pD3D = (pD3D11_3) ? pD3D11_3 : pD3D11_2; - - cb_partial = c_szYes; - cb_offsetting = c_szYes; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D, ext, x2, bpp565 ); - - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - - bool bNonPow2, bShadows, bInstancing, bCubeRT; - CheckD3D9Ops1( pD3D, bNonPow2, bShadows, bInstancing, bCubeRT ); - nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; - shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; - instancing = bInstancing ? "Optional (Simple)" : "Optional (No)"; - cubeRT = bCubeRT ? "Optional (Yes)" : "Optional (No)"; - } - else if (pD3D11_1) - { - cb_partial = c_szYes; - cb_offsetting = c_szYes; - - BOOL ext, x2, bpp565; - CheckExtendedFormats( pD3D11_1, ext, x2, bpp565 ); - - bpp16 = (bpp565) ? "Optional (Yes)" : "Optional (No)"; - - bool bNonPow2, bShadows; - CheckD3D9Ops( pD3D11_1, bNonPow2, bShadows ); - nonpow2 = bNonPow2 ? "Optional (Full)" : "Conditional"; - shadows = bShadows ? "Optional (Yes)" : "Optional (No)"; - } - break; - - default: - return E_FAIL; - } - - if ( d3dType == D3D_DRIVER_TYPE_WARP ) - { - maxTexDim = ( pD3D12 || pD3D11_3 || pD3D11_2 || pD3D11_1 ) ? "16777216" : "65536"; - } - - if ( pPrintInfo == nullptr ) - { - LVLINE( "Shader Model", shaderModel ) - LVYESNO( "Geometry Shader", (fl >= D3D_FEATURE_LEVEL_10_0) ) - LVYESNO( "Stream Out", (fl >= D3D_FEATURE_LEVEL_10_0) ) - - if ( pD3D12 || pD3D11_3 || pD3D11_2 || pD3D11_1 || pD3D11 ) - { - if ( g_dwViewState == IDM_VIEWALL || computeShader != c_szNo ) - { - LVLINE( "DirectCompute", computeShader ) - } - - LVYESNO( "Hull & Domain Shaders", (fl >= D3D_FEATURE_LEVEL_11_0) ) - } - - LVYESNO( "Texture Resource Arrays", (fl >= D3D_FEATURE_LEVEL_10_0) ) - - if ( d3dVer != 0 ) - { - LVYESNO( "Cubemap Resource Arrays", (fl >= D3D_FEATURE_LEVEL_10_1) ) - } - - LVYESNO( "BC4/BC5 Compression", (fl >= D3D_FEATURE_LEVEL_10_0) ) - - if ( pD3D12 || pD3D11_3 || pD3D11_2 || pD3D11_1 || pD3D11 ) - { - LVYESNO( "BC6H/BC7 Compression", (fl >= D3D_FEATURE_LEVEL_11_0) ) - } - - LVYESNO( "Alpha-to-coverage", (fl >= D3D_FEATURE_LEVEL_10_0) ) - - if ( pD3D11_1 || pD3D11_2 || pD3D11_3 || pD3D12 ) - { - LVLINE( "Logic Ops (Output Merger)", logic_ops ); - } - - if ( pD3D11_1 || pD3D11_2 || pD3D11_3 ) - { - LVLINE( "Constant Buffer Partial Updates", cb_partial ); - LVLINE( "Constant Buffer Offsetting", cb_offsetting ); - - if (uavEveryStage) - { - LVLINE( "UAVs at Every Stage", uavEveryStage ) - } - - if (uavOnlyRender) - { - LVLINE( "UAV-only rendering", uavOnlyRender ); - } - } - - if ( pD3D11_2 || pD3D11_3 || pD3D12 ) - { - if (tiled_rsc) - { - LVLINE( "Tiled Resources", tiled_rsc ); - } - } - - if ( pD3D11_2 || pD3D11_3 ) - { - if (minmaxfilter) - { - LVLINE( "Min/Max Filtering", minmaxfilter ); - } - - if (mapdefaultbuff) - { - LVLINE( "Map DEFAULT Buffers", mapdefaultbuff ); - } - } - - if ( pD3D11_3 || pD3D12 ) - { - if (consrv_rast) - { - LVLINE( "Conservative Rasterization", consrv_rast ); - } - - if (ps_stencil_ref) - { - LVLINE( "PS-Specified Stencil Ref", ps_stencil_ref ); - } - - if (rast_ordered_views) - { - LVLINE( "Rasterizer Ordered Views", rast_ordered_views ); - } - } - - if ( pD3D12 ) - { - if (binding_rsc) - { - LVLINE( "Resource Binding", binding_rsc ); - } - } - - if ( g_DXGIFactory1 && !pD3D12 ) - { - LVLINE( "Extended Formats (BGRA, etc.)", extFormats ) - - if ( x2_10BitFormat && (g_dwViewState == IDM_VIEWALL || x2_10BitFormat != c_szNo)) - { - LVLINE( "10-bit XR High Color Format", x2_10BitFormat ) - } - } - - if ( pD3D11_1 || pD3D11_2 || pD3D11_3 ) - { - LVLINE( "16-bit Formats (565/5551/4444)", bpp16 ); - } - - if ( nonpow2 && !pD3D12 ) - { - LVLINE( "Non-Power-of-2 Textures", nonpow2 ); - } - - LVLINE( "Max Texture Dimension", maxTexDim ) - LVLINE( "Max Cubemap Dimension", maxCubeDim ) - - if ( maxVolDim ) - { - LVLINE( "Max Volume Extent", maxVolDim ) - } - - if ( maxTexRepeat ) - { - LVLINE( "Max Texture Repeat", maxTexRepeat ) - } - - LVLINE( "Max Input Slots", maxInputSlots ) - - if ( uavSlots ) - { - LVLINE( "UAV Slots", uavSlots ) - } - - if (maxAnisotropy) - { - LVLINE( "Max Anisotropy", maxAnisotropy ) - } - - LVLINE( "Max Primitive Count", maxPrimCount ) - - if (mrt) - { - LVLINE( "Simultaneous Render Targets", mrt ) - } - - if ( _10level9 ) - { - LVYESNO( "Occlusion Queries", (fl >= D3D_FEATURE_LEVEL_9_2) ) - LVYESNO( "Separate Alpha Blend", (fl >= D3D_FEATURE_LEVEL_9_2) ) - LVYESNO( "Mirror Once", (fl >= D3D_FEATURE_LEVEL_9_2) ) - LVYESNO( "Overlapping Vertex Elements", (fl >= D3D_FEATURE_LEVEL_9_2) ) - LVYESNO( "Independant Write Masks", (fl >= D3D_FEATURE_LEVEL_9_3) ) - - LVLINE( "Instancing", instancing ) - - if ( pD3D11_1 || pD3D11_2 || pD3D11_3 ) - { - LVLINE( "Shadow Support", shadows ) - } - - if ( pD3D11_2 || pD3D11_3 ) - { - LVLINE( "Cubemap Render w/ non-Cube Depth", cubeRT ); - } - } - - LVLINE( "Note", FL_NOTE ) - } - else - { - PRINTLINE( "Shader Model", shaderModel ) - PRINTYESNO( "Geometry Shader", (fl >= D3D_FEATURE_LEVEL_10_0) ) - PRINTYESNO( "Stream Out", (fl >= D3D_FEATURE_LEVEL_10_0) ) - - if ( pD3D12 || pD3D11_3 || pD3D11_2 || pD3D11_1 || pD3D11 ) - { - PRINTLINE( "DirectCompute", computeShader ) - PRINTYESNO( "Hull & Domain Shaders", (fl >= D3D_FEATURE_LEVEL_11_0) ) - } - - PRINTYESNO( "Texture Resource Arrays", (fl >= D3D_FEATURE_LEVEL_10_0) ) - - if ( d3dVer != 0 ) - { - PRINTYESNO( "Cubemap Resource Arrays", (fl >= D3D_FEATURE_LEVEL_10_1) ) - } - - PRINTYESNO( "BC4/BC5 Compression", (fl >= D3D_FEATURE_LEVEL_10_0) ) - - if ( pD3D11_3 || pD3D11_2 || pD3D11_1 || pD3D11 ) - { - PRINTYESNO( "BC6H/BC7 Compression", (fl >= D3D_FEATURE_LEVEL_11_0) ) - } - - PRINTYESNO( "Alpha-to-coverage", (fl >= D3D_FEATURE_LEVEL_10_0) ) - - if ( pD3D11_1 || pD3D11_2 || pD3D11_3 || pD3D12 ) - { - PRINTLINE( "Logic Ops (Output Merger)", logic_ops ); - } - - if ( pD3D11_1 || pD3D11_2 || pD3D11_3 ) - { - PRINTLINE( "Constant Buffer Partial Updates", cb_partial ); - PRINTLINE( "Constant Buffer Offsetting", cb_offsetting ); - - if (uavEveryStage) - { - PRINTLINE( "UAVs at Every Stage", uavEveryStage ) - } - - if (uavOnlyRender) - { - PRINTLINE( "UAV-only rendering", uavOnlyRender ); - } - } - - if ( pD3D11_2 || pD3D11_3 || pD3D12 ) - { - if (tiled_rsc) - { - PRINTLINE( "Tiled Resources", tiled_rsc ); - } - } - - if ( pD3D11_2 || pD3D11_3 ) - { - if (minmaxfilter) - { - PRINTLINE( "Min/Max Filtering", minmaxfilter ); - } - - if (mapdefaultbuff) - { - PRINTLINE( "Map DEFAULT Buffers", mapdefaultbuff ); - } - } - - if ( pD3D11_3 || pD3D12 ) - { - if (consrv_rast) - { - PRINTLINE( "Conservative Rasterization", consrv_rast ); - } - - if (ps_stencil_ref) - { - PRINTLINE( "PS-Specified Stencil Ref ", ps_stencil_ref ); - } - - if (rast_ordered_views) - { - PRINTLINE( "Rasterizer Ordered Views", rast_ordered_views ); - } - } - - if ( pD3D12 ) - { - if (binding_rsc) - { - PRINTLINE( "Resource Binding", binding_rsc ); - } - } - - if ( g_DXGIFactory1 && !pD3D12 ) - { - PRINTLINE( "Extended Formats (BGRA, etc.)", extFormats ) - - if (x2_10BitFormat) - { - PRINTLINE( "10-bit XR High Color Format", x2_10BitFormat ) - } - } - - if ( pD3D11_1 || pD3D11_2 || pD3D11_3 ) - { - PRINTLINE( "16-bit Formats (565/5551/4444)", bpp16 ); - } - - if ( nonpow2 ) - { - PRINTLINE( "Non-Power-of-2 Textures", nonpow2 ); - } - - PRINTLINE( "Max Texture Dimension", maxTexDim ) - PRINTLINE( "Max Cubemap Dimension", maxCubeDim ) - - if ( maxVolDim ) - { - PRINTLINE( "Max Volume Extent", maxVolDim ) - } - - if ( maxTexRepeat ) - { - PRINTLINE( "Max Texture Repeat", maxTexRepeat ) - } - - PRINTLINE( "Max Input Slots", maxInputSlots ) - - if ( uavSlots ) - { - PRINTLINE( "UAV Slots", uavSlots ) - } - - if (maxAnisotropy) - { - PRINTLINE( "Max Anisotropy", maxAnisotropy ) - } - - PRINTLINE( "Max Primitive Count", maxPrimCount ) - - if (mrt) - { - PRINTLINE( "Simultaneous Render Targets", mrt ) - } - - if ( _10level9 ) - { - PRINTYESNO( "Occlusion Queries", (fl >= D3D_FEATURE_LEVEL_9_2) ) - PRINTYESNO( "Separate Alpha Blend", (fl >= D3D_FEATURE_LEVEL_9_2) ) - PRINTYESNO( "Mirror Once", (fl >= D3D_FEATURE_LEVEL_9_2) ) - PRINTYESNO( "Overlapping Vertex Elements", (fl >= D3D_FEATURE_LEVEL_9_2) ) - PRINTYESNO( "Independant Write Masks", (fl >= D3D_FEATURE_LEVEL_9_3) ) - - PRINTLINE( "Instancing", instancing ) - - if ( pD3D11_1 || pD3D11_2 || pD3D11_3 ) - { - PRINTLINE( "Shadow Support", shadows ) - } - - if ( pD3D11_2 || pD3D11_3 ) - { - PRINTLINE( "Cubemap Render w/ non-Cube Depth", cubeRT ); - } - } - - PRINTLINE( "Note", FL_NOTE ) - } - - return S_OK; -} - -//----------------------------------------------------------------------------- -static HRESULT D3D10Info( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - auto pDevice = reinterpret_cast(lParam1); - - if ( pDevice == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - - if ( lParam2 == D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET ) - { - LVAddColumn(g_hwndLV, 1, "Value", 25); - LVAddColumn(g_hwndLV, 2, "Quality Level", 25); - } - else - { - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - } - - if ( !lParam2 ) - { - // General Direct3D 10.0 device information - - BOOL ext, x2; - CheckExtendedFormats( pDevice, ext, x2 ); - - if ( pPrintInfo == nullptr) - { - if ( g_DXGIFactory1 != nullptr ) - { - LVYESNO( "Extended Formats (BGRA, etc.)", ext ) - LVYESNO( "10-bit XR High Color Format", x2 ) - } - - LVLINE( "Note", D3D10_NOTE ) - } - else - { - if ( g_DXGIFactory1 != nullptr ) - { - PRINTYESNO( "Extended Formats (BGRA, etc.)", ext ) - PRINTYESNO( "10-bit XR High Color Format", x2 ) - } - - PRINTLINE( "Note", D3D10_NOTE ) - } - - return S_OK; - } - - // Use CheckFormatSupport for format usage defined as optional for Direct3D 10 devices - static const DXGI_FORMAT cfsShaderSample[] = - { - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32_FLOAT, - DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, - DXGI_FORMAT_R32_FLOAT, - DXGI_FORMAT_R24_UNORM_X8_TYPELESS - }; - - static const DXGI_FORMAT cfsMipAutoGen[] = - { - DXGI_FORMAT_R32G32B32_FLOAT - }; - - static const DXGI_FORMAT cfsRenderTarget[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32B32_UINT, - DXGI_FORMAT_R32G32B32_SINT - }; - - static const DXGI_FORMAT cfsBlendableRT[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R16G16B16A16_UNORM, - DXGI_FORMAT_R16G16_UNORM, - DXGI_FORMAT_R16_UNORM - }; - - UINT count = 0; - const DXGI_FORMAT *array = nullptr; - BOOL skips = FALSE; - - switch( lParam2 ) - { - case D3D10_FORMAT_SUPPORT_SHADER_SAMPLE: - count = sizeof(cfsShaderSample) / sizeof(DXGI_FORMAT); - array = cfsShaderSample; - break; - - case D3D10_FORMAT_SUPPORT_MIP_AUTOGEN: - count = sizeof(cfsMipAutoGen) / sizeof(DXGI_FORMAT); - array = cfsMipAutoGen; - break; - - case D3D10_FORMAT_SUPPORT_RENDER_TARGET: - count = sizeof(cfsRenderTarget) / sizeof(DXGI_FORMAT); - array = cfsRenderTarget; - break; - - case D3D10_FORMAT_SUPPORT_BLENDABLE: - count = sizeof(cfsBlendableRT) / sizeof(DXGI_FORMAT); - array = cfsBlendableRT; - break; - - case D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET: - count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); - array = g_cfsMSAA_10; - break; - - case D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD: - count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); - array = g_cfsMSAA_10; - skips = TRUE; - break; - - default: - return E_FAIL; - } - - for(UINT i = 0; i < count; ++i) - { - DXGI_FORMAT fmt = array[i]; - - if (skips) - { - // Special logic to let us reuse the MSAA array twice with a few special cases that are skipped - switch( fmt ) - { - case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: - case DXGI_FORMAT_D32_FLOAT: - case DXGI_FORMAT_D24_UNORM_S8_UINT: - case DXGI_FORMAT_D16_UNORM: - continue; - } - } - - if ( lParam2 == D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET ) - { - UINT quality; - HRESULT hr = pDevice->CheckMultisampleQualityLevels( fmt, (UINT)lParam3, &quality ); - - BOOL msaa = ( SUCCEEDED(hr) && quality > 0 ) != 0; - - if ( pPrintInfo == nullptr ) - { - if ( g_dwViewState == IDM_VIEWALL || msaa ) - { - LVAddText( g_hwndLV, 0, FormatName(fmt) ); - LVAddText( g_hwndLV, 1, msaa ? c_szYes : c_szNo ); \ - - TCHAR strBuffer[ 16 ]; - sprintf_s(strBuffer, 16, "%d", msaa ? quality : 0 ); - LVAddText( g_hwndLV, 2, strBuffer ); - } - } - else - { - TCHAR strBuffer[ 32 ]; - if ( msaa ) - sprintf_s(strBuffer, 32, "Yes (%d)", quality ); - else - strcpy_s( strBuffer, 32, c_szNo ); - - PrintStringValueLine( FormatName(fmt), strBuffer, pPrintInfo ); - } - } - else - { - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport( fmt, &fmtSupport ); - if ( FAILED(hr) ) - fmtSupport = 0; - - if ( pPrintInfo == nullptr) - { - LVYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - else - { - PRINTYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - } - } - - return S_OK; -} - -static HRESULT D3D10Info1( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - auto pDevice = reinterpret_cast(lParam1); - - if ( pDevice == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - - if ( lParam2 == D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET ) - { - LVAddColumn(g_hwndLV, 1, "Value", 25); - LVAddColumn(g_hwndLV, 2, "Quality Level", 25); - } - else - { - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - } - - if ( !lParam2 ) - { - // General Direct3D 10.1 device information - D3D10_FEATURE_LEVEL1 fl = pDevice->GetFeatureLevel(); - - const char *szNote = nullptr; - - switch ( fl ) - { - case D3D10_FEATURE_LEVEL_10_0: - szNote = SEE_D3D10; - break; - - case D3D10_FEATURE_LEVEL_9_3: - case D3D10_FEATURE_LEVEL_9_2: - case D3D10_FEATURE_LEVEL_9_1: - szNote = _10L9_NOTE; - break; - - default: - szNote = D3D10_NOTE1; - break; - } - - BOOL ext, x2; - CheckExtendedFormats( pDevice, ext, x2 ); - - if ( pPrintInfo == nullptr) - { - LVLINE( "Feature Level", FLName(fl) ) - - if ( g_DXGIFactory1 != nullptr && (fl >= D3D10_FEATURE_LEVEL_10_0) ) - { - LVYESNO( "Extended Formats (BGRA, etc.)", ext ) - LVYESNO( "10-bit XR High Color Format", x2 ) - } - - LVLINE( "Note", szNote ) - } - else - { - PRINTLINE( "Feature Level", FLName(fl) ) - - if ( g_DXGIFactory1 != nullptr && (fl >= D3D10_FEATURE_LEVEL_10_0) ) - { - PRINTYESNO( "Extended Formats (BGRA, etc.)", ext ) - PRINTYESNO( "10-bit XR High Color Format", x2 ) - } - - PRINTLINE( "Note", szNote ) - } - - return S_OK; - } - - // Use CheckFormatSupport for format usage defined as optional for Direct3D 10.1 devices - static const DXGI_FORMAT cfsShaderSample[] = - { - DXGI_FORMAT_R32G32B32_FLOAT - }; - - static const DXGI_FORMAT cfsMipAutoGen[] = - { - DXGI_FORMAT_R32G32B32_FLOAT - }; - - static const DXGI_FORMAT cfsRenderTarget[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32B32_UINT, - DXGI_FORMAT_R32G32B32_SINT - }; - - // Most RT formats are required to support 4x MSAA for 10.1 devices - static const DXGI_FORMAT cfsMSAA4x[] = - { - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R32G32B32A32_UINT, - DXGI_FORMAT_R32G32B32A32_SINT, - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32B32_UINT, - DXGI_FORMAT_R32G32B32_SINT, - }; - - UINT count = 0; - const DXGI_FORMAT *array = nullptr; - - switch( lParam2 ) - { - case D3D10_FORMAT_SUPPORT_SHADER_SAMPLE: - count = sizeof(cfsShaderSample) / sizeof(DXGI_FORMAT); - array = cfsShaderSample; - break; - - case D3D10_FORMAT_SUPPORT_MIP_AUTOGEN: - count = sizeof(cfsMipAutoGen) / sizeof(DXGI_FORMAT); - array = cfsMipAutoGen; - break; - - case D3D10_FORMAT_SUPPORT_RENDER_TARGET: - count = sizeof(cfsRenderTarget) / sizeof(DXGI_FORMAT); - array = cfsRenderTarget; - break; - - case D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET: - if ( pDevice->GetFeatureLevel() <= D3D10_FEATURE_LEVEL_9_3 ) - { - count = sizeof(g_cfsMSAA_10level9) / sizeof(DXGI_FORMAT); - array = g_cfsMSAA_10level9; - } - else if ( g_dwViewState != IDM_VIEWALL && lParam3 == 4 ) - { - count = sizeof(cfsMSAA4x) / sizeof(DXGI_FORMAT); - array = cfsMSAA4x; - } - else - { - count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); - array = g_cfsMSAA_10; - } - break; - - default: - return E_FAIL; - } - - for(UINT i = 0; i < count; ++i) - { - DXGI_FORMAT fmt = array[i]; - - if ( lParam2 == D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET ) - { - UINT quality; - HRESULT hr = pDevice->CheckMultisampleQualityLevels( fmt, (UINT)lParam3, &quality ); - - BOOL msaa = ( SUCCEEDED(hr) && quality > 0 ) != 0; - - if ( pPrintInfo == nullptr ) - { - if ( g_dwViewState == IDM_VIEWALL || msaa ) - { - LVAddText( g_hwndLV, 0, FormatName(fmt) ); - LVAddText( g_hwndLV, 1, msaa ? c_szYes : c_szNo ); \ - - TCHAR strBuffer[ 16 ]; - sprintf_s(strBuffer, 16, "%d", msaa ? quality : 0 ); - LVAddText( g_hwndLV, 2, strBuffer ); - } - } - else - { - TCHAR strBuffer[ 32 ]; - if ( msaa ) - sprintf_s(strBuffer, 32, "Yes (%d)", quality ); - else - strcpy_s( strBuffer, 32, c_szNo ); - - PrintStringValueLine( FormatName(fmt), strBuffer, pPrintInfo ); - } - } - else - { - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport( fmt, &fmtSupport ); - if ( FAILED(hr) ) - fmtSupport = 0; - - if ( pPrintInfo == nullptr) - { - LVYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - else - { - PRINTYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - } - } - - return S_OK; -} - -static HRESULT D3D10InfoMSAA( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ) -{ - auto pDevice = reinterpret_cast(lParam1); - auto sampCount = reinterpret_cast(lParam2); - - if ( pDevice == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - - UINT column = 1; - for( UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples ) - { - if (!sampCount[ samples - 1 ] && !IsMSAAPowerOf2(samples)) - continue; - - TCHAR strBuffer[ 8 ]; - sprintf_s( strBuffer, 8, "%dx", samples ); - LVAddColumn( g_hwndLV, column, strBuffer, 8 ); - ++column; - } - } - - const UINT count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); - - for(UINT i = 0; i < count; ++i) - { - DXGI_FORMAT fmt = g_cfsMSAA_10[i]; - - UINT sampQ[ D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT ]; - memset( sampQ, 0, sizeof(sampQ) ); - - BOOL any = FALSE; - for( UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples ) - { - UINT quality; - HRESULT hr = pDevice->CheckMultisampleQualityLevels( fmt, samples, &quality ); - - if ( SUCCEEDED(hr) && quality > 0 ) - { - sampQ[ samples-1 ] = quality; - any = TRUE; - } - } - - if ( pPrintInfo == nullptr) - { - if ( g_dwViewState != IDM_VIEWALL && !any ) - continue; - - LVAddText( g_hwndLV, 0, FormatName(fmt) ); - - UINT column = 1; - for( UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples ) - { - if (!sampCount[ samples - 1 ] && !IsMSAAPowerOf2(samples)) - continue; - - if ( sampQ[ samples-1 ] > 0 ) - { - TCHAR strBuffer[ 32 ]; - sprintf_s(strBuffer, 32, "Yes (%d)", sampQ[ samples-1 ] ); - LVAddText( g_hwndLV, column, strBuffer ); - } - else - LVAddText( g_hwndLV, column, c_szNo ); - - ++column; - } - } - else - { - TCHAR buff[ 1024 ]; - *buff = 0; - - for( UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples ) - { - if (!sampCount[ samples - 1 ] && !IsMSAAPowerOf2(samples)) - continue; - - TCHAR strBuffer[ 32 ]; - if ( sampQ[ samples-1 ] > 0 ) - sprintf_s(strBuffer, 32, "%dx: Yes (%d) ", samples, sampQ[ samples-1 ] ); - else - sprintf_s(strBuffer, 32, "%dx: No ", samples ); - - strcat_s( buff, 1024, strBuffer ); - } - - PrintStringValueLine( FormatName(fmt), buff, pPrintInfo ); - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -static HRESULT D3D11Info( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - auto pDevice = reinterpret_cast(lParam1); - - if ( pDevice == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - - if ( lParam2 == D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET ) - { - LVAddColumn(g_hwndLV, 1, "Value", 25); - LVAddColumn(g_hwndLV, 2, "Quality Level", 25); - } - else - { - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - } - - if ( !lParam2 ) - { - // General Direct3D 11 device information - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - if ( fl > D3D_FEATURE_LEVEL_11_0 ) - fl = D3D_FEATURE_LEVEL_11_0; - - // CheckFeatureSupport - D3D11_FEATURE_DATA_THREADING threading = {0}; - HRESULT hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_THREADING, &threading, sizeof(threading) ); - if ( FAILED(hr) ) - memset( &threading, 0, sizeof(threading) ); - - D3D11_FEATURE_DATA_DOUBLES doubles = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_DOUBLES, &doubles, sizeof(doubles) ); - if ( FAILED(hr) ) - memset( &doubles, 0, sizeof(doubles) ); - - D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw) ); - if ( FAILED(hr) ) - memset( &d3d10xhw, 0, sizeof(d3d10xhw) ); - - // Setup note - const char *szNote = nullptr; - - switch ( fl ) - { - case D3D_FEATURE_LEVEL_10_0: - szNote = SEE_D3D10; - break; - - case D3D_FEATURE_LEVEL_10_1: - case D3D_FEATURE_LEVEL_9_3: - case D3D_FEATURE_LEVEL_9_2: - case D3D_FEATURE_LEVEL_9_1: - szNote = SEE_D3D10_1; - break; - - default: - szNote = D3D11_NOTE; - break; - } - - if ( pPrintInfo == nullptr) - { - LVLINE( "Feature Level", FLName(fl) ) - - LVYESNO( "Driver Concurrent Creates", threading.DriverConcurrentCreates ) - LVYESNO( "Driver Command Lists", threading.DriverCommandLists ) - LVYESNO( "Double-precision Shaders", doubles.DoublePrecisionFloatShaderOps ) - LVYESNO( "DirectCompute CS 4.x", d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x ) - - LVLINE( "Note", szNote ) - } - else - { - PRINTLINE( "Feature Level", FLName(fl) ) - - PRINTYESNO( "Driver Concurrent Creates", threading.DriverConcurrentCreates ) - PRINTYESNO( "Driver Command Lists", threading.DriverCommandLists ) - PRINTYESNO( "Double-precision Shaders", doubles.DoublePrecisionFloatShaderOps ) - PRINTYESNO( "DirectCompute CS 4.x", d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x ) - - PRINTLINE( "Note", szNote ) - } - - return S_OK; - } - - // Use CheckFormatSupport for format usage defined as optional for Direct3D 11 devices - static const DXGI_FORMAT cfsShaderSample[] = - { - DXGI_FORMAT_R32G32B32_FLOAT - }; - - static const DXGI_FORMAT cfsShaderGather[] = - { - DXGI_FORMAT_R32G32B32_FLOAT - }; - - static const DXGI_FORMAT cfsMipAutoGen[] = - { - DXGI_FORMAT_R32G32B32_FLOAT - }; - - static const DXGI_FORMAT cfsRenderTarget[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32B32_UINT, - DXGI_FORMAT_R32G32B32_SINT - }; - - // Most RT formats are required to support 8x MSAA for 11 devices - static const DXGI_FORMAT cfsMSAA8x[] = - { - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R32G32B32A32_UINT, - DXGI_FORMAT_R32G32B32A32_SINT - }; - - UINT count = 0; - const DXGI_FORMAT *array = nullptr; - - switch( lParam2 ) - { - case D3D11_FORMAT_SUPPORT_SHADER_SAMPLE: - count = sizeof(cfsShaderSample) / sizeof(DXGI_FORMAT); - array = cfsShaderSample; - break; - - case D3D11_FORMAT_SUPPORT_SHADER_GATHER: - count = sizeof(cfsShaderGather) / sizeof(DXGI_FORMAT); - array = cfsShaderGather; - break; - - case D3D11_FORMAT_SUPPORT_MIP_AUTOGEN: - count = sizeof(cfsMipAutoGen) / sizeof(DXGI_FORMAT); - array = cfsMipAutoGen; - break; - - case D3D11_FORMAT_SUPPORT_RENDER_TARGET: - count = sizeof(cfsRenderTarget) / sizeof(DXGI_FORMAT); - array = cfsRenderTarget; - break; - - case D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET: - if ( g_dwViewState != IDM_VIEWALL && lParam3 == 8 ) - { - count = sizeof(cfsMSAA8x) / sizeof(DXGI_FORMAT); - array = cfsMSAA8x; - } - else if ( g_dwViewState != IDM_VIEWALL && lParam3 == 4 ) - { - count = 0; - } - else - { - count = _countof(g_cfsMSAA_11); - array = g_cfsMSAA_11; - } - break; - - default: - return E_FAIL; - } - - for(UINT i = 0; i < count; ++i) - { - DXGI_FORMAT fmt = array[i]; - - if ( lParam2 == D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET ) - { - // Skip 16 bits-per-pixel formats for DX 11.0 - if ( fmt == DXGI_FORMAT_B5G6R5_UNORM || fmt == DXGI_FORMAT_B5G5R5A1_UNORM || fmt == DXGI_FORMAT_B4G4R4A4_UNORM ) - continue; - - UINT quality; - HRESULT hr = pDevice->CheckMultisampleQualityLevels( fmt, (UINT)lParam3, &quality ); - - BOOL msaa = ( SUCCEEDED(hr) && quality > 0 ) != 0; - - if ( pPrintInfo == nullptr ) - { - if ( g_dwViewState == IDM_VIEWALL || msaa ) - { - LVAddText( g_hwndLV, 0, FormatName(fmt) ); - LVAddText( g_hwndLV, 1, msaa ? c_szYes : c_szNo ); \ - - TCHAR strBuffer[ 16 ]; - sprintf_s(strBuffer, 16, "%d", msaa ? quality : 0 ); - LVAddText( g_hwndLV, 2, strBuffer ); - } - } - else - { - TCHAR strBuffer[ 32 ]; - if ( msaa ) - sprintf_s(strBuffer, 32, "Yes (%d)", quality ); - else - strcpy_s( strBuffer, 32, c_szNo ); - - PrintStringValueLine( FormatName(fmt), strBuffer, pPrintInfo ); - } - } - else - { - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport( fmt, &fmtSupport ); - if ( FAILED(hr) ) - fmtSupport = 0; - - if ( pPrintInfo == nullptr) - { - LVYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - else - { - PRINTYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - } - } - - return S_OK; -} - -static void D3D11FeatureSupportInfo1( ID3D11Device1* pDevice, bool bDev2, PRINTCBINFO* pPrintInfo ) -{ - if ( !pDevice ) - return; - - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - - // CheckFeatureSupport - D3D11_FEATURE_DATA_THREADING threading = {0}; - HRESULT hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_THREADING, &threading, sizeof(threading) ); - if ( FAILED(hr) ) - memset( &threading, 0, sizeof(threading) ); - - D3D11_FEATURE_DATA_DOUBLES doubles = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_DOUBLES, &doubles, sizeof(doubles) ); - if ( FAILED(hr) ) - memset( &doubles, 0, sizeof(doubles) ); - - D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS d3d10xhw = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &d3d10xhw, sizeof(d3d10xhw) ); - if ( FAILED(hr) ) - memset( &d3d10xhw, 0, sizeof(d3d10xhw) ); - - D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11opts = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D11_OPTIONS, &d3d11opts, sizeof(d3d11opts) ); - if ( FAILED(hr) ) - memset( &d3d11opts, 0, sizeof(d3d11opts) ); - - D3D11_FEATURE_DATA_D3D9_OPTIONS d3d9opts = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D9_OPTIONS, &d3d9opts, sizeof(d3d9opts) ); - if ( FAILED(hr) ) - memset( &d3d9opts, 0, sizeof(d3d9opts) ); - - D3D11_FEATURE_DATA_ARCHITECTURE_INFO d3d11arch = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_ARCHITECTURE_INFO, &d3d11arch, sizeof(d3d11arch) ); - if ( FAILED(hr) ) - memset( &d3d11arch, 0, sizeof(d3d11arch) ); - - D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT minprecis = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT, &minprecis, sizeof(minprecis) ); - if ( FAILED(hr) ) - memset( &minprecis, 0, sizeof(minprecis) ); - - D3D11_FEATURE_DATA_D3D11_OPTIONS1 d3d11opts1 = {}; - memset( &d3d11opts1, 0, sizeof(d3d11opts1) ); - if ( bDev2 ) - { - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D11_OPTIONS1, &d3d11opts1, sizeof(d3d11opts1) ); - if ( FAILED(hr) ) - memset( &d3d11opts1, 0, sizeof(d3d11opts1) ); - } - - const char* clearview = nullptr; - if ( d3d11opts.ClearView ) - { - clearview = d3d11opts1.ClearViewAlsoSupportsDepthOnlyFormats ? "RTV, UAV, and Depth (Driver sees)" : "RTV and UAV (Driver sees)"; - } - else - { - clearview = d3d11opts1.ClearViewAlsoSupportsDepthOnlyFormats ? "RTV, UAV, and Depth (Driver doesn't see)" : "RTV and UAV (Driver doesn't see)"; - } - - const char* double_shaders = nullptr; - if ( d3d11opts.ExtendedDoublesShaderInstructions ) - { - double_shaders = "Extended"; - } - else if ( doubles.DoublePrecisionFloatShaderOps ) - { - double_shaders = c_szYes; - } - else - { - double_shaders = c_szNo; - } - - const char* ps_precis = nullptr; - switch( minprecis.PixelShaderMinPrecision & (D3D11_SHADER_MIN_PRECISION_16_BIT|D3D11_SHADER_MIN_PRECISION_10_BIT) ) - { - case 0: ps_precis = "Full"; break; - case D3D11_SHADER_MIN_PRECISION_16_BIT: ps_precis = "16/32-bit"; break; - case D3D11_SHADER_MIN_PRECISION_10_BIT: ps_precis = "10/32-bit"; break; - default: ps_precis = "10/16/32-bit"; break; - } - - const char* other_precis = nullptr; - switch( minprecis.AllOtherShaderStagesMinPrecision & (D3D11_SHADER_MIN_PRECISION_16_BIT|D3D11_SHADER_MIN_PRECISION_10_BIT) ) - { - case 0: other_precis = "Full"; break; - case D3D11_SHADER_MIN_PRECISION_16_BIT: other_precis = "16/32-bit"; break; - case D3D11_SHADER_MIN_PRECISION_10_BIT: other_precis = "10/32-bit"; break; - default: other_precis = "10/16/32-bit"; break; - } - - const char* nonpow2 = (d3d9opts.FullNonPow2TextureSupport) ? "Full" : "Conditional"; - - if ( !pPrintInfo ) - { - LVLINE( "Feature Level", FLName(fl) ) - - LVYESNO( "Driver Concurrent Creates", threading.DriverConcurrentCreates ) - LVYESNO( "Driver Command Lists", threading.DriverCommandLists ) - LVLINE( "Double-precision Shaders", double_shaders ) - LVYESNO( "DirectCompute CS 4.x", d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x ) - - LVYESNO( "Driver sees DiscardResource/View", d3d11opts.DiscardAPIsSeenByDriver ) - LVYESNO( "Driver sees COPY_FLAGS", d3d11opts.FlagsForUpdateAndCopySeenByDriver ) - LVLINE( "ClearView", clearview ) - LVYESNO( "Copy w/ Overlapping Rect", d3d11opts.CopyWithOverlap ) - LVYESNO( "CB Partial Update", d3d11opts.ConstantBufferPartialUpdate ) - LVYESNO( "CB Offsetting", d3d11opts.ConstantBufferOffsetting ) - LVYESNO( "Map NO_OVERWRITE on Dynamic CB", d3d11opts.MapNoOverwriteOnDynamicConstantBuffer ) - - if ( fl >= D3D_FEATURE_LEVEL_10_0 ) - { - LVYESNO( "Map NO_OVERWRITE on Dynamic SRV", d3d11opts.MapNoOverwriteOnDynamicBufferSRV ) - LVYESNO( "MSAA with ForcedSampleCount=1", d3d11opts.MultisampleRTVWithForcedSampleCountOne ) - LVYESNO( "Extended resource sharing", d3d11opts.ExtendedResourceSharing ); - } - - if ( fl >= D3D_FEATURE_LEVEL_11_0 ) - { - LVYESNO( "Saturating Add Instruction", d3d11opts.SAD4ShaderInstructions ) - } - - LVYESNO( "Tile-based Deferred Renderer", d3d11arch.TileBasedDeferredRenderer ) - - LVLINE( "Non-Power-of-2 Textures", nonpow2 ); - - LVLINE( "Pixel Shader Precision", ps_precis ); - LVLINE( "Other Stage Precision", other_precis ); - } - else - { - PRINTLINE( "Feature Level", FLName(fl) ) - - PRINTYESNO( "Driver Concurrent Creates", threading.DriverConcurrentCreates ) - PRINTYESNO( "Driver Command Lists", threading.DriverCommandLists ) - PRINTLINE( "Double-precision Shaders", double_shaders ) - PRINTYESNO( "DirectCompute CS 4.x", d3d10xhw.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x ) - - PRINTYESNO( "Driver sees DiscardResource/View", d3d11opts.DiscardAPIsSeenByDriver ) - PRINTYESNO( "Driver sees COPY_FLAGS", d3d11opts.FlagsForUpdateAndCopySeenByDriver ) - PRINTLINE( "ClearView", clearview ) - PRINTYESNO( "Copy w/ Overlapping Rect", d3d11opts.CopyWithOverlap ) - PRINTYESNO( "CB Partial Update", d3d11opts.ConstantBufferPartialUpdate ) - PRINTYESNO( "CB Offsetting", d3d11opts.ConstantBufferOffsetting ) - PRINTYESNO( "Map NO_OVERWRITE on Dynamic CB", d3d11opts.MapNoOverwriteOnDynamicConstantBuffer ) - - if ( fl >= D3D_FEATURE_LEVEL_10_0 ) - { - PRINTYESNO( "Map NO_OVERWRITE on Dynamic SRV", d3d11opts.MapNoOverwriteOnDynamicBufferSRV ) - PRINTYESNO( "MSAA with ForcedSampleCount=1", d3d11opts.MultisampleRTVWithForcedSampleCountOne ) - PRINTYESNO( "Extended resource sharing", d3d11opts.ExtendedResourceSharing ); - } - - if ( fl >= D3D_FEATURE_LEVEL_11_0 ) - { - PRINTYESNO( "Saturating Add Instruction", d3d11opts.SAD4ShaderInstructions ) - } - - PRINTYESNO( "Tile-based Deferred Renderer", d3d11arch.TileBasedDeferredRenderer ) - - PRINTLINE( "Non-Power-of-2 Textures", nonpow2 ); - - PRINTLINE( "Pixel Shader Precision", ps_precis ); - PRINTLINE( "Other Stage Precision", other_precis ); - } -} - -static HRESULT D3D11Info1( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - auto pDevice = reinterpret_cast(lParam1); - - if ( pDevice == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - - if ( lParam2 == D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET ) - { - LVAddColumn(g_hwndLV, 1, "Value", 25); - LVAddColumn(g_hwndLV, 2, "Quality Level", 25); - } - else - { - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - } - - // General Direct3D 11.1 device information - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - - if ( !lParam2 ) - { - D3D11FeatureSupportInfo1( pDevice, false, pPrintInfo ); - - // Setup note - const char *szNote = nullptr; - - switch ( fl ) - { - case D3D_FEATURE_LEVEL_10_0: - szNote = SEE_D3D10; - break; - - case D3D_FEATURE_LEVEL_10_1: - case D3D_FEATURE_LEVEL_9_3: - case D3D_FEATURE_LEVEL_9_2: - case D3D_FEATURE_LEVEL_9_1: - szNote = SEE_D3D10_1; - break; - - case D3D_FEATURE_LEVEL_11_0: - szNote = SEE_D3D11; - break; - - default: - szNote = D3D11_NOTE1; - break; - } - - if ( pPrintInfo == nullptr) - { - LVLINE( "Note", szNote ) - } - else - { - PRINTLINE( "Note", szNote ) - } - - return S_OK; - } - - // Use CheckFormatSupport for format usage defined as optional for Direct3D 11.1 devices - - static const DXGI_FORMAT cfs16bpp[] = - { - DXGI_FORMAT_B5G6R5_UNORM, - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B4G4R4A4_UNORM, - }; - - static const DXGI_FORMAT cfs16bpp2[] = - { - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B4G4R4A4_UNORM, - }; - - static const DXGI_FORMAT cfsShaderSample[] = - { - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32_FLOAT, - DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, - DXGI_FORMAT_R32_FLOAT, - DXGI_FORMAT_R24_UNORM_X8_TYPELESS - }; - - static const DXGI_FORMAT cfsShaderSample10_1[] = - { - DXGI_FORMAT_R32G32B32_FLOAT - }; - - static const DXGI_FORMAT cfsShaderGather[] = - { - DXGI_FORMAT_R32G32B32_FLOAT - }; - - static const DXGI_FORMAT cfsMipAutoGen[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_B5G6R5_UNORM, - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B4G4R4A4_UNORM, - }; - - static const DXGI_FORMAT cfsMipAutoGen11_1[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B4G4R4A4_UNORM, - }; - - static const DXGI_FORMAT cfsRenderTarget[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32B32_UINT, - DXGI_FORMAT_R32G32B32_SINT, - DXGI_FORMAT_B5G6R5_UNORM, - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B4G4R4A4_UNORM, - }; - - static const DXGI_FORMAT cfsRenderTarget11_1[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32B32_UINT, - DXGI_FORMAT_R32G32B32_SINT, - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B4G4R4A4_UNORM, - }; - - static const DXGI_FORMAT cfsBlendableRT[] = - { - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R16G16B16A16_UNORM, - DXGI_FORMAT_R16G16_UNORM, - DXGI_FORMAT_R16_UNORM, - DXGI_FORMAT_B5G6R5_UNORM, - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B4G4R4A4_UNORM, - }; - - static const DXGI_FORMAT cfsLogicOps[] = - { - DXGI_FORMAT_R32G32B32A32_UINT, - DXGI_FORMAT_R32G32B32_UINT, - DXGI_FORMAT_R16G16B16A16_UINT, - DXGI_FORMAT_R32G32_UINT, - DXGI_FORMAT_R10G10B10A2_UINT, - DXGI_FORMAT_R8G8B8A8_UINT, - DXGI_FORMAT_R16G16_UINT, - DXGI_FORMAT_R32_UINT, - DXGI_FORMAT_R8G8_UINT, - DXGI_FORMAT_R16_UINT, - DXGI_FORMAT_R8_UINT, - }; - - // Most RT formats are required to support 8x MSAA for 11.x devices - static const DXGI_FORMAT cfsMSAA8x[] = - { - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R32G32B32A32_UINT, - DXGI_FORMAT_R32G32B32A32_SINT, - DXGI_FORMAT_B5G6R5_UNORM, - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B4G4R4A4_UNORM, - }; - - UINT count = 0; - const DXGI_FORMAT *array = nullptr; - BOOL skips = FALSE; - - switch( lParam2 ) - { - case D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER: - count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); - array = cfs16bpp; - break; - - case D3D11_FORMAT_SUPPORT_SHADER_SAMPLE: - if ( fl >= D3D_FEATURE_LEVEL_10_1 ) - { - count = sizeof(cfsShaderSample10_1) / sizeof(DXGI_FORMAT); - array = cfsShaderSample10_1; - } - else - { - count = sizeof(cfsShaderSample) / sizeof(DXGI_FORMAT); - array = cfsShaderSample; - } - break; - - case D3D11_FORMAT_SUPPORT_SHADER_GATHER: - count = sizeof(cfsShaderGather) / sizeof(DXGI_FORMAT); - array = cfsShaderGather; - break; - - case D3D11_FORMAT_SUPPORT_MIP_AUTOGEN: - if ( fl >= D3D_FEATURE_LEVEL_11_1 ) - { - count = sizeof(cfsMipAutoGen11_1) / sizeof(DXGI_FORMAT); - array = cfsMipAutoGen11_1; - } - else - { - count = sizeof(cfsMipAutoGen) / sizeof(DXGI_FORMAT); - array = cfsMipAutoGen; - } - break; - - case D3D11_FORMAT_SUPPORT_RENDER_TARGET: - if ( fl >= D3D_FEATURE_LEVEL_11_1 ) - { - count = sizeof(cfsRenderTarget11_1) / sizeof(DXGI_FORMAT); - array = cfsRenderTarget11_1; - } - else - { - count = sizeof(cfsRenderTarget) / sizeof(DXGI_FORMAT); - array = cfsRenderTarget; - } - break; - - case D3D11_FORMAT_SUPPORT_BLENDABLE: - if ( fl >= D3D_FEATURE_LEVEL_10_0 ) - { - count = sizeof(cfs16bpp2) / sizeof(DXGI_FORMAT); - array = cfs16bpp2; - } - else - { - count = sizeof(cfsBlendableRT) / sizeof(DXGI_FORMAT); - array = cfsBlendableRT; - } - break; - - case D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET: - if ( g_dwViewState != IDM_VIEWALL && lParam3 == 8 ) - { - count = sizeof(cfsMSAA8x) / sizeof(DXGI_FORMAT); - array = cfsMSAA8x; - } - else if ( g_dwViewState != IDM_VIEWALL && (lParam3 == 2 || lParam3 == 4)) - { - count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); - array = cfs16bpp; - } - else - { - count = sizeof(g_cfsMSAA_11) / sizeof(DXGI_FORMAT); - array = g_cfsMSAA_11; - } - break; - - case D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD: - if ( fl >= D3D_FEATURE_LEVEL_10_1 ) - { - count = sizeof(cfs16bpp2) / sizeof(DXGI_FORMAT); - array = cfs16bpp2; - } - else if ( fl >= D3D_FEATURE_LEVEL_10_0 ) - { - count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); - array = cfs16bpp; - } - else - { - count = sizeof(g_cfsMSAA_11) / sizeof(DXGI_FORMAT); - array = g_cfsMSAA_11; - } - skips = TRUE; - break; - - case D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW: - count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); - array = cfs16bpp; - break; - - case 0xffffffff: // D3D11_FORMAT_SUPPORT2 - switch( lParam3 ) - { - case D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP: - count = sizeof(cfsLogicOps) / sizeof(DXGI_FORMAT); - array = cfsLogicOps; - break; - - case D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE: - count = sizeof(cfs16bpp) / sizeof(DXGI_FORMAT); - array = cfs16bpp; - break; - - default: - return E_FAIL; - } - break; - - default: - return E_FAIL; - } - - for(UINT i = 0; i < count; ++i) - { - DXGI_FORMAT fmt = array[i]; - - if (skips) - { - // Special logic to let us reuse the MSAA array twice with a few special cases that are skipped - switch( fmt ) - { - case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: - case DXGI_FORMAT_D32_FLOAT: - case DXGI_FORMAT_D24_UNORM_S8_UINT: - case DXGI_FORMAT_D16_UNORM: - case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: - case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: - continue; - } - } - - if ( lParam2 == D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET ) - { - if ( g_dwViewState != IDM_VIEWALL && fmt == DXGI_FORMAT_B5G6R5_UNORM ) - continue; - - UINT quality; - HRESULT hr = pDevice->CheckMultisampleQualityLevels( fmt, (UINT)lParam3, &quality ); - - BOOL msaa = ( SUCCEEDED(hr) && quality > 0 ) != 0; - - if ( pPrintInfo == nullptr ) - { - if ( g_dwViewState == IDM_VIEWALL || msaa ) - { - LVAddText( g_hwndLV, 0, FormatName(fmt) ); - LVAddText( g_hwndLV, 1, msaa ? c_szYes : c_szNo ); \ - - TCHAR strBuffer[ 16 ]; - sprintf_s(strBuffer, 16, "%d", msaa ? quality : 0 ); - LVAddText( g_hwndLV, 2, strBuffer ); - } - } - else - { - TCHAR strBuffer[ 32 ]; - if ( msaa ) - sprintf_s(strBuffer, 32, "Yes (%d)", quality ); - else - strcpy_s( strBuffer, 32, c_szNo ); - - PrintStringValueLine( FormatName(fmt), strBuffer, pPrintInfo ); - } - } - else if ( lParam2 != 0xffffffff ) - { - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport( fmt, &fmtSupport ); - if ( FAILED(hr) ) - fmtSupport = 0; - - if ( pPrintInfo == nullptr ) - { - LVYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - else - { - PRINTYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - } - else - { - D3D11_FEATURE_DATA_FORMAT_SUPPORT2 cfs2; - cfs2.InFormat = fmt; - cfs2.OutFormatSupport2 = 0; - HRESULT hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_FORMAT_SUPPORT2, &cfs2, sizeof(cfs2) ); - if ( FAILED(hr) ) - cfs2.OutFormatSupport2 = 0; - - if ( pPrintInfo == nullptr ) - { - LVYESNO( FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3 ); - } - else - { - PRINTYESNO( FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3 ); - } - } - } - - return S_OK; -} - -static HRESULT D3D11Info2( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - ID3D11Device2* pDevice = reinterpret_cast(lParam1); - - if ( !pDevice ) - return S_OK; - - if( !pPrintInfo ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - - // General Direct3D 11.2 device information - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - - if ( !lParam2 ) - { - D3D11FeatureSupportInfo1( pDevice, true, pPrintInfo ); - - D3D11_FEATURE_DATA_MARKER_SUPPORT marker = {0}; - HRESULT hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_MARKER_SUPPORT, &marker, sizeof(marker) ); - if ( FAILED(hr) ) - memset( &marker, 0, sizeof(marker) ); - - // Setup note - const char *szNote = nullptr; - - switch ( fl ) - { - case D3D_FEATURE_LEVEL_10_0: - szNote = SEE_D3D10; - break; - - case D3D_FEATURE_LEVEL_10_1: - case D3D_FEATURE_LEVEL_9_3: - case D3D_FEATURE_LEVEL_9_2: - case D3D_FEATURE_LEVEL_9_1: - szNote = SEE_D3D10_1; - break; - - case D3D_FEATURE_LEVEL_11_0: - szNote = SEE_D3D11; - break; - - case D3D_FEATURE_LEVEL_11_1: - szNote = SEE_D3D11_1; - break; - - default: - szNote = D3D11_NOTE2; - break; - } - - if ( !pPrintInfo ) - { - LVYESNO( "Profile Marker Support", marker.Profile ) - - LVLINE( "Note", szNote ) - } - else - { - PRINTYESNO( "Profile Marker Support", marker.Profile ) - - PRINTLINE( "Note", szNote ) - } - - return S_OK; - } - - // Use CheckFormatSupport for format usage defined as optional for Direct3D 11.2 devices - - static const DXGI_FORMAT cfsShareable[] = - { - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R32G32B32A32_UINT, - DXGI_FORMAT_R32G32B32A32_SINT, - DXGI_FORMAT_R16G16B16A16_FLOAT, - DXGI_FORMAT_R16G16B16A16_UNORM, - DXGI_FORMAT_R16G16B16A16_UINT, - DXGI_FORMAT_R16G16B16A16_SNORM, - DXGI_FORMAT_R16G16B16A16_SINT, - DXGI_FORMAT_R10G10B10A2_UNORM, - DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, - DXGI_FORMAT_R10G10B10A2_UINT, - DXGI_FORMAT_R8G8B8A8_UNORM, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, - DXGI_FORMAT_R8G8B8A8_UINT, - DXGI_FORMAT_R8G8B8A8_SNORM, - DXGI_FORMAT_R8G8B8A8_SINT, - DXGI_FORMAT_R32_FLOAT, - DXGI_FORMAT_R32_UINT, - DXGI_FORMAT_R32_SINT, - DXGI_FORMAT_R8G8_UNORM, - DXGI_FORMAT_R16_FLOAT, - DXGI_FORMAT_R16_UNORM, - DXGI_FORMAT_R16_UINT, - DXGI_FORMAT_R16_SNORM, - DXGI_FORMAT_R16_SINT, - DXGI_FORMAT_R8_UNORM, - DXGI_FORMAT_R8_UINT, - DXGI_FORMAT_R8_SNORM, - DXGI_FORMAT_R8_SINT, - DXGI_FORMAT_A8_UNORM, - DXGI_FORMAT_BC1_UNORM, - DXGI_FORMAT_BC1_UNORM_SRGB, - DXGI_FORMAT_BC2_UNORM, - DXGI_FORMAT_BC2_UNORM_SRGB, - DXGI_FORMAT_BC3_UNORM, - DXGI_FORMAT_BC3_UNORM_SRGB, - DXGI_FORMAT_B8G8R8A8_UNORM, - DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, - DXGI_FORMAT_B8G8R8X8_UNORM, - DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, - }; - - UINT count = 0; - const DXGI_FORMAT *array = nullptr; - - switch( lParam2 ) - { - case 0xffffffff: // D3D11_FORMAT_SUPPORT2 - switch( lParam3 ) - { - case D3D11_FORMAT_SUPPORT2_SHAREABLE: - count = _countof(cfsShareable); - array = cfsShareable; - break; - - default: - return E_FAIL; - } - break; - - default: - return E_FAIL; - } - - for(UINT i = 0; i < count; ++i) - { - DXGI_FORMAT fmt = array[i]; - - if ( lParam2 != 0xffffffff ) - { - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport( fmt, &fmtSupport ); - if ( FAILED(hr) ) - fmtSupport = 0; - - if ( !pPrintInfo ) - { - LVYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - else - { - PRINTYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - } - else - { - D3D11_FEATURE_DATA_FORMAT_SUPPORT2 cfs2; - cfs2.InFormat = fmt; - cfs2.OutFormatSupport2 = 0; - HRESULT hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_FORMAT_SUPPORT2, &cfs2, sizeof(cfs2) ); - if ( FAILED(hr) ) - cfs2.OutFormatSupport2 = 0; - - if ( !pPrintInfo ) - { - LVYESNO( FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3 ); - } - else - { - PRINTYESNO( FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3 ); - } - } - } - - return S_OK; -} - -static HRESULT D3D11Info3( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - ID3D11Device3* pDevice = reinterpret_cast(lParam1); - - if ( !pDevice ) - return S_OK; - - if( !pPrintInfo ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - - // General Direct3D 11.3/11.4 device information - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - - if ( !lParam2 ) - { - D3D11FeatureSupportInfo1( pDevice, true, pPrintInfo ); - - D3D11_FEATURE_DATA_MARKER_SUPPORT marker = {0}; - HRESULT hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_MARKER_SUPPORT, &marker, sizeof(marker) ); - if ( FAILED(hr) ) - memset( &marker, 0, sizeof(marker) ); - - D3D11_FEATURE_DATA_D3D11_OPTIONS2 d3d11opts2 = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D11_OPTIONS2, &d3d11opts2, sizeof(d3d11opts2) ); - if ( FAILED(hr) ) - memset( &d3d11opts2, 0, sizeof(d3d11opts2) ); - - D3D11_FEATURE_DATA_D3D11_OPTIONS3 d3d11opts3 = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D11_OPTIONS3, &d3d11opts3, sizeof(d3d11opts3) ); - if ( FAILED(hr) ) - memset( &d3d11opts3, 0, sizeof(d3d11opts3) ); - - D3D11_FEATURE_DATA_D3D11_OPTIONS4 d3d11opts4 = {0}; - hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_D3D11_OPTIONS4, &d3d11opts4, sizeof(d3d11opts4) ); - if ( FAILED(hr) ) - memset( &d3d11opts4, 0, sizeof(d3d11opts4) ); - - // Setup note - const char *szNote = nullptr; - - switch ( fl ) - { - case D3D_FEATURE_LEVEL_10_0: - szNote = SEE_D3D10; - break; - - case D3D_FEATURE_LEVEL_10_1: - case D3D_FEATURE_LEVEL_9_3: - case D3D_FEATURE_LEVEL_9_2: - case D3D_FEATURE_LEVEL_9_1: - szNote = SEE_D3D10_1; - break; - - case D3D_FEATURE_LEVEL_11_0: - szNote = SEE_D3D11; - break; - - case D3D_FEATURE_LEVEL_11_1: - szNote = SEE_D3D11_1; - break; - - default: - szNote = (lParam3 != 0) ? D3D11_NOTE4 : D3D11_NOTE3; - break; - } - - char tiled_rsc[16]; - if ( d3d11opts2.TiledResourcesTier == D3D11_TILED_RESOURCES_NOT_SUPPORTED ) - strcpy_s( tiled_rsc, "Not supported" ); - else - sprintf_s( tiled_rsc, "Tier %d", d3d11opts2.TiledResourcesTier ); - - char consrv_rast[16]; - if ( d3d11opts2.ConservativeRasterizationTier == D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED ) - strcpy_s( consrv_rast, "Not supported" ); - else - sprintf_s( consrv_rast, "Tier %d", d3d11opts2.ConservativeRasterizationTier ); - - if ( !pPrintInfo ) - { - LVYESNO( "Profile Marker Support", marker.Profile ) - - LVYESNO( "Map DEFAULT Textures", d3d11opts2.MapOnDefaultTextures ) - LVYESNO( "Standard Swizzle", d3d11opts2.StandardSwizzle ) - LVYESNO( "UMA", d3d11opts2.UnifiedMemoryArchitecture ) - LVYESNO( "Extended formats TypedUAVLoad", d3d11opts2.TypedUAVLoadAdditionalFormats ); - - LVLINE( "Conservative Rasterization", consrv_rast ); - LVLINE( "Tiled Resources", tiled_rsc ); - LVYESNO( "PS-Specified Stencil Ref", d3d11opts2.PSSpecifiedStencilRefSupported ); - LVYESNO( "Rasterizer Ordered Views", d3d11opts2.ROVsSupported ); - - LVYESNO( "VP/RT f/ Rast-feeding Shader", d3d11opts3.VPAndRTArrayIndexFromAnyShaderFeedingRasterizer ); - - if (lParam3 != 0) - { - LVYESNO( "Extended Shared NV12", d3d11opts4.ExtendedNV12SharedTextureSupported ) - } - - LVLINE( "Note", szNote ) - } - else - { - PRINTYESNO( "Profile Marker Support", marker.Profile ) - - PRINTYESNO( "Map DEFAULT Textures", d3d11opts2.MapOnDefaultTextures ) - PRINTYESNO( "Standard Swizzle", d3d11opts2.StandardSwizzle ) - PRINTYESNO( "UMA", d3d11opts2.UnifiedMemoryArchitecture ) - PRINTYESNO( "Extended formats TypedUAVLoad", d3d11opts2.TypedUAVLoadAdditionalFormats ); - - PRINTLINE( "Conservative Rasterization", consrv_rast ); - PRINTLINE( "Tiled Resources", tiled_rsc ); - PRINTYESNO( "PS-Specified Stencil Ref", d3d11opts2.PSSpecifiedStencilRefSupported ); - PRINTYESNO( "Rasterizer Ordered Views", d3d11opts2.ROVsSupported ); - - PRINTYESNO( "VP/RT f/ Rast-feeding Shader", d3d11opts3.VPAndRTArrayIndexFromAnyShaderFeedingRasterizer ); - - if (lParam3 != 0) - { - PRINTYESNO( "Extended Shared NV12", d3d11opts4.ExtendedNV12SharedTextureSupported ) - } - - PRINTLINE( "Note", szNote ) - } - - return S_OK; - } - - // Use CheckFormatSupport for format usage defined as optional for Direct3D 11.3/11.4 devices - - static const DXGI_FORMAT cfsUAVTypedLoad[] = - { - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R32G32B32A32_UINT, - DXGI_FORMAT_R32G32B32A32_SINT, - DXGI_FORMAT_R16G16B16A16_FLOAT, - DXGI_FORMAT_R16G16B16A16_UNORM, - DXGI_FORMAT_R16G16B16A16_UINT, - DXGI_FORMAT_R16G16B16A16_SNORM, - DXGI_FORMAT_R16G16B16A16_SINT, - DXGI_FORMAT_R32G32_FLOAT, - DXGI_FORMAT_R32G32_UINT, - DXGI_FORMAT_R32G32_SINT, - DXGI_FORMAT_R10G10B10A2_UNORM, - DXGI_FORMAT_R10G10B10A2_UINT, - DXGI_FORMAT_R11G11B10_FLOAT, - DXGI_FORMAT_R8G8B8A8_UNORM, - DXGI_FORMAT_R8G8B8A8_UINT, - DXGI_FORMAT_R8G8B8A8_SNORM, - DXGI_FORMAT_R8G8B8A8_SINT, - DXGI_FORMAT_R16G16_FLOAT, - DXGI_FORMAT_R16G16_UNORM, - DXGI_FORMAT_R16G16_UINT, - DXGI_FORMAT_R16G16_SNORM, - DXGI_FORMAT_R16G16_SINT, - DXGI_FORMAT_R32_FLOAT, // req - DXGI_FORMAT_R32_UINT, // req - DXGI_FORMAT_R32_SINT, // req - DXGI_FORMAT_R8G8_UNORM, - DXGI_FORMAT_R8G8_UINT, - DXGI_FORMAT_R8G8_SNORM, - DXGI_FORMAT_R8G8_SINT, - DXGI_FORMAT_R16_FLOAT, - DXGI_FORMAT_R16_UNORM, - DXGI_FORMAT_R16_UINT, - DXGI_FORMAT_R16_SNORM, - DXGI_FORMAT_R16_SINT, - DXGI_FORMAT_R8_UNORM, - DXGI_FORMAT_R8_UINT, - DXGI_FORMAT_R8_SNORM, - DXGI_FORMAT_R8_SINT, - DXGI_FORMAT_A8_UNORM, - }; - - UINT count = 0; - const DXGI_FORMAT *array = nullptr; - - switch( lParam2 ) - { - case 0xffffffff: // D3D11_FORMAT_SUPPORT2 - switch( lParam3 ) - { - case D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD: - count = _countof(cfsUAVTypedLoad); - array = cfsUAVTypedLoad; - break; - - default: - return E_FAIL; - } - break; - - default: - return E_FAIL; - } - - for(UINT i = 0; i < count; ++i) - { - DXGI_FORMAT fmt = array[i]; - - if ( lParam2 != 0xffffffff ) - { - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport( fmt, &fmtSupport ); - if ( FAILED(hr) ) - fmtSupport = 0; - - if ( !pPrintInfo ) - { - LVYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - else - { - PRINTYESNO( FormatName(fmt), fmtSupport & (UINT)lParam2 ); - } - } - else - { - D3D11_FEATURE_DATA_FORMAT_SUPPORT2 cfs2; - cfs2.InFormat = fmt; - cfs2.OutFormatSupport2 = 0; - HRESULT hr = pDevice->CheckFeatureSupport( D3D11_FEATURE_FORMAT_SUPPORT2, &cfs2, sizeof(cfs2) ); - if ( FAILED(hr) ) - cfs2.OutFormatSupport2 = 0; - - if ( !pPrintInfo ) - { - LVYESNO( FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3 ); - } - else - { - PRINTYESNO( FormatName(fmt), cfs2.OutFormatSupport2 & (UINT)lParam3 ); - } - } - } - - return S_OK; -} - -static HRESULT D3D11InfoMSAA( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - auto pDevice = reinterpret_cast(lParam1); - auto sampCount = reinterpret_cast(lParam2); - - if ( pDevice == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - - UINT column = 1; - for( UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples ) - { - if (!sampCount[ samples - 1 ] && !IsMSAAPowerOf2(samples)) - continue; - - TCHAR strBuffer[ 8 ]; - sprintf_s( strBuffer, 8, "%dx", samples ); - LVAddColumn( g_hwndLV, column, strBuffer, 8 ); - ++column; - } - } - - const UINT count = sizeof(g_cfsMSAA_11) / sizeof(DXGI_FORMAT); - - for(UINT i = 0; i < count; ++i) - { - DXGI_FORMAT fmt = g_cfsMSAA_11[i]; - - // Skip 16 bits-per-pixel formats for DX 11.0 - if ( lParam3 == 0 - && ( fmt == DXGI_FORMAT_B5G6R5_UNORM || fmt == DXGI_FORMAT_B5G5R5A1_UNORM || fmt == DXGI_FORMAT_B4G4R4A4_UNORM ) ) - continue; - - UINT sampQ[ D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT ]; - memset( sampQ, 0, sizeof(sampQ) ); - - BOOL any = FALSE; - for( UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples ) - { - UINT quality; - HRESULT hr = pDevice->CheckMultisampleQualityLevels( fmt, samples, &quality ); - - if ( SUCCEEDED(hr) && quality > 0 ) - { - sampQ[ samples-1 ] = quality; - any = TRUE; - } - } - - if ( pPrintInfo == nullptr) - { - if ( g_dwViewState != IDM_VIEWALL && !any ) - continue; - - LVAddText( g_hwndLV, 0, FormatName(fmt) ); - - UINT column = 1; - for( UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples ) - { - if (!sampCount[ samples - 1 ] && !IsMSAAPowerOf2(samples)) - continue; - - if ( sampQ[ samples-1 ] > 0 ) - { - TCHAR strBuffer[ 32 ]; - sprintf_s(strBuffer, 32, "Yes (%d)", sampQ[ samples-1 ] ); - LVAddText( g_hwndLV, column, strBuffer ); - } - else - LVAddText( g_hwndLV, column, c_szNo ); - - ++column; - } - } - else - { - TCHAR buff[ 1024 ]; - *buff = 0; - - for( UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples ) - { - if (!sampCount[ samples - 1 ] && !IsMSAAPowerOf2(samples)) - continue; - - TCHAR strBuffer[ 32 ]; - if ( sampQ[ samples-1 ] > 0 ) - sprintf_s(strBuffer, 32, "%dx: Yes (%d) ", samples, sampQ[ samples-1 ] ); - else - sprintf_s(strBuffer, 32, "%dx: No ", samples ); - - strcat_s( buff, 1024, strBuffer ); - } - - PrintStringValueLine( FormatName(fmt), buff, pPrintInfo ); - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -namespace -{ - void FillMSAASampleTable(ID3D10Device* pDevice, BOOL sampCount[], BOOL _10level9) - { - memset(sampCount, 0, sizeof(BOOL) * D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT); - sampCount[0] = TRUE; // sample count of 1 is always required - - UINT count = 0; - const DXGI_FORMAT *array = nullptr; - - if (_10level9) - { - count = sizeof(g_cfsMSAA_10level9) / sizeof(DXGI_FORMAT); - array = g_cfsMSAA_10level9; - } - else - { - count = sizeof(g_cfsMSAA_10) / sizeof(DXGI_FORMAT); - array = g_cfsMSAA_10; - } - - for (UINT samples = 2; samples <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) - { - for (UINT i = 0; i < count; ++i) - { - UINT quality; - HRESULT hr = pDevice->CheckMultisampleQualityLevels(array[i], samples, &quality); - - if (SUCCEEDED(hr) && quality > 0) - { - sampCount[samples - 1] = TRUE; - break; - } - } - } - } - - void FillMSAASampleTable(ID3D11Device* pDevice, BOOL sampCount[]) - { - memset(sampCount, 0, sizeof(BOOL) * D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT); - sampCount[0] = TRUE; // sample count of 1 is always required - - for (UINT samples = 2; samples <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) - { - const UINT count = sizeof(g_cfsMSAA_11) / sizeof(DXGI_FORMAT); - - for (UINT i = 0; i < count; ++i) - { - UINT quality; - HRESULT hr = pDevice->CheckMultisampleQualityLevels(g_cfsMSAA_11[i], samples, &quality); - - if (SUCCEEDED(hr) && quality > 0) - { - sampCount[samples - 1] = TRUE; - break; - } - } - } - } -} - - -//----------------------------------------------------------------------------- -static HRESULT D3D11InfoVideo( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - auto pDevice = reinterpret_cast(lParam1); - auto sampCount = reinterpret_cast(lParam2); - - if ( pDevice == nullptr ) - return S_OK; - - if( pPrintInfo == nullptr ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn( g_hwndLV, 1, "Texture2D", 15 ); - LVAddColumn( g_hwndLV, 2, "Input", 15 ); - LVAddColumn( g_hwndLV, 3, "Output", 15 ); - LVAddColumn( g_hwndLV, 4, "Encoder", 15 ); - } - - static const DXGI_FORMAT cfsVideo[] = - { - DXGI_FORMAT_NV12, - DXGI_FORMAT_420_OPAQUE, - DXGI_FORMAT_YUY2, - DXGI_FORMAT_AYUV, - DXGI_FORMAT_Y410, - DXGI_FORMAT_Y416, - DXGI_FORMAT_P010, - DXGI_FORMAT_P016, - DXGI_FORMAT_Y210, - DXGI_FORMAT_Y216, - DXGI_FORMAT_NV11, - DXGI_FORMAT_AI44, - DXGI_FORMAT_IA44, - DXGI_FORMAT_P8, - DXGI_FORMAT_A8P8, - }; - - for(UINT i = 0; i < _countof(cfsVideo); ++i) - { - DXGI_FORMAT fmt = cfsVideo[i]; - - UINT fmtSupport = 0; - HRESULT hr = pDevice->CheckFormatSupport( fmt, &fmtSupport ); - if ( FAILED(hr) ) - fmtSupport = 0; - - bool any = ( fmtSupport & ( D3D11_FORMAT_SUPPORT_TEXTURE2D - | D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT - | D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT - | D3D11_FORMAT_SUPPORT_VIDEO_ENCODER ) ) ? true : false; - - if ( pPrintInfo == nullptr) - { - if ( g_dwViewState != IDM_VIEWALL && !any ) - continue; - - LVAddText( g_hwndLV, 0, FormatName(fmt) ); - - LVAddText( g_hwndLV, 1, (fmtSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) ? c_szYes : c_szNo ); - LVAddText( g_hwndLV, 2, (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT) ? c_szYes : c_szNo ); - LVAddText( g_hwndLV, 3, (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT) ? c_szYes : c_szNo ); - LVAddText( g_hwndLV, 4, (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_ENCODER) ? c_szYes : c_szNo ); - } - else - { - TCHAR buff[ 1024 ]; - - sprintf_s( buff, "Texture2D: %-3s Input: %-3s Output: %-3s Encoder: %-3s", - (fmtSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D) ? c_szYes : c_szNo, - (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT) ? c_szYes : c_szNo, - (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT) ? c_szYes : c_szNo, - (fmtSupport & D3D11_FORMAT_SUPPORT_VIDEO_ENCODER) ? c_szYes : c_szNo ); - - PrintStringValueLine( FormatName(fmt), buff, pPrintInfo ); - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -static HRESULT D3D12Info( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ) -{ - auto pDevice = reinterpret_cast( lParam1 ); - auto fl = (D3D_FEATURE_LEVEL) lParam2; - - if ( !pDevice ) - return S_OK; - - if( !pPrintInfo ) - { - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 60); - } - - D3D12_FEATURE_DATA_SHADER_MODEL shaderModelOpt = {}; - shaderModelOpt.HighestShaderModel = D3D_SHADER_MODEL_6_5; - HRESULT hr = pDevice->CheckFeatureSupport( D3D12_FEATURE_SHADER_MODEL, &shaderModelOpt, sizeof(shaderModelOpt) ); - while(hr == E_INVALIDARG && shaderModelOpt.HighestShaderModel > D3D_SHADER_MODEL_6_0) - { - shaderModelOpt.HighestShaderModel = static_cast(static_cast(shaderModelOpt.HighestShaderModel) - 1); - hr = pDevice->CheckFeatureSupport( D3D12_FEATURE_SHADER_MODEL, &shaderModelOpt, sizeof(shaderModelOpt) ); - } - if (FAILED(hr)) - { - shaderModelOpt.HighestShaderModel = D3D_SHADER_MODEL_5_1; - } - - D3D12_FEATURE_DATA_ROOT_SIGNATURE rootSigOpt = {}; - rootSigOpt.HighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_1; - hr = pDevice->CheckFeatureSupport( D3D12_FEATURE_ROOT_SIGNATURE, &rootSigOpt, sizeof(rootSigOpt) ); - if (FAILED(hr)) - { - rootSigOpt.HighestVersion = D3D_ROOT_SIGNATURE_VERSION_1_0; - } - - D3D12_FEATURE_DATA_D3D12_OPTIONS d3d12opts = {0}; - hr = pDevice->CheckFeatureSupport( D3D12_FEATURE_D3D12_OPTIONS, &d3d12opts, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS) ); - if ( FAILED(hr) ) - memset( &d3d12opts, 0, sizeof(d3d12opts) ); - - D3D12_FEATURE_DATA_D3D12_OPTIONS1 d3d12opts1 = {0}; - hr = pDevice->CheckFeatureSupport( D3D12_FEATURE_D3D12_OPTIONS1, &d3d12opts1, sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS1) ); - if ( FAILED(hr) ) - memset( &d3d12opts1, 0, sizeof(d3d12opts1) ); - - D3D12_FEATURE_DATA_ARCHITECTURE d3d12arch = {0}; - hr = pDevice->CheckFeatureSupport( D3D12_FEATURE_ARCHITECTURE, &d3d12arch, sizeof(D3D12_FEATURE_DATA_ARCHITECTURE) ); - if ( FAILED(hr) ) - memset( &d3d12arch, 0, sizeof(d3d12arch) ); - - D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT d3d12vm = {0}; - hr = pDevice->CheckFeatureSupport( D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT, &d3d12vm, sizeof(D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT) ); - if ( FAILED(hr) ) - memset( &d3d12vm, 0, sizeof(d3d12vm) ); - - const char* shaderModel = "Unknown"; - switch (shaderModelOpt.HighestShaderModel) - { - case D3D_SHADER_MODEL_6_5: shaderModel = "6.5"; break; - case D3D_SHADER_MODEL_6_4: shaderModel = "6.4"; break; - case D3D_SHADER_MODEL_6_3: shaderModel = "6.3"; break; - case D3D_SHADER_MODEL_6_2: shaderModel = "6.2"; break; - case D3D_SHADER_MODEL_6_1: shaderModel = "6.1"; break; - case D3D_SHADER_MODEL_6_0: shaderModel = "6.0"; break; - case D3D_SHADER_MODEL_5_1: shaderModel = "5.1"; break; - } - - const char* rootSig = "Unknown"; - switch (rootSigOpt.HighestVersion) - { - case D3D_ROOT_SIGNATURE_VERSION_1_0: rootSig = "1.0"; break; - case D3D_ROOT_SIGNATURE_VERSION_1_1: rootSig = "1.1"; break; - } - - char vmRes[ 16 ]; - sprintf_s(vmRes, 16, "%u", d3d12vm.MaxGPUVirtualAddressBitsPerResource ); - - char vmProcess[ 16 ]; - sprintf_s(vmProcess, 16, "%u", d3d12vm.MaxGPUVirtualAddressBitsPerProcess ); - - const char* precis = nullptr; - switch( d3d12opts.MinPrecisionSupport & (D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT|D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT) ) - { - case 0: precis = "Full"; break; - case D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT: precis = "16/32-bit"; break; - case D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT: precis = "10/32-bit"; break; - default: precis = "10/16/32-bit"; break; - } - - const char *sharing = nullptr; - switch ( d3d12opts.CrossNodeSharingTier ) - { - case D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED: sharing = c_szNo; break; - case D3D12_CROSS_NODE_SHARING_TIER_1_EMULATED: sharing = "Yes - Tier 1 (Emulated)"; break; - case D3D12_CROSS_NODE_SHARING_TIER_1: sharing = "Yes - Tier 1"; break; - case D3D12_CROSS_NODE_SHARING_TIER_2: sharing = "Yes - Tier 2"; break; - default: sharing = "Yes"; break; - } - - char heap[16]; - sprintf_s( heap, "Tier %d", d3d12opts.ResourceHeapTier ); - - char tiled_rsc[16]; - if ( d3d12opts.TiledResourcesTier == D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED ) - strcpy_s( tiled_rsc, "Not supported" ); - else - sprintf_s( tiled_rsc, "Tier %d", d3d12opts.TiledResourcesTier ); - - char consrv_rast[16]; - if ( d3d12opts.ConservativeRasterizationTier == D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED ) - strcpy_s( consrv_rast, "Not supported" ); - else - sprintf_s( consrv_rast, "Tier %d", d3d12opts.ConservativeRasterizationTier ); - - char binding_rsc[16]; - sprintf_s( binding_rsc, "Tier %d", d3d12opts.ResourceBindingTier ); - - char lane_count[16]; - sprintf_s( lane_count, "%u", d3d12opts1.TotalLaneCount ); - - char wave_lane_count[16]; - sprintf_s( wave_lane_count, "%u/%u", d3d12opts1.WaveLaneCountMin, d3d12opts1.WaveLaneCountMax ); - - if ( !pPrintInfo ) - { - LVLINE( "Feature Level", FLName(fl) ) - LVLINE( "Shader Model", shaderModel ) - LVLINE( "Root Signature", rootSig ) - - LVYESNO( "Double-precision Shaders", d3d12opts.DoublePrecisionFloatShaderOps ) - LVYESNO( "Standard Swizzle 64KB", d3d12opts.StandardSwizzle64KBSupported ) - LVYESNO( "Extended formats TypedUAVLoad", d3d12opts.TypedUAVLoadAdditionalFormats ); - - LVLINE( "Conservative Rasterization", consrv_rast ); - LVLINE( "Resource Binding", binding_rsc ); - LVLINE( "Tiled Resources", tiled_rsc ); - LVLINE( "Resource Heap", heap ); - LVYESNO( "PS-Specified Stencil Ref", d3d12opts.PSSpecifiedStencilRefSupported ); - LVYESNO( "Rasterizer Ordered Views", d3d12opts.ROVsSupported ); - - LVYESNO( "VP/RT without GS Emulation", d3d12opts.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation ); - LVYESNO( "Cross-adapter RM Texture", d3d12opts.CrossAdapterRowMajorTextureSupported ); - LVLINE( "Cross-node Sharing", sharing ); - - LVYESNO( "Tile-based Renderer", d3d12arch.TileBasedRenderer ) - LVYESNO( "UMA", d3d12arch.UMA ) - LVYESNO( "Cache Coherent UMA", d3d12arch.CacheCoherentUMA ) - - LVLINE( "Max GPU VM bits per resource", vmRes ); - LVLINE( "Max GPU VM bits per process", vmProcess ); - - LVLINE( "Minimum Precision", precis ); - - if (lParam3 != 0) - { - LVYESNO( "Wave operations", d3d12opts1.WaveOps ); - LVLINE( "Wave lane count", wave_lane_count ); - LVLINE( "Total lane count", lane_count ); - LVYESNO( "Expanded compute resource states", d3d12opts1.ExpandedComputeResourceStates ); - } - } - else - { - PRINTLINE( "Feature Level", FLName(fl) ) - PRINTLINE( "Shader Model", shaderModel ) - PRINTLINE( "Root Signature", rootSig ) - - PRINTYESNO( "Double-precision Shaders", d3d12opts.DoublePrecisionFloatShaderOps ) - PRINTYESNO( "Standard Swizzle 64KB", d3d12opts.StandardSwizzle64KBSupported ) - PRINTYESNO( "Extended formats TypedUAVLoad", d3d12opts.TypedUAVLoadAdditionalFormats ); - - PRINTLINE( "Conservative Rasterization", consrv_rast ); - PRINTLINE( "Resource Binding", binding_rsc ); - PRINTLINE( "Tiled Resources", tiled_rsc ); - PRINTLINE( "Resource Heap", heap ); - PRINTYESNO( "PS-Specified Stencil Ref", d3d12opts.PSSpecifiedStencilRefSupported ); - PRINTYESNO( "Rasterizer Ordered Views", d3d12opts.ROVsSupported ); - - PRINTYESNO( "VP/RT without GS Emulation", d3d12opts.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation ); - PRINTYESNO( "Cross-adapter RM Texture", d3d12opts.CrossAdapterRowMajorTextureSupported ); - PRINTLINE( "Cross-node Sharing", sharing ); - - PRINTYESNO( "Tile-based Renderer", d3d12arch.TileBasedRenderer ) - PRINTYESNO( "UMA", d3d12arch.UMA ) - PRINTYESNO( "Cache Coherent UMA", d3d12arch.CacheCoherentUMA ) - - PRINTLINE( "Max GPU VM bits per resource", vmRes ); - PRINTLINE( "Max GPU VM bits per process", vmProcess ); - - PRINTLINE( "Minimum Precision", precis ); - - if (lParam3 != 0) - { - PRINTYESNO( "Wave operations", d3d12opts1.WaveOps ); - PRINTLINE( "Wave lane count", wave_lane_count ); - PRINTLINE( "Total lane count", lane_count ); - PRINTYESNO( "Expanded compute resource states", d3d12opts1.ExpandedComputeResourceStates ); - } - } - - return S_OK; -} - - -//----------------------------------------------------------------------------- -static void D3D10_FillTree( HTREEITEM hTree, ID3D10Device* pDevice, D3D_DRIVER_TYPE devType ) -{ - HTREEITEM hTreeD3D = TVAddNodeEx( hTree, "Direct3D 10", TRUE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, 0, 0 ); - - TVAddNodeEx( hTreeD3D, "Features", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10( devType ) ); - - TVAddNodeEx( hTreeD3D, "Shader sample (any filter)", FALSE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_SHADER_SAMPLE, 0 ); - - TVAddNodeEx( hTreeD3D, "Mipmap Auto-Generation", FALSE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MIP_AUTOGEN, 0 ); - - TVAddNodeEx( hTreeD3D, "Render Target", FALSE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_RENDER_TARGET, 0 ); - - TVAddNodeEx( hTreeD3D, "Blendable Render Target", FALSE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_BLENDABLE, 0 ); - - // MSAA - FillMSAASampleTable( pDevice, g_sampCount10, FALSE ); - - TVAddNodeEx( hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2 ); - - TVAddNodeEx( hTreeD3D, "4x MSAA", FALSE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4 ); - - TVAddNodeEx( hTreeD3D, "8x MSAA", FALSE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 8 ); - - TVAddNode( hTreeD3D, "Other MSAA", FALSE, IDI_CAPS, D3D10InfoMSAA, (LPARAM)pDevice, (LPARAM)g_sampCount10 ); - - TVAddNodeEx( hTreeD3D, "MSAA Load", FALSE, IDI_CAPS, D3D10Info, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD, 0 ); -} - -static void D3D10_FillTree1( HTREEITEM hTree, ID3D10Device1* pDevice, DWORD flMask, D3D_DRIVER_TYPE devType ) -{ - D3D10_FEATURE_LEVEL1 fl = pDevice->GetFeatureLevel(); - - HTREEITEM hTreeD3D = TVAddNodeEx( hTree, "Direct3D 10.1", TRUE, - IDI_CAPS, D3D10Info1, (LPARAM)pDevice, 0, 0 ); - - TVAddNodeEx( hTreeD3D, FLName( fl ), FALSE, IDI_CAPS, D3D_FeatureLevel, (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1( devType ) ); - - if ( (g_DXGIFactory1 != nullptr && fl != D3D10_FEATURE_LEVEL_9_1) - || (g_DXGIFactory1 == nullptr && fl != D3D10_FEATURE_LEVEL_10_0) ) - { - HTREEITEM hTreeF = TVAddNode( hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0 ); - - switch( fl ) - { - case D3D10_FEATURE_LEVEL_10_1: - if ( flMask & FLMASK_10_0 ) - { - TVAddNodeEx( hTreeF, "D3D10_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1( devType ) ); - } - // Fall thru - - case D3D10_FEATURE_LEVEL_10_0: - if ( flMask & FLMASK_9_3 ) - { - TVAddNodeEx( hTreeF, "D3D10_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1( devType ) ); - } - // Fall thru - - case D3D10_FEATURE_LEVEL_9_3: - if ( flMask & FLMASK_9_2 ) - { - TVAddNodeEx( hTreeF, "D3D10_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1( devType ) ); - } - // Fall thru - - case D3D10_FEATURE_LEVEL_9_2: - if ( flMask & FLMASK_9_1 ) - { - TVAddNodeEx( hTreeF, "D3D10_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D10_1( devType ) ); - } - break; - } - } - - // Only display for 10.1 devices. 10 and 11 devices are handled in their "native" node - // Nothing optional about 10level9 feature levels - if ( fl == D3D10_FEATURE_LEVEL_10_1 ) - { - TVAddNodeEx( hTreeD3D, "Shader sample (any filter)", FALSE, IDI_CAPS, D3D10Info1, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_SHADER_SAMPLE, 0 ); - - TVAddNodeEx( hTreeD3D, "Mipmap Auto-Generation", FALSE, IDI_CAPS, D3D10Info1, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MIP_AUTOGEN, 0 ); - - TVAddNodeEx( hTreeD3D, "Render Target", FALSE, IDI_CAPS, D3D10Info1, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_RENDER_TARGET, 0 ); - } - - // MSAA (for all but 10 devices, which are handled in their "native" node) - if ( fl != D3D10_FEATURE_LEVEL_10_0 ) - { - FillMSAASampleTable( pDevice, g_sampCount10_1, (fl != D3D10_FEATURE_LEVEL_10_1) ); - - if ( fl == D3D10_FEATURE_LEVEL_10_1 ) - { - TVAddNodeEx( hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D10Info1, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2 ); - - TVAddNodeEx( hTreeD3D, "4x MSAA (most required)", FALSE, IDI_CAPS, D3D10Info1, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4 ); - - TVAddNodeEx( hTreeD3D, "8x MSAA", FALSE, IDI_CAPS, D3D10Info1, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 8 ); - - TVAddNode( hTreeD3D, "Other MSAA", FALSE, IDI_CAPS, D3D10InfoMSAA, (LPARAM)pDevice, (LPARAM)g_sampCount10_1 ); - } - else // 10level9 - { - TVAddNodeEx( hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D10Info1, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2 ); - - if ( fl >= D3D10_FEATURE_LEVEL_9_3 ) - { - TVAddNodeEx( hTreeD3D, "4x MSAA", FALSE, IDI_CAPS, D3D10Info1, - (LPARAM)pDevice, (LPARAM)D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4 ); - } - } - } -} - - -//----------------------------------------------------------------------------- -static void D3D11_FillTree( HTREEITEM hTree, ID3D11Device* pDevice, DWORD flMask, D3D_DRIVER_TYPE devType ) -{ - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - if ( fl > D3D_FEATURE_LEVEL_11_0 ) - fl = D3D_FEATURE_LEVEL_11_0; - - HTREEITEM hTreeD3D = TVAddNodeEx( hTree, "Direct3D 11", TRUE, - IDI_CAPS, D3D11Info, (LPARAM)pDevice, 0, 0 ); - - TVAddNodeEx( hTreeD3D, FLName( fl ), FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11( devType ) ); - - if ( fl != D3D_FEATURE_LEVEL_9_1 ) - { - HTREEITEM hTreeF = TVAddNode( hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0 ); - - switch( fl ) - { - case D3D_FEATURE_LEVEL_11_0: - if ( flMask & FLMASK_10_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_10_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_10_1: - if ( flMask & FLMASK_10_0 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_10_0: - if ( flMask & FLMASK_9_3 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_9_3: - if ( flMask & FLMASK_9_2 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_9_2: - if ( flMask & FLMASK_9_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11( devType ) ); - } - break; - } - } - - if ( fl >= D3D_FEATURE_LEVEL_11_0 ) - { - TVAddNodeEx( hTreeD3D, "Shader sample (any filter)", FALSE, IDI_CAPS, D3D11Info, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_SHADER_SAMPLE, 0 ); - - TVAddNodeEx( hTreeD3D, "Shader gather4", FALSE, IDI_CAPS, D3D11Info, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_SHADER_GATHER, 0 ); - - TVAddNodeEx( hTreeD3D, "Mipmap Auto-Generation", FALSE, IDI_CAPS, D3D11Info, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MIP_AUTOGEN, 0 ); - - TVAddNodeEx( hTreeD3D, "Render Target", FALSE, IDI_CAPS, D3D11Info, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_RENDER_TARGET, 0 ); - - // MSAA (MSAA data for 10level9 is shown under the 10.1 node) - FillMSAASampleTable( pDevice, g_sampCount11 ); - - TVAddNodeEx( hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D11Info, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2 ); - - TVAddNodeEx( hTreeD3D, "4x MSAA (all required)", FALSE, IDI_CAPS, D3D11Info, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4 ); - - TVAddNodeEx( hTreeD3D, "8x MSAA (most required)", FALSE, IDI_CAPS, D3D11Info, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 8 ); - - TVAddNodeEx( hTreeD3D, "Other MSAA", FALSE, IDI_CAPS, D3D11InfoMSAA, - (LPARAM)pDevice, (LPARAM)g_sampCount11, 0 ); - } -} - -static void D3D11_FillTree1( HTREEITEM hTree, ID3D11Device1* pDevice, DWORD flMask, D3D_DRIVER_TYPE devType ) -{ - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - if ( fl > D3D_FEATURE_LEVEL_11_1 ) - fl = D3D_FEATURE_LEVEL_11_1; - - HTREEITEM hTreeD3D = TVAddNodeEx( hTree, "Direct3D 11.1", TRUE, - IDI_CAPS, D3D11Info1, (LPARAM)pDevice, 0, 0 ); - - TVAddNodeEx( hTreeD3D, FLName( fl ), FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1( devType ) ); - - if ( fl != D3D_FEATURE_LEVEL_9_1 ) - { - HTREEITEM hTreeF = TVAddNode( hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0 ); - - switch( fl ) - { - case D3D_FEATURE_LEVEL_11_1: - if( flMask & FLMASK_11_0 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_11_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_11_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_11_0: - if ( flMask & FLMASK_10_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_10_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_10_1: - if ( flMask & FLMASK_10_0 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_10_0: - if ( flMask & FLMASK_9_3 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_9_3: - if ( flMask & FLMASK_9_2 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_9_2: - if ( flMask & FLMASK_9_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_1( devType ) ); - } - break; - } - } - - if ( fl >= D3D_FEATURE_LEVEL_10_0 ) - { - TVAddNodeEx( hTreeD3D, "IA Vertex Buffer", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER, 0 ); - - TVAddNodeEx( hTreeD3D, "Shader sample (any filter)", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_SHADER_SAMPLE, 0 ); - - if ( fl >= D3D_FEATURE_LEVEL_11_0 ) - { - TVAddNodeEx( hTreeD3D, "Shader gather4", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_SHADER_GATHER, 0 ); - } - - TVAddNodeEx( hTreeD3D, "Mipmap Auto-Generation", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MIP_AUTOGEN, 0 ); - - TVAddNodeEx( hTreeD3D, "Render Target", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_RENDER_TARGET, 0 ); - - TVAddNodeEx( hTreeD3D, "Blendable Render Target", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_BLENDABLE, 0 ); - - if ( fl < D3D_FEATURE_LEVEL_11_1 ) - { - // This is required for 11.1, but is optional for 10.x and 11.0 - TVAddNodeEx( hTreeD3D, "OM Logic Ops", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)0xffffffff, (LPARAM)D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP ); - } - - if ( fl >= D3D_FEATURE_LEVEL_11_0 ) - { - TVAddNodeEx( hTreeD3D, "Typed UAV (most required)", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW, 0 ); - - TVAddNodeEx( hTreeD3D, "UAV Typed Store (most required)", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)0xffffffff, (LPARAM)D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE ); - } - - // MSAA (MSAA data for 10level9 is shown under the 10.1 node) - FillMSAASampleTable( pDevice, g_sampCount11_1 ); - - TVAddNodeEx( hTreeD3D, "2x MSAA", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 2 ); - - TVAddNodeEx( hTreeD3D, "4x MSAA (all required)", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 4 ); - - TVAddNodeEx( hTreeD3D, "8x MSAA (most required)", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET, 8 ); - - TVAddNodeEx( hTreeD3D, "Other MSAA", FALSE, IDI_CAPS, D3D11InfoMSAA, - (LPARAM)pDevice, (LPARAM)g_sampCount11_1, 1 ); - - TVAddNodeEx( hTreeD3D, "MSAA Load", FALSE, IDI_CAPS, D3D11Info1, - (LPARAM)pDevice, (LPARAM)D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD, 0 ); - } - - if ( devType != D3D_DRIVER_TYPE_REFERENCE ) - { - TVAddNodeEx( hTreeD3D, "Video", FALSE, IDI_CAPS, D3D11InfoVideo, (LPARAM)pDevice, 0, 1 ); - } -} - -static void D3D11_FillTree2( HTREEITEM hTree, ID3D11Device2* pDevice, DWORD flMask, D3D_DRIVER_TYPE devType ) -{ - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - if ( fl > D3D_FEATURE_LEVEL_11_1 ) - fl = D3D_FEATURE_LEVEL_11_1; - - HTREEITEM hTreeD3D = TVAddNodeEx( hTree, "Direct3D 11.2", TRUE, - IDI_CAPS, D3D11Info2, (LPARAM)pDevice, 0, 0 ); - - TVAddNodeEx( hTreeD3D, FLName( fl ), FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2( devType ) ); - - if ( fl != D3D_FEATURE_LEVEL_9_1 ) - { - HTREEITEM hTreeF = TVAddNode( hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0 ); - - switch( fl ) - { - case D3D_FEATURE_LEVEL_11_1: - if( flMask & FLMASK_11_0 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_11_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_11_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_11_0: - if ( flMask & FLMASK_10_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_10_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_10_1: - if ( flMask & FLMASK_10_0 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_10_0: - if ( flMask & FLMASK_9_3 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_9_3: - if ( flMask & FLMASK_9_2 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_9_2: - if ( flMask & FLMASK_9_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_2( devType ) ); - } - break; - } - } - - // The majority of this data is already shown under the DirectX 11.1 node, so we only show the 'new' info - - TVAddNodeEx( hTreeD3D, "Shareable", FALSE, IDI_CAPS, D3D11Info2, - (LPARAM)pDevice, (LPARAM)0xffffffff, (LPARAM)D3D11_FORMAT_SUPPORT2_SHAREABLE ); -} - -static void D3D11_FillTree3( HTREEITEM hTree, ID3D11Device3* pDevice, ID3D11Device4* pDevice4, DWORD flMask, D3D_DRIVER_TYPE devType ) -{ - D3D_FEATURE_LEVEL fl = pDevice->GetFeatureLevel(); - - HTREEITEM hTreeD3D = TVAddNodeEx( hTree, (pDevice4) ? "Direct3D 11.3/11.4" : "Direct3D 11.3", TRUE, - IDI_CAPS, D3D11Info3, (LPARAM)pDevice, 0, (LPARAM)pDevice4 ); - - TVAddNodeEx( hTreeD3D, FLName( fl ), FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - - if ( fl != D3D_FEATURE_LEVEL_9_1 ) - { - HTREEITEM hTreeF = TVAddNode( hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0 ); - - switch( fl ) - { - case D3D_FEATURE_LEVEL_12_1: - if( flMask & FLMASK_12_0 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_12_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_12_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_12_0: - if( flMask & FLMASK_11_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_11_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_11_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_11_1: - if( flMask & FLMASK_11_0 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_11_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_11_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_11_0: - if ( flMask & FLMASK_10_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_10_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_10_1: - if ( flMask & FLMASK_10_0 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_10_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_10_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_10_0: - if ( flMask & FLMASK_9_3 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_3", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_3, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_9_3: - if ( flMask & FLMASK_9_2 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_2", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_2, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - } - // Fall thru - - case D3D_FEATURE_LEVEL_9_2: - if ( flMask & FLMASK_9_1 ) - { - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_9_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_9_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D11_3( devType ) ); - } - break; - } - } - - // The majority of this data is already shown under the DirectX 11.1 or 11.2 node, so we only show the 'new' info - - TVAddNodeEx( hTreeD3D, "UAV Typed Load", FALSE, IDI_CAPS, D3D11Info3, - (LPARAM)pDevice, (LPARAM)0xffffffff, (LPARAM)D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD ); - - // TODO - Hardware JPEG information -} - -//----------------------------------------------------------------------------- -static void D3D12_FillTree( HTREEITEM hTree, ID3D12Device* pDevice, ID3D12Device1* pDevice1, D3D_DRIVER_TYPE devType ) -{ - D3D_FEATURE_LEVEL fl = GetD3D12FeatureLevel(pDevice); - - HTREEITEM hTreeD3D = TVAddNodeEx( hTree, "Direct3D 12", TRUE, IDI_CAPS, D3D12Info, (LPARAM)pDevice, (LPARAM)fl, (LPARAM)pDevice1 ); - - TVAddNodeEx( hTreeD3D, FLName( fl ), FALSE, IDI_CAPS, D3D_FeatureLevel, (LPARAM)fl, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D12( devType ) ); - - if ( fl != D3D_FEATURE_LEVEL_11_0 ) - { - HTREEITEM hTreeF = TVAddNode( hTreeD3D, "Additional Feature Levels", TRUE, IDI_CAPS, nullptr, 0, 0 ); - - switch( fl ) - { - case D3D_FEATURE_LEVEL_12_1: - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_12_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_12_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D12( devType ) ); - // Fall thru - - case D3D_FEATURE_LEVEL_12_0: - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_11_1", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_11_1, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D12( devType ) ); - // Fall thru - - case D3D_FEATURE_LEVEL_11_1: - TVAddNodeEx( hTreeF, "D3D_FEATURE_LEVEL_11_0", FALSE, IDI_CAPS, D3D_FeatureLevel, - (LPARAM)D3D_FEATURE_LEVEL_11_0, (LPARAM)pDevice, D3D_FL_LPARAM3_D3D12( devType ) ); - break; - } - } -} //----------------------------------------------------------------------------- // Name: DXGI_FillTree() //----------------------------------------------------------------------------- -VOID DXGI_FillTree( HWND hwndTV ) +VOID DXGI_FillTree(HWND hwndTV) { - HRESULT hr; - - if ( g_DXGIFactory == nullptr ) + if (!g_DXGIFactory) return; - HTREEITEM hTree = TVAddNode( TVI_ROOT, "DXGI Devices", TRUE, IDI_DIRECTX, nullptr, 0, 0 ); + HTREEITEM hTree = TVAddNode(TVI_ROOT, "DXGI Devices", TRUE, IDI_DIRECTX, nullptr, 0, 0); // Hardware driver types - IDXGIAdapter *pAdapter = nullptr; - IDXGIAdapter1 *pAdapter1 = nullptr; - IDXGIAdapter2 *pAdapter2 = nullptr; - IDXGIAdapter3 *pAdapter3 = nullptr; - for(UINT iAdapter = 0; ; ++iAdapter) + IDXGIAdapter* pAdapter = nullptr; + IDXGIAdapter1* pAdapter1 = nullptr; + IDXGIAdapter2* pAdapter2 = nullptr; + IDXGIAdapter3* pAdapter3 = nullptr; + HRESULT hr; + for (UINT iAdapter = 0; ; ++iAdapter) { - if ( g_DXGIFactory1 != nullptr ) + if (g_DXGIFactory1) { - hr = g_DXGIFactory1->EnumAdapters1( iAdapter, &pAdapter1 ); + hr = g_DXGIFactory1->EnumAdapters1(iAdapter, &pAdapter1); pAdapter = pAdapter1; - if ( SUCCEEDED(hr) ) + if (SUCCEEDED(hr)) { - HRESULT hr2 = pAdapter1->QueryInterface( IID_PPV_ARGS( &pAdapter2 ) ); - if ( FAILED(hr2) ) + HRESULT hr2 = pAdapter1->QueryInterface(IID_PPV_ARGS(&pAdapter2)); + if (FAILED(hr2)) pAdapter2 = nullptr; - hr2 = pAdapter1->QueryInterface( IID_PPV_ARGS( &pAdapter3 ) ); - if ( FAILED(hr2) ) + hr2 = pAdapter1->QueryInterface(IID_PPV_ARGS(&pAdapter3)); + if (FAILED(hr2)) pAdapter3 = nullptr; } } else { - hr = g_DXGIFactory->EnumAdapters( iAdapter, &pAdapter ); + hr = g_DXGIFactory->EnumAdapters(iAdapter, &pAdapter); } - if ( FAILED(hr) ) + if (FAILED(hr)) break; - if ( pAdapter2 ) + if (pAdapter2) { DXGI_ADAPTER_DESC2 aDesc2; - pAdapter2->GetDesc2( &aDesc2 ); + pAdapter2->GetDesc2(&aDesc2); - if ( aDesc2.Flags & DXGI_ADAPTER_FLAG_SOFTWARE ) + if (aDesc2.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) { // Skip "always there" Microsoft Basics Display Driver pAdapter2->Release(); @@ -5177,93 +5143,96 @@ VOID DXGI_FillTree( HWND hwndTV ) } DXGI_ADAPTER_DESC aDesc; - pAdapter->GetDesc( &aDesc ); + pAdapter->GetDesc(&aDesc); char szDesc[128]; - wcstombs( szDesc, aDesc.Description, 128 ); + wcstombs_s(nullptr, szDesc, aDesc.Description, 128); HTREEITEM hTreeA; // No need for DXGIAdapterInfo3 as there's no extra desc information to display - if ( pAdapter2 ) + if (pAdapter2) { - hTreeA = TVAddNode(hTree, szDesc, TRUE, IDI_CAPS, DXGIAdapterInfo2, iAdapter, (LPARAM)( pAdapter2 )); + hTreeA = TVAddNode(hTree, szDesc, TRUE, IDI_CAPS, DXGIAdapterInfo2, iAdapter, (LPARAM)(pAdapter2)); } - else if ( pAdapter1 ) + else if (pAdapter1) { - hTreeA = TVAddNode(hTree, szDesc, TRUE, IDI_CAPS, DXGIAdapterInfo1, iAdapter, (LPARAM)( pAdapter1 )); + hTreeA = TVAddNode(hTree, szDesc, TRUE, IDI_CAPS, DXGIAdapterInfo1, iAdapter, (LPARAM)(pAdapter1)); } else { - hTreeA = TVAddNode(hTree, szDesc, TRUE, IDI_CAPS, DXGIAdapterInfo, iAdapter, (LPARAM)( pAdapter )); + hTreeA = TVAddNode(hTree, szDesc, TRUE, IDI_CAPS, DXGIAdapterInfo, iAdapter, (LPARAM)(pAdapter)); } // Outputs HTREEITEM hTreeO = nullptr; - - IDXGIOutput* pOutput = nullptr; - for(UINT iOutput = 0; ; ++iOutput) - { - hr = pAdapter->EnumOutputs( iOutput, &pOutput ); - if ( FAILED(hr) ) + IDXGIOutput* pOutput = nullptr; + for (UINT iOutput = 0; ; ++iOutput) + { + hr = pAdapter->EnumOutputs(iOutput, &pOutput); + + if (FAILED(hr)) break; - if ( iOutput == 0 ) + if (iOutput == 0) { - hTreeO = TVAddNode(hTreeA, "Outputs", TRUE, IDI_CAPS, DXGIFeatures, 0, 0 ); + hTreeO = TVAddNode(hTreeA, "Outputs", TRUE, IDI_CAPS, DXGIFeatures, 0, 0); } DXGI_OUTPUT_DESC oDesc; - pOutput->GetDesc( &oDesc ); + pOutput->GetDesc(&oDesc); char szDeviceName[32]; - wcstombs( szDeviceName, oDesc.DeviceName, 32 ); + wcstombs_s(nullptr, szDeviceName, oDesc.DeviceName, 32); - HTREEITEM hTreeD = TVAddNode( hTreeO, szDeviceName, TRUE, IDI_CAPS, DXGIOutputInfo, iOutput, (LPARAM)pOutput ); + HTREEITEM hTreeD = TVAddNode(hTreeO, szDeviceName, TRUE, IDI_CAPS, DXGIOutputInfo, iOutput, (LPARAM)pOutput); - TVAddNode( hTreeD, "Display Modes", FALSE, IDI_CAPS, DXGIOutputModes, iOutput, (LPARAM)pOutput); + TVAddNode(hTreeD, "Display Modes", FALSE, IDI_CAPS, DXGIOutputModes, iOutput, (LPARAM)pOutput); } // Direct3D 10.x #ifdef EXTRA_DEBUG - OutputDebugStringA( "Direct3D 10.x\n" ); + OutputDebugStringA("Direct3D 10.x\n"); #endif ID3D10Device* pDevice10 = nullptr; ID3D10Device1* pDevice10_1 = nullptr; DWORD flMaskDX10 = 0; - if ( g_D3D10CreateDevice1 != nullptr ) + if (g_D3D10CreateDevice1) { // Since 10 & 10.1 are so close, try to create just one device object for both... - static const D3D10_FEATURE_LEVEL1 lvl[] = { D3D10_FEATURE_LEVEL_10_1, D3D10_FEATURE_LEVEL_10_0, - D3D10_FEATURE_LEVEL_9_3, D3D10_FEATURE_LEVEL_9_2, D3D10_FEATURE_LEVEL_9_1 }; + static const D3D10_FEATURE_LEVEL1 lvl[] = + { + D3D10_FEATURE_LEVEL_10_1, D3D10_FEATURE_LEVEL_10_0, + D3D10_FEATURE_LEVEL_9_3, D3D10_FEATURE_LEVEL_9_2, D3D10_FEATURE_LEVEL_9_1 + }; // Test every feature-level since some devices might be missing some D3D10_FEATURE_LEVEL1 flHigh = (D3D10_FEATURE_LEVEL1)0; - for(UINT i=0; i < _countof(lvl); ++i) + for (UINT i = 0; i < _countof(lvl); ++i) { - if ( g_DXGIFactory1 == 0 ) + if (g_DXGIFactory1 == 0) { // Skip 10level9 if using DXGI 1.0 - if ( lvl[i] == D3D10_FEATURE_LEVEL_9_1 - || lvl[i] == D3D10_FEATURE_LEVEL_9_2 - || lvl[i] == D3D10_FEATURE_LEVEL_9_3 ) + if (lvl[i] == D3D10_FEATURE_LEVEL_9_1 + || lvl[i] == D3D10_FEATURE_LEVEL_9_2 + || lvl[i] == D3D10_FEATURE_LEVEL_9_3) continue; } #ifdef EXTRA_DEBUG - OutputDebugString( FLName( lvl[i] ) ); + OutputDebugString(FLName(lvl[i])); #endif - hr = g_D3D10CreateDevice1( pAdapter, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, lvl[i], D3D10_1_SDK_VERSION, &pDevice10_1 ); - if ( SUCCEEDED(hr) ) + hr = g_D3D10CreateDevice1(pAdapter, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, lvl[i], D3D10_1_SDK_VERSION, &pDevice10_1); + if (SUCCEEDED(hr)) { #ifdef EXTRA_DEBUG - OutputDebugString( ": Success\n"); + OutputDebugString(": Success\n"); #endif - switch( lvl[i] ) + switch (lvl[i]) { case D3D10_FEATURE_LEVEL_9_1: flMaskDX10 |= FLMASK_9_1; break; case D3D10_FEATURE_LEVEL_9_2: flMaskDX10 |= FLMASK_9_2; break; @@ -5272,20 +5241,20 @@ VOID DXGI_FillTree( HWND hwndTV ) case D3D10_FEATURE_LEVEL_10_1: flMaskDX10 |= FLMASK_10_1; break; } - if ( lvl[i] > flHigh ) + if (lvl[i] > flHigh) flHigh = lvl[i]; } else { #ifdef EXTRA_DEBUG - char buff[64]={}; + char buff[64] = {}; sprintf_s(buff, ": Failed (%08X)\n", hr); - OutputDebugStringA( buff ); + OutputDebugStringA(buff); #endif pDevice10_1 = nullptr; } - if ( pDevice10_1 ) + if (pDevice10_1) { pDevice10_1->Release(); pDevice10_1 = nullptr; @@ -5294,13 +5263,13 @@ VOID DXGI_FillTree( HWND hwndTV ) if (flHigh > 0) { - hr = g_D3D10CreateDevice1( pAdapter, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, flHigh, D3D10_1_SDK_VERSION, &pDevice10_1 ); - if ( SUCCEEDED(hr) ) + hr = g_D3D10CreateDevice1(pAdapter, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, flHigh, D3D10_1_SDK_VERSION, &pDevice10_1); + if (SUCCEEDED(hr)) { - if ( flHigh >= D3D10_FEATURE_LEVEL_10_0 ) + if (flHigh >= D3D10_FEATURE_LEVEL_10_0) { - hr = pDevice10_1->QueryInterface( IID_PPV_ARGS( &pDevice10 ) ); - if ( FAILED(hr) ) + hr = pDevice10_1->QueryInterface(IID_PPV_ARGS(&pDevice10)); + if (FAILED(hr)) pDevice10 = nullptr; } } @@ -5310,24 +5279,24 @@ VOID DXGI_FillTree( HWND hwndTV ) } } } - else if ( g_D3D10CreateDevice != nullptr ) + else if (g_D3D10CreateDevice) { - hr = g_D3D10CreateDevice( pAdapter, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, D3D10_SDK_VERSION, &pDevice10 ); - if ( FAILED(hr) ) + hr = g_D3D10CreateDevice(pAdapter, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, D3D10_SDK_VERSION, &pDevice10); + if (FAILED(hr)) pDevice10 = nullptr; } // Direct3D 10 - if ( pDevice10 != nullptr ) - D3D10_FillTree( hTreeA, pDevice10, D3D_DRIVER_TYPE_HARDWARE ); + if (pDevice10) + D3D10_FillTree(hTreeA, pDevice10, D3D_DRIVER_TYPE_HARDWARE); // Direct3D 10.1 (includes 10level9 feature levels) - if ( pDevice10_1 != nullptr ) - D3D10_FillTree1( hTreeA, pDevice10_1, flMaskDX10, D3D_DRIVER_TYPE_HARDWARE ); + if (pDevice10_1) + D3D10_FillTree1(hTreeA, pDevice10_1, flMaskDX10, D3D_DRIVER_TYPE_HARDWARE); // Direct3D 11.x #ifdef EXTRA_DEBUG - OutputDebugStringA( "Direct3D 11.x\n" ); + OutputDebugStringA("Direct3D 11.x\n"); #endif ID3D11Device* pDevice11 = nullptr; @@ -5340,19 +5309,19 @@ VOID DXGI_FillTree( HWND hwndTV ) { D3D_FEATURE_LEVEL flHigh = (D3D_FEATURE_LEVEL)0; - for(UINT i=0; i < _countof(g_featureLevels); ++i) + for (UINT i = 0; i < _countof(g_featureLevels); ++i) { #ifdef EXTRA_DEBUG - OutputDebugString( FLName( g_featureLevels[i] ) ); + OutputDebugString(FLName(g_featureLevels[i])); #endif - hr = g_D3D11CreateDevice( pAdapter1, D3D_DRIVER_TYPE_UNKNOWN, nullptr, 0, &g_featureLevels[ i ], 1, - D3D11_SDK_VERSION, &pDevice11, nullptr, nullptr ); - if ( SUCCEEDED(hr) ) + hr = g_D3D11CreateDevice(pAdapter1, D3D_DRIVER_TYPE_UNKNOWN, nullptr, 0, &g_featureLevels[i], 1, + D3D11_SDK_VERSION, &pDevice11, nullptr, nullptr); + if (SUCCEEDED(hr)) { #ifdef EXTRA_DEBUG - OutputDebugString( ": Success\n"); + OutputDebugString(": Success\n"); #endif - switch(g_featureLevels[i]) + switch (g_featureLevels[i]) { case D3D_FEATURE_LEVEL_9_1: flMaskDX11 |= FLMASK_9_1; break; case D3D_FEATURE_LEVEL_9_2: flMaskDX11 |= FLMASK_9_2; break; @@ -5365,24 +5334,24 @@ VOID DXGI_FillTree( HWND hwndTV ) case D3D_FEATURE_LEVEL_12_1: flMaskDX11 |= FLMASK_12_1; break; } - if ( g_featureLevels[i] > flHigh ) + if (g_featureLevels[i] > flHigh) flHigh = g_featureLevels[i]; } else { #ifdef EXTRA_DEBUG - char buff[64]={}; + char buff[64] = {}; sprintf_s(buff, ": Failed (%08X)\n", hr); - OutputDebugStringA( buff ); + OutputDebugStringA(buff); #endif pDevice11 = nullptr; } - if ( pDevice11 ) + if (pDevice11) { // Some Intel Integrated Graphics WDDM 1.0 drivers will crash if you try to release here // For this application, leaking a few device instances is not a big deal - if ( aDesc.VendorId != 0x8086 ) + if (aDesc.VendorId != 0x8086) pDevice11->Release(); pDevice11 = nullptr; @@ -5391,75 +5360,75 @@ VOID DXGI_FillTree( HWND hwndTV ) if (flHigh > 0) { - hr = g_D3D11CreateDevice( pAdapter1, D3D_DRIVER_TYPE_UNKNOWN, nullptr, 0, &flHigh, 1, - D3D11_SDK_VERSION, &pDevice11, nullptr, nullptr ); - - if ( SUCCEEDED(hr) ) + hr = g_D3D11CreateDevice(pAdapter1, D3D_DRIVER_TYPE_UNKNOWN, nullptr, 0, &flHigh, 1, + D3D11_SDK_VERSION, &pDevice11, nullptr, nullptr); + + if (SUCCEEDED(hr)) { - hr = pDevice11->QueryInterface( IID_PPV_ARGS( &pDevice11_1 ) ); - if ( FAILED(hr) ) + hr = pDevice11->QueryInterface(IID_PPV_ARGS(&pDevice11_1)); + if (FAILED(hr)) pDevice11_1 = nullptr; - hr = pDevice11->QueryInterface( IID_PPV_ARGS( &pDevice11_2 ) ); - if ( FAILED(hr) ) + hr = pDevice11->QueryInterface(IID_PPV_ARGS(&pDevice11_2)); + if (FAILED(hr)) pDevice11_2 = nullptr; - hr = pDevice11->QueryInterface( IID_PPV_ARGS( &pDevice11_3 ) ); - if ( FAILED(hr) ) + hr = pDevice11->QueryInterface(IID_PPV_ARGS(&pDevice11_3)); + if (FAILED(hr)) pDevice11_3 = nullptr; - hr = pDevice11->QueryInterface( IID_PPV_ARGS( &pDevice11_4 ) ); - if ( FAILED(hr) ) + hr = pDevice11->QueryInterface(IID_PPV_ARGS(&pDevice11_4)); + if (FAILED(hr)) pDevice11_4 = nullptr; } - else if ( FAILED(hr) ) + else if (FAILED(hr)) pDevice11 = nullptr; } } - - if ( pDevice11 != nullptr ) - D3D11_FillTree( hTreeA, pDevice11, flMaskDX11, D3D_DRIVER_TYPE_HARDWARE ); - if ( pDevice11_1 != nullptr ) - D3D11_FillTree1( hTreeA, pDevice11_1, flMaskDX11, D3D_DRIVER_TYPE_HARDWARE ); + if (pDevice11) + D3D11_FillTree(hTreeA, pDevice11, flMaskDX11, D3D_DRIVER_TYPE_HARDWARE); - if ( pDevice11_2 ) - D3D11_FillTree2( hTreeA, pDevice11_2, flMaskDX11, D3D_DRIVER_TYPE_HARDWARE ); + if (pDevice11_1) + D3D11_FillTree1(hTreeA, pDevice11_1, flMaskDX11, D3D_DRIVER_TYPE_HARDWARE); - if ( pDevice11_3 ) - D3D11_FillTree3( hTreeA, pDevice11_3, pDevice11_4, flMaskDX11, D3D_DRIVER_TYPE_HARDWARE ); + if (pDevice11_2) + D3D11_FillTree2(hTreeA, pDevice11_2, flMaskDX11, D3D_DRIVER_TYPE_HARDWARE); + + if (pDevice11_3) + D3D11_FillTree3(hTreeA, pDevice11_3, pDevice11_4, flMaskDX11, D3D_DRIVER_TYPE_HARDWARE); // Direct3D 12 #ifdef EXTRA_DEBUG - OutputDebugStringA( "Direct3D 12\n" ); + OutputDebugStringA("Direct3D 12\n"); #endif - ID3D12Device* pDevice12 = nullptr; + ID3D12Device* pDevice12 = nullptr; ID3D12Device1* pDevice12_1 = nullptr; if (pAdapter3 != 0 && g_D3D12CreateDevice != 0) { - hr = g_D3D12CreateDevice( pAdapter3, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS( &pDevice12 ) ); - if ( SUCCEEDED(hr) ) + hr = g_D3D12CreateDevice(pAdapter3, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&pDevice12)); + if (SUCCEEDED(hr)) { #ifdef EXTRA_DEBUG D3D_FEATURE_LEVEL fl = GetD3D12FeatureLevel(pDevice12); - OutputDebugString( FLName( fl ) ); + OutputDebugString(FLName(fl)); #endif - hr = pDevice12->QueryInterface( IID_PPV_ARGS( &pDevice12_1) ); - if ( FAILED(hr) ) + hr = pDevice12->QueryInterface(IID_PPV_ARGS(&pDevice12_1)); + if (FAILED(hr)) pDevice12_1 = nullptr; #ifdef EXTRA_DEBUG - OutputDebugString( ": Succeeded\n" ); + OutputDebugString(": Succeeded\n"); #endif - D3D12_FillTree( hTreeA, pDevice12, pDevice12_1, D3D_DRIVER_TYPE_HARDWARE ); + D3D12_FillTree(hTreeA, pDevice12, pDevice12_1, D3D_DRIVER_TYPE_HARDWARE); } else { #ifdef EXTRA_DEBUG - char buff[64]={}; + char buff[64] = {}; sprintf_s(buff, ": Failed (%08X)\n", hr); - OutputDebugStringA( buff ); + OutputDebugStringA(buff); #endif pDevice12 = nullptr; } @@ -5469,98 +5438,98 @@ VOID DXGI_FillTree( HWND hwndTV ) // WARP DWORD flMaskWARP = FLMASK_9_1 | FLMASK_9_2 | FLMASK_9_3 | FLMASK_10_0 | FLMASK_10_1; ID3D10Device1* pDeviceWARP10 = nullptr; - if ( g_D3D10CreateDevice1 != nullptr ) + if (g_D3D10CreateDevice1) { #ifdef EXTRA_DEBUG - OutputDebugString( "WARP10\n" ); + OutputDebugString("WARP10\n"); #endif - hr = g_D3D10CreateDevice1( nullptr, D3D10_DRIVER_TYPE_WARP, nullptr, 0, D3D10_FEATURE_LEVEL_10_1, - D3D10_1_SDK_VERSION, &pDeviceWARP10 ); - if ( FAILED(hr) ) + hr = g_D3D10CreateDevice1(nullptr, D3D10_DRIVER_TYPE_WARP, nullptr, 0, D3D10_FEATURE_LEVEL_10_1, + D3D10_1_SDK_VERSION, &pDeviceWARP10); + if (FAILED(hr)) pDeviceWARP10 = nullptr; } - + ID3D11Device* pDeviceWARP11 = nullptr; ID3D11Device1* pDeviceWARP11_1 = nullptr; ID3D11Device2* pDeviceWARP11_2 = nullptr; ID3D11Device3* pDeviceWARP11_3 = nullptr; ID3D11Device4* pDeviceWARP11_4 = nullptr; - if ( g_D3D11CreateDevice != nullptr ) + if (g_D3D11CreateDevice) { #ifdef EXTRA_DEBUG - OutputDebugString( "WARP11\n" ); + OutputDebugString("WARP11\n"); #endif D3D_FEATURE_LEVEL fl; - hr = g_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_WARP, nullptr, 0, g_featureLevels, _countof(g_featureLevels), - D3D11_SDK_VERSION, &pDeviceWARP11, &fl, nullptr ); - if ( FAILED(hr) ) + hr = g_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_WARP, nullptr, 0, g_featureLevels, _countof(g_featureLevels), + D3D11_SDK_VERSION, &pDeviceWARP11, &fl, nullptr); + if (FAILED(hr)) { // Try without 12.1 or 12.0 - hr = g_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_WARP, nullptr, 0, &g_featureLevels[2], _countof(g_featureLevels) - 2, - D3D11_SDK_VERSION, &pDeviceWARP11, &fl, nullptr ); + hr = g_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_WARP, nullptr, 0, &g_featureLevels[2], _countof(g_featureLevels) - 2, + D3D11_SDK_VERSION, &pDeviceWARP11, &fl, nullptr); - if ( FAILED(hr) ) + if (FAILED(hr)) { - hr = g_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_WARP, nullptr, 0, nullptr, 0, - D3D11_SDK_VERSION, &pDeviceWARP11, &fl, nullptr ); + hr = g_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_WARP, nullptr, 0, nullptr, 0, + D3D11_SDK_VERSION, &pDeviceWARP11, &fl, nullptr); } } - if ( FAILED(hr) ) + if (FAILED(hr)) pDeviceWARP11 = nullptr; else { #ifdef EXTRA_DEBUG - OutputDebugString( FLName( fl ) ); + OutputDebugString(FLName(fl)); #endif - if ( fl >= D3D_FEATURE_LEVEL_12_1 ) + if (fl >= D3D_FEATURE_LEVEL_12_1) flMaskWARP |= FLMASK_12_1; - if ( fl >= D3D_FEATURE_LEVEL_12_0 ) + if (fl >= D3D_FEATURE_LEVEL_12_0) flMaskWARP |= FLMASK_12_0; - if ( fl >= D3D_FEATURE_LEVEL_11_1 ) + if (fl >= D3D_FEATURE_LEVEL_11_1) flMaskWARP |= FLMASK_11_1; - if ( fl >= D3D_FEATURE_LEVEL_11_0 ) + if (fl >= D3D_FEATURE_LEVEL_11_0) flMaskWARP |= FLMASK_11_0; - hr = pDeviceWARP11->QueryInterface( IID_PPV_ARGS( &pDeviceWARP11_1 ) ); - if ( FAILED(hr) ) + hr = pDeviceWARP11->QueryInterface(IID_PPV_ARGS(&pDeviceWARP11_1)); + if (FAILED(hr)) pDeviceWARP11_1 = nullptr; - hr = pDeviceWARP11->QueryInterface( IID_PPV_ARGS( &pDeviceWARP11_2 ) ); - if ( FAILED(hr) ) + hr = pDeviceWARP11->QueryInterface(IID_PPV_ARGS(&pDeviceWARP11_2)); + if (FAILED(hr)) pDeviceWARP11_2 = nullptr; - hr = pDeviceWARP11->QueryInterface( IID_PPV_ARGS( &pDeviceWARP11_3 ) ); - if ( FAILED(hr) ) + hr = pDeviceWARP11->QueryInterface(IID_PPV_ARGS(&pDeviceWARP11_3)); + if (FAILED(hr)) pDeviceWARP11_3 = nullptr; - hr = pDeviceWARP11->QueryInterface( IID_PPV_ARGS( &pDeviceWARP11_4 ) ); - if ( FAILED(hr) ) + hr = pDeviceWARP11->QueryInterface(IID_PPV_ARGS(&pDeviceWARP11_4)); + if (FAILED(hr)) pDeviceWARP11_4 = nullptr; } } - ID3D12Device* pDeviceWARP12 = nullptr; + ID3D12Device* pDeviceWARP12 = nullptr; ID3D12Device1* pDeviceWARP12_1 = nullptr; if (g_D3D12CreateDevice != 0 && g_DXGIFactory4 != 0) { #ifdef EXTRA_DEBUG - OutputDebugString( "WARP12\n" ); + OutputDebugString("WARP12\n"); #endif IDXGIAdapter* warpAdapter = nullptr; - hr = g_DXGIFactory4->EnumWarpAdapter( IID_PPV_ARGS(&warpAdapter) ); - if ( SUCCEEDED(hr) ) + hr = g_DXGIFactory4->EnumWarpAdapter(IID_PPV_ARGS(&warpAdapter)); + if (SUCCEEDED(hr)) { - hr = g_D3D12CreateDevice( warpAdapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS( &pDeviceWARP12 ) ); + hr = g_D3D12CreateDevice(warpAdapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&pDeviceWARP12)); if (SUCCEEDED(hr)) { #ifdef EXTRA_DEBUG D3D_FEATURE_LEVEL fl = GetD3D12FeatureLevel(pDeviceWARP12); - OutputDebugString( FLName( fl ) ); + OutputDebugString(FLName(fl)); #endif hr = pDeviceWARP12->QueryInterface(IID_PPV_ARGS(&pDeviceWARP12_1)); if (FAILED(hr)) @@ -5569,9 +5538,9 @@ VOID DXGI_FillTree( HWND hwndTV ) else { #ifdef EXTRA_DEBUG - char buff[64]={}; + char buff[64] = {}; sprintf_s(buff, ": Failed (%08X)\n", hr); - OutputDebugStringA( buff ); + OutputDebugStringA(buff); #endif pDeviceWARP12 = nullptr; } @@ -5581,57 +5550,57 @@ VOID DXGI_FillTree( HWND hwndTV ) #ifdef EXTRA_DEBUG else { - OutputDebugString( "WARP12 adapter not found!\n" ); + OutputDebugString("WARP12 adapter not found!\n"); } #endif } - if ( pDeviceWARP10 || pDeviceWARP11 || pDeviceWARP11_1 || pDeviceWARP11_2 || pDeviceWARP11_3 || pDeviceWARP11_4 || pDeviceWARP12 || pDeviceWARP12_1 ) + if (pDeviceWARP10 || pDeviceWARP11 || pDeviceWARP11_1 || pDeviceWARP11_2 || pDeviceWARP11_3 || pDeviceWARP11_4 || pDeviceWARP12 || pDeviceWARP12_1) { - HTREEITEM hTreeW = TVAddNode(hTree, "Windows Advanced Rasterization Platform (WARP)", TRUE, IDI_CAPS, nullptr, 0, 0 ); + HTREEITEM hTreeW = TVAddNode(hTree, "Windows Advanced Rasterization Platform (WARP)", TRUE, IDI_CAPS, nullptr, 0, 0); - if ( pDeviceWARP10 != nullptr ) - D3D10_FillTree( hTreeW, pDeviceWARP10, D3D_DRIVER_TYPE_WARP ); + if (pDeviceWARP10) + D3D10_FillTree(hTreeW, pDeviceWARP10, D3D_DRIVER_TYPE_WARP); - if ( pDeviceWARP10 != nullptr ) - D3D10_FillTree1( hTreeW, pDeviceWARP10, flMaskWARP, D3D_DRIVER_TYPE_WARP ); + if (pDeviceWARP10) + D3D10_FillTree1(hTreeW, pDeviceWARP10, flMaskWARP, D3D_DRIVER_TYPE_WARP); - if ( pDeviceWARP11 != nullptr ) - D3D11_FillTree( hTreeW, pDeviceWARP11, flMaskWARP, D3D_DRIVER_TYPE_WARP ); + if (pDeviceWARP11) + D3D11_FillTree(hTreeW, pDeviceWARP11, flMaskWARP, D3D_DRIVER_TYPE_WARP); - if ( pDeviceWARP11_1 != nullptr ) - D3D11_FillTree1( hTreeW, pDeviceWARP11_1, flMaskWARP, D3D_DRIVER_TYPE_WARP ); + if (pDeviceWARP11_1) + D3D11_FillTree1(hTreeW, pDeviceWARP11_1, flMaskWARP, D3D_DRIVER_TYPE_WARP); - if ( pDeviceWARP11_2 ) - D3D11_FillTree2( hTreeW, pDeviceWARP11_2, flMaskWARP, D3D_DRIVER_TYPE_WARP ); + if (pDeviceWARP11_2) + D3D11_FillTree2(hTreeW, pDeviceWARP11_2, flMaskWARP, D3D_DRIVER_TYPE_WARP); - if ( pDeviceWARP11_3 ) - D3D11_FillTree3( hTreeW, pDeviceWARP11_3, pDeviceWARP11_4, flMaskWARP, D3D_DRIVER_TYPE_WARP ); + if (pDeviceWARP11_3) + D3D11_FillTree3(hTreeW, pDeviceWARP11_3, pDeviceWARP11_4, flMaskWARP, D3D_DRIVER_TYPE_WARP); - if ( pDeviceWARP12 ) - D3D12_FillTree( hTreeW, pDeviceWARP12, pDeviceWARP12_1, D3D_DRIVER_TYPE_WARP ); + if (pDeviceWARP12) + D3D12_FillTree(hTreeW, pDeviceWARP12, pDeviceWARP12_1, D3D_DRIVER_TYPE_WARP); } // REFERENCE ID3D10Device1* pDeviceREF10_1 = nullptr; ID3D10Device* pDeviceREF10 = nullptr; - if ( g_D3D10CreateDevice1 != nullptr ) + if (g_D3D10CreateDevice1) { - hr = g_D3D10CreateDevice1( nullptr, D3D10_DRIVER_TYPE_REFERENCE, nullptr, 0, D3D10_FEATURE_LEVEL_10_1, - D3D10_1_SDK_VERSION, &pDeviceREF10_1 ); - if ( SUCCEEDED(hr) ) + hr = g_D3D10CreateDevice1(nullptr, D3D10_DRIVER_TYPE_REFERENCE, nullptr, 0, D3D10_FEATURE_LEVEL_10_1, + D3D10_1_SDK_VERSION, &pDeviceREF10_1); + if (SUCCEEDED(hr)) { - hr = pDeviceREF10_1->QueryInterface( IID_PPV_ARGS( &pDeviceREF10 ) ); - if ( FAILED(hr) ) + hr = pDeviceREF10_1->QueryInterface(IID_PPV_ARGS(&pDeviceREF10)); + if (FAILED(hr)) pDeviceREF10 = nullptr; } else pDeviceREF10_1 = nullptr; } - else if ( g_D3D10CreateDevice != nullptr ) + else if (g_D3D10CreateDevice != nullptr) { - hr = g_D3D10CreateDevice( nullptr, D3D10_DRIVER_TYPE_REFERENCE, nullptr, 0, D3D10_SDK_VERSION, &pDeviceREF10 ); - if ( FAILED(hr) ) + hr = g_D3D10CreateDevice(nullptr, D3D10_DRIVER_TYPE_REFERENCE, nullptr, 0, D3D10_SDK_VERSION, &pDeviceREF10); + if (FAILED(hr)) pDeviceREF10 = nullptr; } @@ -5641,68 +5610,68 @@ VOID DXGI_FillTree( HWND hwndTV ) ID3D11Device3* pDeviceREF11_3 = nullptr; ID3D11Device4* pDeviceREF11_4 = nullptr; DWORD flMaskREF = FLMASK_9_1 | FLMASK_9_2 | FLMASK_9_3 | FLMASK_10_0 | FLMASK_10_1 | FLMASK_11_0; - if ( g_D3D11CreateDevice != nullptr ) + if (g_D3D11CreateDevice) { D3D_FEATURE_LEVEL lvl = D3D_FEATURE_LEVEL_11_1; - hr = g_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_REFERENCE, nullptr, 0, &lvl, 1, - D3D11_SDK_VERSION, &pDeviceREF11, nullptr, nullptr ); + hr = g_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_REFERENCE, nullptr, 0, &lvl, 1, + D3D11_SDK_VERSION, &pDeviceREF11, nullptr, nullptr); - if ( SUCCEEDED(hr) ) + if (SUCCEEDED(hr)) { flMaskREF |= FLMASK_11_1; - hr = pDeviceREF11->QueryInterface( IID_PPV_ARGS( &pDeviceREF11_1 ) ); - if ( FAILED(hr) ) + hr = pDeviceREF11->QueryInterface(IID_PPV_ARGS(&pDeviceREF11_1)); + if (FAILED(hr)) pDeviceREF11_1 = nullptr; - hr = pDeviceREF11->QueryInterface( IID_PPV_ARGS( &pDeviceREF11_2 ) ); - if ( FAILED(hr) ) + hr = pDeviceREF11->QueryInterface(IID_PPV_ARGS(&pDeviceREF11_2)); + if (FAILED(hr)) pDeviceREF11_2 = nullptr; - hr = pDeviceREF11->QueryInterface( IID_PPV_ARGS( &pDeviceREF11_3 ) ); - if ( FAILED(hr) ) + hr = pDeviceREF11->QueryInterface(IID_PPV_ARGS(&pDeviceREF11_3)); + if (FAILED(hr)) pDeviceREF11_3 = nullptr; - hr = pDeviceREF11->QueryInterface( IID_PPV_ARGS( &pDeviceREF11_4 ) ); - if ( FAILED(hr) ) + hr = pDeviceREF11->QueryInterface(IID_PPV_ARGS(&pDeviceREF11_4)); + if (FAILED(hr)) pDeviceREF11_4 = nullptr; } else { - hr = g_D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_REFERENCE, nullptr, 0, nullptr, 0, - D3D11_SDK_VERSION, &pDeviceREF11, nullptr, nullptr ); - if ( SUCCEEDED(hr) ) + hr = g_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_REFERENCE, nullptr, 0, nullptr, 0, + D3D11_SDK_VERSION, &pDeviceREF11, nullptr, nullptr); + if (SUCCEEDED(hr)) { - hr = pDeviceREF11->QueryInterface( IID_PPV_ARGS( &pDeviceREF11_1 ) ); - if ( FAILED(hr) ) + hr = pDeviceREF11->QueryInterface(IID_PPV_ARGS(&pDeviceREF11_1)); + if (FAILED(hr)) pDeviceREF11_1 = nullptr; } } } - if ( pDeviceREF10 || pDeviceREF10_1 || pDeviceREF11 || pDeviceREF11_1 || pDeviceREF11_2 || pDeviceREF11_3 ) + if (pDeviceREF10 || pDeviceREF10_1 || pDeviceREF11 || pDeviceREF11_1 || pDeviceREF11_2 || pDeviceREF11_3) { - HTREEITEM hTreeR = TVAddNode(hTree, "Reference", TRUE, IDI_CAPS, nullptr, 0, 0 ); + HTREEITEM hTreeR = TVAddNode(hTree, "Reference", TRUE, IDI_CAPS, nullptr, 0, 0); - if ( pDeviceREF10 != nullptr ) - D3D10_FillTree( hTreeR, pDeviceREF10, D3D_DRIVER_TYPE_REFERENCE ); + if (pDeviceREF10) + D3D10_FillTree(hTreeR, pDeviceREF10, D3D_DRIVER_TYPE_REFERENCE); - if ( pDeviceREF10_1 != nullptr ) - D3D10_FillTree1( hTreeR, pDeviceREF10_1, FLMASK_10_0 | FLMASK_10_1, D3D_DRIVER_TYPE_REFERENCE ); + if (pDeviceREF10_1) + D3D10_FillTree1(hTreeR, pDeviceREF10_1, FLMASK_10_0 | FLMASK_10_1, D3D_DRIVER_TYPE_REFERENCE); - if ( pDeviceREF11 != nullptr ) - D3D11_FillTree( hTreeR, pDeviceREF11, flMaskREF, D3D_DRIVER_TYPE_REFERENCE ); + if (pDeviceREF11) + D3D11_FillTree(hTreeR, pDeviceREF11, flMaskREF, D3D_DRIVER_TYPE_REFERENCE); - if ( pDeviceREF11_1 != nullptr ) - D3D11_FillTree1( hTreeR, pDeviceREF11_1, flMaskREF, D3D_DRIVER_TYPE_REFERENCE ); + if (pDeviceREF11_1) + D3D11_FillTree1(hTreeR, pDeviceREF11_1, flMaskREF, D3D_DRIVER_TYPE_REFERENCE); - if ( pDeviceREF11_2 ) - D3D11_FillTree2( hTreeR, pDeviceREF11_2, flMaskREF, D3D_DRIVER_TYPE_REFERENCE ); + if (pDeviceREF11_2) + D3D11_FillTree2(hTreeR, pDeviceREF11_2, flMaskREF, D3D_DRIVER_TYPE_REFERENCE); - if ( pDeviceREF11_3 ) - D3D11_FillTree3( hTreeR, pDeviceREF11_3, pDeviceREF11_4, flMaskREF, D3D_DRIVER_TYPE_REFERENCE ); + if (pDeviceREF11_3) + D3D11_FillTree3(hTreeR, pDeviceREF11_3, pDeviceREF11_4, flMaskREF, D3D_DRIVER_TYPE_REFERENCE); } - TreeView_Expand( hwndTV, hTree, TVE_EXPAND ); + TreeView_Expand(hwndTV, hTree, TVE_EXPAND); } @@ -5724,31 +5693,31 @@ VOID DXGI_CleanUp() if (g_dxgi) { - FreeLibrary( g_dxgi ); + FreeLibrary(g_dxgi); g_dxgi = nullptr; } - if ( g_d3d10 ) + if (g_d3d10) { - FreeLibrary( g_d3d10 ); + FreeLibrary(g_d3d10); g_d3d10 = nullptr; } - if ( g_d3d10_1 ) + if (g_d3d10_1) { - FreeLibrary( g_d3d10_1 ); + FreeLibrary(g_d3d10_1); g_d3d10_1 = nullptr; } - if ( g_d3d11 ) + if (g_d3d11) { - FreeLibrary( g_d3d11 ); + FreeLibrary(g_d3d11); g_d3d11 = nullptr; } - if ( g_d3d12 ) + if (g_d3d12) { - FreeLibrary( g_d3d12 ); + FreeLibrary(g_d3d12); g_d3d12 = nullptr; } } diff --git a/dxprint.cpp b/dxprint.cpp index 75c4603..88a8109 100644 --- a/dxprint.cpp +++ b/dxprint.cpp @@ -1,748 +1,710 @@ //----------------------------------------------------------------------------- -// Name: DXPrint.cpp +// Name: dxprint.cpp // -// Desc: Print's DX Tree View info to selected printer +// Desc: DirectX Capabilities Viewer Printing Support // // Copyright (c) Microsoft Corporation. All Rights Reserved. //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include // Common Print Dialog -#include // Unicode string functions and types -#include -#include -#include #include "dxview.h" -//----------------------------------------------------------------------------- -// Local Variables -//----------------------------------------------------------------------------- -BOOL g_fAbortPrint = FALSE; // Did User Abort Print operation ?!? -HWND g_hAbortPrintDlg = NULL; // Print Abort Dialog handle -BOOL g_PrintToFile = FALSE; // Don't print to printer print to dxview.log +#include +#include +#include + +BOOL g_PrintToFile = FALSE; // Don't print to printer print to dxview.log TCHAR g_PrintToFilePath[MAX_PATH]; // "Print" to this file instead of dxview.log -HANDLE g_FileHandle = NULL; // Handle to log file - +namespace +{ + BOOL g_fAbortPrint = FALSE; // Did User Abort Print operation ?!? + HWND g_hAbortPrintDlg = nullptr; // Print Abort Dialog handle + HANDLE g_FileHandle = nullptr; // Handle to log file + DWORD iLastXPos = 0; -//----------------------------------------------------------------------------- -// Local Prototypes -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + // Local Prototypes + //----------------------------------------------------------------------------- #define MAX_TITLE 64 #define MAX_MESSAGE 256 -VOID DoMessage( DWORD dwTitle, DWORD dwMsg ); + VOID DoMessage(DWORD dwTitle, DWORD dwMsg); -BOOL CALLBACK PrintTreeStats( HINSTANCE hInstance, HWND hWnd, HWND hTreeWnd, - HTREEITEM hRoot ); + BOOL CALLBACK PrintTreeStats(HINSTANCE hInstance, HWND hWnd, HWND hTreeWnd, + HTREEITEM hRoot); -static DWORD iLastXPos; + + //----------------------------------------------------------------------------- + // Name: PrintDialogProc() + // Desc: Dialog procedure for printing + //----------------------------------------------------------------------------- + BOOL CALLBACK PrintDialogProc(HWND hDlg, UINT msg, WPARAM /*wParam*/, LPARAM /*lParam*/) + { + switch (msg) + { + case WM_INITDIALOG: + // Disable system menu on dialog + EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE, MF_GRAYED); + return TRUE; + + case WM_COMMAND: + // User is aborting print operation + g_fAbortPrint = TRUE; + EnableWindow(GetParent(hDlg), TRUE); + DestroyWindow(hDlg); + g_hAbortPrintDlg = nullptr; + return TRUE; + } + + return FALSE; + } + + + //----------------------------------------------------------------------------- + // Name: AbortProc() + // Desc: Abort procedure for printing + //----------------------------------------------------------------------------- + BOOL CALLBACK AbortProc(HDC /*hPrinterDC*/, int /*iCode*/) + { + MSG msg; + + while (!g_fAbortPrint && PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) + { + if ((!g_hAbortPrintDlg) || !IsDialogMessage(g_hAbortPrintDlg, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return !g_fAbortPrint; + } + + + //----------------------------------------------------------------------------- + // Name: PrintStartPage + // Desc: Check if we need to start a new page + //----------------------------------------------------------------------------- + HRESULT PrintStartPage(_In_ PRINTCBINFO* pci) + { + if (g_PrintToFile) + return S_OK; + + if (!pci) + return E_FAIL; + + // Check if we need to start a new page + if (pci->fStartPage) + { + // Check for user abort + if (g_fAbortPrint) + return E_FAIL; + + // Start new page + if (StartPage(pci->hdcPrint) < 0) + return E_FAIL; + + // Reset line count + pci->fStartPage = FALSE; + pci->dwCurrLine = 0; + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + // Name: PrintEndPage() + // Desc: Check if we need to start a new page + //----------------------------------------------------------------------------- + HRESULT PrintEndPage(_In_ PRINTCBINFO* pci) + { + if (g_PrintToFile) + return S_OK; + + if (!pci) + return E_FAIL; + + // Check if we need to end this page + if (!pci->fStartPage) + { + // End page + if (EndPage(pci->hdcPrint) < 0) + return E_FAIL; + + pci->fStartPage = TRUE; + + // Check for user abort + if (g_fAbortPrint) + return E_FAIL; + } + + return S_OK; + } + + + //----------------------------------------------------------------------------- + // Name: DoMessage() + // Desc: Display warning message to user + //----------------------------------------------------------------------------- + VOID DoMessage(DWORD dwTitle, DWORD dwMsg) + { + TCHAR strTitle[MAX_TITLE]; + TCHAR strMsg[MAX_MESSAGE]; + + LoadString(GetModuleHandle(nullptr), dwTitle, strTitle, MAX_TITLE); + LoadString(GetModuleHandle(nullptr), dwMsg, strMsg, MAX_MESSAGE); + MessageBox(nullptr, strMsg, strTitle, MB_OK); + } + + + //----------------------------------------------------------------------------- + // Name: PrintStats() + // Desc: Print user defined stuff + //----------------------------------------------------------------------------- + BOOL CALLBACK PrintTreeStats(HINSTANCE hInstance, HWND hWnd, HWND hTreeWnd, + HTREEITEM hRoot) + { + static DOCINFO di; + static PRINTDLG pd = {}; + + // Check Parameters + if (!hInstance || !hWnd || !hTreeWnd) + return FALSE; + + // Get Starting point for tree + HTREEITEM hStartTree = (hRoot) ? hRoot : TreeView_GetRoot(hTreeWnd); + if (!hStartTree) + return FALSE; + + BOOL fDone = FALSE; + BOOL fFindNext = FALSE; + BOOL fResult = FALSE; + BOOL fStartDoc = FALSE; + BOOL fDisableWindow = FALSE; + LPTSTR pstrTitle = nullptr; + LPTSTR pstrBuff = nullptr; + DWORD dwCurrCopy; + HANDLE hHeap = nullptr; + DWORD buffSize; + DWORD cchLen; + TV_ITEM tvi; + + // Initialize Print Dialog structure + pd.lStructSize = sizeof(PRINTDLG); + pd.hwndOwner = hWnd; + pd.Flags = PD_ALLPAGES | PD_RETURNDC; + pd.nCopies = 1; + + PRINTCBINFO pci = {}; + TEXTMETRIC tm = {}; + if (g_PrintToFile) + { + pci.hdcPrint = nullptr; + } + else + { + // Call Common Print Dialog to get printer DC + if (!PrintDlg(&pd) || !pd.hDC) + { + // Print Dialog failed or user canceled + return TRUE; + } + + pci.hdcPrint = pd.hDC; + // Get Text metrics for printing + if (!GetTextMetrics(pci.hdcPrint, &tm)) + { + // Error, TextMetrics failed + goto lblCLEANUP; + } + } + + if (g_PrintToFile) + { + pci.dwLineHeight = 1; + pci.dwCharWidth = 1; + pci.dwCharsPerLine = 80; + pci.dwLinesPerPage = 66; + } + else + { + pci.dwLineHeight = tm.tmHeight + tm.tmExternalLeading; + pci.dwCharWidth = tm.tmAveCharWidth; + pci.dwCharsPerLine = GetDeviceCaps(pci.hdcPrint, HORZRES) / pci.dwCharWidth; + pci.dwLinesPerPage = GetDeviceCaps(pci.hdcPrint, VERTRES) / pci.dwLineHeight; + } + + // Get Heap + hHeap = GetProcessHeap(); + if (!hHeap) + { + // Error, no heap associated with this process + goto lblCLEANUP; + } + + // Create line buffer + buffSize = (pci.dwCharsPerLine + 1) * sizeof(TCHAR); + pstrBuff = (LPTSTR)HeapAlloc(hHeap, HEAP_NO_SERIALIZE, buffSize); + if (!pstrBuff) + { + // Error, not enough memory + goto lblCLEANUP; + } + + *pstrBuff = 0; + + // Disable Parent window + EnableWindow(hWnd, FALSE); + fDisableWindow = TRUE; + + // Start Printer Abort Dialog + g_fAbortPrint = FALSE; + g_hAbortPrintDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_ABORTPRINTDLG), + hWnd, (DLGPROC)PrintDialogProc); + if (!g_hAbortPrintDlg) + { + // Error, unable to create abort dialog + goto lblCLEANUP; + } + + // + // Set Document title to Root string + // + tvi.mask = TVIF_CHILDREN | TVIF_TEXT; + tvi.hItem = hStartTree; + tvi.pszText = pstrBuff; + tvi.cchTextMax = pci.dwCharsPerLine; + if (TreeView_GetItem(hTreeWnd, &tvi)) + { + SetWindowText(g_hAbortPrintDlg, pstrBuff); + SetAbortProc(pd.hDC, AbortProc); + cchLen = static_cast(_tcsclen(pstrBuff)); + DWORD cbSize = (cchLen + 1) * sizeof(TCHAR); + pstrTitle = (LPTSTR)HeapAlloc(hHeap, HEAP_NO_SERIALIZE, cbSize); + if (!pstrTitle) + { + // Error, not enough memory + goto lblCLEANUP; + } + + strcpy_s(pstrTitle, cbSize, pstrBuff); + pstrTitle[cchLen] = 0; + } + else + { + SetWindowText(g_hAbortPrintDlg, TEXT("Unknown")); + SetAbortProc(pd.hDC, AbortProc); + cchLen = static_cast(_tcsclen(TEXT("Unknown"))); + DWORD cbSize = (cchLen + 1) * sizeof(TCHAR); + pstrTitle = (LPTSTR)HeapAlloc(hHeap, HEAP_NO_SERIALIZE, cbSize); + if (!pstrTitle) + { + // Error, not enough memory + goto lblCLEANUP; + } + + strcpy_s(pstrTitle, cbSize, TEXT("Unknown")); + pstrTitle[cchLen] = 0; + } + + // Initialize Document Structure + di.cbSize = sizeof(DOCINFO); + di.lpszDocName = pstrTitle; + di.lpszOutput = nullptr; + di.lpszDatatype = nullptr; + di.fwType = 0; + + // Start document + if (g_PrintToFile) + { + const TCHAR* pstrFile; + TCHAR buff[MAX_PATH]; + if (strlen(g_PrintToFilePath) > 0) + pstrFile = g_PrintToFilePath; + else + { + HRESULT hr = SHGetFolderPath(nullptr, CSIDL_DESKTOP, nullptr, SHGFP_TYPE_CURRENT, buff); + if (SUCCEEDED(hr)) + { + strcat_s(buff, MAX_PATH, TEXT("\\dxview.log")); + pstrFile = buff; + } + else + pstrFile = TEXT("dxview.log"); + } + g_FileHandle = CreateFile(pstrFile, GENERIC_WRITE, 0, nullptr, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + } + else + if (StartDoc(pd.hDC, &di) < 0) + { + // Error, StartDoc failed + goto lblCLEANUP; + } + fStartDoc = TRUE; + + // Print requested number of copies + fResult = FALSE; + for (dwCurrCopy = 0; dwCurrCopy < (DWORD)pd.nCopies; dwCurrCopy++) + { + + pci.hCurrTree = hStartTree; + pci.fStartPage = TRUE; + pci.dwCurrIndent = 0; + + + // Note: We are basically doing an pre-order traversal + // of the Tree. Printing the current node + // before moving on to it's children or siblings + + fDone = FALSE; + while (!fDone) + { + // Check if we need to start a new page + if (FAILED(PrintStartPage(&pci))) + { + goto lblCLEANUP; + } + + // + // Get Current Item in Tree + // and print it's text info and associated Node caps + // + + tvi.mask = TVIF_CHILDREN | TVIF_TEXT | TVIF_PARAM; + tvi.hItem = pci.hCurrTree; + tvi.pszText = pstrBuff; + tvi.lParam = 0; + tvi.cchTextMax = pci.dwCharsPerLine; + if (TreeView_GetItem(hTreeWnd, &tvi)) + { + cchLen = static_cast(_tcslen(pstrBuff)); + cchLen = __min(cchLen, buffSize); + if (cchLen > 0) + { + int xOffset = (int)(pci.dwCurrIndent * DEF_TAB_SIZE * pci.dwCharWidth); + int yOffset = (int)(pci.dwLineHeight * pci.dwCurrLine); + + // Print this line + if (FAILED(PrintLine(xOffset, yOffset, pstrBuff, cchLen, &pci))) + { + goto lblCLEANUP; + } + + // Advance to next line in page + if (FAILED(PrintNextLine(&pci))) + { + goto lblCLEANUP; + } + + // Check if there is any additional node info + // that needs to be printed + if (tvi.lParam != 0) + { + NODEINFO* pni = (NODEINFO*)tvi.lParam; + + if (pni && pni->fnDisplayCallback) + { + // Force indent to offset node info from tree info + pci.dwCurrIndent += 2; + + if (pni->bUseLParam3) + { + if (FAILED(((DISPLAYCALLBACKEX)(pni->fnDisplayCallback))(pni->lParam1, pni->lParam2, pni->lParam3, &pci))) + { + // Error, callback failed + goto lblCLEANUP; + } + } + else + { + if (FAILED(pni->fnDisplayCallback(pni->lParam1, pni->lParam2, &pci))) + { + // Error, callback failed + goto lblCLEANUP; + } + } + + // Recover indent + pci.dwCurrIndent -= 2; + } + } + } + } // End if TreeView_GetItem() + // + // Get Next Item in tree + // + + // Get first child, if any + if (tvi.cChildren) + { + // Get First child + HTREEITEM hTempTree = TreeView_GetChild(hTreeWnd, pci.hCurrTree); + if (hTempTree) + { + // Increase Indentation + pci.dwCurrIndent++; + + pci.hCurrTree = hTempTree; + continue; + } + } + + // Exit, if we are the root + if (pci.hCurrTree == hRoot) + { + // We have reached the root, so stop + PrintEndPage(&pci); + fDone = TRUE; + continue; + } + + // Get next sibling in the chain + HTREEITEM hTempTree = TreeView_GetNextSibling(hTreeWnd, pci.hCurrTree); + if (hTempTree) + { + pci.hCurrTree = hTempTree; + continue; + } + + // Get next Ancestor yet to be processed + // (uncle, granduncle, etc) + fFindNext = FALSE; + while (!fFindNext) + { + hTempTree = TreeView_GetParent(hTreeWnd, pci.hCurrTree); + if ((!hTempTree) || (hTempTree == hRoot)) + { + // We have reached the root, so stop + PrintEndPage(&pci); + fDone = TRUE; + fFindNext = TRUE; + } + else + { + // Move up to the parent + pci.hCurrTree = hTempTree; + + // Decrease Indentation + pci.dwCurrIndent--; + + // Since we have already processed the parent + // we want to get the uncle/aunt node + hTempTree = TreeView_GetNextSibling(hTreeWnd, pci.hCurrTree); + if (hTempTree) + { + // Found a non-processed node + pci.hCurrTree = hTempTree; + fFindNext = TRUE; + } + } + } + } // End While (! fDone) + } // End for num copies + + // Success + fResult = TRUE; + + lblCLEANUP: + // End Document + if (fStartDoc) + { + if (g_PrintToFile) + { + CloseHandle(g_FileHandle); + } + else + EndDoc(pd.hDC); + fStartDoc = FALSE; + } + + // Re-enable main window + // Note: Do this before destroying abort dialog + // otherwise the main window loses focus + if (fDisableWindow) + { + EnableWindow(hWnd, TRUE); + fDisableWindow = FALSE; + } + + // Destroy Abort Dialog + if (g_hAbortPrintDlg) + { + DestroyWindow(g_hAbortPrintDlg); + g_hAbortPrintDlg = nullptr; + } + + // Free title memory + if (pstrTitle) + { + HeapFree(hHeap, 0, (VOID*)pstrTitle); + pstrTitle = nullptr; + di.lpszDocName = nullptr; + } + + // Free buffer memory + if (pstrBuff) + { + HeapFree(hHeap, 0, (VOID*)pstrBuff); + pstrBuff = nullptr; + } + + // Cleanup printer DC + if (pd.hDC) + { + DeleteDC(pd.hDC); + pd.hDC = nullptr; + } + + return fResult; + } +} //----------------------------------------------------------------------------- // Name: DXView_OnPrint() // Desc: Print user defined stuff //----------------------------------------------------------------------------- -BOOL DXView_OnPrint( HWND hWnd, HWND hTreeWnd, BOOL bPrintAll ) +BOOL DXView_OnPrint(HWND hWnd, HWND hTreeWnd, BOOL bPrintAll) { HINSTANCE hInstance; HTREEITEM hRoot; // Check Parameters - if( NULL==hWnd || NULL==hTreeWnd ) + if (!hWnd || !hTreeWnd) return FALSE; // Get hInstance -#ifdef _WIN64 - hInstance = (HINSTANCE)GetWindowLongPtr( hWnd, GWLP_HINSTANCE ); -#else - hInstance = (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE ); -#endif - if( NULL == hInstance ) + hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); + if (!hInstance) return FALSE; - if( bPrintAll ) + if (bPrintAll) { - hRoot = NULL; + hRoot = nullptr; } else { - hRoot = TreeView_GetSelection( hTreeWnd ) ; - if( NULL == hRoot ) - DoMessage( IDS_PRINT_WARNING, IDS_PRINT_NEEDSELECT ); + hRoot = TreeView_GetSelection(hTreeWnd); + if (!hRoot) + DoMessage(IDS_PRINT_WARNING, IDS_PRINT_NEEDSELECT); } g_PrintToFile = FALSE; - + // Do actual printing - return PrintTreeStats( hInstance, hWnd, hTreeWnd, hRoot ); + return PrintTreeStats(hInstance, hWnd, hTreeWnd, hRoot); } - - //----------------------------------------------------------------------------- // Name: DXView_OnFile() -// Desc: //----------------------------------------------------------------------------- -BOOL DXView_OnFile( HWND hWnd, HWND hTreeWnd, BOOL bPrintAll ) +BOOL DXView_OnFile(HWND hWnd, HWND hTreeWnd, BOOL bPrintAll) { HINSTANCE hInstance; HTREEITEM hRoot; // Check Parameters - if( NULL==hWnd || NULL==hTreeWnd ) + if (!hWnd || !hTreeWnd) return FALSE; // Get hInstance -#ifdef _WIN64 - hInstance = (HINSTANCE)GetWindowLongPtr( hWnd, GWLP_HINSTANCE ); -#else - hInstance = (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE ); -#endif - if( NULL == hInstance ) + hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); + if (!hInstance) return FALSE; - if( bPrintAll ) + if (bPrintAll) { - hRoot = NULL; + hRoot = nullptr; } else { - hRoot = TreeView_GetSelection( hTreeWnd ); - if( NULL==hRoot) - DoMessage( IDS_PRINT_WARNING, IDS_PRINT_NEEDSELECT ); + hRoot = TreeView_GetSelection(hTreeWnd); + if (!hRoot) + DoMessage(IDS_PRINT_WARNING, IDS_PRINT_NEEDSELECT); } - + g_PrintToFile = TRUE; // Do actual printing - return PrintTreeStats( hInstance, hWnd, hTreeWnd, hRoot ); + return PrintTreeStats(hInstance, hWnd, hTreeWnd, hRoot); } - - -//----------------------------------------------------------------------------- -// Name: PrintDialogProc() -// Desc: Dialog procedure for printing -//----------------------------------------------------------------------------- -BOOL CALLBACK PrintDialogProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) -{ - switch( msg ) - { - case WM_INITDIALOG: - // Disable system menu on dialog - EnableMenuItem( GetSystemMenu( hDlg, FALSE ), SC_CLOSE, MF_GRAYED ); - return TRUE; - - case WM_COMMAND: - // User is aborting print operation - g_fAbortPrint = TRUE; - EnableWindow( GetParent( hDlg ), TRUE ); - DestroyWindow( hDlg ); - g_hAbortPrintDlg = NULL; - return TRUE; - } - - return FALSE; -} - - - - -//----------------------------------------------------------------------------- -// Name: AbortProc() -// Desc: Abort procedure for printing -//----------------------------------------------------------------------------- -BOOL CALLBACK AbortProc( HDC hPrinterDC, int iCode ) -{ - MSG msg; - - while( !g_fAbortPrint && PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) - { - if( ( !g_hAbortPrintDlg) || !IsDialogMessage( g_hAbortPrintDlg, &msg ) ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - } - - return !g_fAbortPrint; -} - - - - -//----------------------------------------------------------------------------- -// Name: PrintStats() -// Desc: Print user defined stuff -//----------------------------------------------------------------------------- -BOOL CALLBACK PrintTreeStats( HINSTANCE hInstance, HWND hWnd, HWND hTreeWnd, - HTREEITEM hRoot ) -{ - static DOCINFO di; - static PRINTDLG pd; - - BOOL fDone = FALSE; - BOOL fFindNext = FALSE; - BOOL fResult = FALSE; - BOOL fStartDoc = FALSE; - BOOL fDisableWindow = FALSE; - LPTSTR pstrTitle = NULL; - LPTSTR pstrBuff = NULL; - TEXTMETRIC tm = {0}; - DWORD dwCurrCopy; - HANDLE hHeap = NULL; - DWORD cbSize; - DWORD cchLen; - TV_ITEM tvi; - HTREEITEM hStartTree, hTempTree; - PRINTCBINFO pci; - - // Check Parameters - if( NULL==hInstance || NULL==hWnd || NULL==hTreeWnd ) - return FALSE; - - // Get Starting point for tree - if( hRoot ) - hStartTree = hRoot; - else - hStartTree = TreeView_GetRoot (hTreeWnd); - - if( NULL==hStartTree ) - return FALSE; - - // Initialize Print Dialog structure - ZeroMemory( &pd, sizeof(PRINTDLG) ); - pd.lStructSize = sizeof (PRINTDLG); - pd.hwndOwner = hWnd; - pd.Flags = PD_ALLPAGES | PD_RETURNDC; - pd.nCopies = 1; - - if( g_PrintToFile ) - { - pci.hdcPrint = NULL; - } - else - { - // Call Common Print Dialog to get printer DC - if( !PrintDlg( &pd ) || !pd.hDC ) - { - // Print Dialog failed or user canceled - return TRUE; - } - - pci.hdcPrint = pd.hDC; - // Get Text metrics for printing - if( !GetTextMetrics( pci.hdcPrint, &tm ) ) - { - // Error, TextMetrics failed - goto lblCLEANUP; - } - } - - if( g_PrintToFile ) - { - pci.dwLineHeight = 1; - pci.dwCharWidth = 1; - pci.dwCharsPerLine = 80; - pci.dwLinesPerPage = 66; - } - else - { - pci.dwLineHeight = tm.tmHeight + tm.tmExternalLeading; - pci.dwCharWidth = tm.tmAveCharWidth; - pci.dwCharsPerLine = GetDeviceCaps (pci.hdcPrint, HORZRES) / pci.dwCharWidth; - pci.dwLinesPerPage = GetDeviceCaps (pci.hdcPrint, VERTRES) / pci.dwLineHeight; - } - - // Get Heap - hHeap = GetProcessHeap(); - if( !hHeap ) - { - // Error, no heap associated with this process - goto lblCLEANUP; - } - - // Create line buffer - cbSize = (pci.dwCharsPerLine + 1) * sizeof(TCHAR); - pstrBuff = (LPTSTR) HeapAlloc (hHeap, HEAP_NO_SERIALIZE, cbSize); - if( !pstrBuff ) - { - // Error, not enough memory - goto lblCLEANUP; - } - - *pstrBuff = 0; - - // Disable Parent window - EnableWindow( hWnd, FALSE ); - fDisableWindow = TRUE; - - // Start Printer Abort Dialog - g_fAbortPrint = FALSE; - g_hAbortPrintDlg = CreateDialog( hInstance, MAKEINTRESOURCE(IDD_ABORTPRINTDLG), - hWnd, (DLGPROC)PrintDialogProc ); - if( !g_hAbortPrintDlg ) - { - // Error, unable to create abort dialog - goto lblCLEANUP; - } - - // - // Set Document title to Root string - // - tvi.mask = TVIF_CHILDREN | TVIF_TEXT; - tvi.hItem = hStartTree; - tvi.pszText = pstrBuff; - tvi.cchTextMax = pci.dwCharsPerLine; - if (TreeView_GetItem (hTreeWnd, &tvi)) - { - SetWindowText (g_hAbortPrintDlg, pstrBuff); - SetAbortProc (pd.hDC, AbortProc); - cchLen = _tcsclen (pstrBuff); - cbSize = (cchLen + 1) * sizeof(TCHAR); - pstrTitle = (LPTSTR) HeapAlloc (hHeap, HEAP_NO_SERIALIZE, cbSize); - if (! pstrTitle) - { - // Error, not enough memory - goto lblCLEANUP; - } - - strcpy_s (pstrTitle, cbSize, pstrBuff); - pstrTitle[cchLen] = 0; - } - else - { - SetWindowText (g_hAbortPrintDlg, TEXT("Unknown")); - SetAbortProc (pd.hDC, AbortProc); - cchLen = _tcsclen (TEXT("Unknown")); - cbSize = (cchLen + 1) * sizeof(TCHAR); - pstrTitle = (LPTSTR) HeapAlloc (hHeap, HEAP_NO_SERIALIZE, cbSize); - if (! pstrTitle) - { - // Error, not enough memory - goto lblCLEANUP; - } - - strcpy_s (pstrTitle, cbSize, TEXT("Unknown")); - pstrTitle[cchLen] = 0; - } - - // Initialize Document Structure - di.cbSize = sizeof(DOCINFO); - di.lpszDocName = pstrTitle; - di.lpszOutput = NULL; - di.lpszDatatype = NULL; - di.fwType = 0; - - // Start document - if(g_PrintToFile) - { - TCHAR* pstrFile; - TCHAR buff[MAX_PATH]; - if( strlen( g_PrintToFilePath ) > 0 ) - pstrFile = g_PrintToFilePath; - else - { - HRESULT hr = SHGetFolderPath( NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT, buff ); - if ( SUCCEEDED(hr) ) - { - strcat_s( buff, MAX_PATH, TEXT("\\dxview.log") ); - pstrFile = buff; - } - else - pstrFile = TEXT("dxview.log"); - } - g_FileHandle = CreateFile( pstrFile, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - } else - if (StartDoc (pd.hDC, &di) < 0) - { - // Error, StartDoc failed - goto lblCLEANUP; - } - fStartDoc = TRUE; - - // Print requested number of copies - fResult = FALSE; - for (dwCurrCopy = 0; dwCurrCopy < (DWORD)pd.nCopies; dwCurrCopy++) - { - - pci.hCurrTree = hStartTree; - pci.fStartPage = TRUE; - pci.dwCurrIndent = 0; - - - // Note: We are basically doing an pre-order traversal - // of the Tree. Printing the current node - // before moving on to it's children or siblings - - fDone = FALSE; - while (! fDone) - { - // Check if we need to start a new page - if( FAILED( PrintStartPage(&pci) ) ) - { - goto lblCLEANUP; - } - - // - // Get Current Item in Tree - // and print it's text info and associated Node caps - // - - tvi.mask = TVIF_CHILDREN | TVIF_TEXT | TVIF_PARAM; - tvi.hItem = pci.hCurrTree; - tvi.pszText = pstrBuff; - tvi.lParam = 0; - tvi.cchTextMax = pci.dwCharsPerLine; - if (TreeView_GetItem (hTreeWnd, &tvi)) - { - cchLen = _tcslen (pstrBuff); - if (cchLen > 0) - { - int xOffset = (int)(pci.dwCurrIndent * DEF_TAB_SIZE * pci.dwCharWidth); - int yOffset = (int)(pci.dwLineHeight * pci.dwCurrLine); - - // Print this line - if( FAILED( PrintLine (xOffset, yOffset, pstrBuff, cchLen, &pci) ) ) - { - goto lblCLEANUP; - } - - // Advance to next line in page - if( FAILED( PrintNextLine(&pci) ) ) - { - goto lblCLEANUP; - } - - // Check if there is any additional node info - // that needs to be printed - if (tvi.lParam != 0) - { - NODEINFO * pni = (NODEINFO*)tvi.lParam; - - if (pni && pni->fnDisplayCallback) - { - // Force indent to offset node info from tree info - pci.dwCurrIndent += 2; - - if (pni->bUseLParam3) - { - if( FAILED( ((DISPLAYCALLBACKEX)(pni->fnDisplayCallback))(pni->lParam1, pni->lParam2, pni->lParam3, &pci ) ) ) - { - // Error, callback failed - goto lblCLEANUP; - } - } - else - { - if( FAILED( pni->fnDisplayCallback(pni->lParam1, pni->lParam2, &pci ) ) ) - { - // Error, callback failed - goto lblCLEANUP; - } - } - - // Recover indent - pci.dwCurrIndent -= 2; - } - } - } - } // End if TreeView_GetItem() - - - - // - // Get Next Item in tree - // - - // Get first child, if any - if (tvi.cChildren) - { - // Get First child - hTempTree = TreeView_GetChild (hTreeWnd, pci.hCurrTree); - if (hTempTree) - { - // Increase Indentation - pci.dwCurrIndent++; - - pci.hCurrTree = hTempTree; - continue; - } - } - - // Exit, if we are the root - if (pci.hCurrTree == hRoot) - { - // We have reached the root, so stop - PrintEndPage( &pci ); - fDone = TRUE; - continue; - } - - // Get next sibling in the chain - hTempTree = TreeView_GetNextSibling (hTreeWnd, pci.hCurrTree); - if (hTempTree) - { - pci.hCurrTree = hTempTree; - continue; - } - - // Get next Ancestor yet to be processed - // (uncle, granduncle, etc) - fFindNext = FALSE; - while (! fFindNext) - { - hTempTree = TreeView_GetParent (hTreeWnd, pci.hCurrTree); - if ((! hTempTree) || (hTempTree == hRoot)) - { - // We have reached the root, so stop - PrintEndPage( &pci ); - fDone = TRUE; - fFindNext = TRUE; - } - else - { - // Move up to the parent - pci.hCurrTree = hTempTree; - - // Decrease Indentation - pci.dwCurrIndent--; - - // Since we have already processed the parent - // we want to get the uncle/aunt node - hTempTree = TreeView_GetNextSibling (hTreeWnd, pci.hCurrTree); - if (hTempTree) - { - // Found a non-processed node - pci.hCurrTree = hTempTree; - fFindNext = TRUE; - } - } - } - } // End While (! fDone) - } // End for num copies - - // Success - fResult = TRUE; - -lblCLEANUP: - // End Document - if (fStartDoc) - { - if(g_PrintToFile) - { - CloseHandle(g_FileHandle); - } else - EndDoc (pd.hDC); - fStartDoc = FALSE; - } - - // Re-enable main window - // Note: Do this before destroying abort dialog - // otherwise the main window loses focus - if (fDisableWindow) - { - EnableWindow( hWnd, TRUE ); - fDisableWindow = FALSE; - } - - // Destroy Abort Dialog - if( g_hAbortPrintDlg ) - { - DestroyWindow( g_hAbortPrintDlg ); - g_hAbortPrintDlg = NULL; - } - - // Free title memory - if( pstrTitle ) - { - HeapFree( hHeap, 0, (VOID*)pstrTitle ); - pstrTitle = NULL; - di.lpszDocName = NULL; - } - - // Free buffer memory - if( pstrBuff ) - { - HeapFree( hHeap, 0, (VOID*)pstrBuff ); - pstrBuff = NULL; - } - - // Cleanup printer DC - if( pd.hDC ) - { - DeleteDC (pd.hDC); - pd.hDC = NULL; - } - - return fResult; -} - - - - -//----------------------------------------------------------------------------- -// Name: PrintStartPage -// Desc: Check if we need to start a new page -//----------------------------------------------------------------------------- -HRESULT PrintStartPage( PRINTCBINFO* pci ) -{ - if( g_PrintToFile ) - return S_OK; - if( NULL==pci ) - return E_FAIL; - - // Check if we need to start a new page - if( pci->fStartPage ) - { - // Check for user abort - if( g_fAbortPrint ) - return E_FAIL; - - // Start new page - if( StartPage( pci->hdcPrint ) < 0 ) - return E_FAIL; - - // Reset line count - pci->fStartPage = FALSE; - pci->dwCurrLine = 0; - } - - return S_OK; -} - - - - -//----------------------------------------------------------------------------- -// Name: PrintEndPage() -// Desc: Check if we need to start a new page -//----------------------------------------------------------------------------- -HRESULT PrintEndPage( PRINTCBINFO* pci ) -{ - if( g_PrintToFile ) - return S_OK; - if( NULL==pci ) - return E_FAIL; - - // Check if we need to end this page - if( !pci->fStartPage ) - { - // End page - if( EndPage( pci->hdcPrint ) < 0 ) - return E_FAIL; - - pci->fStartPage = TRUE; - - // Check for user abort - if( g_fAbortPrint ) - return E_FAIL; - } - - return S_OK; -} - - - - //----------------------------------------------------------------------------- // Name: PrintLine() // Desc: Prints text to page at specified location //----------------------------------------------------------------------------- -HRESULT PrintLine( int xOffset, int yOffset, LPCTSTR pszBuff, DWORD cchBuff, - PRINTCBINFO* pci ) +_Use_decl_annotations_ +HRESULT PrintLine(int xOffset, int yOffset, LPCTSTR pszBuff, size_t cchBuff, + PRINTCBINFO* pci) { - if( NULL == pci ) + if (!pci) return E_FAIL; // Check if we need to start a new page - if( FAILED( PrintStartPage(pci) ) ) + if (FAILED(PrintStartPage(pci))) return E_FAIL; // Return if there's nothing to print - if( NULL==pszBuff || NULL==cchBuff ) + if (!pszBuff || !cchBuff) return S_OK; // Print text out to buffer current line - if( g_PrintToFile ) + if (g_PrintToFile) { DWORD dwDummy; TCHAR Temp[80]; - int offset = (xOffset-iLastXPos)/pci->dwCharWidth; + int offset = (xOffset - iLastXPos) / pci->dwCharWidth; - if( offset < 0 || offset>=80 ) + if (offset < 0 || offset >= 80) return S_OK; - memset( Temp, ' ', sizeof(TCHAR)*79 ); - Temp[offset]=0; - WriteFile( g_FileHandle,Temp,( xOffset - iLastXPos ) / pci->dwCharWidth, &dwDummy, NULL ); - iLastXPos = ( xOffset-iLastXPos ) + ( pci->dwCharWidth * cchBuff ); - - WriteFile( g_FileHandle, pszBuff, cchBuff, &dwDummy, NULL ); + memset(Temp, ' ', sizeof(TCHAR) * 79); + Temp[offset] = 0; + WriteFile(g_FileHandle, Temp, (xOffset - iLastXPos) / pci->dwCharWidth, &dwDummy, nullptr); + iLastXPos = (xOffset - iLastXPos) + (pci->dwCharWidth * static_cast(cchBuff)); + + WriteFile(g_FileHandle, pszBuff, static_cast(cchBuff), &dwDummy, nullptr); } else { - TextOut( pci->hdcPrint, xOffset, yOffset, pszBuff, cchBuff ); + TextOut(pci->hdcPrint, xOffset, yOffset, pszBuff, static_cast(cchBuff)); } return S_OK; } - - //----------------------------------------------------------------------------- // Name: PrintNextLine() // Desc: Advance to next line on page //----------------------------------------------------------------------------- -HRESULT PrintNextLine( PRINTCBINFO* pci ) +_Use_decl_annotations_ +HRESULT PrintNextLine(PRINTCBINFO* pci) { - if( g_PrintToFile ) + if (g_PrintToFile) { DWORD dwDummy; - WriteFile( g_FileHandle, "\r\n", 2, &dwDummy, NULL ); + WriteFile(g_FileHandle, "\r\n", 2, &dwDummy, nullptr); iLastXPos = 0; return S_OK; } - if( NULL==pci ) + if (!pci) return E_FAIL; pci->dwCurrLine++; // Check if we need to end the page - if( pci->dwCurrLine >= pci->dwLinesPerPage ) - return PrintEndPage( pci ); + if (pci->dwCurrLine >= pci->dwLinesPerPage) + return PrintEndPage(pci); return S_OK; } - - - - -//----------------------------------------------------------------------------- -// Name: DoMessage() -// Desc: Display warning message to user -//----------------------------------------------------------------------------- -VOID DoMessage( DWORD dwTitle, DWORD dwMsg ) -{ - TCHAR strTitle[MAX_TITLE]; - TCHAR strMsg[MAX_MESSAGE]; - - LoadString( GetModuleHandle(NULL), dwTitle, strTitle, MAX_TITLE ); - LoadString( GetModuleHandle(NULL), dwMsg, strMsg, MAX_MESSAGE ); - MessageBox( NULL, strMsg, strTitle, MB_OK ); -} - - diff --git a/dxview.cpp b/dxview.cpp index e864fba..a0a0e6e 100644 --- a/dxview.cpp +++ b/dxview.cpp @@ -1,17 +1,20 @@ //----------------------------------------------------------------------------- -// Name: DXView.cpp +// Name: dxview.cpp // -// Desc: DirectX caps viewer +// Desc: DirectX Capabilities Viewer (Main program) // // Copyright (c) Microsoft Corporation. All Rights Reserved. //----------------------------------------------------------------------------- #include "dxview.h" + #include #include -#include // for D3DSHADER_VERSION_MAJOR and D3DSHADER_VERSION_MINOR #include #include -#include + +// These are from d3d8types.h +#define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF) +#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) HINSTANCE g_hInstance; CHAR g_strAppName[] = "DXView"; @@ -19,6 +22,11 @@ CHAR g_strClassName[] = "DXView"; CHAR g_strTitle[] = "DirectX Caps Viewer"; HWND g_hwndMain; +extern const char c_szYes[] = "Yes"; +extern const char c_szNo[] = "No"; +extern const char c_szCurrentMode[] = "Current Mode"; +extern const char c_szNA[] = "n/a"; + HWND g_hwndLV; // List view HWND g_hwndTV; // Tree view HIMAGELIST g_hImageList; @@ -32,7 +40,7 @@ DWORD g_tmAveCharWidth; extern BOOL g_PrintToFile; extern TCHAR g_PrintToFilePath[MAX_PATH]; CHAR g_szClip[200]; // Text to possibly copy to clipboard -TCHAR g_helpPath[MAX_PATH] = {0}; +TCHAR g_helpPath[MAX_PATH] = {}; //----------------------------------------------------------------------------- // Local function prototypes @@ -50,9 +58,6 @@ BOOL DXView_OnPrint( HWND hWindow, HWND hTreeView, BOOL bPrintAll ); BOOL DXView_OnFile( HWND hWindow, HWND hTreeWnd,BOOL bPrintAll ); VOID CreateCopyMenu( VOID ); -VOID FindHelp(); -VOID InvokeHelp(); - //----------------------------------------------------------------------------- @@ -81,22 +86,22 @@ BOOL DXG_Is9Ex(); //----------------------------------------------------------------------------- HRESULT Int2Str( _Out_z_cap_(nDestLen) LPTSTR strDest, UINT nDestLen, DWORD i ) { - char strIn[32]; - char strOut[32]; - char strDec[2]; - char* pstrDec; - *strDest = 0; + char strDec[2]; GetLocaleInfo( LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, strDec, 2 ); + char strIn[32]; sprintf_s( strIn, sizeof(strIn), "%u",i ); - if( 0 == GetNumberFormat( LOCALE_USER_DEFAULT, 0, strIn, NULL, strOut, 32 ) ) + + char strOut[32]; + if( 0 == GetNumberFormat( LOCALE_USER_DEFAULT, 0, strIn, nullptr, strOut, 32 ) ) { strcpy_s( strDest, nDestLen, strIn ); return E_FAIL; } - pstrDec = strrchr( strOut, strDec[0] ); - if( pstrDec != NULL ) + + char * pstrDec = strrchr( strOut, strDec[0] ); + if( pstrDec) *pstrDec = '\0'; if( strcpy_s( strDest, nDestLen, strOut ) != 0) @@ -109,34 +114,27 @@ HRESULT Int2Str( _Out_z_cap_(nDestLen) LPTSTR strDest, UINT nDestLen, DWORD i ) } - - -//----------------------------------------------------------------------------- -// Name: -// Desc: //----------------------------------------------------------------------------- +_Use_decl_annotations_ HRESULT PrintStringValueLine(const char * szText, const char * szText2, PRINTCBINFO *lpInfo) { - char szBuff[80]; - DWORD cchLen; - int xName, xVal, yLine; - // Calculate Name and Value column x offsets - xName = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth); - xVal = xName + (32 * lpInfo->dwCharWidth); - yLine = (lpInfo->dwCurrLine * lpInfo->dwLineHeight); + int xName = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth); + int xVal = xName + (32 * lpInfo->dwCharWidth); + int yLine = (lpInfo->dwCurrLine * lpInfo->dwLineHeight); // Print name + char szBuff[80]; strcpy_s(szBuff, sizeof(szBuff), szText); szBuff[79] = '\0'; - cchLen = _tcslen (szText); + auto cchLen = static_cast(_tcslen(szText)); if( FAILED( PrintLine (xName, yLine, szBuff, cchLen, lpInfo) ) ) return E_FAIL; // Print value strcpy_s(szBuff, sizeof(szBuff), szText2); szBuff[79] = '\0'; - cchLen = _tcslen (szText2); + cchLen = static_cast(_tcslen(szText2)); if( FAILED( PrintLine (xVal, yLine, szBuff, cchLen, lpInfo) ) ) return E_FAIL; @@ -148,12 +146,8 @@ HRESULT PrintStringValueLine(const char * szText, const char * szText2, PRINTCBI } - - -//----------------------------------------------------------------------------- -// Name: -// Desc: //----------------------------------------------------------------------------- +_Use_decl_annotations_ HRESULT PrintValueLine(const char * szText, DWORD dwValue, PRINTCBINFO *lpInfo) { char szBuff[80]; @@ -163,9 +157,7 @@ HRESULT PrintValueLine(const char * szText, DWORD dwValue, PRINTCBINFO *lpInfo) //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- +_Use_decl_annotations_ HRESULT PrintHexValueLine(const char * szText, DWORD dwValue, PRINTCBINFO *lpInfo) { char szBuff[80]; @@ -175,23 +167,18 @@ HRESULT PrintHexValueLine(const char * szText, DWORD dwValue, PRINTCBINFO *lpInf //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- +_Use_decl_annotations_ HRESULT PrintStringLine(const char * szText, PRINTCBINFO *lpInfo) { - char szBuff[80]; - DWORD cchLen; - int xName, yLine; - // Calculate Name and Value column x offsets - xName = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth); - yLine = (lpInfo->dwCurrLine * lpInfo->dwLineHeight); + int xName = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth); + int yLine = (lpInfo->dwCurrLine * lpInfo->dwLineHeight); // Print name + char szBuff[80]; strcpy_s(szBuff, sizeof(szBuff), szText); szBuff[79] = '\0'; - cchLen = _tcslen (szText); + auto cchLen = static_cast(_tcslen(szText)); if( FAILED( PrintLine (xName, yLine, szBuff, cchLen, lpInfo) ) ) return E_FAIL; @@ -203,22 +190,19 @@ HRESULT PrintStringLine(const char * szText, PRINTCBINFO *lpInfo) } - - //----------------------------------------------------------------------------- -// Name: -// Desc: +// Name: WinMain //----------------------------------------------------------------------------- -int WINAPI WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, - _In_ LPSTR strCmdLine, _In_ int nCmdShow ) +int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance*/, + _In_ LPSTR /*strCmdLine*/, _In_ int /*nCmdShow*/) { g_hInstance = hInstance; // Store instance handle in our global variable g_PrintToFilePath[0] = TEXT('\0'); // Initialize COM - CoInitialize( NULL ); - - FindHelp(); + HRESULT hr = CoInitializeEx(nullptr, COINITBASE_MULTITHREADED); + if (FAILED(hr)) + return 1; // Init various DX components DXGI_Init(); @@ -227,25 +211,25 @@ int WINAPI WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, // Register window class WNDCLASS wc; - wc.style = CS_HREDRAW | CS_VREDRAW; // Class style(s). - wc.lpfnWndProc = (WNDPROC)WndProc; // Window Procedure - wc.cbClsExtra = 0; // No per-class extra data. - wc.cbWndExtra = 0; // No per-window extra data. - wc.hInstance = hInstance; // Owner of this class - wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DIRECTX)); // Icon name from .RC - wc.hCursor = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_SPLIT));// Cursor - wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); // Default color - wc.lpszMenuName = "Menu"; // Menu name from .RC + wc.style = CS_HREDRAW | CS_VREDRAW; // Class style(s). + wc.lpfnWndProc = (WNDPROC)WndProc; // Window Procedure + wc.cbClsExtra = 0; // No per-class extra data. + wc.cbWndExtra = 0; // No per-window extra data. + wc.hInstance = hInstance; // Owner of this class + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DIRECTX)); // Icon name from .RC + wc.hCursor = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_SPLIT));// Cursor + wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); // Default color + wc.lpszMenuName = "Menu"; // Menu name from .RC wc.lpszClassName = g_strClassName; // Name to register as - RegisterClass( &wc ); + RegisterClass(&wc); // Create a main window for this application instance. - g_hwndMain = CreateWindowEx( 0, g_strClassName, g_strTitle, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, DXView_WIDTH, DXView_HEIGHT, - NULL, NULL, hInstance, NULL ); + g_hwndMain = CreateWindowEx(0, g_strClassName, g_strTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, DXView_WIDTH, DXView_HEIGHT, + nullptr, nullptr, hInstance, nullptr); // If window could not be created, return "failure" - if( NULL==g_hwndMain ) + if (!g_hwndMain) { CoUninitialize(); return -1; @@ -261,8 +245,8 @@ int WINAPI WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, while (*pszCmdLine && (*pszCmdLine != TEXT('"'))) pszCmdLine++; // If we stopped on a double-quote (usual case), skip over it. - if (*pszCmdLine == TEXT('"')) - pszCmdLine++; + if (*pszCmdLine == TEXT('"')) + pszCmdLine++; } else // First token wasn't a quote { @@ -284,8 +268,8 @@ int WINAPI WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, while (*pszCmdLine && (*pszCmdLine != TEXT('"'))) *pstrSave++ = *pszCmdLine++; // If we stopped on a double-quote (usual case), skip over it. - if (*pszCmdLine == TEXT('"')) - pszCmdLine++; + if (*pszCmdLine == TEXT('"')) + pszCmdLine++; } else // First token wasn't a quote { @@ -294,23 +278,23 @@ int WINAPI WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, } *pstrSave = TEXT('\0'); - if( strlen( g_PrintToFilePath ) > 0 ) + if (strlen(g_PrintToFilePath) > 0) { - PostMessage( g_hwndMain, WM_COMMAND, IDM_PRINTWHOLETREETOFILE, 0 ); - PostMessage( g_hwndMain, WM_CLOSE, 0, 0 ); + PostMessage(g_hwndMain, WM_COMMAND, IDM_PRINTWHOLETREETOFILE, 0); + PostMessage(g_hwndMain, WM_CLOSE, 0, 0); } else { // Make the window visible; update its client area; and return "success" - ShowWindow( g_hwndMain, SW_MAXIMIZE /*nCmdShow*/ ); + ShowWindow(g_hwndMain, SW_MAXIMIZE /*nCmdShow*/); } // Message pump MSG msg; - while( GetMessage(&msg, NULL, 0, 0 ) ) + while (GetMessage(&msg, nullptr, 0, 0)) { - TranslateMessage( &msg ); - DispatchMessage( &msg ); + TranslateMessage(&msg); + DispatchMessage(&msg); } CoUninitialize(); @@ -319,189 +303,175 @@ int WINAPI WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, } - - //----------------------------------------------------------------------------- -// Name: WndProc() -// Desc: Message handler -//----------------------------------------------------------------------------- -LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch( msg ) + switch (msg) { - case WM_CREATE: - return DXView_OnCreate(hWnd); + case WM_CREATE: + return DXView_OnCreate(hWnd); - case WM_SIZE: + case WM_SIZE: + DXView_OnSize(hWnd); + break; + + case WM_LBUTTONDOWN: + g_bSplitMove = TRUE; + SetCapture(hWnd); + break; + + case WM_LBUTTONUP: + g_bSplitMove = FALSE; + ReleaseCapture(); + break; + + case WM_MOUSEMOVE: + if (g_bSplitMove) + { + RECT rect; + // change the value from unsigned to signed + int x = (int)(short)LOWORD(lParam); + + GetClientRect(hWnd, &rect); + if (rect.left > x) + { + x = rect.left; + } + else if (rect.right < x) + { + x = rect.right; + } + g_xPaneSplit = (x - g_xHalfSplitWidth); DXView_OnSize(hWnd); - break; + } + break; - case WM_LBUTTONDOWN: - g_bSplitMove = TRUE; - SetCapture(hWnd); - break; - - case WM_LBUTTONUP: - g_bSplitMove = FALSE; - ReleaseCapture(); - break; - - case WM_MOUSEMOVE: - if(g_bSplitMove) + case WM_NOTIFY: + if (((NMHDR*)lParam)->hwndFrom == g_hwndTV) + { + if (((NMHDR*)lParam)->code == TVN_SELCHANGED) + DXView_OnTreeSelect(g_hwndTV, (NM_TREEVIEW*)lParam); + else if (((NMHDR*)lParam)->code == NM_RCLICK) { - RECT rect; - // change the value from unsigned to signed - int x = (int)(short)LOWORD(lParam); - - GetClientRect(hWnd, &rect); - if (rect.left > x) + NMHDR* pnmhdr = (NMHDR*)lParam; + TVHITTESTINFO info; + GetCursorPos(&info.pt); + ScreenToClient(pnmhdr->hwndFrom, &info.pt); + TreeView_HitTest(pnmhdr->hwndFrom, &info); + if (info.flags & TVHT_ONITEMLABEL) { - x = rect.left; - } - else if (rect.right < x) - { - x = rect.right; - } - g_xPaneSplit = (x - g_xHalfSplitWidth); - DXView_OnSize(hWnd); - } - break; - - case WM_NOTIFY: - if (((NMHDR*)lParam)->hwndFrom == g_hwndTV) - { - if (((NMHDR*)lParam)->code == TVN_SELCHANGED) - DXView_OnTreeSelect(g_hwndTV, (NM_TREEVIEW*)lParam); - else if (((NMHDR*)lParam)->code == NM_RCLICK) - { - NMHDR* pnmhdr = (NMHDR*)lParam; - TVHITTESTINFO info; - GetCursorPos(&info.pt); - ScreenToClient(pnmhdr->hwndFrom, &info.pt); - TreeView_HitTest(pnmhdr->hwndFrom, &info); - if (info.flags & TVHT_ONITEMLABEL) - { - TVITEM tvitem; - tvitem.mask = TVIF_TEXT; - tvitem.hItem = info.hItem; - tvitem.pszText = g_szClip; - tvitem.cchTextMax = 200; - TreeView_GetItem(g_hwndTV, &tvitem); - CreateCopyMenu(); - } - } - else if(((NMHDR*)lParam)->code == TVN_KEYDOWN) - { - NMTVKEYDOWN* ptvkd = (LPNMTVKEYDOWN)lParam; - if( ptvkd->wVKey == VK_TAB ) - SetFocus( g_hwndLV ); + TVITEM tvitem; + tvitem.mask = TVIF_TEXT; + tvitem.hItem = info.hItem; + tvitem.pszText = g_szClip; + tvitem.cchTextMax = 200; + TreeView_GetItem(g_hwndTV, &tvitem); + CreateCopyMenu(); } } - - if (((NMHDR*)lParam)->hwndFrom == g_hwndLV) + else if (((NMHDR*)lParam)->code == TVN_KEYDOWN) { - if (((NMHDR*)lParam)->code == NM_RDBLCLK) - DXView_OnListViewDblClick(g_hwndLV, (NM_LISTVIEW*)lParam); - else if (((NMHDR*)lParam)->code == NM_RCLICK) + NMTVKEYDOWN* ptvkd = (LPNMTVKEYDOWN)lParam; + if (ptvkd->wVKey == VK_TAB) + SetFocus(g_hwndLV); + } + } + + if (((NMHDR*)lParam)->hwndFrom == g_hwndLV) + { + if (((NMHDR*)lParam)->code == NM_RDBLCLK) + DXView_OnListViewDblClick(g_hwndLV, (NM_LISTVIEW*)lParam); + else if (((NMHDR*)lParam)->code == NM_RCLICK) + { + NMHDR* pnmhdr = (NMHDR*)lParam; + LVHITTESTINFO info; + GetCursorPos(&info.pt); + ScreenToClient(pnmhdr->hwndFrom, &info.pt); + ListView_SubItemHitTest(pnmhdr->hwndFrom, &info); + if (info.iItem >= 0) { - NMHDR* pnmhdr = (NMHDR*)lParam; - LVHITTESTINFO info; - GetCursorPos(&info.pt); - ScreenToClient(pnmhdr->hwndFrom, &info.pt); - ListView_SubItemHitTest(pnmhdr->hwndFrom, &info); - if (info.iItem >= 0) - { - ListView_GetItemText(g_hwndLV, info.iItem, info.iSubItem, g_szClip, 200); - CreateCopyMenu(); - } - } - else if(((NMHDR*)lParam)->code == LVN_KEYDOWN) - { - NMLVKEYDOWN* plvkd = (LPNMLVKEYDOWN)lParam; - if( plvkd->wVKey == VK_TAB ) - SetFocus( g_hwndTV ); + ListView_GetItemText(g_hwndLV, info.iItem, info.iSubItem, g_szClip, 200); + CreateCopyMenu(); } } + else if (((NMHDR*)lParam)->code == LVN_KEYDOWN) + { + NMLVKEYDOWN* plvkd = (LPNMLVKEYDOWN)lParam; + if (plvkd->wVKey == VK_TAB) + SetFocus(g_hwndTV); + } + } - break; + break; - case WM_SETFOCUS: - SetFocus( g_hwndTV ); - break; + case WM_SETFOCUS: + SetFocus(g_hwndTV); + break; - case WM_COMMAND: // message: command from application menu - DXView_OnCommand(hWnd, wParam); - break; + case WM_COMMAND: // message: command from application menu + DXView_OnCommand(hWnd, wParam); + break; - case WM_CLOSE: - DestroyWindow(hWnd); - return 0; + case WM_CLOSE: + DestroyWindow(hWnd); + return 0; - case WM_DESTROY: // message: window being destroyed - DXView_Cleanup(); // Free per item struct for all items - PostQuitMessage(0); - break; + case WM_DESTROY: // message: window being destroyed + DXView_Cleanup(); // Free per item struct for all items + PostQuitMessage(0); + break; } - return DefWindowProc( hWnd, msg, wParam, lParam ); + return DefWindowProc(hWnd, msg, wParam, lParam); } -//----------------------------------------------------------------------------- -// Name: -// Desc: //----------------------------------------------------------------------------- VOID CreateCopyMenu(VOID) { - HMENU hPopupMenu; - HMENU hMenu; - MENUITEMINFO mii; - POINT pt; - TCHAR szMenu[200]; - TCHAR szMenuNew[200]; - - hPopupMenu = LoadMenu(NULL, "POPUP"); - if( hPopupMenu == NULL ) + HMENU hPopupMenu = LoadMenu(nullptr, "POPUP"); + if (!hPopupMenu) return; - hMenu = GetSubMenu(hPopupMenu, 0); - if( hMenu == NULL ) + HMENU hMenu = GetSubMenu(hPopupMenu, 0); + if (!hMenu) { DestroyMenu(hPopupMenu); return; } + TCHAR szMenu[200]; GetMenuString(hMenu, IDM_COPY, szMenu, 200, MF_BYCOMMAND); + + TCHAR szMenuNew[200]; sprintf_s(szMenuNew, sizeof(szMenuNew), szMenu, g_szClip); - ZeroMemory(&mii, sizeof(mii)); + + MENUITEMINFO mii = {}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = szMenuNew; SetMenuItemInfo(hMenu, IDM_COPY, FALSE, &mii); + + POINT pt; GetCursorPos(&pt); - TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_hwndMain, NULL); + TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_hwndMain, nullptr); } -//----------------------------------------------------------------------------- -// Name: -// Desc: + //----------------------------------------------------------------------------- BOOL DXView_OnCreate(HWND hWnd) { - HDC hDC; - int PixelsPerInch; - TEXTMETRIC tm; + HDC hDC = GetDC(hWnd); + int PixelsPerInch = GetDeviceCaps(hDC, LOGPIXELSX); - hDC = GetDC(hWnd); - PixelsPerInch = GetDeviceCaps(hDC, LOGPIXELSX); - - NONCLIENTMETRICS nmi; + NONCLIENTMETRICS nmi = {}; nmi.cbSize = sizeof(nmi); - (void)SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &nmi, 0 ); - g_hFont = CreateFontIndirect( &nmi.lfMessageFont ); - + (void)SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &nmi, 0); + g_hFont = CreateFontIndirect(&nmi.lfMessageFont); SelectObject(hDC, g_hFont); + + TEXTMETRIC tm = {}; GetTextMetrics(hDC, &tm); g_tmAveCharWidth = tm.tmAveCharWidth; ReleaseDC(hWnd, hDC); @@ -511,8 +481,8 @@ BOOL DXView_OnCreate(HWND hWnd) g_xPaneSplit = PixelsPerInch * 12 / 4; g_xHalfSplitWidth = GetSystemMetrics(SM_CXSIZEFRAME) / 2; - g_dwView9Ex = DXG_Is9Ex()? 1 : 0; - CheckMenuItem(GetMenu(hWnd), IDM_VIEW9EX, MF_BYCOMMAND | (g_dwView9Ex? MF_CHECKED : MF_UNCHECKED)); + g_dwView9Ex = DXG_Is9Ex() ? 1 : 0; + CheckMenuItem(GetMenu(hWnd), IDM_VIEW9EX, MF_BYCOMMAND | (g_dwView9Ex ? MF_CHECKED : MF_UNCHECKED)); // Make sure that the common control library read to rock InitCommonControls(); @@ -522,72 +492,66 @@ BOOL DXView_OnCreate(HWND hWnd) // Create the list view window. g_hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, "", WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SINGLESEL, - 0, 0, 0, 0, hWnd, (HMENU)IDC_LV, g_hInstance, NULL); + 0, 0, 0, 0, hWnd, (HMENU)IDC_LV, g_hInstance, nullptr); ListView_SetExtendedListViewStyleEx(g_hwndLV, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); // create the tree view window. g_hwndTV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "", WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_SHOWSELALWAYS, - 0, 0, 0, 0, hWnd, (HMENU)IDC_TV, g_hInstance, NULL); + 0, 0, 0, 0, hWnd, (HMENU)IDC_TV, g_hInstance, nullptr); // create our image list. DXView_InitImageList(); // Add DXStuff stuff to the tree // view. - DXGI_FillTree( g_hwndTV ); - DXG_FillTree( g_hwndTV ); - DD_FillTree( g_hwndTV ); + DXGI_FillTree(g_hwndTV); + DXG_FillTree(g_hwndTV); + DD_FillTree(g_hwndTV); - TreeView_SelectItem( g_hwndTV, TreeView_GetRoot( g_hwndTV ) ); + TreeView_SelectItem(g_hwndTV, TreeView_GetRoot(g_hwndTV)); return(TRUE); } - - //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -void AddCapsToTV(HTREEITEM hRoot, CAPDEFS *pcds, LPARAM lParam1) +void AddCapsToTV(HTREEITEM hRoot, CAPDEFS* pcds, LPARAM lParam1) { - HTREEITEM hTree; - HTREEITEM hParent[20]; - char* name; - int level=0; BOOL bRoot = TRUE; // the first one is always a root + HTREEITEM hParent[20]; hParent[0] = hRoot; - while( name = pcds->strName ) + int level = 0; + const char* name; + while ((name = pcds->strName) != nullptr) { - if( name[0] == '-') + if (name[0] == '-') { level--; - if ( level < 0 ) + if (level < 0) level = 0; name++; } - if( name[0] == '+') + if (name[0] == '+') { bRoot = TRUE; name++; } - if( name[0] && (level >=0 && level < 20) ) + if (name[0] && (level >= 0 && level < 20)) { - hTree = TVAddNode( hParent[level], name, bRoot, IDI_CAPS, - pcds->fnDisplayCallback, lParam1, - pcds->lParam2 ); + HTREEITEM hTree = TVAddNode(hParent[level], name, bRoot, IDI_CAPS, + pcds->fnDisplayCallback, lParam1, + pcds->lParam2); - if( bRoot ) + if (bRoot) { level++; - if ( level >= 20 ) + if (level >= 20) level = 19; hParent[level] = hTree; bRoot = FALSE; @@ -599,157 +563,13 @@ void AddCapsToTV(HTREEITEM hRoot, CAPDEFS *pcds, LPARAM lParam1) } - - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -char c_szYes[] = "Yes"; -char c_szNo[] = "No"; -char c_szCurrentMode[] = "Current Mode"; - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: //----------------------------------------------------------------------------- // AddMoreCapsToLV is like AddCapsToLV, except it doesn't add the // column headers like AddCapsToLV does. -void AddMoreCapsToLV(CAPDEF *pcd, LPVOID pv) +void AddMoreCapsToLV(CAPDEF* pcd, LPVOID pv) { - DWORD dwValue; - FLOAT fValue; TCHAR szBuff[64]; - while(pcd->strName && *pcd->strName) - { - if (!g_dwView9Ex && (pcd->dwCapsFlags & DXV_9EXCAP)) - { - pcd++; // Get next Cap bit definition - continue; - } - - dwValue = *(DWORD *)(((BYTE *)pv) + pcd->dwOffset); - - switch (pcd->dwFlag) - { - case 0: - LVAddText(g_hwndLV, 0, "%s", pcd->strName); - Int2Str(szBuff,64,dwValue); - LVAddText(g_hwndLV, 1, "%s", szBuff); - break; - case 0xFFFFFFFF: // Hex - LVAddText(g_hwndLV, 0, "%s", pcd->strName); - LVAddText(g_hwndLV, 1, "0x%08X", dwValue); - break; - case 0xEFFFFFFF: // Shader Version - LVAddText(g_hwndLV, 0, "%s", pcd->strName); - LVAddText(g_hwndLV, 1, "%d.%0d", D3DSHADER_VERSION_MAJOR(dwValue), D3DSHADER_VERSION_MINOR(dwValue)); - break; - case 0xBFFFFFFF: // FLOAT Support for new DX6 "D3DVALUE" values in D3DDeviceDesc - LVAddText(g_hwndLV, 0, "%s", pcd->strName); - fValue = *(FLOAT*)(((BYTE *)pv) + pcd->dwOffset); - LVAddText(g_hwndLV, 1, "%G", fValue); - break; - case 0x7FFFFFFF: // HEX Support for new DX6 "WORD" values in D3DDeviceDesc - LVAddText(g_hwndLV, 0, "%s", pcd->strName); - dwValue = *(WORD *)(((BYTE *)pv) + pcd->dwOffset); - LVAddText(g_hwndLV, 1, "0x%04X", dwValue); - break; - case 0x3FFFFFFF: // VAL Support for new DX6 "WORD" values in D3DDeviceDesc - LVAddText(g_hwndLV, 0, "%s", pcd->strName); - dwValue = *(WORD *)(((BYTE *)pv) + pcd->dwOffset); - Int2Str(szBuff,64,dwValue); - LVAddText(g_hwndLV, 1, "%s", szBuff); - break; - case 0x1FFFFFFF: // "-1 == unlimited" - LVAddText(g_hwndLV, 0, "%s", pcd->strName); - if (dwValue == 0xFFFFFFFF) - { - LVAddText(g_hwndLV, 1, "Unlimited"); - } - else - { - Int2Str(szBuff,64,dwValue); - LVAddText(g_hwndLV, 1, "%s", szBuff); - } - break; - case 0x0fffffff: // Mask with 0xffff - { - LVAddText(g_hwndLV, 0, pcd->strName); - dwValue = (*(DWORD *)(((BYTE *)pv) + pcd->dwOffset)) & 0xffff; - Int2Str(szBuff,64,dwValue); - LVAddText(g_hwndLV, 1, "%s", szBuff); - } - break; - default: - if (pcd->dwFlag & dwValue) - { - LVAddText(g_hwndLV, 0, pcd->strName); - LVAddText(g_hwndLV, 1, c_szYes); - } - else if (g_dwViewState == IDM_VIEWALL) - { - LVAddText(g_hwndLV, 0, pcd->strName); - LVAddText(g_hwndLV, 1, c_szNo); - } - break; - } - pcd++; // Get next Cap bit definition - } -} - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -// AddColsToLV adds the column headers but no data. -void AddColsToLV(void) -{ - LVAddColumn(g_hwndLV, 0, "Name", 30); - LVAddColumn(g_hwndLV, 1, "Value", 10); -} - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -VOID AddCapsToLV(CAPDEF *pcd, LPVOID pv) -{ - AddColsToLV(); - AddMoreCapsToLV(pcd, pv); -} - - - - -//----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HRESULT PrintCapsToDC( CAPDEF *pcd, LPVOID pv, PRINTCBINFO * lpInfo ) -{ - DWORD dwValue; - DWORD cchLen; - int xName, xVal, yLine; - TCHAR szValue[100]; - FLOAT fValue; - - // Check Parameters - if ((! pcd) || (!lpInfo)) - return E_FAIL; - - // Calculate Name and Value column x offsets - xName = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth); - xVal = xName + (50 * lpInfo->dwCharWidth); - while (pcd->strName && *pcd->strName) { if (!g_dwView9Ex && (pcd->dwCapsFlags & DXV_9EXCAP)) @@ -758,138 +578,253 @@ HRESULT PrintCapsToDC( CAPDEF *pcd, LPVOID pv, PRINTCBINFO * lpInfo ) continue; } - dwValue = *(DWORD *)(((BYTE *)pv) + pcd->dwOffset); - yLine = lpInfo->dwCurrLine * lpInfo->dwLineHeight; + auto dwValue = *reinterpret_cast(static_cast(pv) + pcd->dwOffset); + + switch (pcd->dwFlag) + { + case 0: + LVAddText(g_hwndLV, 0, "%s", pcd->strName); + Int2Str(szBuff, 64, dwValue); + LVAddText(g_hwndLV, 1, "%s", szBuff); + break; + case 0xFFFFFFFF: // Hex + LVAddText(g_hwndLV, 0, "%s", pcd->strName); + LVAddText(g_hwndLV, 1, "0x%08X", dwValue); + break; + case 0xEFFFFFFF: // Shader Version + LVAddText(g_hwndLV, 0, "%s", pcd->strName); + LVAddText(g_hwndLV, 1, "%d.%0d", D3DSHADER_VERSION_MAJOR(dwValue), D3DSHADER_VERSION_MINOR(dwValue)); + break; + case 0xBFFFFFFF: // FLOAT Support for new DX6 "D3DVALUE" values in D3DDeviceDesc + { + LVAddText(g_hwndLV, 0, "%s", pcd->strName); + auto fValue = *reinterpret_cast(static_cast(pv) + pcd->dwOffset); + LVAddText(g_hwndLV, 1, "%G", fValue); + break; + } + case 0x7FFFFFFF: // HEX Support for new DX6 "WORD" values in D3DDeviceDesc + LVAddText(g_hwndLV, 0, "%s", pcd->strName); + dwValue = *reinterpret_cast(static_cast(pv) + pcd->dwOffset); + LVAddText(g_hwndLV, 1, "0x%04X", dwValue); + break; + case 0x3FFFFFFF: // VAL Support for new DX6 "WORD" values in D3DDeviceDesc + LVAddText(g_hwndLV, 0, "%s", pcd->strName); + dwValue = *reinterpret_cast(static_cast(pv) + pcd->dwOffset); + Int2Str(szBuff, 64, dwValue); + LVAddText(g_hwndLV, 1, "%s", szBuff); + break; + case 0x1FFFFFFF: // "-1 == unlimited" + LVAddText(g_hwndLV, 0, "%s", pcd->strName); + if (dwValue == 0xFFFFFFFF) + { + LVAddText(g_hwndLV, 1, "Unlimited"); + } + else + { + Int2Str(szBuff, 64, dwValue); + LVAddText(g_hwndLV, 1, "%s", szBuff); + } + break; + case 0x0fffffff: // Mask with 0xffff + { + LVAddText(g_hwndLV, 0, pcd->strName); + dwValue = (*reinterpret_cast(static_cast(pv) + pcd->dwOffset)) & 0xffff; + Int2Str(szBuff, 64, dwValue); + LVAddText(g_hwndLV, 1, "%s", szBuff); + } + break; + default: + if (pcd->dwFlag & dwValue) + { + LVAddText(g_hwndLV, 0, pcd->strName); + LVAddText(g_hwndLV, 1, c_szYes); + } + else if (g_dwViewState == IDM_VIEWALL) + { + LVAddText(g_hwndLV, 0, pcd->strName); + LVAddText(g_hwndLV, 1, c_szNo); + } + break; + } + pcd++; // Get next Cap bit definition + } +} + + +//----------------------------------------------------------------------------- +// AddColsToLV adds the column headers but no data. +void AddColsToLV(void) +{ + LVAddColumn(g_hwndLV, 0, "Name", 30); + LVAddColumn(g_hwndLV, 1, "Value", 10); +} + + +//----------------------------------------------------------------------------- +VOID AddCapsToLV(CAPDEF *pcd, LPVOID pv) +{ + AddColsToLV(); + AddMoreCapsToLV(pcd, pv); +} + + +//----------------------------------------------------------------------------- +_Use_decl_annotations_ +HRESULT PrintCapsToDC(CAPDEF* pcd, LPVOID pv, PRINTCBINFO* lpInfo) +{ + DWORD cchLen; + TCHAR szValue[100]; + + // Check Parameters + if ((!pcd) || (!lpInfo)) + return E_FAIL; + + // Calculate Name and Value column x offsets + int xName = (lpInfo->dwCurrIndent * DEF_TAB_SIZE * lpInfo->dwCharWidth); + int xVal = xName + (50 * lpInfo->dwCharWidth); + + while (pcd->strName && *pcd->strName) + { + if (!g_dwView9Ex && (pcd->dwCapsFlags & DXV_9EXCAP)) + { + pcd++; // Get next Cap bit definition + continue; + } + + auto dwValue = *reinterpret_cast(static_cast(pv) + pcd->dwOffset); + int yLine = lpInfo->dwCurrLine * lpInfo->dwLineHeight; if (pcd->dwFlag) { switch (pcd->dwFlag) { - case 0xFFFFFFFF: // Hex - // Print name - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, pcd->strName, cchLen, lpInfo) ) ) + case 0xFFFFFFFF: // Hex + // Print name + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, pcd->strName, cchLen, lpInfo))) + return E_FAIL; + // Print value in hex + sprintf_s(szValue, sizeof(szValue), "0x%08X", dwValue); + if (FAILED(PrintLine(xVal, yLine, szValue, strlen(szValue), lpInfo))) + return E_FAIL; + // Advance to next line on page + if (FAILED(PrintNextLine(lpInfo))) + return E_FAIL; + break; + + case 0xEFFFFFFF: // Shader Version + // Print name + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, pcd->strName, cchLen, lpInfo))) + return E_FAIL; + // Print version + sprintf_s(szValue, sizeof(szValue), "%u.%0u", D3DSHADER_VERSION_MAJOR(dwValue), D3DSHADER_VERSION_MINOR(dwValue)); + if (FAILED(PrintLine(xVal, yLine, szValue, strlen(szValue), lpInfo))) + return E_FAIL; + // Advance to next line on page + if (FAILED(PrintNextLine(lpInfo))) + return E_FAIL; + break; + + case 0xBFFFFFFF: // FLOAT Support for new DX6 "D3DVALUE" values in D3DDeviceDesc + { + // Print name + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, pcd->strName, cchLen, lpInfo))) + return E_FAIL; + // Print value + auto fValue = *reinterpret_cast(static_cast(pv) + pcd->dwOffset); + sprintf_s(szValue, sizeof(szValue), "%G", fValue); + if (FAILED(PrintLine(xVal, yLine, szValue, strlen(szValue), lpInfo))) + return E_FAIL; + // Advance to next line on page + if (FAILED(PrintNextLine(lpInfo))) + return E_FAIL; + break; + } + + case 0x7FFFFFFF: // HEX Support for new DX6 "WORD" values in D3DDeviceDesc + // Print name + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, pcd->strName, cchLen, lpInfo))) + return E_FAIL; + // Print value + dwValue = *reinterpret_cast(static_cast(pv) + pcd->dwOffset); + sprintf_s(szValue, sizeof(szValue), "0x%04X", dwValue); + if (FAILED(PrintLine(xVal, yLine, szValue, strlen(szValue), lpInfo))) + return E_FAIL; + // Advance to next line on page + if (FAILED(PrintNextLine(lpInfo))) + return E_FAIL; + break; + + case 0x3FFFFFFF: // VAL Support for new DX6 "WORD" values in D3DDeviceDesc + // Print name + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, pcd->strName, cchLen, lpInfo))) + return E_FAIL; + // Print value + dwValue = *reinterpret_cast(static_cast(pv) + pcd->dwOffset); + *szValue = 0; + Int2Str(szValue, 100, dwValue); + if (FAILED(PrintLine(xVal, yLine, szValue, strlen(szValue), lpInfo))) + return E_FAIL; + // Advance to next line on page + if (FAILED(PrintNextLine(lpInfo))) + return E_FAIL; + break; + + case 0x1FFFFFFF: // "-1 == unlimited" + // Print name + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, pcd->strName, cchLen, lpInfo))) + return E_FAIL; + // Print value + *szValue = 0; + if (dwValue == 0xFFFFFFFF) + strcpy_s(szValue, sizeof(szValue), "Unlimited"); + else + Int2Str(szValue, 100, dwValue); + if (FAILED(PrintLine(xVal, yLine, szValue, strlen(szValue), lpInfo))) + return E_FAIL; + // Advance to next line on page + if (FAILED(PrintNextLine(lpInfo))) + return E_FAIL; + break; + + default: + if (pcd->dwFlag & dwValue) + { + // Print Name + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, pcd->strName, cchLen, lpInfo))) return E_FAIL; - // Print value in hex - sprintf_s(szValue, sizeof(szValue), "0x%08X", dwValue); - if( FAILED( PrintLine (xVal, yLine, szValue, strlen(szValue), lpInfo) ) ) + + // Print Yes in value column + cchLen = static_cast(_tcslen(c_szYes)); + if (FAILED(PrintLine(xVal, yLine, c_szYes, cchLen, lpInfo))) return E_FAIL; + // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) + if (FAILED(PrintNextLine(lpInfo))) return E_FAIL; - break; - - case 0xEFFFFFFF: // Shader Version + } + else if (g_dwViewState == IDM_VIEWALL) + { // Print name - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, pcd->strName, cchLen, lpInfo) ) ) + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, pcd->strName, cchLen, lpInfo))) return E_FAIL; - // Print version - sprintf_s(szValue, sizeof(szValue), "%d.%0d", D3DSHADER_VERSION_MAJOR(dwValue), D3DSHADER_VERSION_MINOR(dwValue)); - if( FAILED( PrintLine (xVal, yLine, szValue, strlen(szValue), lpInfo) ) ) + + // Print No in value column + cchLen = static_cast(_tcslen(c_szNo)); + if (FAILED(PrintLine(xVal, yLine, c_szNo, cchLen, lpInfo))) return E_FAIL; + // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) + if (FAILED(PrintNextLine(lpInfo))) return E_FAIL; - break; - - case 0xBFFFFFFF: // FLOAT Support for new DX6 "D3DVALUE" values in D3DDeviceDesc - // Print name - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, pcd->strName, cchLen, lpInfo) ) ) - return E_FAIL; - // Print value - fValue = *(FLOAT*)(((BYTE *)pv) + pcd->dwOffset); - sprintf_s(szValue, sizeof(szValue), "%G", fValue); - if( FAILED( PrintLine (xVal, yLine, szValue, strlen(szValue), lpInfo) ) ) - return E_FAIL; - // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) - return E_FAIL; - break; - - case 0x7FFFFFFF: // HEX Support for new DX6 "WORD" values in D3DDeviceDesc - // Print name - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, pcd->strName, cchLen, lpInfo) ) ) - return E_FAIL; - // Print value - dwValue = *(WORD *)(((BYTE *)pv) + pcd->dwOffset); - sprintf_s(szValue, sizeof(szValue), "0x%04X", dwValue); - if( FAILED( PrintLine (xVal, yLine, szValue, strlen(szValue), lpInfo) ) ) - return E_FAIL; - // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) - return E_FAIL; - break; - - case 0x3FFFFFFF: // VAL Support for new DX6 "WORD" values in D3DDeviceDesc - // Print name - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, pcd->strName, cchLen, lpInfo) ) ) - return E_FAIL; - // Print value - dwValue = *(WORD *)(((BYTE *)pv) + pcd->dwOffset); - *szValue = 0; - Int2Str(szValue,100,dwValue); - if( FAILED( PrintLine (xVal, yLine, szValue, strlen(szValue), lpInfo) ) ) - return E_FAIL; - // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) - return E_FAIL; - break; - - case 0x1FFFFFFF: // "-1 == unlimited" - // Print name - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, pcd->strName, cchLen, lpInfo) ) ) - return E_FAIL; - // Print value - *szValue = 0; - if (dwValue == 0xFFFFFFFF) - strcpy_s(szValue, sizeof(szValue), "Unlimited"); - else - Int2Str(szValue, 100, dwValue); - if( FAILED( PrintLine (xVal, yLine, szValue, strlen(szValue), lpInfo) ) ) - return E_FAIL; - // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) - return E_FAIL; - break; - - default: - if (pcd->dwFlag & dwValue) - { - // Print Name - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, pcd->strName, cchLen, lpInfo) ) ) - return E_FAIL; - - // Print Yes in value column - cchLen = _tcslen (c_szYes); - if( FAILED( PrintLine (xVal, yLine, c_szYes, cchLen, lpInfo) ) ) - return E_FAIL; - - // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) - return E_FAIL; - } - else if (g_dwViewState == IDM_VIEWALL) - { - // Print name - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, pcd->strName, cchLen, lpInfo) ) ) - return E_FAIL; - - // Print No in value column - cchLen = _tcslen (c_szNo); - if( FAILED( PrintLine (xVal, yLine, c_szNo, cchLen, lpInfo) ) ) - return E_FAIL; - - // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) - return E_FAIL; - } + } break; } } @@ -898,19 +833,19 @@ HRESULT PrintCapsToDC( CAPDEF *pcd, LPVOID pv, PRINTCBINFO * lpInfo ) char szBuff[80]; // Print name - sprintf_s (szBuff, sizeof(szBuff), pcd->strName, "test"); - cchLen = _tcslen (pcd->strName); - if( FAILED( PrintLine (xName, yLine, szBuff, cchLen, lpInfo) ) ) + sprintf_s(szBuff, sizeof(szBuff), pcd->strName, "test"); + cchLen = static_cast(_tcslen(pcd->strName)); + if (FAILED(PrintLine(xName, yLine, szBuff, cchLen, lpInfo))) return E_FAIL; // Print value Int2Str(szBuff, 80, dwValue); - cchLen = _tcslen (szBuff); - if( FAILED( PrintLine (xVal, yLine, szBuff, cchLen, lpInfo) ) ) + cchLen = static_cast(_tcslen(szBuff)); + if (FAILED(PrintLine(xVal, yLine, szBuff, cchLen, lpInfo))) return E_FAIL; // Advance to next line on page - if( FAILED( PrintNextLine(lpInfo) ) ) + if (FAILED(PrintNextLine(lpInfo))) return E_FAIL; } @@ -921,27 +856,20 @@ HRESULT PrintCapsToDC( CAPDEF *pcd, LPVOID pv, PRINTCBINFO * lpInfo ) } - - //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -void DXView_OnTreeSelect(HWND hwndTV, NM_TREEVIEW *ptv) +void DXView_OnTreeSelect(HWND /*hwndTV*/, NM_TREEVIEW* ptv) { - NODEINFO *pni; - SendMessage(g_hwndLV, WM_SETREDRAW, FALSE, 0); LVDeleteAllItems(g_hwndLV); LVAddColumn(g_hwndLV, 0, "", 0); - if (ptv == NULL) + NODEINFO* pni = nullptr; + if (!ptv) { - TV_ITEM tvi; + TV_ITEM tvi = {}; // get lParam of current tree node - tvi.hItem = TreeView_GetSelection(g_hwndTV); - tvi.mask = TVIF_PARAM; - tvi.lParam = 0; + tvi.hItem = TreeView_GetSelection(g_hwndTV); + tvi.mask = TVIF_PARAM; TreeView_GetItem(g_hwndTV, &tvi); pni = (NODEINFO*)tvi.lParam; } @@ -952,127 +880,104 @@ void DXView_OnTreeSelect(HWND hwndTV, NM_TREEVIEW *ptv) if (pni && pni->fnDisplayCallback) { - if( pni->bUseLParam3 ) - ((DISPLAYCALLBACKEX)(pni->fnDisplayCallback))(pni->lParam1, pni->lParam2, pni->lParam3, NULL ); + if (pni->bUseLParam3) + ((DISPLAYCALLBACKEX)(pni->fnDisplayCallback))(pni->lParam1, pni->lParam2, pni->lParam3, nullptr); else - pni->fnDisplayCallback(pni->lParam1, pni->lParam2, NULL ); + pni->fnDisplayCallback(pni->lParam1, pni->lParam2, nullptr); } - ListView_SetItemState( g_hwndLV, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED ); + ListView_SetItemState(g_hwndLV, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); SendMessage(g_hwndLV, WM_SETREDRAW, TRUE, 0); - InvalidateRect(g_hwndLV, NULL, TRUE); + InvalidateRect(g_hwndLV, nullptr, TRUE); } - - -//----------------------------------------------------------------------------- -// Name: -// Desc: //----------------------------------------------------------------------------- void DXView_OnListViewDblClick(HWND hwndLV, NM_LISTVIEW *plv) { - LV_ITEM lvi; - + LV_ITEM lvi = {}; lvi.mask = LVIF_PARAM; - lvi.lParam = 0; lvi.iItem = plv->iItem; ListView_GetItem(hwndLV, &lvi); } - - -//----------------------------------------------------------------------------- -// Name: -// Desc: //----------------------------------------------------------------------------- void DXView_OnCommand(HWND hWnd, WPARAM wParam) { HMENU hMenu; - switch(LOWORD(wParam)) + switch (LOWORD(wParam)) { - case IDM_VIEWAVAIL: - case IDM_VIEWALL: - hMenu = GetMenu(hWnd); - CheckMenuItem(hMenu, g_dwViewState, MF_BYCOMMAND | MF_UNCHECKED); - g_dwViewState = LOWORD(wParam); - CheckMenuItem(hMenu, g_dwViewState, MF_BYCOMMAND | MF_CHECKED); - DXView_OnTreeSelect(g_hwndTV, NULL); - break; + case IDM_VIEWAVAIL: + case IDM_VIEWALL: + hMenu = GetMenu(hWnd); + CheckMenuItem(hMenu, g_dwViewState, MF_BYCOMMAND | MF_UNCHECKED); + g_dwViewState = LOWORD(wParam); + CheckMenuItem(hMenu, g_dwViewState, MF_BYCOMMAND | MF_CHECKED); + DXView_OnTreeSelect(g_hwndTV, nullptr); + break; - case IDM_VIEW9EX: - hMenu = GetMenu(hWnd); - g_dwView9Ex = !g_dwView9Ex; - CheckMenuItem(hMenu, IDM_VIEW9EX, MF_BYCOMMAND | (g_dwView9Ex? MF_CHECKED : MF_UNCHECKED)); - DXView_OnTreeSelect(g_hwndTV, NULL); - break; + case IDM_VIEW9EX: + hMenu = GetMenu(hWnd); + g_dwView9Ex = !g_dwView9Ex; + CheckMenuItem(hMenu, IDM_VIEW9EX, MF_BYCOMMAND | (g_dwView9Ex ? MF_CHECKED : MF_UNCHECKED)); + DXView_OnTreeSelect(g_hwndTV, nullptr); + break; - case IDM_PRINTWHOLETREETOPRINTER: - g_PrintToFile = FALSE; - DXView_OnPrint( hWnd, g_hwndTV, TRUE ); - break; + case IDM_PRINTWHOLETREETOPRINTER: + g_PrintToFile = FALSE; + DXView_OnPrint(hWnd, g_hwndTV, TRUE); + break; - case IDM_PRINTSUBTREETOPRINTER: - g_PrintToFile = FALSE; - DXView_OnPrint( hWnd, g_hwndTV, FALSE ); - break; + case IDM_PRINTSUBTREETOPRINTER: + g_PrintToFile = FALSE; + DXView_OnPrint(hWnd, g_hwndTV, FALSE); + break; - case IDM_PRINTWHOLETREETOFILE: - g_PrintToFile = TRUE; - DXView_OnFile( hWnd, g_hwndTV, TRUE ); - break; + case IDM_PRINTWHOLETREETOFILE: + g_PrintToFile = TRUE; + DXView_OnFile(hWnd, g_hwndTV, TRUE); + break; - case IDM_PRINTSUBTREETOFILE: - g_PrintToFile = TRUE; - DXView_OnFile( hWnd, g_hwndTV, FALSE ); - break; + case IDM_PRINTSUBTREETOFILE: + g_PrintToFile = TRUE; + DXView_OnFile(hWnd, g_hwndTV, FALSE); + break; - case IDM_COPY: + case IDM_COPY: + { + // Put g_szClip into the clipboard + UINT GlobalSize = static_cast(strlen(g_szClip) + 1); + HGLOBAL hGlobal = GlobalAlloc(GHND | GMEM_SHARE, GlobalSize); + if (hGlobal) + { + VOID* pGlobal = GlobalLock(hGlobal); + if (pGlobal) { - // Put g_szClip into the clipboard - HGLOBAL hGlobal; - VOID* pGlobal; - UINT GlobalSize= strlen(g_szClip) + 1; - hGlobal = GlobalAlloc(GHND | GMEM_SHARE, GlobalSize ); - if( hGlobal != NULL ) - { - pGlobal = GlobalLock(hGlobal); - if( pGlobal != NULL ) - { - strcpy_s((CHAR*)pGlobal, GlobalSize, g_szClip); - GlobalUnlock(hGlobal); - OpenClipboard(g_hwndMain); - EmptyClipboard(); - SetClipboardData(CF_TEXT, hGlobal); - CloseClipboard(); - } - } + strcpy_s((CHAR*)pGlobal, GlobalSize, g_szClip); + GlobalUnlock(hGlobal); + OpenClipboard(g_hwndMain); + EmptyClipboard(); + SetClipboardData(CF_TEXT, hGlobal); + CloseClipboard(); } - break; + } + } + break; - case IDM_ABOUT: - DialogBox(g_hInstance, "About", hWnd, (DLGPROC)About); - break; + case IDM_ABOUT: + DialogBox(g_hInstance, "About", hWnd, (DLGPROC)About); + break; - case IDM_HELP: - InvokeHelp(); - break; - - case IDM_EXIT: - PostMessage(hWnd, WM_CLOSE, 0, 0); - break; + case IDM_EXIT: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; } } - - -//----------------------------------------------------------------------------- -// Name: -// Desc: //----------------------------------------------------------------------------- void DXView_Cleanup() { @@ -1082,144 +987,124 @@ void DXView_Cleanup() DD_CleanUp(); - if( g_hImageList ) - ImageList_Destroy( g_hImageList ); + if (g_hImageList) + ImageList_Destroy(g_hImageList); } - - -//----------------------------------------------------------------------------- -// Name: -// Desc: //----------------------------------------------------------------------------- BOOL DXView_InitImageList() { - int cxSmIcon; - int cySmIcon; - UINT Index; - HICON hIcon; - if (g_hImageList) return TRUE; - cxSmIcon = GetSystemMetrics(SM_CXSMICON); - cySmIcon = GetSystemMetrics(SM_CYSMICON); + int cxSmIcon = GetSystemMetrics(SM_CXSMICON); + int cySmIcon = GetSystemMetrics(SM_CYSMICON); // First, create the image list that is needed. - if((g_hImageList = ImageList_Create(cxSmIcon, cySmIcon, TRUE, IDI_LASTIMAGE - IDI_FIRSTIMAGE, 10)) == NULL) + if ((g_hImageList = ImageList_Create(cxSmIcon, cySmIcon, TRUE, IDI_LASTIMAGE - IDI_FIRSTIMAGE, 10)) == nullptr) return(FALSE); // // Initialize the image list with all of the icons that we'll be using // Once set, send its handle to all interested child windows. // - for (Index = IDI_FIRSTIMAGE; Index <= IDI_LASTIMAGE; Index++) + for (UINT Index = IDI_FIRSTIMAGE; Index <= IDI_LASTIMAGE; Index++) { - hIcon = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(Index), IMAGE_ICON, cxSmIcon, cySmIcon, 0); - if( hIcon != NULL ) + auto hIcon = reinterpret_cast(LoadImage(g_hInstance, MAKEINTRESOURCE(Index), IMAGE_ICON, cxSmIcon, cySmIcon, 0)); + if (hIcon) { ImageList_AddIcon(g_hImageList, hIcon); DestroyIcon(hIcon); } } - TreeView_SetImageList( g_hwndTV, g_hImageList, TVSIL_NORMAL ); + TreeView_SetImageList(g_hwndTV, g_hImageList, TVSIL_NORMAL); return TRUE; } - - //----------------------------------------------------------------------------- // Name: About() // Desc: Process about box //----------------------------------------------------------------------------- -LRESULT CALLBACK About( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK About(HWND hDlg, UINT msg, WPARAM wParam, LPARAM /*lParam*/) { - switch( msg ) + switch (msg) { - case WM_INITDIALOG: - TCHAR str[500]; - TCHAR strFmt[500]; - TCHAR szFile[MAX_PATH]; - TCHAR strVersion[100]; - UINT cb; - DWORD dwHandle; + case WM_INITDIALOG: + { + VS_FIXEDFILEINFO* pVersion = nullptr; + TCHAR strFmt[500]; + GetWindowText(GetDlgItem(hDlg, IDC_VERSION), strFmt, 500); + + TCHAR szFile[MAX_PATH]; + *szFile = 0; + GetModuleFileName(nullptr, szFile, MAX_PATH); + + DWORD dwHandle; + UINT cb = GetFileVersionInfoSize(szFile, &dwHandle/*ignored*/); + if (cb > 0) + { BYTE FileVersionBuffer[1024]; - VS_FIXEDFILEINFO* pVersion; - pVersion = NULL; - GetWindowText( GetDlgItem( hDlg, IDC_VERSION ), strFmt, 500 ); - *szFile = 0; - GetModuleFileName(NULL, szFile, MAX_PATH); + if (cb > sizeof(FileVersionBuffer)) + cb = sizeof(FileVersionBuffer); - cb = GetFileVersionInfoSize(szFile, &dwHandle/*ignored*/); - if (cb > 0) + if (GetFileVersionInfo(szFile, 0, cb, FileVersionBuffer)) { - if (cb > sizeof(FileVersionBuffer)) - cb = sizeof(FileVersionBuffer); - - if (GetFileVersionInfo(szFile, 0, cb, FileVersionBuffer)) + pVersion = nullptr; + if (VerQueryValue(FileVersionBuffer, "\\", (VOID**)&pVersion, &cb) + && pVersion != nullptr) { - pVersion = NULL; - if (VerQueryValue(FileVersionBuffer, "\\", (VOID**)&pVersion, &cb) - && pVersion != NULL) - { - sprintf_s(strVersion, sizeof(strVersion), "%d.%02d.%02d.%04d", - HIWORD(pVersion->dwFileVersionMS), - LOWORD(pVersion->dwFileVersionMS), - HIWORD(pVersion->dwFileVersionLS), - LOWORD(pVersion->dwFileVersionLS) ); + TCHAR strVersion[100]; + sprintf_s(strVersion, sizeof(strVersion), "%u.%02u.%02u.%04u", + HIWORD(pVersion->dwFileVersionMS), + LOWORD(pVersion->dwFileVersionMS), + HIWORD(pVersion->dwFileVersionLS), + LOWORD(pVersion->dwFileVersionLS)); - sprintf_s(str, sizeof(str), strFmt, strVersion ); - SetWindowText( GetDlgItem( hDlg, IDC_VERSION ), str ); - } + TCHAR str[500]; + sprintf_s(str, sizeof(str), strFmt, strVersion); + SetWindowText(GetDlgItem(hDlg, IDC_VERSION), str); } } + } - // Note: The warning text is static, but it must be set via code, - // not in the .rc file, because it is > 256 characters (warning RC4206). - { - const TCHAR* pstrWarning = TEXT("Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law."); - SetWindowText( GetDlgItem( hDlg, IDC_WARNING), pstrWarning ); - } + // Note: The warning text is static, but it must be set via code, + // not in the .rc file, because it is > 256 characters (warning RC4206). + { + const TCHAR* pstrWarning = TEXT("Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law."); + SetWindowText(GetDlgItem(hDlg, IDC_WARNING), pstrWarning); + } + return TRUE; + } + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, TRUE); // Exit the dialog return TRUE; - - case WM_COMMAND: - if( LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL ) - { - EndDialog( hDlg, TRUE ); // Exit the dialog - return TRUE; - } - break; + } + break; } return FALSE; } - - //----------------------------------------------------------------------------- // Name: DXView_OnSize() // Desc: Called whenever the size of the app window has changed or the size // of its child controls should be adjusted. //----------------------------------------------------------------------------- -VOID DXView_OnSize( HWND hWnd ) +VOID DXView_OnSize(HWND hWnd) { - HDWP hDWP; - RECT ClientRect; - int Height; - HWND hKeyTreeWnd; - HWND hValueListWnd; - int x; - int dx; - - if( IsIconic(hWnd) ) + if (IsIconic(hWnd)) return; - if( (hDWP = BeginDeferWindowPos(2)) != NULL ) + HDWP hDWP; + if ((hDWP = BeginDeferWindowPos(2)) != nullptr) { // Data structure used when calling GetEffectiveClientRect (which takes into // account space taken up by the toolbars/status bars). First half of the @@ -1230,20 +1115,21 @@ VOID DXView_OnSize( HWND hWnd ) 0, 0 // First zero marks end of data }; + RECT ClientRect; GetEffectiveClientRect(hWnd, &ClientRect, s_EffectiveClientRectData); - Height = ClientRect.bottom - ClientRect.top; + int Height = ClientRect.bottom - ClientRect.top; - hKeyTreeWnd = g_hwndTV; + HWND hKeyTreeWnd = g_hwndTV; - DeferWindowPos(hDWP, hKeyTreeWnd, NULL, 0, ClientRect.top, g_xPaneSplit, + DeferWindowPos(hDWP, hKeyTreeWnd, nullptr, 0, ClientRect.top, g_xPaneSplit, Height, SWP_NOZORDER | SWP_NOACTIVATE); - x = g_xPaneSplit + GetSystemMetrics(SM_CXSIZEFRAME); - dx = ClientRect.right - ClientRect.left - x; + int x = g_xPaneSplit + GetSystemMetrics(SM_CXSIZEFRAME); + int dx = ClientRect.right - ClientRect.left - x; - hValueListWnd = g_hwndLV; + HWND hValueListWnd = g_hwndLV; - DeferWindowPos(hDWP, hValueListWnd, NULL, x, ClientRect.top, dx, Height, + DeferWindowPos(hDWP, hValueListWnd, nullptr, x, ClientRect.top, dx, Height, SWP_NOZORDER | SWP_NOACTIVATE); EndDeferWindowPos(hDWP); @@ -1251,67 +1137,48 @@ VOID DXView_OnSize( HWND hWnd ) } - //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -void LVAddColumn(HWND hwndLV, int i, const char *name, int width) +void LVAddColumn(HWND hwndLV, int i, const char* name, int width) { - LV_COLUMN col; - if (i == 0) { - while(ListView_DeleteColumn(hwndLV, 0)) + while (ListView_DeleteColumn(hwndLV, 0)) ; } + LV_COLUMN col = {}; col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; - col.fmt = LVCFMT_LEFT; + col.fmt = LVCFMT_LEFT; col.pszText = (char*)name; - col.cchTextMax = 0; col.cx = width * g_tmAveCharWidth; - col.iSubItem = 0; ListView_InsertColumn(hwndLV, i, &col); } - - //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -int LVAddText(HWND hwndLV, int col, const char *sz, ...) +int LVAddText(HWND hwndLV, int col, const char* sz, ...) { - LV_ITEM lvi; - char ach[80]; va_list vl; + va_start(vl, sz); - va_start(vl, sz ); - + char ach[80]; vsprintf_s(ach, sizeof(ach), sz, vl); ach[79] = '\0'; - lvi.mask = LVIF_TEXT; - lvi.iSubItem = 0; - lvi.state = 0; - lvi.stateMask = 0; - lvi.pszText = ach; - lvi.cchTextMax = 0; - lvi.iImage = 0; - lvi.lParam = 0; + LV_ITEM lvi = {}; + lvi.mask = LVIF_TEXT; + lvi.pszText = ach; if (col == 0) { - lvi.iItem = 0x7FFF; + lvi.iItem = 0x7FFF; lvi.iSubItem = 0; va_end(vl); return ListView_InsertItem(hwndLV, &lvi); } else { - lvi.iItem = ListView_GetItemCount(hwndLV)-1; + lvi.iItem = ListView_GetItemCount(hwndLV) - 1; lvi.iSubItem = col; va_end(vl); return ListView_SetItem(hwndLV, &lvi); @@ -1319,169 +1186,70 @@ int LVAddText(HWND hwndLV, int col, const char *sz, ...) } - - //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -void LVDeleteAllItems( HWND hwndLV ) +void LVDeleteAllItems(HWND hwndLV) { - ListView_DeleteAllItems( hwndLV ); + ListView_DeleteAllItems(hwndLV); } - - //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HTREEITEM TVAddNode( HTREEITEM hParent, LPCSTR strText, BOOL fKids, - int iImage, DISPLAYCALLBACK fnDisplayCallback, LPARAM lParam1, - LPARAM lParam2 ) +HTREEITEM TVAddNode(HTREEITEM hParent, LPCSTR strText, BOOL fKids, + int iImage, DISPLAYCALLBACK fnDisplayCallback, LPARAM lParam1, + LPARAM lParam2) { - TV_INSERTSTRUCT tvi; - NODEINFO* pni; + auto pni = reinterpret_cast(LocalAlloc(LPTR, sizeof(NODEINFO))); + if (!pni) + return nullptr; - pni = (NODEINFO*)LocalAlloc( LPTR, sizeof(NODEINFO) ); - - if( pni == NULL ) - return NULL; - - pni->bUseLParam3 = FALSE; - pni->lParam1 = lParam1; - pni->lParam2 = lParam2; - pni->lParam3 = 0; + pni->bUseLParam3 = FALSE; + pni->lParam1 = lParam1; + pni->lParam2 = lParam2; + pni->lParam3 = 0; pni->fnDisplayCallback = fnDisplayCallback; // Add Node to treeview - tvi.hParent = hParent; - tvi.hInsertAfter = TVI_LAST; - tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | - TVIF_PARAM | TVIF_CHILDREN; - tvi.item.iImage = iImage - IDI_FIRSTIMAGE; + TV_INSERTSTRUCT tvi = {}; + tvi.hParent = hParent; + tvi.hInsertAfter = TVI_LAST; + tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | + TVIF_PARAM | TVIF_CHILDREN; + tvi.item.iImage = iImage - IDI_FIRSTIMAGE; tvi.item.iSelectedImage = iImage - IDI_FIRSTIMAGE; - tvi.item.lParam = (LPARAM)pni; - tvi.item.cChildren = fKids; - tvi.item.pszText = (LPSTR)strText; + tvi.item.lParam = (LPARAM)pni; + tvi.item.cChildren = fKids; + tvi.item.pszText = (LPSTR)strText; - return TreeView_InsertItem( g_hwndTV, &tvi ); + return TreeView_InsertItem(g_hwndTV, &tvi); } - - //----------------------------------------------------------------------------- -// Name: -// Desc: -//----------------------------------------------------------------------------- -HTREEITEM TVAddNodeEx( HTREEITEM hParent, LPCSTR strText, BOOL fKids, - int iImage, DISPLAYCALLBACKEX fnDisplayCallback, LPARAM lParam1, - LPARAM lParam2, LPARAM lParam3 ) +HTREEITEM TVAddNodeEx(HTREEITEM hParent, LPCSTR strText, BOOL fKids, + int iImage, DISPLAYCALLBACKEX fnDisplayCallback, LPARAM lParam1, + LPARAM lParam2, LPARAM lParam3) { - TV_INSERTSTRUCT tvi; - NODEINFO* pni; + auto pni = reinterpret_cast(LocalAlloc(LPTR, sizeof(NODEINFO))); + if (!pni) + return nullptr; - pni = (NODEINFO*)LocalAlloc( LPTR, sizeof(NODEINFO) ); - - if( pni == NULL ) - return NULL; - - pni->bUseLParam3 = TRUE; - pni->lParam1 = lParam1; - pni->lParam2 = lParam2; - pni->lParam3 = lParam3; - pni->fnDisplayCallback = (DISPLAYCALLBACK)fnDisplayCallback; + pni->bUseLParam3 = TRUE; + pni->lParam1 = lParam1; + pni->lParam2 = lParam2; + pni->lParam3 = lParam3; + pni->fnDisplayCallback = reinterpret_cast(fnDisplayCallback); // Add Node to treeview - tvi.hParent = hParent; - tvi.hInsertAfter = TVI_LAST; - tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | - TVIF_PARAM | TVIF_CHILDREN; - tvi.item.iImage = iImage - IDI_FIRSTIMAGE; + TV_INSERTSTRUCT tvi = {}; + tvi.hParent = hParent; + tvi.hInsertAfter = TVI_LAST; + tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | + TVIF_PARAM | TVIF_CHILDREN; + tvi.item.iImage = iImage - IDI_FIRSTIMAGE; tvi.item.iSelectedImage = iImage - IDI_FIRSTIMAGE; - tvi.item.lParam = (LPARAM)pni; - tvi.item.cChildren = fKids; - tvi.item.pszText = (LPSTR)strText; + tvi.item.lParam = (LPARAM)pni; + tvi.item.cChildren = fKids; + tvi.item.pszText = (LPSTR)strText; - return TreeView_InsertItem( g_hwndTV, &tvi ); + return TreeView_InsertItem(g_hwndTV, &tvi); } - - -//----------------------------------------------------------------------------- -VOID FindHelp() -{ - *g_helpPath = 0; - - TCHAR strPath[MAX_PATH]; - *strPath = 0; - GetModuleFileName( NULL, strPath, MAX_PATH ); - PathRemoveFileSpec( strPath ); - PathAppend( strPath, TEXT("..") ); // up to bin - PathAppend( strPath, TEXT("..") ); // up to utilities - PathAppend( strPath, TEXT("..") ); // up to SDK - PathAppend( strPath, TEXT("Documentation") ); - PathAppend( strPath, TEXT("DirectX9") ); - - TCHAR strHelp[MAX_PATH]; - sprintf_s( strHelp, MAX_PATH, "%s\\directx_sdk.chm", strPath ); - - if( !PathFileExists( strHelp ) ) - { - // Try the current directory instead - GetModuleFileName( NULL, strPath, MAX_PATH ); - PathRemoveFileSpec( strPath ); - sprintf_s( strHelp, MAX_PATH, "%s\\directx_sdk.chm", strPath ); - - if( !PathFileExists( strHelp ) ) - { - // Look for the environment variable - ::GetEnvironmentVariable( TEXT("DXSDK_DIR"), strPath, MAX_PATH); - sprintf_s( strHelp, MAX_PATH, "%sDocumentation\\DirectX9\\directx_sdk.chm", strPath ); - if( !PathFileExists( strHelp ) ) - { - return; - } - } - } - - strcpy_s( g_helpPath, MAX_PATH, strHelp ); -} - - -//----------------------------------------------------------------------------- -VOID InvokeHelp() -{ - // Check if help is available - if( *g_helpPath == 0 ) - { - MessageBox( g_hwndMain, TEXT("Help file not found."), g_strAppName, MB_OK ); - return; - } - - TCHAR strHelp[ MAX_PATH ]; - strcpy_s( strHelp, MAX_PATH, g_helpPath ); - - strcat_s( strHelp, MAX_PATH, "::/DirectX_Caps_Viewer_Tool.htm" ); - -#if _MFC_VER >= 0x0710 - HtmlHelp( (DWORD_PTR)strHelp, HH_DISPLAY_TOPIC ); -#else - ::HtmlHelp( NULL, strHelp, HH_DISPLAY_TOPIC, NULL ); -#endif -} - - -//----------------------------------------------------------------------------- -// Name: DisplayErrorMessage() -// Desc: Displays an error message in a message box -//----------------------------------------------------------------------------- -VOID DisplayErrorMessage( const CHAR* strError ) -{ - if( !g_PrintToFile ) - MessageBox( g_hwndMain, strError, g_strAppName, MB_OK ); -} - - - diff --git a/dxview.h b/dxview.h index 525fed8..c472162 100644 --- a/dxview.h +++ b/dxview.h @@ -1,24 +1,19 @@ //----------------------------------------------------------------------------- // Name: DXView.h // -// Desc: DirectX Device Viewer - Common header file +// Desc: DirectX Capabilities Viewer Common Header // -//@@BEGIN_MSINTERNAL -// -// Hist: 05.24.99 - mwetzel - I didn't write this, I'm just cleaning it up, so -// don't complain to me how horrid this app is. -// -//@@END_MSINTERNAL // Copyright (c) Microsoft Corporation. All Rights Reserved. //----------------------------------------------------------------------------- -#include +#include #include #include #include #include -#include "resource.h" #include +#include "resource.h" + //----------------------------------------------------------------------------- // Defines //----------------------------------------------------------------------------- @@ -34,7 +29,7 @@ #define TIMER_PERIOD 500 - +#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=nullptr; } } //----------------------------------------------------------------------------- @@ -54,8 +49,8 @@ struct PRINTCBINFO BOOL fStartPage; // In/Out: need to a start new page ?!? }; -typedef HRESULT (*DISPLAYCALLBACK)( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo ); -typedef HRESULT (*DISPLAYCALLBACKEX)( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo ); +using DISPLAYCALLBACK = HRESULT(*)(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pPrintInfo); +using DISPLAYCALLBACKEX = HRESULT(*)(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, _In_opt_ PRINTCBINFO* pPrintInfo); struct NODEINFO { @@ -70,17 +65,17 @@ struct NODEINFO struct CAPDEF { - CHAR* strName; // Name of cap - DWORD dwOffset; // Offset to cap - DWORD dwFlag; // Bit flag for cal - DWORD dwCapsFlags; // used for optional caps and such (see DXV_ values above) + const CHAR* strName; // Name of cap + LONG dwOffset; // Offset to cap + DWORD dwFlag; // Bit flag for cal + DWORD dwCapsFlags; // used for optional caps and such (see DXV_ values above) }; struct CAPDEFS { - CHAR* strName; // Name of cap - DISPLAYCALLBACK fnDisplayCallback; - LPARAM lParam2; + const CHAR* strName; // Name of cap + DISPLAYCALLBACK fnDisplayCallback; + LPARAM lParam2; }; @@ -116,15 +111,15 @@ VOID AddCapsToTV( HTREEITEM hParent, CAPDEFS *pcds, LPARAM lParam1 ); VOID AddColsToLV(); VOID AddCapsToLV( CAPDEF* pcd, VOID* pv ); VOID AddMoreCapsToLV( CAPDEF* pcd, VOID* pv ); -HRESULT PrintCapsToDC( CAPDEF* pcd, VOID* pv, PRINTCBINFO* pInfo ); +HRESULT PrintCapsToDC( CAPDEF* pcd, VOID* pv, _In_ PRINTCBINFO* pInfo ); // Printer Helper functions -HRESULT PrintStartPage( PRINTCBINFO* pci ); -HRESULT PrintEndPage( PRINTCBINFO* pci ); -HRESULT PrintLine( int x, int y, LPCTSTR lpszBuff, DWORD cchBuff, PRINTCBINFO* pci ); -HRESULT PrintNextLine( PRINTCBINFO* pci ); - - +HRESULT PrintLine(int x, int y, _In_count_(cchBuff) LPCTSTR lpszBuff, size_t cchBuff, _In_ PRINTCBINFO* pci); +HRESULT PrintNextLine(_In_ PRINTCBINFO* pci ); +HRESULT PrintValueLine(_In_z_ const char* szText, DWORD dwValue, _In_ PRINTCBINFO* lpInfo); +HRESULT PrintHexValueLine(_In_z_ const CHAR* szText, DWORD dwValue, _In_ PRINTCBINFO* lpInfo); +HRESULT PrintStringValueLine(_In_z_ const CHAR* szText, const CHAR* szText2, _In_ PRINTCBINFO* lpInfo); +HRESULT PrintStringLine(_In_z_ const CHAR* szText, _In_ PRINTCBINFO* lpInfo); //----------------------------------------------------------------------------- diff --git a/dxview.rc b/dxview.rc index a0700e5..d812f32 100644 --- a/dxview.rc +++ b/dxview.rc @@ -1,5 +1,6 @@ -//Microsoft Developer Studio generated resource script. +// Microsoft Visual C++ generated resource script. // + #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS @@ -8,27 +9,18 @@ // Generated from the TEXTINCLUDE 2 resource. // #include -#include -#define VERSIONTYPE VFT_APP -#define VERSIONSUBTYPE VFT2_UNKNOWN -#define VERSIONDESCRIPTION "Microsoft DirectX Caps Viewer\0" -#define VERSIONNAME "dxcapsviewer.exe\0" -#include + ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources +// English (United States) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) -#endif //_WIN32 - -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "DxCapsViewer.manifest" ///////////////////////////////////////////////////////////////////////////// // @@ -55,8 +47,6 @@ BEGIN END POPUP "&Help" BEGIN - MENUITEM "&Help", IDM_HELP - MENUITEM SEPARATOR MENUITEM "&About", IDM_ABOUT END END @@ -120,28 +110,24 @@ IDC_SPLIT CURSOR DISCARDABLE "Split.cur" // TEXTINCLUDE // -1 TEXTINCLUDE DISCARDABLE +1 TEXTINCLUDE BEGIN - "resource.h\0" +"resource.h\0" END -2 TEXTINCLUDE DISCARDABLE +2 TEXTINCLUDE BEGIN - "#include \r\n" - "#define IDC_STATIC -1\r\n" - "#include ""verinfo.h""\r\n" - "#define VERSIONNAME ""dxcapsviewer.exe\\0""\r\n" - "#define VERSIONDESCRIPTION ""Microsoft DirectX Caps Viewer\\0""\r\n" - "#define VERSIONTYPE VFT_APP\r\n" - "#define VERSIONSUBTYPE VFT2_UNKNOWN\r\n" - "#include ""verinfo.ver""\r\n" - "\0" +"#define IDC_STATIC -1\r\n" +"#include \r\n" +"\r\n" +"\r\n" +"\0" END -3 TEXTINCLUDE DISCARDABLE +3 TEXTINCLUDE BEGIN - "\r\n" - "\0" +"\r\n" +"\0" END #endif // APSTUDIO_INVOKED @@ -159,6 +145,45 @@ BEGIN IDS_PRINT_NOROOT "Unable to print, DX View Tree not properly set up." END + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO +FILEVERSION 1, 0, 0, 0 +PRODUCTVERSION 1, 0, 0, 0 +FILEFLAGSMASK 0x3fL +#ifdef _DEBUG +FILEFLAGS 0x1L +#else +FILEFLAGS 0x0L +#endif +FILEOS 0x40004L +FILETYPE 0x1L +FILESUBTYPE 0x0L +BEGIN +BLOCK "StringFileInfo" +BEGIN +BLOCK "040904b0" +BEGIN +VALUE "CompanyName", "Microsoft Corp" +VALUE "FileDescription", "Microsoft DirectX Caps Viewer" +VALUE "FileVersion", "1.0.0.0" +VALUE "InternalName", "dxcapsviewer.exe" +VALUE "LegalCopyright", "Copyright (c) Microsoft Corp." +VALUE "OriginalFilename", "dxcapsviewer.exe" +VALUE "ProductName", "Microsoft DirectX Caps Viewer" +VALUE "ProductVersion", "1.0.0.0" +END +END +BLOCK "VarFileInfo" +BEGIN +VALUE "Translation", 0x409, 1200 +END +END + #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/resource.h b/resource.h index 4353be4..cf1083a 100644 --- a/resource.h +++ b/resource.h @@ -23,7 +23,6 @@ #define IDM_PRINTSUBTREETOFILE 40008 #define IDM_COPY 40009 #define IDM_VIEW9EX 40010 -#define IDM_HELP 40011 // Next default values for new objects //