Qt 4.8
Public Types | Public Functions | Static Public Functions | Properties | Static Private Attributes | List of all members
QGLEngineSharedShaders Class Reference

#include <qglengineshadermanager_p.h>

Public Types

enum  SnippetName {
  MainVertexShader, MainWithTexCoordsVertexShader, MainWithTexCoordsAndOpacityVertexShader, UntransformedPositionVertexShader,
  PositionOnlyVertexShader, ComplexGeometryPositionOnlyVertexShader, PositionWithPatternBrushVertexShader, PositionWithLinearGradientBrushVertexShader,
  PositionWithConicalGradientBrushVertexShader, PositionWithRadialGradientBrushVertexShader, PositionWithTextureBrushVertexShader, AffinePositionWithPatternBrushVertexShader,
  AffinePositionWithLinearGradientBrushVertexShader, AffinePositionWithConicalGradientBrushVertexShader, AffinePositionWithRadialGradientBrushVertexShader, AffinePositionWithTextureBrushVertexShader,
  MainFragmentShader_CMO, MainFragmentShader_CM, MainFragmentShader_MO, MainFragmentShader_M,
  MainFragmentShader_CO, MainFragmentShader_C, MainFragmentShader_O, MainFragmentShader,
  MainFragmentShader_ImageArrays, ImageSrcFragmentShader, ImageSrcWithPatternFragmentShader, NonPremultipliedImageSrcFragmentShader,
  CustomImageSrcFragmentShader, SolidBrushSrcFragmentShader, TextureBrushSrcFragmentShader, TextureBrushSrcWithPatternFragmentShader,
  PatternBrushSrcFragmentShader, LinearGradientBrushSrcFragmentShader, RadialGradientBrushSrcFragmentShader, ConicalGradientBrushSrcFragmentShader,
  ShockingPinkSrcFragmentShader, NoMaskFragmentShader, MaskFragmentShader, RgbMaskFragmentShaderPass1,
  RgbMaskFragmentShaderPass2, RgbMaskWithGammaFragmentShader, NoCompositionModeFragmentShader, MultiplyCompositionModeFragmentShader,
  ScreenCompositionModeFragmentShader, OverlayCompositionModeFragmentShader, DarkenCompositionModeFragmentShader, LightenCompositionModeFragmentShader,
  ColorDodgeCompositionModeFragmentShader, ColorBurnCompositionModeFragmentShader, HardLightCompositionModeFragmentShader, SoftLightCompositionModeFragmentShader,
  DifferenceCompositionModeFragmentShader, ExclusionCompositionModeFragmentShader, TotalSnippetCount, InvalidSnippetName
}
 

Public Functions

QGLShaderProgramblitProgram ()
 
void cleanupCustomStage (QGLCustomShaderStage *stage)
 
QGLEngineShaderProgfindProgramInCache (const QGLEngineShaderProg &prog)
 
 QGLEngineSharedShaders (const QGLContext *context)
 
QGLShaderProgramsimpleProgram ()
 
 ~QGLEngineSharedShaders ()
 

Static Public Functions

static QGLEngineSharedShadersshadersForContext (const QGLContext *context)
 

Properties

QGLShaderProgramblitShaderProg
 
QList< QGLEngineShaderProg * > cachedPrograms
 
QGLSharedResourceGuard ctxGuard
 
QList< QGLShader * > shaders
 
QGLShaderProgramsimpleShaderProg
 

Static Private Attributes

static const char * qShaderSnippets [TotalSnippetCount]
 

Detailed Description

Definition at line 262 of file qglengineshadermanager_p.h.

Enumerations

◆ SnippetName

Enumerator
MainVertexShader 
MainWithTexCoordsVertexShader 
MainWithTexCoordsAndOpacityVertexShader 
UntransformedPositionVertexShader 
PositionOnlyVertexShader 
ComplexGeometryPositionOnlyVertexShader 
PositionWithPatternBrushVertexShader 
PositionWithLinearGradientBrushVertexShader 
PositionWithConicalGradientBrushVertexShader 
PositionWithRadialGradientBrushVertexShader 
PositionWithTextureBrushVertexShader 
AffinePositionWithPatternBrushVertexShader 
AffinePositionWithLinearGradientBrushVertexShader 
AffinePositionWithConicalGradientBrushVertexShader 
AffinePositionWithRadialGradientBrushVertexShader 
AffinePositionWithTextureBrushVertexShader 
MainFragmentShader_CMO 
MainFragmentShader_CM 
MainFragmentShader_MO 
MainFragmentShader_M 
MainFragmentShader_CO 
MainFragmentShader_C 
MainFragmentShader_O 
MainFragmentShader 
MainFragmentShader_ImageArrays 
ImageSrcFragmentShader 
ImageSrcWithPatternFragmentShader 
NonPremultipliedImageSrcFragmentShader 
CustomImageSrcFragmentShader 
SolidBrushSrcFragmentShader 
TextureBrushSrcFragmentShader 
TextureBrushSrcWithPatternFragmentShader 
PatternBrushSrcFragmentShader 
LinearGradientBrushSrcFragmentShader 
RadialGradientBrushSrcFragmentShader 
ConicalGradientBrushSrcFragmentShader 
ShockingPinkSrcFragmentShader 
NoMaskFragmentShader 
MaskFragmentShader 
RgbMaskFragmentShaderPass1 
RgbMaskFragmentShaderPass2 
RgbMaskWithGammaFragmentShader 
NoCompositionModeFragmentShader 
MultiplyCompositionModeFragmentShader 
ScreenCompositionModeFragmentShader 
OverlayCompositionModeFragmentShader 
DarkenCompositionModeFragmentShader 
LightenCompositionModeFragmentShader 
ColorDodgeCompositionModeFragmentShader 
ColorBurnCompositionModeFragmentShader 
HardLightCompositionModeFragmentShader 
SoftLightCompositionModeFragmentShader 
DifferenceCompositionModeFragmentShader 
ExclusionCompositionModeFragmentShader 
TotalSnippetCount 
InvalidSnippetName 

Definition at line 267 of file qglengineshadermanager_p.h.

267  {
271 
272  // UntransformedPositionVertexShader must be first in the list:
286 
287  // MainFragmentShader_CMO must be first in the list:
297 
298  // ImageSrcFragmentShader must be first in the list::
311 
312  // NoMaskFragmentShader must be first in the list:
318 
319  // NoCompositionModeFragmentShader must be first in the list:
332 
334  };

Constructors and Destructors

◆ QGLEngineSharedShaders()

QGLEngineSharedShaders::QGLEngineSharedShaders ( const QGLContext context)

Definition at line 83 of file qglengineshadermanager.cpp.

