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