Diligent Engine
 
Loading...
Searching...
No Matches
Diligent.IShaderResourceVariable Struct Referenceabstract

Shader resource variable. More...

#include <ShaderResourceVariable.h>

Inheritance diagram for Diligent.IShaderResourceVariable:
Diligent.IObject Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable > Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable > Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerGL > Diligent::ShaderVariableBase< ImageBindInfo, ShaderVariableManagerGL > Diligent::ShaderVariableBase< StorageBufferBindInfo, ShaderVariableManagerGL > Diligent::ShaderVariableBase< TextureBindInfo, ShaderVariableManagerGL > Diligent::ShaderVariableBase< UniformBuffBindInfo, ShaderVariableManagerGL > Diligent::IShaderResourceVariableD3D Diligent::ShaderVariableBase< ThisImplType, VarManagerType, ResourceVariableBaseInterface >

Public Member Functions

virtual void DILIGENT_CALL_TYPE Set (IDeviceObject *pObject, SET_SHADER_RESOURCE_FLAGS Flags=SET_SHADER_RESOURCE_FLAG_NONE)=0
 Binds resource to the variable.
 
virtual void DILIGENT_CALL_TYPE SetArray (IDeviceObject *const *ppObjects, Uint32 FirstElement, Uint32 NumElements, SET_SHADER_RESOURCE_FLAGS Flags=SET_SHADER_RESOURCE_FLAG_NONE)=0
 Binds resource array to the variable.
 
virtual void DILIGENT_CALL_TYPE SetBufferRange (IDeviceObject *pObject, Uint64 Offset, Uint64 Size, Uint32 ArrayIndex=0, SET_SHADER_RESOURCE_FLAGS Flags=SET_SHADER_RESOURCE_FLAG_NONE)=0
 Binds the specified constant buffer range to the variable.
 
virtual void DILIGENT_CALL_TYPE SetBufferOffset (Uint32 Offset, Uint32 ArrayIndex=0)=0
 Sets the constant or structured buffer dynamic offset.
 
virtual SHADER_RESOURCE_VARIABLE_TYPE DILIGENT_CALL_TYPE GetType () const =0
 Returns the shader resource variable type.
 
virtual void DILIGENT_CALL_TYPE GetResourceDesc (ShaderResourceDesc &ResourceDesc) const =0
 Returns shader resource description. See Diligent::ShaderResourceDesc.
 
virtual Uint32 DILIGENT_CALL_TYPE GetIndex () const =0
 Returns the variable index that can be used to access the variable.
 
virtual IDeviceObject *DILIGENT_CALL_TYPE Get (Uint32 ArrayIndex=0) const =0
 Returns a pointer to the resource that is bound to this variable.
 
- 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

Shader resource variable.

Member Function Documentation

◆ Get()

virtual IDeviceObject *DILIGENT_CALL_TYPE Diligent.IShaderResourceVariable.Get ( Uint32 ArrayIndex = 0) const
pure virtual

Returns a pointer to the resource that is bound to this variable.

Parameters
[in]ArrayIndex- Resource array index. Must be 0 for non-array variables.

◆ Set()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderResourceVariable.Set ( IDeviceObject * pObject,
SET_SHADER_RESOURCE_FLAGS Flags = SET_SHADER_RESOURCE_FLAG_NONE )
pure virtual

Binds resource to the variable.

The method performs run-time correctness checks. For instance, shader resource view cannot be assigned to a constant buffer variable.

Implemented in Diligent::ShaderVariableBase< ThisImplType, VarManagerType, ResourceVariableBaseInterface >, Diligent::ShaderVariableBase< BuffSRVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< BuffUAVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ConstBuffBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ImageBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< SamplerBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable >, Diligent::ShaderVariableBase< StorageBufferBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< TexSRVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< TextureBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< TexUAVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerGL >, and Diligent::ShaderVariableBase< UniformBuffBindInfo, ShaderVariableManagerGL >.

◆ SetArray()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderResourceVariable.SetArray ( IDeviceObject *const * ppObjects,
Uint32 FirstElement,
Uint32 NumElements,
SET_SHADER_RESOURCE_FLAGS Flags = SET_SHADER_RESOURCE_FLAG_NONE )
pure virtual

Binds resource array to the variable.

Parameters
[in]ppObjects- a pointer to the array of objects.
[in]FirstElement- first array element to set.
[in]NumElements- the number of objects in ppObjects array.
[in]Flags- flags, see Diligent::SET_SHADER_RESOURCE_FLAGS.

