summaryrefslogtreecommitdiff
path: root/tools/gfx/render-graphics-common.h
blob: e41fc6ee17374f5a0128c0ef8c0288184c1cc240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include "tools/gfx/renderer-shared.h"
#include "core/slang-basic.h"
#include "tools/gfx/slang-context.h"

namespace gfx
{
class GraphicsCommonProgramLayout;

class GraphicsCommonShaderProgram : public ShaderProgramBase
{
public:
    GraphicsCommonProgramLayout* getLayout() const;
private:
    friend class GraphicsAPIRenderer;
    Slang::RefPtr<ShaderObjectLayoutBase> m_layout;
};

class GraphicsAPIRenderer : public RendererBase
{
public:
    virtual Result createShaderObjectLayout(
        slang::TypeLayoutReflection*    typeLayout,
        ShaderObjectLayoutBase**        outLayout) SLANG_OVERRIDE;
    virtual Result createShaderObject(
        ShaderObjectLayoutBase* layout,
        IShaderObject**         outObject) SLANG_OVERRIDE;
    virtual SLANG_NO_THROW Result SLANG_MCALL createRootShaderObject(
        IShaderProgram* program,
        IShaderObject** outObject) SLANG_OVERRIDE;
    virtual SLANG_NO_THROW Result SLANG_MCALL
        bindRootShaderObject(PipelineType pipelineType, IShaderObject* object) SLANG_OVERRIDE;
    void preparePipelineDesc(GraphicsPipelineStateDesc& desc);
    void preparePipelineDesc(ComputePipelineStateDesc& desc);

    Result initProgramCommon(
        GraphicsCommonShaderProgram*    program,
        IShaderProgram::Desc const&     desc);
};
}