summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-08-26 21:13:55 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-08-26 21:13:55 +0000
commit71f1ad60962386b6dc3e6dd6f1a7da598ce63965 (patch)
tree907d1d70fffc0da2bcca933c9bc065ccb7e962e6 /Graphics/GraphicsEngineVulkan
parentAdded comment (diff)
downloadDiligentCore-71f1ad60962386b6dc3e6dd6f1a7da598ce63965.tar.gz
DiligentCore-71f1ad60962386b6dc3e6dd6f1a7da598ce63965.zip
Implemented raw buffers (fixed https://github.com/DiligentGraphics/DiligentCore/issues/18).
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp12
-rw-r--r--Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp2
2 files changed, 11 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp
index ac223012..f31af180 100644
--- a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp
@@ -467,14 +467,22 @@ VulkanUtilities::BufferViewWrapper BufferVkImpl::CreateView(struct BufferViewDes
VulkanUtilities::BufferViewWrapper BuffView;
CorrectBufferViewDesc(ViewDesc);
if( (ViewDesc.ViewType == BUFFER_VIEW_SHADER_RESOURCE || ViewDesc.ViewType == BUFFER_VIEW_UNORDERED_ACCESS) &&
- m_Desc.Mode == BUFFER_MODE_FORMATTED)
+ (m_Desc.Mode == BUFFER_MODE_FORMATTED || m_Desc.Mode == BUFFER_MODE_RAW))
{
VkBufferViewCreateInfo ViewCI = {};
ViewCI.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO;
ViewCI.pNext = nullptr;
ViewCI.flags = 0; // reserved for future use
ViewCI.buffer = m_VulkanBuffer;
- ViewCI.format = TypeToVkFormat(m_Desc.Format.ValueType, m_Desc.Format.NumComponents, m_Desc.Format.IsNormalized);
+ if (m_Desc.Mode == BUFFER_MODE_RAW && ViewDesc.Format.ValueType == VT_UNDEFINED)
+ {
+ ViewCI.format = VK_FORMAT_R32_UINT;
+ }
+ else
+ {
+ DEV_CHECK_ERR(ViewDesc.Format.ValueType != VT_UNDEFINED, "Undefined format");
+ ViewCI.format = TypeToVkFormat(ViewDesc.Format.ValueType, ViewDesc.Format.NumComponents, ViewDesc.Format.IsNormalized);
+ }
ViewCI.offset = ViewDesc.ByteOffset;
ViewCI.range = ViewDesc.ByteWidth; // size in bytes of the buffer view
diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
index 2d3a74cc..5eca60f7 100644
--- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
@@ -198,7 +198,7 @@ TextureVkImpl :: TextureVkImpl(IReferenceCounters* pRefCounters,
std::vector<VkBufferImageCopy> Regions(InitData.NumSubresources);
UINT64 uploadBufferSize = 0;
- auto TexelSize = FmtAttribs.ComponentSize * FmtAttribs.NumComponents;
+ auto TexelSize = Uint32{FmtAttribs.ComponentSize} * Uint32{FmtAttribs.NumComponents};
Uint32 subres = 0;
for(Uint32 layer = 0; layer < ImageCI.arrayLayers; ++layer)
{