summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglshaderprogram.cpp
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-08-31 15:11:01 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-08-31 15:27:45 (GMT)
commitbe51485f9d302eedfdb565c486e24ddab4098463 (patch)
tree9c608b513c04e94829d369d0a21a5c384c21f5bc /src/opengl/qglshaderprogram.cpp
parent48e07d39124068fef1734cfabc1c50a2f6a42007 (diff)
downloadQt-be51485f9d302eedfdb565c486e24ddab4098463.zip
Qt-be51485f9d302eedfdb565c486e24ddab4098463.tar.gz
Qt-be51485f9d302eedfdb565c486e24ddab4098463.tar.bz2
Added context pointer to QGLContextGroupResources.
I renamed QGLContextGroupResources to QGLContextGroup because we are using it to identify context groups. I also added a pointer to one of the contexts in the group. Together with qgl_share_reg(), the pointer can be used to find all contexts in a group. I renamed QGLContextPrivate::qt_get_extension_funcs() to QGLContextPrivate::extensionFuncs() to follow Qt's naming convention. Reviewed-by: Trond
Diffstat (limited to 'src/opengl/qglshaderprogram.cpp')
-rw-r--r--src/opengl/qglshaderprogram.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 6e8474c..61d8b10 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -246,10 +246,10 @@ QT_BEGIN_NAMESPACE
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
#endif
-inline bool qt_check_sharing_with_current_context(QGLContextGroupResources *group)
+inline bool qt_check_sharing_with_current_context(QGLContextGroup *group)
{
const QGLContext *context = QGLContext::currentContext();
- return context && QGLContextPrivate::qt_get_context_group(context) == group;
+ return context && QGLContextPrivate::contextGroup(context) == group;
}
class QGLShaderPrivate
@@ -265,7 +265,7 @@ public:
{
}
- QGLContextGroupResources *ctx;
+ QGLContextGroup *ctx;
GLuint shader;
QGLShader::ShaderType shaderType;
bool compiled;
@@ -284,7 +284,7 @@ bool QGLShaderPrivate::create(const QGLContext *context)
context = QGLContext::currentContext();
if (!context)
return false;
- ctx = QGLContextPrivate::qt_get_context_group(context);
+ ctx = QGLContextPrivate::contextGroup(context);
if (isPartial)
return true;
if (qt_resolve_glsl_extensions(const_cast<QGLContext *>(context))) {
@@ -367,7 +367,7 @@ QGLShader::QGLShader
d = new QGLShaderPrivate(type);
if (d->create(QGLContext::currentContext()) && !compileFile(fileName)) {
if (d->shader) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glDeleteShader(d->shader);
}
d->shader = 0;
@@ -421,7 +421,7 @@ QGLShader::QGLShader
#endif
if (d->create(context) && !compileFile(fileName)) {
if (d->shader) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glDeleteShader(d->shader);
}
d->shader = 0;
@@ -436,7 +436,7 @@ QGLShader::QGLShader
QGLShader::~QGLShader()
{
if (d->shader) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx))
qWarning("QGLShader::~QGLShader: Shader is not associated with current context.");
@@ -510,7 +510,7 @@ bool QGLShader::compile(const char *source)
src.append(redefineHighp);
#endif
src.append(source);
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glShaderSource(d->shader, src.size(), src.data(), 0);
return d->compile(this);
} else {
@@ -593,7 +593,7 @@ bool QGLShader::compileFile(const QString& fileName)
*/
bool QGLShader::setShaderBinary(GLenum format, const void *binary, int length)
{
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx)) {
qWarning("QGLShader::setShaderBinary: Shader is not associated with current context.");
@@ -633,7 +633,7 @@ bool QGLShader::setShaderBinary(GLenum format, const void *binary, int length)
bool QGLShader::setShaderBinary
(QGLShader& otherShader, GLenum format, const void *binary, int length)
{
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx)) {
qWarning("QGLShader::setShaderBinary: Shader is not associated with current context.");
@@ -699,7 +699,7 @@ QByteArray QGLShader::sourceCode() const
if (!d->shader)
return QByteArray();
GLint size = 0;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glGetShaderiv(d->shader, GL_SHADER_SOURCE_LENGTH, &size);
if (size <= 0)
return QByteArray();
@@ -749,7 +749,7 @@ class QGLShaderProgramPrivate
{
public:
QGLShaderProgramPrivate(const QGLContext *context)
- : ctx(context ? QGLContextPrivate::qt_get_context_group(context) : 0)
+ : ctx(context ? QGLContextPrivate::contextGroup(context) : 0)
, program(0)
, linked(false)
, inited(false)
@@ -761,7 +761,7 @@ public:
}
~QGLShaderProgramPrivate();
- QGLContextGroupResources *ctx;
+ QGLContextGroup *ctx;
GLuint program;
bool linked;
bool inited;
@@ -832,7 +832,7 @@ bool QGLShaderProgram::init()
if (!context)
return false;
if (!d->ctx)
- d->ctx = QGLContextPrivate::qt_get_context_group(context);
+ d->ctx = QGLContextPrivate::contextGroup(context);
#ifndef QT_NO_DEBUG
else if (!qt_check_sharing_with_current_context(d->ctx)) {
qWarning("QGLShaderProgram: Shader program is not associated with current context.");
@@ -840,7 +840,7 @@ bool QGLShaderProgram::init()
}
#endif
if (qt_resolve_glsl_extensions(const_cast<QGLContext *>(context))) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
d->program = glCreateProgram();
if (!(d->program)) {
qWarning() << "QGLShaderProgram: could not create shader program";
@@ -886,7 +886,7 @@ bool QGLShaderProgram::addShader(QGLShader *shader)
if (!shader->d->isPartial) {
if (!shader->d->shader)
return false;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glAttachShader(d->program, shader->d->shader);
} else {
d->hasPartialShaders = true;
@@ -999,7 +999,7 @@ bool QGLShaderProgram::addShaderFromFile
void QGLShaderProgram::removeShader(QGLShader *shader)
{
if (d->program && shader && shader->d->shader) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx))
qWarning("QGLShaderProgram::removeShader: Program is not associated with current context.");
@@ -1037,7 +1037,7 @@ QList<QGLShader *> QGLShaderProgram::shaders() const
void QGLShaderProgram::removeAllShaders()
{
d->removingShaders = true;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx))
qWarning("QGLShaderProgram::removeAllShaders: Program is not associated with current context.");
@@ -1193,7 +1193,7 @@ bool QGLShaderProgram::link()
{
if (!d->program)
return false;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx)) {
qWarning("QGLShaderProgram::link: Program is not associated with current context.");
@@ -1303,7 +1303,7 @@ bool QGLShaderProgram::enable()
return false;
if (!d->linked && !link())
return false;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx)) {
qWarning("QGLShaderProgram::enable: Program is not associated with current context.");