summaryrefslogtreecommitdiff
path: root/tools/gfx/metal/metal-command-queue.h
diff options
context:
space:
mode:
authorSimon Kallweit <simon.kallweit@gmail.com>2024-05-27 06:03:13 -0700
committerGitHub <noreply@github.com>2024-05-27 15:03:13 +0200
commitd9443d670ef8413971fe7c3f02368b60a7fc5904 (patch)
tree001e763846b23814b0e4960991fc457d7b580a0f /tools/gfx/metal/metal-command-queue.h
parent4f1cbf6f4d561320b8e3c73b871cc95dd13c6207 (diff)
[gfx] metal backend skeleton (#4223)
* add metal-cpp submodule * add metal-cpp cmake target * gfx metal backend skeleton * add premake support * add foundation framework * add metal-cpp include to premake * update vs project file --------- Co-authored-by: Simon Kallweit <skallweit@nvidia.com> Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
Diffstat (limited to 'tools/gfx/metal/metal-command-queue.h')
-rw-r--r--tools/gfx/metal/metal-command-queue.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/gfx/metal/metal-command-queue.h b/tools/gfx/metal/metal-command-queue.h
new file mode 100644
index 000000000..298b0a09a
--- /dev/null
+++ b/tools/gfx/metal/metal-command-queue.h
@@ -0,0 +1,54 @@
+// metal-command-queue.h
+#pragma once
+
+#include "metal-base.h"
+#include "metal-device.h"
+
+namespace gfx
+{
+
+using namespace Slang;
+
+namespace metal
+{
+
+class CommandQueueImpl
+ : public ICommandQueue
+ , public ComObject
+{
+public:
+ SLANG_COM_OBJECT_IUNKNOWN_ALL
+ ICommandQueue* getInterface(const Guid& guid);
+
+public:
+ Desc m_desc;
+ RefPtr<DeviceImpl> m_renderer;
+ MTL::CommandQueue* m_commandQueue = nullptr;
+ ~CommandQueueImpl();
+
+ void init(DeviceImpl* renderer);
+
+ virtual SLANG_NO_THROW void SLANG_MCALL waitOnHost() override;
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
+
+ virtual SLANG_NO_THROW const Desc& SLANG_MCALL getDesc() override;
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL waitForFenceValuesOnDevice(
+ GfxCount fenceCount, IFence** fences, uint64_t* waitValues) override;
+
+ void queueSubmitImpl(
+ uint32_t count,
+ ICommandBuffer* const* commandBuffers,
+ IFence* fence,
+ uint64_t valueToSignal);
+
+ virtual SLANG_NO_THROW void SLANG_MCALL executeCommandBuffers(
+ GfxCount count,
+ ICommandBuffer* const* commandBuffers,
+ IFence* fence,
+ uint64_t valueToSignal) override;
+};
+
+} // namespace metal
+} // namespace gfx