MCPcopy Create free account
hub / github.com/KhronosGroup/glTF-IBL-Sampler / writeBufferData

Method writeBufferData

lib/source/vkHelper.cpp:939–969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937}
938
939VkResult IBLLib::vkHelper::writeBufferData(VkBuffer _buffer, const void* _pData, size_t _bytes)
940{
941 VkResult res = VK_RESULT_MAX_ENUM;
942
943 if (m_logicalDevice == VK_NULL_HANDLE)
944 {
945 return res;
946 }
947
948 for (const Buffer& buf : m_buffers)
949 {
950 if (buf.buffer == _buffer && buf.memory != VK_NULL_HANDLE)
951 {
952 void* data = nullptr;
953 if ((res = vkMapMemory(m_logicalDevice, buf.memory, 0u, _bytes, 0, &data)) != VK_SUCCESS)
954 {
955 printf("Failed to map buffer memory [%u]\n", res);
956 return res;
957 }
958
959 // write data
960 memcpy(data, _pData, _bytes);
961 vkUnmapMemory(m_logicalDevice, buf.memory);
962 return res;
963 }
964 }
965
966 printf("Not a valid buffer\n");
967
968 return res;
969}
970
971VkResult IBLLib::vkHelper::readBufferData(VkBuffer _buffer, void* _pData, size_t _bytes, size_t _offset)
972{

Callers 1

uploadImageFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected