Started work on build system
This commit is contained in:
@@ -17,8 +17,10 @@ CameraProjection *g_cameraDataMap;
|
||||
IMaterial *g_pDefaultMaterial;
|
||||
IMaterial *g_pCurrentMaterial;
|
||||
|
||||
vk_image2d_t g_meshdepth;
|
||||
vk_image2d_t g_meshcolor;
|
||||
vk_image2d_t g_meshDepth;
|
||||
vk_image2d_t g_meshDepthMSAA;
|
||||
vk_image2d_t g_meshColor;
|
||||
vk_image2d_t g_meshColorMSAA;
|
||||
|
||||
void IVulkan::Init()
|
||||
{
|
||||
@@ -56,10 +58,11 @@ void IVulkan::Init()
|
||||
g_cameraProperties.Create(sizeof(CameraProjection), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
|
||||
g_cameraDataMap = (CameraProjection*)g_cameraProperties.Map(0, 64);
|
||||
|
||||
g_meshdepth.Create(1280, 720, VK_FORMAT_D32_SFLOAT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
|
||||
g_meshcolor.Create(1280, 720, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
|
||||
g_meshDepth.Create(1280, 720, VK_FORMAT_D32_SFLOAT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, VK_SAMPLE_COUNT_1_BIT);
|
||||
g_meshDepthMSAA.Create(1280, 720, VK_FORMAT_D32_SFLOAT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, VK_SAMPLE_COUNT_4_BIT);
|
||||
g_meshColor.Create(1280, 720, VK_FORMAT_R16G16B16A16_SFLOAT, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_SAMPLE_COUNT_1_BIT);
|
||||
g_meshColorMSAA.Create(1280, 720, VK_FORMAT_R16G16B16A16_SFLOAT, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, VK_SAMPLE_COUNT_4_BIT);
|
||||
|
||||
IBrushRenderer::Init();
|
||||
IMeshRenderer::Init();
|
||||
};
|
||||
|
||||
@@ -73,11 +76,17 @@ void IVulkan::Frame()
|
||||
|
||||
if (g_bConfigNotify)
|
||||
{
|
||||
g_meshdepth.Destroy();
|
||||
g_meshdepth.Create(g_nWindowWidth, g_nWindowHeight, VK_FORMAT_D32_SFLOAT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
|
||||
g_meshDepth.Destroy();
|
||||
g_meshDepthMSAA.Destroy();
|
||||
g_meshColor.Destroy();
|
||||
g_meshColorMSAA.Destroy();
|
||||
|
||||
g_meshDepth.Create(g_nWindowWidth, g_nWindowHeight, VK_FORMAT_D32_SFLOAT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, VK_SAMPLE_COUNT_1_BIT);
|
||||
g_meshDepthMSAA.Create(g_nWindowWidth, g_nWindowHeight, VK_FORMAT_D32_SFLOAT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, VK_SAMPLE_COUNT_1_BIT);
|
||||
g_meshColor.Create(g_nWindowWidth, g_nWindowHeight, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_SAMPLE_COUNT_1_BIT);
|
||||
g_meshColorMSAA.Create(g_nWindowWidth, g_nWindowHeight, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, VK_SAMPLE_COUNT_4_BIT);
|
||||
}
|
||||
|
||||
IBrushRenderer::Frame(0);
|
||||
IMeshRenderer::Frame(0);
|
||||
};
|
||||
|
||||
@@ -119,7 +128,8 @@ void vk_shader_t::Destroy( void )
|
||||
void vk_tripipeline_t::Create(
|
||||
CUtlVector<vk_shader_t> &shaders,
|
||||
CUtlVector<VkDescriptorSetLayoutBinding> &bindings,
|
||||
uint32_t pushConstantSize
|
||||
uint32_t pushConstantSize,
|
||||
CUtlVector<VkFormat> formats
|
||||
)
|
||||
{
|
||||
VkPushConstantRange pushConstantRange = {};
|
||||
@@ -202,8 +212,8 @@ void vk_tripipeline_t::Create(
|
||||
VkPipelineRenderingCreateInfo prci = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.colorAttachmentCount = 1,
|
||||
.pColorAttachmentFormats = (VkFormat[]){ VK_FORMAT_B8G8R8A8_UNORM }, // <-- replace with your actual format
|
||||
.colorAttachmentCount = (uint32_t)formats.GetSize(),
|
||||
.pColorAttachmentFormats = formats.GetData(),
|
||||
.depthAttachmentFormat = VK_FORMAT_D32_SFLOAT,
|
||||
};
|
||||
|
||||
@@ -272,7 +282,7 @@ void vk_buffer_t::CopyTo(struct vk_buffer_t *buffer)
|
||||
{
|
||||
|
||||
}
|
||||
void vk_image2d_t::Create(size_t x, size_t y, VkFormat format, VkImageUsageFlags usage)
|
||||
void vk_image2d_t::Create(size_t x, size_t y, VkFormat format, VkImageUsageFlags usage, VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT)
|
||||
{
|
||||
VkImageCreateInfo imageInfo={};
|
||||
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
@@ -286,7 +296,7 @@ void vk_image2d_t::Create(size_t x, size_t y, VkFormat format, VkImageUsageFlags
|
||||
imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||
imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
imageInfo.format=format;
|
||||
imageInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
imageInfo.samples = samples;
|
||||
|
||||
VmaAllocationCreateInfo alloc = {};
|
||||
alloc.usage=VMA_MEMORY_USAGE_AUTO;
|
||||
|
||||
Reference in New Issue
Block a user