2010-06-13 19:50:06 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <d3d11.h>
|
|
|
|
#include "Common.h"
|
2010-06-16 23:25:19 +00:00
|
|
|
#include "D3DBlob.h"
|
2010-06-18 23:33:07 +00:00
|
|
|
#include "GfxState.h"
|
2010-06-13 19:50:06 +00:00
|
|
|
|
|
|
|
#define SAFE_RELEASE(x) { if (x) (x)->Release(); (x) = NULL; }
|
2010-06-18 23:45:16 +00:00
|
|
|
#define SAFE_DELETE(x) { delete (x); (x) = NULL; }
|
|
|
|
#define SAFE_DELETE_ARRAY(x) { delete[] (x); (x) = NULL; }
|
2010-06-18 14:14:13 +00:00
|
|
|
#define CHECK(cond, Message, ...) if (!(cond)) { PanicAlert(__FUNCTION__ "Failed in %s at line %d: " Message, __FILE__, __LINE__, __VA_ARGS__); }
|
2010-06-13 19:50:06 +00:00
|
|
|
|
|
|
|
class D3DTexture2D;
|
|
|
|
namespace D3D
|
|
|
|
{
|
|
|
|
|
|
|
|
HRESULT Create(HWND wnd);
|
|
|
|
void Close();
|
|
|
|
|
2010-06-16 23:25:19 +00:00
|
|
|
extern ID3D11Device* device;
|
|
|
|
extern ID3D11DeviceContext* context;
|
|
|
|
extern IDXGISwapChain* swapchain;
|
2010-06-13 19:50:06 +00:00
|
|
|
extern bool bFrameInProgress;
|
|
|
|
|
|
|
|
void Reset();
|
|
|
|
bool BeginFrame();
|
|
|
|
void EndFrame();
|
|
|
|
void Present();
|
|
|
|
|
|
|
|
unsigned int GetBackBufferWidth();
|
|
|
|
unsigned int GetBackBufferHeight();
|
|
|
|
D3DTexture2D* &GetBackBuffer();
|
2010-06-16 23:25:19 +00:00
|
|
|
const char* PixelShaderVersionString();
|
|
|
|
const char* VertexShaderVersionString();
|
2010-06-19 01:02:43 +00:00
|
|
|
bool BGRATexturesSupported();
|
2010-06-13 19:50:06 +00:00
|
|
|
|
|
|
|
// Ihis function will assign a name to the given resource.
|
|
|
|
// The DirectX debug layer will make it easier to identify resources that way,
|
|
|
|
// e.g. when listing up all resources who have unreleased references.
|
2010-06-16 23:25:19 +00:00
|
|
|
inline void SetDebugObjectName(ID3D11DeviceChild* resource, const char* name)
|
2010-06-13 19:50:06 +00:00
|
|
|
{
|
|
|
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
|
|
|
resource->SetPrivateData( WKPDID_D3DDebugObjectName, strlen(name), name);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|