Commit e416e527 by Qin Jiajia Committed by Commit Bot

Remove some unused codes

This patch will remove unused functions syncVertexAttributes and hasDirtyOrDynamicAttrib, and private member mAppliedIBChanged. Meanwhile, it changes hasDynamicAttrib to hasActiveDynamicAttrib to avoid unnecessary update in some cases. BUG=angleproject:1155 Change-Id: I29a0aa7fbc13874b7b070cf1ac5ec4134728f519 Reviewed-on: https://chromium-review.googlesource.com/707014Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 1fce3283
...@@ -366,7 +366,8 @@ bool DrawCallNeedsTranslation(const gl::Context *context, GLenum mode, GLenum ty ...@@ -366,7 +366,8 @@ bool DrawCallNeedsTranslation(const gl::Context *context, GLenum mode, GLenum ty
// Direct drawing doesn't support dynamic attribute storage since it needs the first and count // Direct drawing doesn't support dynamic attribute storage since it needs the first and count
// to translate when applyVertexBuffer. GL_LINE_LOOP and GL_TRIANGLE_FAN are not supported // to translate when applyVertexBuffer. GL_LINE_LOOP and GL_TRIANGLE_FAN are not supported
// either since we need to simulate them in D3D. // either since we need to simulate them in D3D.
if (vertexArray11->hasDynamicAttrib(context) || mode == GL_LINE_LOOP || mode == GL_TRIANGLE_FAN) if (vertexArray11->hasActiveDynamicAttrib(context) || mode == GL_LINE_LOOP ||
mode == GL_TRIANGLE_FAN)
{ {
return true; return true;
} }
......
...@@ -550,7 +550,6 @@ StateManager11::StateManager11(Renderer11 *renderer) ...@@ -550,7 +550,6 @@ StateManager11::StateManager11(Renderer11 *renderer)
mAppliedIB(nullptr), mAppliedIB(nullptr),
mAppliedIBFormat(DXGI_FORMAT_UNKNOWN), mAppliedIBFormat(DXGI_FORMAT_UNKNOWN),
mAppliedIBOffset(0), mAppliedIBOffset(0),
mAppliedIBChanged(false),
mVertexDataManager(renderer), mVertexDataManager(renderer),
mIndexDataManager(renderer, RENDERER_D3D11), mIndexDataManager(renderer, RENDERER_D3D11),
mIsMultiviewEnabled(false), mIsMultiviewEnabled(false),
...@@ -2504,7 +2503,7 @@ gl::Error StateManager11::applyVertexBuffer(const gl::Context *context, ...@@ -2504,7 +2503,7 @@ gl::Error StateManager11::applyVertexBuffer(const gl::Context *context,
mInputLayoutIsDirty = true; mInputLayoutIsDirty = true;
// Determine if we need to update attribs on the next draw. // Determine if we need to update attribs on the next draw.
mVertexAttribsNeedTranslation = (vertexArray11->hasDynamicAttrib(context)); mVertexAttribsNeedTranslation = (vertexArray11->hasActiveDynamicAttrib(context));
} }
if (!mLastFirstVertex.valid() || mLastFirstVertex.value() != first) if (!mLastFirstVertex.valid() || mLastFirstVertex.value() != first)
......
...@@ -310,7 +310,6 @@ class StateManager11 final : angle::NonCopyable ...@@ -310,7 +310,6 @@ class StateManager11 final : angle::NonCopyable
gl::Error clearTextures(gl::SamplerType samplerType, size_t rangeStart, size_t rangeEnd); gl::Error clearTextures(gl::SamplerType samplerType, size_t rangeStart, size_t rangeEnd);
void handleMultiviewDrawFramebufferChange(const gl::Context *context); void handleMultiviewDrawFramebufferChange(const gl::Context *context);
gl::Error syncVertexAttributes(const gl::Context *context);
gl::Error syncCurrentValueAttribs(const gl::State &glState); gl::Error syncCurrentValueAttribs(const gl::State &glState);
gl::Error generateSwizzle(const gl::Context *context, gl::Texture *texture); gl::Error generateSwizzle(const gl::Context *context, gl::Texture *texture);
...@@ -481,7 +480,6 @@ class StateManager11 final : angle::NonCopyable ...@@ -481,7 +480,6 @@ class StateManager11 final : angle::NonCopyable
ID3D11Buffer *mAppliedIB; ID3D11Buffer *mAppliedIB;
DXGI_FORMAT mAppliedIBFormat; DXGI_FORMAT mAppliedIBFormat;
unsigned int mAppliedIBOffset; unsigned int mAppliedIBOffset;
bool mAppliedIBChanged;
// Vertex, index and input layouts // Vertex, index and input layouts
VertexDataManager mVertexDataManager; VertexDataManager mVertexDataManager;
......
...@@ -70,11 +70,11 @@ void VertexArray11::syncState(const gl::Context *context, ...@@ -70,11 +70,11 @@ void VertexArray11::syncState(const gl::Context *context,
bool VertexArray11::flushAttribUpdates(const gl::Context *context) bool VertexArray11::flushAttribUpdates(const gl::Context *context)
{ {
const gl::Program *program = context->getGLState().getProgram();
const auto &activeLocations = program->getActiveAttribLocationsMask();
if (mAttribsToUpdate.any()) if (mAttribsToUpdate.any())
{ {
const auto &activeLocations =
context->getGLState().getProgram()->getActiveAttribLocationsMask();
// Skip attrib locations the program doesn't use. // Skip attrib locations the program doesn't use.
gl::AttributesMask activeToUpdate = mAttribsToUpdate & activeLocations; gl::AttributesMask activeToUpdate = mAttribsToUpdate & activeLocations;
...@@ -161,16 +161,13 @@ void VertexArray11::updateVertexAttribStorage(const gl::Context *context, size_t ...@@ -161,16 +161,13 @@ void VertexArray11::updateVertexAttribStorage(const gl::Context *context, size_t
} }
} }
bool VertexArray11::hasDynamicAttrib(const gl::Context *context) bool VertexArray11::hasActiveDynamicAttrib(const gl::Context *context)
{
flushAttribUpdates(context);
return mDynamicAttribsMask.any();
}
bool VertexArray11::hasDirtyOrDynamicAttrib(const gl::Context *context)
{ {
flushAttribUpdates(context); flushAttribUpdates(context);
return mAttribsToTranslate.any() || mDynamicAttribsMask.any(); const auto &activeLocations =
context->getGLState().getProgram()->getActiveAttribLocationsMask();
auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations);
return activeDynamicAttribs.any();
} }
gl::Error VertexArray11::updateDirtyAndDynamicAttribs(const gl::Context *context, gl::Error VertexArray11::updateDirtyAndDynamicAttribs(const gl::Context *context,
...@@ -231,6 +228,10 @@ gl::Error VertexArray11::updateDirtyAndDynamicAttribs(const gl::Context *context ...@@ -231,6 +228,10 @@ gl::Error VertexArray11::updateDirtyAndDynamicAttribs(const gl::Context *context
if (mDynamicAttribsMask.any()) if (mDynamicAttribsMask.any())
{ {
auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations); auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations);
if (activeDynamicAttribs.none())
{
return gl::NoError();
}
for (auto dynamicAttribIndex : activeDynamicAttribs) for (auto dynamicAttribIndex : activeDynamicAttribs)
{ {
......
...@@ -27,8 +27,7 @@ class VertexArray11 : public VertexArrayImpl, public OnBufferDataDirtyReceiver ...@@ -27,8 +27,7 @@ class VertexArray11 : public VertexArrayImpl, public OnBufferDataDirtyReceiver
void syncState(const gl::Context *context, void syncState(const gl::Context *context,
const gl::VertexArray::DirtyBits &dirtyBits) override; const gl::VertexArray::DirtyBits &dirtyBits) override;
// This will flush any pending attrib updates and then check the dynamic attribs mask. // This will flush any pending attrib updates and then check the dynamic attribs mask.
bool hasDynamicAttrib(const gl::Context *context); bool hasActiveDynamicAttrib(const gl::Context *context);
bool hasDirtyOrDynamicAttrib(const gl::Context *context);
gl::Error updateDirtyAndDynamicAttribs(const gl::Context *context, gl::Error updateDirtyAndDynamicAttribs(const gl::Context *context,
VertexDataManager *vertexDataManager, VertexDataManager *vertexDataManager,
GLint start, GLint start,
......
Markdown is supported
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