annotate RenderD3D11.cpp @ 2466:5a6cd79069ae

project and filter
author zipi
date Sun, 17 Aug 2014 20:34:56 +0100
parents 1d04e48651d4
children 94cf712fc780
rev   line source
2462
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
1 #include <d3dcompiler.h>
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
2 #include <comdef.h> // _com_error
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
3
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
4 #include "ErrorHandling.h"
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
5 #include "RenderD3D11.h"
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
6 #include "mm7_data.h"
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
7
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
8 #define ErrorD3D(x)\
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
9 {\
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
10 HRESULT hr = x;\
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
11 if (FAILED(hr))\
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
12 {\
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
13 _com_error com_error(hr);\
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
14 Error("HRESULT = %08X\n%S", hr, com_error.ErrorMessage());\
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
15 }\
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
16 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
17
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
18
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
19 RenderD3D11::RenderD3D11() {}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
20 RenderD3D11::~RenderD3D11() {}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
21
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
22
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
23 void RenderD3D11::ClearBlack() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
24 void RenderD3D11::SaveWinnersCertificate(const char *a1) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
25 void RenderD3D11::Present() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
26 void RenderD3D11::_49FD3A_fullscreen() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
27 bool RenderD3D11::InitializeFullscreen() {__debugbreak(); return 0;}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
28 void RenderD3D11::CreateZBuffer() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
29 void RenderD3D11::Release() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
30 void RenderD3D11::RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
31 void RenderD3D11::ClearZBuffer(int a2, int a3) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
32 void RenderD3D11::SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
33 bool RenderD3D11::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags) {__debugbreak(); return 0;}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
34 void RenderD3D11::GetTargetPixelFormat(DDPIXELFORMAT *pOut) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
35 void RenderD3D11::LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
36 void RenderD3D11::UnlockBackBuffer() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
37 void RenderD3D11::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
38 void RenderD3D11::UnlockFrontBuffer() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
39 void RenderD3D11::RestoreFrontBuffer() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
40 void RenderD3D11::RestoreBackBuffer() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
41 void RenderD3D11::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
42 void RenderD3D11::BltBackToFontFast(int a2, int a3, RECT *a4) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
43 void RenderD3D11::BeginSceneD3D() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
44 unsigned int RenderD3D11::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) {__debugbreak(); return 0;}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
45 void RenderD3D11::DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
46 void RenderD3D11::DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
47 void RenderD3D11::DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
48 void RenderD3D11::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
49 void RenderD3D11::MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
50 void RenderD3D11::DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
51 void RenderD3D11::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
52 void RenderD3D11::_4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
53 void RenderD3D11::TransformBillboardsAndSetPalettesODM() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
54 void RenderD3D11::DrawBillboardList_BLV() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
55 void RenderD3D11::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
56 bool RenderD3D11::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) {__debugbreak(); return 0;}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
57 bool RenderD3D11::MoveSpriteToDevice(Sprite *pSprite) {__debugbreak(); return 0;}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
58 void RenderD3D11::ScreenFade(unsigned int color, float t) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
59 void RenderD3D11::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
60 void RenderD3D11::ResetTextureClipRect() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
61 void RenderD3D11::CreditsTextureScroll(unsigned int pX, unsigned int pY, int move_X, int move_Y, RGBTexture *pTexture) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
62 void RenderD3D11::DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
63 void RenderD3D11::ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
64 void RenderD3D11::DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
65 void RenderD3D11::DrawTextureTransparent(unsigned int uX, unsigned int uY, struct Texture *pTexture) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
66 void RenderD3D11::DrawAura(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
67 void RenderD3D11::_4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
68 void RenderD3D11::DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
69 void RenderD3D11::DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
70 void RenderD3D11::DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
71 void RenderD3D11::DrawMasked(signed int a2, signed int a3, struct Texture *pTexture, unsigned __int16 mask) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
72 void RenderD3D11::GetLeather(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
73 void RenderD3D11::DrawTextPalette(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
74 void RenderD3D11::DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
75 void RenderD3D11::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
76 void RenderD3D11::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
77 void RenderD3D11::DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture *a4) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
78 void RenderD3D11::DrawBuildingsD3D() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
79 void RenderD3D11::DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
80 void RenderD3D11::DrawOutdoorSkyD3D() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
81 void RenderD3D11::DrawOutdoorSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
82 void RenderD3D11::DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
83 void RenderD3D11::PrepareDecorationsRenderList_ODM() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
84 void RenderD3D11::DrawSpriteObjects_ODM() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
85 void RenderD3D11::RenderTerrainD3D() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
86 void RenderD3D11::ChangeBetweenWinFullscreenModes() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
87 bool RenderD3D11::AreRenderSurfacesOk() {__debugbreak(); return 0;}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
88 void RenderD3D11::SaveScreenshot(const char *pFilename, unsigned int width, unsigned int height) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
89 void RenderD3D11::PackScreenshot(unsigned int width, unsigned int height, void *out_data, unsigned int data_size, unsigned int *screenshot_size) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
90 void RenderD3D11::SavePCXScreenshot() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
91 int RenderD3D11::_46À6ÀÑ_GetActorsInViewport(int pDepth) {__debugbreak(); return 0;}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
92 void RenderD3D11::BeginLightmaps() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
93 void RenderD3D11::EndLightmaps() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
94 void RenderD3D11::BeginLightmaps2() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
95 void RenderD3D11::EndLightmaps2() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
96 bool RenderD3D11::DrawLightmap(struct Lightmap *pLightmap, struct Vec3_float_ *pColorMult, float z_bias) {__debugbreak(); return 0;}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
97 void RenderD3D11::BeginDecals() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
98 void RenderD3D11::EndDecals() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
99 void RenderD3D11::DrawDecal(struct Decal *pDecal, float z_bias) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
100 void RenderD3D11::do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, signed int sDiffuseBegin, const RenderVertexD3D3 *pLineEnd, signed int sDiffuseEnd, float z_stuff) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
101 void RenderD3D11::DrawLines(const RenderVertexD3D3 *vertices, unsigned int num_vertices) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
102 void RenderD3D11::DrawSpecialEffectsQuad(const RenderVertexD3D3 *vertices, IDirect3DTexture2 *texture) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
103 void RenderD3D11::am_Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
104 void RenderD3D11::am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode) {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
105
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
106 void RenderD3D11::Sub01() {__debugbreak();}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
107
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
108
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
109
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
110
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
111
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
112 void RenderD3D11::PresentBlackScreen()
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
113 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
114 ClearTarget(0xFF000000);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
115 ErrorD3D(pSwapChain->Present(0, 0));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
116 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
117
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
118 void RenderD3D11::BeginScene() {}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
119 void RenderD3D11::EndScene() {}
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
120
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
121 void RenderD3D11::ClearTarget(unsigned int uColor)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
122 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
123 float clear_color[] =
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
124 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
125 ((uColor & 0x00FF0000) >> 16) / 255.0f,
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
126 ((uColor & 0x0000FF00) >> 8) / 255.0f,
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
127 ((uColor & 0x000000FF) >> 0) / 255.0f,
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
128 ((uColor & 0xFF000000) >> 24) / 255.0f
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
129 };
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
130 d3dc->ClearRenderTargetView(primary_srv, clear_color);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
131 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
132
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
133
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
134 void RenderD3D11::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
135 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
136 __debugbreak();
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
137 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
138
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
139 bool RenderD3D11::IsGammaSupported()
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
140 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
141 return false;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
142 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
143
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
144 struct
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
145 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
146 unsigned char restore_resolution;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
147 unsigned char _saved_screen_bpp;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
148 unsigned short _saved_screen_width;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
149 unsigned short _saved_screen_height;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
150 } on_exit;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
151
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
152 void ChangeResolution(int new_width, int new_height, int new_bpp)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
153 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
154 if (!on_exit.restore_resolution)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
155 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
156 on_exit.restore_resolution = true;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
157
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
158 auto hdc = GetDC(nullptr);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
159 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
160 on_exit._saved_screen_width = GetDeviceCaps(hdc, HORZRES);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
161 on_exit._saved_screen_height = GetDeviceCaps(hdc, VERTRES);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
162 on_exit._saved_screen_bpp = GetDeviceCaps(hdc, BITSPIXEL);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
163 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
164 ReleaseDC(nullptr, hdc);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
165 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
166
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
167 DEVMODEA dm;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
168 dm.dmSize = sizeof(dm);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
169 dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
170 dm.dmBitsPerPel = new_bpp;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
171 dm.dmPelsWidth = new_width;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
172 dm.dmPelsHeight = new_height;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
173
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
174 if (ChangeDisplaySettingsA(&dm, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
175 Error("ChangeDisplaySettingsA");
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
176 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
177
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
178 __declspec(noreturn) void ExitApp()
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
179 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
180 if (on_exit.restore_resolution)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
181 ChangeResolution(on_exit._saved_screen_width, on_exit._saved_screen_height, on_exit._saved_screen_bpp);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
182
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
183 ExitProcess(0);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
184 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
185
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
186
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
187
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
188 bool RenderD3D11::SwitchToWindow()
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
189 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
190 if (on_exit.restore_resolution)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
191 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
192 on_exit.restore_resolution = false;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
193 ChangeResolution(on_exit._saved_screen_width, on_exit._saved_screen_height, on_exit._saved_screen_bpp);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
194 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
195 return true;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
196 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
197
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
198
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
199
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
200
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
201 bool RenderD3D11::Initialize(OSWindow *window)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
202 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
203 this->window = window;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
204
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
205 auto d3d_lib = LoadLibraryW(L"d3d11.dll");
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
206 if (!d3d_lib)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
207 return Error("d3d11.dll is missing"), false;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
208
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
209
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
210 DXGI_SWAP_CHAIN_DESC swapChainDesc;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
211 memset(&swapChainDesc, 0, sizeof(swapChainDesc));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
212 swapChainDesc.BufferDesc.Width = window->GetWidth();
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
213 swapChainDesc.BufferDesc.Height = window->GetHeight();
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
214 //swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
215 //swapChainDesc.BufferDesc.RefreshRate.Denominator = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
216 swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
217 //swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
218 //swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
219 swapChainDesc.SampleDesc.Count = 1;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
220 //swapChainDesc.SampleDesc.Quality = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
221 swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
222 swapChainDesc.BufferCount = 2;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
223 swapChainDesc.OutputWindow = window->GetApiHandle();
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
224 swapChainDesc.Windowed = true;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
225 //swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
226 //swapChainDesc.Flags = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
227
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
228
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
229 D3D_FEATURE_LEVEL requested_feature_level = D3D_FEATURE_LEVEL_11_0,
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
230 received_feature_level;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
231
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
232 unsigned int device_flags = 0;//D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
233 #ifndef NODEBUG
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
234 device_flags |= D3D11_CREATE_DEVICE_DEBUG /*| D3D11_CREATE_DEVICE_DEBUGGABLE*/;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
235 #endif
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
236
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
237 HRESULT (__stdcall *dll_D3D11CreateDeviceAndSwapChain)(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags, CONST D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, IDXGISwapChain** ppSwapChain, ID3D11Device** ppDevice, D3D_FEATURE_LEVEL* pFeatureLevel, ID3D11DeviceContext** ppImmediateContext);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
238 dll_D3D11CreateDeviceAndSwapChain = (decltype(dll_D3D11CreateDeviceAndSwapChain))GetProcAddress(d3d_lib, "D3D11CreateDeviceAndSwapChain");
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
239 ErrorD3D(dll_D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, device_flags, &requested_feature_level, 1, D3D11_SDK_VERSION, &swapChainDesc, &pSwapChain, &d3dd, &received_feature_level, &d3dc));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
240
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
241 /*if (fullscreen)
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
242 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
243 extern void ChangeResolution(int new_dith, int new_height, int new_bpp);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
244 ChangeResolution(target_window->GetWidth(), target_window->GetHeight(), 32);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
245
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
246 target_window->SetPosition(0, 0);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
247 target_window->SetTopmost(true);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
248 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
249 ErrorD3D(pSwapChain->SetFullscreenState(fullscreen, nullptr));*/
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
250
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
251
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
252 ID3D11Texture2D *pSwapChainSurface;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
253 {
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
254 ErrorD3D(pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void **)&pSwapChainSurface));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
255 ErrorD3D(d3dd->CreateRenderTargetView(pSwapChainSurface, nullptr, &primary_srv));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
256 }
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
257 pSwapChainSurface->Release();
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
258
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
259
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
260 D3D11_TEXTURE2D_DESC z_desc;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
261 memset(&z_desc, 0, sizeof(z_desc));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
262 z_desc.Width = window->GetWidth();
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
263 z_desc.Height = window->GetHeight();
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
264 z_desc.MipLevels = 1;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
265 z_desc.ArraySize = 1;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
266 z_desc.Format = DXGI_FORMAT_D32_FLOAT;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
267 z_desc.SampleDesc.Count = 1;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
268 //z_desc.SampleDesc.Quality = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
269 //z_desc.Usage = D3D11_USAGE_DEFAULT;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
270 z_desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
271 //z_desc.CPUAccessFlags = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
272 //z_desc.MiscFlags = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
273
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
274 ID3D11Texture2D *depth_surface;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
275 ErrorD3D(d3dd->CreateTexture2D(&z_desc, nullptr, &depth_surface));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
276
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
277 D3D11_DEPTH_STENCIL_VIEW_DESC depth_srv_desc;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
278 memset(&depth_srv_desc, 0, sizeof(depth_srv_desc));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
279 depth_srv_desc.Format = DXGI_FORMAT_D32_FLOAT;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
280 depth_srv_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
281 //depth_srv_desc.Texture2D.MipSlice = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
282 ErrorD3D(d3dd->CreateDepthStencilView(depth_surface, &depth_srv_desc, &depth_srv));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
283
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
284 d3dc->OMSetRenderTargets(1, &primary_srv, depth_srv);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
285 d3dc->ClearDepthStencilView(depth_srv, D3D11_CLEAR_DEPTH, 1.0f, 0);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
286
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
287
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
288
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
289 D3D11_RASTERIZER_DESC d3drs_desc;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
290 memset(&d3drs_desc, 0, sizeof(d3drs_desc));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
291 d3drs_desc.FillMode = D3D11_FILL_SOLID;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
292 d3drs_desc.CullMode = D3D11_CULL_NONE;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
293 //d3drs_desc.FrontCounterClockwise = false;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
294 //d3drs_desc.DepthBias = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
295 //d3drs_desc.DepthBiasClamp = 0.0f;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
296 //d3drs_desc.SlopeScaledDepthBias = 0.0f;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
297 //d3drs_desc.DepthClipEnable = true;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
298 //d3drs_desc.ScissorEnable = false;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
299 //d3drs_desc.MultisampleEnable = false;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
300 //d3drs_desc.AntialiasedLineEnable = false;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
301
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
302 ID3D11RasterizerState *d3drs;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
303 ErrorD3D(d3dd->CreateRasterizerState(&d3drs_desc, &d3drs));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
304 d3dc->RSSetState(d3drs);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
305 d3drs->Release();
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
306
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
307
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
308
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
309 D3D11_VIEWPORT viewport;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
310 memset(&viewport, 0, sizeof(viewport));
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
311 viewport.TopLeftX = game_viewport_x;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
312 viewport.TopLeftY = game_viewport_y;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
313 viewport.Width = game_viewport_width;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
314 viewport.Height = game_viewport_height;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
315 //viewport.MinDepth = 0;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
316 viewport.MaxDepth = 1;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
317 d3dc->RSSetViewports(1, &viewport);
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
318
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
319 return true;
1d04e48651d4 Render split into interface and realization, added Direct3D 11
a.parshin
parents:
diff changeset
320 }