I may also give inefficient code or introduce some problems to discourage copy/paste coding. They are meant to just illustrate a point. Any samples given are not meant to have error checking or show best practices.
One question though, have you tried this on multiple systems with different display drivers and multiple versions of Windows or are you limited to only a single test system? I ask this since it is also always possible that this is a Windows or graphics driver The debug layer can help answer a lot of questions when working with Direct3D and DXGI. If you obtain the IDXGIFactory through CreateDXGIFactory or CreateDXGIFactory1, then the debug layer for that factory will automatically load, but if you use CreateDXGIFactory2 then you will need to use the DXGI_CREATE_FACTORY_DEBUG flag. If you use D3D11CreateDevice and obtain the IDXGIFactory instance from the ID3D11Device interface (this includes any of these interfaces with numbers on the end), then again, just putting D3D11_CREATE_DEVICE_DEBUG into the flags for the D3D11CreateDevice If you are going through D3D11CreateDeviceAndSwapChain, all you need to do is add D3D11_CREATE_DEVICE_DEBUG to the flags. ĭXGI WARNING: Live Object : 1 Įnabling the debug layer is easy. ĭXGI WARNING: Live Object at 0x010314A8, Refcount: 2. ĭ3D11 WARNING: Live Object : 7 ĭXGI WARNING: Live Producer at 0x0102C6A4, Refcount: 2. ĭ3D11 WARNING: Live Object at 0x01054A2C, Refcount: 0.
ĭ3D11 WARNING: Live Object at 0x010548BC, Refcount: 0. ĭ3D11 WARNING: Live Object at 0x0105117C, Refcount: 0. ĭ3D11 WARNING: Live Object at 0x010642F0, Refcount: 0. This lesson will build directly off of lesson 18, first person camera. Since spotlights are basically just point lights with a direction, we are able to build directly off code from the pointlight.
ĭ3D11 WARNING: Live Object at 0x01055FB0, Refcount: 0. Here we will learn how to impliment a spotlight, which we will use as a flashlight. ĭ3D11 WARNING: Live Producer at 0x010339D4, Refcount: 2. Please call ReportLiveObjects() at runtime for standard reporting. Notice how I don't release the device object? Well, the debug layer will output:ĭ3D11 WARNING: Process is terminating. Hr = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_BGRA_SUPPORT, nullptr, 0, D3D11_SDK_VERSION, &dev, nullptr, nullptr) HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED) For example, if I use the following code: #include
Usually, the debug layer tells the attached debugger that something has gone wrong.