/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #pragma once #include #include #include #include #include #include #include namespace AZ { namespace ShaderBuilder { using ConstantBufferContainer = AZStd::vector; using StructContainer = AZStd::vector; using SamplerContainer = AZStd::vector; using TextureContainer = AZStd::vector; using BufferContainer = AZStd::vector; using SrgConstantContainer = AZStd::vector; struct SrgData { //friend bool operator == (const SrgData&, const SrgData&); AZStd::string m_name; AZStd::string m_containingFileName; // One SRG contains the ShaderVariantKey fallback structure // A size greater than 0 indicates that this SRG data is designated as fallback Name m_fallbackName; uint32_t m_fallbackSize = 0; RHI::Handle m_bindingSlot; ConstantBufferContainer m_constantBuffers; SamplerContainer m_samplers; StructContainer m_structs; TextureContainer m_textures; BufferContainer m_buffers; SrgConstantContainer m_srgConstantData; uint32_t m_srgConstantDataRegisterId = RHI::UndefinedRegisterSlot; }; struct FunctionData { AZStd::string m_returnType; AZStd::string m_name; AZStd::string m_parametersAndContents; // Everything else is lumped together // Indicates if the function declares any shader stage inputs or outputs by the use of semantics bool m_hasShaderStageVaryings = false; RHI::ShaderStageAttributeMap attributesList; }; typedef AZStd::vector SrgDataContainer; typedef AZStd::vector AzslFunctions; struct RootConstantData { RootConstantBinding m_bindingInfo; SrgConstantContainer m_constants; }; struct ShaderFiles { AZStd::string m_azslSourceFullPath; //!< Full path to the source AZSL file (referred by the "Source" json element in .shader) AZStd::string m_shaderFileName; //!< Name for the .shader file AZStd::string m_azslFileName; //!< Name for the source .azsl file }; //! DEPRECATED [ATOM-15472] //! This class is used to collect all the json files produced by the compilation //! of an AZSL file as objects. struct AzslData { AzslData(const AZStd::shared_ptr& a_sources) : m_sources(a_sources) { } AZStd::shared_ptr m_sources; AZStd::string m_preprocessedFullPath; // Full path to a preprocessed version of the original AZSL file AZStd::string m_shaderCodePrefix; // AssetProcessor generated shader code which is added to the // AZSLc emitted code prior to invoking the native shader compiler SrgDataContainer m_srgData; AzslFunctions m_functions; StructContainer m_structs; RootConstantData m_rootConstantData; }; //! This class is used to collect all the json files produced by the compilation //! of an AZSL file as objects. struct AzslData2 { AzslData2(const AZStd::shared_ptr& a_sources) : m_sources(a_sources) { } AZStd::shared_ptr m_sources; AZStd::string m_preprocessedFullPath; // Full path to a preprocessed version of the original AZSL file SrgDataContainer m_srgData; AzslFunctions m_functions; StructContainer m_structs; RootConstantData m_rootConstantData; }; } // ShaderBuilder } // AZ