Move dx interface into graphics module.

This commit is contained in:
jmsgrogan 2023-01-11 11:02:03 +00:00
parent 672b31b603
commit 4bb87de0e6
23 changed files with 130 additions and 64 deletions

View file

@ -47,22 +47,26 @@ if(UNIX)
endif() endif()
else() else()
list(APPEND graphics_LIB_INCLUDES list(APPEND graphics_LIB_INCLUDES
directx/DirectXInterface.cpp
directx/DirectXMesh.cpp directx/DirectXMesh.cpp
directx/DirectXPainter.cpp directx/DirectXPainter.cpp
directx/DirectX2dPainter.cpp
directx/DirectXTextPainter.cpp directx/DirectXTextPainter.cpp
directx/DirectXMeshPainter.cpp directx/DirectXMeshPainter.cpp
directx/DirectXShaderProgram.cpp directx/DirectXShaderProgram.cpp
) )
list(APPEND graphics_HEADERS list(APPEND graphics_HEADERS
directx/DirectXInterface.h
directx/DirectXMesh.h directx/DirectXMesh.h
directx/DirectXPainter.h directx/DirectXPainter.h
directx/DirectX2dPainter.h
directx/DirectXTextPainter.h directx/DirectXTextPainter.h
directx/DirectXMeshPainter.h directx/DirectXMeshPainter.h
directx/DirectXShaderProgram.h directx/DirectXShaderProgram.h
) )
find_package(DirectX-Headers REQUIRED) find_package(DirectX-Headers REQUIRED)
list(APPEND platform_LIBS D3D12.lib D3DCompiler.lib Dwrite.lib D2d1.lib Microsoft::DirectX-Headers) list(APPEND platform_LIBS D3D12.lib D3DCompiler.lib DXGI.lib Dwrite.lib D2d1.lib D3D11.lib Microsoft::DirectX-Headers)
endif() endif()
add_library(${MODULE_NAME} SHARED add_library(${MODULE_NAME} SHARED

View file

@ -15,6 +15,9 @@ DrawingContext::DrawingContext(DrawingSurface* surface, FontsManager* fontsManag
mFontsManager(fontsManager) mFontsManager(fontsManager)
{ {
mPainter = PainterFactory::Create(this, mDrawingMode); mPainter = PainterFactory::Create(this, mDrawingMode);
surface->getScene()->setSupportsGeometryPrimitives(mPainter->supportsGeometryPrimitives());
surface->getScene()->setFontsManager(fontsManager);
} }
std::unique_ptr<DrawingContext> DrawingContext::Create(DrawingSurface* surface, FontsManager* fontsManager, DrawingMode requestedDrawingMode) std::unique_ptr<DrawingContext> DrawingContext::Create(DrawingSurface* surface, FontsManager* fontsManager, DrawingMode requestedDrawingMode)
@ -36,7 +39,7 @@ void DrawingContext::paint()
{ {
if (mDrawingMode == DrawingMode::GRAPH) if (mDrawingMode == DrawingMode::GRAPH)
{ {
mSurface->getScene()->update(mFontsManager); mSurface->getScene()->update();
} }
mPainter->paint(); mPainter->paint();
} }
@ -45,8 +48,3 @@ AbstractPainter* DrawingContext::getPainter() const
{ {
return mPainter.get(); return mPainter.get();
} }
bool DrawingContext::painterSupportsGeometryPrimitives() const
{
return mPainter->supportsGeometryPrimitives();
}

View file

@ -28,8 +28,6 @@ public:
AbstractPainter* getPainter() const; AbstractPainter* getPainter() const;
bool painterSupportsGeometryPrimitives() const;
private: private:
DrawingMode mDrawingMode; DrawingMode mDrawingMode;
FontsManager* mFontsManager{nullptr}; FontsManager* mFontsManager{nullptr};

View file

@ -0,0 +1,6 @@
#include "DirectX2dPainter.h"
void DirectX2dPainter::paint(ID2D1DeviceContext2* context, AbstractGeometricItem* item)
{
}

View file

@ -0,0 +1,11 @@
#pragma once
class AbstractGeometricItem;
struct ID2D1DeviceContext2;
class DirectX2dPainter
{
public:
void paint(ID2D1DeviceContext2* context, AbstractGeometricItem* item);
};

View file

@ -1,4 +1,4 @@
#include "Win32DxInterface.h" #include "DirectXInterface.h"
#include "FileLogger.h" #include "FileLogger.h"
@ -14,7 +14,7 @@
#include <dwrite.h> #include <dwrite.h>
void Win32DxInterface::getHardwareAdapter(IDXGIAdapter1** ppAdapter) void DirectXInterface::getHardwareAdapter(IDXGIAdapter1** ppAdapter)
{ {
*ppAdapter = nullptr; *ppAdapter = nullptr;
for (UINT adapterIndex = 0; ; ++adapterIndex) for (UINT adapterIndex = 0; ; ++adapterIndex)
@ -33,52 +33,52 @@ void Win32DxInterface::getHardwareAdapter(IDXGIAdapter1** ppAdapter)
} }
} }
bool Win32DxInterface::isValid() const bool DirectXInterface::isValid() const
{ {
return mIsValid; return mIsValid;
} }
ID3D12Device* Win32DxInterface::getD3dDevice() const ID3D12Device* DirectXInterface::getD3dDevice() const
{ {
return mD3dDevice.Get(); return mD3dDevice.Get();
} }
ID3D11On12Device* Win32DxInterface::get11On12Device() const ID3D11On12Device* DirectXInterface::get11On12Device() const
{ {
return mD3d11On12Device.Get(); return mD3d11On12Device.Get();
} }
IDXGIFactory7* Win32DxInterface::getDxgiFactory() const IDXGIFactory7* DirectXInterface::getDxgiFactory() const
{ {
return mDxgiFactory.Get(); return mDxgiFactory.Get();
} }
ID2D1Factory3* Win32DxInterface::getD2dFactory() const ID2D1Factory3* DirectXInterface::getD2dFactory() const
{ {
return mD2dFactory.Get(); return mD2dFactory.Get();
} }
IDWriteFactory* Win32DxInterface::getDirectWriteFactory() const IDWriteFactory* DirectXInterface::getDirectWriteFactory() const
{ {
return mDWriteFactory.Get(); return mDWriteFactory.Get();
} }
ID2D1DeviceContext2* Win32DxInterface::getD2dContext() const ID2D1DeviceContext2* DirectXInterface::getD2dContext() const
{ {
return mD2dDeviceContext.Get(); return mD2dDeviceContext.Get();
} }
ID3D12CommandQueue* Win32DxInterface::getCommandQueue() const ID3D12CommandQueue* DirectXInterface::getCommandQueue() const
{ {
return mCommandQueue.Get(); return mCommandQueue.Get();
} }
ID3D11DeviceContext* Win32DxInterface::getD3d11DeviceContext() const ID3D11DeviceContext* DirectXInterface::getD3d11DeviceContext() const
{ {
return mD3d11DeviceContext.Get(); return mD3d11DeviceContext.Get();
} }
void Win32DxInterface::initialize() void DirectXInterface::initialize()
{ {
MLOG_INFO("Initialize DirectX"); MLOG_INFO("Initialize DirectX");
createD3dFactory(); createD3dFactory();
@ -92,7 +92,12 @@ void Win32DxInterface::initialize()
mIsValid = initializeD2d(); mIsValid = initializeD2d();
} }
bool Win32DxInterface::createD3dFactory() void DirectXInterface::initializeD2dStandalone()
{
}
bool DirectXInterface::createD3dFactory()
{ {
UINT dxgiFactoryFlags = 0; UINT dxgiFactoryFlags = 0;
#if defined(DEBUG) || defined(_DEBUG) #if defined(DEBUG) || defined(_DEBUG)
@ -112,7 +117,7 @@ bool Win32DxInterface::createD3dFactory()
return true; return true;
} }
bool Win32DxInterface::createD3dDevice(IDXGIAdapter1* pAdapter) bool DirectXInterface::createD3dDevice(IDXGIAdapter1* pAdapter)
{ {
if (pAdapter) if (pAdapter)
{ {
@ -140,7 +145,7 @@ bool Win32DxInterface::createD3dDevice(IDXGIAdapter1* pAdapter)
return true; return true;
} }
bool Win32DxInterface::createCommandQueue() bool DirectXInterface::createCommandQueue()
{ {
D3D12_COMMAND_QUEUE_DESC queueDesc = {}; D3D12_COMMAND_QUEUE_DESC queueDesc = {};
queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
@ -153,7 +158,7 @@ bool Win32DxInterface::createCommandQueue()
return true; return true;
} }
bool Win32DxInterface::initializeD2d() bool DirectXInterface::initializeD2d()
{ {
if (!initializeD11on12()) if (!initializeD11on12())
{ {
@ -173,7 +178,7 @@ bool Win32DxInterface::initializeD2d()
return initializeDirectWrite(); return initializeDirectWrite();
} }
bool Win32DxInterface::initializeD11on12() bool DirectXInterface::initializeD11on12()
{ {
Microsoft::WRL::ComPtr<ID3D11Device> d3d11Device; Microsoft::WRL::ComPtr<ID3D11Device> d3d11Device;
UINT d3d11DeviceFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; UINT d3d11DeviceFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
@ -187,7 +192,7 @@ bool Win32DxInterface::initializeD11on12()
return true; return true;
} }
bool Win32DxInterface::initializeDirectWrite() bool DirectXInterface::initializeDirectWrite()
{ {
return SUCCEEDED(::DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), &mDWriteFactory)); return SUCCEEDED(::DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), &mDWriteFactory));
} }

View file

@ -4,6 +4,7 @@
#include <dwrite.h> #include <dwrite.h>
#include <d2d1_3.h> #include <d2d1_3.h>
#include <d3d11on12.h> #include <d3d11on12.h>
#include <dxgi1_6.h>
struct ID3D12Device; struct ID3D12Device;
struct IDXGIFactory7; struct IDXGIFactory7;
@ -18,7 +19,7 @@ struct ID2D1Factory3;
struct ID2D1Device2; struct ID2D1Device2;
struct ID2D1DeviceContext2; struct ID2D1DeviceContext2;
class Win32DxInterface class DirectXInterface
{ {
public: public:
IDXGIFactory7* getDxgiFactory() const; IDXGIFactory7* getDxgiFactory() const;
@ -32,6 +33,8 @@ public:
IDWriteFactory* getDirectWriteFactory() const; IDWriteFactory* getDirectWriteFactory() const;
void initialize(); void initialize();
void initializeD2dStandalone();
bool isValid() const; bool isValid() const;
private: private:

View file

@ -16,7 +16,9 @@
#include "DirectXShaderProgram.h" #include "DirectXShaderProgram.h"
#include "DirectXMeshPainter.h" #include "DirectXMeshPainter.h"
#include "DirectXTextPainter.h" #include "DirectXTextPainter.h"
#include "DirectX2dPainter.h"
#include "DirectXMesh.h" #include "DirectXMesh.h"
#include "DirectXInterface.h"
#include "File.h" #include "File.h"
@ -27,7 +29,8 @@
DirectXPainter::DirectXPainter(DrawingContext* context) DirectXPainter::DirectXPainter(DrawingContext* context)
: AbstractPainter(context), : AbstractPainter(context),
mMeshPainter(std::make_unique<DirectXMeshPainter>()), mMeshPainter(std::make_unique<DirectXMeshPainter>()),
mTextPainter(std::make_unique<DirectXTextPainter>()) mTextPainter(std::make_unique<DirectXTextPainter>()),
m2dPainter(std::make_unique<DirectX2dPainter>())
{ {
} }
@ -59,6 +62,24 @@ void DirectXPainter::updateMesh(ID3D12Device* device)
void DirectXPainter::paint() void DirectXPainter::paint()
{ {
if (!mDxInterface)
{
mDxInterface = std::make_unique<DirectXInterface>();
mDxInterface->initializeD2dStandalone();
}
auto scene = mDrawingContext->getSurface()->getScene();
for (const auto item : scene->getItems())
{
if (item->getType() == SceneItem::Type::MODEL && item->isVisible())
{
auto model = dynamic_cast<SceneModel*>(item);
if (model->getGeometry())
{
m2dPainter->paint(mDxInterface->getD2dContext(), model->getGeometry());
}
}
}
} }
void DirectXPainter::paintBackground(const D3D12_CPU_DESCRIPTOR_HANDLE& rtvHandle, ID3D12GraphicsCommandList* commandList) void DirectXPainter::paintBackground(const D3D12_CPU_DESCRIPTOR_HANDLE& rtvHandle, ID3D12GraphicsCommandList* commandList)
@ -84,3 +105,8 @@ void DirectXPainter::paintText(ID2D1DeviceContext2* d2dContext, IDWriteFactory*
} }
} }
} }
bool DirectXPainter::supportsGeometryPrimitives() const
{
return true;
}

View file

@ -12,6 +12,8 @@
class DrawingContext; class DrawingContext;
class DirectXMeshPainter; class DirectXMeshPainter;
class DirectXTextPainter; class DirectXTextPainter;
class DirectX2dPainter;
class DirectXInterface;
class DirectXPainter : public AbstractPainter class DirectXPainter : public AbstractPainter
{ {
@ -32,9 +34,14 @@ public:
void paintText(ID2D1DeviceContext2* d2dContext, IDWriteFactory* directWriteFactory); void paintText(ID2D1DeviceContext2* d2dContext, IDWriteFactory* directWriteFactory);
bool supportsGeometryPrimitives() const override;
void updateMesh(ID3D12Device* device); void updateMesh(ID3D12Device* device);
private: private:
std::unique_ptr<DirectXMeshPainter> mMeshPainter; std::unique_ptr<DirectXMeshPainter> mMeshPainter;
std::unique_ptr<DirectXTextPainter> mTextPainter; std::unique_ptr<DirectXTextPainter> mTextPainter;
std::unique_ptr<DirectX2dPainter> m2dPainter;
std::unique_ptr<DirectXInterface> mDxInterface;
}; };

View file

@ -18,10 +18,8 @@ Scene::~Scene()
} }
void Scene::update(FontsManager* fontsManager) void Scene::update()
{ {
mSceneInfo->mFontsManager = fontsManager;
mSceneItems.clear(); mSceneItems.clear();
updateNode(mRootNode.get()); updateNode(mRootNode.get());
} }
@ -71,3 +69,13 @@ void Scene::setShowMeshOutline(bool shouldShow)
{ {
mSceneInfo->mShowMeshOutline = shouldShow; mSceneInfo->mShowMeshOutline = shouldShow;
} }
void Scene::setSupportsGeometryPrimitives(bool supports)
{
mSceneInfo->mSupportsGeometryPrimitives = true;
}
void Scene::setFontsManager(FontsManager* fontsManager)
{
mSceneInfo->mFontsManager = fontsManager;
}

