OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::VulkanTextureGpu Class Reference

#include <OgreVulkanTextureGpu.h>

+ Inheritance diagram for Ogre::VulkanTextureGpu:

Public Member Functions

 VulkanTextureGpu (GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, VaoManager *vaoManager, IdString name, uint32 textureFlags, TextureTypes::TextureTypes initialType, TextureGpuManager *textureManager)
 
 ~VulkanTextureGpu () override
 
void _autogenerateMipmaps (CopyEncTransitionMode::CopyEncTransitionMode transitionMode=CopyEncTransitionMode::Auto) override
 Tells the API to let the HW autogenerate mipmaps. More...
 
VkImageView _createView (PixelFormatGpu pixelFormat, uint8 mipLevel, uint8 numMipmaps, uint16 arraySlice, bool cubemapsAs2DArrays, bool forUav, uint32 numSlices=0u, VkImage imageOverride=0) const
 
bool _isDataReadyImpl () const override
 For internal use. More...
 
void _notifyTextureSlotChanged (const TexturePool *newPool, uint16 slice) override
 
void _setNextLayout (ResourceLayout::Layout layout) override
 Sets the layout the texture should be transitioned to after the next copy operation (once the copy encoder gets closed) More...
 
void _setToDisplayDummyTexture () override
 
void copyTo (TextureGpu *dst, const TextureBox &dstBox, uint8 dstMipLevel, const TextureBox &srcBox, uint8 srcMipLevel, bool keepResolvedTexSynced=true, CopyEncTransitionMode::CopyEncTransitionMode srcTransitionMode=CopyEncTransitionMode::Auto, CopyEncTransitionMode::CopyEncTransitionMode dstTransitionMode=CopyEncTransitionMode::Auto) override
 
VkImageView createView () const
 
VkImageView createView (const DescriptorSetTexture2::TextureSlot &texSlot, bool bUseCache=true) const
 
VkImageView createView (DescriptorSetUav::TextureSlot texSlot, bool bUseCache=true)
 
void destroyView (DescriptorSetTexture2::TextureSlot texSlot, VkImageView imageView)
 
void destroyView (DescriptorSetUav::TextureSlot texSlot, VkImageView imageView)
 
void destroyView (VkImageView imageView)
 
ResourceLayout::Layout getCurrentLayout () const override
 
void getCustomAttribute (IdString name, void *pData) override
 
VkImageView getDefaultDisplaySrv () const
 
VkImage getDisplayTextureName () const
 
VkImage getFinalTextureName () const
 
VkImageSubresourceRange getFullSubresourceRange () const
 
VkImageMemoryBarrier getImageMemoryBarrier () const
 Returns a fresh VkImageMemoryBarrier filled with common data. More...
 
VkImageViewType getInternalVulkanTextureViewType () const
 
VkImage getMsaaFramebufferName () const
 
void getSubsampleLocations (vector< Vector2 >::type locations) override
 Get the MSAA subsample locations. More...
 
VkImageType getVulkanTextureType () const
 
PixelFormatGpu getWorkaroundedPixelFormat (const PixelFormatGpu pixelFormat) const
 
void notifyDataIsReady () override
 Notifies it is safe to use the real data. Everything has been uploaded. More...
 
void setTextureType (TextureTypes::TextureTypes textureType) override
 
- Public Member Functions inherited from Ogre::TextureGpu
 TextureGpu (GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, VaoManager *vaoManager, IdString name, uint32 textureFlags, TextureTypes::TextureTypes initialType, TextureGpuManager *textureManager)
 
 ~TextureGpu () override
 
uint8_getSysRamCopy (uint8 mipLevel)
 
TextureBox _getSysRamCopyAsBox (uint8 mipLevel)
 
size_t _getSysRamCopyBytesPerImage (uint8 mipLevel)
 Note: Returns non-zero even if there is no system ram copy. More...
 
uint32 _getSysRamCopyBytesPerRow (uint8 mipLevel)
 Note: Returns non-zero even if there is no system ram copy. More...
 
bool _isManualTextureFlagPresent () const
 
void _notifySysRamDownloadIsReady (uint8 *sysRamPtr, bool resyncOnly)
 Do not call directly. More...
 
