// Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors. // All rights reserved. // Code licensed under the BSD License. // http://www.anki3d.org/LICENSE // WARNING: This file is auto generated. #pragma once #include #include #include namespace anki { /// Storage or uniform variable. class ShaderProgramBinaryVariable { public: Array m_name = {}; ShaderVariableDataType m_type = ShaderVariableDataType::NONE; template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_name", offsetof(ShaderProgramBinaryVariable, m_name), &self.m_name[0], self.m_name.getSize()); s.doValue("m_type", offsetof(ShaderProgramBinaryVariable, m_type), self.m_type); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Storage or uniform variable per variant. class ShaderProgramBinaryVariableInstance { public: U32 m_index = MAX_U32; ///< Points to ShaderProgramBinaryBlock::m_variables. ShaderVariableBlockInfo m_blockInfo; template static void serializeCommon(TSerializer& s, TClass self) { s.doValue("m_index", offsetof(ShaderProgramBinaryVariableInstance, m_index), self.m_index); s.doValue("m_blockInfo", offsetof(ShaderProgramBinaryVariableInstance, m_blockInfo), self.m_blockInfo); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Storage or uniform block. class ShaderProgramBinaryBlock { public: Array m_name = {}; WeakArray m_variables; U32 m_binding = MAX_U32; U32 m_set = MAX_U32; template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_name", offsetof(ShaderProgramBinaryBlock, m_name), &self.m_name[0], self.m_name.getSize()); s.doValue("m_variables", offsetof(ShaderProgramBinaryBlock, m_variables), self.m_variables); s.doValue("m_binding", offsetof(ShaderProgramBinaryBlock, m_binding), self.m_binding); s.doValue("m_set", offsetof(ShaderProgramBinaryBlock, m_set), self.m_set); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Storage or uniform block per variant. class ShaderProgramBinaryBlockInstance { public: U32 m_index = MAX_U32; ///< Points to ShaderProgramBinary::m_uniformBlocks or m_storageBlocks. WeakArray m_variables; U32 m_size = MAX_U32; template static void serializeCommon(TSerializer& s, TClass self) { s.doValue("m_index", offsetof(ShaderProgramBinaryBlockInstance, m_index), self.m_index); s.doValue("m_variables", offsetof(ShaderProgramBinaryBlockInstance, m_variables), self.m_variables); s.doValue("m_size", offsetof(ShaderProgramBinaryBlockInstance, m_size), self.m_size); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Sampler or texture or image. class ShaderProgramBinaryOpaque { public: Array m_name = {}; ShaderVariableDataType m_type = ShaderVariableDataType::NONE; U32 m_binding = MAX_U32; U32 m_set = MAX_U32; template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_name", offsetof(ShaderProgramBinaryOpaque, m_name), &self.m_name[0], self.m_name.getSize()); s.doValue("m_type", offsetof(ShaderProgramBinaryOpaque, m_type), self.m_type); s.doValue("m_binding", offsetof(ShaderProgramBinaryOpaque, m_binding), self.m_binding); s.doValue("m_set", offsetof(ShaderProgramBinaryOpaque, m_set), self.m_set); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Sampler or texture or image per variant. class ShaderProgramBinaryOpaqueInstance { public: U32 m_index = MAX_U32; ///< Points to ShaderProgramBinary::m_opaques. U32 m_arraySize = MAX_U32; template static void serializeCommon(TSerializer& s, TClass self) { s.doValue("m_index", offsetof(ShaderProgramBinaryOpaqueInstance, m_index), self.m_index); s.doValue("m_arraySize", offsetof(ShaderProgramBinaryOpaqueInstance, m_arraySize), self.m_arraySize); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Specialization constant. class ShaderProgramBinaryConstant { public: Array m_name; ShaderVariableDataType m_type = ShaderVariableDataType::NONE; U32 m_constantId = MAX_U32; template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_name", offsetof(ShaderProgramBinaryConstant, m_name), &self.m_name[0], self.m_name.getSize()); s.doValue("m_type", offsetof(ShaderProgramBinaryConstant, m_type), self.m_type); s.doValue("m_constantId", offsetof(ShaderProgramBinaryConstant, m_constantId), self.m_constantId); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Specialization constant per variant. class ShaderProgramBinaryConstantInstance { public: U32 m_index = MAX_U32; ///< Points to ShaderProgramBinary::m_constants. template static void serializeCommon(TSerializer& s, TClass self) { s.doValue("m_index", offsetof(ShaderProgramBinaryConstantInstance, m_index), self.m_index); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// A member of a ShaderProgramBinaryStruct. class ShaderProgramBinaryStructMember { public: Array m_name = {}; ShaderVariableDataType m_type = ShaderVariableDataType::NONE; ///< If the value is ShaderVariableDataType::NONE then it's a struct. U32 m_structIndex = MAX_U32; U32 m_offset = MAX_U32; U32 m_arraySize = MAX_U32; template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_name", offsetof(ShaderProgramBinaryStructMember, m_name), &self.m_name[0], self.m_name.getSize()); s.doValue("m_type", offsetof(ShaderProgramBinaryStructMember, m_type), self.m_type); s.doValue("m_structIndex", offsetof(ShaderProgramBinaryStructMember, m_structIndex), self.m_structIndex); s.doValue("m_offset", offsetof(ShaderProgramBinaryStructMember, m_offset), self.m_offset); s.doValue("m_arraySize", offsetof(ShaderProgramBinaryStructMember, m_arraySize), self.m_arraySize); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Structures. class ShaderProgramBinaryStruct { public: Array m_name; WeakArray m_members; U32 m_size = MAX_U32; template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_name", offsetof(ShaderProgramBinaryStruct, m_name), &self.m_name[0], self.m_name.getSize()); s.doValue("m_members", offsetof(ShaderProgramBinaryStruct, m_members), self.m_members); s.doValue("m_size", offsetof(ShaderProgramBinaryStruct, m_size), self.m_size); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// ShaderProgramBinaryVariant class. class ShaderProgramBinaryVariant { public: Array m_codeBlockIndices = {}; ///< Index in ShaderProgramBinary::m_codeBlocks. MAX_U32 means no shader. WeakArray m_uniformBlocks; WeakArray m_storageBlocks; ShaderProgramBinaryBlockInstance* m_pushConstantBlock = nullptr; WeakArray m_opaques; WeakArray m_constants; Array m_workgroupSizes = {MAX_U32, MAX_U32, MAX_U32}; Array m_workgroupSizesConstants = {MAX_U32, MAX_U32, MAX_U32}; ///< Indices to ShaderProgramBinary::m_constants. template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_codeBlockIndices", offsetof(ShaderProgramBinaryVariant, m_codeBlockIndices), &self.m_codeBlockIndices[0], self.m_codeBlockIndices.getSize()); s.doValue("m_uniformBlocks", offsetof(ShaderProgramBinaryVariant, m_uniformBlocks), self.m_uniformBlocks); s.doValue("m_storageBlocks", offsetof(ShaderProgramBinaryVariant, m_storageBlocks), self.m_storageBlocks); s.doPointer("m_pushConstantBlock", offsetof(ShaderProgramBinaryVariant, m_pushConstantBlock), self.m_pushConstantBlock); s.doValue("m_opaques", offsetof(ShaderProgramBinaryVariant, m_opaques), self.m_opaques); s.doValue("m_constants", offsetof(ShaderProgramBinaryVariant, m_constants), self.m_constants); s.doArray("m_workgroupSizes", offsetof(ShaderProgramBinaryVariant, m_workgroupSizes), &self.m_workgroupSizes[0], self.m_workgroupSizes.getSize()); s.doArray("m_workgroupSizesConstants", offsetof(ShaderProgramBinaryVariant, m_workgroupSizesConstants), &self.m_workgroupSizesConstants[0], self.m_workgroupSizesConstants.getSize()); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Shader program mutator. class ShaderProgramBinaryMutator { public: Array m_name = {}; WeakArray m_values; template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_name", offsetof(ShaderProgramBinaryMutator, m_name), &self.m_name[0], self.m_name.getSize()); s.doValue("m_values", offsetof(ShaderProgramBinaryMutator, m_values), self.m_values); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// Contains the IR (SPIR-V). class ShaderProgramBinaryCodeBlock { public: WeakArray m_binary; U64 m_hash = 0; template static void serializeCommon(TSerializer& s, TClass self) { s.doValue("m_binary", offsetof(ShaderProgramBinaryCodeBlock, m_binary), self.m_binary); s.doValue("m_hash", offsetof(ShaderProgramBinaryCodeBlock, m_hash), self.m_hash); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// ShaderProgramBinaryMutation class. class ShaderProgramBinaryMutation { public: WeakArray m_values; U32 m_variantIndex = MAX_U32; U64 m_hash = 0; ///< Mutation hash. template static void serializeCommon(TSerializer& s, TClass self) { s.doValue("m_values", offsetof(ShaderProgramBinaryMutation, m_values), self.m_values); s.doValue("m_variantIndex", offsetof(ShaderProgramBinaryMutation, m_variantIndex), self.m_variantIndex); s.doValue("m_hash", offsetof(ShaderProgramBinaryMutation, m_hash), self.m_hash); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; /// ShaderProgramBinary class. class ShaderProgramBinary { public: Array m_magic = {}; WeakArray m_mutators; WeakArray m_codeBlocks; WeakArray m_variants; WeakArray m_mutations; ///< It's sorted using the mutation's hash. WeakArray m_uniformBlocks; WeakArray m_storageBlocks; ShaderProgramBinaryBlock* m_pushConstantBlock = nullptr; WeakArray m_opaques; WeakArray m_constants; WeakArray m_structs; ShaderTypeBit m_presentShaderTypes = ShaderTypeBit::NONE; Array m_libraryName = {}; ///< The name of the shader library. Mainly for RT shaders. U32 m_rayType = MAX_U32; ///< An arbitary number indicating the type of the ray. template static void serializeCommon(TSerializer& s, TClass self) { s.doArray("m_magic", offsetof(ShaderProgramBinary, m_magic), &self.m_magic[0], self.m_magic.getSize()); s.doValue("m_mutators", offsetof(ShaderProgramBinary, m_mutators), self.m_mutators); s.doValue("m_codeBlocks", offsetof(ShaderProgramBinary, m_codeBlocks), self.m_codeBlocks); s.doValue("m_variants", offsetof(ShaderProgramBinary, m_variants), self.m_variants); s.doValue("m_mutations", offsetof(ShaderProgramBinary, m_mutations), self.m_mutations); s.doValue("m_uniformBlocks", offsetof(ShaderProgramBinary, m_uniformBlocks), self.m_uniformBlocks); s.doValue("m_storageBlocks", offsetof(ShaderProgramBinary, m_storageBlocks), self.m_storageBlocks); s.doPointer("m_pushConstantBlock", offsetof(ShaderProgramBinary, m_pushConstantBlock), self.m_pushConstantBlock); s.doValue("m_opaques", offsetof(ShaderProgramBinary, m_opaques), self.m_opaques); s.doValue("m_constants", offsetof(ShaderProgramBinary, m_constants), self.m_constants); s.doValue("m_structs", offsetof(ShaderProgramBinary, m_structs), self.m_structs); s.doValue("m_presentShaderTypes", offsetof(ShaderProgramBinary, m_presentShaderTypes), self.m_presentShaderTypes); s.doArray("m_libraryName", offsetof(ShaderProgramBinary, m_libraryName), &self.m_libraryName[0], self.m_libraryName.getSize()); s.doValue("m_rayType", offsetof(ShaderProgramBinary, m_rayType), self.m_rayType); } template void deserialize(TDeserializer& deserializer) { serializeCommon(deserializer, *this); } template void serialize(TSerializer& serializer) const { serializeCommon(serializer, *this); } }; } // end namespace anki