/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

//workaround to access protected functions
#define protected public

// default includes
#include <shiboken.h>
#ifndef QT_NO_VERSION_TAGGING
#  define QT_NO_VERSION_TAGGING
#endif
#include <QDebug>
#include <pysidesignal.h>
#include <pysideproperty.h>
#include <pyside.h>
#include <pysideqenum.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED

#include <typeinfo>
#include <iterator>

// module include
#include "pyside6_qtquick_python.h"

// main header
#include "qsgmaterialshader_wrapper.h"

// inner classes
#include "qsgmaterialshader_renderstate_wrapper.h"

#include <cctype>
#include <cstring>



template <class T>
static const char *typeNameOf(const T &t)
{
    const char *typeName =  typeid(t).name();
    auto size = std::strlen(typeName);
#if defined(Q_CC_MSVC) // MSVC: "class QPaintDevice * __ptr64"
    if (auto lastStar = strchr(typeName, '*')) {
        // MSVC: "class QPaintDevice * __ptr64"
        while (*--lastStar == ' ') {
        }
        size = lastStar - typeName + 1;
    }
#else // g++, Clang: "QPaintDevice *" -> "P12QPaintDevice"
    if (size > 2 && typeName[0] == 'P' && std::isdigit(typeName[1])) {
        ++typeName;
        --size;
    }
#endif
    char *result = new char[size + 1];
    result[size] = '\0';
    memcpy(result, typeName, size);
    return result;
}

// Native ---------------------------------------------------------

void QSGMaterialShaderWrapper::resetPyMethodCache()
{
    std::fill_n(m_PyMethodCache, sizeof(m_PyMethodCache) / sizeof(m_PyMethodCache[0]), false);
}

QSGMaterialShaderWrapper::QSGMaterialShaderWrapper() : QSGMaterialShader()
{
    resetPyMethodCache();
    // ... middle
}

bool QSGMaterialShaderWrapper::updateUniformData(QSGMaterialShader::RenderState & state, QSGMaterial * newMaterial, QSGMaterial * oldMaterial)
{
    if (m_PyMethodCache[0])
        return this->::QSGMaterialShader::updateUniformData(state, newMaterial, oldMaterial);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "updateUniformData";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[0] = true;
        return this->::QSGMaterialShader::updateUniformData(state, newMaterial, oldMaterial);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(NNN)",
        Shiboken::Conversions::referenceToPython(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_RENDERSTATE_IDX], &state),
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtQuickTypes[SBK_QSGMATERIAL_IDX], newMaterial),
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtQuickTypes[SBK_QSGMATERIAL_IDX], oldMaterial)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QSGMaterialShader.updateUniformData",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

QSGMaterialShaderWrapper::~QSGMaterialShaderWrapper()
{
    SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this);
    Shiboken::Object::destroy(wrapper, this);
}

// Target ---------------------------------------------------------

extern "C" {
static int
Sbk_QSGMaterialShader_Init(PyObject *self, PyObject *args, PyObject *kwds)
{
    SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);
    PySide::Feature::Select(self);
    if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType< ::QSGMaterialShader >()))
        return -1;

    ::QSGMaterialShaderWrapper *cptr{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtQuick.QSGMaterialShader.__init__";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // QSGMaterialShader()
            cptr = new ::QSGMaterialShaderWrapper();
        }
    }

    if (PyErr_Occurred() || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::QSGMaterialShader >(), cptr)) {
        delete cptr;
        return -1;
    }
    Shiboken::Object::setValidCpp(sbkSelf, true);
    Shiboken::Object::setHasCppWrapper(sbkSelf, true);
    if (Shiboken::BindingManager::instance().hasWrapper(cptr)) {
        Shiboken::BindingManager::instance().releaseWrapper(Shiboken::BindingManager::instance().retrieveWrapper(cptr));
    }
    Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);


    return 1;
}