void _resetTextureManager ()
 
void _resolveTo (TextureGpu *resolveTexture)
 Immediately resolves this texture to the resolveTexture argument. More...
 
virtual void _setDepthBufferDefaults (uint16 depthBufferPoolId, bool preferDepthTexture, PixelFormatGpu desiredDepthBufferFormat)
 These 3 values are used as defaults for the compositor to use, but they may be explicitly overriden by a RenderPassDescriptor. More...
 
void _setSampleDescription (SampleDescription desc, SampleDescription validatedSampleDesc)
 For internal use. More...
 
void _setSourceType (uint8 type)
 
void _syncGpuResidentToSystemRam ()
 Forces downloading data from GPU to CPU, usually because the data on GPU changed and we're in strategy AlwaysKeepSystemRamCopy. More...
 
void _transitionTo (GpuResidency::GpuResidency newResidency, uint8 *sysRamCopy, bool autoDeleteSysRamCopy=true)
 This function may be called manually (if user is manually managing a texture) or automatically (e.g. More...
 
void addListener (TextureGpuListener *listener)
 
bool allowsAutoMipmaps () const
 
void copyContentsToMemory (TextureBox src, TextureBox dst, PixelFormatGpu dstFormat, bool automaticResolve=true)
 Writes the current contents of the render target to the memory. More...
 
void copyParametersFrom (TextureGpu *src)
 
ResourceLayout::Layout getDefaultLayout (bool bIgnoreDiscardableFlag=false) const
 
uint32 getDepth () const
 For TypeCube & TypeCubeArray, this value returns 1. More...
 
virtual uint16 getDepthBufferPoolId () const
 
uint32 getDepthOrSlices () const
 
virtual PixelFormatGpu getDesiredDepthBufferFormat () const
 
TextureBox getEmptyBox (uint8 mipLevel)
 
uint32 getHeight () const
 
uint32 getInternalHeight () const
 Real API height accounting for TextureGpu::getOrientationMode. See getInternalWidth. More...
 
uint16 getInternalSliceStart () const
 
TextureTypes::TextureTypes getInternalTextureType () const
 
uint32 getInternalWidth () const
 Real API width accounting for TextureGpu::getOrientationMode If orientation mode is 90° or 270° then getInternalWidth returns the height and getInternalHeight returns the width. More...
 
const vector< TextureGpuListener * >::type & getListeners () const
 
String getNameStr () const override
 Note: This returns the alias name of the texture. More...
 
uint8 getNumMipmaps () const
 
uint32 getNumSlices () const
 For TypeCube this value returns 6. More...
 
virtual OrientationMode getOrientationMode () const
 
PixelFormatGpu getPixelFormat () const
 
virtual bool getPreferDepthTexture () const
 
virtual String getRealResourceNameStr () const
 Returns the real name (e.g. disk in file) of the resource. More...
 
SampleDescription getRequestedSampleDescription () const
 Returns original requested sample description, i.e. the raw input to setSampleDescription. More...
 
virtual String getResourceGroupStr () const
 
SampleDescription getSampleDescription () const
 Returns effective sample description supported by the API. More...
 
String getSettingsDesc () const
 
size_t getSizeBytes () const
 Returns total size in bytes used in GPU by this texture (not by its pool) including mipmaps. More...
 
uint8 getSourceType () const
 This setting is for where the texture is created, e.g. More...
 
TextureGpuManagergetTextureManager () const
 
const TexturePoolgetTexturePool () const
 
uint32 getTexturePoolId () const
 
TextureTypes::TextureTypes getTextureType () const
 
uint32 getWidth () const
 
bool hasAutomaticBatching () const
 
bool hasAutoMipmapAuto () const
 
bool hasEquivalentParameters (TextureGpu *other) const
 
bool hasMsaaExplicitResolves () const
 
bool isDataReady () const
 True if this texture is fully ready to be used for displaying. More...
 
bool isDiscardableContent () const
 
bool isManualTexture () const
 
bool isMetadataReady () const
 It is threadsafe to call this function from main thread. More...
 
virtual bool isMsaaPatternSupported (MsaaPatterns::MsaaPatterns pattern)
 
bool isMultisample () const
 
virtual bool isOpenGLRenderWindow () const
 OpenGL RenderWindows are a bit specific: More...
 
bool isPoolOwner () const
 
bool isReinterpretable () const
 
bool isRenderToTexture () const
 
bool isRenderWindowSpecific () const
 
bool isTexture () const
 
bool isTextureGpu () const override
 
bool isTilerMemoryless () const
 
bool isUav () const
 
void notifyAllListenersTextureChanged (uint32 reason, void *extraData=0)
 
bool prefersLoadingFromFileAsSRGB () const
 
void removeListener (TextureGpuListener *listener)
 
bool requiresTextureFlipping () const
 
void scheduleReupload (Image2 *image=0, bool autoDeleteImage=true, bool bSkipMultiload=false)
 There are times where you want to reload a texture again (e.g. More...
 
void scheduleTransitionTo (GpuResidency::GpuResidency nextResidency, Image2 *image=0, bool autoDeleteImage=true, bool bSkipMultiload=false)
 Same as unsafeScheduleTransitionTo, but first checks if we're already in the residency state we want to go to, or if it has already been scheduled; thus it can be called multiple times. More...
 
void setNumMipmaps (uint8 numMipmaps)
 
virtual void setOrientationMode (OrientationMode orientationMode)
 Sets the given orientation. More...
 
void setPixelFormat (PixelFormatGpu pixelFormat)
 Sets the pixel format. More...
 
void setResolution (uint32 width, uint32 height, uint32 depthOrSlices=1u)
 
void setSampleDescription (SampleDescription desc)
 
void setTexturePoolId (uint32 poolId)
 2D Texture with automatic batching will be merged with other textures into the same pool as one big 2D Array texture behind the scenes. More...
 
virtual bool supportsAsDepthBufferFor (TextureGpu *colourTarget) const
 
virtual void swapBuffers ()
 Only valid for TextureGpu classes. More...
 
void unsafeScheduleTransitionTo (GpuResidency::GpuResidency nextResidency, Image2 *image=0, bool autoDeleteImage=true, bool bSkipMultiload=false)
 Schedules an async transition in residency. More...
 
void waitForData ()
 Blocks main thread until data is ready. More...
 
void waitForMetadata ()
 Blocks main thread until metadata is ready. More...
 
void writeContentsToFile (const String &filename, uint8 minMip, uint8 maxMip, bool automaticResolve=true)
 Writes the current contents of the render target to the named file. More...
 
- Public Member Functions inherited from Ogre::GpuTrackedResource
virtual ~GpuTrackedResource ()
 
- Public Member Functions inherited from Ogre::GpuResource
 GpuResource (GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, VaoManager *vaoManager, IdString name)
 
virtual ~GpuResource ()
 
void _addPendingResidencyChanges (uint32 value)
 
void _setNextResidencyStatus (GpuResidency::GpuResidency nextResidency)
 
GpuPageOutStrategy::GpuPageOutStrategy getGpuPageOutStrategy () const
 
IdString getName () const
 
GpuResidency::GpuResidency getNextResidencyStatus () const
 When getResidencyStatus() != getNextResidencyStatus(), residency changes happen in the main thread, while some preparation may be happening in the background. More...
 
uint32 getPendingResidencyChanges () const
 Returns the number of pending residency changes. More...
 
GpuResidency::GpuResidency getResidencyStatus () const
 

Public Attributes

VkImageLayout mCurrLayout
 The current layout we're in. Including any internal stuff. More...
 
VkImageLayout mNextLayout
 The layout we're expected to be when rendering or doing compute, rather than when doing internal stuff (e.g. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Ogre::TextureGpu
static OrientationMode msDefaultOrientationMode
 PUBLIC VARIABLE. More...
 
static const IdString msFinalTextureBuffer
 
static const IdString msMsaaTextureBuffer
 

Constructor & Destructor Documentation

◆ VulkanTextureGpu()

Ogre::VulkanTextureGpu::VulkanTextureGpu ( GpuPageOutStrategy::GpuPageOutStrategy  pageOutStrategy,
VaoManager vaoManager,
IdString  name,
uint32  textureFlags,
TextureTypes::TextureTypes  initialType,
TextureGpuManager textureManager 
)

◆ ~VulkanTextureGpu()

Ogre::VulkanTextureGpu::~VulkanTextureGpu ( )
override

Member Function Documentation

◆ _autogenerateMipmaps()

void Ogre::VulkanTextureGpu::_autogenerateMipmaps ( CopyEncTransitionMode::CopyEncTransitionMode  transitionMode = CopyEncTransitionMode::Auto)
overridevirtual

Tells the API to let the HW autogenerate mipmaps.

Assumes allowsAutoMipmaps() == true and isRenderToTexture() == true

Parameters
transitionModeSee CopyEncTransitionMode::CopyEncTransitionMode

Implements Ogre::TextureGpu.

◆ _createView()

VkImageView Ogre::VulkanTextureGpu::_createView ( PixelFormatGpu  pixelFormat,
uint8  mipLevel,
uint8  numMipmaps,
uint16  arraySlice,
bool  cubemapsAs2DArrays,
bool  forUav,
uint32  numSlices = 0u,
VkImage  imageOverride = 0 
) const

◆ _isDataReadyImpl()

bool Ogre::VulkanTextureGpu::_isDataReadyImpl ( ) const
overridevirtual

For internal use.

Do not call directly.

This function is the same isDataReady except it ignores pending residency changes, which is important when TextureGpuManager needs to know this information but the TextureGpu is transitioning (thus mPendingResidencyChanges is in an inconsistent state)

Implements Ogre::TextureGpu.

Reimplemented in Ogre::VulkanTextureGpuWindow.

◆ _notifyTextureSlotChanged()

void Ogre::VulkanTextureGpu::_notifyTextureSlotChanged ( const TexturePool newPool,
uint16  slice 
)
overridevirtual

Reimplemented from Ogre::TextureGpu.

Reimplemented in Ogre::VulkanTextureGpuWindow.

◆ _setNextLayout()

void Ogre::VulkanTextureGpu::_setNextLayout ( ResourceLayout::Layout  layout)
overridevirtual

Sets the layout the texture should be transitioned to after the next copy operation (once the copy encoder gets closed)

This is specific to Vulkan & D3D12

Reimplemented from Ogre::TextureGpu.

◆ _setToDisplayDummyTexture()

void Ogre::VulkanTextureGpu::_setToDisplayDummyTexture ( )
overridevirtual

Implements Ogre::TextureGpu.

Reimplemented in Ogre::VulkanTextureGpuWindow.

◆ copyTo()

void Ogre::VulkanTextureGpu::copyTo ( TextureGpu dst,
const TextureBox dstBox,
uint8  dstMipLevel,
const TextureBox srcBox,
uint8  srcMipLevel,
bool  keepResolvedTexSynced = true,
CopyEncTransitionMode::CopyEncTransitionMode  srcTransitionMode = CopyEncTransitionMode::Auto,
CopyEncTransitionMode::CopyEncTransitionMode  dstTransitionMode = CopyEncTransitionMode::Auto 
)
overridevirtual
Parameters
dst
dstBox
dstMipLevel
srcBox
srcMipLevel
keepResolvedTexSyncedWhen true, if dst is an MSAA texture and is implicitly resolved (i.e. dst->hasMsaaExplicitResolves() == false); the resolved texture is also kept up to date.

Typically the reason to set this to false is if you plane on rendering more stuff to dst texture and then resolve.

Parameters
srcTransitionModeTransition mode for 'this'
dstTransitionModeTransition mode for 'dst'

Reimplemented from Ogre::TextureGpu.

◆ createView() [1/3]

VkImageView Ogre::VulkanTextureGpu::createView ( ) const

◆ createView() [2/3]

VkImageView Ogre::VulkanTextureGpu::createView ( const DescriptorSetTexture2::TextureSlot texSlot,
bool  bUseCache = true 
) const

◆ createView() [3/3]

VkImageView Ogre::VulkanTextureGpu::createView ( DescriptorSetUav::TextureSlot  texSlot,
bool  bUseCache = true 
)

◆ destroyView() [1/3]

void Ogre::VulkanTextureGpu::destroyView ( DescriptorSetTexture2::TextureSlot  texSlot,
VkImageView  imageView 
)

◆ destroyView() [2/3]

void Ogre::VulkanTextureGpu::destroyView ( DescriptorSetUav::TextureSlot  texSlot,
VkImageView  imageView 
)

◆ destroyView() [3/3]

void Ogre::VulkanTextureGpu::destroyView ( VkImageView  imageView)

◆ getCurrentLayout()

ResourceLayout::Layout Ogre::VulkanTextureGpu::getCurrentLayout ( ) const
overridevirtual

Reimplemented from Ogre::TextureGpu.

◆ getCustomAttribute()

void Ogre::VulkanTextureGpu::getCustomAttribute ( IdString  name,
void *  pData 
)
overridevirtual

Reimplemented from Ogre::TextureGpu.

Reimplemented in Ogre::VulkanTextureGpuWindow.

◆ getDefaultDisplaySrv()

VkImageView Ogre::VulkanTextureGpu::getDefaultDisplaySrv ( ) const
inline

◆ getDisplayTextureName()

VkImage Ogre::VulkanTextureGpu::getDisplayTextureName ( ) const
inline

◆ getFinalTextureName()

VkImage Ogre::VulkanTextureGpu::getFinalTextureName ( ) const
inline

◆ getFullSubresourceRange()

VkImageSubresourceRange Ogre::VulkanTextureGpu::getFullSubresourceRange ( ) const

◆ getImageMemoryBarrier()

VkImageMemoryBarrier Ogre::VulkanTextureGpu::getImageMemoryBarrier ( ) const

Returns a fresh VkImageMemoryBarrier filled with common data.

srcAccessMask, dstAccessMask, oldLayout and newLayout must be filled by caller

◆ getInternalVulkanTextureViewType()

VkImageViewType Ogre::VulkanTextureGpu::getInternalVulkanTextureViewType ( ) const

◆ getMsaaFramebufferName()

VkImage Ogre::VulkanTextureGpu::getMsaaFramebufferName ( ) const
inline

◆ getSubsampleLocations()

void Ogre::VulkanTextureGpu::getSubsampleLocations ( vector< Vector2 >::type  locations)
overridevirtual

Get the MSAA subsample locations.

mSampleDescription.pattern must not be MsaaPatterns::Undefined.

Parameters
locationsOutputs an array with the locations for each subsample. Values are in range [-1; 1]

Implements Ogre::TextureGpu.

Reimplemented in Ogre::VulkanTextureGpuWindow.

◆ getVulkanTextureType()

VkImageType Ogre::VulkanTextureGpu::getVulkanTextureType ( ) const

◆ getWorkaroundedPixelFormat()

PixelFormatGpu Ogre::VulkanTextureGpu::getWorkaroundedPixelFormat ( const PixelFormatGpu  pixelFormat) const

◆ notifyDataIsReady()

void Ogre::VulkanTextureGpu::notifyDataIsReady ( )
overridevirtual

Notifies it is safe to use the real data. Everything has been uploaded.

Implements Ogre::TextureGpu.

Reimplemented in Ogre::VulkanTextureGpuWindow.

◆ setTextureType()

void Ogre::VulkanTextureGpu::setTextureType ( TextureTypes::TextureTypes  textureType)
overridevirtual

Reimplemented from Ogre::TextureGpu.

Reimplemented in Ogre::VulkanTextureGpuWindow.

Member Data Documentation

◆ mCurrLayout

VkImageLayout Ogre::VulkanTextureGpu::mCurrLayout

The current layout we're in. Including any internal stuff.

◆ mNextLayout

VkImageLayout Ogre::VulkanTextureGpu::mNextLayout

The layout we're expected to be when rendering or doing compute, rather than when doing internal stuff (e.g.

this variable won't contain VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, because that origins from C++ operations and are not expected by the compositor)

When mCurrLayout != mNextLayout, it means that there is already a layout transition that will be happening to achieve mCurrLayout = mNextLayout


The documentation for this class was generated from the following file: