Hash :
2dadd1d0
Author :
Date :
2018-04-11T09:25:18
D3D11: Fix inactive attrib VAO perf regression. In the case there are any dirty inactive attributes, we were continually invalidating the Vertex Buffer and Input Layout bindings. This fixes the invalidation to only happen when there are any dirty active attributes. This regressed in "Move Buffer Subject/Observer to front end." Bug: chromium:829906 Bug: angleproject:2389 Change-Id: I8ed616bb696e0be548344192037ad6cc6f9c595c Reviewed-on: https://chromium-review.googlesource.com/1006998 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
//
// 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.
//
// VertexArray11.h: Defines the rx::VertexArray11 class which implements rx::VertexArrayImpl.
#ifndef LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
#include "libANGLE/Framebuffer.h"
#include "libANGLE/renderer/VertexArrayImpl.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
namespace rx
{
class Renderer11;
class VertexArray11 : public VertexArrayImpl
{
public:
VertexArray11(const gl::VertexArrayState &data);
~VertexArray11() override;
void destroy(const gl::Context *context) override;
// Does not apply any state updates - these are done in syncStateForDraw which as access to
// the DrawCallParams before a draw.
gl::Error syncState(const gl::Context *context,
const gl::VertexArray::DirtyBits &dirtyBits,
const gl::VertexArray::DirtyAttribBitsArray &attribBits,
const gl::VertexArray::DirtyBindingBitsArray &bindingBits) override;
// Applied buffer pointers are updated here.
gl::Error syncStateForDraw(const gl::Context *context,
const gl::DrawCallParams &drawCallParams);
// This will check the dynamic attribs mask.
bool hasActiveDynamicAttrib(const gl::Context *context);
const std::vector<TranslatedAttribute> &getTranslatedAttribs() const;
Serial getCurrentStateSerial() const { return mCurrentStateSerial; }
// In case of a multi-view program change, we have to update all attributes so that the divisor
// is adjusted.
void markAllAttributeDivisorsForAdjustment(int numViews);
// Returns true if the element array buffer needs to be translated.
gl::Error updateElementArrayStorage(const gl::Context *context,
const gl::DrawCallParams &drawCallParams,
bool restartEnabled);
const TranslatedIndexData &getCachedIndexInfo() const;
void updateCachedIndexInfo(const TranslatedIndexData &indexInfo);
bool isCachedIndexInfoValid() const;
GLenum getCachedDestinationIndexType() const;
private:
void updateVertexAttribStorage(StateManager11 *stateManager,
size_t dirtyBit,
size_t attribIndex);
gl::Error updateDirtyAttribs(const gl::Context *context,
const gl::AttributesMask &activeDirtyAttribs);
gl::Error updateDynamicAttribs(const gl::Context *context,
VertexDataManager *vertexDataManager,
const gl::DrawCallParams &drawCallParams,
const gl::AttributesMask &activeDynamicAttribs);
std::vector<VertexStorageType> mAttributeStorageTypes;
std::vector<TranslatedAttribute> mTranslatedAttribs;
// The mask of attributes marked as dynamic.
gl::AttributesMask mDynamicAttribsMask;
// Mask applied to dirty bits on syncState. If a bit is on, it is relevant.
gl::VertexArray::DirtyBits mRelevantDirtyBitsMask;
// A set of attributes we know are dirty, and need to be re-translated.
gl::AttributesMask mAttribsToTranslate;
Serial mCurrentStateSerial;
// The numViews value used to adjust the divisor.
int mAppliedNumViewsToDivisor;
// If the index buffer needs re-streaming.
Optional<GLenum> mLastDrawElementsType;
Optional<const void *> mLastDrawElementsIndices;
Optional<bool> mLastPrimitiveRestartEnabled;
IndexStorageType mCurrentElementArrayStorage;
Optional<TranslatedIndexData> mCachedIndexInfo;
GLenum mCachedDestinationIndexType;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_