View file

@ -27,7 +27,11 @@ public:
void setShowMeshOutline(bool shouldShow); void setShowMeshOutline(bool shouldShow);
void update(FontsManager* fontsManager = nullptr); void setFontsManager(FontsManager* fontsManager);
void setSupportsGeometryPrimitives(bool supports);
void update();
private: private:
void updateNode(AbstractVisualNode* node); void updateNode(AbstractVisualNode* node);

View file

@ -58,8 +58,6 @@ else()
ui_interfaces/win32/Win32WindowInterface.cpp ui_interfaces/win32/Win32WindowInterface.cpp
ui_interfaces/win32/Win32Window.h ui_interfaces/win32/Win32Window.h
ui_interfaces/win32/Win32Window.cpp ui_interfaces/win32/Win32Window.cpp
ui_interfaces/win32/directx/Win32DxInterface.h
ui_interfaces/win32/directx/Win32DxInterface.cpp
ui_interfaces/win32/directx/Win32DxWindowInterface.h ui_interfaces/win32/directx/Win32DxWindowInterface.h
ui_interfaces/win32/directx/Win32DxWindowInterface.cpp ui_interfaces/win32/directx/Win32DxWindowInterface.cpp
ui_interfaces/win32/directx/DirectXDescriptors.h ui_interfaces/win32/directx/DirectXDescriptors.h

View file

@ -2,7 +2,7 @@
#include "Widget.h" #include "Widget.h"
#include "DesktopManager.h" #include "DesktopManager.h"
#include "Win32DxInterface.h" #include "DirectXInterface.h"
#include <d3d12.h> #include <d3d12.h>
#include <dxgi.h> #include <dxgi.h>
@ -66,6 +66,6 @@ void Win32UIInterface::addWindow(mt::Window* window)
void Win32UIInterface::initializeHardwareRendering() void Win32UIInterface::initializeHardwareRendering()
{ {
mDxInterface = std::make_unique<Win32DxInterface>(); mDxInterface = std::make_unique<DirectXInterface>();
mDxInterface->initialize(); mDxInterface->initialize();
} }

View file

@ -7,8 +7,8 @@
class DesktopManager; class DesktopManager;
class Win32DxInterface; class DirectXInterface;
using Win32DxInterfacePtr = std::unique_ptr<Win32DxInterface>; using DirectXInterfacePtr = std::unique_ptr<DirectXInterface>;
class Win32UIInterface : public AbstractUIInterface class Win32UIInterface : public AbstractUIInterface
{ {
@ -30,5 +30,5 @@ public:
private: private:
void initializeHardwareRendering() override; void initializeHardwareRendering() override;
Win32WindowInterfacePtr mWindowInterface; Win32WindowInterfacePtr mWindowInterface;
Win32DxInterfacePtr mDxInterface; DirectXInterfacePtr mDxInterface;
}; };

