Changed descriptorset api
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "BasePass.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Asset/EnvironmentMapAsset.h"
|
||||
#include "Component/Camera.h"
|
||||
#include "Graphics/Command.h"
|
||||
#include "Graphics/Descriptor.h"
|
||||
@@ -14,6 +13,9 @@
|
||||
#include "Math/Vector.h"
|
||||
#include "MinimalEngine.h"
|
||||
#include "ShadowPass.h"
|
||||
#include "Scene/Scene.h"
|
||||
#include "Asset/EnvironmentMapAsset.h"
|
||||
#include "Scene/LightEnvironment.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
@@ -481,7 +483,6 @@ void BasePass::publishOutputs() {
|
||||
resources->registerRenderPassOutput("BASEPASS_COLOR", colorAttachment);
|
||||
resources->registerRenderPassOutput("BASEPASS_DEPTH", depthAttachment);
|
||||
|
||||
timestamps = graphics->createTimestampQuery(2, "BaseTS");
|
||||
query = graphics->createPipelineStatisticsQuery("BasePassPipelineStatistics");
|
||||
resources->registerQueryOutput("BASEPASS_QUERY", query);
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ class BasePass : public RenderPass {
|
||||
constexpr static const char* SHADOWSAMPLER_NAME = "shadowSampler";
|
||||
constexpr static const char* CASCADE_SPLIT_NAME = "cascadeSplit";
|
||||
|
||||
Gfx::PDescriptorSet opaqueCulling;
|
||||
Gfx::PDescriptorSet transparentCulling;
|
||||
Gfx::PDescriptorSet shadowMapping;
|
||||
Gfx::ODescriptorSet opaqueCulling;
|
||||
Gfx::ODescriptorSet transparentCulling;
|
||||
Gfx::ODescriptorSet shadowMapping;
|
||||
|
||||
// use a different texture here so we can do multisampling
|
||||
Gfx::OTexture2D msBasePassDepth;
|
||||
@@ -51,7 +51,7 @@ class BasePass : public RenderPass {
|
||||
// used for transparency sorting
|
||||
Vector cameraPos;
|
||||
Vector cameraForward;
|
||||
Gfx::PDescriptorSet viewParamsSet;
|
||||
Gfx::ODescriptorSet viewParamsSet;
|
||||
|
||||
PCameraActor source;
|
||||
Gfx::OPipelineLayout basePassLayout;
|
||||
@@ -82,9 +82,9 @@ class BasePass : public RenderPass {
|
||||
|
||||
// Skybox
|
||||
Gfx::ODescriptorLayout skyboxDataLayout;
|
||||
Gfx::PDescriptorSet skyboxDataSet;
|
||||
Gfx::ODescriptorSet skyboxDataSet;
|
||||
Gfx::ODescriptorLayout textureLayout;
|
||||
Gfx::PDescriptorSet textureSet;
|
||||
Gfx::ODescriptorSet textureSet;
|
||||
Gfx::OVertexShader vertexShader;
|
||||
Gfx::OFragmentShader fragmentShader;
|
||||
Gfx::OPipelineLayout pipelineLayout;
|
||||
|
||||
@@ -24,7 +24,7 @@ class CachedDepthPass : public RenderPass {
|
||||
Gfx::OPipelineStatisticsQuery query;
|
||||
Gfx::OTimestampQuery timestamps;
|
||||
|
||||
Gfx::PDescriptorSet viewParamsSet;
|
||||
Gfx::ODescriptorSet viewParamsSet;
|
||||
Gfx::PShaderBuffer cullingBuffer;
|
||||
PScene scene;
|
||||
};
|
||||
|
||||
@@ -72,7 +72,7 @@ void DepthCullingPass::beginFrame(const Component::Camera& cam, const Component:
|
||||
|
||||
void DepthCullingPass::render() {
|
||||
graphics->beginDebugRegion("DepthCullingPass");
|
||||
Gfx::PDescriptorSet set = depthAttachmentLayout->allocateDescriptorSet();
|
||||
Gfx::ODescriptorSet set = depthAttachmentLayout->allocateDescriptorSet();
|
||||
{
|
||||
graphics->beginDebugRegion("MipGeneration");
|
||||
query->beginQuery();
|
||||
|
||||
@@ -44,7 +44,7 @@ class DepthCullingPass : public RenderPass {
|
||||
Gfx::PComputePipeline depthSourceCopy;
|
||||
Gfx::OComputeShader depthReduceLevelShader;
|
||||
Gfx::PComputePipeline depthReduceLevel;
|
||||
Gfx::PDescriptorSet viewParamsSet;
|
||||
Gfx::ODescriptorSet viewParamsSet;
|
||||
|
||||
Gfx::PShaderBuffer cullingBuffer;
|
||||
PScene scene;
|
||||
|
||||
@@ -143,7 +143,7 @@ void LightCullingPass::publishOutputs() {
|
||||
|
||||
Gfx::ComputePipelineCreateInfo pipelineInfo;
|
||||
pipelineInfo.computeShader = cullingShader;
|
||||
pipelineInfo.pipelineLayout = std::move(cullingLayout);
|
||||
pipelineInfo.pipelineLayout = cullingLayout;
|
||||
cullingPipeline = graphics->createComputePipeline(std::move(pipelineInfo));
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void LightCullingPass::publishOutputs() {
|
||||
|
||||
Gfx::ComputePipelineCreateInfo pipelineInfo;
|
||||
pipelineInfo.computeShader = cullingShader;
|
||||
pipelineInfo.pipelineLayout = std::move(cullingEnableLayout);
|
||||
pipelineInfo.pipelineLayout = cullingEnableLayout;
|
||||
cullingEnabledPipeline = graphics->createComputePipeline(std::move(pipelineInfo));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ class LightCullingPass : public RenderPass {
|
||||
Gfx::OShaderBuffer frustumBuffer;
|
||||
const char* FRUSTUMBUFFER_NAME = "frustums";
|
||||
Gfx::ODescriptorLayout dispatchParamsLayout;
|
||||
Gfx::PDescriptorSet dispatchParamsSet;
|
||||
Gfx::ODescriptorSet dispatchParamsSet;
|
||||
Gfx::OComputeShader frustumShader;
|
||||
Gfx::PComputePipeline frustumPipeline;
|
||||
Gfx::OPipelineLayout frustumLayout;
|
||||
Gfx::PDescriptorSet viewParamsSet;
|
||||
Gfx::ODescriptorSet viewParamsSet;
|
||||
|
||||
PLightEnvironment lightEnv;
|
||||
Gfx::PTextureView depthAttachment;
|
||||
@@ -50,7 +50,7 @@ class LightCullingPass : public RenderPass {
|
||||
constexpr static const char* OLIGHTGRID_NAME = "oLightGrid";
|
||||
Gfx::OTexture2D tLightGrid;
|
||||
constexpr static const char* TLIGHTGRID_NAME = "tLightGrid";
|
||||
Gfx::PDescriptorSet cullingDescriptorSet;
|
||||
Gfx::ODescriptorSet cullingDescriptorSet;
|
||||
Gfx::ODescriptorLayout cullingDescriptorLayout;
|
||||
Gfx::OPipelineLayout cullingLayout;
|
||||
Gfx::OPipelineLayout cullingEnableLayout;
|
||||
|
||||
@@ -66,7 +66,8 @@ static uint32 pass = 0;
|
||||
static Component::Transform lastCam;
|
||||
void RayTracingPass::beginFrame(const Component::Camera& cam, const Component::Transform& transform) {
|
||||
updateViewParameters(cam, transform);
|
||||
viewParamsSet = createViewParamsSet(); if (lastCam.getPosition() != transform.getPosition() || lastCam.getForward() != transform.getForward()) {
|
||||
viewParamsSet = createViewParamsSet();
|
||||
if (lastCam.getPosition() != transform.getPosition() || lastCam.getForward() != transform.getForward()) {
|
||||
lastCam = transform;
|
||||
pass = 0;
|
||||
}
|
||||
@@ -149,7 +150,7 @@ void RayTracingPass::render() {
|
||||
.instances = instanceData,
|
||||
.bottomLevelStructures = accelerationStructures,
|
||||
});
|
||||
Gfx::PDescriptorSet desc = paramsLayout->allocateDescriptorSet();
|
||||
Gfx::ODescriptorSet desc = paramsLayout->allocateDescriptorSet();
|
||||
desc->updateAccelerationStructure(TLAS_NAME, 0, tlas);
|
||||
desc->updateTexture(ACCUMULATOR_NAME, 0, radianceAccumulator->getDefaultView());
|
||||
desc->updateTexture(TEXTURE_NAME, 0, texture->getDefaultView());
|
||||
|
||||
@@ -32,7 +32,7 @@ class RayTracingPass : public RenderPass {
|
||||
Gfx::OAnyHitShader anyhit;
|
||||
Gfx::OMissShader miss;
|
||||
Gfx::PRayTracingPipeline pipeline;
|
||||
Gfx::PDescriptorSet viewParamsSet;
|
||||
Gfx::ODescriptorSet viewParamsSet;
|
||||
PScene scene;
|
||||
};
|
||||
} // namespace Seele
|
||||
@@ -38,7 +38,7 @@ class RenderGraph {
|
||||
return res;
|
||||
}
|
||||
private:
|
||||
PRenderGraphResources res;
|
||||
ORenderGraphResources res;
|
||||
List<ORenderPass> passes;
|
||||
};
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ void RenderPass::updateViewParameters(const Component::Camera& cam, const Compon
|
||||
};
|
||||
}
|
||||
|
||||
Gfx::PDescriptorSet RenderPass::createViewParamsSet()
|
||||
Gfx::ODescriptorSet RenderPass::createViewParamsSet()
|
||||
{
|
||||
// screen space
|
||||
//StaticArray<Vector4, 4> corners = {
|
||||
@@ -71,8 +71,7 @@ Gfx::PDescriptorSet RenderPass::createViewParamsSet()
|
||||
|
||||
// extract_planes_from_view_projection_matrix(viewParams.viewProjectionMatrix, viewParams.viewFrustum);
|
||||
|
||||
viewParamsLayout->reset();
|
||||
Gfx::PDescriptorSet viewParamsSet = viewParamsLayout->allocateDescriptorSet();
|
||||
Gfx::ODescriptorSet viewParamsSet = viewParamsLayout->allocateDescriptorSet();
|
||||
viewParamsSet->updateConstants("viewMatrix", 0, &viewParams.viewMatrix);
|
||||
viewParamsSet->updateConstants("inverseViewMatrix", 0, &viewParams.inverseViewMatrix);
|
||||
viewParamsSet->updateConstants("projectionMatrix", 0, &viewParams.projectionMatrix);
|
||||
|
||||
@@ -28,7 +28,7 @@ class RenderPass {
|
||||
|
||||
protected:
|
||||
void updateViewParameters(const Component::Camera& cam, const Component::Transform& transform);
|
||||
Gfx::PDescriptorSet createViewParamsSet();
|
||||
Gfx::ODescriptorSet createViewParamsSet();
|
||||
struct Plane {
|
||||
Vector n;
|
||||
float d;
|
||||
|
||||
@@ -62,6 +62,7 @@ void ShadowPass::beginFrame(const Component::Camera& camera, const Component::Tr
|
||||
float uniform = minZ + range * p;
|
||||
float d = cascadeSplitLambda * (log - uniform) + uniform;
|
||||
cascadeSplits[i] = (d - nearClip) / clipRange;
|
||||
cascades[i].viewParams.clear();
|
||||
}
|
||||
|
||||
// call this to update view params member, ignore descriptor set
|
||||
@@ -210,7 +211,7 @@ void ShadowPass::render() {
|
||||
command->bindPipeline(pipeline);
|
||||
}
|
||||
command->bindDescriptor(
|
||||
{cascades[c].viewParams[c], vertexData->getVertexDataSet(), vertexData->getInstanceDataSet()});
|
||||
{cascades[c].viewParams[shadowIndex], vertexData->getVertexDataSet(), vertexData->getInstanceDataSet()});
|
||||
VertexData::DrawCallOffsets offsets = {
|
||||
.instanceOffset = 0,
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ class ShadowPass : public RenderPass {
|
||||
Array<Gfx::OTextureView> views;
|
||||
Array<Matrix4> lightSpaceMatrices;
|
||||
Gfx::OShaderBuffer lightSpaceBuffer;
|
||||
Array<Gfx::PDescriptorSet> viewParams;
|
||||
Array<Gfx::ODescriptorSet> viewParams;
|
||||
};
|
||||
StaticArray<Cascade, NUM_CASCADES> cascades;
|
||||
Gfx::OUniformBuffer cascadeSplitsBuffer;
|
||||
|
||||
@@ -148,7 +148,7 @@ void ToneMappingPass::render() {
|
||||
{
|
||||
Gfx::OComputeCommand computeCommand = graphics->createComputeCommand("HistogramCommand");
|
||||
computeCommand->bindPipeline(histogramPipeline);
|
||||
computeCommand->bindDescriptor({histogramSet});
|
||||
computeCommand->bindDescriptor(histogramSet);
|
||||
computeCommand->dispatch(threadGroups.x, threadGroups.y, 1);
|
||||
graphics->executeCommands(std::move(computeCommand));
|
||||
}
|
||||
@@ -158,7 +158,7 @@ void ToneMappingPass::render() {
|
||||
{
|
||||
Gfx::OComputeCommand computeCommand = graphics->createComputeCommand("ExposureCommand");
|
||||
computeCommand->bindPipeline(exposurePipeline);
|
||||
computeCommand->bindDescriptor({histogramSet});
|
||||
computeCommand->bindDescriptor(histogramSet);
|
||||
computeCommand->dispatch(1, 1, 1);
|
||||
graphics->executeCommands(std::move(computeCommand));
|
||||
}
|
||||
@@ -168,7 +168,7 @@ void ToneMappingPass::render() {
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT | Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||
|
||||
tonemappingLayout->reset();
|
||||
Gfx::PDescriptorSet tonemappingSet = tonemappingLayout->allocateDescriptorSet();
|
||||
Gfx::ODescriptorSet tonemappingSet = tonemappingLayout->allocateDescriptorSet();
|
||||
tonemappingSet->updateConstants("offset", 0, &offset);
|
||||
tonemappingSet->updateConstants("slope", 0, &slope);
|
||||
tonemappingSet->updateConstants("power", 0, &power);
|
||||
@@ -181,7 +181,7 @@ void ToneMappingPass::render() {
|
||||
Gfx::ORenderCommand command = graphics->createRenderCommand("ToneMapping");
|
||||
command->setViewport(viewport);
|
||||
command->bindPipeline(pipeline);
|
||||
command->bindDescriptor({tonemappingSet});
|
||||
command->bindDescriptor(tonemappingSet);
|
||||
command->draw(3, 1, 0, 0);
|
||||
graphics->executeCommands(std::move(command));
|
||||
graphics->endRenderPass();
|
||||
|
||||
@@ -28,7 +28,7 @@ class ToneMappingPass : public RenderPass {
|
||||
uint32 numPixels;
|
||||
UVector2 threadGroups;
|
||||
Gfx::ODescriptorLayout histogramLayout;
|
||||
Gfx::PDescriptorSet histogramSet;
|
||||
Gfx::ODescriptorSet histogramSet;
|
||||
Gfx::OPipelineLayout histogramPipelineLayout;
|
||||
Gfx::OComputeShader histogramShader;
|
||||
Gfx::PComputePipeline histogramPipeline;
|
||||
@@ -48,6 +48,6 @@ class ToneMappingPass : public RenderPass {
|
||||
Gfx::OFragmentShader frag;
|
||||
Gfx::PGraphicsPipeline pipeline;
|
||||
|
||||
Gfx::PDescriptorSet viewParamsSet;
|
||||
Gfx::ODescriptorSet viewParamsSet;
|
||||
};
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class UIPass : public RenderPass {
|
||||
Gfx::OTexture2D depthBuffer;
|
||||
|
||||
Gfx::ODescriptorLayout textDescriptorLayout;
|
||||
Gfx::PDescriptorSet textDescriptorSet;
|
||||
Gfx::ODescriptorSet textDescriptorSet;
|
||||
|
||||
Gfx::OVertexShader textVertexShader;
|
||||
Gfx::OFragmentShader textFragmentShader;
|
||||
@@ -60,9 +60,9 @@ class UIPass : public RenderPass {
|
||||
Gfx::PGraphicsPipeline textPipeline;
|
||||
|
||||
Gfx::ODescriptorLayout uiDescriptorLayout;
|
||||
Gfx::PDescriptorSet uiDescriptorSet;
|
||||
Gfx::ODescriptorSet uiDescriptorSet;
|
||||
|
||||
Gfx::PDescriptorSet viewParamsSet;
|
||||
Gfx::ODescriptorSet viewParamsSet;
|
||||
|
||||
Gfx::OVertexShader uiVertexShader;
|
||||
Gfx::OFragmentShader uiFragmentShader;
|
||||
|
||||
@@ -19,14 +19,14 @@ class VisibilityPass : public RenderPass {
|
||||
private:
|
||||
static constexpr uint32 BLOCK_SIZE = 32;
|
||||
Gfx::RenderTargetAttachment visibilityAttachment;
|
||||
Gfx::PDescriptorSet visibilitySet;
|
||||
Gfx::ODescriptorSet visibilitySet;
|
||||
Gfx::ODescriptorLayout visibilityDescriptor;
|
||||
Gfx::OPipelineLayout visibilityLayout;
|
||||
Gfx::OComputeShader visibilityShader;
|
||||
Gfx::PComputePipeline visibilityPipeline;
|
||||
Gfx::OPipelineStatisticsQuery query;
|
||||
Gfx::PTimestampQuery timestamps;
|
||||
Gfx::PDescriptorSet viewParamsSet;
|
||||
Gfx::ODescriptorSet viewParamsSet;
|
||||
|
||||
constexpr static const char* VISIBILITY_NAME = "visibilityTexture";
|
||||
// Holds culling information for every meshlet for each instance
|
||||
|
||||
@@ -18,7 +18,7 @@ class WaterRenderer {
|
||||
Gfx::PGraphics graphics;
|
||||
PScene scene;
|
||||
Gfx::ODescriptorLayout computeLayout;
|
||||
Gfx::PDescriptorSet computeSet;
|
||||
Gfx::ODescriptorSet computeSet;
|
||||
Gfx::OPipelineLayout pipelineLayout;
|
||||
|
||||
Gfx::OComputeShader initSpectrumCS;
|
||||
@@ -145,7 +145,7 @@ class WaterRenderer {
|
||||
Gfx::OMeshShader waterMesh;
|
||||
Gfx::OFragmentShader waterFragment;
|
||||
Gfx::ODescriptorLayout materialLayout;
|
||||
Gfx::PDescriptorSet materialSet;
|
||||
Gfx::ODescriptorSet materialSet;
|
||||
Gfx::OPipelineLayout waterLayout;
|
||||
Gfx::PGraphicsPipeline waterPipeline;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user