summaryrefslogtreecommitdiffstats
path: root/tools/gfx/debug-layer/debug-command-encoder.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-16 17:11:54 -0700
committerGitHub <noreply@github.com>2022-08-16 17:11:54 -0700
commit42f49937ffa69c82e333e886952eed027e12340e (patch)
tree08e3e9821dd40e23476060215d589e29092adb53 /tools/gfx/debug-layer/debug-command-encoder.h
parente68fab2bda5d979f8d991fc41122bb9aa71849a6 (diff)
Add gfx interface definition in Slang. (#2364)
* Add gfx interface definition in Slang. - add gfx interface definitons in Slang. - fix slang compiler to correctly type-check `out` interface argument. - modify gfx interface to be fully COM compatible - add convenient ShaderProgram creation methods to gfx. * Fix compile errors and warnings. * Update project files * Fix cuda. * Properly implement queryInterface in command encoder impls. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/debug-layer/debug-command-encoder.h')
-rw-r--r--tools/gfx/debug-layer/debug-command-encoder.h48
1 files changed, 44 insertions, 4 deletions
diff --git a/tools/gfx/debug-layer/debug-command-encoder.h b/tools/gfx/debug-layer/debug-command-encoder.h
index 8a0ffbfdb..b53a11074 100644
--- a/tools/gfx/debug-layer/debug-command-encoder.h
+++ b/tools/gfx/debug-layer/debug-command-encoder.h
@@ -15,7 +15,18 @@ public:
virtual DebugCommandBuffer* getCommandBuffer() = 0;
virtual bool getIsOpen() = 0;
virtual IResourceCommandEncoder* getBaseResourceEncoder() = 0;
-
+ virtual void* getInterface(SlangUUID const& uuid) = 0;
+ SlangResult queryInterface(SlangUUID const& uuid, void** outObject)
+ {
+ if (auto ptr = getInterface(uuid))
+ {
+ *outObject = ptr;
+ return SLANG_OK;
+ }
+ return SLANG_E_NO_INTERFACE;
+ }
+ uint32_t addRef() { return 1; }
+ uint32_t release() { return 1; }
public:
virtual SLANG_NO_THROW void SLANG_MCALL copyBuffer(
IBufferResource* dst,
@@ -97,6 +108,14 @@ public:
virtual DebugCommandBuffer* getCommandBuffer() override { return commandBuffer; }
virtual bool getIsOpen() override { return isOpen; }
virtual IResourceCommandEncoder* getBaseResourceEncoder() override { return baseObject; }
+ virtual void* getInterface(SlangUUID const& uuid) override
+ {
+ if (uuid == GfxGUID::IID_IResourceCommandEncoder || uuid == GfxGUID::IID_IComputeCommandEncoder || uuid == ISlangUnknown::getTypeGuid())
+ {
+ return this;
+ }
+ return nullptr;
+ }
public:
virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override;
@@ -122,7 +141,14 @@ public:
virtual DebugCommandBuffer* getCommandBuffer() override { return commandBuffer; }
virtual bool getIsOpen() override { return isOpen; }
virtual IResourceCommandEncoder* getBaseResourceEncoder() override { return baseObject; }
-
+ virtual void* getInterface(SlangUUID const& uuid) override
+ {
+ if (uuid == GfxGUID::IID_IResourceCommandEncoder || uuid == ISlangUnknown::getTypeGuid())
+ {
+ return this;
+ }
+ return nullptr;
+ }
public:
virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override;
@@ -144,7 +170,14 @@ public:
}
virtual bool getIsOpen() override { return isOpen; }
virtual IResourceCommandEncoder* getBaseResourceEncoder() override { return baseObject; }
-
+ virtual void* getInterface(SlangUUID const& uuid) override
+ {
+ if (uuid == GfxGUID::IID_IResourceCommandEncoder || uuid == GfxGUID::IID_IRenderCommandEncoder || uuid == ISlangUnknown::getTypeGuid())
+ {
+ return this;
+ }
+ return nullptr;
+ }
public:
virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override;
virtual SLANG_NO_THROW Result SLANG_MCALL
@@ -212,7 +245,14 @@ public:
virtual DebugCommandBuffer* getCommandBuffer() override { return commandBuffer; }
virtual bool getIsOpen() override { return isOpen; }
virtual IResourceCommandEncoder* getBaseResourceEncoder() override { return baseObject; }
-
+ virtual void* getInterface(SlangUUID const& uuid) override
+ {
+ if (uuid == GfxGUID::IID_IResourceCommandEncoder || uuid == GfxGUID::IID_IRayTracingCommandEncoder || uuid == ISlangUnknown::getTypeGuid())
+ {
+ return this;
+ }
+ return nullptr;
+ }
public:
virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override;
virtual SLANG_NO_THROW void SLANG_MCALL buildAccelerationStructure(