View file

@ -1,7 +1,7 @@
#include "Win32Window.h" #include "Win32Window.h"
#include "Win32WindowInterface.h" #include "Win32WindowInterface.h"
#include "Win32DxInterface.h" #include "DirectXInterface.h"
#include "Win32DxWindowInterface.h" #include "Win32DxWindowInterface.h"
#include "FileLogger.h" #include "FileLogger.h"
@ -15,7 +15,7 @@
LRESULT CALLBACK FreeWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK FreeWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
Win32Window::Win32Window(mt::Window* window, Win32DxInterface* dxInterface) Win32Window::Win32Window(mt::Window* window, DirectXInterface* dxInterface)
: IPlatformWindow(window) : IPlatformWindow(window)
{ {
if (dxInterface) if (dxInterface)
@ -24,7 +24,7 @@ Win32Window::Win32Window(mt::Window* window, Win32DxInterface* dxInterface)
} }
} }
std::unique_ptr<Win32Window> Win32Window::Create(mt::Window* window, Win32DxInterface* dxInterface) std::unique_ptr<Win32Window> Win32Window::Create(mt::Window* window, DirectXInterface* dxInterface)
{ {
return std::make_unique<Win32Window>(window, dxInterface); return std::make_unique<Win32Window>(window, dxInterface);
} }

View file

