lot of metal changes, but no idea how this stuff works
This commit is contained in:
@@ -138,7 +138,7 @@ void BasePass::beginFrame(const Component::Camera& cam) {
|
||||
}
|
||||
|
||||
void BasePass::render() {
|
||||
opaqueCulling->updateBuffer(0, 0, oLightIndexList);
|
||||
/*opaqueCulling->updateBuffer(0, 0, oLightIndexList);
|
||||
opaqueCulling->updateTexture(1, 0, oLightGrid);
|
||||
transparentCulling->updateBuffer(0, 0, tLightIndexList);
|
||||
transparentCulling->updateTexture(1, 0, tLightGrid);
|
||||
@@ -250,16 +250,21 @@ void BasePass::render() {
|
||||
|
||||
//commands.add(waterRenderer->render(viewParamsSet));
|
||||
//commands.add(terrainRenderer->render(viewParamsSet));
|
||||
|
||||
*/
|
||||
// Skybox
|
||||
graphics->waitDeviceIdle();
|
||||
graphics->beginRenderPass(renderPass);
|
||||
{
|
||||
Gfx::ORenderCommand skyboxCommand = graphics->createRenderCommand("SkyboxRender");
|
||||
skyboxCommand->setViewport(viewport);
|
||||
skyboxCommand->bindPipeline(pipeline);
|
||||
skyboxCommand->bindDescriptor({viewParamsSet, skyboxDataSet, textureSet});
|
||||
skyboxCommand->draw(36, 1, 0, 0);
|
||||
commands.add(std::move(skyboxCommand));
|
||||
graphics->executeCommands(std::move(skyboxCommand));
|
||||
}
|
||||
graphics->endRenderPass();
|
||||
graphics->waitDeviceIdle();
|
||||
/*
|
||||
// Transparent rendering
|
||||
{
|
||||
permutation.setDepthCulling(false); // ignore visibility infos for transparency
|
||||
@@ -376,6 +381,7 @@ void BasePass::render() {
|
||||
query->endQuery();
|
||||
timestamps->write(Gfx::SE_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, "BaseEnd");
|
||||
gDebugVertices.clear();
|
||||
*/
|
||||
}
|
||||
|
||||
void BasePass::endFrame() {}
|
||||
|
||||
@@ -43,7 +43,7 @@ CachedDepthPass::~CachedDepthPass() {}
|
||||
void CachedDepthPass::beginFrame(const Component::Camera& cam) { RenderPass::beginFrame(cam); }
|
||||
|
||||
void CachedDepthPass::render() {
|
||||
query->beginQuery();
|
||||
/* query->beginQuery();
|
||||
timestamps->write(Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT, "CachedBegin");
|
||||
graphics->beginRenderPass(renderPass);
|
||||
Array<Gfx::ORenderCommand> commands;
|
||||
@@ -136,7 +136,7 @@ void CachedDepthPass::render() {
|
||||
graphics->endRenderPass();
|
||||
graphics->waitDeviceIdle();
|
||||
timestamps->write(Gfx::SE_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, "CachedEnd");
|
||||
query->endQuery();
|
||||
query->endQuery();*/
|
||||
}
|
||||
|
||||
void CachedDepthPass::endFrame() {}
|
||||
|
||||
@@ -68,7 +68,7 @@ DepthCullingPass::~DepthCullingPass() {}
|
||||
void DepthCullingPass::beginFrame(const Component::Camera& cam) { RenderPass::beginFrame(cam); }
|
||||
|
||||
void DepthCullingPass::render() {
|
||||
query->beginQuery();
|
||||
/*query->beginQuery();
|
||||
depthAttachment.getTexture()->changeLayout(Gfx::SE_IMAGE_LAYOUT_GENERAL, Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, Gfx::SE_ACCESS_SHADER_READ_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
@@ -217,7 +217,7 @@ void DepthCullingPass::render() {
|
||||
// Sync visibility write with compute read
|
||||
visibilityAttachment.getTexture()->pipelineBarrier(Gfx::SE_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, Gfx::SE_ACCESS_SHADER_READ_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);*/
|
||||
}
|
||||
|
||||
void DepthCullingPass::endFrame() {}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "RenderGraph.h"
|
||||
#include "Scene/Scene.h"
|
||||
#include "Graphics/Metal/Descriptor.h"
|
||||
#include "Graphics/Metal/Shader.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
@@ -36,7 +38,7 @@ void LightCullingPass::beginFrame(const Component::Camera& cam) {
|
||||
}
|
||||
|
||||
void LightCullingPass::render() {
|
||||
query->beginQuery();
|
||||
/*query->beginQuery();
|
||||
timestamps->write(Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT, "LightCullBegin");
|
||||
oLightGrid->pipelineBarrier(Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, Gfx::SE_ACCESS_SHADER_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
@@ -71,7 +73,7 @@ void LightCullingPass::render() {
|
||||
oLightGrid->pipelineBarrier(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);
|
||||
tLightGrid->pipelineBarrier(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_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);*/
|
||||
}
|
||||
|
||||
void LightCullingPass::endFrame() {}
|
||||
@@ -248,7 +250,7 @@ void LightCullingPass::setupFrustums() {
|
||||
dispatchParamsLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.binding = 0,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
||||
.uniformLength = 56,//sizeof(DispatchParams),
|
||||
.uniformLength = sizeof(DispatchParams),
|
||||
});
|
||||
dispatchParamsLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.binding = 1,
|
||||
@@ -269,6 +271,8 @@ void LightCullingPass::setupFrustums() {
|
||||
graphics->beginShaderCompilation(createInfo);
|
||||
frustumShader = graphics->createComputeShader({0});
|
||||
// Have to compile shader before finalizing layout as parameters get mapped later
|
||||
Metal::ComputeShader* shader = (Metal::ComputeShader*)(*frustumShader);
|
||||
std::cout << shader->getFunction()->newArgumentEncoder(1)->debugDescription()->cString(NS::ASCIIStringEncoding) << std::endl;
|
||||
frustumLayout->create();
|
||||
|
||||
Gfx::ComputePipelineCreateInfo pipelineInfo;
|
||||
@@ -315,7 +319,7 @@ void LightCullingPass::setupFrustums() {
|
||||
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);
|
||||
graphics->waitDeviceIdle();
|
||||
Frustum* frustums = (Frustum*)frustumBuffer->map();
|
||||
std::cout << frustums << std::endl;
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ void VisibilityPass::beginFrame(const Component::Camera& cam) {
|
||||
}
|
||||
|
||||
void VisibilityPass::render() {
|
||||
cullingBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_MESH_SHADER_BIT_EXT,
|
||||
/*cullingBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_MESH_SHADER_BIT_EXT,
|
||||
Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT);
|
||||
cullingBuffer->clear();
|
||||
|
||||
@@ -38,7 +38,7 @@ void VisibilityPass::render() {
|
||||
query->endQuery();
|
||||
cullingBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_TASK_SHADER_BIT_EXT | Gfx::SE_PIPELINE_STAGE_MESH_SHADER_BIT_EXT);
|
||||
Gfx::SE_PIPELINE_STAGE_TASK_SHADER_BIT_EXT | Gfx::SE_PIPELINE_STAGE_MESH_SHADER_BIT_EXT);*/
|
||||
}
|
||||
|
||||
void VisibilityPass::endFrame() {}
|
||||
|
||||
Reference in New Issue
Block a user