From f834f25794cfb746079e92d58c7410b767c57208 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 14 Jan 2021 15:48:54 -0800 Subject: COM-ify all slang-gfx interfaces. (#1656) * COM-ify all slang-gfx interfaces. --- tools/gfx/renderer-shared.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/gfx/renderer-shared.cpp (limited to 'tools/gfx/renderer-shared.cpp') diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp new file mode 100644 index 000000000..94154bc42 --- /dev/null +++ b/tools/gfx/renderer-shared.cpp @@ -0,0 +1,31 @@ +#include "renderer-shared.h" +#include "render-graphics-common.h" + +namespace gfx +{ + +IResource* BufferResource::getInterface(const Slang::Guid& guid) +{ + if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IResource || + guid == GfxGUID::IID_IBufferResource) + return static_cast(this); + return nullptr; +} + +SLANG_NO_THROW IResource::Type SLANG_MCALL BufferResource::getType() { return m_type; } +SLANG_NO_THROW IBufferResource::Desc* SLANG_MCALL BufferResource::getDesc() { return &m_desc; } + + +IResource* TextureResource::getInterface(const Slang::Guid& guid) +{ + if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IResource || + guid == GfxGUID::IID_ITextureResource) + return static_cast(this); + return nullptr; +} + +SLANG_NO_THROW IResource::Type SLANG_MCALL TextureResource::getType() { return m_type; } +SLANG_NO_THROW ITextureResource::Desc* SLANG_MCALL TextureResource::getDesc() { return &m_desc; } + + +} // namespace gfx -- cgit v1.2.3