/*
Copyright (C) 2010, Heikki Salo
All rights reserved.
Distributed under the BSD license:
http://www.opensource.org/licenses/bsd-license.php
*/
#pragma once
#include "targetver.h"
#define DPVERSIONHEXSTR "0x00000100"
#define DPVERISONMAJOR 0
#define DPVERSIONMINOR 1
#define DPVERSIONMICRO 0
//Buffer and Texture buffer protocol support.
#define DP_BUFFER_SUPPORT
#define WIN32_LEAN_AND_MEAN
//Boost
#include <boost/utility.hpp>
#include <boost/scoped_array.hpp>
#include <boost/python.hpp>
#include <boost/python/slice.hpp>
#include <boost/python/stl_iterator.hpp>
#include <boost/shared_ptr.hpp>
#include <windows.h>
//Direct3D.
#include <d3d11.h>
#include <d3dcompiler.h>
#include <d3dx11.h>
#include <DXErr.h>
//Effects 11 must be built manually.
#include <D3dx11effect.h>
//XNAMath
#define XM_NO_ALIGNMENT
#define _XM_NO_INTRINSICS_
#include <Xnamath.h>
//Standard library.
#include <string>
#include <vector>
#include <set>
#include <sstream>
//Libraries.
#pragma comment(lib, "dxerr.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3dcompiler.lib")
#pragma comment(lib, "Effects11.lib")
#if defined(_DEBUG)
#pragma comment(lib, "d3dx11d.lib")
#else
#pragma comment(lib, "d3dx11.lib")
#endif
//PyPy test build support. *Very* experimental.
#ifdef DP_PYPY
inline void PySys_WriteStdout(const char* text) { }
template<typename T> void Py_AtExit(T arg) { }
#define PySequence_ITEM PySequence_GetItem
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
//No buffer protocol.
#undef DP_BUFFER_SUPPORT
#pragma comment(lib, "libpypy.lib")
#endif
namespace python = boost::python;
//"Safe" release for COM-objects, note the reference argument.
template<typename T>
void SafeRelease(T& comptr)
{
if (comptr != 0) {
comptr->Release();
comptr = 0;
}
}
void DPThrow(const char* message);
void DPThrow(HRESULT);
inline void TestHR(HRESULT hr)
{
if (FAILED(hr)) {
DPThrow(hr);
}
}