I try to bind depth buffer used in compositor to compute job (for particle depth collisions) with this code:
Code: Select all
CompositorNode* node = mCompositorWorkspace->findNode(Ogre::IdString("PostprocessingSampleStdRenderer"));
if(node) {
TextureGpu* tex = node->getDefinedTexture(Ogre::IdString("depthTextureView"));
DescriptorSetTexture2::TextureSlot texSlot(DescriptorSetTexture2::TextureSlot::makeEmpty());
texSlot.texture = tex;
mUpdateParticlesJob->setTexture( 4, texSlot );
}
Code: Select all
Ogre::Image2 img;
img.convertFromTexture( tex, 0u, tex->getNumMipmaps() - 1u );
img.save( path + "depthTextureView" + Ogre::StringConverter::toString(counter2) + "." + ext, 0u, tex->getNumMipmaps() );
In compositor node depth texture is declared as follow:
Code: Select all
texture rt0 target_width target_height PFG_RGBA8_UNORM depth_format PFG_D32_FLOAT_S8X24_UINT depth_texture depth_pool 1
texture rt1 target_width target_height PFG_RGBA8_UNORM depth_pool 1
... // some other textures using the same depth buffer
texture depthTextureView target_width target_height PFG_D32_FLOAT_S8X24_UINT depth_pool 1 keep_content
Code: Select all
An exception has occured: OGRE EXCEPTION(1:InvalidStateException): Transitioning texture RenderWindow DepthBuffer from Undefined to a read-only layout. Perhaps you didn't want to set TextureFlags::DiscardableContent / aka keep_content in compositor? in BarrierSolver::resolveTransition