Hash :
112a3a8e
Author :
Date :
2018-01-23T13:04:06
Vulkan: De-couple Program from VertexArrayVk dirtyiness. The VertexArrayVk is responsible for filling out the packed shader input info in ANGLE's packed PipelineDesc info structure. This packed info structure is used for Pipeline init and caching lookup. The prior design had this info depend on the active inputs in the current Program. This was undesirable because then, on a Program change, the ContextVk would have to call into the VertexArrayVk to invalidate this info. Instead, keep a working copy of the VertexArrayVk bits and only update the bits corresponding to dirty vertex attributes. This simplifies the cached state management a little bit for ContextVk. This also means we don't have to update the cached copy in the VertexArray on a change in VertexArray binding. Bug: angleproject:2163 Change-Id: I5ba74535367aed74957d17bdc61f882508562d0e Reviewed-on: https://chromium-review.googlesource.com/881703 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@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
//
// Copyright 2016 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.
//
// VertexArrayVk.h:
// Defines the class interface for VertexArrayVk, implementing VertexArrayImpl.
//
#ifndef LIBANGLE_RENDERER_VULKAN_VERTEXARRAYVK_H_
#define LIBANGLE_RENDERER_VULKAN_VERTEXARRAYVK_H_
#include "libANGLE/renderer/VertexArrayImpl.h"
#include "libANGLE/renderer/vulkan/vk_cache_utils.h"
namespace rx
{
class BufferVk;
class VertexArrayVk : public VertexArrayImpl
{
public:
VertexArrayVk(const gl::VertexArrayState &state);
~VertexArrayVk() override;
void destroy(const gl::Context *context) override;
void syncState(const gl::Context *context,
const gl::VertexArray::DirtyBits &dirtyBits) override;
const gl::AttribArray<VkBuffer> &getCurrentArrayBufferHandles() const;
void updateDrawDependencies(vk::CommandBufferNode *readNode,
const gl::AttributesMask &activeAttribsMask,
Serial serial,
DrawType drawType);
void getPackedInputDescriptions(vk::PipelineDesc *pipelineDesc);
private:
// This will update any dirty packed input descriptions, regardless if they're used by the
// active program. This could lead to slight inefficiencies when the app would repeatedly
// update vertex info for attributes the program doesn't use, (very silly edge case). The
// advantage is the cached state then doesn't depend on the Program, so doesn't have to be
// updated when the active Program changes.
void updatePackedInputDescriptions();
void updatePackedInputInfo(uint32_t attribIndex,
const gl::VertexBinding &binding,
const gl::VertexAttribute &attrib);
gl::AttribArray<VkBuffer> mCurrentArrayBufferHandles;
gl::AttribArray<ResourceVk *> mCurrentArrayBufferResources;
ResourceVk *mCurrentElementArrayBufferResource;
// Keep a cache of binding and attribute descriptions for easy pipeline updates.
// This is copied out of here into the pipeline description on a Context state change.
gl::AttributesMask mDirtyPackedInputs;
vk::VertexInputBindings mPackedInputBindings;
vk::VertexInputAttributes mPackedInputAttributes;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_VERTEXARRAYVK_H_