HDK
|
#include <RE_Shader.h>
Classes | |
class | Factory |
class | re_LibFunc |
struct | re_NeededLibFuncs |
Public Types | |
enum | { USE_GLSL_BASE_VERSION = -1, USE_SHADER_GLSL_VERSION = 0 } |
Public Member Functions | |
RE_Shader (const char *program_name, int shader_version) | |
virtual | ~RE_Shader () |
exint | getUniqueID () const |
virtual int64 | getMemoryUsage (bool inclusive) const |
void | setRegisterProgram (bool register_program) |
const char * | getName () const |
Readable name of the shader. More... | |
const char * | getDefines () const |
Any define commands used to alter this shader. More... | |
int | getProgram () const |
Raw GL id of the shader. More... | |
bool | isLinked () const |
True if the shader has been successfully linked. More... | |
int | getCodeVersion () const |
Returns the version of the shader (110,120,130,140,150,330,400,410). More... | |
virtual RE_ShaderStage * | newShader (RE_ShaderType type, const char *name=0)=0 |
void | useHoudiniLibraryFuncs () |
If true, this shader may use Houdini's builtin functions. More... | |
void | useDefaultAttribMap (bool enable=true) |
If true, this shader follows the default Houdini attribute map. More... | |
void | useExplicitAttribMap (bool enable=true) |
virtual bool | attachShader (RE_Render *r, RE_ShaderStage *obj, UT_String *messages=nullptr) |
virtual bool | detachShader (RE_Render *r, RE_ShaderStage *obj) |
RE_ShaderStage * | getShader (const char *shader_name, RE_ShaderType hint=RE_SHADER_ALL) |
Returns an attached shader by the given name. More... | |
virtual bool | setVertexInput (RE_Render *r, const char *name, int vertex_index) |
virtual bool | setFragmentOutput (RE_Render *r, const char *name, int buffer_index) |
virtual bool | linkShaders (RE_Render *r, UT_String *messages=nullptr) |
int | getLinkSerial () const |
Bumped every time a link is performed (uniforms invalidated, etc). More... | |
virtual bool | validateShader (RE_Render *r, UT_String *messages=nullptr) |
virtual void | clearShaders (RE_Render *r, RE_ShaderType types=RE_SHADER_ALL) |
Clears and deletes all the shader objects of a certain type (or all) More... | |
bool | hasShader (RE_ShaderType type) const |
void | disableShadingRate () |
virtual RE_TextureDimension | getTextureMapType (RE_Render *r, const UT_StringHolder &name)=0 |
Return the texture type for the sampler named 'name'. More... | |
int | getNumTextures () const |
Return the number of samplers this shader references. More... | |
int | getNumImages () const |
const char * | getTextureSamplerName (int tex_index) const |
Return the name of a sampler uniform Return the texture sampler name of the enumerated samplers at 'tex_index' Must be within [0, getNumTextures()-1]. More... | |
RE_TextureDimension | getTextureSamplerType (int tex_index) const |
Return the texture sampler type at 'tex_index' [0, getNumTextures()-1]. More... | |
UT_StringHolder | findSamplerAtUnit (int tex_unit) const |
int | getUniformTextureUnit (const UT_StringHolder &uniform_name, int array_index=0) const |
return the texture unit of sampler 'uniform_name' Return the texture unit this sampler has been assigned to, or -1 if 'uniform_name' does not exist, or is not a sampler. array_index is used to identify indices of sampler arrays. More... | |
bool | setUniformTextureUnit (RE_Render *r, const UT_StringHolder &uniform_name, int unit_index) |
Set a binding point for the given sampler. More... | |
int | getUniformImageUnit (const UT_StringHolder &uniform_name) const |
return the image unit of sampler 'uniform_name' Return the image unit this image uniform has been assigned to, or -1 if 'uniform_name' does not exist, or is not a image uniform. Images are different than textures, used by RE_EXT_IMAGE_LOAD_STORE (GL4.2). More... | |
RE_UniformType | getUniformType (const UT_StringHolder &uniform_name) const |
int | getNumUniforms () const |
Returns the number of active uniforms in this shader. More... | |
const char * | getUniformName (int idx) const |
Returns the name of active uniform 'idx' [0, getNumUniforms()-1]. More... | |
int | getUniformLocation (int idx) const |
Return the GL uniform location of uniform 'idx' [0, getNumUniforms()-1]. More... | |
RE_UniformType | getUniformType (int idx) const |
Return the GL uniform type 'idx' [ 0, getNumUniforms()-1]. More... | |
int | getBlockIndexForUniform (int idx) const |
Return the index of the uniform block a uniform is in, -1 for none. More... | |
virtual bool | bindImage (RE_Render *r, const UT_StringHolder &name, RE_Texture *image, RE_BufferAccess image_access)=0 |
virtual bool | bindImageLayer (RE_Render *r, const UT_StringHolder &name, RE_Texture *image, RE_BufferAccess image_access, int layer)=0 |
bool | setTextureHandle (RE_Render *r, const UT_StringHolder &uniform_name, RE_Texture *texture, int *saved_idx=0) |
bool | clearTextureHandle (RE_Render *r, const UT_StringHolder &uniform_name, int *saved_idx=0) |
Remove a bindless handle from the uniform, clearing it to 0 (no tex). More... | |
virtual bool | bindUniform (RE_Render *r, const RE_Uniform *uniform, int index=-1) |
Bind an RE_Uniform's values to the corresponding GL uniform Bind an RE_Uniform to this shader. If 'uniform' is an array uniform then 'index' specifies which array element to bind. 'index' must be less than uniform->getSize(). Pass -1 for 'index' (the default) to bind all elements of an array; passing -1 for non-arrays is safe and is equivalent to passing 0. More... | |
bool | hasUniform (const UT_StringHolder &uniform_name) const |
returns true if the named uniform exists in the shader. More... | |
bool | hasBuiltInUniform (RE_UniformBuiltIn uniform) const |
Queries the use of a builtin uniform Returns true if this shader has the specified built-in uniform. 'uniform' must be an RE_UniformBuiltIn. Note that certain built-in uniforms may only be supported for certain languages. More... | |
const UT_IntArray & | getBuiltInUniformList () const |
Returns a list of RE_UniformBuiltIn IDs this shader uses. More... | |
void | bindBuiltIns (RE_Render *r, bool force_update=false) |
Bind all builtin uniforms. Bind all builtin uniforms this shader uses to their current values in RE_Render. More... | |
void | invalidateUniform (RE_UniformBuiltIn uniform) |
virtual void | printUniforms (RE_Render *r, std::ostream *os=nullptr) const |
Prints all the active uniforms plus their values to stream os (or cerr) More... | |
virtual int | getMaxUniformBlocks (RE_Render *) |
Returns the OpenGL maximum number of supported blocks. More... | |
virtual int | getMaxUniformBlockSizeB (RE_Render *) |
Returns the OpenGL maximum size of a uniform block, in bytes. More... | |
virtual int | getNumUniformBlocks () const |
Returns the number of blocks and specific uniform blocks. More... | |
virtual RE_UniformBlockHandle | getUniformBlock (int) const |
Return an attached uniform block by index. More... | |
virtual RE_UniformBlockHandle | getUniformBlock (const char *name) const |
Return an attached uniform block by name. More... | |
virtual int | getUniformBlockIndex (const char *name) const |
Returns the block binding point of the named block. More... | |
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. More... | |
virtual RE_UniformBlockHandle | detachUniformBlock (const char *) |
Detach a named RE_UniformBlock from this shader Detach a single uniform block by name or pointer. The shader will no longer keep a reference to it, and will not delete it when relinking or when the shader is deleted. Note that a shader must have all blocks attached when executed. Detaching a uniform block does not remove the GL binding to the block, it merely removes this shader's ownership of the block (for performance reasons) More... | |
virtual bool | detachUniformBlock (RE_UniformBlock *) |
Detach a specific RE_UniformBlock from this shader. More... | |
virtual bool | detachAllUniformBlocks () |
Detaches all blocks referenced by this shader. More... | |
virtual bool | bindAllUniformBlocks (RE_Render *) |
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 proper offsets and size for block index 'index'. If index is -1, block must have the name of one of the uniform blocks in the shader. More... | |
virtual RE_UniformBlockHandle | copyUniformBlock (const char *name, bool data_too) const |
Copies the structure of the named uniform block, and possibly the data. More... | |
virtual bool | updateUniformBlock (const RE_UniformBlockHandle &b) const |
virtual int | overrideUniformBlock (RE_UniformBlock *block, int block_index=-1) |
virtual void | removeOverrideBlock (int) |
Remove an override block from the shader, by index. More... | |
virtual void | removeOverrideBlock (RE_UniformBlock *b) |
Remove a specific override block from the shader. More... | |
virtual void | removeOverrideBlocks () |
Remove all override blocks from the shader. More... | |
virtual RE_UniformBlockHandle | getOverrideBlock (int) const |
Return the currently bound override block for an index, if any is bound. More... | |
virtual RE_UniformBlockHandle | createStorageBlock (const char *name, int array_size) |
virtual RE_UniformBlockHandle | getStorageBlock (const char *name) |
Return the block definition for storage block 'name'. More... | |
virtual RE_UniformBlockHandle | getStorageBlockBinding (const char *name) |
Return the storage block bound to 'name' (bound by attachStorageBlock) More... | |
virtual RE_VertexArray * | getStorageBufferBinding (const char *name) |
Return the raw buffer bound to 'name' (bound by attachStorageBlock) More... | |
virtual bool | attachStorageBlock (const RE_UniformBlockHandle &block) |
virtual bool | detachStorageBlock (const RE_UniformBlockHandle &block) |
virtual bool | attachStorageBuffer (RE_VertexArray *raw_buffer) |
virtual bool | detachStorageBuffer (RE_VertexArray *raw_buffer) |
virtual bool | detachStorageBinding (const char *bind_name) |
Unbind the block or buffer attached to binding point 'bind_name'. More... | |
bool | hasShaderAttribs () const |
Return if the vertex shader has input attributes. More... | |
int | getNumShaderAttribs () const |
Return the number of vertex shader input attributes. More... | |
bool | hasTessellation () const |
const char * | getShaderAttribName (int i) const |
Return the name of vertex shader input at index 'i'. More... | |
RE_GenericAttribID | getShaderAttribGenID (int i) const |
int | getShaderAttribLocation (int i) const |
Return the GL attribute location of vertex shader input at index 'i'. More... | |
RE_GPUType | getShaderAttribType (int i) const |
Return the type of vertex shader input at index 'i'. More... | |
int | getShaderAttribSize (int i) const |
Return the vector size of vertex shader input at index 'i'. More... | |
const UT_StringList & | getShaderAttribNames () const |
Return a string array of all vertex shader input names. More... | |
const UT_IntArray & | getShaderAttribLocations () const |
Return an int array of all vertex shader input locations. More... | |
const UT_IntArray & | getShaderAttribSizes () const |
Return an int array of all vertex shader input sizes. More... | |
const char * | getAttribNameForLocation (int loc) const |
Returns the name of a vertex shader input at GL location 'loc'. More... | |
int | getAttributeModeLoc (RE_GenericAttribID t) const |
Return the default GL location of generic vertex attribute 't'. More... | |
int | getAttributeSamplerLoc (RE_GenericAttribID t) const |
Return the texture sampler unit of a texture buffer object for 't'. More... | |
int | getNumBuiltinAttribs () const |
Return the number of GL-builtin vertex shader inputs (gl_Vertex, gl_*) More... | |
const char * | getBuiltinAttrib (int i) const |
Return the name of GL-builtin vertex shader input at index 'i'. More... | |
int | getNumBufferAttribs () const |
Return the number of texture-buffer object attributes. More... | |
const char * | getBufferAttrib (int i) const |
Return the name of texture-buffer object attribute at index 'i'. More... | |
RE_GenericAttribID | getBufferAttribID (int i) const |
int | getNumBufferTextures () const |
Return the number of texture buffer object samplers in this shader. More... | |
const char * | getBufferTextureName (int i) const |
Name of the texture buffer object sampler at index 'i'. More... | |
RE_GPUType | getBufferTextureType (int i) const |
Type of the texture buffer object sampler at index 'i' (float, int, uint) More... | |
bool | hasBufferTexture (const char *name) const |
True if the shader has a texture buffer object sampler named 'name'. More... | |
bool | getAttribute (const char *attrib_name, int &location, RE_GPUType &type, int &size) const |
Return information about vertex shader input 'attrib_name' Returns the location and size of the named vertex attribute, or false if it does not exist in this shader. This also includes the GL built-ins, though these will not set location type, or size; only return true/false for their presence in the shader. More... | |
bool | hasAttribute (const char *attrib_name) const |
Simpler version of getAttribute() - just returns if the attribute exists. More... | |
bool | getAttributeIndex (int index, UT_String &name, int &location, RE_GPUType &type, int &size) const |
Return information about vertex shader input at 'index' Similar to getAttribute(), but the name of the input does not need to be known. GL builtins are not supported by this method. index must be within [0, getNumAttribs()-1]. More... | |
void | printAttributes (std::ostream *os=nullptr) const |
bool | bindZeroConstant (RE_Render *r, RE_VertexArray *array) |
Zero out the constant attribute location given by 'array' Bind a constant zero for this array. If data is non-nullptr, this data is used, otherwise the current constant data for this array is used (default 0's). More... | |
virtual void | loadShaderTexMaps (RE_Render *)=0 |
Loads texture maps specified by the RE_TextureMap bindTextureMap() More... | |
virtual void | loadBoundTextures (RE_Render *r)=0 |
virtual void | unloadBoundTextures (RE_Render *r)=0 |
int | getNumTextures (RE_ShaderType stage) const |
void | getShaderSource (RE_Render *r, UT_String &source, RE_ShaderType sh=RE_SHADER_ALL) |
Returns the shader source of some or all attached shaders. More... | |
bool | prepForDrawing (RE_Render *r, RE_Geometry *obj=nullptr, RE_ElementArray *element=nullptr, RE_VertexState *state=nullptr, unsigned int vertex_stride=0, RE_OverrideList *atrbover=0, int instance_group=0) |
Prepare this shader for rendering Binds uniform buffer objects and all builtin uniforms. Optionally re-binds vertex attribute locations in 'obj'. More... | |
bool | cleanupAfterDrawing (RE_Render *r, RE_Geometry *obj=nullptr, RE_VertexState *vstate=nullptr, RE_OverrideList *atrbover=0) |
virtual bool | runCompute (RE_Render *r, int num_wg_x, int num_wg_y=1, int num_wg_z=1) |
COMPUTE. More... | |
virtual bool | runCompute (RE_Render *r, RE_VertexArray *wg_buffer, int offset) |
virtual void | applyShader (RE_Render *r, bool update_re=true)=0 |
virtual void | removeShader (RE_Render *r, bool update_re=true)=0 |
virtual void | cleanup (RE_Render *r)=0 |
RE_ShaderStage * | loadShader (RE_Render *r, RE_ShaderType stype, const char *filename, UT_String *messages=nullptr, const char *shader_name=nullptr, const char *defines="", int default_code_version=USE_GLSL_BASE_VERSION, int geom_max_verts=-1, RE_ShaderLanguage lang=RE_SHADER_LANGUAGE_GLSL, bool print_source=true) |
RE_ShaderStage * | addShader (RE_Render *r, RE_ShaderType stype, const char *shader_source, const char *shader_name, int codeversion, UT_String *messages=nullptr, bool print_source=true, RE_ShaderLanguage lang=RE_SHADER_LANGUAGE_GLSL, bool preprocess=false) |
Geometry Shaders | |
Geometry shaders must be initialized with a cap on how many vertices they emit per primitive, as well as the primitives they operate on, and the primitives they produce. A vertex and fragment shader MUST be used with a geometry shader. A geometry shader will fail if the primitives drawn do not match the geometry shader input. Input primitives can be points, line variants (lines, line loop, line strip) or triangle variants (tris, tristrips, trifans). Quads and polys are not supported. The output must be points, linestrip or tristrip. | |
virtual bool | setGeometryParms (RE_Render *r, int max_vertices, RE_PrimType input, RE_PrimType output) |
Specify geometry shader parameters. More... | |
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 setGeometryParms() or the shader itself (via layout(in=triangles), etc). More... | |
void | setShadingRate (fpreal rate) |
fpreal | getShadingRate () const |
bool | isSampleShading () const |
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 shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
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 shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
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 shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
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 shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindColor (RE_Render *r, const UT_StringHolder &name, const UT_Color &c, fpreal alpha) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
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 shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVector (RE_Render *r, const UT_StringHolder &name, const UT_Vector3F &v) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVector (RE_Render *r, const UT_StringHolder &name, const UT_Vector4F &v) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVector (RE_Render *r, const UT_StringHolder &name, const UT_Vector2D &v) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVector (RE_Render *r, const UT_StringHolder &name, const UT_Vector3D &v) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVector (RE_Render *r, const UT_StringHolder &name, const UT_Vector4D &v) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVector (RE_Render *r, const UT_StringHolder &name, const UT_Vector2i &v) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVector (RE_Render *r, const UT_StringHolder &name, const UT_Vector3i &v) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVector (RE_Render *r, const UT_StringHolder &name, const UT_Vector4i &v) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
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 shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVectors (RE_Render *r, const UT_StringHolder &name, const UT_Vector3FArray &vals) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVectors (RE_Render *r, const UT_StringHolder &name, const UT_Vector4FArray &vals) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVectors (RE_Render *r, const UT_StringHolder &name, const UT_Vector2DArray &vals) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVectors (RE_Render *r, const UT_StringHolder &name, const UT_Vector3DArray &vals) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindVectors (RE_Render *r, const UT_StringHolder &name, const UT_Vector4DArray &vals) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
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 shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindMatrix (RE_Render *r, const UT_StringHolder &name, const UT_Matrix3F &m) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindMatrix (RE_Render *r, const UT_StringHolder &name, const UT_Matrix4F &m) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindMatrix (RE_Render *r, const UT_StringHolder &name, const UT_Matrix2D &m) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindMatrix (RE_Render *r, const UT_StringHolder &name, const UT_Matrix3D &m) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
bool | bindMatrix (RE_Render *r, const UT_StringHolder &name, const UT_Matrix4D &m) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type. More... | |
virtual bool | bindTextureMap (RE_Render *r, const UT_StringHolder &name, const char *mapname, const char *relative_to)=0 |
Setting Uniforms | |
These methods set uniform values in a shader. 'name' is the name of the uniform in the shader. 'val' is the value that uniform should take. 'array_size' is used if the uniform is an array. 'saved_idx' is an optimization to speed up subsequent accesses to the uniforms. Initially it should be -1. | |
virtual bool | bindVariableInt (RE_Render *r, const UT_StringHolder &name, const int *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindVariableInt2 (RE_Render *r, const UT_StringHolder &name, const int *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer vector-2. More... | |
virtual bool | bindVariableInt3 (RE_Render *r, const UT_StringHolder &name, const int *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer vector-3. More... | |
virtual bool | bindVariableInt4 (RE_Render *r, const UT_StringHolder &name, const int *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer vector-4. More... | |
virtual bool | bindUint64 (RE_Render *r, const UT_StringHolder &name, uint64 *val, int array_size=1, int *saved_idx=0)=0 |
64b Integer handle for bindless texturing More... | |
virtual bool | bindVariable1 (RE_Render *r, const UT_StringHolder &name, const fpreal32 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindVariable2 (RE_Render *r, const UT_StringHolder &name, const fpreal32 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindVariable3 (RE_Render *r, const UT_StringHolder &name, const fpreal32 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindVariable4 (RE_Render *r, const UT_StringHolder &name, const fpreal32 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindVariable1 (RE_Render *r, const UT_StringHolder &name, const fpreal64 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindVariable2 (RE_Render *r, const UT_StringHolder &name, const fpreal64 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindVariable3 (RE_Render *r, const UT_StringHolder &name, const fpreal64 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindVariable4 (RE_Render *r, const UT_StringHolder &name, const fpreal64 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindMatrix2 (RE_Render *r, const UT_StringHolder &name, const fpreal32 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindMatrix3 (RE_Render *r, const UT_StringHolder &name, const fpreal32 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindMatrix4 (RE_Render *r, const UT_StringHolder &name, const fpreal32 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindMatrix2 (RE_Render *r, const UT_StringHolder &name, const fpreal64 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindMatrix3 (RE_Render *r, const UT_StringHolder &name, const fpreal64 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindMatrix4 (RE_Render *r, const UT_StringHolder &name, const fpreal64 *val, int array_size=1, int *saved_idx=0)=0 |
Generic Integer scalar. More... | |
virtual bool | bindTexture (RE_Render *r, const UT_StringHolder &name, RE_Texture *tex, int *saved_idx=0)=0 |
RE_TextureCompress | getTextureFormat () const |
Override texture compression for texture bound via bindTextureMap() More... | |
void | setTextureFormat (RE_TextureCompress format) |
Override texture compression for texture bound via bindTextureMap() More... | |
void | limitTextureSize (bool limit, int w, int h) |
Limit the resolution of the textures to a max width and height. More... | |
bool | limitTextureSize () const |
Limit the resolution of the textures to a max width and height. More... | |
int | getMaxTextureWidth () const |
Limit the resolution of the textures to a max width and height. More... | |
int | getMaxTextureHeight () const |
Limit the resolution of the textures to a max width and height. More... | |
void | setTextureScale (float sc) |
Scale by a constant scale factor for textures bound via bindTextureMap() More... | |
float | getTextureScale () const |
Scale by a constant scale factor for textures bound via bindTextureMap() More... | |
bool | mipMapTextures () const |
Enable or disable mipmapping for textures bound via bindTextureMap() More... | |
void | mipMapTextures (bool yes) |
Enable or disable mipmapping for textures bound via bindTextureMap() More... | |
void | setAnisotropySamples (int samples) |
Set anisotropic filtering for textures bound via bindTextureMap() More... | |
int | getAnisotropySamples () const |
Set anisotropic filtering for textures bound via bindTextureMap() More... | |
bool | matchesLights (int light_serial, int light_id) const |
Cached RE_LightList information (uniform blocks) More... | |
void | setLightID (int light_serial, int light_id, int mask) |
Cached RE_LightList information (uniform blocks) More... | |
int | getLightMask () const |
Cached RE_LightList information (uniform blocks) More... | |
Static Public Member Functions | |
static RE_Shader * | create (const char *name, int shader_version=0, RE_ShaderLanguage lang=RE_SHADER_LANGUAGE_GLSL, RE_Shader::Factory *factory=nullptr) |
static RE_Shader * | createShader (RE_Render *r, const char *name, const char **shader_files, int shader_version=USE_SHADER_GLSL_VERSION, UT_String *compile_msg=nullptr, bool use_houdini_libs=true, RE_ShaderLanguage s=RE_SHADER_LANGUAGE_GLSL, bool register_program=true, const char *extra_defines=nullptr, RE_Shader::Factory *factory=nullptr, bool dump_src_on_error=true) |
static RE_Shader * | createShader (RE_Render *r, const char *name, const char *shader_files, int shader_version=USE_SHADER_GLSL_VERSION, UT_String *compile_msg=nullptr, bool use_houdini_libs=true, RE_ShaderLanguage s=RE_SHADER_LANGUAGE_GLSL, bool register_program=true, const char *extra_defines=nullptr, RE_Shader::Factory *factory=nullptr, bool dump_src_on_error=true) |
A version with a single string containing whitespace-separated filenames. More... | |
static RE_Shader * | lookupProgram (int id) |
static int | getBaseGLSLVersion () |
Returns the minimum GLSL version supported (base requirement) More... | |
static int | getBaseGLSLVersion (RE_ShaderLanguage lang) |
Returns the minimum GLSL version supported for specific language type. More... | |
static int | determineCodeVersion (const char *shader_string) |
static RE_Shader * | getShader (int program_object) |
Fetch a shader based on GL program id Returns the RE_Shader object with the specified program object if it exists; otherwise, returns nullptr. More... | |
static bool | loadFile (const char *filename, const char *defines, UT_WorkBuffer &src, int &codeversion, UT_String *messages, int default_code_version=0, int max_verts=-1, bool adjust_line_num=false, bool loadingInclude=false, RE_ShaderLanguage lang=RE_SHADER_LANGUAGE_GLSL) |
static bool | getCodeBlock (const char *block_name, UT_StringHolder &block_source, RE_ShaderLanguage lang) |
static void | unregisterProgram (int program_object) |
static void | removeAllTextureRefs (RE_OGLTexture *) |
static int | loadProgramFile (RE_Render *r, const char *file, const char *basepath, UT_String &prog_name, UT_StringArray &files, UT_StringArray &files_names, UT_StringArray &inputs, UT_StringArray &outputs, UT_StringArray &defines, int &codeversion, fpreal &shading_rate, int &max_verts, bool &use_attrib_map, bool &explicit_attrib_map, int max_version, RE_ShaderLanguage &shader_lang, UT_String *msg) |
Protected Member Functions | |
virtual void | removeTextureRefs (RE_OGLTexture *) |
virtual int | getAttributeIndex (const char *name) const |
int | getUniformIndex (const UT_StringHolder &name) const |
bool | loadHoudiniLibraryFuncs (RE_Render *r, UT_String *msg, RE_ShaderLanguage lang) |
const char ** | getTransformFeedbackAttribs (int &num_attribs) |
virtual re_LibFunc * | getShaderLibrary () const |
void | setGeomMaxVerts (int max_verts) |
Static Protected Member Functions | |
static void | registerProgram (RE_Shader *shader, int program_object) |
static RE_Texture * | getDefaultTBO (RE_Render *r) |
static void | scanSourceForFuncs (const char *line, RE_ShaderType shtype, UT_Array< re_NeededLibFuncs > &needed, re_LibFunc *library, int glmajor, int glminor) |
static void | processCodeLine (const char *line, int line_num, const char *defines, UT_WorkBuffer &src, int &codeversion, UT_String *messages, int default_code_version, bool &found_codeversion, int max_verts, bool adjust_line_num, RE_ShaderLanguage lang) |
Transform Feedback | |
Using transform feedback, it is possible to capture vertex or geometry shader outputs and write these values to buffers (RE_VertexArrays). Method to add or remove shader outputs should be called before the shader is linked, otherwise they will cause a re-link of the shader. Note that relinking with clear out any uniform values, so these buffers should be set up early. | |
void | addCaptureGeometry (RE_Geometry *object, bool give_ownership=false) |
Specify an RE_Geometry to collect data from Transform Feedback. Specify a geometry object to hold all the arrays for transform feedback. You retain ownership of the object unless 'give_ownership' is true. If no object is attached when the shader is linked, one will be created for you (with ownership maintained by this shader). More... | |
RE_Geometry * | getCaptureGeometry (bool take_ownership=false) |
Return the capture geometry for transform feedback. More... | |
bool | addFeedbackBuffer (const char *attrib_name) |
Specify a generic attribute to capture during transform feedback. More... | |
bool | removeFeedbackBuffer (const char *attrib_name) |
Remove a generic attribute from the capture geometry. More... | |
void | setFeedbackBufferSize (int num_vertices) |
Will generate a new owned capture geometry if one isn't present. More... | |
void | clearAllFeedbackBuffers () |
Remove all attributes from the capture gemetry. More... | |
bool | hasTransformFeedback () const |
True if this shader has transform feedback varyings available. More... | |
RE_VertexArray * | getFeedbackBuffer (const char *attrib_name) const |
Fetch a vertex array written to by the shader. These are only valid after the shader has been linked for transform feedback (usually due to a draw call). Returns a vertex array for the named feedback buffer. More... | |
bool | isFeedbackBufferUsed (RE_BufferType glattrib, int texlevel=0) const |
Check if a feedback buffer will be written by this shader Returns true if the attribute is available to be captured. Will return false if no buffer was setup to capture the attribute, or the shader does not output that attribute. This method must be called after the shader is linked. More... | |
bool | isFeedbackBufferUsed (const char *attrib) const |
Check if a feedback buffer will be written by this shader Returns true if the attribute is available to be captured. Will return false if no buffer was setup to capture the attribute, or the shader does not output that attribute. This method must be called after the shader is linked. More... | |
Definition at line 59 of file RE_Shader.h.
anonymous enum |
Program name is readable, shader_version may be 0 or a valid GLSL version (110, 120, 130, 140, 150, 330, 400, 410, 420..)
Enumerator | |
---|---|
USE_GLSL_BASE_VERSION | |
USE_SHADER_GLSL_VERSION |
Definition at line 64 of file RE_Shader.h.
RE_Shader::RE_Shader | ( | const char * | program_name, |
int | shader_version | ||
) |
|
virtual |
void RE_Shader::addCaptureGeometry | ( | RE_Geometry * | object, |
bool | give_ownership = false |
||
) |
Specify an RE_Geometry to collect data from Transform Feedback. Specify a geometry object to hold all the arrays for transform feedback. You retain ownership of the object unless 'give_ownership' is true. If no object is attached when the shader is linked, one will be created for you (with ownership maintained by this shader).
bool RE_Shader::addFeedbackBuffer | ( | const char * | attrib_name | ) |
Specify a generic attribute to capture during transform feedback.
RE_ShaderStage* RE_Shader::addShader | ( | RE_Render * | r, |
RE_ShaderType | stype, | ||
const char * | shader_source, | ||
const char * | shader_name, | ||
int | codeversion, | ||
UT_String * | messages = nullptr , |
||
bool | print_source = true , |
||
RE_ShaderLanguage | lang = RE_SHADER_LANGUAGE_GLSL , |
||
bool | preprocess = false |
||
) |
loadShader() loads a shader from an ASCII file. addShader() is used when the source is already available. 'messages' returns the warnings & errors (if any) from shader compilation. Multiple shaders can be attached to the same shader type; it is expected that one is the main shader, and others are functions.
Implemented in RV_VKShader.
|
virtual |
Individual Shader objects can be created separately and attached. returns true if the shader was attached, and false if it was already attached.
Reimplemented in RV_VKShader.
|
inlinevirtual |
Attach a shader storage block to the binding point corresponding to its name. Shader storage blocks should be created with createStorageBlock().
Definition at line 755 of file RE_Shader.h.
|
inlinevirtual |
Attach a GL buffer to the shader storage block binding point that shares its name (getAttributeName()). This method is for simple storage blocks, such as "buffer blockname { vec4 color[]; }".
Definition at line 766 of file RE_Shader.h.
|
inlinevirtual |
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 at line 676 of file RE_Shader.h.
|
inlinevirtual |
Uploads attached uniform blocks that are dirty (uniform modifications) and ensures they are bound to the shader.
Definition at line 695 of file RE_Shader.h.
Bind all builtin uniforms. Bind all builtin uniforms this shader uses to their current values in RE_Render.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1329 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1338 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1317 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1311 of file RE_Shader.h.
|
pure virtual |
Bind a texture to an image slot for reading, writing, or both. Requires RE_EXT_IMAGE_LOAD_STORE (or GL4.2).
Implemented in RV_VKShader.
|
pure virtual |
Bind a texture array layer, cubemap layer, or a 3D texture slice to an image slot for reading, writing, or both. Requires RE_EXT_IMAGE_LOAD_STORE (or GL4.2).
Implemented in RV_VKShader.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1305 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1429 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1435 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1441 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1447 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1453 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1459 of file RE_Shader.h.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Sampler buffer bound to a texture. The shader manages the texture unit assignment, the binding of the texture to the texture unit, and the assingment of the sampler buffer uniform.
Implemented in RV_VKShader.
|
pure virtual |
Bind a texture map using named textures in TIL_TextureMap. You can also bind a texture with its raw OpenGL ID using bindVariableInt().
Bind a new texture object using the mapname (filename, op:/coppath)
Implemented in RV_VKShader.
|
pure virtual |
64b Integer handle for bindless texturing
Implemented in RV_VKShader.
|
virtual |
Bind an RE_Uniform's values to the corresponding GL uniform Bind an RE_Uniform to this shader. If 'uniform' is an array uniform then 'index' specifies which array element to bind. 'index' must be less than uniform->getSize(). Pass -1 for 'index' (the default) to bind all elements of an array; passing -1 for non-arrays is safe and is equivalent to passing 0.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer scalar.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer vector-2.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer vector-3.
Implemented in RV_VKShader.
|
pure virtual |
Generic Integer vector-4.
Implemented in RV_VKShader.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1323 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1350 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1356 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1362 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1368 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1374 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1381 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1387 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1393 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1399 of file RE_Shader.h.
bool RE_Shader::bindVectors | ( | RE_Render * | r, |
const UT_StringHolder & | name, | ||
const UT_Vector3FArray & | vals | ||
) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1408 of file RE_Shader.h.
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1415 of file RE_Shader.h.
bool RE_Shader::bindVectors | ( | RE_Render * | r, |
const UT_StringHolder & | name, | ||
const UT_Vector3DArray & | vals | ||
) |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
|
inline |
Set the value of a uniform. Set uniform value(s) for a specific type. False will be returned if the shader is not linked (errors?), the given name does not exist, or the type does not match the GLSL uniform type.
— Inlines
Definition at line 1422 of file RE_Shader.h.
bool RE_Shader::bindZeroConstant | ( | RE_Render * | r, |
RE_VertexArray * | array | ||
) |
Zero out the constant attribute location given by 'array' Bind a constant zero for this array. If data is non-nullptr, this data is used, otherwise the current constant data for this array is used (default 0's).
Implemented in RV_VKShader.
bool RE_Shader::cleanupAfterDrawing | ( | RE_Render * | r, |
RE_Geometry * | obj = nullptr , |
||
RE_VertexState * | vstate = nullptr , |
||
RE_OverrideList * | atrbover = 0 |
||
) |
void RE_Shader::clearAllFeedbackBuffers | ( | ) |
Remove all attributes from the capture gemetry.
|
virtual |
Clears and deletes all the shader objects of a certain type (or all)
Reimplemented in RV_VKShader.
bool RE_Shader::clearTextureHandle | ( | RE_Render * | r, |
const UT_StringHolder & | uniform_name, | ||
int * | saved_idx = 0 |
||
) |
Remove a bindless handle from the uniform, clearing it to 0 (no tex).
|
inlinevirtual |
Copies the structure of the named uniform block, and possibly the data.
Definition at line 707 of file RE_Shader.h.
|
static |
|
static |
Create a shader and load all shader files listed in shader_files, up to a nullptr filename. If the shader compiles and links, a non-nullptr shader will be returned. 'compile_msg' will contain any error messages otherwise. Shader stages must have extensions .vert, .geom and .frag.
|
static |
A version with a single string containing whitespace-separated filenames.
|
inlinevirtual |
Create a buffer for buffer block 'name'. If it has an open-ended array, array_size specifies the size of that array, othwer it is ignored.
Definition at line 737 of file RE_Shader.h.
|
inlinevirtual |
Detaches all blocks referenced by this shader.
Definition at line 691 of file RE_Shader.h.
|
virtual |
Reimplemented in RV_VKShader.
|
inlinevirtual |
Unbind the block or buffer attached to binding point 'bind_name'.
Definition at line 774 of file RE_Shader.h.
|
inlinevirtual |
Detach a shader storage block from the binding point corresponding to its name.
Definition at line 760 of file RE_Shader.h.
|
inlinevirtual |
Detach a GL buffer from the shader storage block binding point that shares its name (raw_buffer->getAttributeName()).
Definition at line 770 of file RE_Shader.h.
|
inlinevirtual |
Detach a named RE_UniformBlock from this shader Detach a single uniform block by name or pointer. The shader will no longer keep a reference to it, and will not delete it when relinking or when the shader is deleted. Note that a shader must have all blocks attached when executed. Detaching a uniform block does not remove the GL binding to the block, it merely removes this shader's ownership of the block (for performance reasons)
Definition at line 685 of file RE_Shader.h.
|
inlinevirtual |
Detach a specific RE_UniformBlock from this shader.
Definition at line 688 of file RE_Shader.h.
|
static |
determine the version of the shader from the source (#version <num>) return 100 if no version is specified.
|
inline |
Disables the shading rate for this shader. The rate set by RE_Render::setShaderSampleRate() is used instead.
Definition at line 367 of file RE_Shader.h.
UT_StringHolder RE_Shader::findSamplerAtUnit | ( | int | tex_unit | ) | const |
|
inline |
Set anisotropic filtering for textures bound via bindTextureMap()
Definition at line 938 of file RE_Shader.h.
const char* RE_Shader::getAttribNameForLocation | ( | int | loc | ) | const |
Returns the name of a vertex shader input at GL location 'loc'.
bool RE_Shader::getAttribute | ( | const char * | attrib_name, |
int & | location, | ||
RE_GPUType & | type, | ||
int & | size | ||
) | const |
Return information about vertex shader input 'attrib_name' Returns the location and size of the named vertex attribute, or false if it does not exist in this shader. This also includes the GL built-ins, though these will not set location type, or size; only return true/false for their presence in the shader.
bool RE_Shader::getAttributeIndex | ( | int | index, |
UT_String & | name, | ||
int & | location, | ||
RE_GPUType & | type, | ||
int & | size | ||
) | const |
Return information about vertex shader input at 'index' Similar to getAttribute(), but the name of the input does not need to be known. GL builtins are not supported by this method. index must be within [0, getNumAttribs()-1].
|
protectedvirtual |
|
inline |
Return the default GL location of generic vertex attribute 't'.
Definition at line 826 of file RE_Shader.h.
|
inline |
Return the texture sampler unit of a texture buffer object for 't'.
Definition at line 830 of file RE_Shader.h.
|
static |
Returns the minimum GLSL version supported (base requirement)
|
static |
Returns the minimum GLSL version supported for specific language type.
Return the index of the uniform block a uniform is in, -1 for none.
|
inline |
Return the name of texture-buffer object attribute at index 'i'.
Definition at line 844 of file RE_Shader.h.
|
inline |
Definition at line 846 of file RE_Shader.h.
const char* RE_Shader::getBufferTextureName | ( | int | i | ) | const |
Name of the texture buffer object sampler at index 'i'.
RE_GPUType RE_Shader::getBufferTextureType | ( | int | i | ) | const |
Type of the texture buffer object sampler at index 'i' (float, int, uint)
|
inline |
Return the name of GL-builtin vertex shader input at index 'i'.
Definition at line 837 of file RE_Shader.h.
|
inline |
Returns a list of RE_UniformBuiltIn IDs this shader uses.
Definition at line 622 of file RE_Shader.h.
RE_Geometry* RE_Shader::getCaptureGeometry | ( | bool | take_ownership = false | ) |
Return the capture geometry for transform feedback.
|
static |
|
inline |
Returns the version of the shader (110,120,130,140,150,330,400,410).
Definition at line 144 of file RE_Shader.h.
|
staticprotected |
|
inline |
Any define commands used to alter this shader.
Definition at line 132 of file RE_Shader.h.
RE_VertexArray* RE_Shader::getFeedbackBuffer | ( | const char * | attrib_name | ) | const |
Fetch a vertex array written to by the shader. These are only valid after the shader has been linked for transform feedback (usually due to a draw call). Returns a vertex array for the named feedback buffer.
|
inline |
Fetch current geometry shader values. Return the geometry shader parameters specified by setGeometryParms() or the shader itself (via layout(in=triangles), etc).
Definition at line 275 of file RE_Shader.h.
|
inline |
Cached RE_LightList information (uniform blocks)
Definition at line 967 of file RE_Shader.h.
|
inline |
Bumped every time a link is performed (uniforms invalidated, etc).
Definition at line 235 of file RE_Shader.h.
|
inline |
Limit the resolution of the textures to a max width and height.
Definition at line 919 of file RE_Shader.h.
|
inline |
Limit the resolution of the textures to a max width and height.
Definition at line 918 of file RE_Shader.h.
Returns the OpenGL maximum number of supported blocks.
Definition at line 649 of file RE_Shader.h.
Returns the OpenGL maximum size of a uniform block, in bytes.
Definition at line 652 of file RE_Shader.h.
|
virtual |
Returns the amount of main memory (NOT graphics memory!) owned by this RE_Shader.
Reimplemented in RV_VKShader.
|
inline |
Readable name of the shader.
Definition at line 129 of file RE_Shader.h.
|
inline |
Return the number of texture-buffer object attributes.
Definition at line 841 of file RE_Shader.h.
int RE_Shader::getNumBufferTextures | ( | ) | const |
Return the number of texture buffer object samplers in this shader.
|
inline |
Return the number of GL-builtin vertex shader inputs (gl_Vertex, gl_*)
Definition at line 834 of file RE_Shader.h.
|
inline |
Return the number of image samplers this shader references (GL4.2 shader load/store images, not regular texture samplers)
Definition at line 438 of file RE_Shader.h.
|
inline |
Return the number of vertex shader input attributes.
Definition at line 784 of file RE_Shader.h.
|
inline |
Return the number of samplers this shader references.
Definition at line 434 of file RE_Shader.h.
int RE_Shader::getNumTextures | ( | RE_ShaderType | stage | ) | const |
Returns the number of texture samplers used by shader 'stage'. As RE_ShaderType is a bitfield, multiple stages can be queried at once and the sum will be returned. Requires RE_EXT_PROGRAM_INTERFACE_QUERY.
|
inlinevirtual |
Returns the number of blocks and specific uniform blocks.
Definition at line 656 of file RE_Shader.h.
|
inline |
Returns the number of active uniforms in this shader.
Definition at line 475 of file RE_Shader.h.
|
inlinevirtual |
Return the currently bound override block for an index, if any is bound.
Definition at line 731 of file RE_Shader.h.
|
inline |
Raw GL id of the shader.
Definition at line 135 of file RE_Shader.h.
RE_ShaderStage* RE_Shader::getShader | ( | const char * | shader_name, |
RE_ShaderType | hint = RE_SHADER_ALL |
||
) |
Returns an attached shader by the given name.
Fetch a shader based on GL program id Returns the RE_Shader object with the specified program object if it exists; otherwise, returns nullptr.
|
inline |
Return the ID of the attribute if it is a known type, or RE_GENATTRIB_UNDEF if it is not.
Definition at line 1465 of file RE_Shader.h.
Return the GL attribute location of vertex shader input at index 'i'.
Definition at line 799 of file RE_Shader.h.
|
inline |
Return an int array of all vertex shader input locations.
Definition at line 815 of file RE_Shader.h.
|
inline |
Return the name of vertex shader input at index 'i'.
Definition at line 791 of file RE_Shader.h.
|
inline |
Return a string array of all vertex shader input names.
Definition at line 811 of file RE_Shader.h.
Return the vector size of vertex shader input at index 'i'.
Definition at line 807 of file RE_Shader.h.
|
inline |
Return an int array of all vertex shader input sizes.
Definition at line 819 of file RE_Shader.h.
|
inline |
Return the type of vertex shader input at index 'i'.
Definition at line 803 of file RE_Shader.h.
|
protectedvirtual |
Reimplemented in RV_VKShader.
void RE_Shader::getShaderSource | ( | RE_Render * | r, |
UT_String & | source, | ||
RE_ShaderType | sh = RE_SHADER_ALL |
||
) |
Returns the shader source of some or all attached shaders.
|
inline |
For multisampled framebuffers, this sets the fraction of samples that should be shaded by a fragment shader, from 0.0 to 1.0. For example, setting this to 0.5 would guarentee at least 4 color samples for a 8x multisample buffer. The default is 0.0 (1 color sample, N coverage) This only has an effect on GL4 hardware. It is ignored unless RE_EXT_SAMPLE_SHADING is supported.
Definition at line 360 of file RE_Shader.h.
|
inlinevirtual |
Return the block definition for storage block 'name'.
Definition at line 742 of file RE_Shader.h.
|
inlinevirtual |
Return the storage block bound to 'name' (bound by attachStorageBlock)
Definition at line 746 of file RE_Shader.h.
|
inlinevirtual |
Return the raw buffer bound to 'name' (bound by attachStorageBlock)
Definition at line 750 of file RE_Shader.h.
|
inline |
Override texture compression for texture bound via bindTextureMap()
Definition at line 908 of file RE_Shader.h.
|
pure virtual |
Return the texture type for the sampler named 'name'.
Implemented in RV_VKShader.
const char* RE_Shader::getTextureSamplerName | ( | int | tex_index | ) | const |
Return the name of a sampler uniform Return the texture sampler name of the enumerated samplers at 'tex_index' Must be within [0, getNumTextures()-1].
RE_TextureDimension RE_Shader::getTextureSamplerType | ( | int | tex_index | ) | const |
Return the texture sampler type at 'tex_index' [0, getNumTextures()-1].
|
inline |
Scale by a constant scale factor for textures bound via bindTextureMap()
Definition at line 925 of file RE_Shader.h.
|
protected |
|
inlinevirtual |
Return an attached uniform block by index.
Definition at line 659 of file RE_Shader.h.
|
inlinevirtual |
Return an attached uniform block by name.
Definition at line 662 of file RE_Shader.h.
|
inlinevirtual |
Returns the block binding point of the named block.
Definition at line 666 of file RE_Shader.h.
int RE_Shader::getUniformImageUnit | ( | const UT_StringHolder & | uniform_name | ) | const |
return the image unit of sampler 'uniform_name' Return the image unit this image uniform has been assigned to, or -1 if 'uniform_name' does not exist, or is not a image uniform. Images are different than textures, used by RE_EXT_IMAGE_LOAD_STORE (GL4.2).
|
protected |
Return the GL uniform location of uniform 'idx' [0, getNumUniforms()-1].
const char* RE_Shader::getUniformName | ( | int | idx | ) | const |
Returns the name of active uniform 'idx' [0, getNumUniforms()-1].
int RE_Shader::getUniformTextureUnit | ( | const UT_StringHolder & | uniform_name, |
int | array_index = 0 |
||
) | const |
return the texture unit of sampler 'uniform_name' Return the texture unit this sampler has been assigned to, or -1 if 'uniform_name' does not exist, or is not a sampler. array_index is used to identify indices of sampler arrays.
RE_UniformType RE_Shader::getUniformType | ( | const UT_StringHolder & | uniform_name | ) | const |
Return the uniform type of the uniform named 'uniform_name', or RE_UNIFORM_INVALID if it does not exist.
RE_UniformType RE_Shader::getUniformType | ( | int | idx | ) | const |
Return the GL uniform type 'idx' [ 0, getNumUniforms()-1].
|
inline |
Definition at line 70 of file RE_Shader.h.
|
inline |
Simpler version of getAttribute() - just returns if the attribute exists.
Definition at line 869 of file RE_Shader.h.
bool RE_Shader::hasBufferTexture | ( | const char * | name | ) | const |
True if the shader has a texture buffer object sampler named 'name'.
bool RE_Shader::hasBuiltInUniform | ( | RE_UniformBuiltIn | uniform | ) | const |
Queries the use of a builtin uniform Returns true if this shader has the specified built-in uniform. 'uniform' must be an RE_UniformBuiltIn. Note that certain built-in uniforms may only be supported for certain languages.
bool RE_Shader::hasShader | ( | RE_ShaderType | type | ) | const |
Returns true if this shader program has a shader of 'type' attached. type may be a bitmask of shader types, in which case it returns true if any of the shader types exist.
|
inline |
Return if the vertex shader has input attributes.
Definition at line 780 of file RE_Shader.h.
|
inline |
Definition at line 787 of file RE_Shader.h.
bool RE_Shader::hasTransformFeedback | ( | ) | const |
True if this shader has transform feedback varyings available.
bool RE_Shader::hasUniform | ( | const UT_StringHolder & | uniform_name | ) | const |
returns true if the named uniform exists in the shader.
|
inlinevirtual |
Initialize a uniform block based on this shader's block layout Initializes a uniform block with the proper offsets and size for block index 'index'. If index is -1, block must have the name of one of the uniform blocks in the shader.
Definition at line 701 of file RE_Shader.h.
void RE_Shader::invalidateUniform | ( | RE_UniformBuiltIn | uniform | ) |
Called to invalidate the cached uniform, usually by RE_Uniform::unregisterBuiltIn().
bool RE_Shader::isFeedbackBufferUsed | ( | RE_BufferType | glattrib, |
int | texlevel = 0 |
||
) | const |
Check if a feedback buffer will be written by this shader Returns true if the attribute is available to be captured. Will return false if no buffer was setup to capture the attribute, or the shader does not output that attribute. This method must be called after the shader is linked.
bool RE_Shader::isFeedbackBufferUsed | ( | const char * | attrib | ) | const |
Check if a feedback buffer will be written by this shader Returns true if the attribute is available to be captured. Will return false if no buffer was setup to capture the attribute, or the shader does not output that attribute. This method must be called after the shader is linked.
|
inline |
True if the shader has been successfully linked.
Definition at line 141 of file RE_Shader.h.
|
inline |
For multisampled framebuffers, this sets the fraction of samples that should be shaded by a fragment shader, from 0.0 to 1.0. For example, setting this to 0.5 would guarentee at least 4 color samples for a 8x multisample buffer. The default is 0.0 (1 color sample, N coverage) This only has an effect on GL4 hardware. It is ignored unless RE_EXT_SAMPLE_SHADING is supported.
Definition at line 362 of file RE_Shader.h.
Limit the resolution of the textures to a max width and height.
|
inline |
Limit the resolution of the textures to a max width and height.
Definition at line 916 of file RE_Shader.h.
Links all the shaders together; called implicitly if needed by RE_Render::setShader(). Note that linking the shader will clear out any uniforms that have been set.
Reimplemented in RV_VKShader.
Implemented in RV_VKShader.
|
static |
|
protected |
|
static |
RE_ShaderStage* RE_Shader::loadShader | ( | RE_Render * | r, |
RE_ShaderType | stype, | ||
const char * | filename, | ||
UT_String * | messages = nullptr , |
||
const char * | shader_name = nullptr , |
||
const char * | defines = "" , |
||
int | default_code_version = USE_GLSL_BASE_VERSION , |
||
int | geom_max_verts = -1 , |
||
RE_ShaderLanguage | lang = RE_SHADER_LANGUAGE_GLSL , |
||
bool | print_source = true |
||
) |
loadShader() loads a shader from an ASCII file. addShader() is used when the source is already available. 'messages' returns the warnings & errors (if any) from shader compilation. Multiple shaders can be attached to the same shader type; it is expected that one is the main shader, and others are functions.
Loads texture maps specified by the RE_TextureMap bindTextureMap()
Implemented in RV_VKShader.
Cached RE_LightList information (uniform blocks)
|
inline |
Enable or disable mipmapping for textures bound via bindTextureMap()
Definition at line 930 of file RE_Shader.h.
|
inline |
Enable or disable mipmapping for textures bound via bindTextureMap()
Definition at line 931 of file RE_Shader.h.
|
pure virtual |
Allocate a new shader stage of the specified type, with an optional readable name.
Implemented in RV_VKShader.
|
inlinevirtual |
Override the currently bound uniform block without deleting the block currently residing at that index. If 'block_index' is -1, the name of the block is used to find the block index. Only one override can be active at once. Passing nullptr for the block clears the override.
Definition at line 720 of file RE_Shader.h.
bool RE_Shader::prepForDrawing | ( | RE_Render * | r, |
RE_Geometry * | obj = nullptr , |
||
RE_ElementArray * | element = nullptr , |
||
RE_VertexState * | state = nullptr , |
||
unsigned int | vertex_stride = 0 , |
||
RE_OverrideList * | atrbover = 0 , |
||
int | instance_group = 0 |
||
) |
Prepare this shader for rendering Binds uniform buffer objects and all builtin uniforms. Optionally re-binds vertex attribute locations in 'obj'.
void RE_Shader::printAttributes | ( | std::ostream * | os = nullptr | ) | const |
|
inlinevirtual |
Prints all the active uniforms plus their values to stream os (or cerr)
Reimplemented in RV_VKShader.
Definition at line 636 of file RE_Shader.h.
|
staticprotected |
|
static |
bool RE_Shader::removeFeedbackBuffer | ( | const char * | attrib_name | ) |
Remove a generic attribute from the capture geometry.
Remove an override block from the shader, by index.
Definition at line 724 of file RE_Shader.h.
|
inlinevirtual |
Remove a specific override block from the shader.
Definition at line 726 of file RE_Shader.h.
|
inlinevirtual |
Remove all override blocks from the shader.
Definition at line 728 of file RE_Shader.h.
Implemented in RV_VKShader.
|
inlineprotectedvirtual |
Definition at line 1021 of file RE_Shader.h.
|
virtual |
COMPUTE.
|
virtual |
|
staticprotected |
Set anisotropic filtering for textures bound via bindTextureMap()
Definition at line 936 of file RE_Shader.h.
Will generate a new owned capture geometry if one isn't present.
|
virtual |
bind fragment shader output 'name' to color attachment 'buffer_index'. Must be called before linking. Only needed for custom fragment output (ie, not gl_FragData[] or gl_FragColor).
Reimplemented in RV_VKShader.
|
virtual |
Specify geometry shader parameters.
Reimplemented in RV_VKShader.
Definition at line 1073 of file RE_Shader.h.
Cached RE_LightList information (uniform blocks)
void RE_Shader::setRegisterProgram | ( | bool | register_program | ) |
If true, register this shader so that RE_Shader::getShader() can find this shader (default is true).
For multisampled framebuffers, this sets the fraction of samples that should be shaded by a fragment shader, from 0.0 to 1.0. For example, setting this to 0.5 would guarentee at least 4 color samples for a 8x multisample buffer. The default is 0.0 (1 color sample, N coverage) This only has an effect on GL4 hardware. It is ignored unless RE_EXT_SAMPLE_SHADING is supported.
Definition at line 358 of file RE_Shader.h.
|
inline |
Override texture compression for texture bound via bindTextureMap()
Definition at line 909 of file RE_Shader.h.
bool RE_Shader::setTextureHandle | ( | RE_Render * | r, |
const UT_StringHolder & | uniform_name, | ||
RE_Texture * | texture, | ||
int * | saved_idx = 0 |
||
) |
assign a bindless texture to its handle uniform. 'texture' must have a texture handle, and uniform_name must refer to a texture handle.
Scale by a constant scale factor for textures bound via bindTextureMap()
Definition at line 924 of file RE_Shader.h.
bool RE_Shader::setUniformTextureUnit | ( | RE_Render * | r, |
const UT_StringHolder & | uniform_name, | ||
int | unit_index | ||
) |
Set a binding point for the given sampler.
|
virtual |
bind vertex shader input 'name' to vertex array index 'vertex_index'. Must be called before linking, or a re-link must be done.
Reimplemented in RV_VKShader.
Implemented in RV_VKShader.
|
inlinevirtual |
Update an offset/name/size information in 'b' with the uniforms for the correspondingly-named uniform block in this shader.
Definition at line 713 of file RE_Shader.h.
void RE_Shader::useDefaultAttribMap | ( | bool | enable = true | ) |
If true, this shader follows the default Houdini attribute map.
void RE_Shader::useExplicitAttribMap | ( | bool | enable = true | ) |
If true, this shader defines its own attribute locations in shader code Do not move any attributes.
void RE_Shader::useHoudiniLibraryFuncs | ( | ) |
If true, this shader may use Houdini's builtin functions.
Ensures that the shader can run given the current GL state. This mostly deals with texture bindings matching what is expected by the shader. If this returns false, the shader will not run, and 'messages' can be used to fetch the reason.
Reimplemented in RV_VKShader.
|
protected |
Definition at line 1109 of file RE_Shader.h.
|
protected |
Definition at line 1108 of file RE_Shader.h.
|
protected |
Definition at line 1105 of file RE_Shader.h.
|
protected |
Definition at line 1111 of file RE_Shader.h.
|
protected |
Definition at line 1110 of file RE_Shader.h.
|
protected |
Definition at line 1120 of file RE_Shader.h.
|
protected |
Definition at line 1121 of file RE_Shader.h.
|
protected |
Definition at line 1107 of file RE_Shader.h.
|
protected |
Definition at line 1106 of file RE_Shader.h.
|
protected |
Definition at line 1128 of file RE_Shader.h.
|
protected |
Definition at line 1104 of file RE_Shader.h.
|
protected |
Definition at line 1117 of file RE_Shader.h.
|
protected |
Definition at line 1123 of file RE_Shader.h.
|
protected |
Definition at line 1115 of file RE_Shader.h.
|
protected |
Definition at line 1124 of file RE_Shader.h.
|
protected |
Definition at line 1116 of file RE_Shader.h.
|
protected |
Definition at line 1131 of file RE_Shader.h.
|
protected |
Definition at line 1096 of file RE_Shader.h.
|
protected |
Definition at line 1147 of file RE_Shader.h.
|
protected |
Definition at line 1078 of file RE_Shader.h.
|
protected |
Definition at line 1112 of file RE_Shader.h.
|
protected |
Definition at line 1095 of file RE_Shader.h.
|
protected |
Definition at line 1094 of file RE_Shader.h.
|
protected |
Definition at line 1101 of file RE_Shader.h.
|
protected |
Definition at line 1100 of file RE_Shader.h.
|
protected |
Definition at line 1102 of file RE_Shader.h.
|
protected |
Definition at line 1139 of file RE_Shader.h.
|
protected |
Definition at line 1144 of file RE_Shader.h.
|
protected |
Definition at line 1143 of file RE_Shader.h.
|
protected |
Definition at line 1142 of file RE_Shader.h.
|
protected |
Definition at line 1085 of file RE_Shader.h.
|
protected |
Definition at line 1080 of file RE_Shader.h.
|
protected |
Definition at line 1086 of file RE_Shader.h.
|
protected |
Definition at line 1086 of file RE_Shader.h.
|
protected |
Definition at line 1088 of file RE_Shader.h.
|
protected |
Definition at line 1130 of file RE_Shader.h.
|
protected |
Definition at line 1098 of file RE_Shader.h.
|
protected |
Definition at line 1077 of file RE_Shader.h.
|
protected |
Definition at line 1079 of file RE_Shader.h.
|
protected |
Definition at line 1083 of file RE_Shader.h.
|
protected |
Definition at line 1125 of file RE_Shader.h.
|
protected |
Definition at line 1141 of file RE_Shader.h.
|
protected |
Definition at line 1137 of file RE_Shader.h.
|
protected |
Definition at line 1092 of file RE_Shader.h.
|
protected |
Definition at line 1093 of file RE_Shader.h.
|
protected |
Definition at line 1084 of file RE_Shader.h.
|
protected |
Definition at line 1089 of file RE_Shader.h.
|
protected |
Definition at line 1087 of file RE_Shader.h.
|
protected |
Definition at line 1138 of file RE_Shader.h.
|
protected |
Definition at line 1133 of file RE_Shader.h.
|
protected |
Definition at line 1134 of file RE_Shader.h.
|
protected |
Definition at line 1135 of file RE_Shader.h.
|
protected |
Definition at line 1119 of file RE_Shader.h.
|
protected |
Definition at line 1114 of file RE_Shader.h.
|
protected |
Definition at line 1118 of file RE_Shader.h.
|
protected |
Definition at line 1145 of file RE_Shader.h.
|
protected |
Definition at line 1081 of file RE_Shader.h.
|
protected |
Definition at line 1082 of file RE_Shader.h.
|
protected |
Definition at line 1127 of file RE_Shader.h.
|
protected |
Definition at line 1091 of file RE_Shader.h.
|
protected |
Definition at line 1148 of file RE_Shader.h.