added barriers, started working on libraries

This commit is contained in:
2025-12-15 20:31:16 +02:00
parent 5d4c587bf2
commit dd1a51b752
20 changed files with 608 additions and 61 deletions

View File

@@ -0,0 +1,7 @@
#include "../vulkan_state.h"
#include "../commands.h"
#include "tier0/platform.h"
DECLARE_VULKAN_COMMAND(Empty)
{
}

View File

@@ -1,6 +1,9 @@
#include "../vulkan_state.h"
#include "../commands.h"
#include "materialsystem/imaterialsystem.h"
#include "tier0/platform.h"
#include "tier1/utlvector.h"
#include "vulkan/vulkan_core.h"
DECLARE_VULKAN_COMMAND(ClearColor)
@@ -8,7 +11,6 @@ DECLARE_VULKAN_COMMAND(ClearColor)
CVkImage *pImg;
pImage = NULL;
if (pImage)
pImg = (CVkImage*)pImage;
if (ppSwapchainImages)
@@ -17,7 +19,6 @@ DECLARE_VULKAN_COMMAND(ClearColor)
if (pImg == NULL)
Plat_FatalErrorFunc("pImage and *ppSwapchainImages are NULL\n");
AddDependency(pImg, DEPENDENCY_MODE_IMAGE_DESTINATION);
VkClearColorValue color = {.float32 = {r,g,b,a}};
VkImageSubresourceRange range = {
@@ -27,3 +28,31 @@ DECLARE_VULKAN_COMMAND(ClearColor)
};
vkCmdClearColorImage(hCommandBuffer, pImg->m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &color, 1, &range);
}
DECLARE_VULKAN_COMMAND(Begin)
{
VkRenderingInfo stRenderingInfo = {};
CUtlVector<VkRenderingAttachmentInfo> attachments;
for (auto i: images)
{
VkRenderingAttachmentInfo a;
a.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
a.imageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
a.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
a.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
a.imageView = ((CVkImage*)VulkanGetObject(i.m_stImage, iCurrentFrame))->m_imageView;
attachments.AppendTail(a);
}
stRenderingInfo.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
stRenderingInfo.layerCount = 1;
stRenderingInfo.colorAttachmentCount = attachments.GetSize();
stRenderingInfo.pColorAttachments = attachments.GetData();
vkCmdBeginRendering(hCommandBuffer, &stRenderingInfo);
}
DECLARE_VULKAN_COMMAND(End)
{
vkCmdEndRendering(hCommandBuffer);
}