KWin
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
KWin::GLShader Class Reference

#include <glshader.h>

Public Types

enum  Flags { NoFlags = 0 , ExplicitLinking = (1 << 0) }
 
enum class  Mat3Uniform
 
enum class  Mat4Uniform {
  TextureMatrix = 0 , ProjectionMatrix , ModelViewMatrix , ModelViewProjectionMatrix ,
  WindowTransformation , ScreenTransformation , ColorimetryTransformation , MatrixCount
}
 
enum class  Vec2Uniform { Offset , Vec2UniformCount }
 
enum class  Vec3Uniform { PrimaryBrightness = 0 }
 
enum class  Vec4Uniform { ModulationConstant , Vec4UniformCount }
 
enum class  FloatUniform { Saturation , MaxHdrBrightness , SdrBrightness , FloatUniformCount }
 
enum class  IntUniform {
  AlphaToOne , TextureWidth , TextureHeight , SourceNamedTransferFunction ,
  DestinationNamedTransferFunction , Sampler , Sampler1 , IntUniformCount
}
 
enum class  ColorUniform { Color , ColorUniformCount }
 

Public Member Functions

 GLShader (const QString &vertexfile, const QString &fragmentfile, unsigned int flags=NoFlags)
 
 ~GLShader ()
 
bool isValid () const
 
void bindAttributeLocation (const char *name, int index)
 
void bindFragDataLocation (const char *name, int index)
 
bool link ()
 
int uniformLocation (const char *name)
 
bool setUniform (const char *name, float value)
 
bool setUniform (const char *name, int value)
 
bool setUniform (const char *name, const QVector2D &value)
 
bool setUniform (const char *name, const QVector3D &value)
 
bool setUniform (const char *name, const QVector4D &value)
 
bool setUniform (const char *name, const QMatrix4x4 &value)
 
bool setUniform (const char *name, const QColor &color)
 
bool setUniform (int location, float value)
 
bool setUniform (int location, int value)
 
bool setUniform (int location, int xValue, int yValue, int zValue)
 
bool setUniform (int location, const QVector2D &value)
 
bool setUniform (int location, const QVector3D &value)
 
bool setUniform (int location, const QVector4D &value)
 
bool setUniform (int location, const QMatrix3x3 &value)
 
bool setUniform (int location, const QMatrix4x4 &value)
 
bool setUniform (int location, const QColor &value)
 
int attributeLocation (const char *name)
 
bool setAttribute (const char *name, float value)
 
QMatrix4x4 getUniformMatrix4x4 (const char *name)
 
bool setUniform (Mat3Uniform uniform, const QMatrix3x3 &value)
 
bool setUniform (Mat4Uniform uniform, const QMatrix4x4 &matrix)
 
bool setUniform (Vec2Uniform uniform, const QVector2D &value)
 
bool setUniform (Vec3Uniform uniform, const QVector3D &value)
 
bool setUniform (Vec4Uniform uniform, const QVector4D &value)
 
bool setUniform (FloatUniform uniform, float value)
 
bool setUniform (IntUniform uniform, int value)
 
bool setUniform (ColorUniform uniform, const QVector4D &value)
 
bool setUniform (ColorUniform uniform, const QColor &value)
 
bool setColorspaceUniforms (const ColorDescription &src, const ColorDescription &dst)
 
bool setColorspaceUniformsFromSRGB (const ColorDescription &dst)
 
bool setColorspaceUniformsToSRGB (const ColorDescription &src)
 

Protected Member Functions

 GLShader (unsigned int flags=NoFlags)
 
bool loadFromFiles (const QString &vertexfile, const QString &fragmentfile)
 
bool load (const QByteArray &vertexSource, const QByteArray &fragmentSource)
 
const QByteArray prepareSource (GLenum shaderType, const QByteArray &sourceCode) const
 
bool compile (GLuint program, GLenum shaderType, const QByteArray &sourceCode) const
 
void bind ()
 
void unbind ()
 
void resolveLocations ()
 

Friends

class ShaderManager
 

Detailed Description

Definition at line 25 of file glshader.h.

Member Enumeration Documentation

◆ ColorUniform

enum class KWin::GLShader::ColorUniform
strong
Enumerator
Color 
ColorUniformCount 

Definition at line 120 of file glshader.h.

◆ Flags

Enumerator
NoFlags 
ExplicitLinking 

Definition at line 28 of file glshader.h.

◆ FloatUniform

enum class KWin::GLShader::FloatUniform
strong
Enumerator
Saturation 
MaxHdrBrightness 
SdrBrightness 
FloatUniformCount 

Definition at line 102 of file glshader.h.

◆ IntUniform

