// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include #include #include #include #pragma comment(lib,"user32.lib") #pragma comment(lib,"d3d9.lib") using Microsoft::WRL::ComPtr; int main() { ComPtr pDirect3D; if (FAILED(Direct3DCreate9Ex(D3D_SDK_VERSION, pDirect3D.GetAddressOf()))) { printf("ERROR\n"); return 1; } D3DPRESENT_PARAMETERS d3dpp = {}; d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_COPY; ComPtr pDevice; if (FAILED(pDirect3D->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, GetDesktopWindow(), D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, nullptr, pDevice.GetAddressOf()))) { printf("ERROR\n"); return 1; } if (FAILED(pDevice->CreateQuery(D3DQUERYTYPE_VCACHE, NULL))) { printf("ERROR - VCACHE query not supported\n"); return 1; } ComPtr pQuery; if (FAILED(pDevice->CreateQuery(D3DQUERYTYPE_VCACHE, pQuery.GetAddressOf()))) { printf("ERROR\n"); return 1; } pQuery->Issue(D3DISSUE_END); D3DDEVINFO_VCACHE vcache; while (S_FALSE == pQuery->GetData(&vcache, sizeof(vcache), D3DGETDATA_FLUSH)) ; if (vcache.OptMethod == 1) { printf("vertexCache (size %lu, magic %lu)\n", vcache.CacheSize, vcache.MagicNumber); } else { printf("stripOrder\n"); } return 0; }