Plasma Engine  2.0
Loading...
Searching...
No Matches
Helper.h
1#pragma once
2
3#include <Foundation/Strings/String.h>
4#include <RendererCore/Declarations.h>
5
6namespace plShaderHelper
7{
8 class PL_RENDERERCORE_DLL plTextSectionizer
9 {
10 public:
11 void Clear();
12
13 void AddSection(const char* szName);
14
15 void Process(const char* szText);
16
17 plStringView GetSectionContent(plUInt32 uiSection, plUInt32& out_uiFirstLine) const;
18
19 private:
20 struct plTextSection
21 {
22 plTextSection(const char* szName)
23 : m_sName(szName)
24
25 {
26 }
27
28 void Reset()
29 {
30 m_szSectionStart = nullptr;
31 m_Content = plStringView();
32 m_uiFirstLine = 0;
33 }
34
35 plString m_sName;
36 const char* m_szSectionStart = nullptr;
37 plStringView m_Content;
38 plUInt32 m_uiFirstLine = 0;
39 };
40
41 plStringBuilder m_sText;
43 };
44
46 {
47 enum Enum
48 {
49 PLATFORMS,
50 PERMUTATIONS,
51 MATERIALPARAMETER,
52 MATERIALCONFIG,
53 RENDERSTATE,
54 SHADER,
55 VERTEXSHADER,
56 HULLSHADER,
57 DOMAINSHADER,
58 GEOMETRYSHADER,
59 PIXELSHADER,
60 COMPUTESHADER,
61 TEMPLATE_VARS
62 };
63 };
64
65 PL_RENDERERCORE_DLL void GetShaderSections(const char* szContent, plTextSectionizer& out_sections);
66
67 plUInt32 CalculateHash(const plArrayPtr<plPermutationVar>& vars);
68} // namespace plShaderHelper
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
plStringBuilder is a class that is meant for creating and modifying strings.
Definition StringBuilder.h:35
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Definition Helper.h:46