enum class KWin::GLShader::IntUniform
strong
Enumerator
AlphaToOne 
Deprecated
no longer used
TextureWidth 
TextureHeight 
SourceNamedTransferFunction 
DestinationNamedTransferFunction 
Sampler 
Sampler1 
IntUniformCount 

Definition at line 109 of file glshader.h.

◆ Mat3Uniform

enum class KWin::GLShader::Mat3Uniform
strong

Definition at line 74 of file glshader.h.

◆ Mat4Uniform

enum class KWin::GLShader::Mat4Uniform
strong
Enumerator
TextureMatrix 
ProjectionMatrix 
ModelViewMatrix 
ModelViewProjectionMatrix 
WindowTransformation 
ScreenTransformation 
ColorimetryTransformation 
MatrixCount 

Definition at line 77 of file glshader.h.

◆ Vec2Uniform

enum class KWin::GLShader::Vec2Uniform
strong
Enumerator
Offset 
Vec2UniformCount 

Definition at line 88 of file glshader.h.

◆ Vec3Uniform

enum class KWin::GLShader::Vec3Uniform
strong
Enumerator
PrimaryBrightness 

Definition at line 93 of file glshader.h.

◆ Vec4Uniform

enum class KWin::GLShader::Vec4Uniform
strong
Enumerator
ModulationConstant 
Vec4UniformCount 

Definition at line 97 of file glshader.h.

Constructor & Destructor Documentation

◆ GLShader() [1/2]

KWin::GLShader::GLShader ( const QString & vertexfile,
const QString & fragmentfile,
unsigned int flags = NoFlags )

Definition at line 29 of file glshader.cpp.

◆ ~GLShader()

KWin::GLShader::~GLShader ( )

Definition at line 38 of file glshader.cpp.

◆ GLShader() [2/2]

KWin::GLShader::GLShader ( unsigned int flags = NoFlags)
protected

Definition at line 21 of file glshader.cpp.

Member Function Documentation

◆ attributeLocation()

int KWin::GLShader::attributeLocation ( const char * name)

Definition at line 415 of file glshader.cpp.

◆ bind()

void KWin::GLShader::bind ( )
protected

Definition at line 195 of file glshader.cpp.

◆ bindAttributeLocation()

void KWin::GLShader::bindAttributeLocation ( const char * name,
int index )

Definition at line 183 of file glshader.cpp.

◆ bindFragDataLocation()

void KWin::GLShader::bindFragDataLocation ( const char * name,
int index )

Definition at line 188 of file glshader.cpp.

◆ compile()

bool KWin::GLShader::compile ( GLuint program,
GLenum shaderType,
const QByteArray & sourceCode ) const
protected

Definition at line 109 of file glshader.cpp.

◆ getUniformMatrix4x4()

QMatrix4x4 KWin::GLShader::getUniformMatrix4x4 ( const char * name)
Returns
The value of the uniform as a matrix
Since
4.7

Definition at line 430 of file glshader.cpp.

◆ isValid()

bool KWin::GLShader::isValid ( ) const
inline

Definition at line 36 of file glshader.h.

◆ link()

bool KWin::GLShader::link ( )

Definition at line 64 of file glshader.cpp.

◆ load()

bool KWin::GLShader::load ( const QByteArray & vertexSource,
const QByteArray & fragmentSource )
protected

Definition at line 153 of file glshader.cpp.

◆ loadFromFiles()

bool KWin::GLShader::loadFromFiles ( const QString & vertexfile,
const QString & fragmentfile )
protected

Definition at line 45 of file glshader.cpp.

◆ prepareSource()

const QByteArray KWin::GLShader::prepareSource ( GLenum shaderType,
const QByteArray & sourceCode ) const
protected

Definition at line 94 of file glshader.cpp.

◆ resolveLocations()

void KWin::GLShader::resolveLocations ( )
protected

Definition at line 205 of file glshader.cpp.

◆ setAttribute()

bool KWin::GLShader::setAttribute ( const char * name,
float value )

Definition at line 421 of file glshader.cpp.

◆ setColorspaceUniforms()

bool KWin::GLShader::setColorspaceUniforms ( const ColorDescription & src,
const ColorDescription & dst )

Definition at line 447 of file glshader.cpp.

◆ setColorspaceUniformsFromSRGB()

bool KWin::GLShader::setColorspaceUniformsFromSRGB ( const ColorDescription & dst)

Definition at line 457 of file glshader.cpp.

◆ setColorspaceUniformsToSRGB()

bool KWin::GLShader::setColorspaceUniformsToSRGB ( const ColorDescription & src)

Definition at line 462 of file glshader.cpp.

