Menu

[025cc2]: / DirectPython11 / DPDevice.hpp  Maximize  Restore  History

Download this file

121 lines (95 with data), 3.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
Copyright (C) 2010, Heikki Salo
All rights reserved.
Distributed under the BSD license:
http://www.opensource.org/licenses/bsd-license.php
*/
#ifndef DP_DEVICE_HPP
#define DP_DEVICE_HPP
#include "stdafx.h"
class DPWindow;
class DPBuffer;
class DPEffect;
class DPInputLayout;
class DPView;
class DPDeviceState;
class DPTexture;
class DPDevice : boost::noncopyable {
public:
~DPDevice();
DPDevice(DPWindow*, UINT, UINT, UINT, UINT, python::object&);
DPDeviceState* createDepthStencilState(python::dict&);
DPDeviceState* createBlendState(python::dict&);
DPDeviceState* createRasterizerState(python::dict&);
DPDeviceState* createSamplerState(python::dict&);
void setState(DPDeviceState&);
DPDeviceState* getState();
void release();
void reset();
void setFullscreenState(bool, UINT, UINT);
void setInputLayout(DPInputLayout&);
void setVertexBuffers(python::object&);
void setIndexBuffer(DPBuffer&);
void setPrimitiveTopology(UINT);
void setRenderTargetsDefault(bool);
void setRenderTargets(python::object&, python::object&);
void drawAuto();
void draw(UINT, UINT);
void drawInstanced(UINT, UINT, UINT, UINT);
void drawIndexed(UINT, UINT, UINT);
void drawIndexedInstanced(UINT, UINT, UINT, int, UINT);
void flush() { mainContext->Flush(); }
void setStreamOutputTargets(python::object&);
UINT checkFormatSupport(UINT);
UINT checkMultisampleQualityLevels(UINT, UINT);
void present(UINT);
UINT getFeatureLevel() { return (UINT)device->GetFeatureLevel(); }
void dispatch(UINT, UINT, UINT);
void setViewports(python::object&);
python::list getViewports();
void setScissorRects(python::object&);
python::list getScissorRects();
ID3D11Device* getDevice() { return device; }
ID3D11DeviceContext* getContext() { return mainContext; }
IDXGISwapChain* getSwapChain() { return swapChain; }
//Misc
python::object getScreenInfo();
DPTexture* getDefaultRT();
DPView* getDefaultRTView();
DPTexture* getDefaultDS();
DPView* getDefaultDSView();
python::object getDisplayModes(UINT);
void restoreDepthStencilState() { mainContext->OMSetDepthStencilState(defaultDSState, 0); }
void restoreBlendState() { float zeros[4] = {0.0f}; mainContext->OMSetBlendState(defaultBlendState, zeros, 0xffffffff); }
void restoreRasterizerState() { mainContext->RSSetState(defaultRasterState); }
void restoreSamplerState() {
mainContext->CSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1, 0);
mainContext->DSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1, 0);
mainContext->GSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1, 0);
mainContext->HSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1, 0);
mainContext->PSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1, 0);
mainContext->VSSetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1, 0);
}
void setWindow(DPWindow* window) { associatedWindow = window; }
ULONG_PTR getDevicePy();
private:
ID3D11Device* device;
ID3D11DeviceContext* mainContext;
IDXGISwapChain* swapChain;
DPWindow* associatedWindow;
ID3D11Texture2D* renderTarget;
ID3D11RenderTargetView* renderTargetView;
ID3D11Texture2D* depthStencil;
ID3D11DepthStencilView* depthStencilView;
DXGI_FORMAT defaultDSFormat;
//States
ID3D11DepthStencilState* defaultDSState;
ID3D11BlendState* defaultBlendState;
ID3D11RasterizerState* defaultRasterState;
IDXGIAdapter* getAdapterAtIndex(UINT);
void initStates();
};
DPDevice* getDPDevice();
void DPEnableDebug();
bool DPIsDebugEnabled();
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.