static PyObject *Sbk_QSGMaterialShaderFunc_flags(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QSGMaterialShader *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtQuick.QSGMaterialShader.flags";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // flags()const
            QFlags<QSGMaterialShader::Flag> cppResult = const_cast<const ::QSGMaterialShader *>(cppSelf)->flags();
            pyResult = Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QSGMaterialShaderFunc_setFlag(PyObject *self, PyObject *args, PyObject *kwds)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QSGMaterialShader *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtQuick.QSGMaterialShader.setFlag";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0};

    // invalid argument lengths
    if (numArgs > 2) {
        static PyObject *const too_many = Shiboken::String::createStaticString(">");
        errInfo.reset(too_many);
        Py_INCREF(errInfo.object());
        goto Sbk_QSGMaterialShaderFunc_setFlag_TypeError;
    } else if (numArgs < 1) {
        static PyObject *const too_few = Shiboken::String::createStaticString("<");
        errInfo.reset(too_few);
        Py_INCREF(errInfo.object());
        goto Sbk_QSGMaterialShaderFunc_setFlag_TypeError;
    }

    if (!PyArg_ParseTuple(args, "|OO:setFlag", &(pyArgs[0]), &(pyArgs[1])))
        return {};


    // Overloaded function decisor
    // 0: QSGMaterialShader::setFlag(QFlags<QSGMaterialShader::Flag>,bool)
    if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, (pyArgs[0])))) {
        if (numArgs == 1) {
            overloadId = 0; // setFlag(QFlags<QSGMaterialShader::Flag>,bool)
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), (pyArgs[1])))) {
            overloadId = 0; // setFlag(QFlags<QSGMaterialShader::Flag>,bool)
        }
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QSGMaterialShaderFunc_setFlag_TypeError;

    // Call function/method
    {
        if (kwds && PyDict_Size(kwds) > 0) {
            PyObject *value{};
            Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
            static PyObject *const key_on = Shiboken::String::createStaticString("on");
            if (PyDict_Contains(kwds, key_on)) {
                value = PyDict_GetItem(kwds, key_on);
                if (value && pyArgs[1]) {
                    errInfo.reset(key_on);
                    Py_INCREF(errInfo.object());
                    goto Sbk_QSGMaterialShaderFunc_setFlag_TypeError;
                }
                if (value) {
                    pyArgs[1] = value;
                    if (!(pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), (pyArgs[1]))))
                        goto Sbk_QSGMaterialShaderFunc_setFlag_TypeError;
                }
                PyDict_DelItem(kwds_dup, key_on);
            }
            if (PyDict_Size(kwds_dup) > 0) {
                errInfo.reset(kwds_dup.release());
                goto Sbk_QSGMaterialShaderFunc_setFlag_TypeError;
            }
        }
        ::QFlags<QSGMaterialShader::Flag> cppArg0 = QFlags<QSGMaterialShader::Flag>(0);
        pythonToCpp[0](pyArgs[0], &cppArg0);
        bool cppArg1 = true;
        if (pythonToCpp[1])
            pythonToCpp[1](pyArgs[1], &cppArg1);

        if (!PyErr_Occurred()) {
            // setFlag(QFlags<QSGMaterialShader::Flag>,bool)
            cppSelf->setFlag(cppArg0, cppArg1);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QSGMaterialShaderFunc_setFlag_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QSGMaterialShaderFunc_setFlags(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QSGMaterialShader *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtQuick.QSGMaterialShader.setFlags";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QSGMaterialShader::setFlags(QFlags<QSGMaterialShader::Flag>)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, (pyArg)))) {
        overloadId = 0; // setFlags(QFlags<QSGMaterialShader::Flag>)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QSGMaterialShaderFunc_setFlags_TypeError;

    // Call function/method
    {
        ::QFlags<QSGMaterialShader::Flag> cppArg0 = QFlags<QSGMaterialShader::Flag>(0);
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setFlags(QFlags<QSGMaterialShader::Flag>)
            cppSelf->setFlags(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QSGMaterialShaderFunc_setFlags_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QSGMaterialShaderFunc_setShaderFileName(PyObject *self, PyObject *args)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QSGMaterialShader *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtQuick.QSGMaterialShader.setShaderFileName";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0};

    // invalid argument lengths


    if (!PyArg_UnpackTuple(args, "setShaderFileName", 2, 2, &(pyArgs[0]), &(pyArgs[1])))
        return {};


    // Overloaded function decisor
    // 0: QSGMaterialShader::setShaderFileName(QSGMaterialShader::Stage,QString)
    if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX]))->converter, (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArgs[1])))) {
        overloadId = 0; // setShaderFileName(QSGMaterialShader::Stage,QString)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QSGMaterialShaderFunc_setShaderFileName_TypeError;

    // Call function/method
    {
        ::QSGMaterialShader::Stage cppArg0{QSGMaterialShader::VertexStage};
        pythonToCpp[0](pyArgs[0], &cppArg0);
        ::QString cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);

        if (!PyErr_Occurred()) {
            // setShaderFileName(QSGMaterialShader::Stage,QString)
            cppSelf->setShaderFileName(cppArg0, cppArg1);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QSGMaterialShaderFunc_setShaderFileName_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QSGMaterialShaderFunc_updateUniformData(PyObject *self, PyObject *args)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QSGMaterialShader *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtQuick.QSGMaterialShader.updateUniformData";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[3];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0, 0};

    // invalid argument lengths


    if (!PyArg_UnpackTuple(args, "updateUniformData", 3, 3, &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2])))
        return {};


    // Overloaded function decisor
    // 0: QSGMaterialShader::updateUniformData(QSGMaterialShader::RenderState&,QSGMaterial*,QSGMaterial*)->bool
    if (numArgs == 3
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_RENDERSTATE_IDX], (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtQuickTypes[SBK_QSGMATERIAL_IDX], (pyArgs[1])))
        && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtQuickTypes[SBK_QSGMATERIAL_IDX], (pyArgs[2])))) {
        overloadId = 0; // updateUniformData(QSGMaterialShader::RenderState&,QSGMaterial*,QSGMaterial*)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QSGMaterialShaderFunc_updateUniformData_TypeError;

    // Call function/method
    {
        if (!Shiboken::Object::isValid(pyArgs[0]))
            return {};
        ::QSGMaterialShader::RenderState cppArg0_local;
        ::QSGMaterialShader::RenderState *cppArg0 = &cppArg0_local;
        if (pythonToCpp[0].isValue())
            pythonToCpp[0](pyArgs[0], &cppArg0_local);
        else
            pythonToCpp[0](pyArgs[0], &cppArg0);

        if (!Shiboken::Object::isValid(pyArgs[1]))
            return {};
        ::QSGMaterial *cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);
        if (!Shiboken::Object::isValid(pyArgs[2]))
            return {};
        ::QSGMaterial *cppArg2;
        pythonToCpp[2](pyArgs[2], &cppArg2);

        if (!PyErr_Occurred()) {
            // updateUniformData(QSGMaterialShader::RenderState&,QSGMaterial*,QSGMaterial*)
            bool cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? cppSelf->::QSGMaterialShader::updateUniformData(*cppArg0, cppArg1, cppArg2)
                : cppSelf->updateUniformData(*cppArg0, cppArg1, cppArg2);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;

    Sbk_QSGMaterialShaderFunc_updateUniformData_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}


static const char *Sbk_QSGMaterialShader_PropertyStrings[] = {
    nullptr // Sentinel
};

static PyMethodDef Sbk_QSGMaterialShader_methods[] = {
    {"flags", reinterpret_cast<PyCFunction>(Sbk_QSGMaterialShaderFunc_flags), METH_NOARGS},
    {"setFlag", reinterpret_cast<PyCFunction>(Sbk_QSGMaterialShaderFunc_setFlag), METH_VARARGS|METH_KEYWORDS},
    {"setFlags", reinterpret_cast<PyCFunction>(Sbk_QSGMaterialShaderFunc_setFlags), METH_O},
    {"setShaderFileName", reinterpret_cast<PyCFunction>(Sbk_QSGMaterialShaderFunc_setShaderFileName), METH_VARARGS},
    {"updateUniformData", reinterpret_cast<PyCFunction>(Sbk_QSGMaterialShaderFunc_updateUniformData), METH_VARARGS},

    {nullptr, nullptr} // Sentinel
};

static int Sbk_QSGMaterialShader_setattro(PyObject *self, PyObject *name, PyObject *value)
{
    PySide::Feature::Select(self);
    if (value && PyCallable_Check(value)) {
        auto plain_inst = reinterpret_cast< ::QSGMaterialShader *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_IDX], reinterpret_cast<SbkObject *>(self)));
        auto inst = dynamic_cast<QSGMaterialShaderWrapper *>(plain_inst);
        if (inst)
            inst->resetPyMethodCache();
    }
    return PyObject_GenericSetAttr(self, name, value);
}

} // extern "C"