◆ setUniform() [1/25]

bool KWin::GLShader::setUniform ( ColorUniform uniform,
const QColor & value )

Definition at line 295 of file glshader.cpp.

◆ setUniform() [2/25]

bool KWin::GLShader::setUniform ( ColorUniform uniform,
const QVector4D & value )

Definition at line 289 of file glshader.cpp.

◆ setUniform() [3/25]

bool KWin::GLShader::setUniform ( const char * name,
const QColor & color )

Definition at line 337 of file glshader.cpp.

◆ setUniform() [4/25]

bool KWin::GLShader::setUniform ( const char * name,
const QMatrix4x4 & value )

Definition at line 331 of file glshader.cpp.

◆ setUniform() [5/25]

bool KWin::GLShader::setUniform ( const char * name,
const QVector2D & value )

Definition at line 313 of file glshader.cpp.

◆ setUniform() [6/25]

bool KWin::GLShader::setUniform ( const char * name,
const QVector3D & value )

Definition at line 319 of file glshader.cpp.

◆ setUniform() [7/25]

bool KWin::GLShader::setUniform ( const char * name,
const QVector4D & value )

Definition at line 325 of file glshader.cpp.

◆ setUniform() [8/25]

bool KWin::GLShader::setUniform ( const char * name,
float value )

Definition at line 301 of file glshader.cpp.

◆ setUniform() [9/25]

bool KWin::GLShader::setUniform ( const char * name,
int value )

Definition at line 307 of file glshader.cpp.

◆ setUniform() [10/25]

bool KWin::GLShader::setUniform ( FloatUniform uniform,
float value )

Definition at line 277 of file glshader.cpp.

◆ setUniform() [11/25]

bool KWin::GLShader::setUniform ( int location,
const QColor & value )

Definition at line 407 of file glshader.cpp.

◆ setUniform() [12/25]

bool KWin::GLShader::setUniform ( int location,
const QMatrix3x3 & value )

Definition at line 391 of file glshader.cpp.

◆ setUniform() [13/25]

bool KWin::GLShader::setUniform ( int location,
const QMatrix4x4 & value )

Definition at line 399 of file glshader.cpp.

◆ setUniform() [14/25]

bool KWin::GLShader::setUniform ( int location,
const QVector2D & value )

Definition at line 367 of file glshader.cpp.

◆ setUniform() [15/25]

bool KWin::GLShader::setUniform ( int location,
const QVector3D & value )

Definition at line 375 of file glshader.cpp.

◆ setUniform() [16/25]

bool KWin::GLShader::setUniform ( int location,
const QVector4D & value )

Definition at line 383 of file glshader.cpp.

◆ setUniform() [17/25]

bool KWin::GLShader::setUniform ( int location,
float value )

Definition at line 343 of file glshader.cpp.

◆ setUniform() [18/25]

bool KWin::GLShader::setUniform ( int location,
int value )

Definition at line 351 of file glshader.cpp.

◆ setUniform() [19/25]

bool KWin::GLShader::setUniform ( int location,
int xValue,
int yValue,
int zValue )

Definition at line 359 of file glshader.cpp.

◆ setUniform() [20/25]

bool KWin::GLShader::setUniform ( IntUniform uniform,
int value )

Definition at line 283 of file glshader.cpp.

◆ setUniform() [21/25]

bool KWin::GLShader::setUniform ( Mat3Uniform uniform,
const QMatrix3x3 & value )

Definition at line 247 of file glshader.cpp.

◆ setUniform() [22/25]

bool KWin::GLShader::setUniform ( Mat4Uniform uniform,
const QMatrix4x4 & matrix )

Definition at line 253 of file glshader.cpp.

◆ setUniform() [23/25]

bool KWin::GLShader::setUniform ( Vec2Uniform uniform,
const QVector2D & value )

Definition at line 259 of file glshader.cpp.

◆ setUniform() [24/25]

bool KWin::GLShader::setUniform ( Vec3Uniform uniform,
const QVector3D & value )

Definition at line 265 of file glshader.cpp.

◆ setUniform() [25/25]

bool KWin::GLShader::setUniform ( Vec4Uniform uniform,
const QVector4D & value )

Definition at line 271 of file glshader.cpp.

◆ unbind()

void KWin::GLShader::unbind ( )
protected

Definition at line 200 of file glshader.cpp.

◆ uniformLocation()

int KWin::GLShader::uniformLocation ( const char * name)

Definition at line 241 of file glshader.cpp.

Friends And Related Symbol Documentation

◆ ShaderManager

friend class ShaderManager
friend

Definition at line 163 of file glshader.h.


The documentation for this class was generated from the following files: