Hash :
da854a27
Author :
Date :
2017-11-30T17:24:21
Vulkan: Clean up VAO cached resources. We can actually store a pointer to the base ResourceVk instead of BufferVk for updating serials. This will work a little nicer with streaming vertex data, which won't have a BufferVk but will have an accessible ResourceVk pointer. Also add an element array resource pointer for serial update. This was missing and could lead to incorrect behaviour. Also change the types of the caches from std::vector to gl::AttribArray, which is a std::array. Bug: angleproject:2264 Change-Id: Ibd79b7676b5dbc3875ae9d110be477d228e01c5c Reviewed-on: https://chromium-review.googlesource.com/798170 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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
//
// 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/renderervk_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 updateCurrentBufferSerials(const gl::AttributesMask &activeAttribsMask,
Serial serial,
DrawType drawType);
void invalidateVertexDescriptions();
void updateVertexDescriptions(const gl::Context *context);
const std::vector<VkVertexInputBindingDescription> &getVertexBindingDescs() const;
const std::vector<VkVertexInputAttributeDescription> &getVertexAttribDescs() const;
private:
gl::AttribArray<VkBuffer> mCurrentArrayBufferHandles;
gl::AttribArray<ResourceVk *> mCurrentArrayBufferResources;
ResourceVk *mCurrentElementArrayBufferResource;
// Keep a cache of binding and attribute descriptions for easy pipeline updates.
// TODO(jmadill): Update this when we support pipeline caching.
bool mCurrentVertexDescsValid;
std::vector<VkVertexInputBindingDescription> mCurrentVertexBindingDescs;
std::vector<VkVertexInputAttributeDescription> mCurrentVertexAttribDescs;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_VERTEXARRAYVK_H_