static int Sbk_QSGMaterialShader_traverse(PyObject *self, visitproc visit, void *arg)
{
    return SbkObject_TypeF()->tp_traverse(self, visit, arg);
}
static int Sbk_QSGMaterialShader_clear(PyObject *self)
{
    return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_clear(self);
}
// Class Definition -----------------------------------------------
extern "C" {
static PyTypeObject *_Sbk_QSGMaterialShader_Type = nullptr;
static PyTypeObject *Sbk_QSGMaterialShader_TypeF(void)
{
    return _Sbk_QSGMaterialShader_Type;
}

static PyType_Slot Sbk_QSGMaterialShader_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_repr,        nullptr},
    {Py_tp_hash,        nullptr},
    {Py_tp_call,        nullptr},
    {Py_tp_str,         nullptr},
    {Py_tp_getattro,    nullptr},
    {Py_tp_setattro,    reinterpret_cast<void *>(Sbk_QSGMaterialShader_setattro)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_QSGMaterialShader_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_QSGMaterialShader_clear)},
    {Py_tp_richcompare, nullptr},
    {Py_tp_iter,        nullptr},
    {Py_tp_iternext,    nullptr},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_QSGMaterialShader_methods)},
    {Py_tp_getset,      nullptr},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_QSGMaterialShader_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},
    {0, nullptr}
};
static PyType_Spec Sbk_QSGMaterialShader_spec = {
    "2:PySide6.QtQuick.QSGMaterialShader",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_QSGMaterialShader_slots
};

} //extern "C"

PyObject *SbkPySide6_QtQuick_QSGMaterialShader_Flag___and__(PyObject *self, PyObject *pyArg)
{
    ::QSGMaterialShader::Flags cppResult, cppSelf, cppArg;
    cppSelf = static_cast<::QSGMaterialShader::Flags>(int(PyLong_AsLong(self)));
    if (PyErr_Occurred())
        return nullptr;
    cppArg = static_cast<QSGMaterialShader::Flags>(int(PyLong_AsLong(pyArg)));
    if (PyErr_Occurred())
        return nullptr;
    cppResult = cppSelf & cppArg;
    return Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, &cppResult);
}

PyObject *SbkPySide6_QtQuick_QSGMaterialShader_Flag___or__(PyObject *self, PyObject *pyArg)
{
    ::QSGMaterialShader::Flags cppResult, cppSelf, cppArg;
    cppSelf = static_cast<::QSGMaterialShader::Flags>(int(PyLong_AsLong(self)));
    if (PyErr_Occurred())
        return nullptr;
    cppArg = static_cast<QSGMaterialShader::Flags>(int(PyLong_AsLong(pyArg)));
    if (PyErr_Occurred())
        return nullptr;
    cppResult = cppSelf | cppArg;
    return Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, &cppResult);
}

PyObject *SbkPySide6_QtQuick_QSGMaterialShader_Flag___xor__(PyObject *self, PyObject *pyArg)
{
    ::QSGMaterialShader::Flags cppResult, cppSelf, cppArg;
    cppSelf = static_cast<::QSGMaterialShader::Flags>(int(PyLong_AsLong(self)));
    if (PyErr_Occurred())
        return nullptr;
    cppArg = static_cast<QSGMaterialShader::Flags>(int(PyLong_AsLong(pyArg)));
    if (PyErr_Occurred())
        return nullptr;
    cppResult = cppSelf ^ cppArg;
    return Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, &cppResult);
}

PyObject *SbkPySide6_QtQuick_QSGMaterialShader_Flag___invert__(PyObject *self, PyObject *pyArg)
{
    ::QSGMaterialShader::Flags cppSelf;
    Shiboken::Conversions::pythonToCppCopy(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, self, &cppSelf);
    ::QSGMaterialShader::Flags cppResult = ~cppSelf;
    return Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, &cppResult);
}

static PyObject *SbkPySide6_QtQuick_QSGMaterialShader_Flag_long(PyObject *self)
{
    int val;
    Shiboken::Conversions::pythonToCppCopy(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, self, &val);
    return Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &val);
}
static int SbkPySide6_QtQuick_QSGMaterialShader_Flag__nonzero(PyObject *self)
{
    int val;
    Shiboken::Conversions::pythonToCppCopy(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))->converter, self, &val);
    return val != 0;
}

static PyType_Slot SbkPySide6_QtQuick_QSGMaterialShader_Flag_number_slots[] = {
    {Py_nb_bool,    reinterpret_cast<void *>(SbkPySide6_QtQuick_QSGMaterialShader_Flag__nonzero)},
    {Py_nb_invert,  reinterpret_cast<void *>(SbkPySide6_QtQuick_QSGMaterialShader_Flag___invert__)},
    {Py_nb_and,     reinterpret_cast<void *>(SbkPySide6_QtQuick_QSGMaterialShader_Flag___and__)},
    {Py_nb_xor,     reinterpret_cast<void *>(SbkPySide6_QtQuick_QSGMaterialShader_Flag___xor__)},
    {Py_nb_or,      reinterpret_cast<void *>(SbkPySide6_QtQuick_QSGMaterialShader_Flag___or__)},
    {Py_nb_int,     reinterpret_cast<void *>(SbkPySide6_QtQuick_QSGMaterialShader_Flag_long)},
    {Py_nb_index,   reinterpret_cast<void *>(SbkPySide6_QtQuick_QSGMaterialShader_Flag_long)},
    {0, nullptr} // sentinel
};



// Type conversion functions.

// Python to C++ enum conversion.
static void QSGMaterialShader_Flag_PythonToCpp_QSGMaterialShader_Flag(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QSGMaterialShader::Flag *>(cppOut) =
        static_cast<::QSGMaterialShader::Flag>(Shiboken::Enum::getValue(pyIn));

}
static PythonToCppFunc is_QSGMaterialShader_Flag_PythonToCpp_QSGMaterialShader_Flag_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX]))
        return QSGMaterialShader_Flag_PythonToCpp_QSGMaterialShader_Flag;
    return {};
}
static PyObject *QSGMaterialShader_Flag_CppToPython_QSGMaterialShader_Flag(const void *cppIn)
{
    const int castCppIn = int(*reinterpret_cast<const ::QSGMaterialShader::Flag *>(cppIn));
    return Shiboken::Enum::newItem(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX], castCppIn);

}

