Skip to content

Commit 1eb71cc

Browse files
Merge pull request #962 from vsg-dev/DescriptorBinding
Impoved handling of storage buffer alignment
2 parents 7c07acd + 4ef5435 commit 1eb71cc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

include/vsg/state/DescriptorBuffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace vsg
1919
{
2020

2121
/// DescriptorBuffer is a Descriptor class that encapsulates the bufferInfoList used to set VkWriteDescriptorSet::pBufferInfo settings
22-
/// DescriptorBuffer is a means for passing uniforms to shaders.
22+
/// DescriptorBuffer is a means for passing uniform and storage buffers to shaders.
2323
class VSG_DECLSPEC DescriptorBuffer : public Inherit<Descriptor, DescriptorBuffer>
2424
{
2525
public:

src/vsg/state/BufferInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ bool vsg::createBufferAndTransferData(Context& context, const BufferInfoList& bu
198198

199199
VkDeviceSize alignment = 4;
200200
if (usage == VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) alignment = device->getPhysicalDevice()->getProperties().limits.minUniformBufferOffsetAlignment;
201+
else if (usage == VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) alignment = device->getPhysicalDevice()->getProperties().limits.minStorageBufferOffsetAlignment;
201202

202203
VkDeviceSize totalSize = 0;
203204
VkDeviceSize offset = 0;
@@ -303,6 +304,7 @@ BufferInfoList vsg::createHostVisibleBuffer(Device* device, const DataList& data
303304

304305
VkDeviceSize alignment = 4;
305306
if (usage == VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) alignment = device->getPhysicalDevice()->getProperties().limits.minUniformBufferOffsetAlignment;
307+
else if (usage == VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) alignment = device->getPhysicalDevice()->getProperties().limits.minStorageBufferOffsetAlignment;
306308

307309
VkDeviceSize totalSize = 0;
308310
VkDeviceSize offset = 0;

0 commit comments

Comments
 (0)