Draw List works now
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
extern bool resetVisibility;
|
||||
|
||||
VisibilityPass::VisibilityPass(Gfx::PGraphics graphics, PScene scene)
|
||||
: RenderPass(graphics, scene)
|
||||
{
|
||||
@@ -17,22 +19,26 @@ void VisibilityPass::beginFrame(const Component::Camera& cam)
|
||||
{
|
||||
RenderPass::beginFrame(cam);
|
||||
cullingBuffer->rotateBuffer(VertexData::getMeshletCount() * sizeof(VertexData::MeshletCullingInfo), true);
|
||||
if (resetVisibility)
|
||||
{
|
||||
Array<VertexData::MeshletCullingInfo> cullingData(VertexData::getMeshletCount());
|
||||
std::memset(cullingData.data(), 0xffff, cullingData.size() * sizeof(VertexData::MeshletCullingInfo));
|
||||
|
||||
//Array<VertexData::MeshletCullingInfo> cullingData(VertexData::getMeshletCount());
|
||||
//std::memset(cullingData.data(), 0xffff, cullingData.size() * sizeof(VertexData::MeshletCullingInfo));
|
||||
cullingBuffer->updateContents(ShaderBufferCreateInfo{
|
||||
.sourceData = {
|
||||
.size = VertexData::getMeshletCount() * sizeof(VertexData::MeshletCullingInfo),
|
||||
.data = (uint8 *)cullingData.data(),
|
||||
},
|
||||
.numElements = VertexData::getMeshletCount()});
|
||||
cullingBuffer->pipelineBarrier(
|
||||
Gfx::SE_ACCESS_TRANSFER_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
Gfx::SE_ACCESS_MEMORY_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
|
||||
|
||||
resetVisibility = false;
|
||||
}
|
||||
|
||||
//cullingBuffer->updateContents(ShaderBufferCreateInfo{
|
||||
// .sourceData = {
|
||||
// .size = VertexData::getMeshletCount() * sizeof(VertexData::MeshletCullingInfo),
|
||||
// .data = (uint8 *)cullingData.data(),
|
||||
// },
|
||||
// .numElements = VertexData::getMeshletCount()});
|
||||
//cullingBuffer->pipelineBarrier(
|
||||
// Gfx::SE_ACCESS_TRANSFER_WRITE_BIT,
|
||||
// Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
// Gfx::SE_ACCESS_MEMORY_WRITE_BIT,
|
||||
// Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
|
||||
|
||||
}
|
||||
|
||||
void VisibilityPass::render()
|
||||
@@ -60,8 +66,7 @@ void VisibilityPass::render()
|
||||
Gfx::OComputeCommand command = graphics->createComputeCommand("VisibilityCommand");
|
||||
command->bindPipeline(visibilityPipeline);
|
||||
command->bindDescriptor({viewParamsSet, visibilitySet});
|
||||
command->dispatch(VertexData::getMeshletCount() / BLOCK_SIZE, 1, 1);
|
||||
//command->dispatch(threadGroupSize.x, threadGroupSize.y, threadGroupSize.z);
|
||||
command->dispatch(threadGroupSize.x, threadGroupSize.y, threadGroupSize.z);
|
||||
Array<Gfx::OComputeCommand> commands;
|
||||
commands.add(std::move(command));
|
||||
graphics->executeCommands(std::move(commands));
|
||||
|
||||
@@ -20,6 +20,8 @@ using namespace Seele;
|
||||
bool usePositionOnly = false;
|
||||
bool useViewCulling = false;
|
||||
bool useLightCulling = false;
|
||||
bool resetVisibility = false;
|
||||
|
||||
|
||||
GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo, std::string dllPath)
|
||||
: View(graphics, window, createInfo, "Game")
|
||||
@@ -122,6 +124,10 @@ void GameView::keyCallback(KeyCode code, InputAction action, KeyModifier modifie
|
||||
useLightCulling = !useLightCulling;
|
||||
std::cout << "Use Light Culling " << useLightCulling << std::endl;
|
||||
}
|
||||
if (code == KeyCode::KEY_R && action == InputAction::RELEASE)
|
||||
{
|
||||
resetVisibility = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GameView::mouseMoveCallback(double xPos, double yPos)
|
||||
|
||||
Reference in New Issue
Block a user