Commit 4e12621a authored by Miikka Heikkinen's avatar Miikka Heikkinen Committed by Pasi Keränen
Browse files

Fix getUniform for array and struct uniforms.


Change-Id: I8d30feb99efbb4340a89ef32376dbf7a49e5905c
Task-number: QTBUG-46312
Reviewed-by: default avatarPasi Keränen <pasi.keranen@digia.com>
Showing with 1327 additions and 300 deletions
This diff is collapsed.
...@@ -1210,10 +1210,6 @@ private: ...@@ -1210,10 +1210,6 @@ private:
void uniform3iva(CanvasUniformLocation *location, QVariantList array); void uniform3iva(CanvasUniformLocation *location, QVariantList array);
void uniform4iva(CanvasUniformLocation *location, QVariantList array); void uniform4iva(CanvasUniformLocation *location, QVariantList array);
void uniformMatrix2fva(CanvasUniformLocation *location, bool transpose, QVariantList value);
void uniformMatrix3fva(CanvasUniformLocation *location, bool transpose, QVariantList value);
void uniformMatrix4fva(CanvasUniformLocation *location, bool transpose, QVariantList value);
void vertexAttrib1fva(uint indx, QVariantList values); void vertexAttrib1fva(uint indx, QVariantList values);
void vertexAttrib2fva(uint indx, QVariantList values); void vertexAttrib2fva(uint indx, QVariantList values);
void vertexAttrib3fva(uint indx, QVariantList values); void vertexAttrib3fva(uint indx, QVariantList values);
...@@ -1236,6 +1232,12 @@ private: ...@@ -1236,6 +1232,12 @@ private:
bool isValidTextureBound(glEnums target, const QString &funcName); bool isValidTextureBound(glEnums target, const QString &funcName);
bool checkParent(QObject *jsObj, const char *function); bool checkParent(QObject *jsObj, const char *function);
float *transposeMatrix(int dim, int count, float *src);
void uniformMatrixNfv(int dim, const QJSValue &location3D, bool transpose,
const QJSValue &array);
void uniformMatrixNfva(int dim, CanvasUniformLocation *uniformLocation, bool transpose,
const QVariantList &array);
typedef enum { typedef enum {
CANVAS_NO_ERRORS = 0, CANVAS_NO_ERRORS = 0,
CANVAS_INVALID_ENUM = 1 << 0, CANVAS_INVALID_ENUM = 1 << 0,
......
...@@ -54,7 +54,8 @@ QT_CANVAS3D_BEGIN_NAMESPACE ...@@ -54,7 +54,8 @@ QT_CANVAS3D_BEGIN_NAMESPACE
*/ */
CanvasUniformLocation::CanvasUniformLocation(int location, QObject *parent) : CanvasUniformLocation::CanvasUniformLocation(int location, QObject *parent) :
CanvasAbstractObject(parent), CanvasAbstractObject(parent),
m_location(location) m_location(location),
m_type(-1)
{ {
} }
...@@ -73,6 +74,22 @@ int CanvasUniformLocation::id() ...@@ -73,6 +74,22 @@ int CanvasUniformLocation::id()
return m_location; return m_location;
} }
/*!
* \internal
*/
int CanvasUniformLocation::type()
{
return m_type;
}
/*!
* \internal
*/
void CanvasUniformLocation::setType(int type)
{
m_type = type;
}
/*! /*!
* \internal * \internal
*/ */
......
...@@ -63,11 +63,14 @@ public: ...@@ -63,11 +63,14 @@ public:
virtual ~CanvasUniformLocation(); virtual ~CanvasUniformLocation();
int id(); int id();
int type();
void setType(int type);
friend QDebug operator<< (QDebug d, const CanvasUniformLocation *uLoc); friend QDebug operator<< (QDebug d, const CanvasUniformLocation *uLoc);
private: private:
int m_location; int m_location;
int m_type;
}; };
QT_CANVAS3D_END_NAMESPACE QT_CANVAS3D_END_NAMESPACE
......
This diff is collapsed.
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCanvas3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** 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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.2
import QtCanvas3D 1.0
import QtTest 1.0
import "tst_uniforms.js" as Content
Item {
id: top
height: 300
width: 300
Canvas3D {
id: uniforms_test
property bool heightChanged: false
property bool widthChanged: false
property int initStatus: -1
property int renderStatus: -1
anchors.fill: parent
onInitializeGL: initStatus = Content.initializeGL(uniforms_test)
onPaintGL: {
renderStatus = Content.paintGL(uniforms_test)
}
onHeightChanged: heightChanged = true
onWidthChanged: widthChanged = true
}
TestCase {
name: "Canvas3D_test_uniforms"
when: windowShown
function test_uniforms() {
waitForRendering(uniforms_test)
tryCompare(uniforms_test, "initStatus", 0)
tryCompare(uniforms_test, "renderStatus", 0)
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment