HDK
|
Simple interface to building a shader from a .prog file. More...
#include <RE_ShaderHandle.h>
Public Member Functions | |
RE_ShaderHandle (const char *program_file, bool register_shader=true, const char *defines=nullptr) | |
Create a shader handle using a .prog file. More... | |
RE_ShaderHandle (const char *program_name, int code_version, const char *files, bool register_shader=true, const char *defines=nullptr) | |
RE_ShaderHandle (const RE_ShaderHandle &handle) | |
~RE_ShaderHandle () | |
RE_Shader * | operator-> () |
void | setProgramDefines (const char *defines) |
Set the defines for the program, overwriting existing ones. More... | |
void | appendProgramDefines (const char *defines) |
Add more defines to the defines list. More... | |
void | setShaderLanguage (RE_ShaderLanguage lang) |
Default language is GLSL. More... | |
bool | isInitialized () const |
bool | isValid (RE_Render *r) |
bool | compile (RE_Render *r) |
int | getCodeVersion () const |
Returns the GLSL or Cg version that the shader was compiled with. More... | |
RE_Shader * | getShader () const |
void | printErrors (std::ostream &os) const |
Prints this shader's errors, warnings and messages. More... | |
const char * | getErrors () const |
const char * | getName () const |
Name of the shader (if any) or the .prog pathname. More... | |
const char * | getSourceFiles () const |
const char * | getDefines () const |
UT_UniquePtr< RE_Shader > | createDetachedShader (RE_Render *r, UT_String *errors=nullptr) const |
Static Public Member Functions | |
static const char * | getSystemDefines (RE_Render *r) |
Returns a list of #defines for platform, vendor, driver version. More... | |
Simple interface to building a shader from a .prog file.
Definition at line 77 of file RE_ShaderHandle.h.
RE_ShaderHandle::RE_ShaderHandle | ( | const char * | program_file, |
bool | register_shader = true , |
||
const char * | defines = nullptr |
||
) |
Create a shader handle using a .prog file.
RE_ShaderHandle::RE_ShaderHandle | ( | const char * | program_name, |
int | code_version, | ||
const char * | files, | ||
bool | register_shader = true , |
||
const char * | defines = nullptr |
||
) |
Create a shader handle with source files. All source files must share the same GLSL version (100,110,120,130,140,150,330,400,410...) and be whitespace separated in the string.
RE_ShaderHandle::RE_ShaderHandle | ( | const RE_ShaderHandle & | handle | ) |
RE_ShaderHandle::~RE_ShaderHandle | ( | ) |
Add more defines to the defines list.
Definition at line 107 of file RE_ShaderHandle.h.
bool RE_ShaderHandle::compile | ( | RE_Render * | r | ) |
Explicitly compile the shader. Has no effect if the shader is already compiled. Returns true if the shader compiled successfully or was already compiled, or false if the compile failed or previously failed.
UT_UniquePtr<RE_Shader> RE_ShaderHandle::createDetachedShader | ( | RE_Render * | r, |
UT_String * | errors = nullptr |
||
) | const |
Create a shader that is owner by the caller If the shader failed to compile, then an empty pointer is returned.
|
inline |
Returns the GLSL or Cg version that the shader was compiled with.
Definition at line 132 of file RE_ShaderHandle.h.
|
inline |
Definition at line 149 of file RE_ShaderHandle.h.
|
inline |
Returns a NUL-terminated string of errors. Empty string if no errors exist, or if the shader has not been compiled yet.
Definition at line 143 of file RE_ShaderHandle.h.
|
inline |
Returns the shader for this handle. Will return nullptr if the shader did not compile.
Definition at line 136 of file RE_ShaderHandle.h.
|
inline |
Definition at line 148 of file RE_ShaderHandle.h.
Returns a list of #defines for platform, vendor, driver version.
Definition at line 158 of file RE_ShaderHandle.h.
|
inline |
Returns true if the shader was initialized. The shader still may be invalid (compiled improperly).
Definition at line 115 of file RE_ShaderHandle.h.
|
inline |
Returns true if the shader successfully compiled. This may force a compile.
Definition at line 119 of file RE_ShaderHandle.h.
|
inline |
Definition at line 97 of file RE_ShaderHandle.h.
void RE_ShaderHandle::printErrors | ( | std::ostream & | os | ) | const |
Prints this shader's errors, warnings and messages.
Set the defines for the program, overwriting existing ones.
Definition at line 104 of file RE_ShaderHandle.h.
void RE_ShaderHandle::setShaderLanguage | ( | RE_ShaderLanguage | lang | ) |
Default language is GLSL.