зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: Rename BufferHelper::initFor* to allocateFor*
Simply name change per feedback from other CL's review. Bug: b/205337962 Change-Id: Ieb53ed9a2922d09716a1219eb340fe273e5f1807 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3402882 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
This commit is contained in:
Родитель
a83f7e91c9
Коммит
d235496894
|
@ -488,7 +488,8 @@ angle::Result BufferVk::allocStagingBuffer(ContextVk *contextVk,
|
|||
mStagingBuffer.release(contextVk->getRenderer());
|
||||
}
|
||||
|
||||
ANGLE_TRY(mStagingBuffer.initForCopyBuffer(contextVk, static_cast<size_t>(size), coherency));
|
||||
ANGLE_TRY(
|
||||
mStagingBuffer.allocateForCopyBuffer(contextVk, static_cast<size_t>(size), coherency));
|
||||
*mapPtr = mStagingBuffer.getMappedMemory();
|
||||
mIsStagingBufferMapped = true;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ angle::Result StreamVertexData(ContextVk *contextVk,
|
|||
RendererVk *renderer = contextVk->getRenderer();
|
||||
|
||||
// Allocate buffer for results
|
||||
ANGLE_TRY(dstBufferHelper->initForVertexConversion(contextVk, bytesToAllocate,
|
||||
ANGLE_TRY(dstBufferHelper->allocateForVertexConversion(contextVk, bytesToAllocate,
|
||||
vk::MemoryHostVisibility::Visible));
|
||||
uint8_t *dst = dstBufferHelper->getMappedMemory() + dstOffset;
|
||||
|
||||
|
@ -167,7 +167,7 @@ angle::Result VertexArrayVk::convertIndexBufferGPU(ContextVk *contextVk,
|
|||
size_t srcDataSize = static_cast<size_t>(bufferVk->getSize()) - offsetIntoSrcData;
|
||||
|
||||
// Allocate buffer for results
|
||||
ANGLE_TRY(mTranslatedByteIndexData.initForVertexConversion(
|
||||
ANGLE_TRY(mTranslatedByteIndexData.allocateForVertexConversion(
|
||||
contextVk, sizeof(GLushort) * srcDataSize, vk::MemoryHostVisibility::NonVisible));
|
||||
mCurrentElementArrayBuffer = &mTranslatedByteIndexData;
|
||||
|
||||
|
@ -196,11 +196,11 @@ angle::Result VertexArrayVk::convertIndexBufferIndirectGPU(ContextVk *contextVk,
|
|||
vk::BufferHelper *srcIndexBuf = mCurrentElementArrayBuffer;
|
||||
|
||||
// Allocate buffer for results
|
||||
ANGLE_TRY(mTranslatedByteIndexData.initForVertexConversion(
|
||||
ANGLE_TRY(mTranslatedByteIndexData.allocateForVertexConversion(
|
||||
contextVk, sizeof(GLushort) * srcDataSize, vk::MemoryHostVisibility::NonVisible));
|
||||
vk::BufferHelper *dstIndexBuf = &mTranslatedByteIndexData;
|
||||
|
||||
ANGLE_TRY(mTranslatedByteIndirectData.initForVertexConversion(
|
||||
ANGLE_TRY(mTranslatedByteIndirectData.allocateForVertexConversion(
|
||||
contextVk, sizeof(VkDrawIndexedIndirectCommand), vk::MemoryHostVisibility::NonVisible));
|
||||
vk::BufferHelper *dstIndirectBuf = &mTranslatedByteIndirectData;
|
||||
|
||||
|
@ -277,7 +277,7 @@ angle::Result VertexArrayVk::convertIndexBufferCPU(ContextVk *contextVk,
|
|||
size_t elementSize = contextVk->getVkIndexTypeSize(indexType);
|
||||
const size_t amount = elementSize * indexCount;
|
||||
|
||||
ANGLE_TRY(mStreamedIndexData.initForVertexConversion(contextVk, amount,
|
||||
ANGLE_TRY(mStreamedIndexData.allocateForVertexConversion(contextVk, amount,
|
||||
vk::MemoryHostVisibility::Visible));
|
||||
GLubyte *dst = mStreamedIndexData.getMappedMemory();
|
||||
|
||||
|
@ -354,7 +354,7 @@ angle::Result VertexArrayVk::convertVertexBufferGPU(ContextVk *contextVk,
|
|||
|
||||
// Allocate buffer for results
|
||||
vk::BufferHelper *dstBuffer = conversion->data.get();
|
||||
ANGLE_TRY(dstBuffer->initForVertexConversion(contextVk, numVertices * dstFormatSize,
|
||||
ANGLE_TRY(dstBuffer->allocateForVertexConversion(contextVk, numVertices * dstFormatSize,
|
||||
vk::MemoryHostVisibility::NonVisible));
|
||||
|
||||
ASSERT(conversion->dirty);
|
||||
|
|
|
@ -3632,7 +3632,7 @@ angle::Result LineLoopHelper::getIndexBufferForDrawArrays(ContextVk *contextVk,
|
|||
BufferHelper **bufferOut)
|
||||
{
|
||||
size_t allocateBytes = sizeof(uint32_t) * (static_cast<size_t>(clampedVertexCount) + 1);
|
||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, allocateBytes,
|
||||
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, allocateBytes,
|
||||
MemoryHostVisibility::Visible));
|
||||
uint32_t *indices = reinterpret_cast<uint32_t *>(mDynamicIndexBuffer.getMappedMemory());
|
||||
|
||||
|
@ -3682,7 +3682,7 @@ angle::Result LineLoopHelper::getIndexBufferForElementArrayBuffer(ContextVk *con
|
|||
size_t unitSize = contextVk->getVkIndexTypeSize(glIndexType);
|
||||
|
||||
size_t allocateBytes = unitSize * (indexCount + 1) + 1;
|
||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, allocateBytes,
|
||||
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, allocateBytes,
|
||||
MemoryHostVisibility::Visible));
|
||||
|
||||
BufferHelper *sourceBuffer = &elementArrayBufferVk->getBuffer();
|
||||
|
@ -3727,7 +3727,7 @@ angle::Result LineLoopHelper::streamIndices(ContextVk *contextVk,
|
|||
}
|
||||
*indexCountOut = numOutIndices;
|
||||
|
||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, unitSize * numOutIndices,
|
||||
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, unitSize * numOutIndices,
|
||||
MemoryHostVisibility::Visible));
|
||||
uint8_t *indices = mDynamicIndexBuffer.getMappedMemory();
|
||||
|
||||
|
@ -3790,9 +3790,9 @@ angle::Result LineLoopHelper::streamIndicesIndirect(ContextVk *contextVk,
|
|||
}
|
||||
|
||||
// Allocate buffer for results
|
||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, allocateBytes,
|
||||
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, allocateBytes,
|
||||
MemoryHostVisibility::Visible));
|
||||
ANGLE_TRY(mDynamicIndirectBuffer.initForVertexConversion(
|
||||
ANGLE_TRY(mDynamicIndirectBuffer.allocateForVertexConversion(
|
||||
contextVk, sizeof(VkDrawIndexedIndirectCommand), MemoryHostVisibility::Visible));
|
||||
|
||||
*indexBufferOut = &mDynamicIndexBuffer;
|
||||
|
@ -3824,9 +3824,9 @@ angle::Result LineLoopHelper::streamArrayIndirect(ContextVk *contextVk,
|
|||
auto unitSize = sizeof(uint32_t);
|
||||
size_t allocateBytes = static_cast<size_t>((vertexCount + 1) * unitSize);
|
||||
|
||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, allocateBytes,
|
||||
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, allocateBytes,
|
||||
MemoryHostVisibility::Visible));
|
||||
ANGLE_TRY(mDynamicIndirectBuffer.initForVertexConversion(
|
||||
ANGLE_TRY(mDynamicIndirectBuffer.allocateForVertexConversion(
|
||||
contextVk, sizeof(VkDrawIndexedIndirectCommand), MemoryHostVisibility::Visible));
|
||||
|
||||
*indexBufferOut = &mDynamicIndexBuffer;
|
||||
|
@ -4052,7 +4052,7 @@ angle::Result BufferHelper::initSuballocation(ContextVk *contextVk,
|
|||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result BufferHelper::initForCopyBuffer(ContextVk *contextVk,
|
||||
angle::Result BufferHelper::allocateForCopyBuffer(ContextVk *contextVk,
|
||||
size_t size,
|
||||
MemoryCoherency coherency)
|
||||
{
|
||||
|
@ -4062,7 +4062,7 @@ angle::Result BufferHelper::initForCopyBuffer(ContextVk *contextVk,
|
|||
return initSuballocation(contextVk, memoryTypeIndex, size, alignment);
|
||||
}
|
||||
|
||||
angle::Result BufferHelper::initForVertexConversion(ContextVk *contextVk,
|
||||
angle::Result BufferHelper::allocateForVertexConversion(ContextVk *contextVk,
|
||||
size_t size,
|
||||
MemoryHostVisibility hostVisibility)
|
||||
{
|
||||
|
@ -4101,7 +4101,7 @@ angle::Result BufferHelper::initForVertexConversion(ContextVk *contextVk,
|
|||
return initSuballocation(contextVk, memoryTypeIndex, sizeToAllocate, alignment);
|
||||
}
|
||||
|
||||
angle::Result BufferHelper::initForCopyImage(ContextVk *contextVk,
|
||||
angle::Result BufferHelper::allocateForCopyImage(ContextVk *contextVk,
|
||||
size_t size,
|
||||
MemoryCoherency coherency,
|
||||
angle::FormatID formatId,
|
||||
|
@ -6231,7 +6231,7 @@ angle::Result ImageHelper::stageSubresourceUpdateImpl(ContextVk *contextVk,
|
|||
|
||||
uint8_t *stagingPointer;
|
||||
VkDeviceSize stagingOffset;
|
||||
ANGLE_TRY(currentBuffer->initForCopyImage(contextVk, allocationSize,
|
||||
ANGLE_TRY(currentBuffer->allocateForCopyImage(contextVk, allocationSize,
|
||||
MemoryCoherency::NonCoherent, storageFormat.id,
|
||||
&stagingOffset, &stagingPointer));
|
||||
|
||||
|
@ -6403,7 +6403,7 @@ angle::Result ImageHelper::reformatStagedBufferUpdates(ContextVk *contextVk,
|
|||
uint8_t *dstData;
|
||||
VkDeviceSize dstBufferOffset;
|
||||
size_t dstBufferSize = dstDataDepthPitch * copy.imageExtent.depth;
|
||||
ANGLE_TRY(dstBuffer->initForCopyImage(contextVk, dstBufferSize,
|
||||
ANGLE_TRY(dstBuffer->allocateForCopyImage(contextVk, dstBufferSize,
|
||||
MemoryCoherency::NonCoherent, dstFormatID,
|
||||
&dstBufferOffset, &dstData));
|
||||
|
||||
|
@ -6623,7 +6623,7 @@ angle::Result ImageHelper::stageSubresourceUpdateAndGetData(ContextVk *contextVk
|
|||
BufferHelper *currentBuffer = &stagingBuffer->get();
|
||||
|
||||
VkDeviceSize stagingOffset;
|
||||
ANGLE_TRY(currentBuffer->initForCopyImage(contextVk, allocationSize,
|
||||
ANGLE_TRY(currentBuffer->allocateForCopyImage(contextVk, allocationSize,
|
||||
MemoryCoherency::NonCoherent, formatID,
|
||||
&stagingOffset, dstData));
|
||||
|
||||
|
@ -6697,7 +6697,7 @@ angle::Result ImageHelper::stageSubresourceUpdateFromFramebuffer(
|
|||
|
||||
// The destination is only one layer deep.
|
||||
size_t allocationSize = outputDepthPitch;
|
||||
ANGLE_TRY(currentBuffer->initForCopyImage(contextVk, allocationSize,
|
||||
ANGLE_TRY(currentBuffer->allocateForCopyImage(contextVk, allocationSize,
|
||||
MemoryCoherency::NonCoherent, storageFormat.id,
|
||||
&stagingOffset, &stagingPointer));
|
||||
|
||||
|
@ -6868,7 +6868,7 @@ angle::Result ImageHelper::stageRobustResourceClearWithFormat(ContextVk *context
|
|||
|
||||
uint8_t *stagingPointer;
|
||||
VkDeviceSize stagingOffset;
|
||||
ANGLE_TRY(currentBuffer->initForCopyImage(contextVk, totalSize,
|
||||
ANGLE_TRY(currentBuffer->allocateForCopyImage(contextVk, totalSize,
|
||||
MemoryCoherency::NonCoherent, imageFormat.id,
|
||||
&stagingOffset, &stagingPointer));
|
||||
memset(stagingPointer, 0, totalSize);
|
||||
|
@ -7690,7 +7690,7 @@ angle::Result ImageHelper::copyImageDataToBuffer(ContextVk *contextVk,
|
|||
// Allocate coherent staging buffer
|
||||
ASSERT(dstBuffer != nullptr && !dstBuffer->valid());
|
||||
VkDeviceSize dstOffset;
|
||||
ANGLE_TRY(dstBuffer->initForCopyImage(contextVk, bufferSize, MemoryCoherency::Coherent,
|
||||
ANGLE_TRY(dstBuffer->allocateForCopyImage(contextVk, bufferSize, MemoryCoherency::Coherent,
|
||||
imageFormat.id, &dstOffset, outDataPtr));
|
||||
VkBuffer bufferHandle = dstBuffer->getBuffer().getHandle();
|
||||
|
||||
|
@ -8006,8 +8006,9 @@ angle::Result ImageHelper::readPixels(ContextVk *contextVk,
|
|||
VkDeviceSize stagingOffset = 0;
|
||||
size_t allocationSize = readFormat->pixelBytes * area.width * area.height;
|
||||
|
||||
ANGLE_TRY(stagingBuffer->initForCopyImage(contextVk, allocationSize, MemoryCoherency::Coherent,
|
||||
mActualFormatID, &stagingOffset, &readPixelBuffer));
|
||||
ANGLE_TRY(stagingBuffer->allocateForCopyImage(contextVk, allocationSize,
|
||||
MemoryCoherency::Coherent, mActualFormatID,
|
||||
&stagingOffset, &readPixelBuffer));
|
||||
VkBuffer bufferHandle = stagingBuffer->getBuffer().getHandle();
|
||||
|
||||
VkBufferImageCopy region = {};
|
||||
|
|
|
@ -741,14 +741,16 @@ class BufferHelper : public ReadWriteResource
|
|||
size_t alignment);
|
||||
|
||||
// Helper functions to initialize a buffer for a specific usage
|
||||
// Initialize a buffer with alignment good for shader storage or copyBuffer .
|
||||
angle::Result initForVertexConversion(ContextVk *contextVk,
|
||||
// Suballocate a buffer with alignment good for shader storage or copyBuffer .
|
||||
angle::Result allocateForVertexConversion(ContextVk *contextVk,
|
||||
size_t size,
|
||||
MemoryHostVisibility hostVisibility);
|
||||
// Initialize a host visible buffer with alignment good for copyBuffer .
|
||||
angle::Result initForCopyBuffer(ContextVk *contextVk, size_t size, MemoryCoherency coherency);
|
||||
// Initialize a host visible buffer with alignment good for copyImage .
|
||||
angle::Result initForCopyImage(ContextVk *contextVk,
|
||||
// Suballocate a host visible buffer with alignment good for copyBuffer .
|
||||
angle::Result allocateForCopyBuffer(ContextVk *contextVk,
|
||||
size_t size,
|
||||
MemoryCoherency coherency);
|
||||
// Suballocate a host visible buffer with alignment good for copyImage .
|
||||
angle::Result allocateForCopyImage(ContextVk *contextVk,
|
||||
size_t size,
|
||||
MemoryCoherency coherency,
|
||||
angle::FormatID formatId,
|
||||
|
|
Загрузка…
Ссылка в новой задаче