зеркало из 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());
|
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();
|
*mapPtr = mStagingBuffer.getMappedMemory();
|
||||||
mIsStagingBufferMapped = true;
|
mIsStagingBufferMapped = true;
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ angle::Result StreamVertexData(ContextVk *contextVk,
|
||||||
RendererVk *renderer = contextVk->getRenderer();
|
RendererVk *renderer = contextVk->getRenderer();
|
||||||
|
|
||||||
// Allocate buffer for results
|
// Allocate buffer for results
|
||||||
ANGLE_TRY(dstBufferHelper->initForVertexConversion(contextVk, bytesToAllocate,
|
ANGLE_TRY(dstBufferHelper->allocateForVertexConversion(contextVk, bytesToAllocate,
|
||||||
vk::MemoryHostVisibility::Visible));
|
vk::MemoryHostVisibility::Visible));
|
||||||
uint8_t *dst = dstBufferHelper->getMappedMemory() + dstOffset;
|
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;
|
size_t srcDataSize = static_cast<size_t>(bufferVk->getSize()) - offsetIntoSrcData;
|
||||||
|
|
||||||
// Allocate buffer for results
|
// Allocate buffer for results
|
||||||
ANGLE_TRY(mTranslatedByteIndexData.initForVertexConversion(
|
ANGLE_TRY(mTranslatedByteIndexData.allocateForVertexConversion(
|
||||||
contextVk, sizeof(GLushort) * srcDataSize, vk::MemoryHostVisibility::NonVisible));
|
contextVk, sizeof(GLushort) * srcDataSize, vk::MemoryHostVisibility::NonVisible));
|
||||||
mCurrentElementArrayBuffer = &mTranslatedByteIndexData;
|
mCurrentElementArrayBuffer = &mTranslatedByteIndexData;
|
||||||
|
|
||||||
|
@ -196,11 +196,11 @@ angle::Result VertexArrayVk::convertIndexBufferIndirectGPU(ContextVk *contextVk,
|
||||||
vk::BufferHelper *srcIndexBuf = mCurrentElementArrayBuffer;
|
vk::BufferHelper *srcIndexBuf = mCurrentElementArrayBuffer;
|
||||||
|
|
||||||
// Allocate buffer for results
|
// Allocate buffer for results
|
||||||
ANGLE_TRY(mTranslatedByteIndexData.initForVertexConversion(
|
ANGLE_TRY(mTranslatedByteIndexData.allocateForVertexConversion(
|
||||||
contextVk, sizeof(GLushort) * srcDataSize, vk::MemoryHostVisibility::NonVisible));
|
contextVk, sizeof(GLushort) * srcDataSize, vk::MemoryHostVisibility::NonVisible));
|
||||||
vk::BufferHelper *dstIndexBuf = &mTranslatedByteIndexData;
|
vk::BufferHelper *dstIndexBuf = &mTranslatedByteIndexData;
|
||||||
|
|
||||||
ANGLE_TRY(mTranslatedByteIndirectData.initForVertexConversion(
|
ANGLE_TRY(mTranslatedByteIndirectData.allocateForVertexConversion(
|
||||||
contextVk, sizeof(VkDrawIndexedIndirectCommand), vk::MemoryHostVisibility::NonVisible));
|
contextVk, sizeof(VkDrawIndexedIndirectCommand), vk::MemoryHostVisibility::NonVisible));
|
||||||
vk::BufferHelper *dstIndirectBuf = &mTranslatedByteIndirectData;
|
vk::BufferHelper *dstIndirectBuf = &mTranslatedByteIndirectData;
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ angle::Result VertexArrayVk::convertIndexBufferCPU(ContextVk *contextVk,
|
||||||
size_t elementSize = contextVk->getVkIndexTypeSize(indexType);
|
size_t elementSize = contextVk->getVkIndexTypeSize(indexType);
|
||||||
const size_t amount = elementSize * indexCount;
|
const size_t amount = elementSize * indexCount;
|
||||||
|
|
||||||
ANGLE_TRY(mStreamedIndexData.initForVertexConversion(contextVk, amount,
|
ANGLE_TRY(mStreamedIndexData.allocateForVertexConversion(contextVk, amount,
|
||||||
vk::MemoryHostVisibility::Visible));
|
vk::MemoryHostVisibility::Visible));
|
||||||
GLubyte *dst = mStreamedIndexData.getMappedMemory();
|
GLubyte *dst = mStreamedIndexData.getMappedMemory();
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ angle::Result VertexArrayVk::convertVertexBufferGPU(ContextVk *contextVk,
|
||||||
|
|
||||||
// Allocate buffer for results
|
// Allocate buffer for results
|
||||||
vk::BufferHelper *dstBuffer = conversion->data.get();
|
vk::BufferHelper *dstBuffer = conversion->data.get();
|
||||||
ANGLE_TRY(dstBuffer->initForVertexConversion(contextVk, numVertices * dstFormatSize,
|
ANGLE_TRY(dstBuffer->allocateForVertexConversion(contextVk, numVertices * dstFormatSize,
|
||||||
vk::MemoryHostVisibility::NonVisible));
|
vk::MemoryHostVisibility::NonVisible));
|
||||||
|
|
||||||
ASSERT(conversion->dirty);
|
ASSERT(conversion->dirty);
|
||||||
|
|
|
@ -3632,7 +3632,7 @@ angle::Result LineLoopHelper::getIndexBufferForDrawArrays(ContextVk *contextVk,
|
||||||
BufferHelper **bufferOut)
|
BufferHelper **bufferOut)
|
||||||
{
|
{
|
||||||
size_t allocateBytes = sizeof(uint32_t) * (static_cast<size_t>(clampedVertexCount) + 1);
|
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));
|
MemoryHostVisibility::Visible));
|
||||||
uint32_t *indices = reinterpret_cast<uint32_t *>(mDynamicIndexBuffer.getMappedMemory());
|
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 unitSize = contextVk->getVkIndexTypeSize(glIndexType);
|
||||||
|
|
||||||
size_t allocateBytes = unitSize * (indexCount + 1) + 1;
|
size_t allocateBytes = unitSize * (indexCount + 1) + 1;
|
||||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, allocateBytes,
|
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, allocateBytes,
|
||||||
MemoryHostVisibility::Visible));
|
MemoryHostVisibility::Visible));
|
||||||
|
|
||||||
BufferHelper *sourceBuffer = &elementArrayBufferVk->getBuffer();
|
BufferHelper *sourceBuffer = &elementArrayBufferVk->getBuffer();
|
||||||
|
@ -3727,7 +3727,7 @@ angle::Result LineLoopHelper::streamIndices(ContextVk *contextVk,
|
||||||
}
|
}
|
||||||
*indexCountOut = numOutIndices;
|
*indexCountOut = numOutIndices;
|
||||||
|
|
||||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, unitSize * numOutIndices,
|
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, unitSize * numOutIndices,
|
||||||
MemoryHostVisibility::Visible));
|
MemoryHostVisibility::Visible));
|
||||||
uint8_t *indices = mDynamicIndexBuffer.getMappedMemory();
|
uint8_t *indices = mDynamicIndexBuffer.getMappedMemory();
|
||||||
|
|
||||||
|
@ -3790,9 +3790,9 @@ angle::Result LineLoopHelper::streamIndicesIndirect(ContextVk *contextVk,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate buffer for results
|
// Allocate buffer for results
|
||||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, allocateBytes,
|
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, allocateBytes,
|
||||||
MemoryHostVisibility::Visible));
|
MemoryHostVisibility::Visible));
|
||||||
ANGLE_TRY(mDynamicIndirectBuffer.initForVertexConversion(
|
ANGLE_TRY(mDynamicIndirectBuffer.allocateForVertexConversion(
|
||||||
contextVk, sizeof(VkDrawIndexedIndirectCommand), MemoryHostVisibility::Visible));
|
contextVk, sizeof(VkDrawIndexedIndirectCommand), MemoryHostVisibility::Visible));
|
||||||
|
|
||||||
*indexBufferOut = &mDynamicIndexBuffer;
|
*indexBufferOut = &mDynamicIndexBuffer;
|
||||||
|
@ -3824,9 +3824,9 @@ angle::Result LineLoopHelper::streamArrayIndirect(ContextVk *contextVk,
|
||||||
auto unitSize = sizeof(uint32_t);
|
auto unitSize = sizeof(uint32_t);
|
||||||
size_t allocateBytes = static_cast<size_t>((vertexCount + 1) * unitSize);
|
size_t allocateBytes = static_cast<size_t>((vertexCount + 1) * unitSize);
|
||||||
|
|
||||||
ANGLE_TRY(mDynamicIndexBuffer.initForVertexConversion(contextVk, allocateBytes,
|
ANGLE_TRY(mDynamicIndexBuffer.allocateForVertexConversion(contextVk, allocateBytes,
|
||||||
MemoryHostVisibility::Visible));
|
MemoryHostVisibility::Visible));
|
||||||
ANGLE_TRY(mDynamicIndirectBuffer.initForVertexConversion(
|
ANGLE_TRY(mDynamicIndirectBuffer.allocateForVertexConversion(
|
||||||
contextVk, sizeof(VkDrawIndexedIndirectCommand), MemoryHostVisibility::Visible));
|
contextVk, sizeof(VkDrawIndexedIndirectCommand), MemoryHostVisibility::Visible));
|
||||||
|
|
||||||
*indexBufferOut = &mDynamicIndexBuffer;
|
*indexBufferOut = &mDynamicIndexBuffer;
|
||||||
|
@ -4052,7 +4052,7 @@ angle::Result BufferHelper::initSuballocation(ContextVk *contextVk,
|
||||||
return angle::Result::Continue;
|
return angle::Result::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
angle::Result BufferHelper::initForCopyBuffer(ContextVk *contextVk,
|
angle::Result BufferHelper::allocateForCopyBuffer(ContextVk *contextVk,
|
||||||
size_t size,
|
size_t size,
|
||||||
MemoryCoherency coherency)
|
MemoryCoherency coherency)
|
||||||
{
|
{
|
||||||
|
@ -4062,7 +4062,7 @@ angle::Result BufferHelper::initForCopyBuffer(ContextVk *contextVk,
|
||||||
return initSuballocation(contextVk, memoryTypeIndex, size, alignment);
|
return initSuballocation(contextVk, memoryTypeIndex, size, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
angle::Result BufferHelper::initForVertexConversion(ContextVk *contextVk,
|
angle::Result BufferHelper::allocateForVertexConversion(ContextVk *contextVk,
|
||||||
size_t size,
|
size_t size,
|
||||||
MemoryHostVisibility hostVisibility)
|
MemoryHostVisibility hostVisibility)
|
||||||
{
|
{
|
||||||
|
@ -4101,7 +4101,7 @@ angle::Result BufferHelper::initForVertexConversion(ContextVk *contextVk,
|
||||||
return initSuballocation(contextVk, memoryTypeIndex, sizeToAllocate, alignment);
|
return initSuballocation(contextVk, memoryTypeIndex, sizeToAllocate, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
angle::Result BufferHelper::initForCopyImage(ContextVk *contextVk,
|
angle::Result BufferHelper::allocateForCopyImage(ContextVk *contextVk,
|
||||||
size_t size,
|
size_t size,
|
||||||
MemoryCoherency coherency,
|
MemoryCoherency coherency,
|
||||||
angle::FormatID formatId,
|
angle::FormatID formatId,
|
||||||
|
@ -6231,7 +6231,7 @@ angle::Result ImageHelper::stageSubresourceUpdateImpl(ContextVk *contextVk,
|
||||||
|
|
||||||
uint8_t *stagingPointer;
|
uint8_t *stagingPointer;
|
||||||
VkDeviceSize stagingOffset;
|
VkDeviceSize stagingOffset;
|
||||||
ANGLE_TRY(currentBuffer->initForCopyImage(contextVk, allocationSize,
|
ANGLE_TRY(currentBuffer->allocateForCopyImage(contextVk, allocationSize,
|
||||||
MemoryCoherency::NonCoherent, storageFormat.id,
|
MemoryCoherency::NonCoherent, storageFormat.id,
|
||||||
&stagingOffset, &stagingPointer));
|
&stagingOffset, &stagingPointer));
|
||||||
|
|
||||||
|
@ -6403,7 +6403,7 @@ angle::Result ImageHelper::reformatStagedBufferUpdates(ContextVk *contextVk,
|
||||||
uint8_t *dstData;
|
uint8_t *dstData;
|
||||||
VkDeviceSize dstBufferOffset;
|
VkDeviceSize dstBufferOffset;
|
||||||
size_t dstBufferSize = dstDataDepthPitch * copy.imageExtent.depth;
|
size_t dstBufferSize = dstDataDepthPitch * copy.imageExtent.depth;
|
||||||
ANGLE_TRY(dstBuffer->initForCopyImage(contextVk, dstBufferSize,
|
ANGLE_TRY(dstBuffer->allocateForCopyImage(contextVk, dstBufferSize,
|
||||||
MemoryCoherency::NonCoherent, dstFormatID,
|
MemoryCoherency::NonCoherent, dstFormatID,
|
||||||
&dstBufferOffset, &dstData));
|
&dstBufferOffset, &dstData));
|
||||||
|
|
||||||
|
@ -6623,7 +6623,7 @@ angle::Result ImageHelper::stageSubresourceUpdateAndGetData(ContextVk *contextVk
|
||||||
BufferHelper *currentBuffer = &stagingBuffer->get();
|
BufferHelper *currentBuffer = &stagingBuffer->get();
|
||||||
|
|
||||||
VkDeviceSize stagingOffset;
|
VkDeviceSize stagingOffset;
|
||||||
ANGLE_TRY(currentBuffer->initForCopyImage(contextVk, allocationSize,
|
ANGLE_TRY(currentBuffer->allocateForCopyImage(contextVk, allocationSize,
|
||||||
MemoryCoherency::NonCoherent, formatID,
|
MemoryCoherency::NonCoherent, formatID,
|
||||||
&stagingOffset, dstData));
|
&stagingOffset, dstData));
|
||||||
|
|
||||||
|
@ -6697,7 +6697,7 @@ angle::Result ImageHelper::stageSubresourceUpdateFromFramebuffer(
|
||||||
|
|
||||||
// The destination is only one layer deep.
|
// The destination is only one layer deep.
|
||||||
size_t allocationSize = outputDepthPitch;
|
size_t allocationSize = outputDepthPitch;
|
||||||
ANGLE_TRY(currentBuffer->initForCopyImage(contextVk, allocationSize,
|
ANGLE_TRY(currentBuffer->allocateForCopyImage(contextVk, allocationSize,
|
||||||
MemoryCoherency::NonCoherent, storageFormat.id,
|
MemoryCoherency::NonCoherent, storageFormat.id,
|
||||||
&stagingOffset, &stagingPointer));
|
&stagingOffset, &stagingPointer));
|
||||||
|
|
||||||
|
@ -6868,7 +6868,7 @@ angle::Result ImageHelper::stageRobustResourceClearWithFormat(ContextVk *context
|
||||||
|
|
||||||
uint8_t *stagingPointer;
|
uint8_t *stagingPointer;
|
||||||
VkDeviceSize stagingOffset;
|
VkDeviceSize stagingOffset;
|
||||||
ANGLE_TRY(currentBuffer->initForCopyImage(contextVk, totalSize,
|
ANGLE_TRY(currentBuffer->allocateForCopyImage(contextVk, totalSize,
|
||||||
MemoryCoherency::NonCoherent, imageFormat.id,
|
MemoryCoherency::NonCoherent, imageFormat.id,
|
||||||
&stagingOffset, &stagingPointer));
|
&stagingOffset, &stagingPointer));
|
||||||
memset(stagingPointer, 0, totalSize);
|
memset(stagingPointer, 0, totalSize);
|
||||||
|
@ -7690,7 +7690,7 @@ angle::Result ImageHelper::copyImageDataToBuffer(ContextVk *contextVk,
|
||||||
// Allocate coherent staging buffer
|
// Allocate coherent staging buffer
|
||||||
ASSERT(dstBuffer != nullptr && !dstBuffer->valid());
|
ASSERT(dstBuffer != nullptr && !dstBuffer->valid());
|
||||||
VkDeviceSize dstOffset;
|
VkDeviceSize dstOffset;
|
||||||
ANGLE_TRY(dstBuffer->initForCopyImage(contextVk, bufferSize, MemoryCoherency::Coherent,
|
ANGLE_TRY(dstBuffer->allocateForCopyImage(contextVk, bufferSize, MemoryCoherency::Coherent,
|
||||||
imageFormat.id, &dstOffset, outDataPtr));
|
imageFormat.id, &dstOffset, outDataPtr));
|
||||||
VkBuffer bufferHandle = dstBuffer->getBuffer().getHandle();
|
VkBuffer bufferHandle = dstBuffer->getBuffer().getHandle();
|
||||||
|
|
||||||
|
@ -8006,8 +8006,9 @@ angle::Result ImageHelper::readPixels(ContextVk *contextVk,
|
||||||
VkDeviceSize stagingOffset = 0;
|
VkDeviceSize stagingOffset = 0;
|
||||||
size_t allocationSize = readFormat->pixelBytes * area.width * area.height;
|
size_t allocationSize = readFormat->pixelBytes * area.width * area.height;
|
||||||
|
|
||||||
ANGLE_TRY(stagingBuffer->initForCopyImage(contextVk, allocationSize, MemoryCoherency::Coherent,
|
ANGLE_TRY(stagingBuffer->allocateForCopyImage(contextVk, allocationSize,
|
||||||
mActualFormatID, &stagingOffset, &readPixelBuffer));
|
MemoryCoherency::Coherent, mActualFormatID,
|
||||||
|
&stagingOffset, &readPixelBuffer));
|
||||||
VkBuffer bufferHandle = stagingBuffer->getBuffer().getHandle();
|
VkBuffer bufferHandle = stagingBuffer->getBuffer().getHandle();
|
||||||
|
|
||||||
VkBufferImageCopy region = {};
|
VkBufferImageCopy region = {};
|
||||||
|
|
|
@ -741,14 +741,16 @@ class BufferHelper : public ReadWriteResource
|
||||||
size_t alignment);
|
size_t alignment);
|
||||||
|
|
||||||
// Helper functions to initialize a buffer for a specific usage
|
// Helper functions to initialize a buffer for a specific usage
|
||||||
// Initialize a buffer with alignment good for shader storage or copyBuffer .
|
// Suballocate a buffer with alignment good for shader storage or copyBuffer .
|
||||||
angle::Result initForVertexConversion(ContextVk *contextVk,
|
angle::Result allocateForVertexConversion(ContextVk *contextVk,
|
||||||
size_t size,
|
size_t size,
|
||||||
MemoryHostVisibility hostVisibility);
|
MemoryHostVisibility hostVisibility);
|
||||||
// Initialize a host visible buffer with alignment good for copyBuffer .
|
// Suballocate a host visible buffer with alignment good for copyBuffer .
|
||||||
angle::Result initForCopyBuffer(ContextVk *contextVk, size_t size, MemoryCoherency coherency);
|
angle::Result allocateForCopyBuffer(ContextVk *contextVk,
|
||||||
// Initialize a host visible buffer with alignment good for copyImage .
|
size_t size,
|
||||||
angle::Result initForCopyImage(ContextVk *contextVk,
|
MemoryCoherency coherency);
|
||||||
|
// Suballocate a host visible buffer with alignment good for copyImage .
|
||||||
|
angle::Result allocateForCopyImage(ContextVk *contextVk,
|
||||||
size_t size,
|
size_t size,
|
||||||
MemoryCoherency coherency,
|
MemoryCoherency coherency,
|
||||||
angle::FormatID formatId,
|
angle::FormatID formatId,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче