mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Pipeline custom zoom fbo size (#3964)
* ForwardPipeline custom zoom fbo size * DeferredPipeline custom zoom fbo size
This commit is contained in:
@@ -229,10 +229,21 @@ void RenderPipeline::ensureEnoughSize(const vector<scene::Camera *> &cameras) {
|
||||
}
|
||||
}
|
||||
|
||||
gfx::Viewport RenderPipeline::getViewport(scene::Camera *camera) {
|
||||
auto scale{_pipelineSceneData->getSharedData()->shadingScale};
|
||||
const gfx::Rect &rect = getRenderArea(camera);
|
||||
return {
|
||||
static_cast<int>(rect.x * scale),
|
||||
static_cast<int>(rect.y * scale),
|
||||
static_cast<uint>(rect.width * scale),
|
||||
static_cast<uint>(rect.height * scale)
|
||||
};
|
||||
}
|
||||
|
||||
gfx::Rect RenderPipeline::getRenderArea(scene::Camera *camera) {
|
||||
auto scale{_pipelineSceneData->getSharedData()->shadingScale};
|
||||
auto w{static_cast<float>(camera->window->getWidth()) * scale};
|
||||
auto h{static_cast<float>(camera->window->getHeight()) * scale};
|
||||
float shadingScale{_pipelineSceneData->getSharedData()->shadingScale};
|
||||
float w{static_cast<float>(camera->window->getWidth()) * shadingScale};
|
||||
float h{static_cast<float>(camera->window->getHeight()) * shadingScale};
|
||||
|
||||
return {
|
||||
static_cast<int>(camera->viewPort.x * w),
|
||||
|
||||
@@ -88,6 +88,7 @@ public:
|
||||
RenderStage * getRenderstageByName(const String &name) const;
|
||||
|
||||
gfx::Rect getRenderArea(scene::Camera *camera);
|
||||
gfx::Viewport getViewport(scene::Camera *camera);
|
||||
void genQuadVertexData(const Vec4 &viewport, float *data);
|
||||
uint getWidth() const { return _width; }
|
||||
uint getHeight() const { return _height; }
|
||||
|
||||
@@ -164,7 +164,7 @@ void BloomStage::render(scene::Camera *camera) {
|
||||
auto renderArea = pipeline->getRenderArea(camera);
|
||||
renderArea.width >>= 1;
|
||||
renderArea.height >>= 1;
|
||||
|
||||
float shadingScale{_pipeline->getPipelineSceneData()->getSharedData()->shadingScale};
|
||||
auto prefilterSetup = [&](framegraph::PassNodeBuilder &builder, PrefilterRenderData &data) {
|
||||
data.sampler = _sampler;
|
||||
// read lightingout as input
|
||||
@@ -174,8 +174,8 @@ void BloomStage::render(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = gfx::Format::RGBA16F;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = pipeline->getWidth();
|
||||
colorTexInfo.height = pipeline->getHeight();
|
||||
colorTexInfo.width = static_cast<uint>(pipeline->getWidth() * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(pipeline->getHeight() * shadingScale);
|
||||
|
||||
data.inputTexHandle = builder.create<framegraph::Texture>(
|
||||
RenderPipeline::fgStrHandleOutColorTexture, colorTexInfo);
|
||||
@@ -190,16 +190,15 @@ void BloomStage::render(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = gfx::Format::RGBA16F;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = renderArea.width;
|
||||
colorTexInfo.height = renderArea.height;
|
||||
colorTexInfo.width = static_cast<uint>(renderArea.width * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(renderArea.height * shadingScale);
|
||||
|
||||
data.outputTexHandle = builder.create<framegraph::Texture>(prefilterTexHandle, colorTexInfo);
|
||||
}
|
||||
data.outputTexHandle = builder.write(data.outputTexHandle, colorAttachmentInfo);
|
||||
builder.writeToBlackboard(prefilterTexHandle, data.outputTexHandle);
|
||||
|
||||
gfx::Viewport viewport{renderArea.x, renderArea.y, renderArea.width, renderArea.height, 0.F, 1.F};
|
||||
builder.setViewport(viewport, renderArea);
|
||||
builder.setViewport(pipeline->getViewport(camera), renderArea);
|
||||
};
|
||||
|
||||
auto prefilterExec = [this, camera](PrefilterRenderData const &data, const framegraph::DevicePassResourceTable &table) {
|
||||
@@ -266,23 +265,22 @@ void BloomStage::render(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = gfx::Format::RGBA16F;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = renderArea.width;
|
||||
colorTexInfo.height = renderArea.height;
|
||||
colorTexInfo.width = static_cast<uint>(renderArea.width * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(renderArea.height * shadingScale);
|
||||
|
||||
data.outputTexHandle = builder.create<framegraph::Texture>(downsampleTexHandles[data.index], colorTexInfo);
|
||||
}
|
||||
data.outputTexHandle = builder.write(data.outputTexHandle, colorAttachmentInfo);
|
||||
builder.writeToBlackboard(downsampleTexHandles[data.index], data.outputTexHandle);
|
||||
|
||||
gfx::Viewport viewport{renderArea.x, renderArea.y, renderArea.width, renderArea.height, 0.F, 1.F};
|
||||
builder.setViewport(viewport, renderArea);
|
||||
builder.setViewport(pipeline->getViewport(camera), renderArea);
|
||||
|
||||
// Update cc_textureSize
|
||||
auto *stage = static_cast<BloomStage *>(pipeline->getRenderstageByName(STAGE_NAME));
|
||||
CC_ASSERT(stage != nullptr);
|
||||
data.bloomUBO = stage->getDownsampelUBO()[data.index];
|
||||
data.textureSize[0] = static_cast<float>(renderArea.width << 1);
|
||||
data.textureSize[1] = static_cast<float>(renderArea.height << 1);
|
||||
data.textureSize[0] = static_cast<float>(static_cast<uint>(renderArea.width * shadingScale) << 1);
|
||||
data.textureSize[1] = static_cast<float>(static_cast<uint>(renderArea.height * shadingScale) << 1);
|
||||
};
|
||||
|
||||
auto downsampleExec = [this, camera](ScalingSampleRenderData const &data, const framegraph::DevicePassResourceTable &table) {
|
||||
@@ -344,8 +342,8 @@ void BloomStage::render(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = gfx::Format::RGBA16F;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = renderArea.width;
|
||||
colorTexInfo.height = renderArea.height;
|
||||
colorTexInfo.width = static_cast<uint>(renderArea.width * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(renderArea.height * shadingScale);
|
||||
|
||||
data.outputTexHandle = builder.create<framegraph::Texture>(
|
||||
upsampleTexHandles[data.index], colorTexInfo);
|
||||
@@ -353,15 +351,14 @@ void BloomStage::render(scene::Camera *camera) {
|
||||
data.outputTexHandle = builder.write(data.outputTexHandle, colorAttachmentInfo);
|
||||
builder.writeToBlackboard(upsampleTexHandles[data.index], data.outputTexHandle);
|
||||
|
||||
gfx::Viewport viewport{renderArea.x, renderArea.y, renderArea.width, renderArea.height, 0.F, 1.F};
|
||||
builder.setViewport(viewport, renderArea);
|
||||
builder.setViewport(pipeline->getViewport(camera), renderArea);
|
||||
|
||||
// Update cc_textureSize
|
||||
auto *stage = static_cast<BloomStage *>(pipeline->getRenderstageByName(STAGE_NAME));
|
||||
CC_ASSERT(stage != nullptr);
|
||||
data.bloomUBO = stage->getUpsampleUBO()[data.index];
|
||||
data.textureSize[0] = static_cast<float>(renderArea.width >> 1);
|
||||
data.textureSize[1] = static_cast<float>(renderArea.height >> 1);
|
||||
data.textureSize[0] = static_cast<float>(static_cast<uint>(renderArea.width * shadingScale) >> 1);
|
||||
data.textureSize[1] = static_cast<float>(static_cast<uint>(renderArea.height * shadingScale) >> 1);
|
||||
};
|
||||
|
||||
auto upsampleExec = [this, camera](ScalingSampleRenderData const &data, const framegraph::DevicePassResourceTable &table) {
|
||||
@@ -427,8 +424,8 @@ void BloomStage::render(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = gfx::Format::RGBA16F;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = renderArea.width;
|
||||
colorTexInfo.height = renderArea.height;
|
||||
colorTexInfo.width = static_cast<uint>(renderArea.width * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(renderArea.height * shadingScale);
|
||||
|
||||
data.bloomOutTexHandle = builder.create<framegraph::Texture>(
|
||||
RenderPipeline::fgStrHandleBloomOutTexture, colorTexInfo);
|
||||
@@ -436,8 +433,7 @@ void BloomStage::render(scene::Camera *camera) {
|
||||
data.bloomOutTexHandle = builder.write(data.bloomOutTexHandle, colorAttachmentInfo);
|
||||
builder.writeToBlackboard(RenderPipeline::fgStrHandleBloomOutTexture, data.bloomOutTexHandle);
|
||||
|
||||
gfx::Viewport viewport{renderArea.x, renderArea.y, renderArea.width, renderArea.height, 0.F, 1.F};
|
||||
builder.setViewport(viewport, renderArea);
|
||||
builder.setViewport(pipeline->getViewport(camera), renderArea);
|
||||
};
|
||||
|
||||
auto combineExec = [this, camera](CombineRenderData const &data, const framegraph::DevicePassResourceTable &table) {
|
||||
|
||||
@@ -111,6 +111,7 @@ void PostProcessStage::render(scene::Camera *camera) {
|
||||
_clearColors[0].w = camera->clearColor.w;
|
||||
|
||||
auto *pipeline = _pipeline;
|
||||
float shadingScale{_pipeline->getPipelineSceneData()->getSharedData()->shadingScale};
|
||||
auto postSetup = [&](framegraph::PassNodeBuilder &builder, RenderData &data) {
|
||||
if (pipeline->getBloomEnable()) {
|
||||
data.outColorTex = framegraph::TextureHandle(builder.readFromBlackboard(RenderPipeline::fgStrHandleBloomOutTexture));
|
||||
@@ -122,8 +123,8 @@ void PostProcessStage::render(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = gfx::Format::RGBA16F;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = pipeline->getWidth();
|
||||
colorTexInfo.height = pipeline->getHeight();
|
||||
colorTexInfo.width = static_cast<uint>(pipeline->getWidth() * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(pipeline->getHeight() * shadingScale);
|
||||
|
||||
data.outColorTex = builder.create<framegraph::Texture>(RenderPipeline::fgStrHandleOutColorTexture, colorTexInfo);
|
||||
}
|
||||
@@ -152,8 +153,8 @@ void PostProcessStage::render(scene::Camera *camera) {
|
||||
gfx::TextureType::TEX2D,
|
||||
gfx::TextureUsageBit::COLOR_ATTACHMENT,
|
||||
gfx::Format::RGBA8,
|
||||
camera->window->getWidth(),
|
||||
camera->window->getHeight(),
|
||||
static_cast<uint>(camera->window->getWidth() * shadingScale),
|
||||
static_cast<uint>(camera->window->getHeight() * shadingScale),
|
||||
};
|
||||
data.backBuffer = builder.create<framegraph::Texture>(fgStrHandlePostProcessOutTexture, textureInfo);
|
||||
data.backBuffer = builder.write(data.backBuffer, colorAttachmentInfo);
|
||||
@@ -216,7 +217,7 @@ void PostProcessStage::render(scene::Camera *camera) {
|
||||
|
||||
// add pass
|
||||
pipeline->getFrameGraph().addPass<RenderData>(static_cast<uint>(CommonInsertPoint::DIP_POSTPROCESS), RenderPipeline::fgStrHandlePostprocessPass, postSetup, postExec);
|
||||
pipeline->getFrameGraph().presentFromBlackboard(fgStrHandlePostProcessOutTexture, camera->window->frameBuffer->getColorTextures()[0]);
|
||||
pipeline->getFrameGraph().presentFromBlackboard(fgStrHandlePostProcessOutTexture, camera->window->frameBuffer->getColorTextures()[0], shadingScale == 1.F);
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
|
||||
@@ -146,8 +146,9 @@ void GbufferStage::render(scene::Camera *camera) {
|
||||
framegraph::TextureHandle depth;
|
||||
};
|
||||
|
||||
auto *pipeline = static_cast<DeferredPipeline *>(_pipeline);
|
||||
_renderArea = pipeline->getRenderArea(camera);
|
||||
auto *pipeline = static_cast<DeferredPipeline *>(_pipeline);
|
||||
float shadingScale{_pipeline->getPipelineSceneData()->getSharedData()->shadingScale};
|
||||
_renderArea = pipeline->getRenderArea(camera);
|
||||
|
||||
// render area is not oriented, copy buffer must be called outsize of RenderPass, it should not be called in execute lambda expression
|
||||
// If there are only transparent object, lighting pass is ignored, we should call getIAByRenderArea here
|
||||
@@ -161,15 +162,15 @@ void GbufferStage::render(scene::Camera *camera) {
|
||||
gfx::TextureType::TEX2D,
|
||||
gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::INPUT_ATTACHMENT,
|
||||
gfx::Format::RGBA8,
|
||||
pipeline->getWidth(),
|
||||
pipeline->getHeight(),
|
||||
static_cast<uint>(pipeline->getWidth() * shadingScale),
|
||||
static_cast<uint>(pipeline->getHeight() * shadingScale),
|
||||
};
|
||||
gfx::TextureInfo gbufferInfoFloat = {
|
||||
gfx::TextureType::TEX2D,
|
||||
gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::INPUT_ATTACHMENT,
|
||||
gfx::Format::RGBA16F,
|
||||
pipeline->getWidth(),
|
||||
pipeline->getHeight(),
|
||||
static_cast<uint>(pipeline->getWidth() * shadingScale),
|
||||
static_cast<uint>(pipeline->getHeight() * shadingScale),
|
||||
};
|
||||
for (int i = 0; i < DeferredPipeline::GBUFFER_COUNT - 1; ++i) {
|
||||
if (i != 0) { // positions & normals need more precision
|
||||
@@ -205,8 +206,8 @@ void GbufferStage::render(scene::Camera *camera) {
|
||||
gfx::TextureType::TEX2D,
|
||||
gfx::TextureUsageBit::DEPTH_STENCIL_ATTACHMENT,
|
||||
gfx::Format::DEPTH_STENCIL,
|
||||
pipeline->getWidth(),
|
||||
pipeline->getHeight(),
|
||||
static_cast<uint>(pipeline->getWidth() * shadingScale),
|
||||
static_cast<uint>(pipeline->getHeight() * shadingScale),
|
||||
};
|
||||
data.depth = builder.create<framegraph::Texture>(DeferredPipeline::fgStrHandleOutDepthTexture, depthTexInfo);
|
||||
|
||||
@@ -220,7 +221,7 @@ void GbufferStage::render(scene::Camera *camera) {
|
||||
builder.writeToBlackboard(DeferredPipeline::fgStrHandleOutDepthTexture, data.depth);
|
||||
|
||||
// viewport setup
|
||||
builder.setViewport(_renderArea);
|
||||
builder.setViewport(pipeline->getViewport(camera), _renderArea);
|
||||
};
|
||||
|
||||
auto gbufferExec = [this](const RenderData & /*data*/, const framegraph::DevicePassResourceTable &table) {
|
||||
|
||||
@@ -339,7 +339,7 @@ void LightingStage::fgLightingPass(scene::Camera *camera) {
|
||||
|
||||
auto * pipeline = static_cast<DeferredPipeline *>(_pipeline);
|
||||
gfx::Color clearColor = pipeline->getClearcolor(camera);
|
||||
|
||||
float shadingScale{_pipeline->getPipelineSceneData()->getSharedData()->shadingScale};
|
||||
auto lightingSetup = [&](framegraph::PassNodeBuilder &builder, RenderData &data) {
|
||||
builder.subpass(true);
|
||||
|
||||
@@ -374,8 +374,8 @@ void LightingStage::fgLightingPass(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = gfx::Format::RGBA16F;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = pipeline->getWidth();
|
||||
colorTexInfo.height = pipeline->getHeight();
|
||||
colorTexInfo.width = static_cast<uint>(pipeline->getWidth() * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(pipeline->getHeight() * shadingScale);
|
||||
data.outputTex = builder.create<framegraph::Texture>(RenderPipeline::fgStrHandleOutColorTexture, colorTexInfo);
|
||||
|
||||
framegraph::RenderTargetAttachment::Descriptor colorAttachmentInfo;
|
||||
@@ -386,9 +386,8 @@ void LightingStage::fgLightingPass(scene::Camera *camera) {
|
||||
colorAttachmentInfo.endAccesses = {gfx::AccessType::FRAGMENT_SHADER_READ_TEXTURE};
|
||||
data.outputTex = builder.write(data.outputTex, colorAttachmentInfo);
|
||||
builder.writeToBlackboard(RenderPipeline::fgStrHandleOutColorTexture, data.outputTex);
|
||||
|
||||
// set render area
|
||||
builder.setViewport(pipeline->getRenderArea(camera));
|
||||
builder.setViewport(pipeline->getViewport(camera), pipeline->getRenderArea(camera));
|
||||
};
|
||||
|
||||
auto lightingExec = [this, camera](RenderData const &data, const framegraph::DevicePassResourceTable &table) {
|
||||
@@ -444,7 +443,7 @@ void LightingStage::fgTransparent(scene::Camera *camera) {
|
||||
|
||||
auto * pipeline = static_cast<DeferredPipeline *>(_pipeline);
|
||||
gfx::Color clearColor = pipeline->getClearcolor(camera);
|
||||
|
||||
float shadingScale{_pipeline->getPipelineSceneData()->getSharedData()->shadingScale};
|
||||
auto transparentSetup = [&](framegraph::PassNodeBuilder &builder, RenderData &data) {
|
||||
// write to lighting output
|
||||
framegraph::RenderTargetAttachment::Descriptor colorAttachmentInfo;
|
||||
@@ -459,8 +458,8 @@ void LightingStage::fgTransparent(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = gfx::Format::RGBA16F;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = pipeline->getWidth();
|
||||
colorTexInfo.height = pipeline->getHeight();
|
||||
colorTexInfo.width = static_cast<uint>(pipeline->getWidth() * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(pipeline->getHeight() * shadingScale);
|
||||
|
||||
colorAttachmentInfo.loadOp = gfx::LoadOp::CLEAR;
|
||||
colorAttachmentInfo.clearColor = clearColor;
|
||||
@@ -483,8 +482,8 @@ void LightingStage::fgTransparent(scene::Camera *camera) {
|
||||
gfx::TextureType::TEX2D,
|
||||
gfx::TextureUsageBit::DEPTH_STENCIL_ATTACHMENT,
|
||||
gfx::Format::DEPTH_STENCIL,
|
||||
pipeline->getWidth(),
|
||||
pipeline->getHeight(),
|
||||
static_cast<uint>(pipeline->getWidth() * shadingScale),
|
||||
static_cast<uint>(pipeline->getHeight() * shadingScale),
|
||||
};
|
||||
data.depth = builder.create<framegraph::Texture>(DeferredPipeline::fgStrHandleOutDepthTexture, depthTexInfo);
|
||||
}
|
||||
@@ -492,7 +491,7 @@ void LightingStage::fgTransparent(scene::Camera *camera) {
|
||||
builder.writeToBlackboard(DeferredPipeline::fgStrHandleOutDepthTexture, data.depth);
|
||||
|
||||
// set render area
|
||||
builder.setViewport(pipeline->getRenderArea(camera));
|
||||
builder.setViewport(pipeline->getViewport(camera), pipeline->getRenderArea(camera));
|
||||
};
|
||||
|
||||
auto transparentExec = [this](RenderData const & /*data*/, const framegraph::DevicePassResourceTable &table) {
|
||||
@@ -775,7 +774,7 @@ void LightingStage::fgSsprPass(scene::Camera *camera) {
|
||||
data.depth = builder.write(framegraph::TextureHandle(builder.readFromBlackboard(DeferredPipeline::fgStrHandleOutDepthTexture)), depthAttachmentInfo);
|
||||
builder.writeToBlackboard(DeferredPipeline::fgStrHandleOutDepthTexture, data.depth);
|
||||
|
||||
builder.setViewport(pipeline->getRenderArea(camera));
|
||||
builder.setViewport(pipeline->getViewport(camera), pipeline->getRenderArea(camera));
|
||||
};
|
||||
|
||||
auto renderExec = [this](DataRender const &data, const framegraph::DevicePassResourceTable &table) {
|
||||
|
||||
@@ -140,6 +140,7 @@ void ForwardStage::render(scene::Camera *camera) {
|
||||
auto *const sceneData = _pipeline->getPipelineSceneData();
|
||||
auto *const sharedData = sceneData->getSharedData();
|
||||
|
||||
float shadingScale{_pipeline->getPipelineSceneData()->getSharedData()->shadingScale};
|
||||
_renderArea = pipeline->getRenderArea(camera);
|
||||
// Command 'updateBuffer' must be recorded outside render passes, cannot put them in execute lambda
|
||||
dispenseRenderObject2Queues();
|
||||
@@ -150,7 +151,6 @@ void ForwardStage::render(scene::Camera *camera) {
|
||||
_batchedQueue->uploadBuffers(cmdBuff);
|
||||
_additiveLightQueue->gatherLightPasses(camera, cmdBuff);
|
||||
_planarShadowQueue->gatherShadowPasses(camera, cmdBuff);
|
||||
|
||||
auto forwardSetup = [&](framegraph::PassNodeBuilder &builder, RenderData &data) {
|
||||
if (hasFlag(static_cast<gfx::ClearFlags>(camera->clearFlag), gfx::ClearFlagBit::COLOR)) {
|
||||
if (sharedData->isHDR) {
|
||||
@@ -166,8 +166,8 @@ void ForwardStage::render(scene::Camera *camera) {
|
||||
framegraph::Texture::Descriptor colorTexInfo;
|
||||
colorTexInfo.format = sharedData->isHDR ? gfx::Format::RGBA16F : gfx::Format::RGBA8;
|
||||
colorTexInfo.usage = gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED;
|
||||
colorTexInfo.width = pipeline->getWidth();
|
||||
colorTexInfo.height = pipeline->getHeight();
|
||||
colorTexInfo.width = static_cast<uint>(pipeline->getWidth() * shadingScale);
|
||||
colorTexInfo.height = static_cast<uint>(pipeline->getHeight() * shadingScale);
|
||||
data.outputTex = builder.create<framegraph::Texture>(RenderPipeline::fgStrHandleOutColorTexture, colorTexInfo);
|
||||
framegraph::RenderTargetAttachment::Descriptor colorAttachmentInfo;
|
||||
colorAttachmentInfo.usage = framegraph::RenderTargetAttachment::Usage::COLOR;
|
||||
@@ -191,8 +191,8 @@ void ForwardStage::render(scene::Camera *camera) {
|
||||
gfx::TextureType::TEX2D,
|
||||
gfx::TextureUsageBit::DEPTH_STENCIL_ATTACHMENT,
|
||||
gfx::Format::DEPTH_STENCIL,
|
||||
camera->window->getWidth(),
|
||||
camera->window->getHeight(),
|
||||
static_cast<uint>(camera->window->getWidth() * shadingScale),
|
||||
static_cast<uint>(camera->window->getHeight() * shadingScale),
|
||||
};
|
||||
|
||||
framegraph::RenderTargetAttachment::Descriptor depthAttachmentInfo;
|
||||
@@ -205,8 +205,7 @@ void ForwardStage::render(scene::Camera *camera) {
|
||||
data.depth = builder.create<framegraph::Texture>(RenderPipeline::fgStrHandleOutDepthTexture, depthTexInfo);
|
||||
data.depth = builder.write(data.depth, depthAttachmentInfo);
|
||||
builder.writeToBlackboard(RenderPipeline::fgStrHandleOutDepthTexture, data.depth);
|
||||
|
||||
builder.setViewport(_renderArea);
|
||||
builder.setViewport(pipeline->getViewport(camera), _renderArea);
|
||||
};
|
||||
|
||||
auto offset = _pipeline->getPipelineUBO()->getCurrentCameraUBOOffset();
|
||||
|
||||
Reference in New Issue
Block a user