VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGlProgram.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2023 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 #pragma once
10 
12 
13 #include <vrvMath/DtCommonTypes.h>
14 
15 #include <vector>
16 #include <unordered_map>
17 
18 namespace makVrv
19 {
20  class DtGlShader;
21  class DtGlTexture;
22  class DtGlBuffer;
23 
27  {
28  public:
30  DtGlUbo();
31 
33  DtGlUbo(const std::string& name, int size, int binding);
34 
36  virtual ~DtGlUbo();
37 
39  DtGlUbo(const DtGlUbo& rhs);
40 
42  DtGlUbo& operator=(const DtGlUbo& rhs);
43 
45  virtual bool valid(void) const;
46 
48  const std::string& name(void) const;
49 
51  int size(void) const;
52 
54  int bindingPoint(void) const;
55 
56  protected:
57  std::string myName;
58  int mySize;
59  int myBinding;
60  };
61 
63  typedef std::vector<DtGlShader*> DtShaderVector;
64 
67  {
68  public:
70  DtGlProgram(const std::string& name, const DtShaderVector& shaders, bool multiview = false);
71 
74  DtGlProgram(const std::string& name, unsigned int programId);
75 
77  DtGlProgram(const std::string& name, const std::string& programBinary, bool multiview);
78 
80  virtual ~DtGlProgram();
81  private:
83  DtGlProgram() = delete;
84 
86  DtGlProgram(const DtGlProgram&) = delete;
87 
89  DtGlProgram& operator=(const DtGlProgram&) = delete;
90  public:
91 
93  virtual void bind();
94 
96  virtual void unbind();
97 
99  virtual bool isValid() const;
100 
102  virtual unsigned int id() const;
103 
105  virtual int uboSize(const std::string& name) const;
106 
108  virtual int uboBinding(const std::string& name) const;
109 
111  virtual int ssboBinding(const std::string& name) const;
112 
114  virtual int bufferBinding(const std::string& name, bool ubo) const;
115 
117  virtual int uniformOffset(const std::string& uniformName) const;
118 
120  virtual int uniformLocation(const std::string& uniformName) const;
121 
123  virtual const DtGlUbo* ubo(const std::string& uboName) const;
124 
126  virtual bool saveProgramBinary(const std::string& fileNameFullPath) const;
127 
129  virtual unsigned int releaseHandle(void);
130  public:
131 
136  virtual void runComputeShader(unsigned int workSizeX, unsigned int workSizeY, bool bind);
137 
143  virtual void runComputeShader(unsigned int workSizeX, unsigned int workSizeY, unsigned int workSizeZ, bool bind);
144 
149  virtual void runComputeShader(const DtGlTexture* renderTexture, bool bind);
150 
151  public:
153  static void printGLSLInfoLog(unsigned int shader);
154 
155  protected:
157  virtual void introspect(void) const;
158 
160  virtual bool createProgram(const std::string& name, const VectorUnsignedInts& shaders);
161 
162  protected:
163  unsigned myProgramID;
164  bool myIsValid;
165 
166  mutable bool myMutableIntrospected;
167 
168  mutable std::unordered_map<std::string, DtGlUbo*> myMutableUbos;
169 
170  const bool myOwns;
171 
172  const bool myIsMultiview;
173  };
174 }
Dll export defines.
std::unordered_map< std::string, DtGlUbo * > myMutableUbos
Definition: DtGlProgram.h:168
std::string myName
Definition: DtGlProgram.h:57
int myBinding
Definition: DtGlProgram.h:59
class to hold information about an UBO within a program
Definition: DtGlProgram.h:26
const bool myIsMultiview
Definition: DtGlProgram.h:172
voidpf void uLong size
Definition: ioapi.h:39
bool myMutableIntrospected
Definition: DtGlProgram.h:166
A convenience class to represent an OpenGL Shader Program.
Definition: DtGlProgram.h:66
std::vector< DtGlShader * > DtShaderVector
a list of shaders
Definition: DtGlProgram.h:63
const bool myOwns
Definition: DtGlProgram.h:170
unsigned myProgramID
Definition: DtGlProgram.h:163
#define DT_DLL_VRVGRAPHICSUTILS
Definition: vrvGraphicsUtils.h:18
std::vector< unsigned int > VectorUnsignedInts
Definition: DtCommonTypes.h:19
A helper classes for creating a RTT target, optionally including depth buffer.
Definition: DtGlTexture.h:20
bool myIsValid
Definition: DtGlProgram.h:164
int mySize
Definition: DtGlProgram.h:58

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)