mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-13 18:21:01 +00:00
Remove D3D8 and D3D9 stub backends
* These were added 6-7 years ago and have been untouched since. They add no value to preserve as they are almost guaranteed to never be reasonably implemented. * The only thing that is useful is the D3D9 hooks for begin/end events used in some D3D11 programs, which has been moved to the D3D11 project.
This commit is contained in:
@@ -59,10 +59,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxil", "renderdoc\driver\sh
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d11", "renderdoc\driver\d3d11\renderdoc_d3d11.vcxproj", "{F1E59A05-60D4-4927-9E57-DD191EAE90EF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d8", "renderdoc\driver\d3d8\renderdoc_d3d8.vcxproj", "{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d3d9", "renderdoc\driver\d3d9\renderdoc_d3d9.vcxproj", "{44044776-9469-4079-B587-ABFFF6574AA4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vulkan", "renderdoc\driver\vulkan\renderdoc_vulkan.vcxproj", "{88C5DAC6-30A0-4CFD-AF51-540A977D1F3F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gl", "renderdoc\driver\gl\renderdoc_gl.vcxproj", "{F92FCDA6-A261-4EEC-9CD0-73A11FBCC459}"
|
||||
@@ -197,22 +193,6 @@ Global
|
||||
{F1E59A05-60D4-4927-9E57-DD191EAE90EF}.Release|x64.Build.0 = Release|x64
|
||||
{F1E59A05-60D4-4927-9E57-DD191EAE90EF}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F1E59A05-60D4-4927-9E57-DD191EAE90EF}.Release|x86.Build.0 = Release|Win32
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Development|x64.ActiveCfg = Development|x64
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Development|x64.Build.0 = Development|x64
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Development|x86.ActiveCfg = Development|Win32
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Development|x86.Build.0 = Development|Win32
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Release|x64.ActiveCfg = Release|x64
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Release|x64.Build.0 = Release|x64
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Release|x86.ActiveCfg = Release|Win32
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}.Release|x86.Build.0 = Release|Win32
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4}.Development|x64.ActiveCfg = Development|x64
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4}.Development|x64.Build.0 = Development|x64
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4}.Development|x86.ActiveCfg = Development|Win32
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4}.Development|x86.Build.0 = Development|Win32
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4}.Release|x64.ActiveCfg = Release|x64
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4}.Release|x64.Build.0 = Release|x64
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4}.Release|x86.Build.0 = Release|Win32
|
||||
{88C5DAC6-30A0-4CFD-AF51-540A977D1F3F}.Development|x64.ActiveCfg = Development|x64
|
||||
{88C5DAC6-30A0-4CFD-AF51-540A977D1F3F}.Development|x64.Build.0 = Development|x64
|
||||
{88C5DAC6-30A0-4CFD-AF51-540A977D1F3F}.Development|x86.ActiveCfg = Development|Win32
|
||||
@@ -316,8 +296,6 @@ Global
|
||||
{C43FF27E-A155-4852-88EC-5CE9334C07A8} = {DB2DDA74-A668-4AC7-A1D5-198C9F0BD242}
|
||||
{8AE46EC2-EA46-441F-BEE2-94097101D6A3} = {DB2DDA74-A668-4AC7-A1D5-198C9F0BD242}
|
||||
{F1E59A05-60D4-4927-9E57-DD191EAE90EF} = {864A44B0-5612-451A-857F-41E3EF785EF6}
|
||||
{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22} = {864A44B0-5612-451A-857F-41E3EF785EF6}
|
||||
{44044776-9469-4079-B587-ABFFF6574AA4} = {864A44B0-5612-451A-857F-41E3EF785EF6}
|
||||
{88C5DAC6-30A0-4CFD-AF51-540A977D1F3F} = {864A44B0-5612-451A-857F-41E3EF785EF6}
|
||||
{F92FCDA6-A261-4EEC-9CD0-73A11FBCC459} = {864A44B0-5612-451A-857F-41E3EF785EF6}
|
||||
{9E6B10A2-84B4-434D-ABDB-43BE4EA650F4} = {864A44B0-5612-451A-857F-41E3EF785EF6}
|
||||
|
||||
@@ -26,17 +26,12 @@
|
||||
#include "driver/d3d11/d3d11_device.h"
|
||||
#include "hooks/hooks.h"
|
||||
|
||||
#include "driver/dx/official/d3d9.h"
|
||||
#include "d3d9_device.h"
|
||||
|
||||
typedef int(WINAPI *PFN_BEGIN_EVENT)(DWORD, WCHAR *);
|
||||
typedef int(WINAPI *PFN_END_EVENT)();
|
||||
typedef int(WINAPI *PFN_SET_MARKER_EVENT)(DWORD, WCHAR *);
|
||||
typedef void(WINAPI *PFN_SET_OPTIONS)(DWORD);
|
||||
typedef DWORD(WINAPI *PFN_GET_OPTIONS)();
|
||||
|
||||
typedef IDirect3D9 *(WINAPI *PFN_D3D9_CREATE)(UINT);
|
||||
|
||||
class D3D9Hook : LibraryHook
|
||||
{
|
||||
public:
|
||||
@@ -51,8 +46,6 @@ public:
|
||||
PERF_SetMarker.Register("d3d9.dll", "D3DPERF_SetMarker", PERF_SetMarker_hook);
|
||||
PERF_SetOptions.Register("d3d9.dll", "D3DPERF_SetOptions", PERF_SetOptions_hook);
|
||||
PERF_GetStatus.Register("d3d9.dll", "D3DPERF_GetStatus", PERF_GetStatus_hook);
|
||||
|
||||
Create9.Register("d3d9.dll", "Direct3DCreate9", Create9_hook);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -64,7 +57,6 @@ private:
|
||||
HookedFunction<PFN_SET_MARKER_EVENT> PERF_SetMarker;
|
||||
HookedFunction<PFN_SET_OPTIONS> PERF_SetOptions;
|
||||
HookedFunction<PFN_GET_OPTIONS> PERF_GetStatus;
|
||||
HookedFunction<PFN_D3D9_CREATE> Create9;
|
||||
|
||||
static int WINAPI PERF_BeginEvent_hook(DWORD col, WCHAR *wszName)
|
||||
{
|
||||
@@ -98,14 +90,6 @@ private:
|
||||
}
|
||||
|
||||
static DWORD WINAPI PERF_GetStatus_hook() { return 1; }
|
||||
static IDirect3D9 *WINAPI Create9_hook(UINT SDKVersion)
|
||||
{
|
||||
RDCLOG("App creating d3d9 %x", SDKVersion);
|
||||
|
||||
IDirect3D9 *realD3D = d3d9hooks.Create9()(SDKVersion);
|
||||
|
||||
return new WrappedD3D9(realD3D);
|
||||
}
|
||||
};
|
||||
|
||||
D3D9Hook D3D9Hook::d3d9hooks;
|
||||
@@ -133,6 +133,7 @@
|
||||
<ClCompile Include="d3d11_shaderdebug.cpp" />
|
||||
<ClCompile Include="d3d11_stringise.cpp" />
|
||||
<ClCompile Include="d3d11_video.cpp" />
|
||||
<ClCompile Include="d3d9_hooks.cpp" />
|
||||
<ClCompile Include="precompiled.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
|
||||
@@ -123,6 +123,9 @@
|
||||
<ClCompile Include="d3d11_video.cpp">
|
||||
<Filter>Wrapped</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d9_hooks.cpp">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="d3d11_replay.h">
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d8_common.h"
|
||||
#include "d3d8_device.h"
|
||||
|
||||
unsigned int RefCounter8::SoftRef(WrappedD3DDevice8 *device)
|
||||
{
|
||||
unsigned int ret = AddRef();
|
||||
if(device)
|
||||
device->SoftRef();
|
||||
else
|
||||
RDCWARN("No device pointer, is a deleted resource being AddRef()d?");
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int RefCounter8::SoftRelease(WrappedD3DDevice8 *device)
|
||||
{
|
||||
unsigned int ret = Release();
|
||||
if(device)
|
||||
device->SoftRelease();
|
||||
else
|
||||
RDCWARN("No device pointer, is a deleted resource being Release()d?");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void RefCounter8::AddDeviceSoftref(WrappedD3DDevice8 *device)
|
||||
{
|
||||
if(device)
|
||||
device->SoftRef();
|
||||
}
|
||||
|
||||
void RefCounter8::ReleaseDeviceSoftref(WrappedD3DDevice8 *device)
|
||||
{
|
||||
if(device)
|
||||
device->SoftRelease();
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/core.h"
|
||||
#include "driver/dx/official/d3d8.h"
|
||||
|
||||
class WrappedD3DDevice8;
|
||||
|
||||
class RefCounter8
|
||||
{
|
||||
private:
|
||||
IUnknown *m_pReal;
|
||||
unsigned int m_iRefcount;
|
||||
bool m_SelfDeleting;
|
||||
|
||||
protected:
|
||||
void SetSelfDeleting(bool selfDelete) { m_SelfDeleting = selfDelete; }
|
||||
// used for derived classes that need to soft ref but are handling their
|
||||
// own self-deletion
|
||||
static void AddDeviceSoftref(WrappedD3DDevice8 *device);
|
||||
static void ReleaseDeviceSoftref(WrappedD3DDevice8 *device);
|
||||
|
||||
public:
|
||||
RefCounter8(IUnknown *real, bool selfDelete = true)
|
||||
: m_pReal(real), m_iRefcount(1), m_SelfDeleting(selfDelete)
|
||||
{
|
||||
}
|
||||
virtual ~RefCounter8() {}
|
||||
unsigned int GetRefCount() { return m_iRefcount; }
|
||||
//////////////////////////////
|
||||
// implement IUnknown
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
/* [in] */ REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
__RPC__deref_out void **ppvObject)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
InterlockedIncrement(&m_iRefcount);
|
||||
return m_iRefcount;
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
unsigned int ret = InterlockedDecrement(&m_iRefcount);
|
||||
if(ret == 0 && m_SelfDeleting)
|
||||
delete this;
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int SoftRef(WrappedD3DDevice8 *device);
|
||||
unsigned int SoftRelease(WrappedD3DDevice8 *device);
|
||||
};
|
||||
|
||||
#define IMPLEMENT_FUNCTION_SERIALISED(ret, func) \
|
||||
ret func; \
|
||||
bool CONCAT(Serialise_, func);
|
||||
@@ -1,308 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d8_debug.h"
|
||||
#include "os/os_specific.h"
|
||||
#include "stb/stb_truetype.h"
|
||||
#include "strings/string_utils.h"
|
||||
|
||||
D3D8DebugManager::D3D8DebugManager(WrappedD3DDevice8 *wrapper)
|
||||
: m_WrappedDevice(wrapper), m_fvf(D3DFVF_XYZ | D3DFVF_TEX1)
|
||||
{
|
||||
InitFontRendering();
|
||||
}
|
||||
|
||||
D3D8DebugManager::~D3D8DebugManager()
|
||||
{
|
||||
ShutdownFontRendering();
|
||||
}
|
||||
|
||||
bool D3D8DebugManager::InitFontRendering()
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
int width = FONT_TEX_WIDTH;
|
||||
int height = FONT_TEX_HEIGHT;
|
||||
|
||||
rdcstr font = GetEmbeddedResource(sourcecodepro_ttf);
|
||||
byte *ttfdata = (byte *)font.c_str();
|
||||
|
||||
const int firstChar = int(' ') + 1;
|
||||
const int lastChar = 127;
|
||||
const int numChars = lastChar - firstChar;
|
||||
|
||||
byte *buf = new byte[width * height];
|
||||
|
||||
const float pixelHeight = 20.0f;
|
||||
|
||||
stbtt_BakeFontBitmap(ttfdata, 0, pixelHeight, buf, width, height, firstChar, numChars,
|
||||
m_Font.charData);
|
||||
|
||||
stbtt_fontinfo f = {0};
|
||||
stbtt_InitFont(&f, ttfdata, 0);
|
||||
|
||||
int ascent = 0;
|
||||
stbtt_GetFontVMetrics(&f, &ascent, NULL, NULL);
|
||||
|
||||
m_Font.maxHeight = float(ascent) * stbtt_ScaleForPixelHeight(&f, pixelHeight);
|
||||
|
||||
IDirect3DTexture8 *fontTex = NULL;
|
||||
|
||||
hr = m_WrappedDevice->CreateTexture(width, height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, &fontTex);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
RDCERR("Failed to create font texture HRESULT: %s", ToStr(hr).c_str());
|
||||
}
|
||||
|
||||
D3DLOCKED_RECT lockedRegion;
|
||||
hr = fontTex->LockRect(0, &lockedRegion, NULL, D3DLOCK_DISCARD);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
RDCERR("Failed to lock font texture HRESULT: %s", ToStr(hr).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE *texBase = (BYTE *)lockedRegion.pBits;
|
||||
|
||||
for(int y = 0; y < height; y++)
|
||||
{
|
||||
byte *curRow = (texBase + (y * lockedRegion.Pitch));
|
||||
|
||||
for(int x = 0; x < width; x++)
|
||||
{
|
||||
curRow[x * 4 + 0] = buf[(y * width) + x];
|
||||
curRow[x * 4 + 1] = buf[(y * width) + x];
|
||||
curRow[x * 4 + 2] = buf[(y * width) + x];
|
||||
curRow[x * 4 + 3] = buf[(y * width) + x];
|
||||
}
|
||||
}
|
||||
|
||||
hr = fontTex->UnlockRect(0);
|
||||
if(hr != S_OK)
|
||||
{
|
||||
RDCERR("Failed to unlock font texture HRESULT: %s", ToStr(hr).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
m_Font.Tex = fontTex;
|
||||
|
||||
delete[] buf;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void D3D8DebugManager::ShutdownFontRendering()
|
||||
{
|
||||
SAFE_RELEASE(m_Font.Tex);
|
||||
}
|
||||
|
||||
void D3D8DebugManager::SetOutputWindow(HWND w)
|
||||
{
|
||||
// RECT rect;
|
||||
// GetClientRect(w, &rect);
|
||||
// m_supersamplingX = float(m_width) / float(rect.right - rect.left);
|
||||
// m_supersamplingY = float(m_height) / float(rect.bottom - rect.top);
|
||||
}
|
||||
|
||||
void D3D8DebugManager::RenderText(float x, float y, const rdcstr &text)
|
||||
{
|
||||
rdcarray<rdcstr> lines;
|
||||
split(text, lines, '\n');
|
||||
|
||||
for(const rdcstr &line : lines)
|
||||
{
|
||||
RenderTextInternal(x, y, line);
|
||||
y += 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void D3D8DebugManager::RenderTextInternal(float x, float y, const rdcstr &text)
|
||||
{
|
||||
if(text.empty())
|
||||
return;
|
||||
|
||||
RDCASSERT(text.size() < FONT_MAX_CHARS);
|
||||
|
||||
// transforms
|
||||
float width = (float)m_width;
|
||||
float height = (float)m_height;
|
||||
float nearPlane = 0.001f;
|
||||
float farPlane = 1.f;
|
||||
D3DMATRIX identity = {1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f,
|
||||
0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f};
|
||||
D3DMATRIX ortho = {2.f / width,
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
-(2.f / height),
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
1.f / (farPlane - nearPlane),
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
nearPlane / (nearPlane - farPlane),
|
||||
1.f};
|
||||
|
||||
HRESULT res = S_OK;
|
||||
res |= m_WrappedDevice->SetTransform(D3DTS_PROJECTION, &ortho);
|
||||
res |= m_WrappedDevice->SetTransform(D3DTS_WORLD, &identity);
|
||||
res |= m_WrappedDevice->SetTransform(D3DTS_VIEW, &identity);
|
||||
|
||||
// enable fixed function pipeline
|
||||
res |= m_WrappedDevice->SetVertexShader(NULL);
|
||||
res |= m_WrappedDevice->SetPixelShader(NULL);
|
||||
|
||||
// default render states
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_CLIPPING, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_FOGENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0x0000000F);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_DISABLE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
|
||||
|
||||
// texture stage states
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR /*D3DTEXF_POINT*/);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR /*D3DTEXF_POINT*/);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_LINEAR /*D3DTEXF_POINT*/);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_COLORARG0, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ALPHAARG0, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_RESULTARG, D3DTA_CURRENT);
|
||||
|
||||
res |= m_WrappedDevice->SetVertexShader(m_fvf);
|
||||
res |= m_WrappedDevice->SetTexture(0, m_Font.Tex);
|
||||
for(uint32_t stage = 1; stage < 8; stage++)
|
||||
{
|
||||
res |= m_WrappedDevice->SetTexture(stage, NULL);
|
||||
}
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
float pos[3];
|
||||
float uv[2];
|
||||
|
||||
Vertex() {}
|
||||
Vertex(float posx, float posy, float posz, float texu, float texv)
|
||||
{
|
||||
pos[0] = posx;
|
||||
pos[1] = posy;
|
||||
pos[2] = posz;
|
||||
uv[0] = texu;
|
||||
uv[1] = texv;
|
||||
}
|
||||
};
|
||||
|
||||
struct Quad
|
||||
{
|
||||
Vertex vertices[6];
|
||||
|
||||
Quad() {}
|
||||
Quad(float x0, float y0, float z, float s0, float t0, float x1, float y1, float s1, float t1)
|
||||
{
|
||||
vertices[0] = Vertex(x0, y0, z, s0, t0);
|
||||
vertices[1] = Vertex(x1, y0, z, s1, t0);
|
||||
vertices[2] = Vertex(x0, y1, z, s0, t1);
|
||||
vertices[3] = Vertex(x1, y0, z, s1, t0);
|
||||
vertices[4] = Vertex(x1, y1, z, s1, t1);
|
||||
vertices[5] = Vertex(x0, y1, z, s0, t1);
|
||||
}
|
||||
};
|
||||
|
||||
Quad *quads = NULL;
|
||||
Quad background;
|
||||
UINT triangleCount = 0;
|
||||
{
|
||||
UINT quadCount = (UINT)text.size(); // calculate string length
|
||||
|
||||
triangleCount = quadCount * 2;
|
||||
// create text VB
|
||||
quads = new Quad[quadCount];
|
||||
|
||||
float textStartingPositionX = (-width / 2.f) + (x * m_Font.charData[0].xadvance);
|
||||
float textStartingPositionY = (-height / 2.f) + ((y + 1.f) * m_Font.maxHeight);
|
||||
|
||||
float textPositionX = textStartingPositionX;
|
||||
float textPositionY = textStartingPositionY;
|
||||
|
||||
for(UINT i = 0; i < quadCount; ++i)
|
||||
{
|
||||
char glyphIndex = text[i] - (' ' + 1);
|
||||
if(glyphIndex < 0)
|
||||
{
|
||||
float currentX = textPositionX;
|
||||
textPositionX += m_Font.charData[0].xadvance;
|
||||
quads[i] = Quad(currentX, textPositionY - m_Font.maxHeight, 0.5f, 0.f, 0.f, textPositionX,
|
||||
textPositionY, 0.f, 0.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
stbtt_aligned_quad quad;
|
||||
stbtt_GetBakedQuad(m_Font.charData, 256, 128, glyphIndex, &textPositionX, &textPositionY,
|
||||
&quad, 0);
|
||||
quads[i] = Quad(quad.x0, quad.y0, 0.5f, quad.s0, quad.t0, quad.x1, quad.y1, quad.s1, quad.t1);
|
||||
}
|
||||
}
|
||||
|
||||
background = Quad(textStartingPositionX, textStartingPositionY - m_Font.maxHeight, 0.6f, 0.f,
|
||||
0.f, textPositionX, textPositionY + 3.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
{
|
||||
// overlay render states
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
res |= m_WrappedDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, &background, sizeof(Vertex));
|
||||
|
||||
//// overlay render states
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
||||
|
||||
res |= m_WrappedDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, triangleCount, &quads[0],
|
||||
sizeof(Vertex));
|
||||
delete[] quads;
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include "driver/dx/official/d3d8.h"
|
||||
#include "stb/stb_truetype.h"
|
||||
#include "d3d8_common.h"
|
||||
#include "d3d8_device.h"
|
||||
|
||||
class D3D8DebugManager
|
||||
{
|
||||
public:
|
||||
D3D8DebugManager(WrappedD3DDevice8 *wrapper);
|
||||
~D3D8DebugManager();
|
||||
|
||||
void RenderText(float x, float y, const rdcstr &text);
|
||||
|
||||
void SetOutputDimensions(int w, int h)
|
||||
{
|
||||
m_width = w;
|
||||
m_height = h;
|
||||
}
|
||||
void SetOutputWindow(HWND w);
|
||||
|
||||
// font/text rendering
|
||||
bool InitFontRendering();
|
||||
void ShutdownFontRendering();
|
||||
|
||||
void RenderTextInternal(float x, float y, const rdcstr &text);
|
||||
|
||||
static const int FONT_TEX_WIDTH = 256;
|
||||
static const int FONT_TEX_HEIGHT = 128;
|
||||
static const int FONT_MAX_CHARS = 256;
|
||||
|
||||
static const uint32_t STAGE_BUFFER_BYTE_SIZE = 4 * 1024 * 1024;
|
||||
|
||||
struct FontData
|
||||
{
|
||||
FontData() { RDCEraseMem(this, sizeof(FontData)); }
|
||||
~FontData() { SAFE_RELEASE(Tex); }
|
||||
IDirect3DTexture8 *Tex;
|
||||
stbtt_bakedchar charData[FONT_MAX_CHARS];
|
||||
float maxHeight;
|
||||
} m_Font;
|
||||
|
||||
DWORD m_fvf;
|
||||
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
WrappedD3DDevice8 *m_WrappedDevice;
|
||||
};
|
||||
@@ -1,949 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d8_device.h"
|
||||
#include "core/core.h"
|
||||
#include "driver/dxgi/dxgi_common.h"
|
||||
#include "serialise/serialiser.h"
|
||||
#include "d3d8_debug.h"
|
||||
#include "d3d8_resources.h"
|
||||
|
||||
WrappedD3DDevice8::WrappedD3DDevice8(IDirect3DDevice8 *device, HWND wnd,
|
||||
D3DPRESENT_PARAMETERS *pPresentationParameters)
|
||||
: m_RefCounter(device, false),
|
||||
m_SoftRefCounter(NULL, false),
|
||||
m_device(device),
|
||||
m_DebugManager(NULL),
|
||||
m_PresentParameters(*pPresentationParameters)
|
||||
{
|
||||
// refcounters implicitly construct with one reference, but we don't start with any soft
|
||||
// references.
|
||||
m_SoftRefCounter.Release();
|
||||
m_InternalRefcount = 0;
|
||||
m_Alive = true;
|
||||
|
||||
if(!RenderDoc::Inst().IsReplayApp())
|
||||
{
|
||||
m_State = CaptureState::BackgroundCapturing;
|
||||
|
||||
RenderDoc::Inst().AddDeviceFrameCapturer((IDirect3DDevice8 *)this, this);
|
||||
|
||||
m_Wnd = wnd;
|
||||
|
||||
if(wnd != NULL)
|
||||
RenderDoc::Inst().AddFrameCapturer(DeviceOwnedWindow((IDirect3DDevice8 *)this, wnd), this);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_State = CaptureState::LoadingReplaying;
|
||||
|
||||
m_Wnd = NULL;
|
||||
}
|
||||
|
||||
m_ResourceManager = new D3D8ResourceManager(m_State, this);
|
||||
}
|
||||
|
||||
void WrappedD3DDevice8::CheckForDeath()
|
||||
{
|
||||
if(!m_Alive)
|
||||
return;
|
||||
|
||||
if(m_RefCounter.GetRefCount() == 0)
|
||||
{
|
||||
RDCASSERT(m_SoftRefCounter.GetRefCount() >= m_InternalRefcount);
|
||||
|
||||
if(m_SoftRefCounter.GetRefCount() <= m_InternalRefcount)
|
||||
{
|
||||
m_Alive = false;
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrappedD3DDevice8::~WrappedD3DDevice8()
|
||||
{
|
||||
RenderDoc::Inst().RemoveDeviceFrameCapturer((IDirect3DDevice8 *)this);
|
||||
|
||||
if(m_Wnd != NULL)
|
||||
RenderDoc::Inst().RemoveFrameCapturer(DeviceOwnedWindow((IDirect3DDevice8 *)this, m_Wnd));
|
||||
|
||||
SAFE_DELETE(m_DebugManager);
|
||||
|
||||
m_ResourceManager->Shutdown();
|
||||
|
||||
SAFE_DELETE(m_ResourceManager);
|
||||
|
||||
SAFE_RELEASE(m_device);
|
||||
|
||||
RDCASSERT(WrappedIDirect3DVertexBuffer8::m_BufferList.empty());
|
||||
RDCASSERT(WrappedIDirect3DIndexBuffer8::m_BufferList.empty());
|
||||
}
|
||||
|
||||
bool WrappedD3DDevice8::Serialise_ReleaseResource(IDirect3DResource8 *res)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedD3DDevice8::ReleaseResource(IDirect3DResource8 *res)
|
||||
{
|
||||
ResourceId id = GetResID((IUnknown *)res);
|
||||
|
||||
D3D8ResourceRecord *record = GetResourceManager()->GetResourceRecord(id);
|
||||
|
||||
if(record)
|
||||
record->Delete(GetResourceManager());
|
||||
|
||||
// wrapped resources get released all the time, we don't want to
|
||||
// try and slerp in a resource release. Just the explicit ones
|
||||
if(IsReplayMode(m_State))
|
||||
{
|
||||
if(GetResourceManager()->HasLiveResource(id))
|
||||
GetResourceManager()->EraseLiveResource(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT WrappedD3DDevice8::QueryInterface(REFIID riid, void **ppvObject)
|
||||
{
|
||||
// RenderDoc UUID {A7AA6116-9C8D-4BBA-9083-B4D816B71B78}
|
||||
static const GUID IRenderDoc_uuid = {
|
||||
0xa7aa6116, 0x9c8d, 0x4bba, {0x90, 0x83, 0xb4, 0xd8, 0x16, 0xb7, 0x1b, 0x78}};
|
||||
|
||||
if(riid == IRenderDoc_uuid)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = (IUnknown *)this;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
WarnUnknownGUID("IDirect3DDevice8", riid);
|
||||
}
|
||||
|
||||
return m_device->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
void WrappedD3DDevice8::LazyInit()
|
||||
{
|
||||
m_DebugManager = new D3D8DebugManager(this);
|
||||
}
|
||||
|
||||
void WrappedD3DDevice8::StartFrameCapture(DeviceOwnedWindow devWnd)
|
||||
{
|
||||
RDCERR("Capture not supported on D3D8");
|
||||
}
|
||||
|
||||
bool WrappedD3DDevice8::EndFrameCapture(DeviceOwnedWindow devWnd)
|
||||
{
|
||||
RDCERR("Capture not supported on D3D8");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WrappedD3DDevice8::DiscardFrameCapture(DeviceOwnedWindow devWnd)
|
||||
{
|
||||
RDCERR("Capture not supported on D3D8");
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::TestCooperativeLevel()
|
||||
{
|
||||
return m_device->TestCooperativeLevel();
|
||||
}
|
||||
|
||||
UINT __stdcall WrappedD3DDevice8::GetAvailableTextureMem()
|
||||
{
|
||||
return m_device->GetAvailableTextureMem();
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::ResourceManagerDiscardBytes(DWORD Bytes)
|
||||
{
|
||||
return m_device->ResourceManagerDiscardBytes(Bytes);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetDirect3D(IDirect3D8 **ppD3D8)
|
||||
{
|
||||
return m_device->GetDirect3D(ppD3D8);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetDeviceCaps(D3DCAPS8 *pCaps)
|
||||
{
|
||||
return m_device->GetDeviceCaps(pCaps);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetDisplayMode(D3DDISPLAYMODE *pMode)
|
||||
{
|
||||
return m_device->GetDisplayMode(pMode);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters)
|
||||
{
|
||||
return m_device->GetCreationParameters(pParameters);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetCursorProperties(UINT XHotSpot, UINT YHotSpot,
|
||||
IDirect3DSurface8 *pCursorBitmap)
|
||||
{
|
||||
return m_device->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap);
|
||||
}
|
||||
|
||||
void __stdcall WrappedD3DDevice8::SetCursorPosition(int X, int Y, DWORD Flags)
|
||||
{
|
||||
m_device->SetCursorPosition(X, Y, Flags);
|
||||
}
|
||||
|
||||
BOOL __stdcall WrappedD3DDevice8::ShowCursor(BOOL bShow)
|
||||
{
|
||||
return m_device->ShowCursor(bShow);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateAdditionalSwapChain(
|
||||
D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain8 **pSwapChain)
|
||||
{
|
||||
return m_device->CreateAdditionalSwapChain(pPresentationParameters, pSwapChain);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::Reset(D3DPRESENT_PARAMETERS *pPresentationParameters)
|
||||
{
|
||||
m_PresentParameters = *pPresentationParameters;
|
||||
return m_device->Reset(pPresentationParameters);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::Present(CONST RECT *pSourceRect, CONST RECT *pDestRect,
|
||||
HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
|
||||
{
|
||||
// if(m_State == WRITING_IDLE)
|
||||
RenderDoc::Inst().Tick();
|
||||
|
||||
HWND wnd = m_PresentParameters.hDeviceWindow;
|
||||
if(hDestWindowOverride != NULL)
|
||||
wnd = hDestWindowOverride;
|
||||
|
||||
DeviceOwnedWindow devWnd((IDirect3DDevice8 *)this, wnd);
|
||||
|
||||
m_FrameCounter++;
|
||||
|
||||
// if (m_State == WRITING_IDLE)
|
||||
{
|
||||
uint32_t overlay = RenderDoc::Inst().GetOverlayBits();
|
||||
|
||||
static bool debugRenderOverlay = true;
|
||||
|
||||
if(overlay & eRENDERDOC_Overlay_Enabled && debugRenderOverlay)
|
||||
{
|
||||
HRESULT res = S_OK;
|
||||
res = m_device->BeginScene();
|
||||
DWORD stateBlock;
|
||||
m_device->CreateStateBlock(D3DSBT_ALL, &stateBlock);
|
||||
|
||||
IDirect3DSurface8 *backBuffer;
|
||||
res |= m_device->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &backBuffer);
|
||||
res |= m_device->SetRenderTarget(0, backBuffer);
|
||||
|
||||
D3DSURFACE_DESC bbDesc;
|
||||
backBuffer->GetDesc(&bbDesc);
|
||||
|
||||
//
|
||||
D3DVIEWPORT8 viewport = {0, 0, bbDesc.Width, bbDesc.Height, 0.f, 1.f};
|
||||
res |= m_device->SetViewport(&viewport);
|
||||
|
||||
GetDebugManager()->SetOutputDimensions(bbDesc.Width, bbDesc.Height);
|
||||
GetDebugManager()->SetOutputWindow(m_PresentParameters.hDeviceWindow);
|
||||
|
||||
rdcstr overlayText = RenderDoc::Inst().GetOverlayText(RDCDriver::D3D8, devWnd, m_FrameCounter,
|
||||
RenderDoc::eOverlay_CaptureDisabled);
|
||||
|
||||
overlayText += "Captures not supported with D3D8\n";
|
||||
|
||||
GetDebugManager()->RenderText(0.0f, 0.0f, overlayText);
|
||||
|
||||
m_device->ApplyStateBlock(stateBlock);
|
||||
res |= m_device->EndScene();
|
||||
}
|
||||
}
|
||||
|
||||
RenderDoc::Inst().AddActiveDriver(RDCDriver::D3D8, true);
|
||||
RenderDoc::Inst().SetDriverUnsupportedMessage(RDCDriver::D3D8, "D3D8 is not a supported API");
|
||||
|
||||
return m_device->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetBackBuffer(UINT iBackBuffer, D3DBACKBUFFER_TYPE Type,
|
||||
IDirect3DSurface8 **ppBackBuffer)
|
||||
{
|
||||
return m_device->GetBackBuffer(iBackBuffer, Type, ppBackBuffer);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetRasterStatus(D3DRASTER_STATUS *pRasterStatus)
|
||||
{
|
||||
return m_device->GetRasterStatus(pRasterStatus);
|
||||
}
|
||||
|
||||
void __stdcall WrappedD3DDevice8::SetGammaRamp(DWORD Flags, CONST D3DGAMMARAMP *pRamp)
|
||||
{
|
||||
m_device->SetGammaRamp(Flags, pRamp);
|
||||
}
|
||||
|
||||
void __stdcall WrappedD3DDevice8::GetGammaRamp(D3DGAMMARAMP *pRamp)
|
||||
{
|
||||
m_device->GetGammaRamp(pRamp);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateTexture(UINT Width, UINT Height, UINT Levels,
|
||||
DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DTexture8 **ppTexture)
|
||||
{
|
||||
return m_device->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateVolumeTexture(UINT Width, UINT Height, UINT Depth,
|
||||
UINT Levels, DWORD Usage, D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
IDirect3DVolumeTexture8 **ppVolumeTexture)
|
||||
{
|
||||
return m_device->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool,
|
||||
ppVolumeTexture);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage,
|
||||
D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DCubeTexture8 **ppCubeTexture)
|
||||
{
|
||||
return m_device->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF,
|
||||
D3DPOOL Pool,
|
||||
IDirect3DVertexBuffer8 **ppVertexBuffer)
|
||||
{
|
||||
IDirect3DVertexBuffer8 *real = NULL;
|
||||
IDirect3DVertexBuffer8 *wrapped = NULL;
|
||||
HRESULT ret = m_device->CreateVertexBuffer(Length, Usage, FVF, Pool, &real);
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
wrapped = new WrappedIDirect3DVertexBuffer8(real, Length, this);
|
||||
|
||||
if(IsCaptureMode(m_State))
|
||||
{
|
||||
// TODO: Serialise
|
||||
}
|
||||
else
|
||||
{
|
||||
WrappedIDirect3DVertexBuffer8 *w = (WrappedIDirect3DVertexBuffer8 *)wrapped;
|
||||
|
||||
m_ResourceManager->AddLiveResource(w->GetResourceID(), wrapped);
|
||||
}
|
||||
|
||||
*ppVertexBuffer = wrapped;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
IDirect3DIndexBuffer8 **ppIndexBuffer)
|
||||
{
|
||||
IDirect3DIndexBuffer8 *real = NULL;
|
||||
IDirect3DIndexBuffer8 *wrapped = NULL;
|
||||
HRESULT ret = m_device->CreateIndexBuffer(Length, Usage, Format, Pool, &real);
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
wrapped = new WrappedIDirect3DIndexBuffer8(real, Length, this);
|
||||
|
||||
if(IsCaptureMode(m_State))
|
||||
{
|
||||
// TODO: Serialise
|
||||
}
|
||||
else
|
||||
{
|
||||
WrappedIDirect3DIndexBuffer8 *w = (WrappedIDirect3DIndexBuffer8 *)wrapped;
|
||||
|
||||
m_ResourceManager->AddLiveResource(w->GetResourceID(), wrapped);
|
||||
}
|
||||
|
||||
*ppIndexBuffer = wrapped;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format,
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
BOOL Lockable, IDirect3DSurface8 **ppSurface)
|
||||
{
|
||||
return m_device->CreateRenderTarget(Width, Height, Format, MultiSample, Lockable, ppSurface);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateDepthStencilSurface(UINT Width, UINT Height,
|
||||
D3DFORMAT Format,
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
IDirect3DSurface8 **ppSurface)
|
||||
{
|
||||
return m_device->CreateDepthStencilSurface(Width, Height, Format, MultiSample, ppSurface);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateImageSurface(UINT Width, UINT Height, D3DFORMAT Format,
|
||||
IDirect3DSurface8 **ppSurface)
|
||||
{
|
||||
return m_device->CreateImageSurface(Width, Height, Format, ppSurface);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CopyRects(IDirect3DSurface8 *pSourceSurface,
|
||||
CONST RECT *pSourceRectsArray, UINT NumRects,
|
||||
IDirect3DSurface8 *pDestinationSurface,
|
||||
CONST POINT *pDestPointsArray)
|
||||
{
|
||||
return m_device->CopyRects(pSourceSurface, pSourceRectsArray, NumRects, pDestinationSurface,
|
||||
pDestPointsArray);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::UpdateTexture(IDirect3DBaseTexture8 *pSourceTexture,
|
||||
IDirect3DBaseTexture8 *pDestinationTexture)
|
||||
{
|
||||
return m_device->UpdateTexture(pSourceTexture, pDestinationTexture);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetFrontBuffer(IDirect3DSurface8 *pDestSurface)
|
||||
{
|
||||
return m_device->GetFrontBuffer(pDestSurface);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetRenderTarget(IDirect3DSurface8 *pRenderTarget,
|
||||
IDirect3DSurface8 *pNewZStencil)
|
||||
{
|
||||
return m_device->SetRenderTarget(pRenderTarget, pNewZStencil);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetRenderTarget(IDirect3DSurface8 **ppRenderTarget)
|
||||
{
|
||||
return m_device->GetRenderTarget(ppRenderTarget);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetDepthStencilSurface(IDirect3DSurface8 **ppZStencilSurface)
|
||||
{
|
||||
return m_device->GetDepthStencilSurface(ppZStencilSurface);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::BeginScene()
|
||||
{
|
||||
return m_device->BeginScene();
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::EndScene()
|
||||
{
|
||||
return m_device->EndScene();
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::Clear(DWORD Count, CONST D3DRECT *pRects, DWORD Flags,
|
||||
D3DCOLOR Color, float Z, DWORD Stencil)
|
||||
{
|
||||
return m_device->Clear(Count, pRects, Flags, Color, Z, Stencil);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetTransform(D3DTRANSFORMSTATETYPE State,
|
||||
CONST D3DMATRIX *pMatrix)
|
||||
{
|
||||
return m_device->SetTransform(State, pMatrix);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix)
|
||||
{
|
||||
return m_device->GetTransform(State, pMatrix);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::MultiplyTransform(D3DTRANSFORMSTATETYPE _arg1,
|
||||
CONST D3DMATRIX *_arg2)
|
||||
{
|
||||
return m_device->MultiplyTransform(_arg1, _arg2);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetViewport(CONST D3DVIEWPORT8 *pViewport)
|
||||
{
|
||||
return m_device->SetViewport(pViewport);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetViewport(D3DVIEWPORT8 *pViewport)
|
||||
{
|
||||
return m_device->GetViewport(pViewport);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetMaterial(CONST D3DMATERIAL8 *pMaterial)
|
||||
{
|
||||
return m_device->SetMaterial(pMaterial);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetMaterial(D3DMATERIAL8 *pMaterial)
|
||||
{
|
||||
return m_device->GetMaterial(pMaterial);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetLight(DWORD Index, CONST D3DLIGHT8 *_arg2)
|
||||
{
|
||||
return m_device->SetLight(Index, _arg2);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetLight(DWORD Index, D3DLIGHT8 *_arg2)
|
||||
{
|
||||
return m_device->GetLight(Index, _arg2);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::LightEnable(DWORD Index, BOOL Enable)
|
||||
{
|
||||
return m_device->LightEnable(Index, Enable);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetLightEnable(DWORD Index, BOOL *pEnable)
|
||||
{
|
||||
return m_device->GetLightEnable(Index, pEnable);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetClipPlane(DWORD Index, CONST float *pPlane)
|
||||
{
|
||||
return m_device->SetClipPlane(Index, pPlane);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetClipPlane(DWORD Index, float *pPlane)
|
||||
{
|
||||
return m_device->GetClipPlane(Index, pPlane);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value)
|
||||
{
|
||||
return m_device->SetRenderState(State, Value);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetRenderState(D3DRENDERSTATETYPE State, DWORD *pValue)
|
||||
{
|
||||
return m_device->GetRenderState(State, pValue);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::BeginStateBlock()
|
||||
{
|
||||
return m_device->BeginStateBlock();
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::EndStateBlock(DWORD *pToken)
|
||||
{
|
||||
return m_device->EndStateBlock(pToken);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::ApplyStateBlock(DWORD Token)
|
||||
{
|
||||
return m_device->ApplyStateBlock(Token);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CaptureStateBlock(DWORD Token)
|
||||
{
|
||||
return m_device->CaptureStateBlock(Token);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DeleteStateBlock(DWORD Token)
|
||||
{
|
||||
return m_device->DeleteStateBlock(Token);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateStateBlock(D3DSTATEBLOCKTYPE Type, DWORD *pToken)
|
||||
{
|
||||
return m_device->CreateStateBlock(Type, pToken);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetClipStatus(CONST D3DCLIPSTATUS8 *pClipStatus)
|
||||
{
|
||||
return m_device->SetClipStatus(pClipStatus);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetClipStatus(D3DCLIPSTATUS8 *pClipStatus)
|
||||
{
|
||||
return m_device->GetClipStatus(pClipStatus);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetTexture(DWORD Stage, IDirect3DBaseTexture8 **ppTexture)
|
||||
{
|
||||
return m_device->GetTexture(Stage, ppTexture);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetTexture(DWORD Stage, IDirect3DBaseTexture8 *pTexture)
|
||||
{
|
||||
return m_device->SetTexture(Stage, pTexture);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,
|
||||
DWORD *pValue)
|
||||
{
|
||||
return m_device->GetTextureStageState(Stage, Type, pValue);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetTextureStageState(DWORD Stage,
|
||||
D3DTEXTURESTAGESTATETYPE Type, DWORD Value)
|
||||
{
|
||||
return m_device->SetTextureStageState(Stage, Type, Value);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::ValidateDevice(DWORD *pNumPasses)
|
||||
{
|
||||
return m_device->ValidateDevice(pNumPasses);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetInfo(DWORD DevInfoID, void *pDevInfoStruct,
|
||||
DWORD DevInfoStructSize)
|
||||
{
|
||||
return m_device->GetInfo(DevInfoID, pDevInfoStruct, DevInfoStructSize);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetPaletteEntries(UINT PaletteNumber,
|
||||
CONST PALETTEENTRY *pEntries)
|
||||
{
|
||||
return m_device->SetPaletteEntries(PaletteNumber, pEntries);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY *pEntries)
|
||||
{
|
||||
return m_device->GetPaletteEntries(PaletteNumber, pEntries);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetCurrentTexturePalette(UINT PaletteNumber)
|
||||
{
|
||||
return m_device->SetCurrentTexturePalette(PaletteNumber);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetCurrentTexturePalette(UINT *PaletteNumber)
|
||||
{
|
||||
return m_device->GetCurrentTexturePalette(PaletteNumber);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex,
|
||||
UINT PrimitiveCount)
|
||||
{
|
||||
return m_device->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DrawIndexedPrimitive(D3DPRIMITIVETYPE _arg1,
|
||||
UINT MinVertexIndex, UINT NumVertices,
|
||||
UINT startIndex, UINT primCount)
|
||||
{
|
||||
return m_device->DrawIndexedPrimitive(_arg1, MinVertexIndex, NumVertices, startIndex, primCount);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,
|
||||
UINT PrimitiveCount,
|
||||
CONST void *pVertexStreamZeroData,
|
||||
UINT VertexStreamZeroStride)
|
||||
{
|
||||
return m_device->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData,
|
||||
VertexStreamZeroStride);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DrawIndexedPrimitiveUP(
|
||||
D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount,
|
||||
CONST void *pIndexData, D3DFORMAT IndexDataFormat, CONST void *pVertexStreamZeroData,
|
||||
UINT VertexStreamZeroStride)
|
||||
{
|
||||
return m_device->DrawIndexedPrimitiveUP(PrimitiveType, MinVertexIndex, NumVertices,
|
||||
PrimitiveCount, pIndexData, IndexDataFormat,
|
||||
pVertexStreamZeroData, VertexStreamZeroStride);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::ProcessVertices(UINT SrcStartIndex, UINT DestIndex,
|
||||
UINT VertexCount,
|
||||
IDirect3DVertexBuffer8 *pDestBuffer, DWORD Flags)
|
||||
{
|
||||
return m_device->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreateVertexShader(CONST DWORD *pDeclaration,
|
||||
CONST DWORD *pFunction, DWORD *pHandle,
|
||||
DWORD Usage)
|
||||
{
|
||||
return m_device->CreateVertexShader(pDeclaration, pFunction, pHandle, Usage);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetVertexShader(DWORD Handle)
|
||||
{
|
||||
return m_device->SetVertexShader(Handle);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetVertexShader(DWORD *pHandle)
|
||||
{
|
||||
return m_device->GetVertexShader(pHandle);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DeleteVertexShader(DWORD Handle)
|
||||
{
|
||||
return m_device->DeleteVertexShader(Handle);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetVertexShaderConstant(DWORD Register,
|
||||
CONST void *pConstantData,
|
||||
DWORD ConstantCount)
|
||||
{
|
||||
return m_device->SetVertexShaderConstant(Register, pConstantData, ConstantCount);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetVertexShaderConstant(DWORD Register, void *pConstantData,
|
||||
DWORD ConstantCount)
|
||||
{
|
||||
return m_device->GetVertexShaderConstant(Register, pConstantData, ConstantCount);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetVertexShaderDeclaration(DWORD Handle, void *pData,
|
||||
DWORD *pSizeOfData)
|
||||
{
|
||||
return m_device->GetVertexShaderDeclaration(Handle, pData, pSizeOfData);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetVertexShaderFunction(DWORD Handle, void *pData,
|
||||
DWORD *pSizeOfData)
|
||||
{
|
||||
return m_device->GetVertexShaderFunction(Handle, pData, pSizeOfData);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetStreamSource(UINT StreamNumber,
|
||||
IDirect3DVertexBuffer8 *pStreamData, UINT Stride)
|
||||
{
|
||||
return m_device->SetStreamSource(StreamNumber, Unwrap(pStreamData), Stride);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetStreamSource(UINT StreamNumber,
|
||||
IDirect3DVertexBuffer8 **ppStreamData,
|
||||
UINT *pStride)
|
||||
{
|
||||
IDirect3DVertexBuffer8 *real;
|
||||
HRESULT ret = m_device->GetStreamSource(StreamNumber, &real, pStride);
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SAFE_RELEASE_NOCLEAR(real);
|
||||
*ppStreamData = (IDirect3DVertexBuffer8 *)GetResourceManager()->GetWrapper(real);
|
||||
SAFE_ADDREF(*ppStreamData);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetIndices(IDirect3DIndexBuffer8 *pIndexData,
|
||||
UINT BaseVertexIndex)
|
||||
{
|
||||
return m_device->SetIndices(Unwrap(pIndexData), BaseVertexIndex);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetIndices(IDirect3DIndexBuffer8 **ppIndexData,
|
||||
UINT *pBaseVertexIndex)
|
||||
{
|
||||
IDirect3DIndexBuffer8 *real;
|
||||
HRESULT ret = m_device->GetIndices(&real, pBaseVertexIndex);
|
||||
|
||||
if(SUCCEEDED(ret))
|
||||
{
|
||||
SAFE_RELEASE_NOCLEAR(real);
|
||||
*ppIndexData = (IDirect3DIndexBuffer8 *)GetResourceManager()->GetWrapper(real);
|
||||
SAFE_ADDREF(*ppIndexData);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::CreatePixelShader(CONST DWORD *pFunction, DWORD *pHandle)
|
||||
{
|
||||
return m_device->CreatePixelShader(pFunction, pHandle);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetPixelShader(DWORD Handle)
|
||||
{
|
||||
return m_device->SetPixelShader(Handle);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetPixelShader(DWORD *pHandle)
|
||||
{
|
||||
return m_device->GetPixelShader(pHandle);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DeletePixelShader(DWORD Handle)
|
||||
{
|
||||
return m_device->DeletePixelShader(Handle);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::SetPixelShaderConstant(DWORD Register, CONST void *pConstantData,
|
||||
DWORD ConstantCount)
|
||||
{
|
||||
return m_device->SetPixelShaderConstant(Register, pConstantData, ConstantCount);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetPixelShaderConstant(DWORD Register, void *pConstantData,
|
||||
DWORD ConstantCount)
|
||||
{
|
||||
return m_device->GetPixelShaderConstant(Register, pConstantData, ConstantCount);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::GetPixelShaderFunction(DWORD Handle, void *pData,
|
||||
DWORD *pSizeOfData)
|
||||
{
|
||||
return m_device->GetPixelShaderFunction(Handle, pData, pSizeOfData);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DrawRectPatch(UINT Handle, CONST float *pNumSegs,
|
||||
CONST D3DRECTPATCH_INFO *pRectPatchInfo)
|
||||
{
|
||||
return m_device->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DrawTriPatch(UINT Handle, CONST float *pNumSegs,
|
||||
CONST D3DTRIPATCH_INFO *pTriPatchInfo)
|
||||
{
|
||||
return m_device->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3DDevice8::DeletePatch(UINT Handle)
|
||||
{
|
||||
return m_device->DeletePatch(Handle);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::QueryInterface(REFIID riid, void **ppvObj)
|
||||
{
|
||||
return m_direct3D->QueryInterface(riid, ppvObj);
|
||||
}
|
||||
|
||||
ULONG __stdcall WrappedD3D8::AddRef()
|
||||
{
|
||||
ULONG refCount;
|
||||
refCount = m_direct3D->AddRef();
|
||||
return refCount;
|
||||
}
|
||||
|
||||
ULONG __stdcall WrappedD3D8::Release()
|
||||
{
|
||||
ULONG refCount = m_direct3D->Release();
|
||||
if(refCount == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
return refCount;
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::RegisterSoftwareDevice(void *pInitializeFunction)
|
||||
{
|
||||
return m_direct3D->RegisterSoftwareDevice(pInitializeFunction);
|
||||
}
|
||||
|
||||
UINT __stdcall WrappedD3D8::GetAdapterCount()
|
||||
{
|
||||
return m_direct3D->GetAdapterCount();
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::GetAdapterIdentifier(UINT Adapter, DWORD Flags,
|
||||
D3DADAPTER_IDENTIFIER8 *pIdentifier)
|
||||
{
|
||||
return m_direct3D->GetAdapterIdentifier(Adapter, Flags, pIdentifier);
|
||||
}
|
||||
|
||||
UINT __stdcall WrappedD3D8::GetAdapterModeCount(UINT Adapter)
|
||||
{
|
||||
return m_direct3D->GetAdapterModeCount(Adapter);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::EnumAdapterModes(UINT Adapter, UINT Mode, D3DDISPLAYMODE *pMode)
|
||||
{
|
||||
return m_direct3D->EnumAdapterModes(Adapter, Mode, pMode);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE *pMode)
|
||||
{
|
||||
return m_direct3D->GetAdapterDisplayMode(Adapter, pMode);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::CheckDeviceType(UINT Adapter, D3DDEVTYPE DevType,
|
||||
D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat,
|
||||
BOOL bWindowed)
|
||||
{
|
||||
return m_direct3D->CheckDeviceType(Adapter, DevType, AdapterFormat, BackBufferFormat, bWindowed);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT AdapterFormat, DWORD Usage,
|
||||
D3DRESOURCETYPE RType, D3DFORMAT CheckFormat)
|
||||
{
|
||||
return m_direct3D->CheckDeviceFormat(Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT SurfaceFormat, BOOL Windowed,
|
||||
D3DMULTISAMPLE_TYPE MultiSampleType)
|
||||
{
|
||||
return m_direct3D->CheckDeviceMultiSampleType(Adapter, DeviceType, SurfaceFormat, Windowed,
|
||||
MultiSampleType);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT AdapterFormat,
|
||||
D3DFORMAT RenderTargetFormat,
|
||||
D3DFORMAT DepthStencilFormat)
|
||||
{
|
||||
return m_direct3D->CheckDepthStencilMatch(Adapter, DeviceType, AdapterFormat, RenderTargetFormat,
|
||||
DepthStencilFormat);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8 *pCaps)
|
||||
{
|
||||
return m_direct3D->GetDeviceCaps(Adapter, DeviceType, pCaps);
|
||||
}
|
||||
|
||||
HMONITOR __stdcall WrappedD3D8::GetAdapterMonitor(UINT Adapter)
|
||||
{
|
||||
return m_direct3D->GetAdapterMonitor(Adapter);
|
||||
}
|
||||
|
||||
HRESULT __stdcall WrappedD3D8::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||
DWORD BehaviorFlags,
|
||||
D3DPRESENT_PARAMETERS *pPresentationParameters,
|
||||
IDirect3DDevice8 **ppReturnedDeviceInterface)
|
||||
{
|
||||
IDirect3DDevice8 *device = NULL;
|
||||
HRESULT res = m_direct3D->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags,
|
||||
pPresentationParameters, &device);
|
||||
if(res == S_OK)
|
||||
{
|
||||
RDCLOG("App creating d3d8 device");
|
||||
|
||||
HWND wnd = pPresentationParameters->hDeviceWindow;
|
||||
if(wnd == NULL)
|
||||
wnd = hFocusWindow;
|
||||
|
||||
if(!wnd)
|
||||
RDCWARN("Couldn't find valid non-NULL window at CreateDevice time");
|
||||
|
||||
WrappedD3DDevice8 *wrappedDevice = new WrappedD3DDevice8(device, wnd, pPresentationParameters);
|
||||
wrappedDevice->LazyInit(); // TODO this can be moved later probably
|
||||
*ppReturnedDeviceInterface = wrappedDevice;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppReturnedDeviceInterface = NULL;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -1,278 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "common/timing.h"
|
||||
#include "d3d8_common.h"
|
||||
#include "d3d8_manager.h"
|
||||
|
||||
class D3D8DebugManager;
|
||||
|
||||
class WrappedD3DDevice8 : public IDirect3DDevice8, public IFrameCapturer
|
||||
{
|
||||
public:
|
||||
WrappedD3DDevice8(IDirect3DDevice8 *device, HWND wnd,
|
||||
D3DPRESENT_PARAMETERS *pPresentationParameters);
|
||||
~WrappedD3DDevice8();
|
||||
|
||||
void LazyInit();
|
||||
|
||||
RDCDriver GetFrameCaptureDriver() { return RDCDriver::D3D8; }
|
||||
void StartFrameCapture(DeviceOwnedWindow devWnd);
|
||||
bool EndFrameCapture(DeviceOwnedWindow devWnd);
|
||||
bool DiscardFrameCapture(DeviceOwnedWindow devWnd);
|
||||
|
||||
void InternalRef() { InterlockedIncrement(&m_InternalRefcount); }
|
||||
void InternalRelease() { InterlockedDecrement(&m_InternalRefcount); }
|
||||
void SoftRef() { m_SoftRefCounter.AddRef(); }
|
||||
void SoftRelease()
|
||||
{
|
||||
m_SoftRefCounter.Release();
|
||||
CheckForDeath();
|
||||
}
|
||||
|
||||
D3D8DebugManager *GetDebugManager() { return m_DebugManager; }
|
||||
D3D8ResourceManager *GetResourceManager() { return m_ResourceManager; }
|
||||
Threading::CriticalSection &D3DLock() { return m_D3DLock; }
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, ReleaseResource(IDirect3DResource8 *res));
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
ULONG STDMETHODCALLTYPE AddRef() { return m_RefCounter.AddRef(); }
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
unsigned int ret = m_RefCounter.Release();
|
||||
CheckForDeath();
|
||||
return ret;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
|
||||
|
||||
/*** IDirect3DDevice8 methods ***/
|
||||
virtual HRESULT __stdcall TestCooperativeLevel();
|
||||
virtual UINT __stdcall GetAvailableTextureMem();
|
||||
virtual HRESULT __stdcall ResourceManagerDiscardBytes(DWORD Bytes);
|
||||
virtual HRESULT __stdcall GetDirect3D(IDirect3D8 **ppD3D8);
|
||||
virtual HRESULT __stdcall GetDeviceCaps(D3DCAPS8 *pCaps);
|
||||
virtual HRESULT __stdcall GetDisplayMode(D3DDISPLAYMODE *pMode);
|
||||
virtual HRESULT __stdcall GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters);
|
||||
virtual HRESULT __stdcall SetCursorProperties(UINT XHotSpot, UINT YHotSpot,
|
||||
IDirect3DSurface8 *pCursorBitmap);
|
||||
virtual void __stdcall SetCursorPosition(int X, int Y, DWORD Flags);
|
||||
virtual BOOL __stdcall ShowCursor(BOOL bShow);
|
||||
virtual HRESULT __stdcall CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS *pPresentationParameters,
|
||||
IDirect3DSwapChain8 **pSwapChain);
|
||||
virtual HRESULT __stdcall Reset(D3DPRESENT_PARAMETERS *pPresentationParameters);
|
||||
virtual HRESULT __stdcall Present(CONST RECT *pSourceRect, CONST RECT *pDestRect,
|
||||
HWND hDestWindow, CONST RGNDATA *pDirtyRegion);
|
||||
virtual HRESULT __stdcall GetBackBuffer(UINT iBackBuffer, D3DBACKBUFFER_TYPE Type,
|
||||
IDirect3DSurface8 **ppBackBuffer);
|
||||
virtual HRESULT __stdcall GetRasterStatus(D3DRASTER_STATUS *pRasterStatus);
|
||||
virtual void __stdcall SetGammaRamp(DWORD Flags, CONST D3DGAMMARAMP *pRamp);
|
||||
virtual void __stdcall GetGammaRamp(D3DGAMMARAMP *pRamp);
|
||||
virtual HRESULT __stdcall CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage,
|
||||
D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DTexture8 **ppTexture);
|
||||
virtual HRESULT __stdcall CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels,
|
||||
DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DVolumeTexture8 **ppVolumeTexture);
|
||||
virtual HRESULT __stdcall CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage,
|
||||
D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DCubeTexture8 **ppCubeTexture);
|
||||
virtual HRESULT __stdcall CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool,
|
||||
IDirect3DVertexBuffer8 **ppVertexBuffer);
|
||||
virtual HRESULT __stdcall CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format,
|
||||
D3DPOOL Pool, IDirect3DIndexBuffer8 **ppIndexBuffer);
|
||||
virtual HRESULT __stdcall CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format,
|
||||
D3DMULTISAMPLE_TYPE MultiSample, BOOL Lockable,
|
||||
IDirect3DSurface8 **ppSurface);
|
||||
virtual HRESULT __stdcall CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format,
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
IDirect3DSurface8 **ppSurface);
|
||||
virtual HRESULT __stdcall CreateImageSurface(UINT Width, UINT Height, D3DFORMAT Format,
|
||||
IDirect3DSurface8 **ppSurface);
|
||||
virtual HRESULT __stdcall CopyRects(IDirect3DSurface8 *pSourceSurface,
|
||||
CONST RECT *pSourceRectsArray, UINT NumRects,
|
||||
IDirect3DSurface8 *pDestinationSurface,
|
||||
CONST POINT *pDestPointsArray);
|
||||
virtual HRESULT __stdcall UpdateTexture(IDirect3DBaseTexture8 *pSourceTexture,
|
||||
IDirect3DBaseTexture8 *pDestinationTexture);
|
||||
virtual HRESULT __stdcall GetFrontBuffer(IDirect3DSurface8 *pDestSurface);
|
||||
virtual HRESULT __stdcall SetRenderTarget(IDirect3DSurface8 *pRenderTarget,
|
||||
IDirect3DSurface8 *pNewZStencil);
|
||||
virtual HRESULT __stdcall GetRenderTarget(IDirect3DSurface8 **ppRenderTarget);
|
||||
virtual HRESULT __stdcall GetDepthStencilSurface(IDirect3DSurface8 **ppZStencilSurface);
|
||||
virtual HRESULT __stdcall BeginScene();
|
||||
virtual HRESULT __stdcall EndScene();
|
||||
virtual HRESULT __stdcall Clear(DWORD Count, CONST D3DRECT *pRects, DWORD Flags, D3DCOLOR Color,
|
||||
float Z, DWORD Stencil);
|
||||
virtual HRESULT __stdcall SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix);
|
||||
virtual HRESULT __stdcall GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix);
|
||||
virtual HRESULT __stdcall MultiplyTransform(D3DTRANSFORMSTATETYPE, CONST D3DMATRIX *);
|
||||
virtual HRESULT __stdcall SetViewport(CONST D3DVIEWPORT8 *pViewport);
|
||||
virtual HRESULT __stdcall GetViewport(D3DVIEWPORT8 *pViewport);
|
||||
virtual HRESULT __stdcall SetMaterial(CONST D3DMATERIAL8 *pMaterial);
|
||||
virtual HRESULT __stdcall GetMaterial(D3DMATERIAL8 *pMaterial);
|
||||
virtual HRESULT __stdcall SetLight(DWORD Index, CONST D3DLIGHT8 *);
|
||||
virtual HRESULT __stdcall GetLight(DWORD Index, D3DLIGHT8 *);
|
||||
virtual HRESULT __stdcall LightEnable(DWORD Index, BOOL Enable);
|
||||
virtual HRESULT __stdcall GetLightEnable(DWORD Index, BOOL *pEnable);
|
||||
virtual HRESULT __stdcall SetClipPlane(DWORD Index, CONST float *pPlane);
|
||||
virtual HRESULT __stdcall GetClipPlane(DWORD Index, float *pPlane);
|
||||
virtual HRESULT __stdcall SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
|
||||
virtual HRESULT __stdcall GetRenderState(D3DRENDERSTATETYPE State, DWORD *pValue);
|
||||
virtual HRESULT __stdcall BeginStateBlock();
|
||||
virtual HRESULT __stdcall EndStateBlock(DWORD *pToken);
|
||||
virtual HRESULT __stdcall ApplyStateBlock(DWORD Token);
|
||||
virtual HRESULT __stdcall CaptureStateBlock(DWORD Token);
|
||||
virtual HRESULT __stdcall DeleteStateBlock(DWORD Token);
|
||||
virtual HRESULT __stdcall CreateStateBlock(D3DSTATEBLOCKTYPE Type, DWORD *pToken);
|
||||
virtual HRESULT __stdcall SetClipStatus(CONST D3DCLIPSTATUS8 *pClipStatus);
|
||||
virtual HRESULT __stdcall GetClipStatus(D3DCLIPSTATUS8 *pClipStatus);
|
||||
virtual HRESULT __stdcall GetTexture(DWORD Stage, IDirect3DBaseTexture8 **ppTexture);
|
||||
virtual HRESULT __stdcall SetTexture(DWORD Stage, IDirect3DBaseTexture8 *pTexture);
|
||||
virtual HRESULT __stdcall GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,
|
||||
DWORD *pValue);
|
||||
virtual HRESULT __stdcall SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,
|
||||
DWORD Value);
|
||||
virtual HRESULT __stdcall ValidateDevice(DWORD *pNumPasses);
|
||||
virtual HRESULT __stdcall GetInfo(DWORD DevInfoID, void *pDevInfoStruct, DWORD DevInfoStructSize);
|
||||
virtual HRESULT __stdcall SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY *pEntries);
|
||||
virtual HRESULT __stdcall GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY *pEntries);
|
||||
virtual HRESULT __stdcall SetCurrentTexturePalette(UINT PaletteNumber);
|
||||
virtual HRESULT __stdcall GetCurrentTexturePalette(UINT *PaletteNumber);
|
||||
virtual HRESULT __stdcall DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex,
|
||||
UINT PrimitiveCount);
|
||||
virtual HRESULT __stdcall DrawIndexedPrimitive(D3DPRIMITIVETYPE, UINT MinVertexIndex,
|
||||
UINT NumVertices, UINT startIndex, UINT primCount);
|
||||
virtual HRESULT __stdcall DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount,
|
||||
CONST void *pVertexStreamZeroData,
|
||||
UINT VertexStreamZeroStride);
|
||||
virtual HRESULT __stdcall DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,
|
||||
UINT MinVertexIndex, UINT NumVertices,
|
||||
UINT PrimitiveCount, CONST void *pIndexData,
|
||||
D3DFORMAT IndexDataFormat,
|
||||
CONST void *pVertexStreamZeroData,
|
||||
UINT VertexStreamZeroStride);
|
||||
virtual HRESULT __stdcall ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount,
|
||||
IDirect3DVertexBuffer8 *pDestBuffer, DWORD Flags);
|
||||
virtual HRESULT __stdcall CreateVertexShader(CONST DWORD *pDeclaration, CONST DWORD *pFunction,
|
||||
DWORD *pHandle, DWORD Usage);
|
||||
virtual HRESULT __stdcall SetVertexShader(DWORD Handle);
|
||||
virtual HRESULT __stdcall GetVertexShader(DWORD *pHandle);
|
||||
virtual HRESULT __stdcall DeleteVertexShader(DWORD HHandle);
|
||||
virtual HRESULT __stdcall SetVertexShaderConstant(DWORD Register, CONST void *pConstantData,
|
||||
DWORD ConstantCount);
|
||||
virtual HRESULT __stdcall GetVertexShaderConstant(DWORD Register, void *pConstantData,
|
||||
DWORD ConstantCount);
|
||||
virtual HRESULT __stdcall GetVertexShaderDeclaration(DWORD Handle, void *pData, DWORD *pSizeOfData);
|
||||
virtual HRESULT __stdcall GetVertexShaderFunction(DWORD Handle, void *pData, DWORD *pSizeOfData);
|
||||
virtual HRESULT __stdcall SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer8 *pStreamData,
|
||||
UINT Stride);
|
||||
virtual HRESULT __stdcall GetStreamSource(UINT StreamNumber,
|
||||
IDirect3DVertexBuffer8 **ppStreamData, UINT *pStride);
|
||||
virtual HRESULT __stdcall SetIndices(IDirect3DIndexBuffer8 *pIndexData, UINT BaseVertexIndex);
|
||||
virtual HRESULT __stdcall GetIndices(IDirect3DIndexBuffer8 **ppIndexData, UINT *pBaseVertexIndex);
|
||||
virtual HRESULT __stdcall CreatePixelShader(CONST DWORD *pFunction, DWORD *pHandle);
|
||||
virtual HRESULT __stdcall SetPixelShader(DWORD Handle);
|
||||
virtual HRESULT __stdcall GetPixelShader(DWORD *pHandle);
|
||||
virtual HRESULT __stdcall DeletePixelShader(DWORD Handle);
|
||||
virtual HRESULT __stdcall SetPixelShaderConstant(DWORD Register, CONST void *pConstantData,
|
||||
DWORD ConstantCount);
|
||||
virtual HRESULT __stdcall GetPixelShaderConstant(DWORD Register, void *pConstantData,
|
||||
DWORD ConstantCount);
|
||||
virtual HRESULT __stdcall GetPixelShaderFunction(DWORD Handle, void *pData, DWORD *pSizeOfData);
|
||||
virtual HRESULT __stdcall DrawRectPatch(UINT Handle, CONST float *pNumSegs,
|
||||
CONST D3DRECTPATCH_INFO *pRectPatchInfo);
|
||||
virtual HRESULT __stdcall DrawTriPatch(UINT Handle, CONST float *pNumSegs,
|
||||
CONST D3DTRIPATCH_INFO *pTriPatchInfo);
|
||||
virtual HRESULT __stdcall DeletePatch(UINT Handle);
|
||||
|
||||
private:
|
||||
void CheckForDeath();
|
||||
|
||||
IDirect3DDevice8 *m_device;
|
||||
D3D8DebugManager *m_DebugManager;
|
||||
D3D8ResourceManager *m_ResourceManager;
|
||||
|
||||
D3DPRESENT_PARAMETERS m_PresentParameters;
|
||||
|
||||
HWND m_Wnd;
|
||||
|
||||
// ensure all calls in via the D3D wrapped interface are thread safe
|
||||
// protects wrapped resource creation and serialiser access
|
||||
Threading::CriticalSection m_D3DLock;
|
||||
|
||||
CaptureState m_State;
|
||||
|
||||
unsigned int m_InternalRefcount;
|
||||
RefCounter8 m_RefCounter;
|
||||
RefCounter8 m_SoftRefCounter;
|
||||
bool m_Alive;
|
||||
|
||||
uint32_t m_FrameCounter = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// WrappedD3D8
|
||||
|
||||
class WrappedD3D8 : public IDirect3D8
|
||||
{
|
||||
public:
|
||||
WrappedD3D8(IDirect3D8 *direct3D8) : m_direct3D(direct3D8) {}
|
||||
/*** IUnknown methods ***/
|
||||
virtual HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObj);
|
||||
virtual ULONG __stdcall AddRef();
|
||||
virtual ULONG __stdcall Release();
|
||||
|
||||
/*** IDirect3D8 methods ***/
|
||||
virtual HRESULT __stdcall RegisterSoftwareDevice(void *pInitializeFunction);
|
||||
virtual UINT __stdcall GetAdapterCount();
|
||||
virtual HRESULT __stdcall GetAdapterIdentifier(UINT Adapter, DWORD Flags,
|
||||
D3DADAPTER_IDENTIFIER8 *pIdentifier);
|
||||
virtual UINT __stdcall GetAdapterModeCount(UINT Adapter);
|
||||
virtual HRESULT __stdcall EnumAdapterModes(UINT Adapter, UINT Mode, D3DDISPLAYMODE *pMode);
|
||||
virtual HRESULT __stdcall GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE *pMode);
|
||||
virtual HRESULT __stdcall CheckDeviceType(UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat,
|
||||
D3DFORMAT BackBufferFormat, BOOL bWindowed);
|
||||
virtual HRESULT __stdcall CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT AdapterFormat, DWORD Usage,
|
||||
D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
|
||||
virtual HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT SurfaceFormat, BOOL Windowed,
|
||||
D3DMULTISAMPLE_TYPE MultiSampleType);
|
||||
virtual HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT AdapterFormat,
|
||||
D3DFORMAT RenderTargetFormat,
|
||||
D3DFORMAT DepthStencilFormat);
|
||||
virtual HRESULT __stdcall GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8 *pCaps);
|
||||
virtual HMONITOR __stdcall GetAdapterMonitor(UINT Adapter);
|
||||
virtual HRESULT __stdcall CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||
DWORD BehaviorFlags,
|
||||
D3DPRESENT_PARAMETERS *pPresentationParameters,
|
||||
IDirect3DDevice8 **ppReturnedDeviceInterface);
|
||||
|
||||
private:
|
||||
IDirect3D8 *m_direct3D;
|
||||
};
|
||||
@@ -1,57 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "driver/dx/official/d3d8.h"
|
||||
#include "hooks/hooks.h"
|
||||
#include "d3d8_device.h"
|
||||
|
||||
typedef IDirect3D8 *(WINAPI *PFN_D3D8_CREATE)(UINT);
|
||||
|
||||
class D3D8Hook : LibraryHook
|
||||
{
|
||||
public:
|
||||
void RegisterHooks()
|
||||
{
|
||||
RDCLOG("Registering D3D8 hooks");
|
||||
|
||||
LibraryHooks::RegisterLibraryHook("d3d8.dll", NULL);
|
||||
Create8.Register("d3d8.dll", "Direct3DCreate8", Create8_hook);
|
||||
}
|
||||
|
||||
private:
|
||||
static D3D8Hook d3d8hooks;
|
||||
|
||||
HookedFunction<PFN_D3D8_CREATE> Create8;
|
||||
|
||||
static IDirect3D8 *WINAPI Create8_hook(UINT SDKVersion)
|
||||
{
|
||||
RDCLOG("App creating d3d8 %x", SDKVersion);
|
||||
|
||||
IDirect3D8 *realD3D = d3d8hooks.Create8()(SDKVersion);
|
||||
|
||||
return new WrappedD3D8(realD3D);
|
||||
}
|
||||
};
|
||||
|
||||
D3D8Hook D3D8Hook::d3d8hooks;
|
||||
@@ -1,75 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "d3d8_manager.h"
|
||||
#include "d3d8_resources.h"
|
||||
|
||||
bool D3D8ResourceManager::AutoReferenceResource(ResourceId id, D3D8ResourceRecord *record)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ResourceId D3D8ResourceManager::GetID(IUnknown *res)
|
||||
{
|
||||
return GetResID(res);
|
||||
}
|
||||
|
||||
bool D3D8ResourceManager::ResourceTypeRelease(IUnknown *res)
|
||||
{
|
||||
if(res)
|
||||
res->Release();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool D3D8ResourceManager::Prepare_InitialState(IUnknown *res)
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t D3D8ResourceManager::GetSize_InitialState(ResourceId id, const D3D8InitialContents &data)
|
||||
{
|
||||
// TODO
|
||||
return 128;
|
||||
}
|
||||
|
||||
bool D3D8ResourceManager::Serialise_InitialState(WriteSerialiser &ser, ResourceId id,
|
||||
D3D8ResourceRecord *record,
|
||||
const D3D8InitialContents *data)
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
void D3D8ResourceManager::Create_InitialState(ResourceId id, IUnknown *live, bool hasData)
|
||||
{
|
||||
}
|
||||
|
||||
void D3D8ResourceManager::Apply_InitialState(IUnknown *live, const D3D8InitialContents &data)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/wrapped_pool.h"
|
||||
#include "core/core.h"
|
||||
#include "core/resource_manager.h"
|
||||
#include "serialise/serialiser.h"
|
||||
#include "d3d8_common.h"
|
||||
|
||||
enum D3D8ResourceType
|
||||
{
|
||||
Resource_Unknown = 0,
|
||||
Resource_VertexBuffer,
|
||||
Resource_IndexBuffer,
|
||||
};
|
||||
|
||||
struct D3D8ResourceRecord : public ResourceRecord
|
||||
{
|
||||
enum
|
||||
{
|
||||
NullResource = NULL
|
||||
};
|
||||
|
||||
D3D8ResourceRecord(ResourceId id) : ResourceRecord(id, true) {}
|
||||
};
|
||||
|
||||
struct D3D8InitialContents
|
||||
{
|
||||
template <typename Configuration>
|
||||
void Free(ResourceManager<Configuration> *rm)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct D3D8ResourceManagerConfiguration
|
||||
{
|
||||
typedef IUnknown *WrappedResourceType;
|
||||
typedef IUnknown *RealResourceType;
|
||||
typedef D3D8ResourceRecord RecordType;
|
||||
typedef D3D8InitialContents InitialContentData;
|
||||
};
|
||||
|
||||
class D3D8ResourceManager : public ResourceManager<D3D8ResourceManagerConfiguration>
|
||||
{
|
||||
public:
|
||||
D3D8ResourceManager(CaptureState &state, WrappedD3DDevice8 *dev)
|
||||
: ResourceManager(state), m_Device(dev)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
bool AutoReferenceResource(ResourceId id, D3D8ResourceRecord *record);
|
||||
ResourceId GetID(IUnknown *res);
|
||||
|
||||
bool ResourceTypeRelease(IUnknown *res);
|
||||
|
||||
bool Prepare_InitialState(IUnknown *res);
|
||||
uint64_t GetSize_InitialState(ResourceId id, const D3D8InitialContents &data);
|
||||
bool Serialise_InitialState(WriteSerialiser &ser, ResourceId id, D3D8ResourceRecord *record,
|
||||
const D3D8InitialContents *data);
|
||||
void Create_InitialState(ResourceId id, IUnknown *live, bool hasData);
|
||||
void Apply_InitialState(IUnknown *live, const D3D8InitialContents &data);
|
||||
|
||||
WrappedD3DDevice8 *m_Device;
|
||||
};
|
||||
@@ -1,40 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d8_common.h"
|
||||
|
||||
// disabled until capture is actually supported, so we can actually tell programmatically that the
|
||||
// API is unsupported. E.g. when we detect the API and let the user know, but disable a capture
|
||||
// button.
|
||||
#if 0
|
||||
|
||||
ResultDetails D3D8_CreateReplayDevice(RDCFile *rdc, IReplayDriver **driver)
|
||||
{
|
||||
RDCERR("D3D8 captures are not currently supported");
|
||||
return ResultCode::APIUnsupported;
|
||||
}
|
||||
|
||||
static DriverRegistration D3D8DriverRegistration(RDCDriver::D3D8, &D3D8_CreateReplayDevice);
|
||||
|
||||
#endif
|
||||
@@ -1,121 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d8_resources.h"
|
||||
|
||||
#undef D3D8_TYPE_MACRO
|
||||
#define D3D8_TYPE_MACRO(iface) WRAPPED_POOL_INST(CONCAT(Wrapped, iface));
|
||||
|
||||
ALL_D3D8_TYPES;
|
||||
|
||||
std::map<ResourceId, WrappedIDirect3DVertexBuffer8::BufferEntry>
|
||||
WrappedD3DBuffer8<IDirect3DVertexBuffer8, D3DVERTEXBUFFER_DESC>::m_BufferList;
|
||||
std::map<ResourceId, WrappedIDirect3DIndexBuffer8::BufferEntry>
|
||||
WrappedD3DBuffer8<IDirect3DIndexBuffer8, D3DINDEXBUFFER_DESC>::m_BufferList;
|
||||
|
||||
D3D8ResourceType IdentifyTypeByPtr(IUnknown *ptr)
|
||||
{
|
||||
if(ptr == NULL)
|
||||
return Resource_Unknown;
|
||||
|
||||
#undef D3D8_TYPE_MACRO
|
||||
#define D3D8_TYPE_MACRO(iface) \
|
||||
if(UnwrapHelper<iface>::IsAlloc(ptr)) \
|
||||
return UnwrapHelper<iface>::GetTypeEnum();
|
||||
|
||||
ALL_D3D8_TYPES;
|
||||
|
||||
RDCERR("Unknown type for ptr 0x%p", ptr);
|
||||
|
||||
return Resource_Unknown;
|
||||
}
|
||||
|
||||
TrackedResource8 *GetTracked(IUnknown *ptr)
|
||||
{
|
||||
if(ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
#undef D3D8_TYPE_MACRO
|
||||
#define D3D8_TYPE_MACRO(iface) \
|
||||
if(UnwrapHelper<iface>::IsAlloc(ptr)) \
|
||||
return (TrackedResource8 *)GetWrapped((iface *)ptr);
|
||||
|
||||
ALL_D3D8_TYPES;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <>
|
||||
IUnknown *Unwrap(IUnknown *ptr)
|
||||
{
|
||||
if(ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
#undef D3D8_TYPE_MACRO
|
||||
#define D3D8_TYPE_MACRO(iface) \
|
||||
if(UnwrapHelper<iface>::IsAlloc(ptr)) \
|
||||
return (IUnknown *)GetWrapped((iface *)ptr)->GetReal();
|
||||
|
||||
ALL_D3D8_TYPES;
|
||||
|
||||
RDCERR("Unknown type of ptr 0x%p", ptr);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <>
|
||||
ResourceId GetResID(IUnknown *ptr)
|
||||
{
|
||||
if(ptr == NULL)
|
||||
return ResourceId();
|
||||
|
||||
TrackedResource8 *res = GetTracked(ptr);
|
||||
|
||||
if(res == NULL)
|
||||
{
|
||||
RDCERR("Unknown type of ptr 0x%p", ptr);
|
||||
|
||||
return ResourceId();
|
||||
}
|
||||
|
||||
return res->GetResourceID();
|
||||
}
|
||||
|
||||
template <>
|
||||
D3D8ResourceRecord *GetRecord(IUnknown *ptr)
|
||||
{
|
||||
if(ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
TrackedResource8 *res = GetTracked(ptr);
|
||||
|
||||
if(res == NULL)
|
||||
{
|
||||
RDCERR("Unknown type of ptr 0x%p", ptr);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return res->GetResourceRecord();
|
||||
}
|
||||
@@ -1,336 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "d3d8_device.h"
|
||||
#include "d3d8_manager.h"
|
||||
|
||||
class TrackedResource8
|
||||
{
|
||||
public:
|
||||
TrackedResource8()
|
||||
{
|
||||
m_ID = ResourceIDGen::GetNewUniqueID();
|
||||
m_pRecord = NULL;
|
||||
}
|
||||
ResourceId GetResourceID() { return m_ID; }
|
||||
D3D8ResourceRecord *GetResourceRecord() { return m_pRecord; }
|
||||
void SetResourceRecord(D3D8ResourceRecord *record) { m_pRecord = record; }
|
||||
private:
|
||||
TrackedResource8(const TrackedResource8 &);
|
||||
TrackedResource8 &operator=(const TrackedResource8 &);
|
||||
|
||||
ResourceId m_ID;
|
||||
D3D8ResourceRecord *m_pRecord;
|
||||
};
|
||||
|
||||
template <typename NestedType>
|
||||
class WrappedIDirect3DResource8 : public RefCounter8, public NestedType, public TrackedResource8
|
||||
{
|
||||
protected:
|
||||
WrappedD3DDevice8 *m_pDevice;
|
||||
NestedType *m_pReal;
|
||||
unsigned int m_PipelineRefs;
|
||||
|
||||
WrappedIDirect3DResource8(NestedType *real, WrappedD3DDevice8 *device)
|
||||
: RefCounter8(real), m_pDevice(device), m_pReal(real), m_PipelineRefs(0)
|
||||
{
|
||||
m_pDevice->SoftRef();
|
||||
|
||||
bool ret = m_pDevice->GetResourceManager()->AddWrapper(this, real);
|
||||
if(!ret)
|
||||
RDCERR("Error adding wrapper for type %s", ToStr(__uuidof(NestedType)).c_str());
|
||||
|
||||
m_pDevice->GetResourceManager()->AddCurrentResource(GetResourceID(), this);
|
||||
}
|
||||
|
||||
virtual void Shutdown()
|
||||
{
|
||||
m_pDevice->GetResourceManager()->RemoveWrapper(m_pReal);
|
||||
m_pDevice->GetResourceManager()->ReleaseCurrentResource(GetResourceID());
|
||||
m_pDevice->ReleaseResource((NestedType *)this);
|
||||
SAFE_RELEASE(m_pReal);
|
||||
m_pDevice = NULL;
|
||||
}
|
||||
|
||||
virtual ~WrappedIDirect3DResource8()
|
||||
{
|
||||
// should have already called shutdown (needs to be called from child class to ensure
|
||||
// vtables are still in place when we call ReleaseResource)
|
||||
RDCASSERT(m_pDevice == NULL && m_pReal == NULL);
|
||||
}
|
||||
|
||||
public:
|
||||
typedef NestedType InnerType;
|
||||
|
||||
NestedType *GetReal() { return m_pReal; }
|
||||
ULONG STDMETHODCALLTYPE AddRef() { return RefCounter8::SoftRef(m_pDevice) - m_PipelineRefs; }
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
unsigned int piperefs = m_PipelineRefs;
|
||||
return RefCounter8::SoftRelease(m_pDevice) - piperefs;
|
||||
}
|
||||
|
||||
void PipelineAddRef() { InterlockedIncrement(&m_PipelineRefs); }
|
||||
void PipelineRelease() { InterlockedDecrement(&m_PipelineRefs); }
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
|
||||
{
|
||||
if(riid == __uuidof(IUnknown))
|
||||
{
|
||||
*ppvObject = (IUnknown *)(NestedType *)this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
if(riid == __uuidof(NestedType))
|
||||
{
|
||||
*ppvObject = (NestedType *)this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
if(riid == __uuidof(IDirect3DResource8))
|
||||
{
|
||||
*ppvObject = (IDirect3DResource8 *)this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return RefCounter8::QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// implement IDirect3DResource8
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDevice(__out IDirect3DDevice8 **ppDevice)
|
||||
{
|
||||
if(ppDevice)
|
||||
{
|
||||
*ppDevice = m_pDevice;
|
||||
m_pDevice->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID guid, void *pData, DWORD *pSizeOfData)
|
||||
{
|
||||
return m_pReal->GetPrivateData(guid, pData, pSizeOfData);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID guid, const void *pData, DWORD SizeOfData,
|
||||
DWORD Flags)
|
||||
{
|
||||
return m_pReal->SetPrivateData(guid, pData, SizeOfData, Flags);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE FreePrivateData(REFGUID guid) { return m_pReal->FreePrivateData(guid); }
|
||||
DWORD STDMETHODCALLTYPE SetPriority(DWORD PriorityNew)
|
||||
{
|
||||
return m_pReal->SetPriority(PriorityNew);
|
||||
}
|
||||
|
||||
DWORD STDMETHODCALLTYPE GetPriority() { return m_pReal->GetPriority(); }
|
||||
void STDMETHODCALLTYPE PreLoad() { return m_pReal->PreLoad(); }
|
||||
D3DRESOURCETYPE STDMETHODCALLTYPE GetType() { return m_pReal->GetType(); }
|
||||
};
|
||||
|
||||
template <typename NestedType, typename DescType>
|
||||
class WrappedD3DBuffer8 : public WrappedIDirect3DResource8<NestedType>
|
||||
{
|
||||
protected:
|
||||
#if ENABLED(RDOC_DEVEL)
|
||||
DescType m_Desc;
|
||||
#endif
|
||||
|
||||
public:
|
||||
struct BufferEntry
|
||||
{
|
||||
BufferEntry(WrappedD3DBuffer8 *b = NULL, uint32_t l = 0) : m_Buffer(b), length(l) {}
|
||||
WrappedD3DBuffer8 *m_Buffer;
|
||||
uint32_t length;
|
||||
};
|
||||
|
||||
static std::map<ResourceId, BufferEntry> m_BufferList;
|
||||
|
||||
WrappedD3DBuffer8(NestedType *real, uint32_t byteLength, WrappedD3DDevice8 *device)
|
||||
: WrappedIDirect3DResource8(real, device)
|
||||
{
|
||||
#if ENABLED(RDOC_DEVEL)
|
||||
real->GetDesc(&m_Desc);
|
||||
#endif
|
||||
SCOPED_LOCK(m_pDevice->D3DLock());
|
||||
|
||||
RDCASSERT(m_BufferList.find(GetResourceID()) == m_BufferList.end());
|
||||
m_BufferList[GetResourceID()] = BufferEntry(this, byteLength);
|
||||
}
|
||||
|
||||
virtual ~WrappedD3DBuffer8()
|
||||
{
|
||||
SCOPED_LOCK(m_pDevice->D3DLock());
|
||||
|
||||
if(m_BufferList.find(GetResourceID()) != m_BufferList.end())
|
||||
m_BufferList.erase(GetResourceID());
|
||||
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Lock(UINT OffsetToLock, UINT SizeToLock, BYTE **ppbData, DWORD Flags)
|
||||
{
|
||||
// TODO
|
||||
return m_pReal->Lock(OffsetToLock, SizeToLock, ppbData, Flags);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Unlock()
|
||||
{
|
||||
// TODO
|
||||
return m_pReal->Unlock();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDesc(DescType *pDesc) { return m_pReal->GetDesc(pDesc); }
|
||||
};
|
||||
|
||||
class WrappedIDirect3DVertexBuffer8
|
||||
: public WrappedD3DBuffer8<IDirect3DVertexBuffer8, D3DVERTEXBUFFER_DESC>
|
||||
{
|
||||
public:
|
||||
ALLOCATE_WITH_WRAPPED_POOL(WrappedIDirect3DVertexBuffer8);
|
||||
|
||||
enum
|
||||
{
|
||||
TypeEnum = Resource_VertexBuffer,
|
||||
};
|
||||
|
||||
WrappedIDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *real, uint32_t byteLength,
|
||||
WrappedD3DDevice8 *device)
|
||||
: WrappedD3DBuffer8(real, byteLength, device)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class WrappedIDirect3DIndexBuffer8
|
||||
: public WrappedD3DBuffer8<IDirect3DIndexBuffer8, D3DINDEXBUFFER_DESC>
|
||||
{
|
||||
public:
|
||||
ALLOCATE_WITH_WRAPPED_POOL(WrappedIDirect3DIndexBuffer8);
|
||||
|
||||
enum
|
||||
{
|
||||
TypeEnum = Resource_IndexBuffer,
|
||||
};
|
||||
|
||||
WrappedIDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *real, uint32_t byteLength,
|
||||
WrappedD3DDevice8 *device)
|
||||
: WrappedD3DBuffer8(real, byteLength, device)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#define ALL_D3D8_TYPES \
|
||||
D3D8_TYPE_MACRO(IDirect3DVertexBuffer8); \
|
||||
D3D8_TYPE_MACRO(IDirect3DIndexBuffer8);
|
||||
|
||||
// template magic voodoo to unwrap types
|
||||
template <typename inner>
|
||||
struct UnwrapHelper
|
||||
{
|
||||
};
|
||||
|
||||
#undef D3D8_TYPE_MACRO
|
||||
#define D3D8_TYPE_MACRO(iface) \
|
||||
template <> \
|
||||
struct UnwrapHelper<iface> \
|
||||
{ \
|
||||
typedef CONCAT(Wrapped, iface) Outer; \
|
||||
static bool IsAlloc(void *ptr) { return Outer::IsAlloc(ptr); } \
|
||||
static D3D8ResourceType GetTypeEnum() { return (D3D8ResourceType)Outer::TypeEnum; } \
|
||||
static Outer *FromHandle(iface *wrapped) { return (Outer *)wrapped; } \
|
||||
}; \
|
||||
template <> \
|
||||
struct UnwrapHelper<CONCAT(Wrapped, iface)> \
|
||||
{ \
|
||||
typedef CONCAT(Wrapped, iface) Outer; \
|
||||
static bool IsAlloc(void *ptr) { return Outer::IsAlloc(ptr); } \
|
||||
static D3D8ResourceType GetTypeEnum() { return (D3D8ResourceType)Outer::TypeEnum; } \
|
||||
static Outer *FromHandle(iface *wrapped) { return (Outer *)wrapped; } \
|
||||
};
|
||||
|
||||
ALL_D3D8_TYPES;
|
||||
|
||||
D3D8ResourceType IdentifyTypeByPtr(IUnknown *ptr);
|
||||
|
||||
#define WRAPPING_DEBUG 0
|
||||
|
||||
template <typename iface>
|
||||
typename UnwrapHelper<iface>::Outer *GetWrapped(iface *obj)
|
||||
{
|
||||
if(obj == NULL)
|
||||
return NULL;
|
||||
|
||||
typename UnwrapHelper<iface>::Outer *wrapped = UnwrapHelper<iface>::FromHandle(obj);
|
||||
|
||||
#if WRAPPING_DEBUG
|
||||
if(obj != NULL && !wrapped->IsAlloc(wrapped))
|
||||
{
|
||||
RDCERR("Trying to unwrap invalid type");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
template <typename ifaceptr>
|
||||
ifaceptr Unwrap(ifaceptr obj)
|
||||
{
|
||||
if(obj == NULL)
|
||||
return NULL;
|
||||
|
||||
return GetWrapped(obj)->GetReal();
|
||||
}
|
||||
|
||||
template <typename ifaceptr>
|
||||
ResourceId GetResID(ifaceptr obj)
|
||||
{
|
||||
if(obj == NULL)
|
||||
return ResourceId();
|
||||
|
||||
return GetWrapped(obj)->GetResourceID();
|
||||
}
|
||||
|
||||
template <typename ifaceptr>
|
||||
D3D8ResourceRecord *GetRecord(ifaceptr obj)
|
||||
{
|
||||
if(obj == NULL)
|
||||
return NULL;
|
||||
|
||||
return GetWrapped(obj)->GetResourceRecord();
|
||||
}
|
||||
|
||||
// specialisations that use the IsAlloc() function to identify the real type
|
||||
template <>
|
||||
ResourceId GetResID(IUnknown *ptr);
|
||||
template <>
|
||||
IUnknown *Unwrap(IUnknown *ptr);
|
||||
template <>
|
||||
D3D8ResourceRecord *GetRecord(IUnknown *ptr);
|
||||
@@ -1,25 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "precompiled.h"
|
||||
@@ -1,32 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "api/app/renderdoc_app.h"
|
||||
#include "api/replay/renderdoc_replay.h"
|
||||
#include "common/common.h"
|
||||
#include "os/os_specific.h"
|
||||
|
||||
#include "d3d8_common.h"
|
||||
@@ -1,131 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Development|Win32">
|
||||
<Configuration>Development</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Development|x64">
|
||||
<Configuration>Development</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{9C4487E8-EEB0-4A7F-BD81-23F81CD24E22}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>renderdoc_d3d8</RootNamespace>
|
||||
<ProjectName>d3d8</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)\util\WindowsSDKTarget.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
|
||||
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
<ExcludePath>$(ExcludePath)</ExcludePath>
|
||||
<TargetName>driver_$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)renderdoc\;$(SolutionDir)renderdoc\3rdparty\</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>RENDERDOC_EXPORTS;RENDERDOC_PLATFORM_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DisableSpecificWarnings>4100</DisableSpecificWarnings>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
|
||||
<ForcedIncludeFiles>precompiled.h</ForcedIncludeFiles>
|
||||
<AdditionalOptions>/w44062 /w44840 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Development'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="d3d8_common.cpp" />
|
||||
<ClCompile Include="d3d8_debug.cpp" />
|
||||
<ClCompile Include="d3d8_device.cpp" />
|
||||
<ClCompile Include="d3d8_hooks.cpp" />
|
||||
<ClCompile Include="d3d8_manager.cpp" />
|
||||
<ClCompile Include="d3d8_replay.cpp" />
|
||||
<ClCompile Include="d3d8_resources.cpp" />
|
||||
<ClCompile Include="precompiled.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\dx\official\d3d8.h" />
|
||||
<ClInclude Include="..\dx\official\d3d8caps.h" />
|
||||
<ClInclude Include="..\dx\official\d3d8types.h" />
|
||||
<ClInclude Include="..\dx\official\d3dcommon.h" />
|
||||
<ClInclude Include="..\dx\official\d3dcompiler.h" />
|
||||
<ClInclude Include="d3d8_common.h" />
|
||||
<ClInclude Include="d3d8_debug.h" />
|
||||
<ClInclude Include="d3d8_device.h" />
|
||||
<ClInclude Include="d3d8_manager.h" />
|
||||
<ClInclude Include="d3d8_resources.h" />
|
||||
<ClInclude Include="precompiled.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Hooks">
|
||||
<UniqueIdentifier>{5CAAA42F-25FF-43DD-B545-E7ADB5135418}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="official">
|
||||
<UniqueIdentifier>{87CAD3D6-BA09-4D6E-84CF-29B8DC5A5B0A}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Debug">
|
||||
<UniqueIdentifier>{6056F6EB-A9BC-4B50-B205-461B7580977B}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Common">
|
||||
<UniqueIdentifier>{B9341B0E-2A54-415C-AF54-29D67D2325A2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Replay">
|
||||
<UniqueIdentifier>{7D6E973E-947D-4EAA-AFB4-DA33987ED452}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="PCH">
|
||||
<UniqueIdentifier>{74FA3D85-A524-442D-9682-BB832AB5E136}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Util">
|
||||
<UniqueIdentifier>{025d23be-15d8-4d7d-bcbb-5899d5984f30}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="d3d8_hooks.cpp">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d8_debug.cpp">
|
||||
<Filter>Debug</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d8_device.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d8_common.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d8_replay.cpp">
|
||||
<Filter>Replay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="precompiled.cpp">
|
||||
<Filter>PCH</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d8_manager.cpp">
|
||||
<Filter>Util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d8_resources.cpp">
|
||||
<Filter>Util</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\dx\official\d3d8.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dx\official\d3dcommon.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dx\official\d3dcompiler.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dx\official\d3d8caps.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dx\official\d3d8types.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3d8_debug.h">
|
||||
<Filter>Debug</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3d8_device.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3d8_common.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="precompiled.h">
|
||||
<Filter>PCH</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3d8_resources.h">
|
||||
<Filter>Util</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3d8_manager.h">
|
||||
<Filter>Util</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,58 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d9_common.h"
|
||||
#include "d3d9_device.h"
|
||||
|
||||
unsigned int RefCounter9::SoftRef(WrappedD3DDevice9 *device)
|
||||
{
|
||||
unsigned int ret = AddRef();
|
||||
if(device)
|
||||
device->SoftRef();
|
||||
else
|
||||
RDCWARN("No device pointer, is a deleted resource being AddRef()d?");
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int RefCounter9::SoftRelease(WrappedD3DDevice9 *device)
|
||||
{
|
||||
unsigned int ret = Release();
|
||||
if(device)
|
||||
device->SoftRelease();
|
||||
else
|
||||
RDCWARN("No device pointer, is a deleted resource being Release()d?");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void RefCounter9::AddDeviceSoftref(WrappedD3DDevice9 *device)
|
||||
{
|
||||
if(device)
|
||||
device->SoftRef();
|
||||
}
|
||||
|
||||
void RefCounter9::ReleaseDeviceSoftref(WrappedD3DDevice9 *device)
|
||||
{
|
||||
if(device)
|
||||
device->SoftRelease();
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/core.h"
|
||||
#include "driver/dx/official/d3d9.h"
|
||||
|
||||
class WrappedD3DDevice9;
|
||||
|
||||
class RefCounter9
|
||||
{
|
||||
private:
|
||||
IUnknown *m_pReal;
|
||||
unsigned int m_iRefcount;
|
||||
bool m_SelfDeleting;
|
||||
|
||||
protected:
|
||||
void SetSelfDeleting(bool selfDelete) { m_SelfDeleting = selfDelete; }
|
||||
// used for derived classes that need to soft ref but are handling their
|
||||
// own self-deletion
|
||||
static void AddDeviceSoftref(WrappedD3DDevice9 *device);
|
||||
static void ReleaseDeviceSoftref(WrappedD3DDevice9 *device);
|
||||
|
||||
public:
|
||||
RefCounter9(IUnknown *real, bool selfDelete = true)
|
||||
: m_pReal(real), m_iRefcount(1), m_SelfDeleting(selfDelete)
|
||||
{
|
||||
}
|
||||
virtual ~RefCounter9() {}
|
||||
unsigned int GetRefCount() { return m_iRefcount; }
|
||||
//////////////////////////////
|
||||
// implement IUnknown
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
/* [in] */ REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
__RPC__deref_out void **ppvObject)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
InterlockedIncrement(&m_iRefcount);
|
||||
return m_iRefcount;
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
unsigned int ret = InterlockedDecrement(&m_iRefcount);
|
||||
if(ret == 0 && m_SelfDeleting)
|
||||
delete this;
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int SoftRef(WrappedD3DDevice9 *device);
|
||||
unsigned int SoftRelease(WrappedD3DDevice9 *device);
|
||||
};
|
||||
@@ -1,315 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d9_debug.h"
|
||||
#include "os/os_specific.h"
|
||||
#include "stb/stb_truetype.h"
|
||||
#include "strings/string_utils.h"
|
||||
|
||||
D3D9DebugManager::D3D9DebugManager(WrappedD3DDevice9 *wrapper)
|
||||
: m_WrappedDevice(wrapper), m_fvf(D3DFVF_XYZ | D3DFVF_TEX1)
|
||||
{
|
||||
InitFontRendering();
|
||||
}
|
||||
|
||||
D3D9DebugManager::~D3D9DebugManager()
|
||||
{
|
||||
ShutdownFontRendering();
|
||||
}
|
||||
|
||||
bool D3D9DebugManager::InitFontRendering()
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
int width = FONT_TEX_WIDTH;
|
||||
int height = FONT_TEX_HEIGHT;
|
||||
|
||||
rdcstr font = GetEmbeddedResource(sourcecodepro_ttf);
|
||||
byte *ttfdata = (byte *)font.c_str();
|
||||
|
||||
const int firstChar = int(' ') + 1;
|
||||
const int lastChar = 127;
|
||||
const int numChars = lastChar - firstChar;
|
||||
|
||||
byte *buf = new byte[width * height];
|
||||
|
||||
const float pixelHeight = 20.0f;
|
||||
|
||||
stbtt_BakeFontBitmap(ttfdata, 0, pixelHeight, buf, width, height, firstChar, numChars,
|
||||
m_Font.charData);
|
||||
|
||||
stbtt_fontinfo f = {0};
|
||||
stbtt_InitFont(&f, ttfdata, 0);
|
||||
|
||||
int ascent = 0;
|
||||
stbtt_GetFontVMetrics(&f, &ascent, NULL, NULL);
|
||||
|
||||
m_Font.maxHeight = float(ascent) * stbtt_ScaleForPixelHeight(&f, pixelHeight);
|
||||
|
||||
IDirect3DTexture9 *fontTex = NULL;
|
||||
|
||||
hr = m_WrappedDevice->CreateTexture(width, height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, &fontTex, NULL);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
RDCERR("Failed to create font texture HRESULT: %s", ToStr(hr).c_str());
|
||||
}
|
||||
|
||||
D3DLOCKED_RECT lockedRegion;
|
||||
hr = fontTex->LockRect(0, &lockedRegion, NULL, D3DLOCK_DISCARD);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
RDCERR("Failed to lock font texture HRESULT: %s", ToStr(hr).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE *texBase = (BYTE *)lockedRegion.pBits;
|
||||
|
||||
for(int y = 0; y < height; y++)
|
||||
{
|
||||
byte *curRow = (texBase + (y * lockedRegion.Pitch));
|
||||
|
||||
for(int x = 0; x < width; x++)
|
||||
{
|
||||
curRow[x * 4 + 0] = buf[(y * width) + x];
|
||||
curRow[x * 4 + 1] = buf[(y * width) + x];
|
||||
curRow[x * 4 + 2] = buf[(y * width) + x];
|
||||
curRow[x * 4 + 3] = buf[(y * width) + x];
|
||||
}
|
||||
}
|
||||
|
||||
hr = fontTex->UnlockRect(0);
|
||||
if(hr != S_OK)
|
||||
{
|
||||
RDCERR("Failed to unlock font texture HRESULT: %s", ToStr(hr).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
m_Font.Tex = fontTex;
|
||||
|
||||
delete[] buf;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void D3D9DebugManager::ShutdownFontRendering()
|
||||
{
|
||||
SAFE_RELEASE(m_Font.Tex);
|
||||
}
|
||||
|
||||
void D3D9DebugManager::SetOutputWindow(HWND w)
|
||||
{
|
||||
// RECT rect;
|
||||
// GetClientRect(w, &rect);
|
||||
// m_supersamplingX = float(m_width) / float(rect.right - rect.left);
|
||||
// m_supersamplingY = float(m_height) / float(rect.bottom - rect.top);
|
||||
}
|
||||
|
||||
void D3D9DebugManager::RenderText(float x, float y, const rdcstr &text)
|
||||
{
|
||||
rdcarray<rdcstr> lines;
|
||||
split(text, lines, '\n');
|
||||
|
||||
for(const rdcstr &line : lines)
|
||||
{
|
||||
RenderTextInternal(x, y, line);
|
||||
y += 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void D3D9DebugManager::RenderTextInternal(float x, float y, const rdcstr &text)
|
||||
{
|
||||
if(text.empty())
|
||||
return;
|
||||
|
||||
RDCASSERT(text.size() < FONT_MAX_CHARS);
|
||||
|
||||
// transforms
|
||||
float width = (float)m_width;
|
||||
float height = (float)m_height;
|
||||
float nearPlane = 0.001f;
|
||||
float farPlane = 1.f;
|
||||
D3DMATRIX identity = {1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f,
|
||||
0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f};
|
||||
D3DMATRIX ortho = {2.f / width,
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
-(2.f / height),
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
1.f / (farPlane - nearPlane),
|
||||
0.f,
|
||||
0.f,
|
||||
0.f,
|
||||
nearPlane / (nearPlane - farPlane),
|
||||
1.f};
|
||||
|
||||
HRESULT res = S_OK;
|
||||
res |= m_WrappedDevice->SetTransform(D3DTS_PROJECTION, &ortho);
|
||||
res |= m_WrappedDevice->SetTransform(D3DTS_WORLD, &identity);
|
||||
res |= m_WrappedDevice->SetTransform(D3DTS_VIEW, &identity);
|
||||
|
||||
// enable fixed function pipeline
|
||||
res |= m_WrappedDevice->SetVertexShader(NULL);
|
||||
res |= m_WrappedDevice->SetPixelShader(NULL);
|
||||
|
||||
// default render states
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_CLIPPING, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_FOGENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0x0000000F);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_DISABLE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
|
||||
|
||||
// sampler states
|
||||
res |= m_WrappedDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
|
||||
res |= m_WrappedDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
|
||||
res |= m_WrappedDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR /*D3DTEXF_POINT*/);
|
||||
res |= m_WrappedDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR /*D3DTEXF_POINT*/);
|
||||
res |= m_WrappedDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR /*D3DTEXF_POINT*/);
|
||||
res |= m_WrappedDevice->SetSamplerState(0, D3DSAMP_SRGBTEXTURE, 0);
|
||||
|
||||
// texture stage states
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_COLORARG0, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_ALPHAARG0, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_RESULTARG, D3DTA_CURRENT);
|
||||
res |= m_WrappedDevice->SetTextureStageState(0, D3DTSS_CONSTANT, 0xffffffff);
|
||||
|
||||
res |= m_WrappedDevice->SetFVF(m_fvf);
|
||||
res |= m_WrappedDevice->SetTexture(0, m_Font.Tex);
|
||||
for(uint32_t stage = 1; stage < 8; stage++)
|
||||
{
|
||||
res |= m_WrappedDevice->SetTexture(stage, NULL);
|
||||
}
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
float pos[3];
|
||||
float uv[2];
|
||||
|
||||
Vertex() {}
|
||||
Vertex(float posx, float posy, float posz, float texu, float texv)
|
||||
{
|
||||
pos[0] = posx;
|
||||
pos[1] = posy;
|
||||
pos[2] = posz;
|
||||
uv[0] = texu;
|
||||
uv[1] = texv;
|
||||
}
|
||||
};
|
||||
|
||||
struct Quad
|
||||
{
|
||||
Vertex vertices[6];
|
||||
|
||||
Quad() {}
|
||||
Quad(float x0, float y0, float z, float s0, float t0, float x1, float y1, float s1, float t1)
|
||||
{
|
||||
vertices[0] = Vertex(x0, y0, z, s0, t0);
|
||||
vertices[1] = Vertex(x1, y0, z, s1, t0);
|
||||
vertices[2] = Vertex(x0, y1, z, s0, t1);
|
||||
vertices[3] = Vertex(x1, y0, z, s1, t0);
|
||||
vertices[4] = Vertex(x1, y1, z, s1, t1);
|
||||
vertices[5] = Vertex(x0, y1, z, s0, t1);
|
||||
}
|
||||
};
|
||||
|
||||
Quad *quads = NULL;
|
||||
Quad background;
|
||||
UINT triangleCount = 0;
|
||||
{
|
||||
UINT quadCount = (UINT)text.size(); // calculate string length
|
||||
|
||||
triangleCount = quadCount * 2;
|
||||
// create text VB
|
||||
quads = new Quad[quadCount];
|
||||
|
||||
float textStartingPositionX = (-width / 2.f) + (x * m_Font.charData[0].xadvance);
|
||||
float textStartingPositionY = (-height / 2.f) + ((y + 1.f) * m_Font.maxHeight);
|
||||
|
||||
float textPositionX = textStartingPositionX;
|
||||
float textPositionY = textStartingPositionY;
|
||||
|
||||
for(UINT i = 0; i < quadCount; ++i)
|
||||
{
|
||||
char glyphIndex = text[i] - (' ' + 1);
|
||||
if(glyphIndex < 0)
|
||||
{
|
||||
float currentX = textPositionX;
|
||||
textPositionX += m_Font.charData[0].xadvance;
|
||||
quads[i] = Quad(currentX, textPositionY - m_Font.maxHeight, 0.5f, 0.f, 0.f, textPositionX,
|
||||
textPositionY, 0.f, 0.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
stbtt_aligned_quad quad;
|
||||
stbtt_GetBakedQuad(m_Font.charData, 256, 128, glyphIndex, &textPositionX, &textPositionY,
|
||||
&quad, 0);
|
||||
quads[i] = Quad(quad.x0, quad.y0, 0.5f, quad.s0, quad.t0, quad.x1, quad.y1, quad.s1, quad.t1);
|
||||
}
|
||||
}
|
||||
|
||||
background = Quad(textStartingPositionX, textStartingPositionY - m_Font.maxHeight, 0.6f, 0.f,
|
||||
0.f, textPositionX, textPositionY + 3.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
{
|
||||
// overlay render states
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
res |= m_WrappedDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 2, &background, sizeof(Vertex));
|
||||
|
||||
//// overlay render states
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
res |= m_WrappedDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
||||
|
||||
res |= m_WrappedDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, triangleCount, &quads[0],
|
||||
sizeof(Vertex));
|
||||
delete[] quads;
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include "driver/dx/official/d3d9.h"
|
||||
#include "stb/stb_truetype.h"
|
||||
#include "d3d9_common.h"
|
||||
#include "d3d9_device.h"
|
||||
|
||||
class D3D9DebugManager
|
||||
{
|
||||
public:
|
||||
D3D9DebugManager(WrappedD3DDevice9 *wrapper);
|
||||
~D3D9DebugManager();
|
||||
|
||||
void RenderText(float x, float y, const rdcstr &text);
|
||||
|
||||
void SetOutputDimensions(int w, int h)
|
||||
{
|
||||
m_width = w;
|
||||
m_height = h;
|
||||
}
|
||||
void SetOutputWindow(HWND w);
|
||||
|
||||
// font/text rendering
|
||||
bool InitFontRendering();
|
||||
void ShutdownFontRendering();
|
||||
|
||||
void RenderTextInternal(float x, float y, const rdcstr &text);
|
||||
|
||||
static const int FONT_TEX_WIDTH = 256;
|
||||
static const int FONT_TEX_HEIGHT = 128;
|
||||
static const int FONT_MAX_CHARS = 256;
|
||||
|
||||
static const uint32_t STAGE_BUFFER_BYTE_SIZE = 4 * 1024 * 1024;
|
||||
|
||||
struct FontData
|
||||
{
|
||||
FontData() { RDCEraseMem(this, sizeof(FontData)); }
|
||||
~FontData() { SAFE_RELEASE(Tex); }
|
||||
IDirect3DTexture9 *Tex;
|
||||
stbtt_bakedchar charData[FONT_MAX_CHARS];
|
||||
float maxHeight;
|
||||
} m_Font;
|
||||
|
||||
DWORD m_fvf;
|
||||
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
WrappedD3DDevice9 *m_WrappedDevice;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,313 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "common/timing.h"
|
||||
#include "d3d9_common.h"
|
||||
|
||||
class D3D9DebugManager;
|
||||
|
||||
class WrappedD3DDevice9 : public IDirect3DDevice9, public IFrameCapturer
|
||||
{
|
||||
public:
|
||||
WrappedD3DDevice9(IDirect3DDevice9 *device, HWND wnd);
|
||||
~WrappedD3DDevice9();
|
||||
|
||||
void LazyInit();
|
||||
|
||||
RDCDriver GetFrameCaptureDriver() { return RDCDriver::D3D9; }
|
||||
void StartFrameCapture(DeviceOwnedWindow devWnd);
|
||||
bool EndFrameCapture(DeviceOwnedWindow devWnd);
|
||||
bool DiscardFrameCapture(DeviceOwnedWindow devWnd);
|
||||
|
||||
void InternalRef() { InterlockedIncrement(&m_InternalRefcount); }
|
||||
void InternalRelease() { InterlockedDecrement(&m_InternalRefcount); }
|
||||
void SoftRef() { m_SoftRefCounter.AddRef(); }
|
||||
void SoftRelease()
|
||||
{
|
||||
m_SoftRefCounter.Release();
|
||||
CheckForDeath();
|
||||
}
|
||||
|
||||
D3D9DebugManager *GetDebugManager() { return m_DebugManager; }
|
||||
/*** IUnknown methods ***/
|
||||
ULONG STDMETHODCALLTYPE AddRef() { return m_RefCounter.AddRef(); }
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
unsigned int ret = m_RefCounter.Release();
|
||||
CheckForDeath();
|
||||
return ret;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
|
||||
|
||||
/*** IDirect3DDevice9 methods ***/
|
||||
virtual HRESULT __stdcall TestCooperativeLevel();
|
||||
virtual UINT __stdcall GetAvailableTextureMem();
|
||||
virtual HRESULT __stdcall EvictManagedResources();
|
||||
virtual HRESULT __stdcall GetDirect3D(IDirect3D9 **ppD3D9);
|
||||
virtual HRESULT __stdcall GetDeviceCaps(D3DCAPS9 *pCaps);
|
||||
virtual HRESULT __stdcall GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE *pMode);
|
||||
virtual HRESULT __stdcall GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters);
|
||||
virtual HRESULT __stdcall SetCursorProperties(UINT XHotSpot, UINT YHotSpot,
|
||||
IDirect3DSurface9 *pCursorBitmap);
|
||||
virtual void __stdcall SetCursorPosition(int X, int Y, DWORD Flags);
|
||||
virtual BOOL __stdcall ShowCursor(BOOL bShow);
|
||||
virtual HRESULT __stdcall CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS *pPresentationParameters,
|
||||
IDirect3DSwapChain9 **pSwapChain);
|
||||
virtual HRESULT __stdcall GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain);
|
||||
virtual UINT __stdcall GetNumberOfSwapChains();
|
||||
virtual HRESULT __stdcall Reset(D3DPRESENT_PARAMETERS *pPresentationParameters);
|
||||
virtual HRESULT __stdcall Present(CONST RECT *pSourceRect, CONST RECT *pDestRect,
|
||||
HWND hDestWindow, CONST RGNDATA *pDirtyRegion);
|
||||
virtual HRESULT __stdcall GetBackBuffer(UINT iSwapChain, UINT iBackBuffer,
|
||||
D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer);
|
||||
virtual HRESULT __stdcall GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS *pRasterStatus);
|
||||
virtual HRESULT __stdcall SetDialogBoxMode(BOOL bEnableDialogs);
|
||||
virtual void __stdcall SetGammaRamp(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP *pRamp);
|
||||
virtual void __stdcall GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP *pRamp);
|
||||
virtual HRESULT __stdcall CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage,
|
||||
D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DTexture9 **ppTexture, HANDLE *pSharedHandle);
|
||||
virtual HRESULT __stdcall CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels,
|
||||
DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DVolumeTexture9 **ppVolumeTexture,
|
||||
HANDLE *pSharedHandle);
|
||||
virtual HRESULT __stdcall CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage,
|
||||
D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DCubeTexture9 **ppCubeTexture,
|
||||
HANDLE *pSharedHandle);
|
||||
virtual HRESULT __stdcall CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool,
|
||||
IDirect3DVertexBuffer9 **ppVertexBuffer,
|
||||
HANDLE *pSharedHandle);
|
||||
virtual HRESULT __stdcall CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format,
|
||||
D3DPOOL Pool, IDirect3DIndexBuffer9 **ppIndexBuffer,
|
||||
HANDLE *pSharedHandle);
|
||||
virtual HRESULT __stdcall CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format,
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality, BOOL Lockable,
|
||||
IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle);
|
||||
virtual HRESULT __stdcall CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format,
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality, BOOL Discard,
|
||||
IDirect3DSurface9 **ppSurface,
|
||||
HANDLE *pSharedHandle);
|
||||
virtual HRESULT __stdcall UpdateSurface(IDirect3DSurface9 *pSourceSurface, CONST RECT *pSourceRect,
|
||||
IDirect3DSurface9 *pDestinationSurface,
|
||||
CONST POINT *pDestPoint);
|
||||
virtual HRESULT __stdcall UpdateTexture(IDirect3DBaseTexture9 *pSourceTexture,
|
||||
IDirect3DBaseTexture9 *pDestinationTexture);
|
||||
virtual HRESULT __stdcall GetRenderTargetData(IDirect3DSurface9 *pRenderTarget,
|
||||
IDirect3DSurface9 *pDestSurface);
|
||||
virtual HRESULT __stdcall GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9 *pDestSurface);
|
||||
virtual HRESULT __stdcall StretchRect(IDirect3DSurface9 *pSourceSurface, CONST RECT *pSourceRect,
|
||||
IDirect3DSurface9 *pDestSurface, CONST RECT *pDestRect,
|
||||
D3DTEXTUREFILTERTYPE Filter);
|
||||
virtual HRESULT __stdcall ColorFill(IDirect3DSurface9 *pSurface, CONST RECT *pRect, D3DCOLOR color);
|
||||
virtual HRESULT __stdcall CreateOffscreenPlainSurface(UINT Width, UINT Height, D3DFORMAT Format,
|
||||
D3DPOOL Pool, IDirect3DSurface9 **ppSurface,
|
||||
HANDLE *pSharedHandle);
|
||||
virtual HRESULT __stdcall SetRenderTarget(DWORD RenderTargetIndex,
|
||||
IDirect3DSurface9 *pRenderTarget);
|
||||
virtual HRESULT __stdcall GetRenderTarget(DWORD RenderTargetIndex,
|
||||
IDirect3DSurface9 **ppRenderTarget);
|
||||
virtual HRESULT __stdcall SetDepthStencilSurface(IDirect3DSurface9 *pNewZStencil);
|
||||
virtual HRESULT __stdcall GetDepthStencilSurface(IDirect3DSurface9 **ppZStencilSurface);
|
||||
virtual HRESULT __stdcall BeginScene();
|
||||
virtual HRESULT __stdcall EndScene();
|
||||
virtual HRESULT __stdcall Clear(DWORD Count, CONST D3DRECT *pRects, DWORD Flags, D3DCOLOR Color,
|
||||
float Z, DWORD Stencil);
|
||||
virtual HRESULT __stdcall SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix);
|
||||
virtual HRESULT __stdcall GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix);
|
||||
virtual HRESULT __stdcall MultiplyTransform(D3DTRANSFORMSTATETYPE, CONST D3DMATRIX *);
|
||||
virtual HRESULT __stdcall SetViewport(CONST D3DVIEWPORT9 *pViewport);
|
||||
virtual HRESULT __stdcall GetViewport(D3DVIEWPORT9 *pViewport);
|
||||
virtual HRESULT __stdcall SetMaterial(CONST D3DMATERIAL9 *pMaterial);
|
||||
virtual HRESULT __stdcall GetMaterial(D3DMATERIAL9 *pMaterial);
|
||||
virtual HRESULT __stdcall SetLight(DWORD Index, CONST D3DLIGHT9 *);
|
||||
virtual HRESULT __stdcall GetLight(DWORD Index, D3DLIGHT9 *);
|
||||
virtual HRESULT __stdcall LightEnable(DWORD Index, BOOL Enable);
|
||||
virtual HRESULT __stdcall GetLightEnable(DWORD Index, BOOL *pEnable);
|
||||
virtual HRESULT __stdcall SetClipPlane(DWORD Index, CONST float *pPlane);
|
||||
virtual HRESULT __stdcall GetClipPlane(DWORD Index, float *pPlane);
|
||||
virtual HRESULT __stdcall SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
|
||||
virtual HRESULT __stdcall GetRenderState(D3DRENDERSTATETYPE State, DWORD *pValue);
|
||||
virtual HRESULT __stdcall CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9 **ppSB);
|
||||
virtual HRESULT __stdcall BeginStateBlock();
|
||||
virtual HRESULT __stdcall EndStateBlock(IDirect3DStateBlock9 **ppSB);
|
||||
virtual HRESULT __stdcall SetClipStatus(CONST D3DCLIPSTATUS9 *pClipStatus);
|
||||
virtual HRESULT __stdcall GetClipStatus(D3DCLIPSTATUS9 *pClipStatus);
|
||||
virtual HRESULT __stdcall GetTexture(DWORD Stage, IDirect3DBaseTexture9 **ppTexture);
|
||||
virtual HRESULT __stdcall SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture);
|
||||
virtual HRESULT __stdcall GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,
|
||||
DWORD *pValue);
|
||||
virtual HRESULT __stdcall SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,
|
||||
DWORD Value);
|
||||
virtual HRESULT __stdcall GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD *pValue);
|
||||
virtual HRESULT __stdcall SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
|
||||
virtual HRESULT __stdcall ValidateDevice(DWORD *pNumPasses);
|
||||
virtual HRESULT __stdcall SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY *pEntries);
|
||||
virtual HRESULT __stdcall GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY *pEntries);
|
||||
virtual HRESULT __stdcall SetCurrentTexturePalette(UINT PaletteNumber);
|
||||
virtual HRESULT __stdcall GetCurrentTexturePalette(UINT *PaletteNumber);
|
||||
virtual HRESULT __stdcall SetScissorRect(CONST RECT *pRect);
|
||||
virtual HRESULT __stdcall GetScissorRect(RECT *pRect);
|
||||
virtual HRESULT __stdcall SetSoftwareVertexProcessing(BOOL bSoftware);
|
||||
virtual BOOL __stdcall GetSoftwareVertexProcessing();
|
||||
virtual HRESULT __stdcall SetNPatchMode(float nSegments);
|
||||
virtual float __stdcall GetNPatchMode();
|
||||
virtual HRESULT __stdcall DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex,
|
||||
UINT PrimitiveCount);
|
||||
virtual HRESULT __stdcall DrawIndexedPrimitive(D3DPRIMITIVETYPE, INT BaseVertexIndex,
|
||||
UINT MinVertexIndex, UINT NumVertices,
|
||||
UINT startIndex, UINT primCount);
|
||||
virtual HRESULT __stdcall DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount,
|
||||
CONST void *pVertexStreamZeroData,
|
||||
UINT VertexStreamZeroStride);
|
||||
virtual HRESULT __stdcall DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,
|
||||
UINT MinVertexIndex, UINT NumVertices,
|
||||
UINT PrimitiveCount, CONST void *pIndexData,
|
||||
D3DFORMAT IndexDataFormat,
|
||||
CONST void *pVertexStreamZeroData,
|
||||
UINT VertexStreamZeroStride);
|
||||
virtual HRESULT __stdcall ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount,
|
||||
IDirect3DVertexBuffer9 *pDestBuffer,
|
||||
IDirect3DVertexDeclaration9 *pVertexDecl, DWORD Flags);
|
||||
virtual HRESULT __stdcall CreateVertexDeclaration(CONST D3DVERTEXELEMENT9 *pVertexElements,
|
||||
IDirect3DVertexDeclaration9 **ppDecl);
|
||||
virtual HRESULT __stdcall SetVertexDeclaration(IDirect3DVertexDeclaration9 *pDecl);
|
||||
virtual HRESULT __stdcall GetVertexDeclaration(IDirect3DVertexDeclaration9 **ppDecl);
|
||||
virtual HRESULT __stdcall SetFVF(DWORD FVF);
|
||||
virtual HRESULT __stdcall GetFVF(DWORD *pFVF);
|
||||
virtual HRESULT __stdcall CreateVertexShader(CONST DWORD *pFunction,
|
||||
IDirect3DVertexShader9 **ppShader);
|
||||
virtual HRESULT __stdcall SetVertexShader(IDirect3DVertexShader9 *pShader);
|
||||
virtual HRESULT __stdcall GetVertexShader(IDirect3DVertexShader9 **ppShader);
|
||||
virtual HRESULT __stdcall SetVertexShaderConstantF(UINT StartRegister, CONST float *pConstantData,
|
||||
UINT Vector4fCount);
|
||||
virtual HRESULT __stdcall GetVertexShaderConstantF(UINT StartRegister, float *pConstantData,
|
||||
UINT Vector4fCount);
|
||||
virtual HRESULT __stdcall SetVertexShaderConstantI(UINT StartRegister, CONST int *pConstantData,
|
||||
UINT Vector4iCount);
|
||||
virtual HRESULT __stdcall GetVertexShaderConstantI(UINT StartRegister, int *pConstantData,
|
||||
UINT Vector4iCount);
|
||||
virtual HRESULT __stdcall SetVertexShaderConstantB(UINT StartRegister, CONST BOOL *pConstantData,
|
||||
UINT BoolCount);
|
||||
virtual HRESULT __stdcall GetVertexShaderConstantB(UINT StartRegister, BOOL *pConstantData,
|
||||
UINT BoolCount);
|
||||
virtual HRESULT __stdcall SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9 *pStreamData,
|
||||
UINT OffsetInBytes, UINT Stride);
|
||||
virtual HRESULT __stdcall GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9 **ppStreamData,
|
||||
UINT *pOffsetInBytes, UINT *pStride);
|
||||
virtual HRESULT __stdcall SetStreamSourceFreq(UINT StreamNumber, UINT Setting);
|
||||
virtual HRESULT __stdcall GetStreamSourceFreq(UINT StreamNumber, UINT *pSetting);
|
||||
virtual HRESULT __stdcall SetIndices(IDirect3DIndexBuffer9 *pIndexData);
|
||||
virtual HRESULT __stdcall GetIndices(IDirect3DIndexBuffer9 **ppIndexData);
|
||||
virtual HRESULT __stdcall CreatePixelShader(CONST DWORD *pFunction,
|
||||
IDirect3DPixelShader9 **ppShader);
|
||||
virtual HRESULT __stdcall SetPixelShader(IDirect3DPixelShader9 *pShader);
|
||||
virtual HRESULT __stdcall GetPixelShader(IDirect3DPixelShader9 **ppShader);
|
||||
virtual HRESULT __stdcall SetPixelShaderConstantF(UINT StartRegister, CONST float *pConstantData,
|
||||
UINT Vector4fCount);
|
||||
virtual HRESULT __stdcall GetPixelShaderConstantF(UINT StartRegister, float *pConstantData,
|
||||
UINT Vector4fCount);
|
||||
virtual HRESULT __stdcall SetPixelShaderConstantI(UINT StartRegister, CONST int *pConstantData,
|
||||
UINT Vector4iCount);
|
||||
virtual HRESULT __stdcall GetPixelShaderConstantI(UINT StartRegister, int *pConstantData,
|
||||
UINT Vector4iCount);
|
||||
virtual HRESULT __stdcall SetPixelShaderConstantB(UINT StartRegister, CONST BOOL *pConstantData,
|
||||
UINT BoolCount);
|
||||
virtual HRESULT __stdcall GetPixelShaderConstantB(UINT StartRegister, BOOL *pConstantData,
|
||||
UINT BoolCount);
|
||||
virtual HRESULT __stdcall DrawRectPatch(UINT Handle, CONST float *pNumSegs,
|
||||
CONST D3DRECTPATCH_INFO *pRectPatchInfo);
|
||||
virtual HRESULT __stdcall DrawTriPatch(UINT Handle, CONST float *pNumSegs,
|
||||
CONST D3DTRIPATCH_INFO *pTriPatchInfo);
|
||||
virtual HRESULT __stdcall DeletePatch(UINT Handle);
|
||||
virtual HRESULT __stdcall CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9 **ppQuery);
|
||||
|
||||
private:
|
||||
void CheckForDeath();
|
||||
|
||||
IDirect3DDevice9 *m_device;
|
||||
D3D9DebugManager *m_DebugManager;
|
||||
|
||||
HWND m_Wnd;
|
||||
|
||||
unsigned int m_InternalRefcount;
|
||||
RefCounter9 m_RefCounter;
|
||||
RefCounter9 m_SoftRefCounter;
|
||||
bool m_Alive;
|
||||
|
||||
uint32_t m_FrameCounter = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// WrappedD3D9
|
||||
|
||||
class WrappedD3D9 : public IDirect3D9
|
||||
{
|
||||
public:
|
||||
WrappedD3D9(IDirect3D9 *direct3D9) : m_direct3D(direct3D9) {}
|
||||
/*** IUnknown methods ***/
|
||||
virtual HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObj);
|
||||
virtual ULONG __stdcall AddRef();
|
||||
virtual ULONG __stdcall Release();
|
||||
|
||||
/*** IDirect3D9 methods ***/
|
||||
virtual HRESULT __stdcall RegisterSoftwareDevice(void *pInitializeFunction);
|
||||
virtual UINT __stdcall GetAdapterCount();
|
||||
virtual HRESULT __stdcall GetAdapterIdentifier(UINT Adapter, DWORD Flags,
|
||||
D3DADAPTER_IDENTIFIER9 *pIdentifier);
|
||||
virtual UINT __stdcall GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
|
||||
virtual HRESULT __stdcall EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode,
|
||||
D3DDISPLAYMODE *pMode);
|
||||
virtual HRESULT __stdcall GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE *pMode);
|
||||
virtual HRESULT __stdcall CheckDeviceType(UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat,
|
||||
D3DFORMAT BackBufferFormat, BOOL bWindowed);
|
||||
virtual HRESULT __stdcall CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT AdapterFormat, DWORD Usage,
|
||||
D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
|
||||
virtual HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT SurfaceFormat, BOOL Windowed,
|
||||
D3DMULTISAMPLE_TYPE MultiSampleType,
|
||||
DWORD *pQualityLevels);
|
||||
virtual HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT AdapterFormat,
|
||||
D3DFORMAT RenderTargetFormat,
|
||||
D3DFORMAT DepthStencilFormat);
|
||||
virtual HRESULT __stdcall CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT SourceFormat,
|
||||
D3DFORMAT TargetFormat);
|
||||
virtual HRESULT __stdcall GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps);
|
||||
virtual HMONITOR __stdcall GetAdapterMonitor(UINT Adapter);
|
||||
virtual HRESULT __stdcall CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||
DWORD BehaviorFlags,
|
||||
D3DPRESENT_PARAMETERS *pPresentationParameters,
|
||||
IDirect3DDevice9 **ppReturnedDeviceInterface);
|
||||
|
||||
private:
|
||||
IDirect3D9 *m_direct3D;
|
||||
};
|
||||
@@ -1,40 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d9_common.h"
|
||||
|
||||
// disabled until capture is actually supported, so we can actually tell programmatically that the
|
||||
// API is unsupported. E.g. when we detect the API and let the user know, but disable a capture
|
||||
// button.
|
||||
#if 0
|
||||
|
||||
ResultDetails D3D9_CreateReplayDevice(RDCFile *rdc, IReplayDriver **driver)
|
||||
{
|
||||
RDCERR("D3D9 captures are not currently supported");
|
||||
return ResultCode::APIUnsupported;
|
||||
}
|
||||
|
||||
static DriverRegistration D3D9DriverRegistration(RDCDriver::D3D9, &D3D9_CreateReplayDevice);
|
||||
|
||||
#endif
|
||||
@@ -1,25 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "precompiled.h"
|
||||
@@ -1,32 +0,0 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019-2023 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "api/app/renderdoc_app.h"
|
||||
#include "api/replay/renderdoc_replay.h"
|
||||
#include "common/common.h"
|
||||
#include "os/os_specific.h"
|
||||
|
||||
#include "d3d9_common.h"
|
||||
@@ -1,127 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Development|Win32">
|
||||
<Configuration>Development</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Development|x64">
|
||||
<Configuration>Development</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{44044776-9469-4079-B587-ABFFF6574AA4}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>renderdoc_d3d9</RootNamespace>
|
||||
<ProjectName>d3d9</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)\util\WindowsSDKTarget.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
|
||||
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
<ExcludePath>$(ExcludePath)</ExcludePath>
|
||||
<TargetName>driver_$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)renderdoc\;$(SolutionDir)renderdoc\3rdparty\</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>RENDERDOC_EXPORTS;RENDERDOC_PLATFORM_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DisableSpecificWarnings>4100</DisableSpecificWarnings>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
|
||||
<ForcedIncludeFiles>precompiled.h</ForcedIncludeFiles>
|
||||
<AdditionalOptions>/w44062 /w44840 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Development'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="d3d9_common.cpp" />
|
||||
<ClCompile Include="d3d9_debug.cpp" />
|
||||
<ClCompile Include="d3d9_device.cpp" />
|
||||
<ClCompile Include="d3d9_hooks.cpp" />
|
||||
<ClCompile Include="d3d9_replay.cpp" />
|
||||
<ClCompile Include="precompiled.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\dx\official\d3d9.h" />
|
||||
<ClInclude Include="..\dx\official\d3d9caps.h" />
|
||||
<ClInclude Include="..\dx\official\d3d9types.h" />
|
||||
<ClInclude Include="..\dx\official\d3dcommon.h" />
|
||||
<ClInclude Include="..\dx\official\d3dcompiler.h" />
|
||||
<ClInclude Include="d3d9_common.h" />
|
||||
<ClInclude Include="d3d9_debug.h" />
|
||||
<ClInclude Include="d3d9_device.h" />
|
||||
<ClInclude Include="precompiled.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,72 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Hooks">
|
||||
<UniqueIdentifier>{e8ea7d90-c407-4874-976a-8ddd36598382}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="official">
|
||||
<UniqueIdentifier>{069c5202-e850-427b-9353-250795a60436}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Debug">
|
||||
<UniqueIdentifier>{c6b1027e-abd1-4f79-828a-ad40bd685453}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Common">
|
||||
<UniqueIdentifier>{503975e6-f4c0-4efc-8ff1-77e4082c5998}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Replay">
|
||||
<UniqueIdentifier>{03d937fd-e33a-4b97-aa7e-5f2990163c9b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="PCH">
|
||||
<UniqueIdentifier>{3442a8df-5f4a-49c7-bbf4-854c57362fd3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="d3d9_hooks.cpp">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d9_debug.cpp">
|
||||
<Filter>Debug</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d9_device.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d9_common.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3d9_replay.cpp">
|
||||
<Filter>Replay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="precompiled.cpp">
|
||||
<Filter>PCH</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\dx\official\d3d9.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dx\official\d3dcommon.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dx\official\d3dcompiler.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dx\official\d3d9caps.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\dx\official\d3d9types.h">
|
||||
<Filter>official</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3d9_debug.h">
|
||||
<Filter>Debug</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3d9_device.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3d9_common.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="precompiled.h">
|
||||
<Filter>PCH</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -861,12 +861,6 @@ namespace DXCEnumerateAndCheck {
|
||||
<ProjectReference Include="driver\d3d12\renderdoc_d3d12.vcxproj">
|
||||
<Project>{9e6b10a2-84b4-434d-abdb-43be4ea650f4}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="driver\d3d8\renderdoc_d3d8.vcxproj">
|
||||
<Project>{9c4487e8-eeb0-4a7f-bd81-23f81cd24e22}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="driver\d3d9\renderdoc_d3d9.vcxproj">
|
||||
<Project>{44044776-9469-4079-b587-abfff6574aa4}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="driver\dxgi\renderdoc_dxgi.vcxproj">
|
||||
<Project>{2a793574-bd3c-46d4-9788-c339d9550ce1}</Project>
|
||||
</ProjectReference>
|
||||
|
||||
Reference in New Issue
Block a user