Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qopenglshaderprogram.cpp File Reference

(aa37e67ef7f5ff22da0ef95fb5221bc1fff9b3ca)

#include "qopenglshaderprogram.h"
#include "qopenglextrafunctions.h"
#include "private/qopenglcontext_p.h"
#include <QtOpenGL/QOpenGLVersionFunctionsFactory>
#include <QtCore/private/qobject_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qfile.h>
#include <QtCore/qlist.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qvarlengtharray.h>
#include <QtGui/private/qopenglprogrambinarycache_p.h>
#include <QtGui/qtransform.h>
#include <QtGui/QColor>
#include <QtGui/QSurfaceFormat>
#include <QtOpenGL/qopenglfunctions_4_0_core.h>
#include <algorithm>
#include <memory>
#include "moc_qopenglshaderprogram.cpp"
+ Include dependency graph for qopenglshaderprogram.cpp:

Go to the source code of this file.

Classes

class  QOpenGLShaderPrivate
 
struct  QVersionDirectivePosition
 
class  QOpenGLShaderProgramPrivate
 

Macros

#define GL_GEOMETRY_SHADER   0x8DD9
 
#define GL_TESS_CONTROL_SHADER   0x8E88
 
#define GL_TESS_EVALUATION_SHADER   0x8E87
 
#define GL_COMPUTE_SHADER   0x91B9
 
#define GL_MAX_GEOMETRY_OUTPUT_VERTICES   0x8DE0
 
#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS   0x8DE1
 
#define GL_PATCH_VERTICES   0x8E72
 
#define GL_PATCH_DEFAULT_OUTER_LEVEL   0x8E74
 
#define GL_PATCH_DEFAULT_INNER_LEVEL   0x8E73
 
#define setUniformMatrixArray(func, location, values, count, type, cols, rows)
 
#define setUniformGenericMatrixArray(colfunc, location, values, count, type, cols, rows)
 

Functions

static bool isFormatGLES (const QSurfaceFormat &f)
 
static bool supportsGeometry (const QSurfaceFormat &f)
 
static bool supportsCompute (const QSurfaceFormat &f)
 
static bool supportsTessellation (const QSurfaceFormat &f)
 
static QVersionDirectivePosition findVersionDirectivePosition (const char *source)
 
static QShader::Stage qt_shaderTypeToStage (QOpenGLShader::ShaderType type)
 
static QOpenGLShader::ShaderType qt_shaderStageToType (QShader::Stage stage)
 

Variables

static const char qualifierDefines []
 
static const char blendEquationAdvancedHeader []
 

Macro Definition Documentation

◆ GL_COMPUTE_SHADER

#define GL_COMPUTE_SHADER   0x91B9

Definition at line 159 of file qopenglshaderprogram.cpp.

Referenced by QOpenGLShaderPrivate::create().

◆ GL_GEOMETRY_SHADER

#define GL_GEOMETRY_SHADER   0x8DD9

Definition at line 150 of file qopenglshaderprogram.cpp.

Referenced by QOpenGLShaderPrivate::create().

◆ GL_MAX_GEOMETRY_OUTPUT_VERTICES

#define GL_MAX_GEOMETRY_OUTPUT_VERTICES   0x8DE0

Definition at line 162 of file qopenglshaderprogram.cpp.

◆ GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS

#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS   0x8DE1

Definition at line 165 of file qopenglshaderprogram.cpp.

◆ GL_PATCH_DEFAULT_INNER_LEVEL

#define GL_PATCH_DEFAULT_INNER_LEVEL   0x8E73

Definition at line 174 of file qopenglshaderprogram.cpp.

◆ GL_PATCH_DEFAULT_OUTER_LEVEL

#define GL_PATCH_DEFAULT_OUTER_LEVEL   0x8E74

Definition at line 171 of file qopenglshaderprogram.cpp.

◆ GL_PATCH_VERTICES

#define GL_PATCH_VERTICES   0x8E72

Definition at line 168 of file qopenglshaderprogram.cpp.

◆ GL_TESS_CONTROL_SHADER

#define GL_TESS_CONTROL_SHADER   0x8E88

Definition at line 153 of file qopenglshaderprogram.cpp.

Referenced by QOpenGLShaderPrivate::create().

◆ GL_TESS_EVALUATION_SHADER

#define GL_TESS_EVALUATION_SHADER   0x8E87

Definition at line 156 of file qopenglshaderprogram.cpp.

Referenced by QOpenGLShaderPrivate::create().

◆ setUniformGenericMatrixArray

