Fixed most vulkan validation layers
This commit is contained in:
@@ -431,8 +431,6 @@ namespace Nuake
|
||||
return; // We don't care about this file type, we dont support it.
|
||||
}
|
||||
|
||||
Logger::Log("Adding " + file->GetName() + " to manifest", "manifest", VERBOSE);
|
||||
|
||||
// Register the resource in the manifest
|
||||
const std::string& path = file->GetRelativePath();
|
||||
const UUID uuid = resolverManager.ResolveUUID(file);
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Nuake
|
||||
{
|
||||
private:
|
||||
std::string Name;
|
||||
bool HasDepthTest = true;
|
||||
bool HasDepthTest = false;
|
||||
Ref<VulkanShader> VertShader;
|
||||
Ref<VulkanShader> FragShader;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ void PipelineBuilder::SetColorAttachments(std::vector<VkFormat>& formats)
|
||||
|
||||
void PipelineBuilder::SetLineRendering(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
if (enabled)
|
||||
{
|
||||
LineRasterization = {};
|
||||
LineRasterization.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_KHR;
|
||||
@@ -190,7 +190,7 @@ void PipelineBuilder::SetLineRendering(bool enabled)
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderInfo.pNext = nullptr;
|
||||
RenderInfo.pNext = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ void PipelineBuilder::DisableDepthTest()
|
||||
DepthStencil.depthTestEnable = VK_FALSE;
|
||||
DepthStencil.depthWriteEnable = VK_FALSE;
|
||||
DepthStencil.depthCompareOp = VK_COMPARE_OP_NEVER;
|
||||
DepthStencil.depthBoundsTestEnable = VK_FALSE;
|
||||
DepthStencil.depthBoundsTestEnable = VK_FALSE;
|
||||
DepthStencil.stencilTestEnable = VK_FALSE;
|
||||
DepthStencil.front = {};
|
||||
DepthStencil.back = {};
|
||||
|
||||
@@ -29,6 +29,7 @@ ShadowRenderPipeline::ShadowRenderPipeline()
|
||||
ShadowPipeline = RenderPipeline();
|
||||
auto& shadowPass = ShadowPipeline.AddPass("Shadow");
|
||||
shadowPass.AddAttachment("Depth", ImageFormat::D32F, ImageUsage::Depth, true);
|
||||
shadowPass.SetDepthTest(true);
|
||||
shadowPass.SetShaders(shaderMgr.GetShader("shadow_vert"), shaderMgr.GetShader("shadow_frag"));
|
||||
shadowPass.SetPushConstant<GBufferConstant>(gbufferConstant);
|
||||
shadowPass.SetPreRender([&](PassRenderContext& ctx) {
|
||||
@@ -295,7 +296,7 @@ void SceneRenderPipeline::Render(PassRenderContext& ctx)
|
||||
|
||||
void* mappedData;
|
||||
vmaMapMemory(VulkanAllocator::Get().GetAllocator(), stagingBuffer->GetAllocation(), &mappedData);
|
||||
Vector4 entityID = *reinterpret_cast<Vector4*>(mappedData);
|
||||
Vector4 entityID = *reinterpret_cast<Vector4*>(mappedData);
|
||||
vmaUnmapMemory(VulkanAllocator::Get().GetAllocator(), stagingBuffer->GetAllocation());
|
||||
|
||||
request.callback(static_cast<int>(entityID.r));
|
||||
@@ -312,6 +313,7 @@ void SceneRenderPipeline::RecreatePipeline()
|
||||
GBufferPipeline = RenderPipeline();
|
||||
auto& gBufferPass = GBufferPipeline.AddPass("GBuffer");
|
||||
gBufferPass.SetShaders(shaderMgr.GetShader("basic_vert"), shaderMgr.GetShader("basic_frag"));
|
||||
gBufferPass.SetDepthTest(true);
|
||||
gBufferPass.AddAttachment("Albedo", GBufferAlbedo->GetFormat());
|
||||
gBufferPass.AddAttachment("Normal", GBufferNormal->GetFormat());
|
||||
gBufferPass.AddAttachment("Material", GBufferMaterial->GetFormat());
|
||||
@@ -580,7 +582,7 @@ void SceneRenderPipeline::RecreatePipeline()
|
||||
gizmoPass.SetPushConstant<DebugConstant>(debugConstant);
|
||||
gizmoPass.AddInput("Depth");
|
||||
gizmoPass.AddAttachment("GizmoOutput", GizmoOutput->GetFormat());
|
||||
gizmoPass.AddAttachment("GizmoEntityID", GBufferEntityID->GetFormat(), ImageUsage::ColorAttachment, false);
|
||||
gizmoPass.AddAttachment("GizmoEntityID", GBufferEntityID->GetFormat(), ImageUsage::Default, false);
|
||||
gizmoPass.AddAttachment("GizmoDepth", GBufferDepth->GetFormat(), ImageUsage::Depth, false);
|
||||
gizmoPass.SetDepthTest(true);
|
||||
gizmoPass.SetPreRender([&](PassRenderContext& ctx)
|
||||
|
||||
@@ -190,6 +190,7 @@ namespace Nuake
|
||||
MulticastDelegate<DebugCmd&> DebugDrawDelegate;
|
||||
MulticastDelegate<DebugLineCmd&> DebugLineDrawDelegate;
|
||||
|
||||
|
||||
public:
|
||||
SceneRenderPipeline();
|
||||
~SceneRenderPipeline() = default;
|
||||
|
||||
@@ -125,7 +125,7 @@ Ref<VulkanShader> ShaderCompiler::CompileShader(const std::string& path)
|
||||
const char* errorMsg = reinterpret_cast<const char*>(errorBlobUtf8->GetBufferPointer());
|
||||
std::string errorMsgStr(errorMsg, errorBlobUtf8->GetBufferSize());
|
||||
|
||||
Logger::Log("Shader compilation failed: " + errorMsgStr, "DXC", CRITICAL);
|
||||
Logger::Log("Shader compilation failed: " + errorMsgStr, "DXC", CRITICAL);
|
||||
|
||||
throw std::runtime_error("Shader compilation failed: " + errorMsgStr);
|
||||
}
|
||||
|
||||
@@ -126,14 +126,10 @@ void VkRenderer::Initialize()
|
||||
camData.View = Matrix4(1.0f);
|
||||
camData.Projection = Matrix4(1.0f);
|
||||
|
||||
// init camera buffer
|
||||
InitDescriptors();
|
||||
|
||||
InitImgui();
|
||||
|
||||
SceneRenderer = CreateRef<VkSceneRenderer>();
|
||||
SceneRenderer->Init();
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
|
||||
@@ -203,8 +199,7 @@ void VkRenderer::SelectGPU()
|
||||
{
|
||||
VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
|
||||
VK_KHR_LINE_RASTERIZATION_EXTENSION_NAME,
|
||||
VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME,
|
||||
|
||||
VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME
|
||||
};
|
||||
|
||||
auto systemInfoRet = vkb::SystemInfo::get_system_info();
|
||||
@@ -228,7 +223,7 @@ void VkRenderer::SelectGPU()
|
||||
.set_required_features_12(features12)
|
||||
.set_required_features(VkPhysicalDeviceFeatures{
|
||||
.fillModeNonSolid = VK_TRUE,
|
||||
|
||||
.wideLines = VK_TRUE
|
||||
})
|
||||
.set_surface(Surface)
|
||||
.add_required_extensions(requiredExtensions)
|
||||
@@ -401,8 +396,12 @@ void VkRenderer::PrepareSceneData(RenderContext ctx)
|
||||
{
|
||||
scenes.push_back(scene);
|
||||
}
|
||||
|
||||
SceneRenderer->PrepareScenes(scenes, ctx);
|
||||
|
||||
// Maybe this shouldnt be in a scene renderer
|
||||
if (!SceneRenderers.empty())
|
||||
{
|
||||
SceneRenderers.begin()->second->PrepareScenes(scenes, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void VkRenderer::DrawScenes()
|
||||
|
||||
@@ -175,7 +175,6 @@ namespace Nuake
|
||||
VkCommandPool ImguiCommandPool;
|
||||
|
||||
std::map<UUID, Ref<VkSceneRenderer>> SceneRenderers;
|
||||
Ref<VkSceneRenderer> SceneRenderer;
|
||||
|
||||
public:
|
||||
static VkRenderer& Get()
|
||||
|
||||
Reference in New Issue
Block a user