1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-11 19:24:11 +01:00

[d3d9] Allow changing API name for d3d8

This commit is contained in:
Alpyne 2023-06-19 23:54:48 +01:00 committed by Joshie
parent d6e7e3e780
commit 022bf1d134
4 changed files with 28 additions and 2 deletions

View File

@ -28,6 +28,10 @@ namespace dxvk {
return m_device->QueryInterface(riid, ppvObject); return m_device->QueryInterface(riid, ppvObject);
} }
void DxvkD3D8Bridge::SetAPIName(const char* name) {
m_device->m_implicitSwapchain->SetApiName(name);
}
HRESULT DxvkD3D8Bridge::UpdateTextureFromBuffer( HRESULT DxvkD3D8Bridge::UpdateTextureFromBuffer(
IDirect3DSurface9* pDestSurface, IDirect3DSurface9* pDestSurface,
IDirect3DSurface9* pSrcSurface, IDirect3DSurface9* pSrcSurface,

View File

@ -23,6 +23,13 @@ IDxvkD3D8Bridge : public IUnknown {
using IDirect3DSurface9 = d3d9::IDirect3DSurface9; using IDirect3DSurface9 = d3d9::IDirect3DSurface9;
#endif #endif
/**
* \brief Changes the API name displayed on the HUD
*
* \param [in] name The new API name
*/
virtual void SetAPIName(const char* name) = 0;
/** /**
* \brief Updates a D3D9 surface from a D3D9 buffer * \brief Updates a D3D9 surface from a D3D9 buffer
* *
@ -45,6 +52,7 @@ MIDL_INTERFACE("D3D9D3D8-A407-773E-18E9-CAFEBEEF3000")
IDxvkD3D8InterfaceBridge : public IUnknown { IDxvkD3D8InterfaceBridge : public IUnknown {
/** /**
* \brief Retrieves the DXVK configuration * \brief Retrieves the DXVK configuration
*
* \returns The DXVK Config object * \returns The DXVK Config object
*/ */
virtual const dxvk::Config* GetConfig() const = 0; virtual const dxvk::Config* GetConfig() const = 0;
@ -74,6 +82,8 @@ namespace dxvk {
REFIID riid, REFIID riid,
void** ppvObject); void** ppvObject);
void SetAPIName(const char* name);
HRESULT UpdateTextureFromBuffer( HRESULT UpdateTextureFromBuffer(
IDirect3DSurface9* pDestSurface, IDirect3DSurface9* pDestSurface,
IDirect3DSurface9* pSrcSurface, IDirect3DSurface9* pSrcSurface,

View File

@ -1066,9 +1066,13 @@ namespace dxvk {
void D3D9SwapChainEx::SyncFrameLatency() { void D3D9SwapChainEx::SyncFrameLatency() {
// Wait for the sync event so that we respect the maximum frame latency // Wait for the sync event so that we respect the maximum frame latency
m_frameLatencySignal->wait(m_frameId - GetActualFrameLatency()); m_frameLatencySignal->wait(m_frameId - GetActualFrameLatency());
}
void D3D9SwapChainEx::SetApiName(const char* name) {
m_apiName = name;
CreateHud();
} }
uint32_t D3D9SwapChainEx::GetActualFrameLatency() { uint32_t D3D9SwapChainEx::GetActualFrameLatency() {
uint32_t maxFrameLatency = m_parent->GetFrameLatency(); uint32_t maxFrameLatency = m_parent->GetFrameLatency();
@ -1298,7 +1302,11 @@ namespace dxvk {
std::string D3D9SwapChainEx::GetApiName() { std::string D3D9SwapChainEx::GetApiName() {
return this->GetParent()->IsExtended() ? "D3D9Ex" : "D3D9"; if (m_apiName == nullptr) {
return this->GetParent()->IsExtended() ? "D3D9Ex" : "D3D9";
} else {
return m_apiName;
}
} }
D3D9VkExtSwapchain::D3D9VkExtSwapchain(D3D9SwapChainEx *pSwapChain) D3D9VkExtSwapchain::D3D9VkExtSwapchain(D3D9SwapChainEx *pSwapChain)

View File

@ -122,6 +122,8 @@ namespace dxvk {
void DestroyBackBuffers(); void DestroyBackBuffers();
void SetApiName(const char* name);
private: private:
enum BindingIds : uint32_t { enum BindingIds : uint32_t {
@ -167,6 +169,8 @@ namespace dxvk {
double m_displayRefreshRate = 0.0; double m_displayRefreshRate = 0.0;
const char* m_apiName = nullptr;
bool m_warnedAboutGDIFallback = false; bool m_warnedAboutGDIFallback = false;
VkColorSpaceKHR m_colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; VkColorSpaceKHR m_colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;