Commit f3614370 by Jamie Madill Committed by Commit Bot

Vulkan: Rename StreamingBuffer to DynamicBuffer.

This makes it consistent with DynamicDescriptorPool, and gives a bit more precise definition. Bug: angleproject:2318 Change-Id: I8953113165ebe2d0dcfc0fc923d94280180442ce Reviewed-on: https://chromium-review.googlesource.com/985199 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org>
parent 00af463e
...@@ -57,8 +57,8 @@ VkIndexType GetVkIndexType(GLenum glIndexType) ...@@ -57,8 +57,8 @@ VkIndexType GetVkIndexType(GLenum glIndexType)
} }
} }
constexpr size_t kStreamingVertexDataSize = 1024 * 1024; constexpr size_t kDynamicVertexDataSize = 1024 * 1024;
constexpr size_t kStreamingIndexDataSize = 1024 * 8; constexpr size_t kDynamicIndexDataSize = 1024 * 8;
} // anonymous namespace } // anonymous namespace
...@@ -69,13 +69,13 @@ ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer) ...@@ -69,13 +69,13 @@ ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer)
mDynamicDescriptorPool(), mDynamicDescriptorPool(),
mVertexArrayDirty(false), mVertexArrayDirty(false),
mTexturesDirty(false), mTexturesDirty(false),
mStreamingVertexData(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, kStreamingVertexDataSize), mDynamicVertexData(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, kDynamicVertexDataSize),
mStreamingIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kStreamingIndexDataSize) mDynamicIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kDynamicIndexDataSize)
{ {
memset(&mClearColorValue, 0, sizeof(mClearColorValue)); memset(&mClearColorValue, 0, sizeof(mClearColorValue));
memset(&mClearDepthStencilValue, 0, sizeof(mClearDepthStencilValue)); memset(&mClearDepthStencilValue, 0, sizeof(mClearDepthStencilValue));
mStreamingVertexData.init(1); mDynamicVertexData.init(1);
mStreamingIndexData.init(1); mDynamicIndexData.init(1);
} }
ContextVk::~ContextVk() ContextVk::~ContextVk()
...@@ -87,8 +87,8 @@ void ContextVk::onDestroy(const gl::Context *context) ...@@ -87,8 +87,8 @@ void ContextVk::onDestroy(const gl::Context *context)
VkDevice device = mRenderer->getDevice(); VkDevice device = mRenderer->getDevice();
mDynamicDescriptorPool.destroy(mRenderer); mDynamicDescriptorPool.destroy(mRenderer);
mStreamingVertexData.destroy(device); mDynamicVertexData.destroy(device);
mStreamingIndexData.destroy(device); mDynamicIndexData.destroy(device);
mLineLoopHandler.destroy(device); mLineLoopHandler.destroy(device);
} }
...@@ -224,7 +224,7 @@ gl::Error ContextVk::setupDraw(const gl::Context *context, ...@@ -224,7 +224,7 @@ gl::Error ContextVk::setupDraw(const gl::Context *context,
} }
commandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mCurrentPipeline->get()); commandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mCurrentPipeline->get());
ANGLE_TRY(vkVAO->streamVertexData(context, &mStreamingVertexData, drawCallParams)); ANGLE_TRY(vkVAO->streamVertexData(context, &mDynamicVertexData, drawCallParams));
commandBuffer->bindVertexBuffers(0, maxAttrib, vkVAO->getCurrentArrayBufferHandles().data(), commandBuffer->bindVertexBuffers(0, maxAttrib, vkVAO->getCurrentArrayBufferHandles().data(),
vkVAO->getCurrentArrayBufferOffsets().data()); vkVAO->getCurrentArrayBufferOffsets().data());
...@@ -345,7 +345,7 @@ gl::Error ContextVk::drawElements(const gl::Context *context, ...@@ -345,7 +345,7 @@ gl::Error ContextVk::drawElements(const gl::Context *context,
GLubyte *dst = nullptr; GLubyte *dst = nullptr;
ANGLE_TRY( ANGLE_TRY(
mStreamingIndexData.allocate(contextVk, amount, &dst, &buffer, &offset, nullptr)); mDynamicIndexData.allocate(contextVk, amount, &dst, &buffer, &offset, nullptr));
if (type == GL_UNSIGNED_BYTE) if (type == GL_UNSIGNED_BYTE)
{ {
// Unsigned bytes don't have direct support in Vulkan so we have to expand the // Unsigned bytes don't have direct support in Vulkan so we have to expand the
...@@ -361,7 +361,7 @@ gl::Error ContextVk::drawElements(const gl::Context *context, ...@@ -361,7 +361,7 @@ gl::Error ContextVk::drawElements(const gl::Context *context,
{ {
memcpy(dst, indices, amount); memcpy(dst, indices, amount);
} }
ANGLE_TRY(mStreamingIndexData.flush(contextVk)); ANGLE_TRY(mDynamicIndexData.flush(contextVk));
} }
ANGLE_TRY(setupDraw(context, drawCallParams, nullptr, &commandBuffer)); ANGLE_TRY(setupDraw(context, drawCallParams, nullptr, &commandBuffer));
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#include "libANGLE/renderer/ContextImpl.h" #include "libANGLE/renderer/ContextImpl.h"
#include "libANGLE/renderer/vulkan/DynamicBuffer.h"
#include "libANGLE/renderer/vulkan/DynamicDescriptorPool.h" #include "libANGLE/renderer/vulkan/DynamicDescriptorPool.h"
#include "libANGLE/renderer/vulkan/StreamingBuffer.h"
#include "libANGLE/renderer/vulkan/vk_cache_utils.h" #include "libANGLE/renderer/vulkan/vk_cache_utils.h"
namespace rx namespace rx
...@@ -190,8 +190,8 @@ class ContextVk : public ContextImpl ...@@ -190,8 +190,8 @@ class ContextVk : public ContextImpl
VkClearValue mClearColorValue; VkClearValue mClearColorValue;
VkClearValue mClearDepthStencilValue; VkClearValue mClearDepthStencilValue;
StreamingBuffer mStreamingVertexData; DynamicBuffer mDynamicVertexData;
StreamingBuffer mStreamingIndexData; DynamicBuffer mDynamicIndexData;
vk::LineLoopHandler mLineLoopHandler; vk::LineLoopHandler mLineLoopHandler;
}; };
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// StreamingBuffer: // DynamicBuffer:
// Create, map and flush buffers as needed to hold data, returning a handle and offset for each // Create, map and flush buffers as needed to hold data, returning a handle and offset for each
// chunk. // chunk.
// //
#include "StreamingBuffer.h" #include "libANGLE/renderer/vulkan/DynamicBuffer.h"
#include "anglebase/numerics/safe_math.h" #include "anglebase/numerics/safe_math.h"
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
namespace rx namespace rx
{ {
StreamingBuffer::StreamingBuffer(VkBufferUsageFlags usage, size_t minSize) DynamicBuffer::DynamicBuffer(VkBufferUsageFlags usage, size_t minSize)
: mUsage(usage), : mUsage(usage),
mMinSize(minSize), mMinSize(minSize),
mNextWriteOffset(0), mNextWriteOffset(0),
...@@ -28,28 +28,28 @@ StreamingBuffer::StreamingBuffer(VkBufferUsageFlags usage, size_t minSize) ...@@ -28,28 +28,28 @@ StreamingBuffer::StreamingBuffer(VkBufferUsageFlags usage, size_t minSize)
{ {
} }
void StreamingBuffer::init(size_t alignment) void DynamicBuffer::init(size_t alignment)
{ {
ASSERT(alignment > 0); ASSERT(alignment > 0);
mAlignment = alignment; mAlignment = alignment;
} }
StreamingBuffer::~StreamingBuffer() DynamicBuffer::~DynamicBuffer()
{ {
ASSERT(mAlignment == 0); ASSERT(mAlignment == 0);
} }
bool StreamingBuffer::valid() bool DynamicBuffer::valid()
{ {
return mAlignment > 0; return mAlignment > 0;
} }
vk::Error StreamingBuffer::allocate(ContextVk *context, vk::Error DynamicBuffer::allocate(ContextVk *context,
size_t sizeInBytes, size_t sizeInBytes,
uint8_t **ptrOut, uint8_t **ptrOut,
VkBuffer *handleOut, VkBuffer *handleOut,
uint32_t *offsetOut, uint32_t *offsetOut,
bool *outNewBufferAllocated) bool *outNewBufferAllocated)
{ {
ASSERT(valid()); ASSERT(valid());
RendererVk *renderer = context->getRenderer(); RendererVk *renderer = context->getRenderer();
...@@ -121,7 +121,7 @@ vk::Error StreamingBuffer::allocate(ContextVk *context, ...@@ -121,7 +121,7 @@ vk::Error StreamingBuffer::allocate(ContextVk *context,
return vk::NoError(); return vk::NoError();
} }
vk::Error StreamingBuffer::flush(ContextVk *context) vk::Error DynamicBuffer::flush(ContextVk *context)
{ {
if (mNextWriteOffset > mLastFlushOffset) if (mNextWriteOffset > mLastFlushOffset)
{ {
...@@ -138,19 +138,19 @@ vk::Error StreamingBuffer::flush(ContextVk *context) ...@@ -138,19 +138,19 @@ vk::Error StreamingBuffer::flush(ContextVk *context)
return vk::NoError(); return vk::NoError();
} }
void StreamingBuffer::destroy(VkDevice device) void DynamicBuffer::destroy(VkDevice device)
{ {
mAlignment = 0; mAlignment = 0;
mBuffer.destroy(device); mBuffer.destroy(device);
mMemory.destroy(device); mMemory.destroy(device);
} }
VkBuffer StreamingBuffer::getCurrentBufferHandle() const VkBuffer DynamicBuffer::getCurrentBufferHandle() const
{ {
return mBuffer.getHandle(); return mBuffer.getHandle();
} }
void StreamingBuffer::setMinimumSize(size_t minSize) void DynamicBuffer::setMinimumSize(size_t minSize)
{ {
// This will really only have an effect next time we call allocate. // This will really only have an effect next time we call allocate.
mMinSize = minSize; mMinSize = minSize;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// StreamingBuffer: // DynamicBuffer:
// Create, map and flush buffers as needed to hold data, returning a handle and offset for each // Create, map and flush buffers as needed to hold data, returning a handle and offset for each
// chunk. // chunk.
// //
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
namespace rx namespace rx
{ {
class StreamingBuffer : public ResourceVk class DynamicBuffer : public ResourceVk
{ {
public: public:
StreamingBuffer(VkBufferUsageFlags usage, size_t minSize); DynamicBuffer(VkBufferUsageFlags usage, size_t minSize);
void init(size_t alignment); void init(size_t alignment);
bool valid(); bool valid();
~StreamingBuffer(); ~DynamicBuffer();
vk::Error allocate(ContextVk *context, vk::Error allocate(ContextVk *context,
size_t sizeInBytes, size_t sizeInBytes,
uint8_t **ptrOut, uint8_t **ptrOut,
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "libANGLE/renderer/vulkan/DynamicDescriptorPool.h" #include "libANGLE/renderer/vulkan/DynamicDescriptorPool.h"
#include "libANGLE/renderer/vulkan/GlslangWrapper.h" #include "libANGLE/renderer/vulkan/GlslangWrapper.h"
#include "libANGLE/renderer/vulkan/RendererVk.h" #include "libANGLE/renderer/vulkan/RendererVk.h"
#include "libANGLE/renderer/vulkan/StreamingBuffer.h"
#include "libANGLE/renderer/vulkan/TextureVk.h" #include "libANGLE/renderer/vulkan/TextureVk.h"
namespace rx namespace rx
...@@ -25,7 +24,7 @@ namespace rx ...@@ -25,7 +24,7 @@ namespace rx
namespace namespace
{ {
constexpr size_t kUniformBlockStreamingBufferMinSize = 256 * 128; constexpr size_t kUniformBlockDynamicBufferMinSize = 256 * 128;
gl::Error InitDefaultUniformBlock(const gl::Context *context, gl::Error InitDefaultUniformBlock(const gl::Context *context,
gl::Shader *shader, gl::Shader *shader,
...@@ -115,7 +114,7 @@ void ReadFromDefaultUniformBlock(int componentCount, ...@@ -115,7 +114,7 @@ void ReadFromDefaultUniformBlock(int componentCount,
} }
vk::Error SyncDefaultUniformBlock(ContextVk *contextVk, vk::Error SyncDefaultUniformBlock(ContextVk *contextVk,
StreamingBuffer &streamingBuffer, DynamicBuffer &dynamicBuffer,
const angle::MemoryBuffer &bufferData, const angle::MemoryBuffer &bufferData,
uint32_t *outOffset, uint32_t *outOffset,
bool *outBufferModified) bool *outBufferModified)
...@@ -124,11 +123,11 @@ vk::Error SyncDefaultUniformBlock(ContextVk *contextVk, ...@@ -124,11 +123,11 @@ vk::Error SyncDefaultUniformBlock(ContextVk *contextVk,
uint8_t *data = nullptr; uint8_t *data = nullptr;
VkBuffer *outBuffer = nullptr; VkBuffer *outBuffer = nullptr;
uint32_t offset; uint32_t offset;
ANGLE_TRY(streamingBuffer.allocate(contextVk, bufferData.size(), &data, outBuffer, &offset, ANGLE_TRY(dynamicBuffer.allocate(contextVk, bufferData.size(), &data, outBuffer, &offset,
outBufferModified)); outBufferModified));
*outOffset = offset; *outOffset = offset;
memcpy(data, bufferData.data(), bufferData.size()); memcpy(data, bufferData.data(), bufferData.size());
ANGLE_TRY(streamingBuffer.flush(contextVk)); ANGLE_TRY(dynamicBuffer.flush(contextVk));
return vk::NoError(); return vk::NoError();
} }
...@@ -159,7 +158,7 @@ gl::Shader *GetShader(const gl::ProgramState &programState, uint32_t shaderIndex ...@@ -159,7 +158,7 @@ gl::Shader *GetShader(const gl::ProgramState &programState, uint32_t shaderIndex
ProgramVk::DefaultUniformBlock::DefaultUniformBlock() ProgramVk::DefaultUniformBlock::DefaultUniformBlock()
: storage(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT, : storage(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
kUniformBlockStreamingBufferMinSize), kUniformBlockDynamicBufferMinSize),
uniformData(), uniformData(),
uniformsDirty(false), uniformsDirty(false),
uniformLayout() uniformLayout()
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include "libANGLE/Constants.h" #include "libANGLE/Constants.h"
#include "libANGLE/renderer/ProgramImpl.h" #include "libANGLE/renderer/ProgramImpl.h"
#include "libANGLE/renderer/vulkan/DynamicBuffer.h"
#include "libANGLE/renderer/vulkan/RendererVk.h" #include "libANGLE/renderer/vulkan/RendererVk.h"
#include "libANGLE/renderer/vulkan/StreamingBuffer.h"
#include "libANGLE/renderer/vulkan/vk_utils.h" #include "libANGLE/renderer/vulkan/vk_utils.h"
namespace rx namespace rx
...@@ -153,7 +153,7 @@ class ProgramVk : public ProgramImpl ...@@ -153,7 +153,7 @@ class ProgramVk : public ProgramImpl
DefaultUniformBlock(); DefaultUniformBlock();
~DefaultUniformBlock(); ~DefaultUniformBlock();
StreamingBuffer storage; DynamicBuffer storage;
// Shadow copies of the shader uniform data. // Shadow copies of the shader uniform data.
angle::MemoryBuffer uniformData; angle::MemoryBuffer uniformData;
......
...@@ -50,7 +50,7 @@ gl::AttributesMask VertexArrayVk::getAttribsToStream(const gl::Context *context) ...@@ -50,7 +50,7 @@ gl::AttributesMask VertexArrayVk::getAttribsToStream(const gl::Context *context)
} }
gl::Error VertexArrayVk::streamVertexData(const gl::Context *context, gl::Error VertexArrayVk::streamVertexData(const gl::Context *context,
StreamingBuffer *stream, DynamicBuffer *dynamicBuffer,
const gl::DrawCallParams &drawCallParams) const gl::DrawCallParams &drawCallParams)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
...@@ -86,14 +86,14 @@ gl::Error VertexArrayVk::streamVertexData(const gl::Context *context, ...@@ -86,14 +86,14 @@ gl::Error VertexArrayVk::streamVertexData(const gl::Context *context,
lastVertex * binding.getStride() + gl::ComputeVertexAttributeTypeSize(attrib); lastVertex * binding.getStride() + gl::ComputeVertexAttributeTypeSize(attrib);
uint8_t *dst = nullptr; uint8_t *dst = nullptr;
uint32_t offset = 0; uint32_t offset = 0;
ANGLE_TRY(stream->allocate(contextVk, lastByte, &dst, ANGLE_TRY(dynamicBuffer->allocate(
&mCurrentArrayBufferHandles[attribIndex], &offset, nullptr)); contextVk, lastByte, &dst, &mCurrentArrayBufferHandles[attribIndex], &offset, nullptr));
mCurrentArrayBufferOffsets[attribIndex] = static_cast<VkDeviceSize>(offset); mCurrentArrayBufferOffsets[attribIndex] = static_cast<VkDeviceSize>(offset);
memcpy(dst + firstByte, static_cast<const uint8_t *>(attrib.pointer) + firstByte, memcpy(dst + firstByte, static_cast<const uint8_t *>(attrib.pointer) + firstByte,
lastByte - firstByte); lastByte - firstByte);
} }
ANGLE_TRY(stream->flush(contextVk)); ANGLE_TRY(dynamicBuffer->flush(contextVk));
return gl::NoError(); return gl::NoError();
} }
......
...@@ -21,7 +21,7 @@ class DrawCallParams; ...@@ -21,7 +21,7 @@ class DrawCallParams;
namespace rx namespace rx
{ {
class BufferVk; class BufferVk;
class StreamingBuffer; class DynamicBuffer;
class VertexArrayVk : public VertexArrayImpl class VertexArrayVk : public VertexArrayImpl
{ {
...@@ -32,8 +32,9 @@ class VertexArrayVk : public VertexArrayImpl ...@@ -32,8 +32,9 @@ class VertexArrayVk : public VertexArrayImpl
void destroy(const gl::Context *context) override; void destroy(const gl::Context *context) override;
gl::Error streamVertexData(const gl::Context *context, gl::Error streamVertexData(const gl::Context *context,
StreamingBuffer *stream, DynamicBuffer *dynamicBuffer,
const gl::DrawCallParams &drawCallParams); const gl::DrawCallParams &drawCallParams);
gl::Error syncState(const gl::Context *context, gl::Error syncState(const gl::Context *context,
const gl::VertexArray::DirtyBits &dirtyBits, const gl::VertexArray::DirtyBits &dirtyBits,
const gl::VertexArray::DirtyAttribBitsArray &attribBits, const gl::VertexArray::DirtyAttribBitsArray &attribBits,
......
...@@ -17,11 +17,9 @@ ...@@ -17,11 +17,9 @@
namespace rx namespace rx
{ {
namespace namespace
{ {
constexpr int kLineLoopDynamicBufferMinSize = 1024 * 1024;
constexpr int kLineLoopStreamingBufferMinSize = 1024 * 1024;
GLenum DefaultGLErrorCode(VkResult result) GLenum DefaultGLErrorCode(VkResult result)
{ {
...@@ -1179,13 +1177,13 @@ void GarbageObject::destroy(VkDevice device) ...@@ -1179,13 +1177,13 @@ void GarbageObject::destroy(VkDevice device)
LineLoopHandler::LineLoopHandler() LineLoopHandler::LineLoopHandler()
: mObserverBinding(this, 0u), : mObserverBinding(this, 0u),
mStreamingLineLoopIndicesData( mDynamicLineLoopIndicesData(
new StreamingBuffer(VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, new DynamicBuffer(VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
kLineLoopStreamingBufferMinSize)), kLineLoopDynamicBufferMinSize)),
mLineLoopIndexBuffer(VK_NULL_HANDLE), mLineLoopIndexBuffer(VK_NULL_HANDLE),
mLineLoopIndexBufferOffset(VK_NULL_HANDLE) mLineLoopIndexBufferOffset(VK_NULL_HANDLE)
{ {
mStreamingLineLoopIndicesData->init(1); mDynamicLineLoopIndicesData->init(1);
} }
LineLoopHandler::~LineLoopHandler() = default; LineLoopHandler::~LineLoopHandler() = default;
...@@ -1204,7 +1202,7 @@ gl::Error LineLoopHandler::createIndexBuffer(ContextVk *contextVk, int firstVert ...@@ -1204,7 +1202,7 @@ gl::Error LineLoopHandler::createIndexBuffer(ContextVk *contextVk, int firstVert
{ {
uint32_t *indices = nullptr; uint32_t *indices = nullptr;
size_t allocateBytes = sizeof(uint32_t) * (count + 1); size_t allocateBytes = sizeof(uint32_t) * (count + 1);
ANGLE_TRY(mStreamingLineLoopIndicesData->allocate( ANGLE_TRY(mDynamicLineLoopIndicesData->allocate(
contextVk, allocateBytes, reinterpret_cast<uint8_t **>(&indices), &mLineLoopIndexBuffer, contextVk, allocateBytes, reinterpret_cast<uint8_t **>(&indices), &mLineLoopIndexBuffer,
&mLineLoopIndexBufferOffset, nullptr)); &mLineLoopIndexBufferOffset, nullptr));
...@@ -1217,9 +1215,9 @@ gl::Error LineLoopHandler::createIndexBuffer(ContextVk *contextVk, int firstVert ...@@ -1217,9 +1215,9 @@ gl::Error LineLoopHandler::createIndexBuffer(ContextVk *contextVk, int firstVert
*indices = unsignedFirstVertex; *indices = unsignedFirstVertex;
// Since we are not using the VK_MEMORY_PROPERTY_HOST_COHERENT_BIT flag when creating the // Since we are not using the VK_MEMORY_PROPERTY_HOST_COHERENT_BIT flag when creating the
// device memory in the StreamingBuffer, we always need to make sure we flush it after // device memory in the DynamicBuffer, we always need to make sure we flush it after
// writing. // writing.
ANGLE_TRY(mStreamingLineLoopIndicesData->flush(contextVk)); ANGLE_TRY(mDynamicLineLoopIndicesData->flush(contextVk));
mLineLoopBufferFirstIndex = firstVertex; mLineLoopBufferFirstIndex = firstVertex;
mLineLoopBufferLastIndex = lastVertex; mLineLoopBufferLastIndex = lastVertex;
...@@ -1248,7 +1246,7 @@ gl::Error LineLoopHandler::createIndexBufferFromElementArrayBuffer(ContextVk *co ...@@ -1248,7 +1246,7 @@ gl::Error LineLoopHandler::createIndexBufferFromElementArrayBuffer(ContextVk *co
auto unitSize = (indexType == VK_INDEX_TYPE_UINT16 ? sizeof(uint16_t) : sizeof(uint32_t)); auto unitSize = (indexType == VK_INDEX_TYPE_UINT16 ? sizeof(uint16_t) : sizeof(uint32_t));
size_t allocateBytes = unitSize * (count + 1); size_t allocateBytes = unitSize * (count + 1);
ANGLE_TRY(mStreamingLineLoopIndicesData->allocate( ANGLE_TRY(mDynamicLineLoopIndicesData->allocate(
contextVk, allocateBytes, reinterpret_cast<uint8_t **>(&indices), &mLineLoopIndexBuffer, contextVk, allocateBytes, reinterpret_cast<uint8_t **>(&indices), &mLineLoopIndexBuffer,
&mLineLoopIndexBufferOffset, nullptr)); &mLineLoopIndexBufferOffset, nullptr));
...@@ -1259,22 +1257,22 @@ gl::Error LineLoopHandler::createIndexBufferFromElementArrayBuffer(ContextVk *co ...@@ -1259,22 +1257,22 @@ gl::Error LineLoopHandler::createIndexBufferFromElementArrayBuffer(ContextVk *co
std::array<VkBufferCopy, 2> copies = {{copy1, copy2}}; std::array<VkBufferCopy, 2> copies = {{copy1, copy2}};
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
mStreamingLineLoopIndicesData->beginWriteResource(contextVk->getRenderer(), &commandBuffer); mDynamicLineLoopIndicesData->beginWriteResource(contextVk->getRenderer(), &commandBuffer);
Serial currentSerial = contextVk->getRenderer()->getCurrentQueueSerial(); Serial currentSerial = contextVk->getRenderer()->getCurrentQueueSerial();
bufferVk->onReadResource(mStreamingLineLoopIndicesData->getCurrentWritingNode(currentSerial), bufferVk->onReadResource(mDynamicLineLoopIndicesData->getCurrentWritingNode(currentSerial),
currentSerial); currentSerial);
commandBuffer->copyBuffer(bufferVk->getVkBuffer().getHandle(), mLineLoopIndexBuffer, 2, commandBuffer->copyBuffer(bufferVk->getVkBuffer().getHandle(), mLineLoopIndexBuffer, 2,
copies.data()); copies.data());
ANGLE_TRY(mStreamingLineLoopIndicesData->flush(contextVk)); ANGLE_TRY(mDynamicLineLoopIndicesData->flush(contextVk));
return gl::NoError(); return gl::NoError();
} }
void LineLoopHandler::destroy(VkDevice device) void LineLoopHandler::destroy(VkDevice device)
{ {
mObserverBinding.reset(); mObserverBinding.reset();
mStreamingLineLoopIndicesData->destroy(device); mDynamicLineLoopIndicesData->destroy(device);
} }
gl::Error LineLoopHandler::draw(int count, CommandBuffer *commandBuffer) gl::Error LineLoopHandler::draw(int count, CommandBuffer *commandBuffer)
...@@ -1288,7 +1286,7 @@ gl::Error LineLoopHandler::draw(int count, CommandBuffer *commandBuffer) ...@@ -1288,7 +1286,7 @@ gl::Error LineLoopHandler::draw(int count, CommandBuffer *commandBuffer)
ResourceVk *LineLoopHandler::getLineLoopBufferResource() ResourceVk *LineLoopHandler::getLineLoopBufferResource()
{ {
return mStreamingLineLoopIndicesData.get(); return mDynamicLineLoopIndicesData.get();
} }
void LineLoopHandler::onSubjectStateChange(const gl::Context *context, void LineLoopHandler::onSubjectStateChange(const gl::Context *context,
......
...@@ -53,11 +53,11 @@ ANGLE_GL_OBJECTS_X(ANGLE_PRE_DECLARE_OBJECT); ...@@ -53,11 +53,11 @@ ANGLE_GL_OBJECTS_X(ANGLE_PRE_DECLARE_OBJECT);
namespace rx namespace rx
{ {
class DisplayVk; class DisplayVk;
class DynamicBuffer;
class RenderTargetVk; class RenderTargetVk;
class RendererVk; class RendererVk;
class ResourceVk; class ResourceVk;
class RenderPassCache; class RenderPassCache;
class StreamingBuffer;
ANGLE_GL_OBJECTS_X(ANGLE_PRE_DECLARE_VK_OBJECT); ANGLE_GL_OBJECTS_X(ANGLE_PRE_DECLARE_VK_OBJECT);
...@@ -672,7 +672,7 @@ class LineLoopHandler final : angle::NonCopyable, angle::ObserverInterface ...@@ -672,7 +672,7 @@ class LineLoopHandler final : angle::NonCopyable, angle::ObserverInterface
private: private:
angle::ObserverBinding mObserverBinding; angle::ObserverBinding mObserverBinding;
std::unique_ptr<StreamingBuffer> mStreamingLineLoopIndicesData; std::unique_ptr<DynamicBuffer> mDynamicLineLoopIndicesData;
VkBuffer mLineLoopIndexBuffer; VkBuffer mLineLoopIndexBuffer;
uint32_t mLineLoopIndexBufferOffset; uint32_t mLineLoopIndexBufferOffset;
Optional<int> mLineLoopBufferFirstIndex; Optional<int> mLineLoopBufferFirstIndex;
......
...@@ -758,6 +758,8 @@ ...@@ -758,6 +758,8 @@
'libANGLE/renderer/vulkan/DeviceVk.h', 'libANGLE/renderer/vulkan/DeviceVk.h',
'libANGLE/renderer/vulkan/DisplayVk.cpp', 'libANGLE/renderer/vulkan/DisplayVk.cpp',
'libANGLE/renderer/vulkan/DisplayVk.h', 'libANGLE/renderer/vulkan/DisplayVk.h',
'libANGLE/renderer/vulkan/DynamicBuffer.h',
'libANGLE/renderer/vulkan/DynamicBuffer.cpp',
'libANGLE/renderer/vulkan/DynamicDescriptorPool.cpp', 'libANGLE/renderer/vulkan/DynamicDescriptorPool.cpp',
'libANGLE/renderer/vulkan/DynamicDescriptorPool.h', 'libANGLE/renderer/vulkan/DynamicDescriptorPool.h',
'libANGLE/renderer/vulkan/FenceNVVk.cpp', 'libANGLE/renderer/vulkan/FenceNVVk.cpp',
...@@ -784,8 +786,6 @@ ...@@ -784,8 +786,6 @@
'libANGLE/renderer/vulkan/SamplerVk.h', 'libANGLE/renderer/vulkan/SamplerVk.h',
'libANGLE/renderer/vulkan/ShaderVk.cpp', 'libANGLE/renderer/vulkan/ShaderVk.cpp',
'libANGLE/renderer/vulkan/ShaderVk.h', 'libANGLE/renderer/vulkan/ShaderVk.h',
'libANGLE/renderer/vulkan/StreamingBuffer.h',
'libANGLE/renderer/vulkan/StreamingBuffer.cpp',
'libANGLE/renderer/vulkan/SurfaceVk.cpp', 'libANGLE/renderer/vulkan/SurfaceVk.cpp',
'libANGLE/renderer/vulkan/SurfaceVk.h', 'libANGLE/renderer/vulkan/SurfaceVk.h',
'libANGLE/renderer/vulkan/SyncVk.cpp', 'libANGLE/renderer/vulkan/SyncVk.cpp',
......
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