Open 3D Engine Atom Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RHI::ShaderPlatformInterface Class Referenceabstract

#include <ShaderPlatformInterface.h>

Inherited by AZ::DX12::ShaderPlatformInterface, AZ::Metal::ShaderPlatformInterface, AZ::Null::ShaderPlatformInterface, and AZ::Vulkan::ShaderPlatformInterface.

Classes

struct  ByProducts
 
struct  RootConstantsInfo
 
struct  ShaderResourceGroupInfo
 
struct  StageDescriptor
 Struct used to return data when compiling the AZSL shader to the appropriate platform. More...
 

Public Types

using ShaderResourceGroupInfoList = AZStd::fixed_vector< ShaderResourceGroupInfo, RHI::Limits::Pipeline::ShaderResourceGroupCountMax >
 

Public Member Functions

 ShaderPlatformInterface (uint32_t apiUniqueIndex)
 @apiUniqueIndex See GetApiUniqueIndex() for details.
 
virtual RHI::APIType GetAPIType () const =0
 Returns the RHI API Type that this ShaderPlatformInterface supports.
 
virtual AZ::Name GetAPIName () const =0
 Returns the RHI API Name that this ShaderPlatformInterface supports.
 
virtual RHI::Ptr< RHI::PipelineLayoutDescriptorCreatePipelineLayoutDescriptor ()=0
 Creates the platform specific pipeline layout descriptor.
 
virtual RHI::Ptr< RHI::ShaderStageFunctionCreateShaderStageFunction (const StageDescriptor &stageDescriptor)=0
 
virtual bool IsShaderStageForRaster (ShaderHardwareStage shaderStageType) const =0
 
virtual bool IsShaderStageForCompute (ShaderHardwareStage shaderStageType) const =0
 
virtual bool IsShaderStageForRayTracing (ShaderHardwareStage shaderStageType) const =0
 
virtual bool BuildHasDebugInfo (const RHI::ShaderBuildArguments &shaderBuildArguments) const
 Query whether the shaders are set to build with debug information.
 
virtual const char * GetAzslHeader (const AssetBuilderSDK::PlatformInfo &platform) const =0
 Get the filename of include file to prefix shader programs with.
 
virtual bool BuildPipelineLayoutDescriptor (RHI::Ptr< RHI::PipelineLayoutDescriptor > pipelineLayoutDescriptor, const ShaderResourceGroupInfoList &srgInfoList, const RootConstantsInfo &rootConstantsInfo, const RHI::ShaderBuildArguments &shaderBuildArguments)=0
 
virtual bool VariantCompilationRequiresSrgLayoutData () const
 
uint32_t GetAPIUniqueIndex () const
 

Detailed Description

This class provides a platform agnostic interface for the creation and manipulation of platform shader objects. WARNING: The ShaderPlatformInterface objects are singletons and will be used to process multiple shader compilation jobs. Do not store per-job configuration data in any ShaderPlatformInterface classes, as it may get stomped. Instead, pass any per-job configuration on the call stack.

Member Function Documentation

◆ BuildPipelineLayoutDescriptor()

virtual bool AZ::RHI::ShaderPlatformInterface::BuildPipelineLayoutDescriptor ( RHI::Ptr< RHI::PipelineLayoutDescriptor pipelineLayoutDescriptor,
const ShaderResourceGroupInfoList &  srgInfoList,
const RootConstantsInfo rootConstantsInfo,
const RHI::ShaderBuildArguments shaderBuildArguments 
)
pure virtual

Builds additional platform specific data to the pipeline layout descriptor. Will be called before CompilePlatformInternal().

◆ CreatePipelineLayoutDescriptor()

virtual RHI::Ptr< RHI::PipelineLayoutDescriptor > AZ::RHI::ShaderPlatformInterface::CreatePipelineLayoutDescriptor ( )
pure virtual

◆ GetAPIName()

virtual AZ::Name AZ::RHI::ShaderPlatformInterface::GetAPIName ( ) const
pure virtual

◆ GetAPIType()

virtual RHI::APIType AZ::RHI::ShaderPlatformInterface::GetAPIType ( ) const
pure virtual

◆ GetAPIUniqueIndex()

uint32_t AZ::RHI::ShaderPlatformInterface::GetAPIUniqueIndex ( ) const
inline

See AZ::RHI::Factory::GetAPIUniqueIndex() for details. See AZ::RHI::Limits::APIType::PerPlatformApiUniqueIndexMax.

◆ GetAzslHeader()

virtual const char * AZ::RHI::ShaderPlatformInterface::GetAzslHeader ( const AssetBuilderSDK::PlatformInfo &  platform) const
pure virtual

Get the filename of include file to prefix shader programs with.

Implemented in AZ::DX12::ShaderPlatformInterface, AZ::Metal::ShaderPlatformInterface, AZ::Null::ShaderPlatformInterface, and AZ::Vulkan::ShaderPlatformInterface.

◆ VariantCompilationRequiresSrgLayoutData()

virtual bool AZ::RHI::ShaderPlatformInterface::VariantCompilationRequiresSrgLayoutData ( ) const
inlinevirtual

In general, shader compilation doesn't require SRG Layout data, but RHIs like Metal don't do well if unused resources (descriptors) are not bound. If this function returns TRUE the ShaderVariantAssetBuilder will invoke BuildPipelineLayoutDescriptor() so the RHI gets the chance to build SRG Layout data which will be useful when compiling MetalISL to Metal byte code.

Reimplemented in AZ::Metal::ShaderPlatformInterface.


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