HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_Shader.h
Go to the documentation of this file.
1 
2 /*
3  * PROPRIETARY INFORMATION. This software is proprietary to
4  * Side Effects Software Inc., and is not to be reproduced,
5  * transmitted, or disclosed in any way without written permission.
6  *
7  * NAME: Render Library (C++)
8  *
9  * COMMENTS:
10  * OpenGL GLSL/Cg Shader base definition. Abstracts the difference
11  * between the two.
12  *
13  */
14 #ifndef __RE_Shader__
15 #define __RE_Shader__
16 
17 #include "RE_API.h"
18 #include "RE_Texture.h"
19 #include "RE_TextureTypes.h"
20 #include "RE_Types.h"
21 #include "RE_Uniform.h"
22 
23 #include <UT/UT_Array.h>
24 #include <UT/UT_Color.h>
25 #include <UT/UT_IntrusivePtr.h>
26 #include <UT/UT_Matrix2.h>
27 #include <UT/UT_Matrix3.h>
28 #include <UT/UT_Matrix4.h>
29 #include <UT/UT_String.h>
30 #include <UT/UT_StringHolder.h>
31 #include <UT/UT_SymbolTable.h>
32 #include <UT/UT_ValArray.h>
33 #include <UT/UT_Vector2.h>
34 #include <UT/UT_Vector3.h>
35 #include <UT/UT_Vector4.h>
36 #include <UT/UT_VectorTypes.h>
37 #include <UT/UT_WorkBuffer.h>
38 #include <SYS/SYS_Math.h>
39 #include <SYS/SYS_Types.h>
40 #include <iosfwd>
41 
42 class RE_ElementArray;
43 class RE_Geometry;
44 class RE_Material;
45 class RE_OGLTexture;
46 class RE_Render;
47 class RE_ShaderStage;
48 class RE_UniformBlock;
49 class RE_UniformData;
50 class RE_VertexArray;
51 class RE_VertexMap;
52 class RE_VertexState;
53 class UT_StringArray;
54 
55 class re_VertexName;
56 
58 
60 {
61 public:
62  /// Program name is readable, shader_version may be 0 or a
63  /// valid GLSL version (110, 120, 130, 140, 150, 330, 400, 410, 420..)
64  enum { USE_GLSL_BASE_VERSION = -1,
65  USE_SHADER_GLSL_VERSION = 0 };
66 
67  RE_Shader(const char *program_name, int shader_version);
68  virtual ~RE_Shader();
69 
70  exint getUniqueID() const { return myUniqueID; }
71 
72  /// Returns the amount of main memory (NOT graphics memory!)
73  /// owned by this RE_Shader.
74  virtual int64 getMemoryUsage(bool inclusive) const;
75 
76  /// If true, register this shader so that RE_Shader::getShader() can find
77  /// this shader (default is true).
78  void setRegisterProgram(bool register_program);
79 
80  ///Call to allocate a specific shader type. If you want to allocate a shader
81  ///of a specific GLSL version, set the version to the same number as the
82  ///#version string in the shader (ie, 120 for 1.20, 330 for 3.30). Otherwise
83  ///the shader inherits the version from the first shader object attached.
84  class Factory
85  {
86  public:
87  virtual RE_Shader *newShader(
88  const char *name,
89  int shader_version,
90  RE_ShaderLanguage lang)
91  = 0;
92  virtual ~Factory() {}
93  };
94  static RE_Shader *create(const char *name,
95  int shader_version = 0,
97  RE_Shader::Factory *factory = nullptr);
98 
99  ///Create a shader and load all shader files listed in shader_files, up to
100  ///a nullptr filename. If the shader compiles and links, a non-nullptr shader will
101  ///be returned. 'compile_msg' will contain any error messages otherwise.
102  ///Shader stages must have extensions .vert, .geom and .frag.
104  const char *name,
105  const char **shader_files,
106  int shader_version = USE_SHADER_GLSL_VERSION,
107  UT_String *compile_msg = nullptr,
108  bool use_houdini_libs = true,
110  bool register_program = true,
111  const char *extra_defines = nullptr,
112  RE_Shader::Factory* factory = nullptr,
113  bool dump_src_on_error = true);
114 
115  /// A version with a single string containing whitespace-separated filenames
117  const char *name,
118  const char *shader_files,
119  int shader_version = USE_SHADER_GLSL_VERSION,
120  UT_String *compile_msg = nullptr,
121  bool use_houdini_libs = true,
123  bool register_program = true,
124  const char *extra_defines = nullptr,
125  RE_Shader::Factory* factory = nullptr,
126  bool dump_src_on_error = true);
127 
128  /// Readable name of the shader
129  const char *getName() const { return myProgramName; }
130 
131  /// Any define commands used to alter this shader
132  const char *getDefines() const { return myExtraDefines; }
133 
134  /// Raw GL id of the shader
135  int getProgram() const { return myProgramObject; }
136 
137  // Return the shader with the given program ID.
138  static RE_Shader *lookupProgram(int id);
139 
140  /// True if the shader has been successfully linked
141  bool isLinked() const { return myLinkedFlag; }
142 
143  /// Returns the version of the shader (110,120,130,140,150,330,400,410).
144  int getCodeVersion() const { return myCodeVersion; }
145 
146  /// Returns the minimum GLSL version supported (base requirement)
147  static int getBaseGLSLVersion();
148 
149  /// Returns the minimum GLSL version supported for specific language type
150  static int getBaseGLSLVersion(RE_ShaderLanguage lang);
151 
152  /// determine the version of the shader from the source (#version <num>)
153  /// return 100 if no version is specified.
154  static int determineCodeVersion(const char *shader_string);
155 
156  /// Allocate a new shader stage of the specified type, with an optional
157  /// readable name.
158  virtual RE_ShaderStage *newShader(RE_ShaderType type,
159  const char *name = 0) = 0;
160 
161  /// @{
162  /// loadShader() loads a shader from an ASCII file.
163  /// addShader() is used when the source is already available.
164  /// 'messages' returns the warnings & errors (if any) from shader
165  /// compilation.
166  /// Multiple shaders can be attached to the same shader type; it is expected
167  /// that one is the main shader, and others are functions.
168  RE_ShaderStage *loadShader(RE_Render *r,
169  RE_ShaderType stype,
170  const char *filename,
171  UT_String *messages = nullptr,
172  const char *shader_name = nullptr,
173  const char *defines = "",
174  int default_code_version=USE_GLSL_BASE_VERSION,
175  int geom_max_verts = -1,
177  bool print_source = true);
178 
179  RE_ShaderStage *addShader(RE_Render *r,
180  RE_ShaderType stype,
181  const char *shader_source,
182  const char *shader_name,
183  int codeversion,
184  UT_String *messages = nullptr,
185  bool print_source = true,
187  bool preprocess = false);
188  /// @}
189 
190  /// If true, this shader may use Houdini's builtin functions.
191  void useHoudiniLibraryFuncs();
192 
193  /// If true, this shader follows the default Houdini attribute map.
194  void useDefaultAttribMap(bool enable = true);
195 
196  /// If true, this shader defines its own attribute locations in shader code
197  /// Do not move any attributes.
198  void useExplicitAttribMap(bool enable = true);
199 
200  ///Individual Shader objects can be created separately and attached. returns
201  ///true if the shader was attached, and false if it was already attached.
202  virtual bool attachShader(RE_Render *r,
203  RE_ShaderStage *obj,
204  UT_String *messages = nullptr);
205 
206  // Detaching a shader object prevents it from being deleted when the shader
207  // is deleted. Returns true if the shader was detached, or false if the
208  // shader was not present in the program.
209  virtual bool detachShader(RE_Render *r,
210  RE_ShaderStage *obj);
211 
212  /// Returns an attached shader by the given name.
213  RE_ShaderStage *getShader(const char *shader_name,
215 
216  /// bind vertex shader input 'name' to vertex array index 'vertex_index'.
217  /// Must be called before linking, or a re-link must be done.
218  virtual bool setVertexInput(RE_Render *r,
219  const char *name,
220  int vertex_index);
221 
222  /// bind fragment shader output 'name' to color attachment 'buffer_index'.
223  /// Must be called before linking. Only needed for custom fragment output
224  /// (ie, not gl_FragData[] or gl_FragColor).
225  virtual bool setFragmentOutput(RE_Render *r,
226  const char *name,
227  int buffer_index);
228 
229  /// Links all the shaders together; called implicitly if needed by
230  /// RE_Render::setShader(). Note that linking the shader will clear
231  /// out any uniforms that have been set.
232  virtual bool linkShaders(RE_Render *r, UT_String *messages = nullptr);
233 
234  /// Bumped every time a link is performed (uniforms invalidated, etc).
235  int getLinkSerial() const { return myShaderSerial; }
236 
237  /// Ensures that the shader can run given the current GL state. This mostly
238  /// deals with texture bindings matching what is expected by the shader.
239  /// If this returns false, the shader will not run, and 'messages' can be
240  /// used to fetch the reason.
241  virtual bool validateShader(RE_Render *r, UT_String *messages = nullptr);
242 
243  /// Clears and deletes all the shader objects of a certain type (or all)
244  virtual void clearShaders(RE_Render *r,
246 
247 
248  /// Returns true if this shader program has a shader of 'type' attached.
249  /// type may be a bitmask of shader types, in which case it returns true if
250  /// any of the shader types exist.
251  bool hasShader(RE_ShaderType type) const;
252 
253  // GEOMETRY SHADERS ------------------------------------------------------
254 
255  /// @name Geometry Shaders
256  /// Geometry shaders must be initialized with a cap on how many vertices
257  /// they emit per primitive, as well as the primitives they operate on,
258  /// and the primitives they produce. A vertex and fragment shader MUST be
259  /// used with a geometry shader. A geometry shader will fail if the
260  /// primitives drawn do not match the geometry shader input.
261  /// Input primitives can be points, line variants (lines, line loop, line
262  /// strip) or triangle variants (tris, tristrips, trifans). Quads and polys
263  /// are not supported. The output must be points, linestrip or tristrip.
264  //@{
265 
266  /// Specify geometry shader parameters.
267  virtual bool setGeometryParms(RE_Render *r,
268  int max_vertices,
269  RE_PrimType input,
270  RE_PrimType output);
271 
272  /// @brief Fetch current geometry shader values.
273  /// Return the geometry shader parameters specified by setGeometryParms() or
274  /// the shader itself (via layout(in=triangles), etc).
275  void getGeometryParms(int &maxverts,
276  RE_PrimType &input_type,
277  RE_PrimType &output_type) const
278  {
279  maxverts = myGeoShaderMaxVertices;
280  input_type = myGeoShaderInputPrims;
281  output_type= myGeoShaderOutputPrims;
282  }
283  //@}
284 
285  // TRANSFORM FEEDBACK ----------------------------------------------------
286 
287  /// @name Transform Feedback
288  /// Using transform feedback, it is possible to capture vertex or geometry
289  /// shader outputs and write these values to buffers (RE_VertexArrays).
290  /// Method to add or remove shader outputs should be called before the
291  /// shader is linked, otherwise they will cause a re-link of the shader.
292  /// Note that relinking with clear out any uniform values, so these buffers
293  /// should be set up early.
294  //@{
295 
296  /// @brief Specify an RE_Geometry to collect data from Transform Feedback.
297  /// Specify a geometry object to hold all the arrays for transform feedback.
298  /// You retain ownership of the object unless 'give_ownership' is true.
299  /// If no object is attached when the shader is linked, one will be
300  /// created for you (with ownership maintained by this shader).
301  void addCaptureGeometry(RE_Geometry *object,
302  bool give_ownership = false);
303 
304  /// Return the capture geometry for transform feedback.
305  RE_Geometry *getCaptureGeometry(bool take_ownership = false);
306 
307  /// Specify a generic attribute to capture during transform feedback.
308  bool addFeedbackBuffer(const char *attrib_name);
309 
310  /// Remove a generic attribute from the capture geometry.
311  bool removeFeedbackBuffer(const char *attrib_name);
312 
313  /// Will generate a new owned capture geometry if one isn't present.
314  void setFeedbackBufferSize(int num_vertices);
315 
316  /// Remove all attributes from the capture gemetry.
317  void clearAllFeedbackBuffers();
318 
319  /// True if this shader has transform feedback varyings available.
320  bool hasTransformFeedback() const;
321 
322  /// @brief Fetch a vertex array written to by the shader.
323  /// These are only valid after the shader has been linked for
324  /// transform feedback (usually due to a draw call). Returns a vertex array
325  /// for the named feedback buffer.
326  RE_VertexArray *getFeedbackBuffer(const char *attrib_name) const;
327 
328 
329  /// @brief Check if a feedback buffer will be written by this shader
330  /// Returns true if the attribute is available to be captured. Will return
331  /// false if no buffer was setup to capture the attribute, or the shader
332  /// does not output that attribute.
333  /// This method must be called after the shader is linked.
334  bool isFeedbackBufferUsed(RE_BufferType glattrib,
335  int texlevel = 0) const;
336 
337  /// @brief Check if a feedback buffer will be written by this shader
338  /// Returns true if the attribute is available to be captured. Will return
339  /// false if no buffer was setup to capture the attribute, or the shader
340  /// does not output that attribute.
341  /// This method must be called after the shader is linked.
342  bool isFeedbackBufferUsed(const char *attrib) const;
343 
344  /// @private For RE_Render only.
345  virtual bool bindForTransformFeedback(RE_Render *r);
346 
347  /// @}
348 
349  // SHADING OPTIONS -------------------------------------------------------
350 
351  /// For multisampled framebuffers, this sets the fraction of samples that
352  /// should be shaded by a fragment shader, from 0.0 to 1.0. For example,
353  /// setting this to 0.5 would guarentee _at least_ 4 color samples for a 8x
354  /// multisample buffer. The default is 0.0 (1 color sample, N coverage)
355  /// This only has an effect on GL4 hardware. It is ignored unless
356  /// RE_EXT_SAMPLE_SHADING is supported.
357  /// @{
359  { myShadingRate = SYSclamp(rate,0.0,1.0); }
361  { return SYSmax(myShadingRate,0.0); }
362  bool isSampleShading() const { return myShadingRate >= 0.0; }
363  /// @}
364 
365  /// Disables the shading rate for this shader. The rate set by
366  /// RE_Render::setShaderSampleRate() is used instead.
367  void disableShadingRate() { myShadingRate = -1.0; }
368 
369  // UNIFORMS --------------------------------------------------------------
370 
371  /// @brief Set the value of a uniform.
372  /// Set uniform value(s) for a specific type. False will be returned if the
373  /// shader is not linked (errors?), the given name does not exist, or the
374  /// type does not match the GLSL uniform type.
375  /// @{
376  bool bindInt(RE_Render *r, const UT_StringHolder &name, int v);
377  bool bindFloat(RE_Render *r, const UT_StringHolder &name, float v);
378  bool bindDouble(RE_Render *r, const UT_StringHolder &name, double v);
379 
380  bool bindColor(RE_Render *r, const UT_StringHolder &name, const UT_Color &c);
381  bool bindColor(RE_Render *r, const UT_StringHolder &name, const UT_Color &c,
382  fpreal alpha);
383 
384  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector2F &v);
385  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector3F &v);
386  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector4F &v);
387 
388  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector2D &v);
389  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector3D &v);
390  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector4D &v);
391 
392  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector2i &v);
393  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector3i &v);
394  bool bindVector(RE_Render *r,const UT_StringHolder &name,const UT_Vector4i &v);
395 
396  bool bindVectors(RE_Render *r, const UT_StringHolder &name,
397  const UT_Vector2FArray &vals);
398  bool bindVectors(RE_Render *r, const UT_StringHolder &name,
399  const UT_Vector3FArray &vals);
400  bool bindVectors(RE_Render *r, const UT_StringHolder &name,
401  const UT_Vector4FArray &vals);
402 
403  bool bindVectors(RE_Render *r, const UT_StringHolder &name,
404  const UT_Vector2DArray &vals);
405  bool bindVectors(RE_Render *r, const UT_StringHolder &name,
406  const UT_Vector3DArray &vals);
407  bool bindVectors(RE_Render *r, const UT_StringHolder &name,
408  const UT_Vector4DArray &vals);
409 
410  bool bindMatrix(RE_Render *r,const UT_StringHolder &name,const UT_Matrix2F &m);
411  bool bindMatrix(RE_Render *r,const UT_StringHolder &name,const UT_Matrix3F &m);
412  bool bindMatrix(RE_Render *r,const UT_StringHolder &name,const UT_Matrix4F &m);
413 
414  bool bindMatrix(RE_Render *r,const UT_StringHolder &name,const UT_Matrix2D &m);
415  bool bindMatrix(RE_Render *r,const UT_StringHolder &name,const UT_Matrix3D &m);
416  bool bindMatrix(RE_Render *r,const UT_StringHolder &name,const UT_Matrix4D &m);
417  /// @}
418 
419  /// Bind a texture map using named textures in TIL_TextureMap. You can also
420  /// bind a texture with its raw OpenGL ID using bindVariableInt().
421  /// @{
422  /// Bind a new texture object using the mapname (filename, op:/coppath)
423  virtual bool bindTextureMap(RE_Render *r,
424  const UT_StringHolder &name,
425  const char *mapname,
426  const char *relative_to) = 0;
427  /// @}
428 
429  /// Return the texture type for the sampler named 'name'.
430  virtual RE_TextureDimension getTextureMapType(RE_Render *r,
431  const UT_StringHolder &name) = 0;
432 
433  /// Return the number of samplers this shader references
434  int getNumTextures() const { return myTextureUniforms.entries(); }
435 
436  /// Return the number of image samplers this shader references (GL4.2
437  /// shader load/store images, not regular texture samplers)
438  int getNumImages() const { return myImageUniforms.entries(); }
439 
440  /// @brief Return the name of a sampler uniform
441  /// Return the texture sampler name of the enumerated samplers at 'tex_index'
442  /// Must be within [0, getNumTextures()-1].
443  const char *getTextureSamplerName(int tex_index) const;
444 
445  /// Return the texture sampler type at 'tex_index' [0, getNumTextures()-1].
446  RE_TextureDimension getTextureSamplerType(int tex_index) const;
447 
448  // Return the uniform name of the sampler bounds to 'tex_unit'
449  UT_StringHolder findSamplerAtUnit(int tex_unit) const;
450 
451  /// @brief return the texture unit of sampler 'uniform_name'
452  /// Return the texture unit this sampler has been assigned to, or -1 if
453  /// 'uniform_name' does not exist, or is not a sampler. array_index is used
454  /// to identify indices of sampler arrays.
455  int getUniformTextureUnit(const UT_StringHolder &uniform_name,
456  int array_index = 0) const;
457 
458  /// Set a binding point for the given sampler
459  bool setUniformTextureUnit(RE_Render *r,
460  const UT_StringHolder &uniform_name,
461  int unit_index);
462 
463  /// @brief return the image unit of sampler 'uniform_name'
464  /// Return the image unit this image uniform has been assigned to, or -1 if
465  /// 'uniform_name' does not exist, or is not a image uniform. Images are
466  /// different than textures, used by RE_EXT_IMAGE_LOAD_STORE (GL4.2).
467  int getUniformImageUnit(const UT_StringHolder &uniform_name) const;
468 
469  /// Return the uniform type of the uniform named 'uniform_name', or
470  /// RE_UNIFORM_INVALID if it does not exist.
471  RE_UniformType getUniformType(const UT_StringHolder &uniform_name) const;
472 
473 
474  /// Returns the number of active uniforms in this shader.
475  int getNumUniforms() const { return myUniforms.entries(); }
476 
477  /// Returns the name of active uniform 'idx' [0, getNumUniforms()-1]
478  const char *getUniformName(int idx) const;
479 
480  /// Return the GL uniform location of uniform 'idx' [0, getNumUniforms()-1]
481  int getUniformLocation(int idx) const;
482 
483  /// Return the GL uniform type 'idx' [ 0, getNumUniforms()-1]
484  RE_UniformType getUniformType(int idx) const;
485 
486  /// Return the index of the uniform block a uniform is in, -1 for none.
487  int getBlockIndexForUniform(int idx) const;
488 
489 
490  /// @name Setting Uniforms
491  /// These methods set uniform values in a shader. 'name' is the name of the
492  /// uniform in the shader. 'val' is the value that uniform should take.
493  /// 'array_size' is used if the uniform is an array. 'saved_idx' is an
494  /// optimization to speed up subsequent accesses to the uniforms. Initially
495  /// it should be -1.
496  //@{
497 
498  /// Generic Integer scalar
499  virtual bool bindVariableInt(RE_Render *r,
500  const UT_StringHolder &name, const int *val,
501  int array_size=1, int *saved_idx=0)=0;
502  /// Generic Integer vector-2
503  virtual bool bindVariableInt2(RE_Render *r,
504  const UT_StringHolder &name, const int *val,
505  int array_size=1, int *saved_idx=0)=0;
506  /// Generic Integer vector-3
507  virtual bool bindVariableInt3(RE_Render *r,
508  const UT_StringHolder &name, const int *val,
509  int array_size=1, int *saved_idx=0)=0;
510  /// Generic Integer vector-4
511  virtual bool bindVariableInt4(RE_Render *r,
512  const UT_StringHolder &name, const int *val,
513  int array_size=1, int *saved_idx=0)=0;
514 
515  /// 64b Integer handle for bindless texturing
516  virtual bool bindUint64(RE_Render *r,
517  const UT_StringHolder &name, uint64 *val,
518  int array_size = 1, int *saved_idx=0) =0;
519 
520  virtual bool bindVariable1(RE_Render *r,
521  const UT_StringHolder &name, const fpreal32 *val,
522  int array_size=1, int *saved_idx=0)=0;
523  virtual bool bindVariable2(RE_Render *r,
524  const UT_StringHolder &name, const fpreal32 *val,
525  int array_size=1, int *saved_idx=0)=0;
526  virtual bool bindVariable3(RE_Render *r,
527  const UT_StringHolder &name, const fpreal32 *val,
528  int array_size=1, int *saved_idx=0)=0;
529  virtual bool bindVariable4(RE_Render *r,
530  const UT_StringHolder &name, const fpreal32 *val,
531  int array_size=1, int *saved_idx=0)=0;
532 
533  virtual bool bindVariable1(RE_Render *r,
534  const UT_StringHolder &name, const fpreal64 *val,
535  int array_size=1, int *saved_idx=0)=0;
536  virtual bool bindVariable2(RE_Render *r,
537  const UT_StringHolder &name, const fpreal64 *val,
538  int array_size=1, int *saved_idx=0)=0;
539  virtual bool bindVariable3(RE_Render *r,
540  const UT_StringHolder &name, const fpreal64 *val,
541  int array_size=1, int *saved_idx=0)=0;
542  virtual bool bindVariable4(RE_Render *r,
543  const UT_StringHolder &name, const fpreal64 *val,
544  int array_size=1, int *saved_idx=0)=0;
545 
546  virtual bool bindMatrix2(RE_Render *r,
547  const UT_StringHolder &name, const fpreal32 *val,
548  int array_size=1, int *saved_idx=0)=0;
549  virtual bool bindMatrix3(RE_Render *r,
550  const UT_StringHolder &name, const fpreal32 *val,
551  int array_size=1, int *saved_idx=0)=0;
552  virtual bool bindMatrix4(RE_Render *r,
553  const UT_StringHolder &name, const fpreal32 *val,
554  int array_size=1, int *saved_idx=0)=0;
555 
556  virtual bool bindMatrix2(RE_Render *r,
557  const UT_StringHolder &name, const fpreal64 *val,
558  int array_size=1, int *saved_idx=0)=0;
559  virtual bool bindMatrix3(RE_Render *r,
560  const UT_StringHolder &name, const fpreal64 *val,
561  int array_size=1, int *saved_idx=0)=0;
562  virtual bool bindMatrix4(RE_Render *r,
563  const UT_StringHolder &name, const fpreal64 *val,
564  int array_size=1, int *saved_idx=0)=0;
565 
566  /// Sampler buffer bound to a texture. The shader manages the texture
567  /// unit assignment, the binding of the texture to the texture unit, and
568  /// the assingment of the sampler buffer uniform.
569  virtual bool bindTexture(RE_Render *r,
570  const UT_StringHolder &name,
571  RE_Texture *tex,
572  int *saved_idx=0)=0;
573  //@}
574 
575  /// Bind a texture to an image slot for reading, writing, or both.
576  /// Requires RE_EXT_IMAGE_LOAD_STORE (or GL4.2).
577  virtual bool bindImage(RE_Render *r,
578  const UT_StringHolder &name,
579  RE_Texture *image,
580  RE_BufferAccess image_access) = 0;
581 
582  /// Bind a texture array layer, cubemap layer, or a 3D texture slice
583  /// to an image slot for reading, writing, or both.
584  /// Requires RE_EXT_IMAGE_LOAD_STORE (or GL4.2).
585  virtual bool bindImageLayer(RE_Render *r,
586  const UT_StringHolder &name,
587  RE_Texture *image,
588  RE_BufferAccess image_access,
589  int layer) = 0;
590 
591  /// assign a bindless texture to its handle uniform. 'texture' must have
592  /// a texture handle, and uniform_name must refer to a texture handle.
593  bool setTextureHandle(RE_Render *r,
594  const UT_StringHolder &uniform_name,
596  int *saved_idx = 0);
597 
598  /// Remove a bindless handle from the uniform, clearing it to 0 (no tex).
599  bool clearTextureHandle(RE_Render *r,
600  const UT_StringHolder &uniform_name,
601  int *saved_idx = 0);
602 
603  /// @brief Bind an RE_Uniform's values to the corresponding GL uniform
604  /// Bind an RE_Uniform to this shader. If 'uniform' is an array uniform
605  /// then 'index' specifies which array element to bind. 'index' must be
606  /// less than uniform->getSize(). Pass -1 for 'index' (the default) to
607  /// bind all elements of an array; passing -1 for non-arrays is safe and
608  /// is equivalent to passing 0.
609  virtual bool bindUniform(RE_Render *r,
610  const RE_Uniform *uniform, int index = -1);
611 
612  /// returns true if the named uniform exists in the shader.
613  bool hasUniform(const UT_StringHolder &uniform_name) const;
614 
615  /// @brief Queries the use of a builtin uniform
616  /// Returns true if this shader has the specified built-in uniform.
617  /// 'uniform' must be an RE_UniformBuiltIn. Note that certain
618  /// built-in uniforms may only be supported for certain languages.
619  bool hasBuiltInUniform(RE_UniformBuiltIn uniform) const;
620 
621  /// Returns a list of RE_UniformBuiltIn IDs this shader uses.
623  { return myBuiltInUniforms; }
624 
625  /// @brief Bind all builtin uniforms.
626  /// Bind all builtin uniforms this shader uses to their current values in
627  /// RE_Render
628  void bindBuiltIns(RE_Render *r,
629  bool force_update = false);
630 
631  /// Called to invalidate the cached uniform, usually by
632  /// RE_Uniform::unregisterBuiltIn().
633  void invalidateUniform(RE_UniformBuiltIn uniform);
634 
635  /// Prints all the active uniforms plus their values to stream os (or cerr)
636  virtual void printUniforms(RE_Render *r,
637  std::ostream *os = nullptr) const {}
638 
639  // UNIFORM BLOCKS -------------------------------------------------------
640 
641  // RE_EXT_UNIFORM_BUFFER must be supported, or these will always return 0
642  // NOTE: these methods are specifically for swapping blocks in and out for
643  // optimization purposes.
644  // You do not need to use these directly to bind values to uniform
645  // blocks - the bind...() methods will do that automatically.
646  // See RE_UniformBuffer.h for more information.
647 
648  /// Returns the OpenGL maximum number of supported blocks.
649  virtual int getMaxUniformBlocks(RE_Render *) { return 0; }
650 
651  /// Returns the OpenGL maximum size of a uniform block, in bytes.
652  virtual int getMaxUniformBlockSizeB(RE_Render *) { return 0; }
653 
654 
655  /// Returns the number of blocks and specific uniform blocks.
656  virtual int getNumUniformBlocks() const { return 0; }
657 
658  /// Return an attached uniform block by index
659  virtual RE_UniformBlockHandle getUniformBlock(int ) const { return nullptr; }
660 
661  /// Return an attached uniform block by name
662  virtual RE_UniformBlockHandle getUniformBlock(const char *name) const
663  { return nullptr; }
664 
665  /// Returns the block binding point of the named block.
666  virtual int getUniformBlockIndex(const char *name) const
667  { return -1; }
668 
669  /// @brief Attach an RE_UniformBlock to this shader
670  /// Attach a single uniform block to the shader. The shader owns the block
671  /// while attached, and will delete it if the shader is deleted, or may
672  /// delete it if linkShaders() is called and it is no longer in use.
673  /// If you want to cache a block, detach it when you're done with the shader.
674  /// If a block with the same name is already attached to this shader, it will
675  /// be deleted.
676  virtual bool attachUniformBlock(RE_UniformBlock *) { return false; }
677 
678  /// @brief Detach a named RE_UniformBlock from this shader
679  /// Detach a single uniform block by name or pointer. The shader will no
680  /// longer keep a reference to it, and will not delete it when relinking or
681  /// when the shader is deleted.
682  /// Note that a shader must have all blocks attached when executed. Detaching
683  /// a uniform block does not remove the GL binding to the block, it merely
684  /// removes this shader's ownership of the block (for performance reasons)
685  virtual RE_UniformBlockHandle detachUniformBlock(const char *) {return nullptr;}
686 
687  /// Detach a specific RE_UniformBlock from this shader.
688  virtual bool detachUniformBlock(RE_UniformBlock *) { return false; }
689 
690  /// Detaches all blocks referenced by this shader.
691  virtual bool detachAllUniformBlocks() { return false; }
692 
693  /// Uploads attached uniform blocks that are dirty (uniform modifications)
694  /// and ensures they are bound to the shader.
695  virtual bool bindAllUniformBlocks(RE_Render *) { return false; }
696 
697  /// @brief Initialize a uniform block based on this shader's block layout
698  /// Initializes a uniform block with the proper offsets and size for block
699  /// index 'index'. If index is -1, block must have the name of one of the
700  /// uniform blocks in the shader.
701  virtual bool initUniformBlock(RE_Render *r,
702  RE_UniformBlock *block,
703  int index = -1) const
704  { return false; }
705 
706  /// Copies the structure of the named uniform block, and possibly the data.
708  bool data_too) const
709  { return nullptr; }
710 
711  /// Update an offset/name/size information in 'b' with the uniforms for the
712  /// correspondingly-named uniform block in this shader.
713  virtual bool updateUniformBlock(const RE_UniformBlockHandle &b) const
714  { return false; }
715 
716  /// Override the currently bound uniform block without deleting the block
717  /// currently residing at that index. If 'block_index' is -1, the name of
718  /// the block is used to find the block index. Only one override can be
719  /// active at once. Passing nullptr for the block clears the override.
721  int block_index = -1)
722  { return -1; }
723  /// Remove an override block from the shader, by index.
724  virtual void removeOverrideBlock(int ) {}
725  /// Remove a specific override block from the shader.
727  /// Remove all override blocks from the shader.
728  virtual void removeOverrideBlocks()
729  { myLightsId=-1; myLightsSerial=-1; }
730  /// Return the currently bound override block for an index, if any is bound
731  virtual RE_UniformBlockHandle getOverrideBlock(int ) const { return nullptr; }
732 
733  // STORAGE BUFFER BLOCKS -----------------------------------------------
734 
735  /// Create a buffer for buffer block 'name'. If it has an open-ended array,
736  /// array_size specifies the size of that array, othwer it is ignored.
738  int array_size)
739  { return nullptr; }
740 
741  /// Return the block definition for storage block 'name'
743  { return nullptr; }
744 
745  /// Return the storage block bound to 'name' (bound by attachStorageBlock)
747  { return nullptr; }
748 
749  /// Return the raw buffer bound to 'name' (bound by attachStorageBlock)
751  { return nullptr; }
752 
753  /// Attach a shader storage block to the binding point corresponding to its
754  /// name. Shader storage blocks should be created with createStorageBlock().
755  virtual bool attachStorageBlock(const RE_UniformBlockHandle &block)
756  { return false; }
757 
758  /// Detach a shader storage block from the binding point corresponding to
759  /// its name.
760  virtual bool detachStorageBlock(const RE_UniformBlockHandle &block)
761  { return false; }
762 
763  /// Attach a GL buffer to the shader storage block binding point that shares
764  /// its name (getAttributeName()). This method is for simple storage blocks,
765  /// such as "buffer blockname { vec4 color[]; }".
766  virtual bool attachStorageBuffer(RE_VertexArray *raw_buffer)
767  { return false; }
768  /// Detach a GL buffer from the shader storage block binding point that
769  /// shares its name (raw_buffer->getAttributeName()).
770  virtual bool detachStorageBuffer(RE_VertexArray *raw_buffer)
771  { return false; }
772 
773  /// Unbind the block or buffer attached to binding point 'bind_name'.
774  virtual bool detachStorageBinding(const char *bind_name)
775  { return false; }
776 
777  // ATTRIBUTES ----------------------------------------------------------
778 
779  /// Return if the vertex shader has input attributes
780  bool hasShaderAttribs() const
781  { return myAttribNames.entries() > 0; }
782 
783  /// Return the number of vertex shader input attributes
784  int getNumShaderAttribs() const
785  { return myAttribNames.entries(); }
786 
787  bool hasTessellation() const
788  { return myTessEvalShaders.entries()>0; }
789 
790  /// Return the name of vertex shader input at index 'i'
791  const char *getShaderAttribName(int i) const
792  { return myAttribNames(i); }
793 
794  /// Return the ID of the attribute if it is a known type, or
795  /// RE_GENATTRIB_UNDEF if it is not.
796  RE_GenericAttribID getShaderAttribGenID(int i) const;
797 
798  /// Return the GL attribute location of vertex shader input at index 'i'
799  int getShaderAttribLocation(int i) const
800  { return myAttribLocations(i); }
801 
802  /// Return the type of vertex shader input at index 'i'
804  { return myAttribTypes(i); }
805 
806  /// Return the vector size of vertex shader input at index 'i'
807  int getShaderAttribSize(int i) const
808  { return myAttribSizes(i); }
809 
810  /// Return a string array of all vertex shader input names.
812  { return myAttribNames; }
813 
814  /// Return an int array of all vertex shader input locations.
816  { return myAttribLocations; }
817 
818  /// Return an int array of all vertex shader input sizes.
820  { return myAttribSizes; }
821 
822  /// Returns the name of a vertex shader input at GL location 'loc'
823  const char * getAttribNameForLocation(int loc) const;
824 
825  /// Return the default GL location of generic vertex attribute 't'
827  { return myAttrModeLocs(t); }
828 
829  /// Return the texture sampler unit of a texture buffer object for 't'
831  { return myAttrSamplerLocs(t); }
832 
833  /// Return the number of GL-builtin vertex shader inputs (gl_Vertex, gl_*)
835  { return myBuiltInAttribNames.entries(); }
836  /// Return the name of GL-builtin vertex shader input at index 'i'
837  const char * getBuiltinAttrib(int i) const
838  { return myBuiltInAttribNames(i); }
839 
840  /// Return the number of texture-buffer object attributes
842  { return myBufferAttribNames.entries(); }
843  /// Return the name of texture-buffer object attribute at index 'i'
844  const char * getBufferAttrib(int i) const
845  { return myBufferAttribNames(i); }
847  { return myBufferAttribGenIDs(i); }
848 
849  /// Return the number of texture buffer object samplers in this shader
850  int getNumBufferTextures() const;
851  /// Name of the texture buffer object sampler at index 'i'
852  const char * getBufferTextureName(int i) const;
853  /// Type of the texture buffer object sampler at index 'i' (float, int, uint)
854  RE_GPUType getBufferTextureType(int i) const;
855  /// True if the shader has a texture buffer object sampler named 'name'
856  bool hasBufferTexture(const char *name) const;
857 
858  /// @brief Return information about vertex shader input 'attrib_name'
859  /// Returns the location and size of the named vertex attribute, or false if
860  /// it does not exist in this shader.
861  /// This also includes the GL built-ins, though these will not set location
862  /// type, or size; only return true/false for their presence in the shader.
863  bool getAttribute(const char *attrib_name,
864  int &location,
865  RE_GPUType &type,
866  int &size) const;
867 
868  /// Simpler version of getAttribute() - just returns if the attribute exists
869  bool hasAttribute(const char *attrib_name) const
870  {
871  int loc,size;
872  RE_GPUType t;
873  return getAttribute(attrib_name,loc,t,size);
874  }
875 
876  /// @brief Return information about vertex shader input at 'index'
877  /// Similar to getAttribute(), but the name of the input does not need to be
878  /// known. GL builtins are not supported by this method. index must be
879  /// within [0, getNumAttribs()-1].
880  bool getAttributeIndex(int index,
881  UT_String &name,
882  int &location,
883  RE_GPUType &type,
884  int &size) const;
885 
886  void printAttributes(std::ostream *os = nullptr) const;
887 
888  /// @brief Zero out the constant attribute location given by 'array'
889  /// Bind a constant zero for this array. If data is non-nullptr,
890  /// this data is used, otherwise the current constant data for this array
891  /// is used (default 0's).
892  bool bindZeroConstant(RE_Render *r, RE_VertexArray *array);
893 
894  // TEXTURES ------------------------------------------------------------
895 
896  /// Loads texture maps specified by the RE_TextureMap bindTextureMap()
897  virtual void loadShaderTexMaps(RE_Render *) = 0;
898  virtual void loadBoundTextures(RE_Render *r) = 0;
899  virtual void unloadBoundTextures(RE_Render *r) = 0;
900 
901  /// Returns the number of texture samplers used by shader 'stage'. As
902  /// RE_ShaderType is a bitfield, multiple stages can be queried at once
903  /// and the sum will be returned. Requires RE_EXT_PROGRAM_INTERFACE_QUERY.
904  int getNumTextures(RE_ShaderType stage) const;
905 
906  /// Override texture compression for texture bound via bindTextureMap()
907  // @{
908  RE_TextureCompress getTextureFormat() const { return myTexFormat; }
910  { myTexFormat = format; }
911  // @}
912 
913  /// Limit the resolution of the textures to a max width and height.
914  //@{
915  void limitTextureSize(bool limit, int w, int h);
916  bool limitTextureSize() const { return myLimitTextureSize; }
917 
918  int getMaxTextureWidth() const { return myMaxTexW; }
919  int getMaxTextureHeight() const { return myMaxTexH; }
920  //@}
921 
922  /// Scale by a constant scale factor for textures bound via bindTextureMap()
923  //@{
924  void setTextureScale(float sc) { myTextureScale = sc; }
925  float getTextureScale() const { return myTextureScale; }
926  //@}
927 
928  /// Enable or disable mipmapping for textures bound via bindTextureMap()
929  //@{
930  bool mipMapTextures() const { return myMipMapTexture; }
931  void mipMapTextures(bool yes) { myMipMapTexture = yes; }
932  //@}
933 
934  /// Set anisotropic filtering for textures bound via bindTextureMap()
935  //@{
937  { myTextureAnisotropy = samples; }
939  { return myTextureAnisotropy; }
940  //@}
941 
942  /// Returns the shader source of some or all attached shaders
943  void getShaderSource(RE_Render *r,
944  UT_String &source,
946 
947  /// @brief Prepare this shader for rendering
948  /// Binds uniform buffer objects and all builtin uniforms. Optionally
949  /// re-binds vertex attribute locations in 'obj'.
950  bool prepForDrawing(RE_Render *r,
951  RE_Geometry *obj = nullptr,
952  RE_ElementArray *element = nullptr,
953  RE_VertexState *state = nullptr,
954  unsigned int vertex_stride = 0,
955  RE_OverrideList *atrbover=0,
956  int instance_group = 0);
957 
958  bool cleanupAfterDrawing(RE_Render *r,
959  RE_Geometry *obj=nullptr,
960  RE_VertexState *vstate = nullptr,
961  RE_OverrideList *atrbover=0);
962 
963  /// Cached RE_LightList information (uniform blocks)
964  //@{
965  bool matchesLights(int light_serial, int light_id) const;
966  void setLightID(int light_serial, int light_id, int mask);
967  int getLightMask() const { return myLightMask; }
968  //@}
969 
970  /// COMPUTE
971  virtual bool runCompute(RE_Render *r,
972  int num_wg_x,
973  int num_wg_y = 1,
974  int num_wg_z = 1);
975  virtual bool runCompute(RE_Render *r,
976  RE_VertexArray *wg_buffer, int offset);
977 
978  /// @brief Fetch a shader based on GL program id
979  /// Returns the RE_Shader object with the specified program object if it
980  /// exists; otherwise, returns nullptr.
981  static RE_Shader *getShader(int program_object);
982 
983  // Loads only the source from the Houdini OGL shader path. Returns true if
984  // the file was successfully loaded.
985  static bool loadFile(const char *filename,
986  const char *defines,
988  int &codeversion,
989  UT_String *messages,
990  int default_code_version = 0,
991  int max_verts = -1,
992  bool adjust_line_num = false,
993  bool loadingInclude = false,
995 
996 
997  // This is a list of "built-in" Houdini functions paired with the GL files that
998  // they are defined in.
1000  {
1001  public:
1002  re_LibFunc(const char *func = 0, const char *file = 0, const char *deps = 0,
1003  RE_ShaderType t = RE_SHADER_FRAGMENT, int glmaj=0, int glmin=0)
1004  : myFunc(func), myFile(file), myDeps(deps), myType(t),
1005  myGLMajor(glmaj), myGLMinor(glmin)
1006  {}
1007 
1008  const char *myFunc;
1009  const char *myFile;
1010  const char *myDeps;
1014  };
1015 
1016  static bool getCodeBlock(const char *block_name,
1017  UT_StringHolder &block_source,
1018  RE_ShaderLanguage lang);
1019 
1020 protected:
1021  virtual void removeTextureRefs(RE_OGLTexture *) {}
1022 
1023  // Get the index of an attribute or uniform based on its name. The
1024  // returned index can be used to look up corresponding elements in
1025  // the myAttrib*s arrays or the myUniform*s arrays, respectively.
1026  virtual int getAttributeIndex(const char *name) const;
1027  int getUniformIndex(const UT_StringHolder &name) const;
1028 
1029  // Creates/destroys a mapping from the specified program id to this shader
1030  // in the shader table.
1031  static void registerProgram(RE_Shader *shader, int program_object);
1032 
1033  // Loads any built-in Houdini shaders that loadShader() noted if
1034  // useHoudiniLibraryFuncs() is on.
1035  bool loadHoudiniLibraryFuncs(RE_Render *r, UT_String *msg,
1036  RE_ShaderLanguage lang);
1037 
1038  const char **getTransformFeedbackAttribs(int &num_attribs);
1039 
1040  static RE_Texture * getDefaultTBO(RE_Render *r);
1041 
1043  {
1044  re_NeededLibFuncs(const char *file, const char *func, RE_ShaderType s)
1045  : myFile(file), myFunc(func), myStage(s), myLoaded(false) {}
1049  bool myLoaded;
1050  };
1051 
1052  virtual re_LibFunc* getShaderLibrary() const;
1053 
1054  static void scanSourceForFuncs(const char *line,
1055  RE_ShaderType shtype,
1057  re_LibFunc *library,
1058  int glmajor,
1059  int glminor);
1060 
1061  static void processCodeLine(const char *line,
1062  int line_num,
1063  const char *defines,
1064  UT_WorkBuffer &src,
1065  int &codeversion,
1066  UT_String *messages,
1067  int default_code_version,
1068  bool &found_codeversion,
1069  int max_verts,
1070  bool adjust_line_num,
1071  RE_ShaderLanguage lang);
1072 
1073  void setGeomMaxVerts(int max_verts)
1074  { myGeoShaderMaxVertices = max_verts; }
1075 
1076 
1086  int myMaxTexW, myMaxTexH;
1090 
1097 
1099 
1103 
1113 
1122 
1123  int myBuiltInMap[ RE_UNIFORM_BUILT_IN__count ];
1126 
1129 
1132 
1136 
1140 
1146 
1147  UT_IntArray myDrawBoundTextures; // scope: single draw.
1149 
1150 public:
1151  // These are called by RE_Render. Use r->pushShader() or r->bindShader()
1152  // or r->popShader() instead
1153  // This should set the shader as current.
1154  virtual void applyShader(RE_Render *r, bool update_re = true) = 0;
1155  // This should do a cleanup and unset any current shader.
1156  virtual void removeShader(RE_Render *r, bool update_re = true) = 0;
1157  // This should cleanup after the shader, but leave it set as current.
1158  virtual void cleanup(RE_Render *r) = 0;
1159 
1160  // public only for RE_OGLRender.
1161  static void unregisterProgram(int program_object);
1162  static void removeAllTextureRefs(RE_OGLTexture *);
1163 
1164  // public for RV_ShaderProgram
1165  static int loadProgramFile(RE_Render *r,
1166  const char *file,
1167  const char *basepath,
1168  UT_String &prog_name,
1169  UT_StringArray &files,
1170  UT_StringArray &files_names,
1171  UT_StringArray &inputs,
1172  UT_StringArray &outputs,
1173  UT_StringArray &defines,
1174  int &codeversion,
1175  fpreal &shading_rate,
1176  int &max_verts,
1177  bool &use_attrib_map,
1178  bool &explicit_attrib_map,
1179  int max_version,
1180  RE_ShaderLanguage &shader_lang,
1181  UT_String *msg);
1182 };
1183 
1184 
1186 {
1187 public:
1189  const char *name = 0);
1190  virtual ~RE_ShaderStage();
1191 
1192  /// Returns the amount of main memory (NOT graphics memory!)
1193  /// owned by this RE_ShaderStage.
1194  virtual int64 getMemoryUsage(bool inclusive) const
1195  {
1196  int64 mem = inclusive ? sizeof(*this) : 0;
1197  mem += myName.getMemoryUsage(false);
1198  mem += myFilename.getMemoryUsage(false);
1199  return mem;
1200  }
1201 
1202  const char * getName() const { return myName; }
1203  RE_ShaderType getShaderType() const { return myType; }
1204 
1205  const UT_String &getFilename() const { return myFilename; }
1206  void setFilename(const char * fname)
1207  { myFilename.harden(fname); }
1208 
1209  // This maintains an internal cache of shader source code; once the shader
1210  // is loaded, the cached source is used.
1211  bool loadShader(RE_Render *r,
1212  const char *filename,
1213  UT_String *messages = nullptr,
1214  bool dump_source_on_error = true,
1215  const char *defines = nullptr,
1216  int default_code_version
1218  int max_verts = -1,
1219  RE_ShaderLanguage lang
1221 
1222  virtual bool setSource(RE_Render *r,
1223  const char *source_code,
1224  int version,
1225  UT_String *messages = nullptr,
1226  bool dump_source_on_error = true) = 0;
1227  virtual bool getSource(RE_Render *r, UT_String &source);
1228 
1229  void setID(int id) { myID = id; }
1230  int getID() const { return myID; }
1231 
1232  // Returns the version of the shader (100,110,120,130,140,150,330,400,410).
1233  int getCodeVersion() const { return myCodeVersion; }
1234 protected:
1235  void setCodeVersion(int v) { myCodeVersion=v; }
1236 private:
1237 
1238  UT_String myName;
1239  UT_String myFilename;
1240  RE_ShaderType myType;
1241  int myID;
1242  int myCodeVersion;
1243 };
1244 
1245 class RE_UniformData // private to RE - no RE_API
1246 {
1247 public:
1250  arraysize(0), topsize(0), topstride(0),
1251  uniformblock(-1), dataoffset(0),
1252  location(-1), tex_unit(-1), image_unit(-1),
1253  value_cached(false)
1254  {}
1255 
1257  : name(data.name),
1258  type(data.type),
1259  arraysize(data.arraysize),
1260  topsize(data.topsize),
1261  topstride(data.topstride),
1262  uniformblock(data.uniformblock),
1263  dataoffset(data.dataoffset),
1264  location(data.location),
1265  tex_unit(data.tex_unit),
1266  image_unit(data.image_unit),
1267  value_cached(false)
1268  {}
1269 
1270  bool typeMatch(const RE_UniformData *data) const
1271  {
1272  return (type == data->type &&
1273  arraysize == data->arraysize &&
1274  dataoffset == data->dataoffset);
1275  }
1276 
1277  /// Returns the amount of main memory (NOT graphics memory!)
1278  /// owned by this RE_UniformData.
1279  int64 getMemoryUsage(bool inclusive) const
1280  {
1281  int64 mem = inclusive ? sizeof(*this) : 0;
1282  mem += name.getMemoryUsage(false);
1283  return mem;
1284  }
1285 
1286  enum { cached_data_size = sizeof(UT_Matrix4D) };
1287 
1290  int arraysize; // array size of member element, ie, int[4]
1291  int topsize; // array size of buffer variable
1292  int topstride; // array stride of buffer variable
1296  int tex_unit; // for normal textures
1297  int image_unit; // for image-load-store images
1300 };
1301 
1302 /// --- Inlines
1303 
1304 inline bool
1306 {
1307  return bindVariableInt(r, name, &v);
1308 }
1309 
1310 inline bool
1312 {
1313  return bindVariable1(r, name, &v);
1314 }
1315 
1316 inline bool
1318 {
1319  return bindVariable1(r, name, &v);
1320 }
1321 
1322 inline bool
1324 {
1325  return bindVariable2(r, name, v.data());
1326 }
1327 
1328 inline bool
1330 {
1331  fpreal32 col[3];
1332 
1333  c.getRGB(col, col+1, col+2);
1334  return bindVariable3(r, name, col);
1335 }
1336 
1337 inline bool
1339  fpreal alpha)
1340 {
1341  fpreal32 col[4];
1342 
1343  c.getRGB(col, col+1, col+2);
1344  col[3] = alpha;
1345  return bindVariable4(r, name, col);
1346 }
1347 
1348 
1349 inline bool
1351 {
1352  return bindVariable3(r, name, v.data());
1353 }
1354 
1355 inline bool
1357 {
1358  return bindVariable4(r, name, v.data());
1359 }
1360 
1361 inline bool
1363 {
1364  return bindVariable2(r, name, v.data());
1365 }
1366 
1367 inline bool
1369 {
1370  return bindVariable3(r, name, v.data());
1371 }
1372 
1373 inline bool
1375 {
1376  return bindVariable4(r, name, v.data());
1377 }
1378 
1379 
1380 inline bool
1382 {
1383  return bindVariableInt2(r, name, v.data());
1384 }
1385 
1386 inline bool
1388 {
1389  return bindVariableInt3(r, name, v.data());
1390 }
1391 
1392 inline bool
1394 {
1395  return bindVariableInt4(r, name, v.data());
1396 }
1397 
1398 inline bool
1400  const UT_StringHolder &name,
1401  const UT_Vector2FArray &vals)
1402 {
1403  return bindVariable2(r, name, vals(0).data(), vals.entries());
1404 }
1405 
1406 
1407 inline bool
1409  const UT_Vector4FArray &vals)
1410 {
1411  return bindVariable4(r, name, vals(0).data(), vals.entries());
1412 }
1413 
1414 inline bool
1416  const UT_Vector2DArray &vals)
1417 {
1418  return bindVariable2(r, name, vals(0).data(), vals.entries());
1419 }
1420 
1421 inline bool
1423  const UT_Vector4DArray &vals)
1424 {
1425  return bindVariable4(r, name, vals(0).data(), vals.entries());
1426 }
1427 
1428 inline bool
1430 {
1431  return bindMatrix2(r, name, m.data());
1432 }
1433 
1434 inline bool
1436 {
1437  return bindMatrix3(r, name, m.data());
1438 }
1439 
1440 inline bool
1442 {
1443  return bindMatrix4(r, name, m.data());
1444 }
1445 
1446 inline bool
1448 {
1449  return bindMatrix2(r, name, m.data());
1450 }
1451 
1452 inline bool
1454 {
1455  return bindMatrix3(r, name, m.data());
1456 }
1457 
1458 inline bool
1460 {
1461  return bindMatrix4(r, name, m.data());
1462 }
1463 
1464 inline RE_GenericAttribID
1466 {
1467  return myAttribGenIDs(i);
1468 }
1469 
1470 #endif
const char * getBuiltinAttrib(int i) const
Return the name of GL-builtin vertex shader input at index 'i'.
Definition: RE_Shader.h:837
int getCodeVersion() const
Definition: RE_Shader.h:1233
const UT_String & getFilename() const
Definition: RE_Shader.h:1205
#define SYSmax(a, b)
Definition: SYS_Math.h:1538
virtual RE_UniformBlockHandle copyUniformBlock(const char *name, bool data_too) const
Copies the structure of the named uniform block, and possibly the data.
Definition: RE_Shader.h:707
virtual bool updateUniformBlock(const RE_UniformBlockHandle &b) const
Definition: RE_Shader.h:713
RE_UniformData(const RE_UniformData &data)
Definition: RE_Shader.h:1256
RE_ShaderType myType
Definition: RE_Shader.h:1011
UT_Matrix4T< fpreal64 > UT_Matrix4D
bool hasShaderAttribs() const
Return if the vertex shader has input attributes.
Definition: RE_Shader.h:780
RE_GPUType getShaderAttribType(int i) const
Return the type of vertex shader input at index 'i'.
Definition: RE_Shader.h:803
int myProgramObject
Definition: RE_Shader.h:1079
int getProgram() const
Raw GL id of the shader.
Definition: RE_Shader.h:135
GT_API const UT_StringHolder filename
UT_IntArray myAttribSizes
Definition: RE_Shader.h:1111
UT_String myProgramName
Definition: RE_Shader.h:1077
char cached_data[cached_data_size]
Definition: RE_Shader.h:1299
UT_ValArray< RE_ShaderStage * > myTessEvalShaders
Definition: RE_Shader.h:1093
void setID(int id)
Definition: RE_Shader.h:1229
virtual int getMaxUniformBlockSizeB(RE_Render *)
Returns the OpenGL maximum size of a uniform block, in bytes.
Definition: RE_Shader.h:652
virtual int64 getMemoryUsage(bool inclusive) const
Definition: RE_Shader.h:1194
virtual RE_UniformBlockHandle createStorageBlock(const char *name, int array_size)
Definition: RE_Shader.h:737
#define RE_API
Definition: RE_API.h:10
bool isSampleShading() const
Definition: RE_Shader.h:362
UT_String myExtraDefines
Definition: RE_Shader.h:1078
UT_StringList myBufferAttribNames
Definition: RE_Shader.h:1106
void getRGB(float *r, float *g, float *b) const
Definition: UT_Color.h:101
virtual void printUniforms(RE_Render *r, std::ostream *os=nullptr) const
Prints all the active uniforms plus their values to stream os (or cerr)
Definition: RE_Shader.h:636
GLboolean * data
Definition: glcorearb.h:131
const GLdouble * v
Definition: glcorearb.h:837
UT_Array< RE_GenericAttribID > myBufferAttribGenIDs
Definition: RE_Shader.h:1107
void setFilename(const char *fname)
Definition: RE_Shader.h:1206
UT_IntArray myImageUniforms
Definition: RE_Shader.h:1139
UT_IntrusivePtr< RE_UniformBlock > RE_UniformBlockHandle
Definition: RE_Shader.h:55
int myLightMask
Definition: RE_Shader.h:1144
virtual int getUniformBlockIndex(const char *name) const
Returns the block binding point of the named block.
Definition: RE_Shader.h:666
const UT_IntArray & getShaderAttribSizes() const
Return an int array of all vertex shader input sizes.
Definition: RE_Shader.h:819
RE_TextureCompress myTexFormat
Definition: RE_Shader.h:1084
int getSource() override
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
int64 exint
Definition: SYS_Types.h:125
int getMaxTextureWidth() const
Limit the resolution of the textures to a max width and height.
Definition: RE_Shader.h:918
GLdouble s
Definition: glad.h:3009
bool hasTessellation() const
Definition: RE_Shader.h:787
virtual bool detachStorageBinding(const char *bind_name)
Unbind the block or buffer attached to binding point 'bind_name'.
Definition: RE_Shader.h:774
virtual void removeOverrideBlock(RE_UniformBlock *b)
Remove a specific override block from the shader.
Definition: RE_Shader.h:726
virtual RE_UniformBlockHandle getStorageBlock(const char *name)
Return the block definition for storage block 'name'.
Definition: RE_Shader.h:742
fpreal myShadingRate
Definition: RE_Shader.h:1137
void setCodeVersion(int v)
Definition: RE_Shader.h:1235
int myLightsSerial
Definition: RE_Shader.h:1142
GLenum GLenum GLsizei void * image
Definition: glad.h:5132
bool bindColor(RE_Render *r, const UT_StringHolder &name, const UT_Color &c)
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the s...
Definition: RE_Shader.h:1329
UT_StringList myAttribNames
Definition: RE_Shader.h:1105
const char * myFile
Definition: RE_Shader.h:1009
RE_UniformType
Definition: RE_Uniform.h:145
bool bindMatrix(RE_Render *r, const UT_StringHolder &name, const UT_Matrix2F &m)
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the s...
Definition: RE_Shader.h:1429
virtual RE_UniformBlockHandle getStorageBlockBinding(const char *name)
Return the storage block bound to 'name' (bound by attachStorageBlock)
Definition: RE_Shader.h:746
RE_TextureDimension
unsigned long long uint64
Definition: SYS_Types.h:117
bool typeMatch(const RE_UniformData *data) const
Definition: RE_Shader.h:1270
virtual RE_UniformBlockHandle getOverrideBlock(int) const
Return the currently bound override block for an index, if any is bound.
Definition: RE_Shader.h:731
const char * getName() const
Readable name of the shader.
Definition: RE_Shader.h:129
UT_ValArray< re_VertexName * > myTransformFeedbackVertices
Definition: RE_Shader.h:1135
float fpreal32
Definition: SYS_Types.h:200
void disableShadingRate()
Definition: RE_Shader.h:367
const T * data() const
Return the raw matrix data.
Definition: UT_Matrix3.h:1158
constexpr SYS_FORCE_INLINE const T * data() const noexcept
Definition: UT_Vector3.h:292
bool bindInt(RE_Render *r, const UT_StringHolder &name, int v)
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the s...
Definition: RE_Shader.h:1305
void setAnisotropySamples(int samples)
Set anisotropic filtering for textures bound via bindTextureMap()
Definition: RE_Shader.h:936
int getMaxTextureHeight() const
Limit the resolution of the textures to a max width and height.
Definition: RE_Shader.h:919
UT_ValArray< RE_UniformData * > myUniforms
Definition: RE_Shader.h:1114
int getCodeVersion() const
Returns the version of the shader (110,120,130,140,150,330,400,410).
Definition: RE_Shader.h:144
RE_GenericAttribID getShaderAttribGenID(int i) const
Definition: RE_Shader.h:1465
UT_Array< RE_GenericAttribID > myAttribGenIDs
Definition: RE_Shader.h:1109
UT_Array< re_NeededLibFuncs > * myNeededLibraryFuncs
Definition: RE_Shader.h:1130
virtual bool initUniformBlock(RE_Render *r, RE_UniformBlock *block, int index=-1) const
Initialize a uniform block based on this shader's block layout Initializes a uniform block with the p...
Definition: RE_Shader.h:701
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
bool hasAttribute(const char *attrib_name) const
Simpler version of getAttribute() - just returns if the attribute exists.
Definition: RE_Shader.h:869
re_NeededLibFuncs(const char *file, const char *func, RE_ShaderType s)
Definition: RE_Shader.h:1044
RE_VertexMap * myVertexMap
Definition: RE_Shader.h:1127
int getNumImages() const
Definition: RE_Shader.h:438
double fpreal64
Definition: SYS_Types.h:201
RE_ShaderType
Definition: RE_Types.h:228
virtual RE_UniformBlockHandle getUniformBlock(int) const
Return an attached uniform block by index.
Definition: RE_Shader.h:659
int myCodeVersion
Definition: RE_Shader.h:1131
RE_GenericAttribID
Definition: RE_Types.h:348
UT_StringList myBuiltInAttribNames
Definition: RE_Shader.h:1104
RE_GPUType
Definition: RE_Types.h:44
RE_Geometry * myTransformFeedbackGeometry
Definition: RE_Shader.h:1133
virtual int getNumUniformBlocks() const
Returns the number of blocks and specific uniform blocks.
Definition: RE_Shader.h:656
RE_BufferType
Definition: RE_Types.h:284
int getNumTextures() const
Return the number of samplers this shader references.
Definition: RE_Shader.h:434
UT_IntArray myAttrModeLocs
Definition: RE_Shader.h:1120
GLintptr offset
Definition: glcorearb.h:665
UT_IntArray myNumTexturesPerStage
Definition: RE_Shader.h:1098
UT_IntArray myDrawBoundTextures
Definition: RE_Shader.h:1147
virtual bool detachAllUniformBlocks()
Detaches all blocks referenced by this shader.
Definition: RE_Shader.h:691
int getShaderAttribSize(int i) const
Return the vector size of vertex shader input at index 'i'.
Definition: RE_Shader.h:807
virtual RE_UniformBlockHandle detachUniformBlock(const char *)
Detach a named RE_UniformBlock from this shader Detach a single uniform block by name or pointer...
Definition: RE_Shader.h:685
virtual bool detachStorageBuffer(RE_VertexArray *raw_buffer)
Definition: RE_Shader.h:770
bool mipMapTextures() const
Enable or disable mipmapping for textures bound via bindTextureMap()
Definition: RE_Shader.h:930
bool myLinkedFlag
Definition: RE_Shader.h:1080
UT_ValArray< RE_ShaderStage * > myGeometryShaders
Definition: RE_Shader.h:1094
virtual ~Factory()
Definition: RE_Shader.h:92
bool bindDouble(RE_Render *r, const UT_StringHolder &name, double v)
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the s...
Definition: RE_Shader.h:1317
UT_ValArray< const RE_Uniform * > myBuiltInLastUniform
Definition: RE_Shader.h:1117
UT_IntArray myAttribLocations
Definition: RE_Shader.h:1108
int64 getMemoryUsage(bool inclusive) const
Definition: RE_Shader.h:1279
UT_Vector3T< T > SYSclamp(const UT_Vector3T< T > &v, const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
Definition: UT_Vector3.h:1057
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
int getAttributeModeLoc(RE_GenericAttribID t) const
Return the default GL location of generic vertex attribute 't'.
Definition: RE_Shader.h:826
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
UT_ValArray< RE_ShaderStage * > myTessControlShaders
Definition: RE_Shader.h:1092
bool bindVectors(RE_Render *r, const UT_StringHolder &name, const UT_Vector2FArray &vals)
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the s...
Definition: RE_Shader.h:1399
UT_SymbolMap< int > myUniformBlockTable
Definition: RE_Shader.h:1119
const char * getShaderAttribName(int i) const
Return the name of vertex shader input at index 'i'.
Definition: RE_Shader.h:791
GLint GLuint mask
Definition: glcorearb.h:124
int getNumUniforms() const
Returns the number of active uniforms in this shader.
Definition: RE_Shader.h:475
bool bindFloat(RE_Render *r, const UT_StringHolder &name, float v)
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the s...
Definition: RE_Shader.h:1311
bool isLinked() const
True if the shader has been successfully linked.
Definition: RE_Shader.h:141
constexpr SYS_FORCE_INLINE const T * data() const noexcept
Definition: UT_Vector2.h:217
long long int64
Definition: SYS_Types.h:116
GLint location
Definition: glcorearb.h:805
UT_IntArray myAttrSamplerLocs
Definition: RE_Shader.h:1121
virtual int overrideUniformBlock(RE_UniformBlock *block, int block_index=-1)
Definition: RE_Shader.h:720
GLuint id
Definition: glcorearb.h:655
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:112
int myTextureAnisotropy
Definition: RE_Shader.h:1089
RE_UniformBuiltIn
Definition: RE_Uniform.h:28
virtual bool detachUniformBlock(RE_UniformBlock *)
Detach a specific RE_UniformBlock from this shader.
Definition: RE_Shader.h:688
bool myMipMapTexture
Definition: RE_Shader.h:1088
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual bool attachUniformBlock(RE_UniformBlock *)
Attach an RE_UniformBlock to this shader Attach a single uniform block to the shader. The shader owns the block while attached, and will delete it if the shader is deleted, or may delete it if linkShaders() is called and it is no longer in use. If you want to cache a block, detach it when you're done with the shader. If a block with the same name is already attached to this shader, it will be deleted.
Definition: RE_Shader.h:676
int64 myRenderSerial
Definition: RE_Shader.h:1125
int getAnisotropySamples() const
Set anisotropic filtering for textures bound via bindTextureMap()
Definition: RE_Shader.h:938
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
virtual bool attachStorageBlock(const RE_UniformBlockHandle &block)
Definition: RE_Shader.h:755
const UT_IntArray & getBuiltInUniformList() const
Returns a list of RE_UniformBuiltIn IDs this shader uses.
Definition: RE_Shader.h:622
RE_ShaderType getShaderType() const
Definition: RE_Shader.h:1203
int myMaxTexW
Definition: RE_Shader.h:1086
UT_ValArray< RE_ShaderStage * > myVertexShaders
Definition: RE_Shader.h:1091
int getNumBufferAttribs() const
Return the number of texture-buffer object attributes.
Definition: RE_Shader.h:841
GLdouble t
Definition: glad.h:2397
GLsizei samples
Definition: glcorearb.h:1298
re_LibFunc(const char *func=0, const char *file=0, const char *deps=0, RE_ShaderType t=RE_SHADER_FRAGMENT, int glmaj=0, int glmin=0)
Definition: RE_Shader.h:1002
GT_API const UT_StringHolder version
void setTextureScale(float sc)
Scale by a constant scale factor for textures bound via bindTextureMap()
Definition: RE_Shader.h:924
int getLightMask() const
Cached RE_LightList information (uniform blocks)
Definition: RE_Shader.h:967
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
void setTextureFormat(RE_TextureCompress format)
Override texture compression for texture bound via bindTextureMap()
Definition: RE_Shader.h:909
fpreal getShadingRate() const
Definition: RE_Shader.h:360
virtual RE_VertexArray * getStorageBufferBinding(const char *name)
Return the raw buffer bound to 'name' (bound by attachStorageBlock)
Definition: RE_Shader.h:750
RE_TextureCompress getTextureFormat() const
Override texture compression for texture bound via bindTextureMap()
Definition: RE_Shader.h:908
void setGeomMaxVerts(int max_verts)
Definition: RE_Shader.h:1073
int getID() const
Definition: RE_Shader.h:1230
GLsizeiptr size
Definition: glcorearb.h:664
UT_Array< RE_GPUType > myAttribTypes
Definition: RE_Shader.h:1110
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
const UT_StringList & getShaderAttribNames() const
Return a string array of all vertex shader input names.
Definition: RE_Shader.h:811
GLuint shader
Definition: glcorearb.h:785
GLenum func
Definition: glcorearb.h:783
RE_BufferAccess
Definition: RE_Types.h:314
void setShadingRate(fpreal rate)
Definition: RE_Shader.h:358
const T * data() const
Return the raw matrix data.
Definition: UT_Matrix4.h:1163
bool myRegisterProgram
Definition: RE_Shader.h:1083
UT_IntArray myBufferTextures
Definition: RE_Shader.h:1128
virtual void removeOverrideBlock(int)
Remove an override block from the shader, by index.
Definition: RE_Shader.h:724
int getAttributeSamplerLoc(RE_GenericAttribID t) const
Return the texture sampler unit of a texture buffer object for 't'.
Definition: RE_Shader.h:830
float myTextureScale
Definition: RE_Shader.h:1087
bool myLimitTextureSize
Definition: RE_Shader.h:1085
virtual int getMaxUniformBlocks(RE_Render *)
Returns the OpenGL maximum number of supported blocks.
Definition: RE_Shader.h:649
virtual RE_UniformBlockHandle getUniformBlock(const char *name) const
Return an attached uniform block by name.
Definition: RE_Shader.h:662
fpreal64 fpreal
Definition: SYS_Types.h:277
constexpr SYS_FORCE_INLINE const T * data() const noexcept
Definition: UT_Vector4.h:224
const char * getBufferAttrib(int i) const
Return the name of texture-buffer object attribute at index 'i'.
Definition: RE_Shader.h:844
GLuint index
Definition: glcorearb.h:786
virtual void removeOverrideBlocks()
Remove all override blocks from the shader.
Definition: RE_Shader.h:728
UT_StringHolder name
Definition: RE_Shader.h:1288
GLuint GLfloat * val
Definition: glcorearb.h:1608
UT_ValArray< RE_ShaderStage * > myComputeShaders
Definition: RE_Shader.h:1096
const char * getDefines() const
Any define commands used to alter this shader.
Definition: RE_Shader.h:132
UT_SymbolMap< int > myUniformTable
Definition: RE_Shader.h:1118
int myShaderSerial
Definition: RE_Shader.h:1141
bool myTransformFeedbackGeometryOwned
Definition: RE_Shader.h:1134
RE_UniformType type
Definition: RE_Shader.h:1289
UT_IntArray myBuiltInVersion
Definition: RE_Shader.h:1116
const UT_IntArray & getShaderAttribLocations() const
Return an int array of all vertex shader input locations.
Definition: RE_Shader.h:815
void mipMapTextures(bool yes)
Enable or disable mipmapping for textures bound via bindTextureMap()
Definition: RE_Shader.h:931
float getTextureScale() const
Scale by a constant scale factor for textures bound via bindTextureMap()
Definition: RE_Shader.h:925
MX_RENDER_API ShaderPtr createShader(const string &shaderName, GenContext &context, ElementPtr elem)
Create a shader for a given element.
bool limitTextureSize() const
Limit the resolution of the textures to a max width and height.
Definition: RE_Shader.h:916
virtual bool bindAllUniformBlocks(RE_Render *)
Definition: RE_Shader.h:695
int64 myBuiltInUniformSerial
Definition: RE_Shader.h:1124
RE_PrimType myGeoShaderOutputPrims
Definition: RE_Shader.h:1102
GLuint texture
Definition: glcorearb.h:415
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
bool myUseExplicitAttribMap
Definition: RE_Shader.h:1082
UT_StringList myFeedbackNames
Definition: RE_Shader.h:1112
bool bindVector(RE_Render *r, const UT_StringHolder &name, const UT_Vector2F &v)
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the s...
Definition: RE_Shader.h:1323
const char * getName() const
Definition: RE_Shader.h:1202
void getGeometryParms(int &maxverts, RE_PrimType &input_type, RE_PrimType &output_type) const
Fetch current geometry shader values. Return the geometry shader parameters specified by setGeometryP...
Definition: RE_Shader.h:275
GLsizei GLenum GLenum * types
Definition: glcorearb.h:2542
GLboolean r
Definition: glcorearb.h:1222
UT_ValArray< RE_ShaderStage * > myFragmentShaders
Definition: RE_Shader.h:1095
RE_PrimType myGeoShaderInputPrims
Definition: RE_Shader.h:1101
virtual bool detachStorageBlock(const RE_UniformBlockHandle &block)
Definition: RE_Shader.h:760
int setSource(int source) override
const T * data() const
Return the raw matrix data.
Definition: UT_Matrix2.h:442
exint myUniqueID
Definition: RE_Shader.h:1145
const char * myDeps
Definition: RE_Shader.h:1010
int getNumShaderAttribs() const
Return the number of vertex shader input attributes.
Definition: RE_Shader.h:784
RE_TextureCompress
bool myUseDefaultAttribMap
Definition: RE_Shader.h:1081
int getLinkSerial() const
Bumped every time a link is performed (uniforms invalidated, etc).
Definition: RE_Shader.h:235
RE_ShaderLanguage
Definition: RE_Types.h:257
type
Definition: core.h:1059
virtual bool attachStorageBuffer(RE_VertexArray *raw_buffer)
Definition: RE_Shader.h:766
int getShaderAttribLocation(int i) const
Return the GL attribute location of vertex shader input at index 'i'.
Definition: RE_Shader.h:799
RE_PrimType
Definition: RE_Types.h:193
int getNumBuiltinAttribs() const
Return the number of GL-builtin vertex shader inputs (gl_Vertex, gl_*)
Definition: RE_Shader.h:834
exint getUniqueID() const
Definition: RE_Shader.h:70
const char * myFunc
Definition: RE_Shader.h:1008
virtual void removeTextureRefs(RE_OGLTexture *)
Definition: RE_Shader.h:1021
Definition: format.h:895
UT_IntArray myTextureUniforms
Definition: RE_Shader.h:1138
UT_WorkBuffer myWorkBuffer
Definition: RE_Shader.h:1148
int myGeoShaderMaxVertices
Definition: RE_Shader.h:1100
GLenum src
Definition: glcorearb.h:1793
UT_IntArray myBuiltInUniforms
Definition: RE_Shader.h:1115
RE_GenericAttribID getBufferAttribID(int i) const
Definition: RE_Shader.h:846
int myLightsId
Definition: RE_Shader.h:1143