Fixing debug pass
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
"inheritEnvironments": [ "msvc_x64" ],
|
"inheritEnvironments": [ "msvc_x64" ],
|
||||||
"cmakeCommandArgs": "-DCMAKE_DEBUG_POSTFIX=\"\" -DCMAKE_PLATFORM=x64",
|
"cmakeCommandArgs": "-DCMAKE_DEBUG_POSTFIX=\"\" -DCMAKE_PLATFORM=x64",
|
||||||
"buildRoot": "C:/Users/Dynamitos/Seele/bin/",
|
"buildRoot": "C:/Users/Dynamitos/Seele/bin/",
|
||||||
"installRoot": "C:/Program Files/Seele",
|
"installRoot": "C:/Program Files/Seele"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Release",
|
"name": "Release",
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import Common;
|
||||||
|
|
||||||
|
struct DebugVertex
|
||||||
|
{
|
||||||
|
float3 position;
|
||||||
|
float3 color;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct VertexOutput
|
||||||
|
{
|
||||||
|
float4 clipPosition : SV_Position;
|
||||||
|
float3 color : COLOR0;
|
||||||
|
};
|
||||||
|
|
||||||
|
[shader("vertex")]
|
||||||
|
VertexOutput vertexMain(DebugVertex input)
|
||||||
|
{
|
||||||
|
VertexOutput output;
|
||||||
|
output.clipPosition = mul(pViewParams.projectionMatrix, mul(pViewParams.viewMatrix, float4(input.position, 1.0f)));
|
||||||
|
output.color = input.color;
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
[shader("pixel")]
|
||||||
|
float4 fragmentMain(VertexOutput input)
|
||||||
|
{
|
||||||
|
return float4(input.color, 1.0f);
|
||||||
|
}
|
||||||
@@ -71,6 +71,11 @@ void BasePass::render()
|
|||||||
tLightGrid->pipelineBarrier(
|
tLightGrid->pipelineBarrier(
|
||||||
Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||||
|
depthAttachment->getTexture()->pipelineBarrier(
|
||||||
|
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||||
|
Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT);
|
||||||
|
depthAttachment->getTexture()->transferOwnership(Gfx::QueueType::GRAPHICS);
|
||||||
|
depthAttachment->getTexture()->changeLayout(Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
||||||
|
|
||||||
descriptorSets[INDEX_VIEW_PARAMS] = viewParamsSet;
|
descriptorSets[INDEX_VIEW_PARAMS] = viewParamsSet;
|
||||||
descriptorSets[INDEX_LIGHT_ENV] = scene->getLightEnvironment()->getDescriptorSet();
|
descriptorSets[INDEX_LIGHT_ENV] = scene->getLightEnvironment()->getDescriptorSet();
|
||||||
@@ -191,7 +196,7 @@ void BasePass::publishOutputs()
|
|||||||
|
|
||||||
void BasePass::createRenderPass()
|
void BasePass::createRenderPass()
|
||||||
{
|
{
|
||||||
Gfx::PRenderTargetAttachment depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_DEPTH");
|
depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_DEPTH");
|
||||||
depthAttachment->loadOp = Gfx::SE_ATTACHMENT_LOAD_OP_LOAD;
|
depthAttachment->loadOp = Gfx::SE_ATTACHMENT_LOAD_OP_LOAD;
|
||||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout{
|
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout{
|
||||||
.colorAttachments = { colorAttachment },
|
.colorAttachments = { colorAttachment },
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
static void modifyRenderPassMacros(Map<const char*, const char*>& defines);
|
static void modifyRenderPassMacros(Map<const char*, const char*>& defines);
|
||||||
private:
|
private:
|
||||||
Gfx::ORenderTargetAttachment colorAttachment;
|
Gfx::ORenderTargetAttachment colorAttachment;
|
||||||
Gfx::PTexture2D depthBuffer;
|
Gfx::PRenderTargetAttachment depthAttachment;
|
||||||
Gfx::PShaderBuffer oLightIndexList;
|
Gfx::PShaderBuffer oLightIndexList;
|
||||||
Gfx::PShaderBuffer tLightIndexList;
|
Gfx::PShaderBuffer tLightIndexList;
|
||||||
Gfx::PTexture2D oLightGrid;
|
Gfx::PTexture2D oLightGrid;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ DebugPass::DebugPass(Gfx::PGraphics graphics, PScene scene)
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugPass::~DebugPass()
|
DebugPass::~DebugPass()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ void DebugPass::render()
|
|||||||
Gfx::PRenderCommand renderCommand = graphics->createRenderCommand("DebugRender");
|
Gfx::PRenderCommand renderCommand = graphics->createRenderCommand("DebugRender");
|
||||||
renderCommand->setViewport(viewport);
|
renderCommand->setViewport(viewport);
|
||||||
renderCommand->bindPipeline(pipeline);
|
renderCommand->bindPipeline(pipeline);
|
||||||
renderCommand->bindDescriptor(descriptorSet);
|
renderCommand->bindDescriptor(viewParamsSet);
|
||||||
renderCommand->bindVertexBuffer({ debugVertices });
|
renderCommand->bindVertexBuffer({ debugVertices });
|
||||||
renderCommand->draw((uint32)gDebugVertices.size(), 1, 0, 0);
|
renderCommand->draw((uint32)gDebugVertices.size(), 1, 0, 0);
|
||||||
graphics->executeCommands(Array{renderCommand});
|
graphics->executeCommands(Array{renderCommand});
|
||||||
@@ -64,18 +65,6 @@ void DebugPass::endFrame()
|
|||||||
|
|
||||||
void DebugPass::publishOutputs()
|
void DebugPass::publishOutputs()
|
||||||
{
|
{
|
||||||
UniformBufferCreateInfo viewCreateInfo = {
|
|
||||||
.sourceData = DataSource {
|
|
||||||
.size = sizeof(ViewParameter),
|
|
||||||
.data = nullptr,
|
|
||||||
},
|
|
||||||
.dynamic = true
|
|
||||||
};
|
|
||||||
viewParamsBuffer = graphics->createUniformBuffer(viewCreateInfo);
|
|
||||||
|
|
||||||
descriptorLayout = graphics->createDescriptorLayout("DebugDescLayout");
|
|
||||||
descriptorLayout->addDescriptorBinding(0, Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
|
|
||||||
descriptorLayout->create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugPass::createRenderPass()
|
void DebugPass::createRenderPass()
|
||||||
@@ -91,22 +80,47 @@ void DebugPass::createRenderPass()
|
|||||||
renderPass = graphics->createRenderPass(std::move(layout), viewport);
|
renderPass = graphics->createRenderPass(std::move(layout), viewport);
|
||||||
|
|
||||||
Gfx::OPipelineLayout pipelineLayout = graphics->createPipelineLayout();
|
Gfx::OPipelineLayout pipelineLayout = graphics->createPipelineLayout();
|
||||||
pipelineLayout->addDescriptorLayout(0, descriptorLayout);
|
pipelineLayout->addDescriptorLayout(0, viewParamsLayout);
|
||||||
pipelineLayout->create();
|
pipelineLayout->create();
|
||||||
|
|
||||||
ShaderCreateInfo createInfo;
|
ShaderCreateInfo createInfo = {
|
||||||
createInfo.name = "DebugVertex";
|
.mainModule = "Debug",
|
||||||
createInfo.mainModule = "Debug";
|
.additionalModules = { "Debug" },
|
||||||
createInfo.entryPoint = "vertexMain";
|
.name = "DebugVertex",
|
||||||
createInfo.defines["INDEX_VIEW_PARAMS"] = "0";
|
.entryPoint = "vertexMain",
|
||||||
|
};
|
||||||
vertexShader = graphics->createVertexShader(createInfo);
|
vertexShader = graphics->createVertexShader(createInfo);
|
||||||
|
|
||||||
createInfo.name = "DebugFragment";
|
createInfo.name = "DebugFragment";
|
||||||
|
|
||||||
createInfo.entryPoint = "fragmentMain";
|
createInfo.entryPoint = "fragmentMain";
|
||||||
fragmentShader = graphics->createFragmentShader(createInfo);
|
fragmentShader = graphics->createFragmentShader(createInfo);
|
||||||
|
|
||||||
|
VertexInputStateCreateInfo inputCreate = {
|
||||||
|
.bindings = {
|
||||||
|
VertexInputBinding {
|
||||||
|
.binding = 0,
|
||||||
|
.stride = sizeof(DebugVertex),
|
||||||
|
.inputRate = Gfx::SE_VERTEX_INPUT_RATE_VERTEX,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.attributes = {
|
||||||
|
VertexInputAttribute {
|
||||||
|
.location = 0,
|
||||||
|
.binding = 0,
|
||||||
|
.format = Gfx::SE_FORMAT_R32G32B32_SFLOAT,
|
||||||
|
.offset = 0,
|
||||||
|
},
|
||||||
|
VertexInputAttribute {
|
||||||
|
.location = 1,
|
||||||
|
.binding = 0,
|
||||||
|
.format = Gfx::SE_FORMAT_R32G32B32_SFLOAT,
|
||||||
|
.offset = sizeof(Vector)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
vertexInput = graphics->createVertexInput(inputCreate);
|
||||||
Gfx::LegacyPipelineCreateInfo gfxInfo;
|
Gfx::LegacyPipelineCreateInfo gfxInfo;
|
||||||
|
gfxInfo.vertexInput = vertexInput;
|
||||||
gfxInfo.vertexShader = vertexShader;
|
gfxInfo.vertexShader = vertexShader;
|
||||||
gfxInfo.fragmentShader = fragmentShader;
|
gfxInfo.fragmentShader = fragmentShader;
|
||||||
gfxInfo.rasterizationState.polygonMode = Gfx::SE_POLYGON_MODE_LINE;
|
gfxInfo.rasterizationState.polygonMode = Gfx::SE_POLYGON_MODE_LINE;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "RenderPass.h"
|
#include "RenderPass.h"
|
||||||
#include "Scene/Scene.h"
|
#include "Scene/Scene.h"
|
||||||
#include "Graphics/DebugVertex.h"
|
#include "Graphics/DebugVertex.h"
|
||||||
|
#include "Graphics/Pipeline.h"
|
||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
@@ -21,10 +22,8 @@ public:
|
|||||||
virtual void publishOutputs() override;
|
virtual void publishOutputs() override;
|
||||||
virtual void createRenderPass() override;
|
virtual void createRenderPass() override;
|
||||||
private:
|
private:
|
||||||
|
Gfx::OVertexInput vertexInput;
|
||||||
Gfx::OVertexBuffer debugVertices;
|
Gfx::OVertexBuffer debugVertices;
|
||||||
Gfx::OUniformBuffer viewParamsBuffer;
|
|
||||||
Gfx::ODescriptorLayout descriptorLayout;
|
|
||||||
Gfx::PDescriptorSet descriptorSet;
|
|
||||||
Gfx::OVertexShader vertexShader;
|
Gfx::OVertexShader vertexShader;
|
||||||
Gfx::OFragmentShader fragmentShader;
|
Gfx::OFragmentShader fragmentShader;
|
||||||
Gfx::PGraphicsPipeline pipeline;
|
Gfx::PGraphicsPipeline pipeline;
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ void DepthPrepass::beginFrame(const Component::Camera& cam)
|
|||||||
|
|
||||||
void DepthPrepass::render()
|
void DepthPrepass::render()
|
||||||
{
|
{
|
||||||
depthAttachment->getTexture()->pipelineBarrier(
|
|
||||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
|
||||||
Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT);
|
|
||||||
depthAttachment->getTexture()->transferOwnership(Gfx::QueueType::GRAPHICS);
|
|
||||||
Gfx::ShaderPermutation permutation;
|
Gfx::ShaderPermutation permutation;
|
||||||
if(graphics->supportMeshShading())
|
if(graphics->supportMeshShading())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,8 +64,6 @@ void LightCullingPass::render()
|
|||||||
//computeCommand->dispatch(dispatchParams.numThreadGroups.x, dispatchParams.numThreadGroups.y, dispatchParams.numThreadGroups.z);
|
//computeCommand->dispatch(dispatchParams.numThreadGroups.x, dispatchParams.numThreadGroups.y, dispatchParams.numThreadGroups.z);
|
||||||
Array<Gfx::PComputeCommand> commands = {computeCommand};
|
Array<Gfx::PComputeCommand> commands = {computeCommand};
|
||||||
graphics->executeCommands(commands);
|
graphics->executeCommands(commands);
|
||||||
depthAttachment->changeLayout(Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
|
||||||
depthAttachment->transferOwnership(Gfx::QueueType::GRAPHICS);
|
|
||||||
//std::cout << "LightCulling render()" << std::endl;
|
//std::cout << "LightCulling render()" << std::endl;
|
||||||
//co_return;
|
//co_return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ Fence::Fence(PGraphics graphics)
|
|||||||
|
|
||||||
Fence::~Fence()
|
Fence::~Fence()
|
||||||
{
|
{
|
||||||
|
vkWaitForFences(graphics->getDevice(), 1, &fence, true, 100000);
|
||||||
vkDestroyFence(graphics->getDevice(), fence, nullptr);
|
vkDestroyFence(graphics->getDevice(), fence, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,7 @@ public:
|
|||||||
void update(float deltaTime);
|
void update(float deltaTime);
|
||||||
entt::entity createEntity()
|
entt::entity createEntity()
|
||||||
{
|
{
|
||||||
auto result = registry.create();
|
return registry.create();
|
||||||
std::cout << "Created " << (uint64_t)result << " at " << this << std::endl;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
void destroyEntity(entt::entity identifier)
|
void destroyEntity(entt::entity identifier)
|
||||||
{
|
{
|
||||||
@@ -30,8 +28,6 @@ public:
|
|||||||
template<typename Component, typename... Args>
|
template<typename Component, typename... Args>
|
||||||
Component& attachComponent(entt::entity entity, Args&&... args)
|
Component& attachComponent(entt::entity entity, Args&&... args)
|
||||||
{
|
{
|
||||||
std::cout << "Emplace " << (uint64_t)entity << std::endl;
|
|
||||||
std::cout << "Exists " << registry.valid(entity) << std::endl;
|
|
||||||
return registry.emplace<Component>(entity, std::forward<Args>(args)...);
|
return registry.emplace<Component>(entity, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
template<typename Component>
|
template<typename Component>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreate
|
|||||||
DepthPrepass(graphics, scene),
|
DepthPrepass(graphics, scene),
|
||||||
LightCullingPass(graphics, scene),
|
LightCullingPass(graphics, scene),
|
||||||
BasePass(graphics, scene),
|
BasePass(graphics, scene),
|
||||||
|
DebugPass(graphics, scene),
|
||||||
SkyboxRenderPass(graphics, scene)
|
SkyboxRenderPass(graphics, scene)
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "Graphics/RenderPass/LightCullingPass.h"
|
#include "Graphics/RenderPass/LightCullingPass.h"
|
||||||
#include "Graphics/RenderPass/BasePass.h"
|
#include "Graphics/RenderPass/BasePass.h"
|
||||||
#include "Graphics/RenderPass/SkyboxRenderPass.h"
|
#include "Graphics/RenderPass/SkyboxRenderPass.h"
|
||||||
|
#include "Graphics/RenderPass/DebugPass.h"
|
||||||
#include "System/KeyboardInput.h"
|
#include "System/KeyboardInput.h"
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "Platform/Windows/GameInterface.h" // TODO
|
#include "Platform/Windows/GameInterface.h" // TODO
|
||||||
@@ -35,6 +36,7 @@ protected:
|
|||||||
DepthPrepass,
|
DepthPrepass,
|
||||||
LightCullingPass,
|
LightCullingPass,
|
||||||
BasePass,
|
BasePass,
|
||||||
|
DebugPass,
|
||||||
SkyboxRenderPass
|
SkyboxRenderPass
|
||||||
> renderGraph;
|
> renderGraph;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user