@ -4,17 +4,17 @@
#include <Windows.h> #include <Windows.h>
class Win32ApplicationContext; class Win32ApplicationContext;
class Win32DxInterface;
class Win32DxWindowInterface; class Win32DxWindowInterface;
class DesktopManager; class DesktopManager;
class DirectXInterface;
class Win32Window : public IPlatformWindow class Win32Window : public IPlatformWindow
{ {
public: public:
Win32Window(mt::Window* window, Win32DxInterface* dxInterface = nullptr); Win32Window(mt::Window* window, DirectXInterface* dxInterface = nullptr);
virtual ~Win32Window() = default; virtual ~Win32Window() = default;
static std::unique_ptr<Win32Window> Create(mt::Window* window, Win32DxInterface* dxInterface = nullptr); static std::unique_ptr<Win32Window> Create(mt::Window* window, DirectXInterface* dxInterface = nullptr);
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);

View file

@ -3,7 +3,7 @@
#include "Win32Window.h" #include "Win32Window.h"
#include "DesktopManager.h" #include "DesktopManager.h"
#include "DrawingContext.h" #include "DrawingContext.h"
#include "Win32DxInterface.h" #include "DirectXInterface.h"
#include "Widget.h" #include "Widget.h"
#include "FileLogger.h" #include "FileLogger.h"
@ -22,7 +22,7 @@ void Win32WindowInterface::show(mt::Window* window)
::ShowWindow(platformWindow->getHandle(), platformWindow->getCmdShow()); ::ShowWindow(platformWindow->getHandle(), platformWindow->getCmdShow());
} }
void Win32WindowInterface::add(mt::Window* window, DesktopManager* desktopManager, Win32DxInterface* dxInterface) void Win32WindowInterface::add(mt::Window* window, DesktopManager* desktopManager, DirectXInterface* dxInterface)
{ {
auto context = dynamic_cast<Win32ApplicationContext*>(desktopManager->getMainApp()->GetApplicationContext()); auto context = dynamic_cast<Win32ApplicationContext*>(desktopManager->getMainApp()->GetApplicationContext());

View file

@ -9,7 +9,7 @@
class DesktopManager; class DesktopManager;
class FontsManager; class FontsManager;
class Win32DxInterface; class DirectXInterface;
class Win32ApplicationContext : public IApplicationContext class Win32ApplicationContext : public IApplicationContext
{ {
@ -23,7 +23,7 @@ class Win32WindowInterface
public: public:
Win32WindowInterface(); Win32WindowInterface();
void add(mt::Window* window, DesktopManager* desktopManager, Win32DxInterface* dxInterface = nullptr); void add(mt::Window* window, DesktopManager* desktopManager, DirectXInterface* dxInterface = nullptr);
void show(mt::Window* window); void show(mt::Window* window);
}; };

View file

@ -5,14 +5,14 @@
#include "DirectXPainter.h" #include "DirectXPainter.h"
#include "DrawingContext.h" #include "DrawingContext.h"
#include "Win32DxInterface.h" #include "DirectXInterface.h"
#include <d3d11.h> #include <d3d11.h>
#include <d3d11on12.h> #include <d3d11on12.h>
#include <d2d1_3.h> #include <d2d1_3.h>
#include <d2d1_1.h> #include <d2d1_1.h>
DirectX2dIntegration::DirectX2dIntegration(mt::Window* window, Win32DxInterface* dxInterface, UINT frameCount) DirectX2dIntegration::DirectX2dIntegration(mt::Window* window, DirectXInterface* dxInterface, UINT frameCount)
: mDxInterface(dxInterface), : mDxInterface(dxInterface),
mWindow(window), mWindow(window),
mFrameCount(frameCount) mFrameCount(frameCount)

View file

@ -4,7 +4,7 @@
#include <stdint.h> #include <stdint.h>
#include <vector> #include <vector>
class Win32DxInterface; class DirectXInterface;
namespace mt namespace mt
{ {
class Window; class Window;
@ -16,7 +16,7 @@ struct ID2D1Bitmap1;
class DirectX2dIntegration class DirectX2dIntegration
{ {
public: public:
DirectX2dIntegration(mt::Window* window, Win32DxInterface* dxInterface, UINT frameCount); DirectX2dIntegration(mt::Window* window, DirectXInterface* dxInterface, UINT frameCount);
void clearBuffers(); void clearBuffers();
@ -30,7 +30,7 @@ private:
ID3D11Resource* const* getD11on12WrappedBackBuffer() const; ID3D11Resource* const* getD11on12WrappedBackBuffer() const;
ID2D1Bitmap1* getD2dRenderTarget() const; ID2D1Bitmap1* getD2dRenderTarget() const;
Win32DxInterface* mDxInterface{ nullptr }; DirectXInterface* mDxInterface{ nullptr };
mt::Window* mWindow{ nullptr }; mt::Window* mWindow{ nullptr };
UINT mFrameCount{ 2 }; UINT mFrameCount{ 2 };

View file

@ -1,6 +1,6 @@
#include "Win32DxWindowInterface.h" #include "Win32DxWindowInterface.h"
#include "Win32DxInterface.h" #include "DirectXInterface.h"
#include "Win32Window.h" #include "Win32Window.h"
#include "Window.h" #include "Window.h"
#include "Widget.h" #include "Widget.h"
@ -24,7 +24,7 @@
#include <dwrite.h> #include <dwrite.h>
Win32DxWindowInterface::Win32DxWindowInterface(mt::Window* window, Win32DxInterface* dxInterface) Win32DxWindowInterface::Win32DxWindowInterface(mt::Window* window, DirectXInterface* dxInterface)
: mWindow(window), : mWindow(window),
mDxInterface(dxInterface) mDxInterface(dxInterface)
{ {

View file

@ -6,7 +6,7 @@
#include <d3d12.h> #include <d3d12.h>
#include <directx/d3dx12.h> #include <directx/d3dx12.h>
class Win32DxInterface; class DirectXInterface;
class DirectXDescriptors; class DirectXDescriptors;
class DirectX2dIntegration; class DirectX2dIntegration;
class DirectXBuffers; class DirectXBuffers;
@ -26,7 +26,7 @@ struct ID3D12PipelineState;
class Win32DxWindowInterface class Win32DxWindowInterface
{ {
public: public:
Win32DxWindowInterface(mt::Window* window, Win32DxInterface* dxInterface); Win32DxWindowInterface(mt::Window* window, DirectXInterface* dxInterface);
~Win32DxWindowInterface(); ~Win32DxWindowInterface();
@ -57,7 +57,7 @@ private:
ID3D12PipelineState* getPipelineState() const; ID3D12PipelineState* getPipelineState() const;
Win32DxInterface* mDxInterface{ nullptr }; DirectXInterface* mDxInterface{ nullptr };
bool mInitialized{ false }; bool mInitialized{ false };
bool mIsValid{ false }; bool mIsValid{ false };

View file

@ -25,9 +25,7 @@ TEST_CASE(TestD2dOffScreenRendering, "graphics")
auto rect = std::make_unique<RectangleNode>(DiscretePoint(10, 10), 10.0, 20.0); auto rect = std::make_unique<RectangleNode>(DiscretePoint(10, 10), 10.0, 20.0);
auto scene = surface->getScene(); auto scene = surface->getScene();
scene->addNode(rect.get()); scene->addNode(rect.get());
scene->update();
drawing_context->paint(); drawing_context->paint();