Basic shader compilation
This commit is contained in:
@@ -80,7 +80,7 @@ void BasePass::render()
|
||||
}
|
||||
permutation.setFragmentFile("BasePass");
|
||||
graphics->beginRenderPass(renderPass);
|
||||
Array<Gfx::PRenderCommand> commands;
|
||||
Array<Gfx::ORenderCommand> commands;
|
||||
for (VertexData* vertexData : VertexData::getList())
|
||||
{
|
||||
permutation.setVertexData(vertexData->getTypeName());
|
||||
@@ -98,7 +98,7 @@ void BasePass::render()
|
||||
permutation.setMaterial(materialData.material->getName());
|
||||
Gfx::PermutationId id(permutation);
|
||||
|
||||
Gfx::PRenderCommand command = graphics->createRenderCommand("BaseRender");
|
||||
Gfx::ORenderCommand command = graphics->createRenderCommand("BaseRender");
|
||||
command->setViewport(viewport);
|
||||
Gfx::OPipelineLayout layout = graphics->createPipelineLayout(basePassLayout);
|
||||
layout->addDescriptorLayout(INDEX_MATERIAL, materialData.material->getDescriptorLayout());
|
||||
@@ -159,10 +159,10 @@ void BasePass::render()
|
||||
}
|
||||
}
|
||||
}
|
||||
commands.add(command);
|
||||
commands.add(std::move(command));
|
||||
}
|
||||
}
|
||||
graphics->executeCommands(commands);
|
||||
graphics->executeCommands(std::move(commands));
|
||||
graphics->endRenderPass();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,9 @@ void DebugPass::render()
|
||||
renderCommand->bindDescriptor(viewParamsSet);
|
||||
renderCommand->bindVertexBuffer({ debugVertices });
|
||||
renderCommand->draw((uint32)gDebugVertices.size(), 1, 0, 0);
|
||||
graphics->executeCommands(Array{std::move(renderCommand)});
|
||||
Array<Gfx::ORenderCommand> commands;
|
||||
commands.add(std::move(renderCommand));
|
||||
graphics->executeCommands({std::move(commands)});
|
||||
graphics->endRenderPass();
|
||||
gDebugVertices.clear();
|
||||
}
|
||||
|
||||
@@ -60,13 +60,14 @@ void LightCullingPass::render()
|
||||
cullingDescriptorSet->updateTexture(5, Gfx::PTexture2D(oLightGrid));
|
||||
cullingDescriptorSet->updateTexture(6, Gfx::PTexture2D(tLightGrid));
|
||||
cullingDescriptorSet->writeChanges();
|
||||
Gfx::PComputeCommand computeCommand = graphics->createComputeCommand("CullingCommand");
|
||||
Gfx::OComputeCommand computeCommand = graphics->createComputeCommand("CullingCommand");
|
||||
computeCommand->bindPipeline(cullingPipeline);
|
||||
computeCommand->bindDescriptor({ viewParamsSet, dispatchParamsSet, cullingDescriptorSet, lightEnv->getDescriptorSet() });
|
||||
computeCommand->dispatch(dispatchParams.numThreadGroups.x, dispatchParams.numThreadGroups.y, dispatchParams.numThreadGroups.z);
|
||||
Array<Gfx::PComputeCommand> commands = {computeCommand};
|
||||
Array<Gfx::OComputeCommand> commands;
|
||||
commands.add(std::move(computeCommand));
|
||||
//std::cout << "Execute" << std::endl;
|
||||
graphics->executeCommands(commands);
|
||||
graphics->executeCommands(std::move(commands));
|
||||
}
|
||||
|
||||
void LightCullingPass::endFrame()
|
||||
@@ -246,12 +247,13 @@ void LightCullingPass::setupFrustums()
|
||||
dispatchParamsSet->updateBuffer(1, frustumBuffer);
|
||||
dispatchParamsSet->writeChanges();
|
||||
|
||||
Gfx::PComputeCommand command = graphics->createComputeCommand("FrustumCommand");
|
||||
Gfx::OComputeCommand command = graphics->createComputeCommand("FrustumCommand");
|
||||
command->bindPipeline(frustumPipeline);
|
||||
command->bindDescriptor({ viewParamsSet, dispatchParamsSet });
|
||||
command->dispatch(numThreadGroups.x, numThreadGroups.y, numThreadGroups.z);
|
||||
Array<Gfx::PComputeCommand> commands = {command};
|
||||
graphics->executeCommands(commands);
|
||||
Array<Gfx::OComputeCommand> commands;
|
||||
commands.add(std::move(command));
|
||||
graphics->executeCommands(std::move(commands));
|
||||
frustumBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
@@ -56,12 +56,14 @@ void SkyboxRenderPass::render()
|
||||
Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, Gfx::SE_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT
|
||||
);
|
||||
graphics->beginRenderPass(renderPass);
|
||||
Gfx::PRenderCommand renderCommand = graphics->createRenderCommand("SkyboxRender");
|
||||
Gfx::ORenderCommand renderCommand = graphics->createRenderCommand("SkyboxRender");
|
||||
renderCommand->setViewport(viewport);
|
||||
renderCommand->bindPipeline(pipeline);
|
||||
renderCommand->bindDescriptor({viewParamsSet, skyboxDataSet, textureSet});
|
||||
renderCommand->draw(36, 1, 0, 0);
|
||||
graphics->executeCommands(Array{ renderCommand });
|
||||
Array<Gfx::ORenderCommand> commands;
|
||||
commands.add(std::move(renderCommand));
|
||||
graphics->executeCommands(std::move(commands));
|
||||
graphics->endRenderPass();
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ void TextPass::beginFrame(const Component::Camera& cam)
|
||||
void TextPass::render()
|
||||
{
|
||||
graphics->beginRenderPass(renderPass);
|
||||
Array<Gfx::PRenderCommand> commands;
|
||||
Array<Gfx::ORenderCommand> commands;
|
||||
for(const auto& [fontAsset, res] : textResources)
|
||||
{
|
||||
Gfx::PRenderCommand command = graphics->createRenderCommand("TextPassCommand");
|
||||
Gfx::ORenderCommand command = graphics->createRenderCommand("TextPassCommand");
|
||||
command->setViewport(viewport);
|
||||
command->bindPipeline(pipeline);
|
||||
for(const auto& resource : res)
|
||||
@@ -87,9 +87,9 @@ void TextPass::render()
|
||||
command->pushConstants(layoutRef, Gfx::SE_SHADER_STAGE_VERTEX_BIT | Gfx::SE_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(TextData), &resource.textData);
|
||||
//command->draw(4, static_cast<uint32>(resource.vertexBuffer->getNumVertices()), 0, 0);
|
||||
}
|
||||
commands.add(command);
|
||||
commands.add(std::move(command));
|
||||
}
|
||||
graphics->executeCommands(commands);
|
||||
graphics->executeCommands(std::move(commands));
|
||||
graphics->endRenderPass();
|
||||
textResources.clear();
|
||||
//co_return;
|
||||
|
||||
@@ -48,7 +48,9 @@ void UIPass::render()
|
||||
command->bindVertexBuffer({elementBuffer});
|
||||
command->bindDescriptor(descriptorSet);
|
||||
command->draw(4, static_cast<uint32>(renderElements.size()), 0, 0);
|
||||
graphics->executeCommands(Array{std::move(command)});
|
||||
Array<Gfx::ORenderCommand> commands;
|
||||
commands.add(std::move(command));
|
||||
graphics->executeCommands(std::move(commands));
|
||||
graphics->endRenderPass();
|
||||
|
||||
//co_return;
|
||||
|
||||
Reference in New Issue
Block a user