yum-mirror/slang

Making it easier to work with shaders

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

Ellie Hermaszewskaformatf65d756bf

master
1.6 KiB64 linesraw
1// vk-pipeline-state.h
2#pragma once
3
4#include "vk-base.h"
5
6namespace gfx
7{
8
9using namespace Slang;
10
11namespace vk
12{
13
14class PipelineStateImpl : public PipelineStateBase
15{
16public:
17    PipelineStateImpl(DeviceImpl* device);
18    ~PipelineStateImpl();
19
20    // Turns `m_device` into a strong reference.
21    // This method should be called before returning the pipeline state object to
22    // external users (i.e. via an `IPipelineState` pointer).
23    void establishStrongDeviceReference();
24
25    virtual void comFree() override;
26
27    void init(const GraphicsPipelineStateDesc& inDesc);
28    void init(const ComputePipelineStateDesc& inDesc);
29    void init(const RayTracingPipelineStateDesc& inDesc);
30
31    Result createVKGraphicsPipelineState();
32
33    Result createVKComputePipelineState();
34
35    virtual Result ensureAPIPipelineStateCreated() override;
36
37    virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
38
39    BreakableReference<DeviceImpl> m_device;
40
41    VkPipeline m_pipeline = VK_NULL_HANDLE;
42};
43
44class RayTracingPipelineStateImpl : public PipelineStateImpl
45{
46public:
47    Dictionary<String, Index> shaderGroupNameToIndex;
48    Int shaderGroupCount;
49
50    RayTracingPipelineStateImpl(DeviceImpl* device);
51
52    uint32_t findEntryPointIndexByName(
53        const Dictionary<String, Index>& entryPointNameToIndex,
54        const char* name);
55
56    Result createVKRayTracingPipelineState();
57
58    virtual Result ensureAPIPipelineStateCreated() override;
59
60    virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override;
61};
62
63} // namespace vk
64} // namespace gfx