The method performs run-time correctness checks. For instance, shader resource view cannot be assigned to a constant buffer variable.

Implemented in Diligent::ShaderVariableBase< ThisImplType, VarManagerType, ResourceVariableBaseInterface >, Diligent::ShaderVariableBase< BuffSRVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< BuffUAVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ConstBuffBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ImageBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< SamplerBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable >, Diligent::ShaderVariableBase< StorageBufferBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< TexSRVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< TextureBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< TexUAVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerGL >, and Diligent::ShaderVariableBase< UniformBuffBindInfo, ShaderVariableManagerGL >.

◆ SetBufferOffset()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderResourceVariable.SetBufferOffset ( Uint32 Offset,
Uint32 ArrayIndex = 0 )
pure virtual

Sets the constant or structured buffer dynamic offset.

Parameters
[in]Offset- additional offset, in bytes, that is added to the base offset (see remarks). Only 32-bit offsets are supported.
[in]ArrayIndex- for array variables, index of the array element.

This method is only allowed for constant or structured buffer variables that were not created with Diligent::SHADER_VARIABLE_FLAG_NO_DYNAMIC_BUFFERS or Diligent::PIPELINE_RESOURCE_FLAG_NO_DYNAMIC_BUFFERS flags. The method is also not allowed for static resource variables.

Note
The Offset must be an integer multiple of ConstantBufferOffsetAlignment member when setting the offset for a constant buffer, or StructuredBufferOffsetAlignment when setting the offset for a structured buffer, as specified by device limits (see Diligent::DeviceLimits).

For constant buffers, the offset is added to the offset that was previously set by SetBufferRange() method (if any). For structured buffers, the offset is added to the base offset specified by the buffer view.

Changing the buffer offset does not require committing the SRB. From the engine point of view, buffers with dynamic offsets are treated similar to dynamic buffers, and thus affected by Diligent::DRAW_FLAG_DYNAMIC_RESOURCE_BUFFERS_INTACT flag.

Implemented in Diligent::ShaderVariableBase< ThisImplType, VarManagerType, ResourceVariableBaseInterface >, Diligent::ShaderVariableBase< BuffSRVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< BuffUAVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ConstBuffBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ImageBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< SamplerBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable >, Diligent::ShaderVariableBase< StorageBufferBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< TexSRVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< TextureBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< TexUAVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerGL >, and Diligent::ShaderVariableBase< UniformBuffBindInfo, ShaderVariableManagerGL >.

◆ SetBufferRange()

virtual void DILIGENT_CALL_TYPE Diligent.IShaderResourceVariable.SetBufferRange ( IDeviceObject * pObject,
Uint64 Offset,
Uint64 Size,
Uint32 ArrayIndex = 0,
SET_SHADER_RESOURCE_FLAGS Flags = SET_SHADER_RESOURCE_FLAG_NONE )
pure virtual

Binds the specified constant buffer range to the variable.

Parameters
[in]pObject- pointer to the buffer object.
[in]Offset- offset, in bytes, to the start of the buffer range to bind.
[in]Size- size, in bytes, of the buffer range to bind.
[in]ArrayIndex- for array variables, index of the array element.
[in]Flags- flags, see Diligent::SET_SHADER_RESOURCE_FLAGS.

This method is only allowed for constant buffers. If dynamic offset is further set by SetBufferOffset() method, it is added to the base offset set by this method.

The method resets dynamic offset previously set for this variable to zero.

Warning
The Offset must be an integer multiple of ConstantBufferOffsetAlignment member specified by the device limits (see Diligent::DeviceLimits).

Implemented in Diligent::ShaderVariableBase< ThisImplType, VarManagerType, ResourceVariableBaseInterface >, Diligent::ShaderVariableBase< BuffSRVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< BuffUAVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ConstBuffBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ImageBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< SamplerBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableD3D12Impl, ShaderVariableManagerD3D12, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableVkImpl, ShaderVariableManagerVk, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable >, Diligent::ShaderVariableBase< ShaderVariableWebGPUImpl, ShaderVariableManagerWebGPU, IShaderResourceVariable >, Diligent::ShaderVariableBase< StorageBufferBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< TexSRVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< TextureBindInfo, ShaderVariableManagerGL >, Diligent::ShaderVariableBase< TexUAVBindInfo, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerD3D11, IShaderResourceVariableD3D >, Diligent::ShaderVariableBase< ThisImplType, ShaderVariableManagerGL >, and Diligent::ShaderVariableBase< UniformBuffBindInfo, ShaderVariableManagerGL >.