aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-10-07 09:57:01 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-10-12 09:57:43 +0000
commit6df6c10e1af827d06a387e7422176dd310cf83be (patch)
tree4c343d4f30677147af5a8c64e2fdfc107c7f431f /src
parent51a7d0331ed430d0f81d02c1b690bd12da8fdb3b (diff)
Fix enums in QSGGeometry
Minor fixes based on comments from the 5.8 API changes review: Revert to using Qt-style enum values (POSITION -> PositionAttribute). Use ByteType, FloatType, etc. instead of TypeByte, TypeFloat, ... Add comments about magic GL values. Add missing docs for Attribute::createWithAttributeType(). Change-Id: I1b8242efd3936f000ce8df6c11ff9ab7affb5713 Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp2
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp14
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp2
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp4
-rw-r--r--src/quick/items/qquickshadereffectmesh.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp73
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.h117
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp2
-rw-r--r--src/quick/scenegraph/qsgbasicinternalimagenode.cpp10
-rw-r--r--src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp6
-rw-r--r--src/quick/scenegraph/qsgdefaultspritenode.cpp4
11 files changed, 128 insertions, 108 deletions
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp
index fc3ea4e22e..3351486bc6 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12builtinmaterials.cpp
@@ -679,7 +679,7 @@ void QSGD3D12TextMaterial::populate(const QPointF &p,
float glyphCacheInverseScaleX = 1.0 / glyphCacheScaleX;
float glyphCacheInverseScaleY = 1.0 / glyphCacheScaleY;
- Q_ASSERT(geometry->indexType() == QSGGeometry::TypeUnsignedShort);
+ Q_ASSERT(geometry->indexType() == QSGGeometry::UnsignedShortType);
geometry->allocate(glyphIndexes.size() * 4, glyphIndexes.size() * 6);
QVector4D *vp = reinterpret_cast<QVector4D *>(geometry->vertexDataAsTexturedPoint2D());
Q_ASSERT(geometry->sizeOfVertex() == sizeof(QVector4D));
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
index 2644c693ce..a318ce23f7 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
@@ -585,31 +585,31 @@ QSGD3D12Format QSGD3D12Engine::toDXGIFormat(QSGGeometry::Type sgtype, int tupleS
FmtFloat4 };
switch (sgtype) {
- case QSGGeometry::TypeUnsignedByte:
+ case QSGGeometry::UnsignedByteType:
format = formatMap_ub[tupleSize];
if (size)
*size = tupleSize;
break;
- case QSGGeometry::TypeFloat:
+ case QSGGeometry::FloatType:
format = formatMap_f[tupleSize];
if (size)
*size = sizeof(float) * tupleSize;
break;
- case QSGGeometry::TypeUnsignedShort:
+ case QSGGeometry::UnsignedShortType:
format = FmtUnsignedShort;
if (size)
*size = sizeof(ushort) * tupleSize;
break;
- case QSGGeometry::TypeUnsignedInt:
+ case QSGGeometry::UnsignedIntType:
format = FmtUnsignedInt;
if (size)
*size = sizeof(uint) * tupleSize;
break;
- case QSGGeometry::TypeByte:
- case QSGGeometry::TypeInt:
- case QSGGeometry::TypeShort:
+ case QSGGeometry::ByteType:
+ case QSGGeometry::IntType:
+ case QSGGeometry::ShortType:
qWarning("no mapping for GL type 0x%x", sgtype);
break;
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp
index ce633ae996..7f448ecd6f 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12renderer.cpp
@@ -718,7 +718,7 @@ void QSGD3D12Renderer::renderStencilClip(const QSGClipNode *clip, int elementInd
const QSGGeometry *g = clip->geometry();
Q_ASSERT(g->attributeCount() == 1);
Q_ASSERT(g->attributes()[0].tupleSize == 2);
- Q_ASSERT(g->attributes()[0].type == QSGGeometry::TypeFloat);
+ Q_ASSERT(g->attributes()[0].type == QSGGeometry::FloatType);
setInputLayout(g, &sps);
m_engine->finalizePipeline(sps);
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp
index bad222dbaa..807fbcdcec 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12spritenode.cpp
@@ -166,8 +166,8 @@ QSGD3D12Material::UpdateResults QSGD3D12SpriteMaterial::updatePipeline(const QSG
}
static QSGGeometry::Attribute Sprite_Attributes[] = {
- QSGGeometry::Attribute::createWithSemantic(0, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::POSITION),
- QSGGeometry::Attribute::createWithSemantic(1, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD),
+ QSGGeometry::Attribute::createWithAttributeType(0, 2, QSGGeometry::FloatType, QSGGeometry::PositionAttribute),
+ QSGGeometry::Attribute::createWithAttributeType(1, 2, QSGGeometry::FloatType, QSGGeometry::TexCoordAttribute),
};
static QSGGeometry::AttributeSet Sprite_AttributeSet = { 2, 4 * sizeof(float), Sprite_Attributes };
diff --git a/src/quick/items/qquickshadereffectmesh.cpp b/src/quick/items/qquickshadereffectmesh.cpp
index 8616bf8022..b572feb5ee 100644
--- a/src/quick/items/qquickshadereffectmesh.cpp
+++ b/src/quick/items/qquickshadereffectmesh.cpp
@@ -140,7 +140,7 @@ QSGGeometry *QQuickGridMesh::updateGeometry(QSGGeometry *geometry, int attrCount
? QSGGeometry::defaultAttributes_Point2D()
: QSGGeometry::defaultAttributes_TexturedPoint2D(),
(vmesh + 1) * (hmesh + 1), vmesh * 2 * (hmesh + 2),
- QSGGeometry::TypeUnsignedShort);
+ QSGGeometry::UnsignedShortType);
} else {
geometry->allocate((vmesh + 1) * (hmesh + 1), vmesh * 2 * (hmesh + 2));
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index 239557d527..b43a2bc2ba 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -54,18 +54,18 @@ QT_BEGIN_NAMESPACE
QSGGeometry::Attribute QSGGeometry::Attribute::create(int attributeIndex, int tupleSize, int primitiveType, bool isPrimitive)
{
- Attribute a = { attributeIndex, tupleSize, primitiveType, isPrimitive, UNKNOWN, 0 };
+ Attribute a = { attributeIndex, tupleSize, primitiveType, isPrimitive, UnknownAttribute, 0 };
return a;
}
-QSGGeometry::Attribute QSGGeometry::Attribute::createWithSemantic(int pos, int tupleSize, int type, Semantic semantic)
+QSGGeometry::Attribute QSGGeometry::Attribute::createWithAttributeType(int pos, int tupleSize, int primitiveType, AttributeType attributeType)
{
Attribute a;
a.position = pos;
a.tupleSize = tupleSize;
- a.type = type;
- a.isVertexCoordinate = semantic == POSITION;
- a.semantic = semantic;
+ a.type = primitiveType;
+ a.isVertexCoordinate = attributeType == PositionAttribute;
+ a.attributeType = attributeType;
a.reserved = 0;
return a;
}
@@ -78,7 +78,7 @@ QSGGeometry::Attribute QSGGeometry::Attribute::createWithSemantic(int pos, int t
const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_Point2D()
{
static Attribute data[] = {
- Attribute::createWithSemantic(0, 2, TypeFloat, Attribute::POSITION)
+ Attribute::createWithAttributeType(0, 2, FloatType, PositionAttribute)
};
static AttributeSet attrs = { 1, sizeof(float) * 2, data };
return attrs;
@@ -91,8 +91,8 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_Point2D()
const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_TexturedPoint2D()
{
static Attribute data[] = {
- Attribute::createWithSemantic(0, 2, TypeFloat, Attribute::POSITION),
- Attribute::createWithSemantic(1, 2, TypeFloat, Attribute::TEXCOORD)
+ Attribute::createWithAttributeType(0, 2, FloatType, PositionAttribute),
+ Attribute::createWithAttributeType(1, 2, FloatType, TexCoordAttribute)
};
static AttributeSet attrs = { 2, sizeof(float) * 4, data };
return attrs;
@@ -105,8 +105,8 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_TexturedPoint2D(
const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
{
static Attribute data[] = {
- Attribute::createWithSemantic(0, 2, TypeFloat, Attribute::POSITION),
- Attribute::createWithSemantic(1, 4, TypeUnsignedByte, Attribute::COLOR)
+ Attribute::createWithAttributeType(0, 2, FloatType, PositionAttribute),
+ Attribute::createWithAttributeType(1, 4, UnsignedByteType, ColorAttribute)
};
static AttributeSet attrs = { 2, 2 * sizeof(float) + 4 * sizeof(char), data };
return attrs;
@@ -134,12 +134,31 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D()
\fn QSGGeometry::Attribute QSGGeometry::Attribute::create(int pos, int tupleSize, int primitiveType, bool isPosition)
Creates a new QSGGeometry::Attribute for attribute register \a pos with \a
- tupleSize. The \a primitiveType can be any of the supported OpenGL types,
- such as \c GL_FLOAT or \c GL_UNSIGNED_BYTE.
+ tupleSize. The \a primitiveType can be any of the supported types from
+ QSGGeometry::Type, such as QSGGeometry::FloatType or
+ QSGGeometry::UnsignedByteType.
- If the attribute describes the position for the vertex, the \a isPosition hint
- should be set to \c true. The scene graph renderer may use this information
- to perform optimizations.
+ If the attribute describes the position for the vertex, the \a isPosition
+ hint should be set to \c true. The scene graph renderer may use this
+ information to perform optimizations.
+
+ \note Scene graph backends for APIs other than OpenGL may require an
+ accurate description of attributes' usage, and therefore it is recommended
+ to use createWithAttributeType() instead.
+
+ Use the create function to construct the attribute, rather than an
+ initialization list, to ensure that all fields are initialized.
+ */
+
+/*!
+ \fn QSGGeometry::Attribute QSGGeometry::Attribute::createWithAttributeType(int pos, int tupleSize, int primitiveType, AttributeType attributeType)
+
+ Creates a new QSGGeometry::Attribute for attribute register \a pos with \a
+ tupleSize. The \a primitiveType can be any of the supported types from
+ QSGGeometry::Type, such as QSGGeometry::FloatType or
+ QSGGeometry::UnsignedByteType.
+
+ \a attributeType describes the intended use of the attribute.
Use the create function to construct the attribute, rather than an
initialization list, to ensure that all fields are initialized.
@@ -430,9 +449,9 @@ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes,
"GL_UNSIGNED_INT is not supported, geometry will not render"
);
#endif
- if (indexType != TypeUnsignedByte
- && indexType != TypeUnsignedShort
- && indexType != TypeUnsignedInt) {
+ if (indexType != UnsignedByteType
+ && indexType != UnsignedShortType
+ && indexType != UnsignedIntType) {
qFatal("QSGGeometry: Unsupported index type, %x.\n", indexType);
}
@@ -549,13 +568,13 @@ const void *QSGGeometry::indexData() const
GL_UNSIGNED_BYTE, etc. QSGGeometry provies its own type in order to be able
to provide the same API with non-OpenGL backends as well.
- \value TypeByte
- \value TypeUnsignedByte
- \value TypeShort
- \value TypeUnsignedShort
- \value TypeInt
- \value TypeUnsignedInt
- \value TypeFloat
+ \value ByteType
+ \value UnsignedByteType
+ \value ShortType
+ \value UnsignedShortType
+ \value IntType
+ \value UnsignedIntType
+ \value FloatType
*/
/*!
@@ -653,8 +672,8 @@ void QSGGeometry::allocate(int vertexCount, int indexCount)
m_index_data_offset = -1;
m_owns_data = false;
} else {
- Q_ASSERT(m_index_type == TypeUnsignedInt || m_index_type == TypeUnsignedShort);
- int indexByteSize = indexCount * (m_index_type == TypeUnsignedShort ? sizeof(quint16) : sizeof(quint32));
+ Q_ASSERT(m_index_type == UnsignedIntType || m_index_type == UnsignedShortType);
+ int indexByteSize = indexCount * (m_index_type == UnsignedShortType ? sizeof(quint16) : sizeof(quint32));
m_data = (void *) malloc(vertexByteSize + indexByteSize);
m_index_data_offset = vertexByteSize;
m_owns_data = true;
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h
index ae7b2f494c..7a916610e3 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.h
+++ b/src/quick/scenegraph/coreapi/qsggeometry.h
@@ -51,30 +51,60 @@ class QSGGeometryData;
class Q_QUICK_EXPORT QSGGeometry
{
public:
+ enum AttributeType {
+ UnknownAttribute,
+ PositionAttribute,
+ ColorAttribute,
+ TexCoordAttribute,
+ TexCoord1Attribute,
+ TexCoord2Attribute
+ };
+
+ enum DataPattern {
+ AlwaysUploadPattern = 0,
+ StreamPattern = 1,
+ DynamicPattern = 2,
+ StaticPattern = 3
+ };
+
+ // Equivalents to GL_* drawing modes.
+ // Keep in sync with GL headers.
+ enum DrawingMode {
+ DrawPoints = 0x0000,
+ DrawLines = 0x0001,
+ DrawLineLoop = 0x0002,
+ DrawLineStrip = 0x0003,
+ DrawTriangles = 0x0004,
+ DrawTriangleStrip = 0x0005,
+ DrawTriangleFan = 0x0006
+ };
+
+ // Equivalents to GL_BYTE and similar type constants.
+ // Keep in sync with GL headers.
+ enum Type {
+ ByteType = 0x1400,
+ UnsignedByteType = 0x1401,
+ ShortType = 0x1402,
+ UnsignedShortType = 0x1403,
+ IntType = 0x1404,
+ UnsignedIntType = 0x1405,
+ FloatType = 0x1406
+ };
struct Q_QUICK_EXPORT Attribute
{
- enum Semantic {
- UNKNOWN,
- POSITION,
- COLOR,
- TEXCOORD,
- TEXCOORD1,
- TEXCOORD2
- };
-
int position;
int tupleSize;
int type;
uint isVertexCoordinate : 1;
- Semantic semantic : 4;
+ AttributeType attributeType : 4;
uint reserved : 27;
static Attribute create(int pos, int tupleSize, int primitiveType, bool isPosition = false);
- static Attribute createWithSemantic(int pos, int tupleSize, int type, Semantic semantic);
+ static Attribute createWithAttributeType(int pos, int tupleSize, int primitiveType, AttributeType attributeType);
};
struct AttributeSet {
@@ -109,39 +139,10 @@ public:
static const AttributeSet &defaultAttributes_TexturedPoint2D();
static const AttributeSet &defaultAttributes_ColoredPoint2D();
- enum DataPattern {
- AlwaysUploadPattern = 0,
- StreamPattern = 1,
- DynamicPattern = 2,
- StaticPattern = 3
- };
-
- // Equivalents to GL_* drawing modes.
- enum DrawingMode {
- DrawPoints = 0x0000,
- DrawLines = 0x0001,
- DrawLineLoop = 0x0002,
- DrawLineStrip = 0x0003,
- DrawTriangles = 0x0004,
- DrawTriangleStrip = 0x0005,
- DrawTriangleFan = 0x0006
- };
-
- // Equivalents to GL_BYTE and similar type constants.
- enum Type {
- TypeByte = 0x1400,
- TypeUnsignedByte = 0x1401,
- TypeShort = 0x1402,
- TypeUnsignedShort = 0x1403,
- TypeInt = 0x1404,
- TypeUnsignedInt = 0x1405,
- TypeFloat = 0x1406
- };
-
QSGGeometry(const QSGGeometry::AttributeSet &attribs,
int vertexCount,
int indexCount = 0,
- int indexType = TypeUnsignedShort);
+ int indexType = UnsignedShortType);
virtual ~QSGGeometry();
// must use unsigned int to be compatible with the old GLenum to keep BC
@@ -223,25 +224,25 @@ private:
inline uint *QSGGeometry::indexDataAsUInt()
{
- Q_ASSERT(m_index_type == TypeUnsignedInt);
+ Q_ASSERT(m_index_type == UnsignedIntType);
return static_cast<uint *>(indexData());
}
inline quint16 *QSGGeometry::indexDataAsUShort()
{
- Q_ASSERT(m_index_type == TypeUnsignedShort);
+ Q_ASSERT(m_index_type == UnsignedShortType);
return static_cast<quint16 *>(indexData());
}
inline const uint *QSGGeometry::indexDataAsUInt() const
{
- Q_ASSERT(m_index_type == TypeUnsignedInt);
+ Q_ASSERT(m_index_type == UnsignedIntType);
return static_cast<const uint *>(indexData());
}
inline const quint16 *QSGGeometry::indexDataAsUShort() const
{
- Q_ASSERT(m_index_type == TypeUnsignedShort);
+ Q_ASSERT(m_index_type == UnsignedShortType);
return static_cast<const quint16 *>(indexData());
}
@@ -250,7 +251,7 @@ inline QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D()
Q_ASSERT(m_attributes.count == 1);
Q_ASSERT(m_attributes.stride == 2 * sizeof(float));
Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
- Q_ASSERT(m_attributes.attributes[0].type == TypeFloat);
+ Q_ASSERT(m_attributes.attributes[0].type == FloatType);
Q_ASSERT(m_attributes.attributes[0].position == 0);
return static_cast<Point2D *>(m_data);
}
@@ -261,10 +262,10 @@ inline QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D()
Q_ASSERT(m_attributes.stride == 4 * sizeof(float));
Q_ASSERT(m_attributes.attributes[0].position == 0);
Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
- Q_ASSERT(m_attributes.attributes[0].type == TypeFloat);
+ Q_ASSERT(m_attributes.attributes[0].type == FloatType);
Q_ASSERT(m_attributes.attributes[1].position == 1);
Q_ASSERT(m_attributes.attributes[1].tupleSize == 2);
- Q_ASSERT(m_attributes.attributes[1].type == TypeFloat);
+ Q_ASSERT(m_attributes.attributes[1].type == FloatType);
return static_cast<TexturedPoint2D *>(m_data);
}
@@ -274,10 +275,10 @@ inline QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D()
Q_ASSERT(m_attributes.stride == 2 * sizeof(float) + 4 * sizeof(char));
Q_ASSERT(m_attributes.attributes[0].position == 0);
Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
- Q_ASSERT(m_attributes.attributes[0].type == TypeFloat);
+ Q_ASSERT(m_attributes.attributes[0].type == FloatType);
Q_ASSERT(m_attributes.attributes[1].position == 1);
Q_ASSERT(m_attributes.attributes[1].tupleSize == 4);
- Q_ASSERT(m_attributes.attributes[1].type == TypeUnsignedByte);
+ Q_ASSERT(m_attributes.attributes[1].type == UnsignedByteType);
return static_cast<ColoredPoint2D *>(m_data);
}
@@ -286,7 +287,7 @@ inline const QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() const
Q_ASSERT(m_attributes.count == 1);
Q_ASSERT(m_attributes.stride == 2 * sizeof(float));
Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
- Q_ASSERT(m_attributes.attributes[0].type == TypeFloat);
+ Q_ASSERT(m_attributes.attributes[0].type == FloatType);
Q_ASSERT(m_attributes.attributes[0].position == 0);
return static_cast<const Point2D *>(m_data);
}
@@ -297,10 +298,10 @@ inline const QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoin
Q_ASSERT(m_attributes.stride == 4 * sizeof(float));
Q_ASSERT(m_attributes.attributes[0].position == 0);
Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
- Q_ASSERT(m_attributes.attributes[0].type == TypeFloat);
+ Q_ASSERT(m_attributes.attributes[0].type == FloatType);
Q_ASSERT(m_attributes.attributes[1].position == 1);
Q_ASSERT(m_attributes.attributes[1].tupleSize == 2);
- Q_ASSERT(m_attributes.attributes[1].type == TypeFloat);
+ Q_ASSERT(m_attributes.attributes[1].type == FloatType);
return static_cast<const TexturedPoint2D *>(m_data);
}
@@ -310,18 +311,18 @@ inline const QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2
Q_ASSERT(m_attributes.stride == 2 * sizeof(float) + 4 * sizeof(char));
Q_ASSERT(m_attributes.attributes[0].position == 0);
Q_ASSERT(m_attributes.attributes[0].tupleSize == 2);
- Q_ASSERT(m_attributes.attributes[0].type == TypeFloat);
+ Q_ASSERT(m_attributes.attributes[0].type == FloatType);
Q_ASSERT(m_attributes.attributes[1].position == 1);
Q_ASSERT(m_attributes.attributes[1].tupleSize == 4);
- Q_ASSERT(m_attributes.attributes[1].type == TypeUnsignedByte);
+ Q_ASSERT(m_attributes.attributes[1].type == UnsignedByteType);
return static_cast<const ColoredPoint2D *>(m_data);
}
int QSGGeometry::sizeOfIndex() const
{
- if (m_index_type == TypeUnsignedShort) return 2;
- else if (m_index_type == TypeUnsignedByte) return 1;
- else if (m_index_type == TypeUnsignedInt) return 4;
+ if (m_index_type == UnsignedShortType) return 2;
+ else if (m_index_type == UnsignedByteType) return 1;
+ else if (m_index_type == UnsignedIntType) return 4;
return 0;
}
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 2211f88973..a1e1ef8c27 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -1490,7 +1490,7 @@ QDebug operator<<(QDebug d, const QSGGeometryNode *n)
d << "#V:" << g->vertexCount() << "#I:" << g->indexCount();
- if (g->attributeCount() > 0 && g->attributes()->type == QSGGeometry::TypeFloat) {
+ if (g->attributeCount() > 0 && g->attributes()->type == QSGGeometry::FloatType) {
float x1 = 1e10, x2 = -1e10, y1=1e10, y2=-1e10;
int stride = g->sizeOfVertex();
for (int i = 0; i < g->vertexCount(); ++i) {
diff --git a/src/quick/scenegraph/qsgbasicinternalimagenode.cpp b/src/quick/scenegraph/qsgbasicinternalimagenode.cpp
index 685a51550d..c8699218ba 100644
--- a/src/quick/scenegraph/qsgbasicinternalimagenode.cpp
+++ b/src/quick/scenegraph/qsgbasicinternalimagenode.cpp
@@ -55,10 +55,10 @@ namespace
const QSGGeometry::AttributeSet &smoothAttributeSet()
{
static QSGGeometry::Attribute data[] = {
- QSGGeometry::Attribute::createWithSemantic(0, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::POSITION),
- QSGGeometry::Attribute::createWithSemantic(1, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD),
- QSGGeometry::Attribute::createWithSemantic(2, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD1),
- QSGGeometry::Attribute::createWithSemantic(3, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD2)
+ QSGGeometry::Attribute::createWithAttributeType(0, 2, QSGGeometry::FloatType, QSGGeometry::PositionAttribute),
+ QSGGeometry::Attribute::createWithAttributeType(1, 2, QSGGeometry::FloatType, QSGGeometry::TexCoordAttribute),
+ QSGGeometry::Attribute::createWithAttributeType(2, 2, QSGGeometry::FloatType, QSGGeometry::TexCoord1Attribute),
+ QSGGeometry::Attribute::createWithAttributeType(3, 2, QSGGeometry::FloatType, QSGGeometry::TexCoord2Attribute)
};
static QSGGeometry::AttributeSet attrs = { 4, sizeof(SmoothVertex), data };
return attrs;
@@ -427,7 +427,7 @@ QSGGeometry *QSGBasicInternalImageNode::updateGeometry(const QRectF &targetRect,
if (!geometry) {
geometry = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(),
hCells * vCells * 4, hCells * vCells * 6,
- QSGGeometry::TypeUnsignedShort);
+ QSGGeometry::UnsignedShortType);
} else {
geometry->allocate(hCells * vCells * 4, hCells * vCells * 6);
}
diff --git a/src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp b/src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp
index 8fc850b60c..df124cce35 100644
--- a/src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp
+++ b/src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp
@@ -87,9 +87,9 @@ namespace
const QSGGeometry::AttributeSet &smoothAttributeSet()
{
static QSGGeometry::Attribute data[] = {
- QSGGeometry::Attribute::createWithSemantic(0, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::POSITION),
- QSGGeometry::Attribute::createWithSemantic(1, 4, QSGGeometry::TypeUnsignedByte, QSGGeometry::Attribute::COLOR),
- QSGGeometry::Attribute::createWithSemantic(2, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD)
+ QSGGeometry::Attribute::createWithAttributeType(0, 2, QSGGeometry::FloatType, QSGGeometry::PositionAttribute),
+ QSGGeometry::Attribute::createWithAttributeType(1, 4, QSGGeometry::UnsignedByteType, QSGGeometry::ColorAttribute),
+ QSGGeometry::Attribute::createWithAttributeType(2, 2, QSGGeometry::FloatType, QSGGeometry::TexCoordAttribute)
};
static QSGGeometry::AttributeSet attrs = { 3, sizeof(SmoothVertex), data };
return attrs;
diff --git a/src/quick/scenegraph/qsgdefaultspritenode.cpp b/src/quick/scenegraph/qsgdefaultspritenode.cpp
index 89b26f8660..5eb8fb6e08 100644
--- a/src/quick/scenegraph/qsgdefaultspritenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultspritenode.cpp
@@ -150,8 +150,8 @@ QSGMaterialShader *QQuickSpriteMaterial::createShader() const
}
static QSGGeometry::Attribute Sprite_Attributes[] = {
- QSGGeometry::Attribute::create(0, 2, QSGGeometry::TypeFloat, true), // pos
- QSGGeometry::Attribute::create(1, 2, QSGGeometry::TypeFloat), // tex
+ QSGGeometry::Attribute::create(0, 2, QSGGeometry::FloatType, true), // pos
+ QSGGeometry::Attribute::create(1, 2, QSGGeometry::FloatType), // tex
};
static QSGGeometry::AttributeSet Sprite_AttributeSet =