Files
funnygame/materialsystem/vulkan/commands/draw.cpp
2025-12-14 22:46:45 +02:00

30 lines
705 B
C++

#include "../vulkan_state.h"
#include "../commands.h"
#include "tier0/platform.h"
DECLARE_VULKAN_COMMAND(ClearColor)
{
CVkImage *pImg;
pImage = NULL;
if (pImage)
pImg = (CVkImage*)pImage;
if (ppSwapchainImages)
pImg = (CVkImage*)ppSwapchainImages[iCurrentFrame];
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 = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.levelCount = 1,
.layerCount = 1,
};
vkCmdClearColorImage(hCommandBuffer, pImg->m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &color, 1, &range);
}