static void QFlags_QSGMaterialShader_Flag__PythonToCpp_QFlags_QSGMaterialShader_Flag_(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QFlags<QSGMaterialShader::Flag> *>(cppOut) =
        ::QFlags<QSGMaterialShader::Flag>(QFlag(int(PySide::QFlags::getValue(reinterpret_cast<PySideQFlagsObject *>(pyIn)))));

}
static PythonToCppFunc is_QFlags_QSGMaterialShader_Flag__PythonToCpp_QFlags_QSGMaterialShader_Flag__Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]))
        return QFlags_QSGMaterialShader_Flag__PythonToCpp_QFlags_QSGMaterialShader_Flag_;
    return {};
}
static PyObject *QFlags_QSGMaterialShader_Flag__CppToPython_QFlags_QSGMaterialShader_Flag_(const void *cppIn)
{
    const int castCppIn = int(*reinterpret_cast<const ::QFlags<QSGMaterialShader::Flag> *>(cppIn));
    return reinterpret_cast<PyObject *>(PySide::QFlags::newObject(castCppIn, SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]));

}

static void QSGMaterialShader_Flag_PythonToCpp_QFlags_QSGMaterialShader_Flag_(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QFlags<QSGMaterialShader::Flag> *>(cppOut) =
        ::QFlags<QSGMaterialShader::Flag>(QFlag(int(Shiboken::Enum::getValue(pyIn))));

}
static PythonToCppFunc is_QSGMaterialShader_Flag_PythonToCpp_QFlags_QSGMaterialShader_Flag__Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX]))
        return QSGMaterialShader_Flag_PythonToCpp_QFlags_QSGMaterialShader_Flag_;
    return {};
}
static void number_PythonToCpp_QFlags_QSGMaterialShader_Flag_(PyObject *pyIn, void *cppOut)
{
    Shiboken::AutoDecRef pyLong(PyNumber_Long(pyIn));
    *reinterpret_cast<::QFlags<QSGMaterialShader::Flag> *>(cppOut) =
        ::QFlags<QSGMaterialShader::Flag>(QFlag(int(PyLong_AsLong(pyLong.object()))));

}
static PythonToCppFunc is_number_PythonToCpp_QFlags_QSGMaterialShader_Flag__Convertible(PyObject *pyIn)
{
    if (PyNumber_Check(pyIn) && PyObject_TypeCheck(pyIn, SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX]))
        return number_PythonToCpp_QFlags_QSGMaterialShader_Flag_;
    return {};
}
static void QSGMaterialShader_Stage_PythonToCpp_QSGMaterialShader_Stage(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QSGMaterialShader::Stage *>(cppOut) =
        static_cast<::QSGMaterialShader::Stage>(Shiboken::Enum::getValue(pyIn));

}
static PythonToCppFunc is_QSGMaterialShader_Stage_PythonToCpp_QSGMaterialShader_Stage_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX]))
        return QSGMaterialShader_Stage_PythonToCpp_QSGMaterialShader_Stage;
    return {};
}
static PyObject *QSGMaterialShader_Stage_CppToPython_QSGMaterialShader_Stage(const void *cppIn)
{
    const int castCppIn = int(*reinterpret_cast<const ::QSGMaterialShader::Stage *>(cppIn));
    return Shiboken::Enum::newItem(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX], castCppIn);

}

