yum-mirror/slang

Making it easier to work with shaders

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

Gangzheng TongFix additional VVL violations (#7377)3822f9243

master
1.5 KiB50 linesraw
1// shader-renderer-util.h
2#pragma once
3
4#include "shader-input-layout.h"
5
6#include <slang-rhi.h>
7
8namespace renderer_test
9{
10
11using namespace Slang;
12
13ComPtr<ISampler> _createSampler(IDevice* device, const InputSamplerDesc& srcDesc);
14
15/// Utility class containing functions that construct items on the renderer using the
16/// ShaderInputLayout representation
17struct ShaderRendererUtil
18{
19    /// Generate a texture using the InputTextureDesc and construct a Texture using the Renderer
20    /// with the contents
21    static Slang::Result generateTexture(
22        const InputTextureDesc& inputDesc,
23        ResourceState defaultState,
24        IDevice* device,
25        ComPtr<ITexture>& textureOut);
26
27    /// Create texture resource using inputDesc, and texData to describe format, and contents
28    static Slang::Result createTexture(
29        const InputTextureDesc& inputDesc,
30        const TextureData& texData,
31        ResourceState defaultState,
32        IDevice* device,
33        ComPtr<ITexture>& textureOut);
34
35    /// Create the BufferResource using the renderer from the contents of inputDesc
36    static Slang::Result createBuffer(
37        const InputBufferDesc& inputDesc,
38        size_t bufferSize,
39        const void* initData,
40        IDevice* device,
41        ComPtr<IBuffer>& bufferOut);
42
43    /// Clear a texture with the specified content
44    static Slang::Result clearTexture(
45        ITexture* texture,
46        InputTextureContent content,
47        IDevice* device);
48};
49
50} // namespace renderer_test