aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml8
-rw-r--r--sources/pyside6/PySide6/glue/qtgui.cpp22
2 files changed, 30 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml
index e565f34d4..3268c88b8 100644
--- a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml
@@ -2695,6 +2695,14 @@
</object-type>
<object-type name="QOpenGLFunctions" since="5.0">
<enum-type name="OpenGLFeature" flags="OpenGLFeatures"/>
+ <add-function signature="glGetShaderSource(unsigned int @shader@)" return-type="const char *">
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp"
+ snippet="glgetshadersource"/>
+ </add-function>
+ <add-function signature="glShaderSource(unsigned int @shader@,const QString &amp; @source@)">
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp"
+ snippet="glshadersource"/>
+ </add-function>
<modify-function signature="glGetAttachedShaders(unsigned int,int,int*,unsigned int*)">
<modify-argument index="3"><array/></modify-argument>
<modify-argument index="4"><array/></modify-argument>
diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp
index 869fb9dc4..f70875865 100644
--- a/sources/pyside6/PySide6/glue/qtgui.cpp
+++ b/sources/pyside6/PySide6/glue/qtgui.cpp
@@ -41,6 +41,28 @@
* INJECT CODE
********************************************************************/
+// @snippet glgetshadersource
+GLsizei bufSize = 4096;
+GLsizei length = bufSize - 1;
+QByteArray buffer;
+for (; length == bufSize - 1; bufSize += 4096) {
+ buffer.resize(qsizetype(bufSize));
+ %CPPSELF->%FUNCTION_NAME(%1, bufSize, &length, buffer.data());
+ if (%CPPSELF->glGetError() != GL_NO_ERROR) {
+ buffer.clear();
+ break;
+ }
+}
+auto *data = buffer.constData();
+%PYARG_0 = %CONVERTTOPYTHON[char *](data);
+// @snippet glgetshadersource
+
+// @snippet glshadersource
+const QByteArray buffer = %2.toUtf8();
+const char *sources[] = {buffer.constData()};
+%CPPSELF->%FUNCTION_NAME(%1, 1, sources, nullptr);
+// @snippet glshadersource
+
// @snippet qtransform-quadtoquad
QTransform _result;
if (QTransform::quadToQuad(%1, %2, _result)) {