Remove std::vector/std::string use from D3D8/9 drivers and DXGI

This commit is contained in:
baldurk
2019-12-06 13:01:01 +00:00
parent 37a255c8a4
commit dc72949d02
8 changed files with 21 additions and 23 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ bool D3D8DebugManager::InitFontRendering()
int width = FONT_TEX_WIDTH;
int height = FONT_TEX_HEIGHT;
std::string font = GetEmbeddedResource(sourcecodepro_ttf);
rdcstr font = GetEmbeddedResource(sourcecodepro_ttf);
byte *ttfdata = (byte *)font.c_str();
const int firstChar = int(' ') + 1;
+1 -2
View File
@@ -279,8 +279,7 @@ HRESULT __stdcall WrappedD3DDevice8::Present(CONST RECT *pSourceRect, CONST RECT
int flags = activeWindow ? RenderDoc::eOverlay_ActiveWindow : 0;
flags |= RenderDoc::eOverlay_CaptureDisabled;
std::string overlayText =
RenderDoc::Inst().GetOverlayText(RDCDriver::D3D8, m_FrameCounter, flags);
rdcstr overlayText = RenderDoc::Inst().GetOverlayText(RDCDriver::D3D8, m_FrameCounter, flags);
overlayText += "Captures not supported with D3D8\n";
+1 -1
View File
@@ -44,7 +44,7 @@ bool D3D9DebugManager::InitFontRendering()
int width = FONT_TEX_WIDTH;
int height = FONT_TEX_HEIGHT;
std::string font = GetEmbeddedResource(sourcecodepro_ttf);
rdcstr font = GetEmbeddedResource(sourcecodepro_ttf);
byte *ttfdata = (byte *)font.c_str();
const int firstChar = int(' ') + 1;
+1 -2
View File
@@ -247,8 +247,7 @@ HRESULT __stdcall WrappedD3DDevice9::Present(CONST RECT *pSourceRect, CONST RECT
int flags = activeWindow ? RenderDoc::eOverlay_ActiveWindow : 0;
flags |= RenderDoc::eOverlay_CaptureDisabled;
std::string overlayText =
RenderDoc::Inst().GetOverlayText(RDCDriver::D3D9, m_FrameCounter, flags);
rdcstr overlayText = RenderDoc::Inst().GetOverlayText(RDCDriver::D3D9, m_FrameCounter, flags);
overlayText += "Captures not supported with D3D9\n";
+7 -7
View File
@@ -1610,7 +1610,7 @@ void WarnUnknownGUID(const char *name, REFIID riid)
static Threading::CriticalSection lock;
// we use a vector here, because the number of *distinct* unknown GUIDs encountered is likely to
// be low (e.g. less than 10).
static std::vector<rdcpair<IID, int> > warned;
static rdcarray<rdcpair<IID, int> > warned;
{
SCOPED_LOCK(lock);
@@ -1633,7 +1633,7 @@ void WarnUnknownGUID(const char *name, REFIID riid)
}
}
static std::string GetDeviceProperty(HDEVINFO devs, PSP_DEVINFO_DATA data, const DEVPROPKEY *key)
static rdcstr GetDeviceProperty(HDEVINFO devs, PSP_DEVINFO_DATA data, const DEVPROPKEY *key)
{
DEVPROPTYPE type = {};
DWORD bufSize = 0;
@@ -1668,9 +1668,9 @@ static uint32_t HexToInt(char hex)
return 0;
}
std::string GetDriverVersion(DXGI_ADAPTER_DESC &desc)
rdcstr GetDriverVersion(DXGI_ADAPTER_DESC &desc)
{
std::string device = StringFormat::Wide2UTF8(rdcwstr(desc.Description));
rdcstr device = StringFormat::Wide2UTF8(rdcwstr(desc.Description));
// fixed GUID for graphics drivers, from
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff553426%28v=vs.85%29.aspx
@@ -1684,14 +1684,14 @@ std::string GetDriverVersion(DXGI_ADAPTER_DESC &desc)
return device;
}
std::string driverVersion = "";
rdcstr driverVersion = "";
DWORD idx = 0;
SP_DEVINFO_DATA data = {};
data.cbSize = sizeof(data);
while(SetupDiEnumDeviceInfo(devs, idx, &data))
{
std::string version = GetDeviceProperty(devs, &data, &DEVPKEY_Device_DriverVersion);
rdcstr version = GetDeviceProperty(devs, &data, &DEVPKEY_Device_DriverVersion);
if(version.empty())
{
@@ -1703,7 +1703,7 @@ std::string GetDriverVersion(DXGI_ADAPTER_DESC &desc)
if(driverVersion.empty())
driverVersion = version;
std::string pciid = GetDeviceProperty(devs, &data, &DEVPKEY_Device_MatchingDeviceId);
rdcstr pciid = GetDeviceProperty(devs, &data, &DEVPKEY_Device_MatchingDeviceId);
if(pciid.empty())
{
+1 -1
View File
@@ -72,7 +72,7 @@ void WarnUnknownGUID(const char *name, REFIID riid);
struct ReplayOptions;
std::string GetDriverVersion(DXGI_ADAPTER_DESC &desc);
rdcstr GetDriverVersion(DXGI_ADAPTER_DESC &desc);
void ChooseBestMatchingAdapter(GraphicsAPI api, IDXGIFactory *factory,
const DXGI_ADAPTER_DESC &AdapterDesc, const ReplayOptions &opts,
bool *useWarp, IDXGIAdapter **adapter);
+7 -7
View File
@@ -33,7 +33,7 @@ IDXGIResource *UnwrapDXGIResource(void *dxgiObject);
WRAPPED_POOL_INST(WrappedIDXGIDevice4);
std::vector<D3DDeviceCallback> WrappedIDXGISwapChain4::m_D3DCallbacks;
rdcarray<D3DDeviceCallback> WrappedIDXGISwapChain4::m_D3DCallbacks;
ID3DDevice *GetD3DDevice(IUnknown *pDevice)
{
@@ -1019,9 +1019,9 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice4::QueryInterface(REFIID riid, void
return RefCountDXGIObject::QueryInterface(riid, ppvObject);
}
std::vector<IDXGIResource *> UnwrapResourceSet(UINT NumResources, IDXGIResource *const *ppResources)
rdcarray<IDXGIResource *> UnwrapResourceSet(UINT NumResources, IDXGIResource *const *ppResources)
{
std::vector<IDXGIResource *> resources;
rdcarray<IDXGIResource *> resources;
resources.resize(NumResources);
for(UINT i = 0; i < NumResources; i++)
{
@@ -1041,7 +1041,7 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice4::OfferResources(UINT NumResources,
IDXGIResource *const *ppResources,
DXGI_OFFER_RESOURCE_PRIORITY Priority)
{
std::vector<IDXGIResource *> resources = UnwrapResourceSet(NumResources, ppResources);
rdcarray<IDXGIResource *> resources = UnwrapResourceSet(NumResources, ppResources);
return m_pReal2->OfferResources(NumResources, resources.data(), Priority);
}
@@ -1049,7 +1049,7 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice4::ReclaimResources(UINT NumResource
IDXGIResource *const *ppResources,
BOOL *pDiscarded)
{
std::vector<IDXGIResource *> resources = UnwrapResourceSet(NumResources, ppResources);
rdcarray<IDXGIResource *> resources = UnwrapResourceSet(NumResources, ppResources);
return m_pReal2->ReclaimResources(NumResources, resources.data(), pDiscarded);
}
@@ -1058,7 +1058,7 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice4::OfferResources1(UINT NumResources
DXGI_OFFER_RESOURCE_PRIORITY Priority,
UINT Flags)
{
std::vector<IDXGIResource *> resources = UnwrapResourceSet(NumResources, ppResources);
rdcarray<IDXGIResource *> resources = UnwrapResourceSet(NumResources, ppResources);
return m_pReal4->OfferResources1(NumResources, resources.data(), Priority, Flags);
}
@@ -1067,7 +1067,7 @@ HRESULT STDMETHODCALLTYPE WrappedIDXGIDevice4::ReclaimResources1(UINT NumResourc
DXGI_RECLAIM_RESOURCE_RESULTS *pResults)
{
std::vector<IDXGIResource *> resources = UnwrapResourceSet(NumResources, ppResources);
rdcarray<IDXGIResource *> resources = UnwrapResourceSet(NumResources, ppResources);
return m_pReal4->ReclaimResources1(NumResources, resources.data(), pResults);
}
+2 -2
View File
@@ -569,7 +569,7 @@ class WrappedIDXGISwapChain4 : public IDXGISwapChain4, public RefCountDXGIObject
IDXGISwapChain4 *m_pReal4;
ID3DDevice *m_pDevice;
static std::vector<D3DDeviceCallback> m_D3DCallbacks;
static rdcarray<D3DDeviceCallback> m_D3DCallbacks;
HWND m_Wnd;
@@ -607,7 +607,7 @@ public:
static void RegisterD3DDeviceCallback(D3DDeviceCallback callback)
{
if(std::find(m_D3DCallbacks.begin(), m_D3DCallbacks.end(), callback) == m_D3DCallbacks.end())
if(!m_D3DCallbacks.contains(callback))
m_D3DCallbacks.push_back(callback);
}