diff options
| author | Yong He <yonghe@outlook.com> | 2021-01-14 15:48:54 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-14 15:48:54 -0800 |
| commit | f834f25794cfb746079e92d58c7410b767c57208 (patch) | |
| tree | 583a86d4cb2e446c2c06f9d786996d10647baf84 /tools/gfx/renderer-shared.cpp | |
| parent | ac76997690a39605b2b8fbd63de9cbbbc2af2a73 (diff) | |
COM-ify all slang-gfx interfaces. (#1656)
* COM-ify all slang-gfx interfaces.
Diffstat (limited to 'tools/gfx/renderer-shared.cpp')
| -rw-r--r-- | tools/gfx/renderer-shared.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
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<IBufferResource*>(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<ITextureResource*>(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 |
