Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::ITexture Struct Referenceabstract

Texture interface. More...

#include <Texture.h>

Inheritance diagram for Diligent::ITexture:
Diligent::IDeviceObject Diligent.IObject Diligent::ITextureD3D11 Diligent::ITextureD3D12 Diligent::ITextureGL Diligent::ITextureMtl Diligent::ITextureVk Diligent::ITextureWebGPU

Public Member Functions

virtual const TextureDesc &DILIGENT_CALL_TYPE GetDesc () const override=0
 Returns the texture description used to create the object.
 
virtual void DILIGENT_CALL_TYPE CreateView (const TextureViewDesc &ViewDesc, ITextureView **ppView)=0
 Creates a new texture view.
 
virtual ITextureView *DILIGENT_CALL_TYPE GetDefaultView (TEXTURE_VIEW_TYPE ViewType)=0
 Returns the pointer to the default view.
 
virtual Uint64 DILIGENT_CALL_TYPE GetNativeHandle ()=0
 Returns native texture handle specific to the underlying graphics API.
 
virtual void DILIGENT_CALL_TYPE SetState (RESOURCE_STATE State)=0
 Sets the usage state for all texture subresources.
 
virtual RESOURCE_STATE DILIGENT_CALL_TYPE GetState () const =0
 Returns the internal texture state.
 
virtual const SparseTextureProperties &DILIGENT_CALL_TYPE GetSparseProperties () const =0
 Returns the sparse texture properties, see Diligent::SparseTextureProperties.
 
- Public Member Functions inherited from Diligent::IDeviceObject
virtual Int32 DILIGENT_CALL_TYPE GetUniqueID () const =0
 Returns unique identifier assigned to an object.
 
virtual void DILIGENT_CALL_TYPE SetUserData (IObject *pUserData)=0
 Stores a pointer to the user-provided data object.
 
virtual IObject *DILIGENT_CALL_TYPE GetUserData () const =0
 Returns a pointer to the user data object previously set with SetUserData() method.
 
- Public Member Functions inherited from Diligent.IObject
virtual void DILIGENT_CALL_TYPE QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0
 Queries the specific interface.
 
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE AddRef ()=0
 Increments the number of strong references by 1.
 
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE Release ()=0
 
virtual IReferenceCounters *DILIGENT_CALL_TYPE GetReferenceCounters () const =0
 

Detailed Description

Texture interface.

Member Function Documentation

◆ CreateView()

virtual void DILIGENT_CALL_TYPE Diligent::ITexture::CreateView ( const TextureViewDesc & ViewDesc,
ITextureView ** ppView )
pure virtual

Creates a new texture view.

Parameters
[in]ViewDesc- View description. See Diligent::TextureViewDesc for details.
[out]ppView- Address of the memory location where the pointer to the view interface will be written to.

To create a shader resource view addressing the entire texture, set only TextureViewDesc::ViewType member of the ViewDesc parameter to Diligent::TEXTURE_VIEW_SHADER_RESOURCE and leave all other members in their default values. Using the same method, you can create render target or depth stencil view addressing the largest mip level.

If texture view format is Diligent::TEX_FORMAT_UNKNOWN, the view format will match the texture format.

If texture view type is Diligent::TEXTURE_VIEW_UNDEFINED, the type will match the texture type. If the number of mip levels is 0, and the view type is shader resource, the view will address all mip levels.

For other view types it will address one mip level.

If the number of slices is 0, all slices from FirstArraySlice or FirstDepthSlice will be referenced by the view. For non-array textures, the only allowed values for the number of slices are 0 and 1.

Texture view will contain strong reference to the texture, so the texture will not be destroyed until all views are released.

The function calls AddRef() for the created interface, so it must be released by a call to Release() when it is no longer needed.

◆ GetDefaultView()

virtual ITextureView *DILIGENT_CALL_TYPE Diligent::ITexture::GetDefaultView ( TEXTURE_VIEW_TYPE ViewType)
pure virtual

Returns the pointer to the default view.

Parameters
[in]ViewType- Type of the requested view. See Diligent::TEXTURE_VIEW_TYPE.
Returns
Pointer to the interface
Note
The function does not increase the reference counter for the returned interface, so Release() must not be called.

◆ GetNativeHandle()

virtual Uint64 DILIGENT_CALL_TYPE Diligent::ITexture::GetNativeHandle ( )
pure virtual

Returns native texture handle specific to the underlying graphics API.

Returns
A pointer to ID3D11Resource interface, for D3D11 implementation
A pointer to ID3D12Resource interface, for D3D12 implementation
VkImage handle, for Vulkan implementation
GL texture name, for OpenGL implementation
MtlTexture, for Metal implementation
WGPUTexture for WebGPU implementation

◆ SetState()

virtual void DILIGENT_CALL_TYPE Diligent::ITexture::SetState ( RESOURCE_STATE State)
pure virtual

Sets the usage state for all texture subresources.

This method does not perform state transition, but resets the internal texture state to the given value. This method should be used after the application finished manually managing the texture state and wants to hand over state management back to the engine.