xoreos
0.0.5
|
The global shader manager. More...
#include <vector>
#include <map>
#include "src/common/ustring.h"
#include "src/common/singleton.h"
#include "src/common/mutex.h"
#include "src/graphics/texture.h"
#include "src/graphics/aurora/texturehandle.h"
#include "src/graphics/shader/shaderbuilder.h"
Go to the source code of this file.
Classes | |
struct | Graphics::Shader::ShaderUBO |
struct | Graphics::Shader::ShaderSampler |
Shader sampler is used to bind a texture to a texture unit. More... | |
class | Graphics::Shader::ShaderObject |
struct | Graphics::Shader::ShaderObject::ShaderObjectVariable |
class | Graphics::Shader::ShaderProgram |
class | Graphics::Shader::ShaderManager |
The shader manager. More... | |
Namespaces | |
Graphics | |
Graphics::Shader | |
Macros | |
#define | ShaderMan Graphics::Shader::ShaderManager::instance() |
Shortcut for accessing the shader manager. More... | |
The global shader manager.
Developer's Notes: This form of shader handling is absolute overkill for xoreos. It's based upon code developed for a different project, then plugged into xoreos to save some wheel reinvention. It is, however, rather flexible and should be able to cleanly handle any quirks from any of the particular engines.
The basic idea:
Uniform Buffer Objects UBO's are parsed out and treated as a single variable, similar to a texture sampler. The user themselves must specify both the UBO id to attach, and the attachment location. Index binding within the shader is possible, but discouraged here. It's an OpenGL >=4.2 feature, and while it would cut down on a little bit of overhead, the target version for xoreos is OpenGL 3.2 (maybe 3.3).
To anyone thinking that program introspection would replace much of this, well yes and no. Again, the original idea behind this code involved knowing what uniforms would be available prior to the program linker stage. Uniforms stripped out during the linker phase are pretty much ignored when binding a shader here, so that's not a worry. The methods here also allow a common shader object instance (e.g fragment shader) to be bound across multiple programs (this is where unused uniforms being ignored comes in).
Definition in file shader.h.
#define ShaderMan Graphics::Shader::ShaderManager::instance() |
Shortcut for accessing the shader manager.
Definition at line 293 of file shader.h.
Referenced by Graphics::Aurora::ABCFont::ABCFont(), Graphics::Shader::ShaderInstance::bind(), Graphics::Shader::ShaderMaterial::bindFade(), Graphics::Shader::ShaderSurface::bindObjectModelview(), Graphics::Shader::ShaderSurface::bindProgram(), Graphics::Shader::ShaderMaterial::bindProgram(), Graphics::Shader::ShaderMaterial::bindProgramNoFade(), Graphics::Shader::ShaderSurface::bindTextureView(), Graphics::Aurora::ModelNode_Witcher::buildMaterial(), Graphics::Aurora::ModelNode::buildMaterial(), Graphics::GraphicsManager::deinit(), Graphics::Shader::ShaderProgram::doRebuild(), Graphics::Shader::MaterialManager::init(), Graphics::GraphicsManager::init(), Graphics::Shader::ShaderManager::init(), Engines::NWN::Portrait::Portrait(), Graphics::Shader::ShaderInstance::rebindFragmentVariable(), Graphics::Shader::ShaderInstance::rebindVertexVariable(), Graphics::Shader::ShaderInstance::ShaderInstance(), Graphics::Shader::SurfaceManager::SurfaceManager(), Graphics::Aurora::TextureFont::TextureFont(), and Graphics::Shader::ShaderRenderable::updateProgram().