// Python to C++ pointer conversion - returns the C++ object of the Python wrapper (keeps object identity).
static void QSGMaterialShader_PythonToCpp_QSGMaterialShader_PTR(PyObject *pyIn, void *cppOut)
{
    Shiboken::Conversions::pythonToCppPointer(Sbk_QSGMaterialShader_TypeF(), pyIn, cppOut);
}
static PythonToCppFunc is_QSGMaterialShader_PythonToCpp_QSGMaterialShader_PTR_Convertible(PyObject *pyIn)
{
    if (pyIn == Py_None)
        return Shiboken::Conversions::nonePythonToCppNullPtr;
    if (PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(Sbk_QSGMaterialShader_TypeF())))
        return QSGMaterialShader_PythonToCpp_QSGMaterialShader_PTR;
    return {};
}

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *QSGMaterialShader_PTR_CppToPython_QSGMaterialShader(const void *cppIn)
{
    auto pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn));
    if (pyOut) {
        Py_INCREF(pyOut);
        return pyOut;
    }
    bool changedTypeName = false;
    auto tCppIn = reinterpret_cast<const ::QSGMaterialShader *>(cppIn);
    const char *typeName = typeid(*tCppIn).name();
    auto sbkType = Shiboken::ObjectType::typeForTypeName(typeName);
    if (sbkType && Shiboken::ObjectType::hasSpecialCastFunction(sbkType)) {
        typeName = typeNameOf(tCppIn);
        changedTypeName = true;
    }
    PyObject *result = Shiboken::Object::newObject(Sbk_QSGMaterialShader_TypeF(), const_cast<void *>(cppIn), false, /* exactType */ changedTypeName, typeName);
    if (changedTypeName)
        delete [] typeName;
    return result;
}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
static const char *QSGMaterialShader_SignatureStrings[] = {
    "PySide6.QtQuick.QSGMaterialShader(self)",
    "PySide6.QtQuick.QSGMaterialShader.flags(self)->PySide6.QtQuick.QSGMaterialShader.Flags",
    "PySide6.QtQuick.QSGMaterialShader.setFlag(self,flags:PySide6.QtQuick.QSGMaterialShader.Flags,on:bool=true)",
    "PySide6.QtQuick.QSGMaterialShader.setFlags(self,flags:PySide6.QtQuick.QSGMaterialShader.Flags)",
    "PySide6.QtQuick.QSGMaterialShader.setShaderFileName(self,stage:PySide6.QtQuick.QSGMaterialShader.Stage,filename:QString)",
    "PySide6.QtQuick.QSGMaterialShader.updateUniformData(self,state:PySide6.QtQuick.QSGMaterialShader.RenderState,newMaterial:PySide6.QtQuick.QSGMaterial,oldMaterial:PySide6.QtQuick.QSGMaterial)->bool",
    nullptr}; // Sentinel

