CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Windows/GPU/D3D11Context.h
Views: 1401
1
// Copyright (c) 2015- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include "ppsspp_config.h"
21
22
#include "Common/CommonWindows.h"
23
#include "Windows/GPU/WindowsGraphicsContext.h"
24
#include <d3d11.h>
25
#include <d3d11_1.h>
26
27
class DrawContext;
28
29
class D3D11Context : public WindowsGraphicsContext {
30
public:
31
bool Init(HINSTANCE hInst, HWND window, std::string *error_message) override;
32
void Shutdown() override;
33
34
void Resize() override;
35
36
Draw::DrawContext *GetDrawContext() override { return draw_; }
37
38
private:
39
HRESULT CreateTheDevice(IDXGIAdapter *adapter);
40
41
void LostBackbuffer();
42
void GotBackbuffer();
43
44
Draw::DrawContext *draw_ = nullptr;
45
IDXGISwapChain *swapChain_ = nullptr;
46
ID3D11Device *device_ = nullptr;
47
ID3D11Device1 *device1_ = nullptr;
48
ID3D11DeviceContext *context_ = nullptr;
49
ID3D11DeviceContext1 *context1_ = nullptr;
50
51
ID3D11Texture2D *bbRenderTargetTex_ = nullptr;
52
ID3D11RenderTargetView *bbRenderTargetView_ = nullptr;
53
54
#ifdef _DEBUG
55
ID3D11Debug *d3dDebug_ = nullptr;
56
ID3D11InfoQueue *d3dInfoQueue_ = nullptr;
57
#endif
58
D3D_FEATURE_LEVEL featureLevel_ = D3D_FEATURE_LEVEL_11_0;
59
int adapterId = -1;
60
HDC hDC = nullptr; // Private GDI Device Context
61
HWND hWnd_ = nullptr; // Holds Our Window Handle
62
HMODULE hD3D11 = nullptr;
63
int width = 0;
64
int height = 0;
65
int swapInterval_ = 0;
66
};
67
68