yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong Hegfx/metal uniform data binding and memory leak fix. (#4644)6bcf92d28

master
1.4 KiB53 linesraw
1// metal-pipeline-state.h
2#pragma once
3
4#include "metal-base.h"
5
6namespace gfx
7{
8
9using namespace Slang;
10
11namespace metal
12{
13
14class PipelineStateImpl : public PipelineStateBase
15{
16public:
17    DeviceImpl* m_device;
18    NS::SharedPtr<MTL::RenderPipelineState> m_renderPipelineState;
19    NS::SharedPtr<MTL::DepthStencilState> m_depthStencilState;
20    NS::SharedPtr<MTL::ComputePipelineState> m_computePipelineState;
21    MTL::Size m_threadGroupSize;
22    NS::UInteger m_vertexBufferOffset;
23
24    PipelineStateImpl(DeviceImpl* device);
25    ~PipelineStateImpl();
26
27    void init(const GraphicsPipelineStateDesc& desc);
28    void init(const ComputePipelineStateDesc& desc);
29    void init(const RayTracingPipelineStateDesc& desc);
30
31    Result createMetalComputePipelineState();
32    Result createMetalRenderPipelineState();
33
34    virtual Result ensureAPIPipelineStateCreated() override;
35
36    virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
37};
38
39class RayTracingPipelineStateImpl : public PipelineStateImpl
40{
41public:
42    Dictionary<String, Index> shaderGroupNameToIndex;
43    Int shaderGroupCount;
44
45    RayTracingPipelineStateImpl(DeviceImpl* device);
46
47    virtual Result ensureAPIPipelineStateCreated() override;
48
49    virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
50};
51
52} // namespace metal
53} // namespace gfx