void init_QSGMaterialShader(PyObject *module)
{
    _Sbk_QSGMaterialShader_Type = Shiboken::ObjectType::introduceWrapperType(
        module,
        "QSGMaterialShader",
        "QSGMaterialShader*",
        &Sbk_QSGMaterialShader_spec,
        &Shiboken::callCppDestructor< ::QSGMaterialShader >,
        0,
        0,
        0);
    auto *pyType = Sbk_QSGMaterialShader_TypeF(); // references _Sbk_QSGMaterialShader_Type
    InitSignatureStrings(pyType, QSGMaterialShader_SignatureStrings);
    SbkObjectType_SetPropertyStrings(reinterpret_cast<PyTypeObject *>(_Sbk_QSGMaterialShader_Type), Sbk_QSGMaterialShader_PropertyStrings);
    SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_IDX]
        = Sbk_QSGMaterialShader_TypeF();

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(Sbk_QSGMaterialShader_TypeF(),
        QSGMaterialShader_PythonToCpp_QSGMaterialShader_PTR,
        is_QSGMaterialShader_PythonToCpp_QSGMaterialShader_PTR_Convertible,
        QSGMaterialShader_PTR_CppToPython_QSGMaterialShader);

    Shiboken::Conversions::registerConverterName(converter, "QSGMaterialShader");
    Shiboken::Conversions::registerConverterName(converter, "QSGMaterialShader*");
    Shiboken::Conversions::registerConverterName(converter, "QSGMaterialShader&");
    Shiboken::Conversions::registerConverterName(converter, typeid(::QSGMaterialShader).name());
    Shiboken::Conversions::registerConverterName(converter, typeid(::QSGMaterialShaderWrapper).name());


    // Initialization of enums.

    // Initialization of enum 'Flag'.
    SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX] = PySide::QFlags::create("2:PySide6.QtQuick.QSGMaterialShader.Flags", SbkPySide6_QtQuick_QSGMaterialShader_Flag_number_slots);
    SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX] = Shiboken::Enum::createScopedEnum(Sbk_QSGMaterialShader_TypeF(),
        "Flag",
        "2:PySide6.QtQuick.QSGMaterialShader.Flag",
        "QSGMaterialShader::Flag",
        SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX]);
    if (!SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX])
        return;

    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX],
        Sbk_QSGMaterialShader_TypeF(), "UpdatesGraphicsPipelineState", (long) QSGMaterialShader::Flag::UpdatesGraphicsPipelineState))
        return;
    // Register converter for enum 'QSGMaterialShader::Flag'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX],
            QSGMaterialShader_Flag_CppToPython_QSGMaterialShader_Flag);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QSGMaterialShader_Flag_PythonToCpp_QSGMaterialShader_Flag,
            is_QSGMaterialShader_Flag_PythonToCpp_QSGMaterialShader_Flag_Convertible);
        Shiboken::Enum::setTypeConverter(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_FLAG_IDX], converter, false);
        Shiboken::Conversions::registerConverterName(converter, "QSGMaterialShader::Flag");
        Shiboken::Conversions::registerConverterName(converter, "Flag");
    }
    // Register converter for flag 'QFlags<QSGMaterialShader::Flag>'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX],
            QFlags_QSGMaterialShader_Flag__CppToPython_QFlags_QSGMaterialShader_Flag_);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QSGMaterialShader_Flag_PythonToCpp_QFlags_QSGMaterialShader_Flag_,
            is_QSGMaterialShader_Flag_PythonToCpp_QFlags_QSGMaterialShader_Flag__Convertible);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QFlags_QSGMaterialShader_Flag__PythonToCpp_QFlags_QSGMaterialShader_Flag_,
            is_QFlags_QSGMaterialShader_Flag__PythonToCpp_QFlags_QSGMaterialShader_Flag__Convertible);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            number_PythonToCpp_QFlags_QSGMaterialShader_Flag_,
            is_number_PythonToCpp_QFlags_QSGMaterialShader_Flag__Convertible);
        Shiboken::Enum::setTypeConverter(SbkPySide6_QtQuickTypes[SBK_QFLAGS_QSGMATERIALSHADER_FLAG_IDX], converter, true);
        Shiboken::Conversions::registerConverterName(converter, "QSGMaterialShader::Flags");
        Shiboken::Conversions::registerConverterName(converter, "Flags");
        Shiboken::Conversions::registerConverterName(converter, "QFlags<QSGMaterialShader::Flag>");
    }
    // End of 'Flag' enum/flags.

    // Initialization of enum 'Stage'.
    SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX] = Shiboken::Enum::createScopedEnum(Sbk_QSGMaterialShader_TypeF(),
        "Stage",
        "2:PySide6.QtQuick.QSGMaterialShader.Stage",
        "QSGMaterialShader::Stage");
    if (!SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX])
        return;

    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX],
        Sbk_QSGMaterialShader_TypeF(), "VertexStage", (long) QSGMaterialShader::Stage::VertexStage))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX],
        Sbk_QSGMaterialShader_TypeF(), "FragmentStage", (long) QSGMaterialShader::Stage::FragmentStage))
        return;
    // Register converter for enum 'QSGMaterialShader::Stage'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX],
            QSGMaterialShader_Stage_CppToPython_QSGMaterialShader_Stage);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QSGMaterialShader_Stage_PythonToCpp_QSGMaterialShader_Stage,
            is_QSGMaterialShader_Stage_PythonToCpp_QSGMaterialShader_Stage_Convertible);
        Shiboken::Enum::setTypeConverter(SbkPySide6_QtQuickTypes[SBK_QSGMATERIALSHADER_STAGE_IDX], converter, false);
        Shiboken::Conversions::registerConverterName(converter, "QSGMaterialShader::Stage");
        Shiboken::Conversions::registerConverterName(converter, "Stage");
    }
    // End of 'Stage' enum.

    qRegisterMetaType< ::QSGMaterialShader::Flag >("QSGMaterialShader::Flag");
    qRegisterMetaType< ::QSGMaterialShader::Flags >("QSGMaterialShader::Flags");
    qRegisterMetaType< ::QSGMaterialShader::Stage >("QSGMaterialShader::Stage");
}
