aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-04-12 18:15:52 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-04-13 09:19:18 +0200
commit6e6079031cf44149be4ca1f05547b4c03e505290 (patch)
treed16fb11a3cdb50f367fea645359538523ab83620 /src/quick/scenegraph/coreapi
parent38d2d6ede6722b0fb86ee6723bbfbb2b063c4d6b (diff)
parent8ca22ca7eb5216513410651411fd2e0f07e50f34 (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp8
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h27
2 files changed, 14 insertions, 21 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 8f08020374..a89dbc0ea2 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -2105,8 +2105,8 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip)
if (!m_clipProgram.isLinked()) {
QSGShaderSourceBuilder::initializeProgramFromFiles(
&m_clipProgram,
- QStringLiteral(":/scenegraph/shaders/stencilclip.vert"),
- QStringLiteral(":/scenegraph/shaders/stencilclip.frag"));
+ QStringLiteral(":/qt-project.org/scenegraph/shaders/stencilclip.vert"),
+ QStringLiteral(":/qt-project.org/scenegraph/shaders/stencilclip.frag"));
m_clipProgram.bindAttributeLocation("vCoord", 0);
m_clipProgram.link();
m_clipMatrixId = m_clipProgram.uniformLocation("matrix");
@@ -3116,8 +3116,8 @@ void Renderer::visualize()
VisualizeShader *prog = new VisualizeShader();
QSGShaderSourceBuilder::initializeProgramFromFiles(
prog,
- QStringLiteral(":/scenegraph/shaders/visualization.vert"),
- QStringLiteral(":/scenegraph/shaders/visualization.frag"));
+ QStringLiteral(":/qt-project.org/scenegraph/shaders/visualization.vert"),
+ QStringLiteral(":/qt-project.org/scenegraph/shaders/visualization.frag"));
prog->bindAttributeLocation("v", 0);
prog->link();
prog->bind();
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 1c62b69769..a84ac6d177 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -104,7 +104,11 @@ public:
: available(PageSize)
, allocated(PageSize)
{
- for (int i=0; i<PageSize; ++i) blocks[i] = i;
+ for (int i=0; i<PageSize; ++i)
+ blocks[i] = i;
+
+ // Zero out all new pages.
+ memset(data, 0, sizeof(data));
}
const Type *at(uint index) const
@@ -156,7 +160,7 @@ public:
void *mem = p->at(pos);
p->available--;
p->allocated.setBit(pos);
- Type *t = new (mem) Type();
+ Type *t = (Type*)mem;
return t;
}
@@ -166,8 +170,9 @@ public:
if (!page->allocated.testBit(index))
qFatal("Double delete in allocator: page=%d, index=%d", pageIndex , index);
- // Call the destructor
- page->at(index)->~Type();
+ // Zero this instance as we're done with it.
+ void *mem = page->at(index);
+ memset(mem, 0, sizeof(Type));
page->allocated[index] = false;
page->available++;
@@ -443,21 +448,9 @@ struct Batch
QDataBuffer<DrawSet> drawSets;
};
+// NOTE: Node is zero-allocated by the Allocator.
struct Node
{
- Node()
- : sgNode(0)
- , parent(0)
- , data(0)
- , firstChild(0)
- , nextSibling(0)
- , lastChild(0)
- , dirtyState(0)
- , isOpaque(false)
- , isBatchRoot(false)
- {
- }
-
QSGNode *sgNode;
Node *parent;
void *data;