summaryrefslogtreecommitdiff
path: root/tools/render-test/shader-renderer-util.h
blob: bf05699883930f5e03071cbcd54e7b1c25115095 (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
42
43
44
// shader-renderer-util.h
#pragma once

#include "shader-input-layout.h"

#include <slang-rhi.h>

namespace renderer_test
{

using namespace Slang;

ComPtr<ISampler> _createSampler(IDevice* device, const InputSamplerDesc& srcDesc);

/// Utility class containing functions that construct items on the renderer using the
/// ShaderInputLayout representation
struct ShaderRendererUtil
{
    /// Generate a texture using the InputTextureDesc and construct a Texture using the Renderer
    /// with the contents
    static Slang::Result generateTexture(
        const InputTextureDesc& inputDesc,
        ResourceState defaultState,
        IDevice* device,
        ComPtr<ITexture>& textureOut);

    /// Create texture resource using inputDesc, and texData to describe format, and contents
    static Slang::Result createTexture(
        const InputTextureDesc& inputDesc,
        const TextureData& texData,
        ResourceState defaultState,
        IDevice* device,
        ComPtr<ITexture>& textureOut);

    /// Create the BufferResource using the renderer from the contents of inputDesc
    static Slang::Result createBuffer(
        const InputBufferDesc& inputDesc,
        size_t bufferSize,
        const void* initData,
        IDevice* device,
        ComPtr<IBuffer>& bufferOut);
};

} // namespace renderer_test