// // Copyright 2014 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //
angle::Result TransformFeedback::begin(const Context *context,
PrimitiveMode primitiveMode,
Program *program)
{ // TODO: http://anglebug.com/5486: This method should take in as parameter a // ProgramExecutable instead of a Program.
// In one of the angle_unittests - "TransformFeedbackTest.SideEffectsOfStartAndStop" // there is a code path where <context> is a nullptr, account for that possiblity. const ProgramExecutable *programExecutable =
context ? context->getState().getLinkedProgramExecutable(context) : nullptr; if (programExecutable)
{ // Compute the number of vertices we can draw before overflowing the bound buffers. auto strides = programExecutable->getTransformFeedbackStrides();
ASSERT(strides.size() <= mState.mIndexedBuffers.size() && !strides.empty());
GLsizeiptr minCapacity = std::numeric_limits<GLsizeiptr>::max(); for (size_t index = 0; index < strides.size(); index++)
{
GLsizeiptr capacity =
GetBoundBufferAvailableSize(mState.mIndexedBuffers[index]) / strides[index];
minCapacity = std::min(minCapacity, capacity);
}
mState.mVertexCapacity = minCapacity;
} else
{
mState.mVertexCapacity = 0;
} return angle::Result::Continue;
}
void TransformFeedback::onVerticesDrawn(const Context *context, GLsizei count, GLsizei primcount)
{
ASSERT(mState.mActive && !mState.mPaused); // All draws should be validated with checkBufferSpaceForDraw so ValueOrDie should never fail.
mState.mVerticesDrawn =
(mState.mVerticesDrawn + GetVerticesNeededForDraw(mState.mPrimitiveMode, count, primcount))
.ValueOrDie();
for (auto &buffer : mState.mIndexedBuffers)
{ if (buffer.get() != nullptr)
{
buffer->onDataChanged();
}
}
}
void TransformFeedback::bindProgram(const Context *context, Program *program)
{ if (mState.mProgram != program)
{ if (mState.mProgram != nullptr)
{
mState.mProgram->release(context);
}
mState.mProgram = program; if (mState.mProgram != nullptr)
{
mState.mProgram->addRef();
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.