diff options
| author | Yong He <yonghe@outlook.com> | 2021-04-08 21:10:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-08 21:10:30 -0700 |
| commit | 8a71039475212fb1e1a6dd2fd2911d02769637ef (patch) | |
| tree | 0faa6e773d6b40c3dcbf0eed08217c629f8ebccf /tools/gfx/d3d | |
| parent | d27557d9b770810402a0bf99bcd891c145a1a69d (diff) | |
Improve robustness of gfx lifetime management. (#1788)
* Improve robustness of gfx lifetime management.
* fix clang error
* fix clang error
* Fix clang warning
Diffstat (limited to 'tools/gfx/d3d')
| -rw-r--r-- | tools/gfx/d3d/d3d-swapchain.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/gfx/d3d/d3d-swapchain.h b/tools/gfx/d3d/d3d-swapchain.h index 5a9ead876..11914cca8 100644 --- a/tools/gfx/d3d/d3d-swapchain.h +++ b/tools/gfx/d3d/d3d-swapchain.h @@ -10,10 +10,10 @@ namespace gfx { class D3DSwapchainBase : public ISwapchain - , public Slang::RefObject + , public Slang::ComObject { public: - SLANG_REF_OBJECT_IUNKNOWN_ALL + SLANG_COM_OBJECT_IUNKNOWN_ALL ISwapchain* getInterface(const Slang::Guid& guid) { if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_ISwapchain) @@ -82,8 +82,7 @@ public: virtual SLANG_NO_THROW Result SLANG_MCALL getImage(uint32_t index, ITextureResource** outResource) override { - m_images[index]->addRef(); - *outResource = m_images[index].get(); + returnComPtr(outResource, m_images[index]); return SLANG_OK; } virtual SLANG_NO_THROW Result SLANG_MCALL present() override @@ -148,7 +147,7 @@ public: ISwapchain::Desc m_desc; HANDLE m_swapChainWaitableObject = nullptr; ComPtr<IDXGISwapChain2> m_swapChain; - Slang::ShortList<ComPtr<ITextureResource>> m_images; + Slang::ShortList<Slang::RefPtr<TextureResource>> m_images; }; } |
