// link to Direct3D 10
#pragma comment (lib, "d3d10.lib")


#include <stdexcept>
#include <comdef.h>  // COM smart-ptr with "Ptr" suffix
#include <d3d10_1.h>




// Smart pointer typedef
_COM_SMARTPTR_TYPEDEF(ID3D10Device, __uuidof(ID3D10Device));



void D3D_test () {
    static unsigned int createDeviceFlags = D3D10_CREATE_DEVICE_BGRA_SUPPORT
    #ifdef _DEBUG
                                          | D3D10_CREATE_DEVICE_DEBUG
    #endif
    ;

    // create device that is NOT connected to a window handle

    // create "REFERENCE"/CPU device instead of "WARP"/CPU to avoid blocky/aliased output
    ID3D10DevicePtr m_d3ddev;
    HRESULT res = D3D10CreateDevice(nullptr, D3D10_DRIVER_TYPE_REFERENCE, nullptr, createDeviceFlags, D3D10_SDK_VERSION, &m_d3ddev);
    if (FAILED(res))
        throw std::runtime_error("D3D device creation failed");
}