84  : ctxGuard(context)
85  , blitShaderProg(0)
86  , simpleShaderProg(0)
87 {
88 
89 /*
90  Rather than having the shader source array statically initialised, it is initialised
91  here instead. This is to allow new shader names to be inserted or existing names moved
92  around without having to change the order of the glsl strings. It is hoped this will
93  make future hard-to-find runtime bugs more obvious and generally give more solid code.
94 */
95  static bool snippetsPopulated = false;
96  if (!snippetsPopulated) {
97 
98  const char** code = qShaderSnippets; // shortcut
99 
103 
117 
127 
131  code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader; // Calls "customShader", which must be appended
140 
141  code[NoMaskFragmentShader] = "";
145  code[RgbMaskWithGammaFragmentShader] = ""; //###
146 
148  code[MultiplyCompositionModeFragmentShader] = ""; //###
149  code[ScreenCompositionModeFragmentShader] = ""; //###
150  code[OverlayCompositionModeFragmentShader] = ""; //###
151  code[DarkenCompositionModeFragmentShader] = ""; //###
152  code[LightenCompositionModeFragmentShader] = ""; //###
159 
160 #if defined(QT_DEBUG)
161  // Check that all the elements have been filled:
162  for (int i = 0; i < TotalSnippetCount; ++i) {
163  if (qShaderSnippets[i] == 0) {
164  qFatal("Shader snippet for %s (#%d) is missing!",
165  snippetNameStr(SnippetName(i)).constData(), i);
166  }
167  }
168 #endif
169  snippetsPopulated = true;
170  }
171 
172  QGLShader* fragShader;
173  QGLShader* vertexShader;
174  QByteArray vertexSource;
175  QByteArray fragSource;
176 
177  // Compile up the simple shader:
178  vertexSource.append(qShaderSnippets[MainVertexShader]);
180 
183 
184  simpleShaderProg = new QGLShaderProgram(context, 0);
185 
186  CachedShader simpleShaderCache(fragSource, vertexSource);
187 
188  bool inCache = simpleShaderCache.load(simpleShaderProg, context);
189 
190  if (!inCache) {
191  vertexShader = new QGLShader(QGLShader::Vertex, context, 0);
192  shaders.append(vertexShader);
193  if (!vertexShader->compileSourceCode(vertexSource))
194  qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile");
195 
196  fragShader = new QGLShader(QGLShader::Fragment, context, 0);
197  shaders.append(fragShader);
198  if (!fragShader->compileSourceCode(fragSource))
199  qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile");
200 
201  simpleShaderProg->addShader(vertexShader);
202  simpleShaderProg->addShader(fragShader);
203 
208  }
209 
211 
212  if (simpleShaderProg->isLinked()) {
213  if (!inCache)
214  simpleShaderCache.store(simpleShaderProg, context);
215  } else {
216  qCritical() << "Errors linking simple shader:"
217  << simpleShaderProg->log();
218  }
219 
220  // Compile the blit shader:
221  vertexSource.clear();
224 
225  fragSource.clear();
226  fragSource.append(qShaderSnippets[MainFragmentShader]);
228 
229  blitShaderProg = new QGLShaderProgram(context, 0);
230 
231  CachedShader blitShaderCache(fragSource, vertexSource);
232 
233  inCache = blitShaderCache.load(blitShaderProg, context);
234 
235  if (!inCache) {
236  vertexShader = new QGLShader(QGLShader::Vertex, context, 0);
237  shaders.append(vertexShader);
238  if (!vertexShader->compileSourceCode(vertexSource))
239  qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile");
240 
241  fragShader = new QGLShader(QGLShader::Fragment, context, 0);
242  shaders.append(fragShader);
243  if (!fragShader->compileSourceCode(fragSource))
244  qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile");
245 
246  blitShaderProg->addShader(vertexShader);
247  blitShaderProg->addShader(fragShader);
248 
251  }
252 
253  blitShaderProg->link();
254  if (blitShaderProg->isLinked()) {
255  if (!inCache)
256  blitShaderCache.store(blitShaderProg, context);
257  } else {
258  qCritical() << "Errors linking blit shader:"
259  << blitShaderProg->log();
260  }
261 
262 #ifdef QT_GL_SHARED_SHADER_DEBUG
263  qDebug(" -> QGLEngineSharedShaders() %p for thread %p.", this, QThread::currentThread());
264 #endif
265 }
static const char *const qglslAffinePositionWithTextureBrushVertexShader
void bindAttributeLocation(const char *name, int location)
Binds the attribute name to the specified location.
QGLSharedResourceGuard ctxGuard
static const GLuint QT_PMV_MATRIX_3_ATTR
static const char *const qglslPositionWithLinearGradientBrushVertexShader
static const char *const qglslPositionWithRadialGradientBrushVertexShader
bool compileSourceCode(const char *source)
Sets the source code for this shader and compiles it.
static const char *const qglslCustomSrcFragmentShader
static const char *const qglslAffinePositionWithPatternBrushVertexShader
static const char *const qglslNonPremultipliedImageSrcFragmentShader
static const char *const qglslMainFragmentShader
QByteArray & append(char c)
Appends the character ch to this byte array.
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static const char *const qglslConicalGradientBrushSrcFragmentShader
QString log() const
Returns the errors and warnings that occurred during the last link() or addShader() with explicitly s...
static const char *const qglslRgbMaskFragmentShaderPass2
static const char *const qglslAffinePositionWithConicalGradientBrushVertexShader
static const char *const qglslRgbMaskFragmentShaderPass1
QGLShaderProgram * simpleShaderProg
static const char *const qglslPositionWithPatternBrushVertexShader
static const char *const qglslPatternBrushSrcFragmentShader
static const char *const qglslSolidBrushSrcFragmentShader
Q_CORE_EXPORT void qDebug(const char *,...)
static const char *const qglslMainFragmentShader_O
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
Definition: qthread.cpp:419
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
static const char *const qglslShockingPinkSrcFragmentShader
static const char *const qglslPositionWithTextureBrushVertexShader
static const char *const qglslMainFragmentShader_C
The QGLShader class allows OpenGL shaders to be compiled.
static const GLuint QT_PMV_MATRIX_2_ATTR
static const char *const qglslPositionOnlyVertexShader
Q_CORE_EXPORT void qWarning(const char *,...)
static const char *const qglslLinearGradientBrushSrcFragmentShader
static const char *const qglslPositionWithConicalGradientBrushVertexShader
static const char *const qglslMainFragmentShader_CM
virtual bool link()
Links together the shaders that were added to this program with addShader().
static const char *const qglslTextureBrushSrcWithPatternFragmentShader
Q_CORE_EXPORT void qFatal(const char *,...)
static const char *const qglslMainFragmentShader_ImageArrays
static const char *const qglslMainWithTexCoordsAndOpacityVertexShader
static const GLuint QT_PMV_MATRIX_1_ATTR
static const char *const qglslMainFragmentShader_CO
static const GLuint QT_TEXTURE_COORDS_ATTR
static const char *const qglslRadialGradientBrushSrcFragmentShader
static const char *const qglslMainFragmentShader_M
bool addShader(QGLShader *shader)
Adds a compiled shader to this shader program.
static const char *const qglslAffinePositionWithRadialGradientBrushVertexShader
static const char *const qglslMainWithTexCoordsVertexShader
static const char *const qglslMaskFragmentShader
static const char *const qglslAffinePositionWithLinearGradientBrushVertexShader
static const char *const qglslImageSrcFragmentShader
static const char *const qglslMainFragmentShader_MO
static const char *const qglslUntransformedPositionVertexShader
static const char *const qglslComplexGeometryPositionOnlyVertexShader
static const char * qShaderSnippets[TotalSnippetCount]
static const GLuint QT_VERTEX_COORDS_ATTR
static const char *const qglslImageSrcWithPatternFragmentShader
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
static const char *const qglslMainVertexShader
void clear()
Clears the contents of the byte array and makes it empty.
static const char *const qglslTextureBrushSrcFragmentShader
bool isLinked() const
Returns true if this shader program has been linked; false otherwise.
static const char *const qglslMainFragmentShader_CMO
Q_CORE_EXPORT void qCritical(const char *,...)

