Changeset 651 for trunk/src/opengl/qglshaderprogram.cpp
- Timestamp:
- Mar 8, 2010, 12:52:58 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.2 (added) merged: 650 /branches/vendor/nokia/qt/current merged: 649 /branches/vendor/nokia/qt/4.6.1 removed
- Property svn:mergeinfo changed
-
trunk/src/opengl/qglshaderprogram.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 106 106 107 107 \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 2 108 109 \section1 Binary shaders and programs 110 111 Binary shaders may be specified using \c{glShaderBinary()} on 112 the return value from QGLShader::shaderId(). The QGLShader instance 113 containing the binary can then be added to the shader program with 114 addShader() and linked in the usual fashion with link(). 115 116 Binary programs may be specified using \c{glProgramBinaryOES()} 117 on the return value from programId(). Then the application should 118 call link(), which will notice that the program has already been 119 specified and linked, allowing other operations to be performed 120 on the shader program. 108 121 109 122 \sa QGLShader … … 633 646 return false; 634 647 } 635 if (!shader->d_func()->compiled)636 return false;637 648 if (!shader->d_func()->shaderGuard.id()) 638 649 return false; … … 821 832 if (!program) 822 833 return false; 834 GLint value; 835 if (d->shaders.isEmpty()) { 836 // If there are no explicit shaders, then it is possible that the 837 // application added a program binary with glProgramBinaryOES(), 838 // or otherwise populated the shaders itself. Check to see if the 839 // program is already linked and bail out if so. 840 value = 0; 841 glGetProgramiv(program, GL_LINK_STATUS, &value); 842 d->linked = (value != 0); 843 if (d->linked) 844 return true; 845 } 823 846 glLinkProgram(program); 824 GLintvalue = 0;847 value = 0; 825 848 glGetProgramiv(program, GL_LINK_STATUS, &value); 826 849 d->linked = (value != 0); … … 929 952 { 930 953 Q_D(const QGLShaderProgram); 954 GLuint id = d->programGuard.id(); 955 if (id) 956 return id; 957 958 // Create the identifier if we don't have one yet. This is for 959 // applications that want to create the attached shader configuration 960 // themselves, particularly those using program binaries. 961 if (!const_cast<QGLShaderProgram *>(this)->init()) 962 return 0; 931 963 return d->programGuard.id(); 932 964 }
Note:
See TracChangeset
for help on using the changeset viewer.