Skip to content

Commit 5807ec7

Browse files
Janosch MachowinskiJanosch Machowinski
authored andcommitted
fix: Use R16_UNORM as internal render format if output is PF_L16
This fixes a major performance regression, if a camera uses int16 as output format. The improvement comes from skipping an expensive texture conversion inside from SRGB to INT16 by rendering native to the wanted output format. Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
1 parent 5195394 commit 5807ec7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ogre2/src/Ogre2RenderTarget.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ void Ogre2RenderTarget::BuildCompositor()
180180
nodeDef->addTextureDefinition("rt_fsaa");
181181

182182
msaaDef->fsaa = std::to_string(fsaa);
183+
msaaDef->format = this->dataPtr->ogreTexture[0]->getPixelFormat();
183184

184185
rtvDef->colourAttachments[0].textureName = "rt_fsaa";
185186
rtvDef->colourAttachments[0].resolveTextureName = "rt0";
@@ -585,7 +586,10 @@ void Ogre2RenderTarget::BuildTargetImpl()
585586

586587
this->dataPtr->ogreTexture[i]->setResolution(this->width, this->height);
587588
this->dataPtr->ogreTexture[i]->setNumMipmaps(1u);
588-
this->dataPtr->ogreTexture[i]->setPixelFormat(Ogre::PFG_RGBA8_UNORM_SRGB);
589+
Ogre::PixelFormatGpu pf = Ogre::PFG_RGBA8_UNORM_SRGB;
590+
if (this->format == PF_L16)
591+
pf = Ogre::PFG_R16_UNORM;
592+
this->dataPtr->ogreTexture[i]->setPixelFormat(pf);
589593

590594
this->dataPtr->ogreTexture[i]->scheduleTransitionTo(
591595
Ogre::GpuResidency::Resident);

0 commit comments

Comments
 (0)