◆ ~QGLEngineSharedShaders()

QGLEngineSharedShaders::~QGLEngineSharedShaders ( )

Definition at line 267 of file qglengineshadermanager.cpp.

268 {
269 #ifdef QT_GL_SHARED_SHADER_DEBUG
270  qDebug(" -> ~QGLEngineSharedShaders() %p for thread %p.", this, QThread::currentThread());
271 #endif
273  shaders.clear();
274 
277 
278  if (blitShaderProg) {
279  delete blitShaderProg;
280  blitShaderProg = 0;
281  }
282 
283  if (simpleShaderProg) {
284  delete simpleShaderProg;
285  simpleShaderProg = 0;
286  }
287 }
QGLShaderProgram * simpleShaderProg
Q_CORE_EXPORT void qDebug(const char *,...)
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
Definition: qthread.cpp:419
QList< QGLEngineShaderProg * > cachedPrograms
void clear()
Removes all items from the list.
Definition: qlist.h:764
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319

Functions

◆ blitProgram()

QGLShaderProgram* QGLEngineSharedShaders::blitProgram ( )
inline

◆ cleanupCustomStage()

void QGLEngineSharedShaders::cleanupCustomStage ( QGLCustomShaderStage stage)

Definition at line 442 of file qglengineshadermanager.cpp.

443 {
444  // Remove any shader programs which has this as the custom shader src:
445  for (int i = 0; i < cachedPrograms.size(); ++i) {
446  QGLEngineShaderProg *cachedProg = cachedPrograms[i];
447  if (cachedProg->customStageSource == stage->source()) {
448  delete cachedProg;
450  i--;
451  }
452  }
453 }
QList< QGLEngineShaderProg * > cachedPrograms
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ findProgramInCache()

QGLEngineShaderProg * QGLEngineSharedShaders::findProgramInCache ( const QGLEngineShaderProg prog)

Definition at line 299 of file qglengineshadermanager.cpp.

Referenced by QGLEngineShaderManager::useCorrectShaderProg().

