aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-01-17 07:11:26 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-01-17 07:12:23 +0100
commitf596553e03c3969f6e7cb5344c05591da6e70dfb (patch)
tree8aef667749e1adc015cbc9c5ec5b5af9c6d4c15c /src/quick
parente32845b137834ef46d68345a0029d4af7c1d85bb (diff)
parent7030adff1869e850a7b983e88d7a773d5d594886 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: .qmake.conf src/imports/dialogs/DefaultFileDialog.qml src/imports/widgets/qquickqfiledialog.cpp Change-Id: I00de6dd05cb773f01254061d585a82c90b229acd
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc15
-rw-r--r--src/quick/items/qquickitem.cpp6
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp85
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h8
-rw-r--r--src/quick/scenegraph/scenegraph.pri2
5 files changed, 82 insertions, 34 deletions
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index abef6b765b..f1e13e127c 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -110,20 +110,7 @@ by the other approaches. A QAbstractItemModel can also automatically
notify a QML view when the model data changes.
The roles of a QAbstractItemModel subclass can be exposed to QML by
-reimplementing QAbstractItemModel::roleNames(). The default role names
-set by Qt are:
-
-\table
-\header
-\li Qt Role
-\li QML Role Name
-\row
-\li Qt::DisplayRole
-\li display
-\row
-\li Qt::DecorationRole
-\li decoration
-\endtable
+reimplementing QAbstractItemModel::roleNames().
Here is an application with a QAbstractListModel subclass named \c AnimalModel,
which exposes the \e type and \e sizes roles. It reimplements
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 110a8b7586..2a507a27b1 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2067,8 +2067,12 @@ bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item)
if (role == QAccessible::EditableText
|| role == QAccessible::Table
|| role == QAccessible::List
- || role == QAccessible::SpinBox)
+ || role == QAccessible::SpinBox) {
result = true;
+ } else if (role == QAccessible::ComboBox) {
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(item);
+ return iface->state().editable;
+ }
}
#endif
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 4e62f85d30..eff8158335 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -106,8 +106,7 @@ bool qsg_sort_batch_is_valid(Batch *a, Batch *b) { return a->first && !b->first;
bool qsg_sort_batch_increasing_order(Batch *a, Batch *b) { return a->first->order < b->first->order; }
bool qsg_sort_batch_decreasing_order(Batch *a, Batch *b) { return a->first->order > b->first->order; }
-QSGMaterial::Flag QSGMaterial_FullMatrix = (QSGMaterial::Flag) (QSGMaterial::RequiresFullMatrix & ~QSGMaterial::RequiresFullMatrixExceptTranslate);
-QSGMaterial::Flag QSGMaterial_FullExceptTranslate = (QSGMaterial::Flag) (QSGMaterial::RequiresFullMatrixExceptTranslate & ~QSGMaterial::RequiresDeterminant);
+QSGMaterial::Flag QSGMaterial_RequiresFullMatrixBit = (QSGMaterial::Flag) (QSGMaterial::RequiresFullMatrix & ~QSGMaterial::RequiresFullMatrixExceptTranslate);
struct QMatrix4x4_Accessor
{
@@ -827,6 +826,9 @@ static void qsg_wipeBuffer(Buffer *buffer, QOpenGLFunctions *funcs)
static void qsg_wipeBatch(Batch *batch, QOpenGLFunctions *funcs)
{
qsg_wipeBuffer(&batch->vbo, funcs);
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ qsg_wipeBuffer(&batch->ibo, funcs);
+#endif
delete batch;
}
@@ -879,12 +881,13 @@ void Renderer::map(Buffer *buffer, int byteSize)
}
}
-void Renderer::unmap(Buffer *buffer)
+void Renderer::unmap(Buffer *buffer, bool isIndexBuf)
{
if (buffer->id == 0)
glGenBuffers(1, &buffer->id);
- glBindBuffer(GL_ARRAY_BUFFER, buffer->id);
- glBufferData(GL_ARRAY_BUFFER, buffer->size, buffer->data, m_bufferStrategy);
+ GLenum target = isIndexBuf ? GL_ELEMENT_ARRAY_BUFFER : GL_ARRAY_BUFFER;
+ glBindBuffer(target, buffer->id);
+ glBufferData(target, buffer->size, buffer->data, m_bufferStrategy);
}
BatchRootInfo *Renderer::batchRootInfo(Node *node)
@@ -1700,12 +1703,14 @@ void Renderer::uploadBatch(Batch *b)
QSGGeometryNode *gn = b->first->node;
QSGGeometry *g = gn->geometry();
- QSGMaterial::Flags flags = gn->activeMaterial()->flags();
+
bool canMerge = (g->drawingMode() == GL_TRIANGLES || g->drawingMode() == GL_TRIANGLE_STRIP)
&& b->positionAttribute >= 0
&& g->indexType() == GL_UNSIGNED_SHORT
- && (flags & (QSGMaterial::CustomCompileStep | QSGMaterial_FullMatrix)) == 0
- && ((flags & QSGMaterial_FullExceptTranslate) == 0 || b->isTranslateOnlyToRoot())
+ && (gn->activeMaterial()->flags() & QSGMaterial::CustomCompileStep) == 0
+ && (((gn->activeMaterial()->flags() & QSGMaterial::RequiresDeterminant) == 0)
+ || (((gn->activeMaterial()->flags() & QSGMaterial_RequiresFullMatrixBit) == 0) && b->isTranslateOnlyToRoot())
+ )
&& b->isSafeToBatch();
b->merged = canMerge;
@@ -1753,10 +1758,19 @@ void Renderer::uploadBatch(Batch *b)
non-merged.
*/
int bufferSize = b->vertexCount * g->sizeOfVertex();
- if (b->merged)
- bufferSize += b->vertexCount * sizeof(float) + b->indexCount * sizeof(quint16);
- else
- bufferSize += unmergedIndexSize;
+ int ibufferSize = 0;
+ if (b->merged) {
+ bufferSize += b->vertexCount * sizeof(float);
+ ibufferSize = b->indexCount * sizeof(quint16);
+ } else {
+ ibufferSize = unmergedIndexSize;
+ }
+
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ map(&b->ibo, ibufferSize);
+#else
+ bufferSize += ibufferSize;
+#endif
map(&b->vbo, bufferSize);
if (Q_UNLIKELY(debug_upload)) qDebug() << " - batch" << b << " first:" << b->first << " root:"
@@ -1766,21 +1780,35 @@ void Renderer::uploadBatch(Batch *b)
if (b->merged) {
char *vertexData = b->vbo.data;
char *zData = vertexData + b->vertexCount * g->sizeOfVertex();
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ char *indexData = b->ibo.data;
+#else
char *indexData = zData + b->vertexCount * sizeof(float);
+#endif
quint16 iOffset = 0;
e = b->first;
int verticesInSet = 0;
int indicesInSet = 0;
b->drawSets.reset();
- b->drawSets << DrawSet(0, zData - vertexData, indexData - vertexData);
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ int drawSetIndices = 0;
+#else
+ int drawSetIndices = indexData - vertexData;
+#endif
+ b->drawSets << DrawSet(0, zData - vertexData, drawSetIndices);
while (e) {
verticesInSet += e->node->geometry()->vertexCount();
if (verticesInSet > 0xffff) {
b->drawSets.last().indexCount = indicesInSet;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ drawSetIndices = indexData - b->ibo.data;
+#else
+ drawSetIndices = indexData - b->vbo.data;
+#endif
b->drawSets << DrawSet(vertexData - b->vbo.data,
zData - b->vbo.data,
- indexData - b->vbo.data);
+ drawSetIndices);
iOffset = 0;
verticesInSet = e->node->geometry()->vertexCount();
indicesInSet = 0;
@@ -1791,7 +1819,11 @@ void Renderer::uploadBatch(Batch *b)
b->drawSets.last().indexCount = indicesInSet;
} else {
char *vboData = b->vbo.data;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ char *iboData = b->ibo.data;
+#else
char *iboData = vboData + b->vertexCount * g->sizeOfVertex();
+#endif
Element *e = b->first;
while (e) {
QSGGeometry *g = e->node->geometry();
@@ -1858,6 +1890,9 @@ void Renderer::uploadBatch(Batch *b)
}
unmap(&b->vbo);
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ unmap(&b->ibo, true);
+#endif
if (Q_UNLIKELY(debug_upload)) qDebug() << " --- vertex/index buffers unmapped, batch upload completed...";
@@ -1982,11 +2017,16 @@ void Renderer::renderMergedBatch(const Batch *batch)
glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id);
char *indexBase = 0;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ const Buffer *indexBuf = &batch->ibo;
+#else
+ const Buffer *indexBuf = &batch->vbo;
+#endif
if (m_context->hasBrokenIndexBufferObjects()) {
- indexBase = batch->vbo.data;
+ indexBase = indexBuf->data;
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
} else {
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, batch->vbo.id);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuf->id);
}
@@ -2056,12 +2096,17 @@ void Renderer::renderUnmergedBatch(const Batch *batch)
glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id);
char *indexBase = 0;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ const Buffer *indexBuf = &batch->ibo;
+#else
+ const Buffer *indexBuf = &batch->vbo;
+#endif
if (batch->indexCount) {
if (m_context->hasBrokenIndexBufferObjects()) {
- indexBase = batch->vbo.data;
+ indexBase = indexBuf->data;
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
} else {
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, batch->vbo.id);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuf->id);
}
}
@@ -2082,7 +2127,11 @@ void Renderer::renderUnmergedBatch(const Batch *batch)
}
int vOffset = 0;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ char *iOffset = indexBase;
+#else
char *iOffset = indexBase + batch->vertexCount * gn->geometry()->sizeOfVertex();
+#endif
QMatrix4x4 rootMatrix = batch->root ? matrixForRoot(batch->root) : QMatrix4x4();
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 5404b669a0..001c3b21ab 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -276,6 +276,9 @@ struct Batch
mutable uint uploadedThisFrame : 1; // solely for debugging purposes
Buffer vbo;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ Buffer ibo;
+#endif
QDataBuffer<DrawSet> drawSets;
};
@@ -411,7 +414,7 @@ private:
void map(Buffer *buffer, int size);
- void unmap(Buffer *buffer);
+ void unmap(Buffer *buffer, bool isIndexBuf = false);
void buildRenderListsFromScratch();
void buildRenderListsForTaggedRoots();
@@ -495,6 +498,9 @@ Batch *Renderer::newBatch()
} else {
b = new Batch();
memset(&b->vbo, 0, sizeof(Buffer));
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ memset(&b->ibo, 0, sizeof(Buffer));
+#endif
}
b->init();
return b;
diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri
index 6f64c881a8..6868e10b90 100644
--- a/src/quick/scenegraph/scenegraph.pri
+++ b/src/quick/scenegraph/scenegraph.pri
@@ -1,5 +1,7 @@
!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
+# DEFINES += QSG_SEPARATE_INDEX_BUFFER
+
# Core API
HEADERS += \
$$PWD/coreapi/qsgbatchrenderer_p.h \