Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qopenglshaderprogram.cpp File Reference

(f9a625eb8c774643a8e8a5ff9548634e34bf4fe0)

#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 179 of file qopenglshaderprogram.cpp.

◆ GL_GEOMETRY_SHADER

#define GL_GEOMETRY_SHADER   0x8DD9

Definition at line 170 of file qopenglshaderprogram.cpp.

◆ GL_MAX_GEOMETRY_OUTPUT_VERTICES

#define GL_MAX_GEOMETRY_OUTPUT_VERTICES   0x8DE0

Definition at line 182 of file qopenglshaderprogram.cpp.

◆ GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS

#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS   0x8DE1

Definition at line 185 of file qopenglshaderprogram.cpp.

◆ GL_PATCH_DEFAULT_INNER_LEVEL

#define GL_PATCH_DEFAULT_INNER_LEVEL   0x8E73

Definition at line 194 of file qopenglshaderprogram.cpp.

◆ GL_PATCH_DEFAULT_OUTER_LEVEL

#define GL_PATCH_DEFAULT_OUTER_LEVEL   0x8E74

Definition at line 191 of file qopenglshaderprogram.cpp.

◆ GL_PATCH_VERTICES

#define GL_PATCH_VERTICES   0x8E72

Definition at line 188 of file qopenglshaderprogram.cpp.

◆ GL_TESS_CONTROL_SHADER

#define GL_TESS_CONTROL_SHADER   0x8E88

Definition at line 173 of file qopenglshaderprogram.cpp.

◆ GL_TESS_EVALUATION_SHADER

#define GL_TESS_EVALUATION_SHADER   0x8E87

Definition at line 176 of file qopenglshaderprogram.cpp.

◆ 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()); \
}
typedef GLfloat(GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC)(GLuint path
GLenum type
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
[0]
GLuint index
GLint location
GLenum GLsizei GLsizei GLint * values

Definition at line 3217 of file qopenglshaderprogram.cpp.

◆ 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 3201 of file qopenglshaderprogram.cpp.

Function Documentation

◆ findVersionDirectivePosition()

QVersionDirectivePosition findVersionDirectivePosition ( const char * source)
static

Definition at line 494 of file qopenglshaderprogram.cpp.

References QVersionDirectivePosition::QVersionDirectivePosition().

Here is the call graph for this function:

◆ isFormatGLES()

bool isFormatGLES ( const QSurfaceFormat & f)
inlinestatic

Definition at line 198 of file qopenglshaderprogram.cpp.

◆ qt_shaderStageToType()

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

Definition at line 1083 of file qopenglshaderprogram.cpp.

◆ qt_shaderTypeToStage()

QShader::Stage qt_shaderTypeToStage ( QOpenGLShader::ShaderType type)
inlinestatic

Definition at line 1064 of file qopenglshaderprogram.cpp.

◆ supportsCompute()

bool supportsCompute ( const QSurfaceFormat & f)
inlinestatic

Definition at line 209 of file qopenglshaderprogram.cpp.

◆ supportsGeometry()

bool supportsGeometry ( const QSurfaceFormat & f)
inlinestatic

Definition at line 204 of file qopenglshaderprogram.cpp.

◆ supportsTessellation()

bool supportsTessellation ( const QSurfaceFormat & f)
inlinestatic

Definition at line 221 of file qopenglshaderprogram.cpp.

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 471 of file qopenglshaderprogram.cpp.

◆ qualifierDefines

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

Definition at line 455 of file qopenglshaderprogram.cpp.