300 {
301  for (int i = 0; i < cachedPrograms.size(); ++i) {
302  QGLEngineShaderProg *cachedProg = cachedPrograms[i];
303  if (*cachedProg == prog) {
304  // Move the program to the top of the list as a poor-man's cache algo
305  cachedPrograms.move(i, 0);
306  cachedProg->program->bind();
307  return cachedProg;
308  }
309  }
310 
312 
313  do {
314  QByteArray fragSource;
315  // Insert the custom stage before the srcPixel shader to work around an ATI driver bug
316  // where you cannot forward declare a function that takes a sampler as argument.
318  fragSource.append(prog.customStageSource);
319  fragSource.append(qShaderSnippets[prog.mainFragShader]);
320  fragSource.append(qShaderSnippets[prog.srcPixelFragShader]);
321  if (prog.compositionFragShader)
322  fragSource.append(qShaderSnippets[prog.compositionFragShader]);
323  if (prog.maskFragShader)
324  fragSource.append(qShaderSnippets[prog.maskFragShader]);
325 
326  QByteArray vertexSource;
327  vertexSource.append(qShaderSnippets[prog.mainVertexShader]);
328  vertexSource.append(qShaderSnippets[prog.positionVertexShader]);
329 
331 
332  CachedShader shaderCache(fragSource, vertexSource);
333  bool inCache = shaderCache.load(shaderProgram.data(), ctxGuard.context());
334 
335  if (!inCache) {
336 
338  QByteArray description;
339 #if defined(QT_DEBUG)
340  // Name the shader for easier debugging
341  description.append("Fragment shader: main=");
342  description.append(snippetNameStr(prog.mainFragShader));
343  description.append(", srcPixel=");
344  description.append(snippetNameStr(prog.srcPixelFragShader));
345  if (prog.compositionFragShader) {
346  description.append(", composition=");
347  description.append(snippetNameStr(prog.compositionFragShader));
348  }
349  if (prog.maskFragShader) {
350  description.append(", mask=");
351  description.append(snippetNameStr(prog.maskFragShader));
352  }
353  fragShader->setObjectName(QString::fromLatin1(description));
354 #endif
355  if (!fragShader->compileSourceCode(fragSource)) {
356  qWarning() << "Warning:" << description << "failed to compile!";
357  break;
358  }
359 
361 #if defined(QT_DEBUG)
362  // Name the shader for easier debugging
363  description.clear();
364  description.append("Vertex shader: main=");
365  description.append(snippetNameStr(prog.mainVertexShader));
366  description.append(", position=");
367  description.append(snippetNameStr(prog.positionVertexShader));
368  vertexShader->setObjectName(QString::fromLatin1(description));
369 #endif
370  if (!vertexShader->compileSourceCode(vertexSource)) {
371  qWarning() << "Warning:" << description << "failed to compile!";
372  break;
373  }
374 
375  shaders.append(vertexShader.data());
376  shaders.append(fragShader.data());
377  shaderProgram->addShader(vertexShader.take());
378  shaderProgram->addShader(fragShader.take());
379 
380  // We have to bind the vertex attribute names before the program is linked:
381  shaderProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
382  if (prog.useTextureCoords)
383  shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
384  if (prog.useOpacityAttribute)
385  shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
386  if (prog.usePmvMatrixAttribute) {
387  shaderProgram->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);
388  shaderProgram->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);
389  shaderProgram->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR);
390  }
391  }
392 
393  newProg.reset(new QGLEngineShaderProg(prog));
394  newProg->program = shaderProgram.take();
395 
396  newProg->program->link();
397  if (newProg->program->isLinked()) {
398  if (!inCache)
399  shaderCache.store(newProg->program, ctxGuard.context());
400  } else {
401  QLatin1String none("none");
402  QLatin1String br("\n");
403  QString error;
404  error = QLatin1String("Shader program failed to link,");
405 #if defined(QT_DEBUG)
406  error += QLatin1String("\n Shaders Used:\n");
407  for (int i = 0; i < newProg->program->shaders().count(); ++i) {
408  QGLShader *shader = newProg->program->shaders().at(i);
409  error += QLatin1String(" ") + shader->objectName() + QLatin1String(": \n")
410  + QLatin1String(shader->sourceCode()) + br;
411  }
412 #endif
413  error += QLatin1String(" Error Log:\n")
414  + QLatin1String(" ") + newProg->program->log();
415  qWarning() << error;
416  break;
417  }
418 
419  newProg->program->bind();
420 
422  GLuint location = newProg->program->uniformLocation("maskTexture");
423  newProg->program->setUniformValue(location, QT_MASK_TEXTURE_UNIT);
424  }
425 
426  if (cachedPrograms.count() > 30) {
427  // The cache is full, so delete the last 5 programs in the list.
428  // These programs will be least used, as a program us bumped to
429  // the top of the list when it's used.
430  for (int i = 0; i < 5; ++i) {
431  delete cachedPrograms.last();
433  }
434  }
435 
436  cachedPrograms.insert(0, newProg.data());
437  } while (false);
438 
439  return newProg.take();
440 }
QGLSharedResourceGuard ctxGuard
static const GLuint QT_PMV_MATRIX_3_ATTR
const QGLContext * context() const
Definition: qgl_p.h:873
QGLEngineSharedShaders::SnippetName mainVertexShader
T * data() const
Returns the value of the pointer referenced by this object.
QByteArray & append(char c)
Appends the character ch to this byte array.
QGLEngineSharedShaders::SnippetName mainFragShader
#define error(msg)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
T * take()
Returns the value of the pointer referenced by this object.
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
void removeLast()
Removes the last item in the list.
Definition: qlist.h:287
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
QString log() const
Returns the errors and warnings that occurred during the last link() or addShader() with explicitly s...
QGLEngineSharedShaders::SnippetName maskFragShader
QGLEngineSharedShaders::SnippetName positionVertexShader
The QString class provides a Unicode character string.
Definition: qstring.h:83
QByteArray sourceCode() const
Returns the source code for this shader.
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
static const GLuint QT_OPACITY_ATTR
void move(int from, int to)
Moves the item at index position from to index position to.
Definition: qlist.h:628
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
The QGLShader class allows OpenGL shaders to be compiled.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static const GLuint QT_PMV_MATRIX_2_ATTR
QList< QGLEngineShaderProg * > cachedPrograms
Q_CORE_EXPORT void qWarning(const char *,...)
QGLEngineSharedShaders::SnippetName compositionFragShader
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
void reset(T *other=0)
Deletes the existing object it is pointing to if any, and sets its pointer to other.
virtual bool link()
Links together the shaders that were added to this program with addShader().
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
static const GLuint QT_PMV_MATRIX_1_ATTR
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
T & last()
Returns a reference to the last item in the list.
Definition: qlist.h:284
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QString objectName() const
static const GLuint QT_TEXTURE_COORDS_ATTR
QGLEngineSharedShaders::SnippetName srcPixelFragShader
#define QT_MASK_TEXTURE_UNIT
static const char * qShaderSnippets[TotalSnippetCount]
static const GLuint QT_VERTEX_COORDS_ATTR
bool bind()
Binds this shader program to the active QGLContext and makes it the current shader program...
QList< QGLShader * > shaders() const
Returns a list of all shaders that have been added to this shader program using addShader().
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
void clear()
Clears the contents of the byte array and makes it empty.
bool isLinked() const
Returns true if this shader program has been linked; false otherwise.

◆ shadersForContext()

QGLEngineSharedShaders * QGLEngineSharedShaders::shadersForContext ( const QGLContext context)
static

Definition at line 71 of file qglengineshadermanager.cpp.

Referenced by blitTexture(), and QGLEngineShaderManager::QGLEngineShaderManager().

72 {
73  return qt_shader_storage()->shadersForThread(context);
74 }

◆ simpleProgram()

QGLShaderProgram* QGLEngineSharedShaders::simpleProgram ( )
inline

Properties

◆ blitShaderProg

QGLShaderProgram* QGLEngineSharedShaders::blitShaderProg
private

Definition at line 369 of file qglengineshadermanager_p.h.

Referenced by QGLEngineSharedShaders(), and ~QGLEngineSharedShaders().

◆ cachedPrograms

QList<QGLEngineShaderProg*> QGLEngineSharedShaders::cachedPrograms
private

◆ ctxGuard

QGLSharedResourceGuard QGLEngineSharedShaders::ctxGuard
private

Definition at line 368 of file qglengineshadermanager_p.h.

Referenced by findProgramInCache().

◆ qShaderSnippets

const char * QGLEngineSharedShaders::qShaderSnippets
staticprivate
Initial value:
= {
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0
}

Definition at line 374 of file qglengineshadermanager_p.h.

Referenced by findProgramInCache(), QGLEngineSharedShaders(), and shadersForContext().

◆ shaders

QList<QGLShader *> QGLEngineSharedShaders::shaders
private

◆ simpleShaderProg

QGLShaderProgram* QGLEngineSharedShaders::simpleShaderProg
private

Definition at line 370 of file qglengineshadermanager_p.h.

Referenced by QGLEngineSharedShaders(), and ~QGLEngineSharedShaders().


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