a bit of stuff, time to add spirv-link into this project

This commit is contained in:
2026-02-23 01:42:17 +02:00
parent c00ecf4081
commit 003106a4d7
48 changed files with 626 additions and 752 deletions

View File

@@ -255,7 +255,10 @@ CVkBuffer::CVkBuffer( uint32_t nSize, VkBufferUsageFlags2 eUsage, uint32_t nAlig
VkBufferDeviceAddressInfo stAddress = {};
stUsage.sType = VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO;
stUsage.usage = eUsage | VK_BUFFER_USAGE_2_SHADER_DEVICE_ADDRESS_BIT;
stUsage.usage = eUsage
| VK_BUFFER_USAGE_2_SHADER_DEVICE_ADDRESS_BIT
| VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT
| VK_BUFFER_USAGE_2_TRANSFER_DST_BIT;
if (eUsage & VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT)
{
m_eDescriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
@@ -391,7 +394,7 @@ uint32_t CVkTextureArray::CreateTexture( uint32_t i, const char *szPath )
int uHeight = 0;
int uChannels = 0;
unsigned char *pImg = stbi_load_from_memory(data.GetMemory(), data.GetSize(), &uWidth, &uHeight, &uChannels, 4);
IBuffer *pBuffer = m_pRenderContext->CreateStorageBuffer(uWidth*uHeight*uChannels);
IBuffer *pBuffer = m_pRenderContext->CreateStorageBuffer(uWidth*uHeight*4);
pBuffer->Lock();
void *pData = pBuffer->Map();
V_memcpy(pData, pImg, uWidth*uHeight*uChannels);
@@ -557,7 +560,9 @@ IImage *CVkRenderContext::CreateRenderTarget( uint32_t x, uint32_t y, EImageForm
}
IImage *CVkRenderContext::CreateTexture( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType )
{
return new CVkImage(x, y, 1, eFormat, eMultisampleType, IMAGE_TYPE_2D, VK_IMAGE_USAGE_SAMPLED_BIT);
CVkImage *pImage = new CVkImage(x, y, 1, eFormat, eMultisampleType, IMAGE_TYPE_2D, VK_IMAGE_USAGE_SAMPLED_BIT);
pImage->m_ePreferredLayout = VK_IMAGE_LAYOUT_GENERAL;
return pImage;
}
IImage *CVkRenderContext::CreateStorageImage( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType )
@@ -826,7 +831,6 @@ void CVkRenderContext::Frame( float fDeltaTime )
CUtlVector<uint32_t> uImageIndexes = {};
CUtlVector<uint32_t> uSwapchainImageIndexes = {};
CUtlVector<VulkanWindow_t> recreatedWindows = {};
vkDeviceWaitIdle(s_vkDevice);
for ( auto &m: m_pMaterials)
{
@@ -849,7 +853,6 @@ void CVkRenderContext::Frame( float fDeltaTime )
{
m_renderWindows.AppendTail(s);
}
vkDeviceWaitIdle(s_vkDevice);
for ( auto &s: m_renderWindows)
{
@@ -875,6 +878,7 @@ void CVkRenderContext::Frame( float fDeltaTime )
s_pPresentCommandBuffer = m_pCommandBufferManager->CreateCommandBuffer();
s_pPresentCommandBuffer->Reset();
double a = Plat_GetTime();
i = 0;
for ( auto &s: m_renderWindows )
{
@@ -937,7 +941,6 @@ void CVkRenderContext::Frame( float fDeltaTime )
s.m_uCurrentFrame = (s.m_uCurrentFrame + 1) % FRAMES_IN_FLIGHT;
}
m_pCommandBufferManager->RenderingFinished();
vkDeviceWaitIdle(s_vkDevice);
for (auto &a: m_scheduledRemovalBuffers)
{
@@ -950,7 +953,6 @@ void CVkRenderContext::Frame( float fDeltaTime )
m_scheduledRemovalLists = {};
m_scheduledRemovalBuffers = {};
m_pCommandBufferManager->FreeCommandBufferWithCommands(s_pPresentCommandBuffer);
vkDeviceWaitIdle(s_vkDevice);
}