MCPcopy Create free account
hub / github.com/crownengine/crown / create

Method create

3rdparty/bgfx/src/renderer_vk.cpp:4910–4958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4908 }
4909
4910 void StagingScratchBufferVK::create(uint32_t _size, uint32_t _count, VkBufferUsageFlags usage, uint32_t _align)
4911 {
4912 const VkAllocationCallbacks* allocatorCb = s_renderVK->m_allocatorCb;
4913 const VkDevice device = s_renderVK->m_device;
4914
4915 const uint32_t entrySize = bx::strideAlign(_size, _align);
4916 const uint32_t chunkSize = entrySize * _count;
4917
4918 VkBufferCreateInfo bci;
4919 bci.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
4920 bci.pNext = NULL;
4921 bci.flags = 0;
4922 bci.size = chunkSize;
4923 bci.usage = usage;
4924 bci.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
4925 bci.queueFamilyIndexCount = 0;
4926 bci.pQueueFamilyIndices = NULL;
4927
4928 VK_CHECK(vkCreateBuffer(
4929 device
4930 , &bci
4931 , allocatorCb
4932 , &m_buffer
4933 ) );
4934
4935 VkMemoryRequirements mr;
4936 vkGetBufferMemoryRequirements(
4937 device
4938 , m_buffer
4939 , &mr
4940 );
4941
4942 VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
4943 VkResult result = s_renderVK->allocateMemory(&mr, flags, &m_deviceMem, true);
4944
4945 if (VK_SUCCESS != result)
4946 {
4947 flags &= ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
4948 VK_CHECK(s_renderVK->allocateMemory(&mr, flags, &m_deviceMem, true) );
4949 }
4950
4951 m_size = (uint32_t)mr.size;
4952 m_chunkPos = 0;
4953 m_align = _align;
4954
4955 VK_CHECK(vkBindBufferMemory(device, m_buffer, m_deviceMem.mem, m_deviceMem.offset) );
4956
4957 VK_CHECK(vkMapMemory(device, m_deviceMem.mem, m_deviceMem.offset, m_size, 0, (void**)&m_data) );
4958 }
4959
4960 void StagingScratchBufferVK::createUniform(uint32_t _size, uint32_t _count)
4961 {

Callers 11

initMethod · 0.45
createIndexBufferMethod · 0.45
createVertexBufferMethod · 0.45
createShaderMethod · 0.45
createProgramMethod · 0.45
createTextureMethod · 0.45
createFrameBufferMethod · 0.45
readSwapChainMethod · 0.45
createAttachmentsMethod · 0.45

Calls 15

memSetFunction · 0.85
isShaderTypeFunction · 0.85
isShaderVerLessFunction · 0.85
getShaderTypeNameFunction · 0.85
idToDescriptorTypeFunction · 0.85
idToTextureDimensionFunction · 0.85
skipFunction · 0.85
allocFunction · 0.85
memCopyFunction · 0.85
idToAttribFunction · 0.85
setImageMemoryBarrierFunction · 0.85

Tested by

no test coverage detected