Simple interface to building a shader from a .prog file.
More...
#include <RE_ShaderHandle.h>
|
| RE_ShaderHandle (const char *program_file, bool register_shader=true, const char *defines=nullptr, RE_ShaderLanguage lang=RE_SHADER_LANGUAGE_GLSL) |
| 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_ShaderLanguage lang=RE_SHADER_LANGUAGE_GLSL) |
|
| RE_ShaderHandle (const RE_ShaderHandle &handle) |
|
virtual | ~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, UT_WorkBuffer *msg=nullptr) |
|
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 |
|
Simple interface to building a shader from a .prog file.
- Examples:
- tetprim/GR_PrimTetra.C.
Definition at line 77 of file RE_ShaderHandle.h.
Create a shader handle using a .prog file.
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.
virtual RE_ShaderHandle::~RE_ShaderHandle |
( |
| ) |
|
|
virtual |
void RE_ShaderHandle::appendProgramDefines |
( |
const char * |
defines | ) |
|
|
inline |
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.
Create a shader that is owner by the caller If the shader failed to compile, then an empty pointer is returned.
int RE_ShaderHandle::getCodeVersion |
( |
| ) |
const |
|
inline |
Returns the GLSL or Cg version that the shader was compiled with.
Definition at line 134 of file RE_ShaderHandle.h.
const char* RE_ShaderHandle::getDefines |
( |
| ) |
const |
|
inline |
const char* RE_ShaderHandle::getErrors |
( |
| ) |
const |
|
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 145 of file RE_ShaderHandle.h.
const char* RE_ShaderHandle::getName |
( |
| ) |
const |
Name of the shader (if any) or the .prog pathname.
RE_Shader* RE_ShaderHandle::getShader |
( |
| ) |
const |
|
inline |
Returns the shader for this handle. Will return nullptr if the shader did not compile.
Definition at line 138 of file RE_ShaderHandle.h.
const char* RE_ShaderHandle::getSourceFiles |
( |
| ) |
const |
|
inline |
static const char* RE_ShaderHandle::getSystemDefines |
( |
RE_Render * |
r | ) |
|
|
inlinestatic |
Returns a list of #defines for platform, vendor, driver version.
Definition at line 160 of file RE_ShaderHandle.h.
static void RE_ShaderHandle::initializeDriverInformation |
( |
RE_Render * |
r | ) |
|
|
staticprotected |
bool RE_ShaderHandle::isInitialized |
( |
| ) |
const |
|
inline |
Returns true if the shader was initialized. The shader still may be invalid (compiled improperly).
Definition at line 117 of file RE_ShaderHandle.h.
bool RE_ShaderHandle::isValid |
( |
RE_Render * |
r | ) |
|
|
inline |
Returns true if the shader successfully compiled. This may force a compile.
Definition at line 121 of file RE_ShaderHandle.h.
void RE_ShaderHandle::printErrors |
( |
std::ostream & |
os | ) |
const |
Prints this shader's errors, warnings and messages.
void RE_ShaderHandle::setProgramDefines |
( |
const char * |
defines | ) |
|
|
inline |
Set the defines for the program, overwriting existing ones.
Definition at line 106 of file RE_ShaderHandle.h.
Default language is GLSL.
int RE_ShaderHandle::myCodeVersion |
|
protected |
bool RE_ShaderHandle::myInitFlag |
|
protected |
bool RE_ShaderHandle::myRegisterFlag |
|
protected |
The documentation for this class was generated from the following file: