builds now with VCPKG and MSAA works
This commit is contained in:
@@ -71,6 +71,7 @@ void BasePass::render()
|
||||
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);
|
||||
colorBuffer->changeLayout(Gfx::SE_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
|
||||
|
||||
descriptorSets[INDEX_VIEW_PARAMS] = viewParamsSet;
|
||||
descriptorSets[INDEX_LIGHT_ENV] = scene->getLightEnvironment()->getDescriptorSet();
|
||||
@@ -131,7 +132,7 @@ void BasePass::render()
|
||||
pipelineInfo.pipelineLayout = std::move(layout);
|
||||
pipelineInfo.renderPass = renderPass;
|
||||
pipelineInfo.depthStencilState.depthCompareOp = Gfx::SE_COMPARE_OP_LESS_OR_EQUAL;
|
||||
pipelineInfo.rasterizationState.lineWidth = 10.f;
|
||||
pipelineInfo.multisampleState.samples = viewport->getSamples();
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
}
|
||||
@@ -143,6 +144,7 @@ void BasePass::render()
|
||||
pipelineInfo.pipelineLayout = std::move(layout);
|
||||
pipelineInfo.renderPass = renderPass;
|
||||
pipelineInfo.depthStencilState.depthCompareOp = Gfx::SE_COMPARE_OP_LESS_OR_EQUAL;
|
||||
pipelineInfo.multisampleState.samples = viewport->getSamples();
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
}
|
||||
@@ -185,22 +187,24 @@ void BasePass::endFrame()
|
||||
void BasePass::publishOutputs()
|
||||
{
|
||||
colorBuffer = graphics->createTexture2D(TextureCreateInfo{
|
||||
.format = viewport->getOwner()->getBackBuffer()->getFormat(),
|
||||
.width = viewport->getWidth(),
|
||||
.height = viewport->getHeight(),
|
||||
.samples = viewport->getSamples(),
|
||||
.usage = Gfx::SE_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT,
|
||||
.memoryProps = Gfx::SE_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | Gfx::SE_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT,
|
||||
.usage = Gfx::SE_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
||||
});
|
||||
colorAttachment = new Gfx::RenderTargetAttachment(colorBuffer, Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_DONT_CARE);
|
||||
resolveAttachment = new Gfx::SwapchainAttachment(viewport->getOwner(), Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
resources->registerRenderPassOutput("BASEPASS_COLOR", resolveAttachment);
|
||||
colorAttachment = new Gfx::RenderTargetAttachment(colorBuffer, Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
resources->registerRenderPassOutput("BASEPASS_COLOR", colorAttachment);
|
||||
}
|
||||
|
||||
void BasePass::createRenderPass()
|
||||
{
|
||||
Gfx::PRenderTargetAttachment depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_DEPTH");
|
||||
depthAttachment->loadOp = Gfx::SE_ATTACHMENT_LOAD_OP_LOAD;
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout(colorAttachment, depthAttachment, resolveAttachment);
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout{
|
||||
.colorAttachments = { colorAttachment },
|
||||
.depthAttachment = depthAttachment,
|
||||
};
|
||||
renderPass = graphics->createRenderPass(std::move(layout), viewport);
|
||||
oLightIndexList = resources->requestBuffer("LIGHTCULLING_OLIGHTLIST");
|
||||
tLightIndexList = resources->requestBuffer("LIGHTCULLING_TLIGHTLIST");
|
||||
|
||||
@@ -19,7 +19,6 @@ public:
|
||||
virtual void createRenderPass() override;
|
||||
static void modifyRenderPassMacros(Map<const char*, const char*>& defines);
|
||||
private:
|
||||
Gfx::ORenderTargetAttachment resolveAttachment;
|
||||
Gfx::ORenderTargetAttachment colorAttachment;
|
||||
Gfx::OTexture2D colorBuffer;
|
||||
Gfx::PTexture2D depthBuffer;
|
||||
|
||||
@@ -91,6 +91,7 @@ void DepthPrepass::render()
|
||||
pipelineInfo.pipelineLayout = std::move(layout);
|
||||
pipelineInfo.renderPass = renderPass;
|
||||
pipelineInfo.depthStencilState.depthCompareOp = Gfx::SE_COMPARE_OP_LESS_OR_EQUAL;
|
||||
pipelineInfo.multisampleState.samples = viewport->getSamples();
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
}
|
||||
@@ -102,6 +103,7 @@ void DepthPrepass::render()
|
||||
pipelineInfo.pipelineLayout = std::move(layout);
|
||||
pipelineInfo.renderPass = renderPass;
|
||||
pipelineInfo.depthStencilState.depthCompareOp = Gfx::SE_COMPARE_OP_LESS_OR_EQUAL;
|
||||
pipelineInfo.multisampleState.samples = viewport->getSamples();
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
}
|
||||
@@ -120,7 +122,7 @@ void DepthPrepass::render()
|
||||
{
|
||||
command->bindIndexBuffer(vertexData->getIndexBuffer());
|
||||
uint32 instanceOffset = 0;
|
||||
for (const auto& [instance, meshData] : instance.meshes)
|
||||
for (const auto& [_, meshData] : instance.meshes)
|
||||
{
|
||||
if (meshData.numIndices > 0)
|
||||
{
|
||||
@@ -148,25 +150,30 @@ void DepthPrepass::publishOutputs()
|
||||
.format = Gfx::SE_FORMAT_D32_SFLOAT,
|
||||
.width = viewport->getOwner()->getFramebufferWidth(),
|
||||
.height = viewport->getOwner()->getFramebufferHeight(),
|
||||
.samples = viewport->getSamples(),
|
||||
.usage = Gfx::SE_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
|
||||
};
|
||||
depthBuffer = graphics->createTexture2D(depthBufferInfo);
|
||||
depthAttachment =
|
||||
new Gfx::RenderTargetAttachment(depthBuffer, Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
depthAttachment->clear.depthStencil.depth = 1.0f;
|
||||
depthBufferInfo.samples = Gfx::SE_SAMPLE_COUNT_1_BIT;
|
||||
depthResolveBuffer = graphics->createTexture2D(depthBufferInfo);
|
||||
depthResolveAttachment =
|
||||
new Gfx::RenderTargetAttachment(depthResolveBuffer, Gfx::SE_ATTACHMENT_LOAD_OP_DONT_CARE, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
|
||||
resources->registerRenderPassOutput("DEPTHPREPASS_DEPTH", depthAttachment);
|
||||
resources->registerRenderPassOutput("DEPTHPREPASS_RESOLVED_DEPTH", depthResolveAttachment);
|
||||
}
|
||||
|
||||
void DepthPrepass::createRenderPass()
|
||||
{
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout(depthAttachment);
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout{
|
||||
.depthAttachment = depthAttachment,
|
||||
.depthResolveAttachment = depthResolveAttachment,
|
||||
};
|
||||
renderPass = graphics->createRenderPass(std::move(layout), viewport);
|
||||
}
|
||||
|
||||
void DepthPrepass::modifyRenderPassMacros(Map<const char*, const char*>& defines)
|
||||
{
|
||||
defines["INDEX_VIEW_PARAMS"] = "0";
|
||||
defines["INDEX_MATERIAL"] = "1";
|
||||
defines["INDEX_VERTEX_DATA"] = "2";
|
||||
defines["INDEX_SCENE_DATA"] = "3";
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ public:
|
||||
static void modifyRenderPassMacros(Map<const char*, const char*>& defines);
|
||||
private:
|
||||
Gfx::ORenderTargetAttachment depthAttachment;
|
||||
Gfx::ORenderTargetAttachment depthResolveAttachment;
|
||||
Gfx::OTexture2D depthBuffer;
|
||||
Gfx::OTexture2D depthResolveBuffer;
|
||||
|
||||
Array<Gfx::PDescriptorSet> descriptorSets;
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ void LightCullingPass::publishOutputs()
|
||||
|
||||
void LightCullingPass::createRenderPass()
|
||||
{
|
||||
depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_DEPTH")->getTexture();
|
||||
depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_RESOLVED_DEPTH")->getTexture();
|
||||
}
|
||||
|
||||
void LightCullingPass::modifyRenderPassMacros(Map<const char*, const char*>&)
|
||||
|
||||
@@ -25,13 +25,6 @@ void SkyboxRenderPass::beginFrame(const Component::Camera& cam)
|
||||
RenderPass::beginFrame(cam);
|
||||
DataSource uniformUpdate;
|
||||
|
||||
viewParams.viewMatrix = cam.getViewMatrix();
|
||||
viewParams.projectionMatrix = viewport->getProjectionMatrix();
|
||||
viewParams.cameraPosition = Vector4(cam.getCameraPosition(), 1);
|
||||
viewParams.screenDimensions = Vector2(static_cast<float>(viewport->getWidth()), static_cast<float>(viewport->getHeight()));
|
||||
uniformUpdate.size = sizeof(ViewParameter);
|
||||
uniformUpdate.data = (uint8*)&viewParams;
|
||||
viewParamsBuffer->updateContents(uniformUpdate);
|
||||
skyboxDataLayout->reset();
|
||||
textureLayout->reset();
|
||||
skyboxDataSet = skyboxDataLayout->allocateDescriptorSet();
|
||||
@@ -54,6 +47,8 @@ void SkyboxRenderPass::render()
|
||||
renderCommand->draw(36, 1, 0, 0);
|
||||
graphics->executeCommands(Array{ renderCommand });
|
||||
graphics->endRenderPass();
|
||||
baseColorAttachment->getTexture()->changeLayout(Gfx::SE_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||
graphics->resolveTexture(baseColorAttachment->getTexture(), viewport->getOwner()->getBackBuffer());
|
||||
}
|
||||
|
||||
void SkyboxRenderPass::endFrame()
|
||||
@@ -63,15 +58,6 @@ void SkyboxRenderPass::endFrame()
|
||||
|
||||
void SkyboxRenderPass::publishOutputs()
|
||||
{
|
||||
UniformBufferCreateInfo viewCreateInfo = {
|
||||
.sourceData = DataSource {
|
||||
.size = sizeof(ViewParameter),
|
||||
.data = nullptr,
|
||||
},
|
||||
.dynamic = true
|
||||
};
|
||||
viewParamsBuffer = graphics->createUniformBuffer(viewCreateInfo);
|
||||
|
||||
skyboxDataLayout = graphics->createDescriptorLayout("SkyboxDescLayout");
|
||||
skyboxDataLayout->addDescriptorBinding(0, Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
|
||||
skyboxDataLayout->create();
|
||||
@@ -86,11 +72,14 @@ void SkyboxRenderPass::publishOutputs()
|
||||
|
||||
void SkyboxRenderPass::createRenderPass()
|
||||
{
|
||||
Gfx::PRenderTargetAttachment baseColorAttachment = resources->requestRenderTarget("BASEPASS_COLOR");
|
||||
baseColorAttachment = resources->requestRenderTarget("BASEPASS_COLOR");
|
||||
baseColorAttachment->loadOp = Gfx::SE_ATTACHMENT_LOAD_OP_LOAD;
|
||||
Gfx::PRenderTargetAttachment depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_DEPTH");
|
||||
depthAttachment->loadOp = Gfx::SE_ATTACHMENT_LOAD_OP_LOAD;
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout(baseColorAttachment, depthAttachment);
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout{
|
||||
.colorAttachments = { baseColorAttachment },
|
||||
.depthAttachment = depthAttachment
|
||||
};
|
||||
renderPass = graphics->createRenderPass(std::move(layout), viewport);
|
||||
|
||||
ShaderCreateInfo createInfo;
|
||||
@@ -118,5 +107,6 @@ void SkyboxRenderPass::createRenderPass()
|
||||
gfxInfo.topology = Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
gfxInfo.pipelineLayout = std::move(pipelineLayout);
|
||||
gfxInfo.renderPass = renderPass;
|
||||
gfxInfo.multisampleState.samples = viewport->getSamples();
|
||||
pipeline = graphics->createGraphicsPipeline(std::move(gfxInfo));
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ public:
|
||||
virtual void publishOutputs() override;
|
||||
virtual void createRenderPass() override;
|
||||
private:
|
||||
Gfx::PRenderTargetAttachment baseColorAttachment;
|
||||
Gfx::OVertexBuffer cubeBuffer;
|
||||
Gfx::OUniformBuffer viewParamsBuffer;
|
||||
Gfx::ODescriptorLayout skyboxDataLayout;
|
||||
Gfx::PDescriptorSet skyboxDataSet;
|
||||
Gfx::ODescriptorLayout textureLayout;
|
||||
|
||||
@@ -158,7 +158,10 @@ void TextPass::createRenderPass()
|
||||
.size = sizeof(TextData)});
|
||||
pipelineLayout->create();
|
||||
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout(renderTarget, depthAttachment);
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout{
|
||||
.colorAttachments = {renderTarget},
|
||||
.depthAttachment = depthAttachment
|
||||
};
|
||||
renderPass = graphics->createRenderPass(std::move(layout), viewport);
|
||||
|
||||
Gfx::LegacyPipelineCreateInfo pipelineInfo;
|
||||
|
||||
@@ -136,7 +136,10 @@ void UIPass::createRenderPass()
|
||||
pipelineLayout->addDescriptorLayout(0, descriptorLayout);
|
||||
pipelineLayout->create();
|
||||
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout(std::move(renderTarget), std::move(depthAttachment));
|
||||
Gfx::ORenderTargetLayout layout = new Gfx::RenderTargetLayout{
|
||||
.colorAttachments = { renderTarget },
|
||||
.depthAttachment = depthAttachment
|
||||
};
|
||||
renderPass = graphics->createRenderPass(std::move(layout), viewport);
|
||||
|
||||
Gfx::LegacyPipelineCreateInfo pipelineInfo;
|
||||
|
||||
Reference in New Issue
Block a user