MeVisLab Toolbox Reference
SoView2DShaderDiagnosis.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2015, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #pragma once
14 
15 #include <Inventor/nodes/SoSubNode.h>
16 #include <Inventor/fields/SoSFEnum.h>
17 #include <Inventor/fields/SoSFString.h>
18 #include <Inventor/fields/SoSFBool.h>
20 
22 
23 class ShaderPipeline;
24 
25 class SoView2DShaderDiagnosis: public SoNode
26 {
27  SO_NODE_HEADER(SoView2DShaderDiagnosis);
28 
29 public:
31 
33 
35  static void initClass();
36 
37  void GLRender(SoGLRenderAction *action) override;
38 
39  struct Settings
40  {
42  }
43  std::string customFragmentShader;
44  std::string customVertexShader;
45  };
46 
49  {
50  public:
52  fragmentPipeline = nullptr;
53  }
54 
55  std::string fragmentShader;
56  std::string vertexShader;
57  std::string fragmentShaderLog;
58  std::string vertexShaderLog;
59  std::string programLog;
63 
64  std::vector<ml::OpenGL::TypeInfo> activeUniforms;
65  std::vector<ml::OpenGL::TypeInfo> availableBuiltInUniforms;
66  std::vector<ml::OpenGL::TypeInfo> availableExternalUniforms;
67  std::vector<ml::OpenGL::TypeInfo> availableFragmentShaderStateMembers;
68  std::vector<ml::OpenGL::TypeInfo> availableVaryingMembers;
69  std::vector<ml::OpenGL::TypeInfo> availableIncludes;
70 
71  ShaderPipeline* fragmentPipeline;
72 
73  };
74 
75  virtual void setupDiagnosisSettings(Settings& settings);
76 
77  virtual void diagnosisResult(const ShaderDiagnosis& diagnosis);
78 
79  SoSFBool enabled;
80 
83  SoSFString userFragmentShader;
84  SoSFString userVertexShader;
85 
87 
88  SoSFString fragmentShader;
89  SoSFString vertexShader;
90  SoSFString geometryShader;
91 
92  SoSFString fragmentShaderLog;
93  SoSFString vertexShaderLog;
94  SoSFString geometryShaderLog;
95  SoSFString programLinkLog;
96 
97  SoSFString activeUniforms;
98  SoSFString availableUniforms;
100 
104 
106 
111 
112  SoSFString availableIncludes;
113 
118 
120 
121 
122 private:
123  void setNamesToField(const std::vector<ml::OpenGL::TypeInfo>& list, SoSFString& field);
124  void addVariablesToString(const std::vector<ml::OpenGL::TypeInfo>& list, const std::string& type, std::string& result);
125  void addNamesToString(const std::vector<ml::OpenGL::TypeInfo>& list, std::string& names);
126  void setStringToField(const std::string& value, SoSFString& field);
127  void addTypesToString(const std::vector<ml::OpenGL::TypeInfo>& list, std::string& names);
128  void setTypesToField(const std::vector<ml::OpenGL::TypeInfo>& list, SoSFString& field);
129  void addSizesToString(const std::vector<ml::OpenGL::TypeInfo>& list, std::string& names);
130  void setSizesToField(const std::vector<ml::OpenGL::TypeInfo>& list, SoSFString& field);
131  void setPipelineToField(ShaderPipeline* pipeline, SoSFString& field);
132 };
class that is used for returning advanced shader diagnosis
std::vector< ml::OpenGL::TypeInfo > activeUniforms
std::vector< ml::OpenGL::TypeInfo > availableIncludes
std::vector< ml::OpenGL::TypeInfo > availableFragmentShaderStateMembers
std::vector< ml::OpenGL::TypeInfo > availableBuiltInUniforms
std::vector< ml::OpenGL::TypeInfo > availableVaryingMembers
std::vector< ml::OpenGL::TypeInfo > availableExternalUniforms
virtual void setupDiagnosisSettings(Settings &settings)
SoSFString availableFragmentShaderStateMemberTypes
void GLRender(SoGLRenderAction *action) override
static void initClass()
Initialization of inventor runtime system.
~SoView2DShaderDiagnosis() override
virtual void diagnosisResult(const ShaderDiagnosis &diagnosis)