X-Git-Url: https://git.cworth.org/git?p=apitrace-tests;a=blobdiff_plain;f=apps%2Fd3d11%2Ftri.cpp;h=b8a2c042903806ebc62b7e0c0a4c0c6001fd1acb;hp=1ccf20c090a8b1f5b08f1355bb0aa98af5c36b6a;hb=36de802ab2d1c9c55530059595fb52a757252ff3;hpb=7502b519d86575f6ffdd0c4552e54d1cd5808c99 diff --git a/apps/d3d11/tri.cpp b/apps/d3d11/tri.cpp index 1ccf20c..b8a2c04 100644 --- a/apps/d3d11/tri.cpp +++ b/apps/d3d11/tri.cpp @@ -34,8 +34,8 @@ #include -#include "tri_vs.h" -#include "tri_ps.h" +#include "tri_vs_4_0.h" +#include "tri_ps_4_0.h" static IDXGISwapChain* g_pSwapChain = NULL; @@ -89,6 +89,11 @@ int main(int argc, char *argv[]){ ShowWindow(hWnd, SW_SHOW); + UINT Flags = 0; + if (LoadLibraryA("d3d11sdklayers")) { + Flags |= D3D11_CREATE_DEVICE_DEBUG; + } + DXGI_SWAP_CHAIN_DESC SwapChainDesc; ZeroMemory(&SwapChainDesc, sizeof SwapChainDesc); SwapChainDesc.BufferDesc.Width = WindowWidth; @@ -103,12 +108,18 @@ int main(int argc, char *argv[]){ SwapChainDesc.OutputWindow = hWnd; SwapChainDesc.Windowed = true; + static const D3D_FEATURE_LEVEL FeatureLevels[] = { + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0 + }; + hr = D3D11CreateDeviceAndSwapChain(NULL, /* pAdapter */ D3D_DRIVER_TYPE_HARDWARE, NULL, /* Software */ - D3D11_CREATE_DEVICE_DEBUG, - NULL, - 0, + Flags, + FeatureLevels, + sizeof FeatureLevels / sizeof FeatureLevels[0], D3D11_SDK_VERSION, &SwapChainDesc, &g_pSwapChain, @@ -216,8 +227,12 @@ int main(int argc, char *argv[]){ RasterizerDesc.CullMode = D3D11_CULL_NONE; RasterizerDesc.FillMode = D3D11_FILL_SOLID; RasterizerDesc.FrontCounterClockwise = true; + RasterizerDesc.DepthClipEnable = true; ID3D11RasterizerState* pRasterizerState = NULL; - g_pDevice->CreateRasterizerState(&RasterizerDesc, &pRasterizerState); + hr = g_pDevice->CreateRasterizerState(&RasterizerDesc, &pRasterizerState); + if (FAILED(hr)) { + return 1; + } g_pDeviceContext->RSSetState(pRasterizerState); g_pDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);