#define setUniformGenericMatrixArray ( colfunc,
location,
values,
count,
type,
cols,
rows )
Value:
if (location == -1 || count <= 0) \
return; \
if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \
const GLfloat *data = reinterpret_cast<const GLfloat *> \
(values[0].constData()); \
colfunc(location, count * cols, data); \
} else { \
QVarLengthArray<GLfloat> temp(cols * rows * count); \
for (int index = 0; index < count; ++index) { \
for (int index2 = 0; index2 < (cols * rows); ++index2) { \
temp.data()[cols * rows * index + index2] = \
values[index].constData()[index2]; \
} \
} \
colfunc(location, count * cols, temp.constData()); \
}
GLint location
GLenum GLsizei GLsizei GLint * values
[15]
typedef GLfloat(GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC)(GLuint path
GLuint index
[2]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum type

Definition at line 3197 of file qopenglshaderprogram.cpp.

Referenced by QOpenGLShaderProgram::setUniformValueArray(), QOpenGLShaderProgram::setUniformValueArray(), QOpenGLShaderProgram::setUniformValueArray(), QOpenGLShaderProgram::setUniformValueArray(), QOpenGLShaderProgram::setUniformValueArray(), and QOpenGLShaderProgram::setUniformValueArray().

◆ setUniformMatrixArray

#define setUniformMatrixArray ( func,
location,
values,
count,
type,
cols,
rows )
Value:
if (location == -1 || count <= 0) \
return; \
if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \
func(location, count, GL_FALSE, \
reinterpret_cast<const GLfloat *>(values[0].constData())); \
} else { \
QVarLengthArray<GLfloat> temp(cols * rows * count); \
for (int index = 0; index < count; ++index) { \
for (int index2 = 0; index2 < (cols * rows); ++index2) { \
temp.data()[cols * rows * index + index2] = \
values[index].constData()[index2]; \
} \
} \
func(location, count, GL_FALSE, temp.constData()); \
}

Definition at line 3181 of file qopenglshaderprogram.cpp.

Referenced by QOpenGLShaderProgram::setUniformValueArray(), QOpenGLShaderProgram::setUniformValueArray(), and QOpenGLShaderProgram::setUniformValueArray().

Function Documentation

◆ findVersionDirectivePosition()

static QVersionDirectivePosition findVersionDirectivePosition ( const char * source)
static

Definition at line 474 of file qopenglshaderprogram.cpp.

References Normal, Q_ASSERT, Q_FALLTHROUGH, and state.

Referenced by QOpenGLShader::compileSourceCode().

+ Here is the caller graph for this function:

◆ isFormatGLES()

static bool isFormatGLES ( const QSurfaceFormat & f)
inlinestatic

Definition at line 178 of file qopenglshaderprogram.cpp.

References QSurfaceFormat::OpenGLES.

Referenced by supportsCompute(), and supportsTessellation().

+ Here is the caller graph for this function:

◆ qt_shaderStageToType()

static QOpenGLShader::ShaderType qt_shaderStageToType ( QShader::Stage stage)
inlinestatic

◆ qt_shaderTypeToStage()

◆ supportsCompute()

static bool supportsCompute ( const QSurfaceFormat & f)
inlinestatic

Definition at line 189 of file qopenglshaderprogram.cpp.

References isFormatGLES(), and qMakePair().

Referenced by QOpenGLShaderPrivate::QOpenGLShaderPrivate(), and QOpenGLShader::hasOpenGLShaders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ supportsGeometry()

static bool supportsGeometry ( const QSurfaceFormat & f)
inlinestatic

Definition at line 184 of file qopenglshaderprogram.cpp.

References qMakePair().

Referenced by QOpenGLShaderPrivate::QOpenGLShaderPrivate(), and QOpenGLShader::hasOpenGLShaders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ supportsTessellation()

static bool supportsTessellation ( const QSurfaceFormat & f)
inlinestatic

Definition at line 201 of file qopenglshaderprogram.cpp.

References isFormatGLES(), and qMakePair().

Referenced by QOpenGLShaderPrivate::QOpenGLShaderPrivate(), and QOpenGLShader::hasOpenGLShaders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ blendEquationAdvancedHeader

const char blendEquationAdvancedHeader[]
static
Initial value:
=
"#ifdef GL_KHR_blend_equation_advanced\n"
"#extension GL_ARB_fragment_coord_conventions : enable\n"
"#extension GL_KHR_blend_equation_advanced : enable\n"
"#endif\n"

Definition at line 451 of file qopenglshaderprogram.cpp.

Referenced by QOpenGLShader::compileSourceCode().

◆ qualifierDefines

const char qualifierDefines[]
static
Initial value:
=
"#define lowp\n"
"#define mediump\n"
"#define highp\n"

Definition at line 435 of file qopenglshaderprogram.cpp.

Referenced by QOpenGLShader::compileSourceCode().