X-Git-Url: https://git.cworth.org/git?p=apitrace-tests;a=blobdiff_plain;f=apps%2Fd3d11_1%2Ftri.cpp;h=f86ab7c2b46168902c79d2dd763c8357cdd23c67;hp=d3c3bff90e664a3ef867da5090d215ffd5207a54;hb=36de802ab2d1c9c55530059595fb52a757252ff3;hpb=7502b519d86575f6ffdd0c4552e54d1cd5808c99 diff --git a/apps/d3d11_1/tri.cpp b/apps/d3d11_1/tri.cpp index d3c3bff..f86ab7c 100644 --- a/apps/d3d11_1/tri.cpp +++ b/apps/d3d11_1/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; @@ -91,6 +91,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; @@ -105,19 +110,19 @@ int main(int argc, char *argv[]){ SwapChainDesc.OutputWindow = hWnd; SwapChainDesc.Windowed = true; - D3D_FEATURE_LEVEL FeatureLevel = D3D_FEATURE_LEVEL_11_1; + static const D3D_FEATURE_LEVEL FeatureLevels[] = { + D3D_FEATURE_LEVEL_11_1, + 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, -#if 0 - &FeatureLevel, - 1, -#else - NULL, - 0, -#endif + Flags, + FeatureLevels, + sizeof FeatureLevels / sizeof FeatureLevels[0], D3D11_SDK_VERSION, &SwapChainDesc, &g_pSwapChain, @@ -235,8 +240,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_pDevice1->CreateRasterizerState(&RasterizerDesc, &pRasterizerState); + hr = g_pDevice1->CreateRasterizerState(&RasterizerDesc, &pRasterizerState); + if (FAILED(hr)) { + return 1; + } g_pDeviceContext1->RSSetState(pRasterizerState); g_pDeviceContext1->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);