File indexing completed on 2024-12-22 04:12:47

0001 /*
0002  *  SPDX-FileCopyrightText: 2021 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 
0008 #ifndef KISOPENGLBUFFERCREATIONGUARD_H
0009 #define KISOPENGLBUFFERCREATIONGUARD_H
0010 
0011 #include <QOpenGLBuffer>
0012 
0013 struct KisOpenGLBufferCreationGuard {
0014     KisOpenGLBufferCreationGuard(QOpenGLBuffer *buffer, int size, QOpenGLBuffer::UsagePattern usagePattern);
0015     ~KisOpenGLBufferCreationGuard();
0016 
0017     inline quint8* data() {
0018         return m_bufferPtr;
0019     }
0020 
0021 private:
0022     QOpenGLBuffer *m_buffer;
0023     quint8 *m_bufferPtr = 0;
0024     bool m_bufferIsMapped = false;
0025 
0026 };
0027 
0028 #endif // KISOPENGLBUFFERCREATIONGUARD_H