diff options
| author | skallweitNV <64953474+skallweitNV@users.noreply.github.com> | 2024-05-14 00:39:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-13 15:39:49 -0700 |
| commit | 9f23046138629f78995d54a7722ad6749bd84db9 (patch) | |
| tree | 25ac343566f896cae547046ac7e960441874ec00 /tools/gfx/vulkan/vk-device.cpp | |
| parent | 04d3dd51125182767d90c318895a6232ec4ee750 (diff) | |
[gfx] specify resource view buffer range in bytes (#4149)
* refactor gfx buffer range to use byte range
* create buffer view with zero struct stride for ClearUnorderedAccessViewUint/Float
* create buffer descriptors on demand
* avoid copying gfx.dll
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tools/gfx/vulkan/vk-device.cpp')
| -rw-r--r-- | tools/gfx/vulkan/vk-device.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp index b3124231d..03165f606 100644 --- a/tools/gfx/vulkan/vk-device.cpp +++ b/tools/gfx/vulkan/vk-device.cpp @@ -2189,26 +2189,10 @@ Result DeviceImpl::createBufferView( { auto resourceImpl = (BufferResourceImpl*)buffer; - // TODO: These should come from the `ResourceView::Desc` - auto stride = desc.bufferElementSize; - if (stride == 0) - { - if (desc.format == Format::Unknown) - { - stride = 1; - } - else - { - FormatInfo info; - gfxGetFormatInfo(desc.format, &info); - stride = info.blockSizeInBytes; - assert(info.pixelsPerBlock == 1); - } - } - VkDeviceSize offset = (VkDeviceSize)desc.bufferRange.firstElement * stride; - VkDeviceSize size = desc.bufferRange.elementCount == 0 + VkDeviceSize offset = (VkDeviceSize)desc.bufferRange.offset; + VkDeviceSize size = desc.bufferRange.size == 0 ? (buffer ? resourceImpl->getDesc()->sizeInBytes : 0) - : (VkDeviceSize)desc.bufferRange.elementCount * stride; + : (VkDeviceSize)desc.bufferRange.size; // There are two different cases we need to think about for buffers. // |
