// Generated by ShaderCompiler. Do not edit manually.
// Shared reflection types included by every generated shader artifact header.
#pragma once

#include <cstddef>
#include <cstdint>

#ifndef SHADERCOMPILER_REFLECTION_TYPES
#define SHADERCOMPILER_REFLECTION_TYPES

namespace ShaderCompiler
{
	// Scalar/vector/matrix/opaque type of a uniform, block member or vertex attribute
	enum class UniformType : std::uint8_t
	{
		Float, Int, UInt, Bool,
		Vec2, Vec3, Vec4,
		IVec2, IVec3, IVec4,
		UVec2, UVec3, UVec4,
		BVec2, BVec3, BVec4,
		Mat2, Mat3, Mat4,
		Sampler2D, Sampler3D, SamplerCube,
		Struct
	};

	// ArraySize value marking an array sized by the symbolic BATCH_SIZE constant
	inline constexpr std::uint16_t SymbolicArraySize = 0xFFFFu;

	// Loose (non-block, non-sampler) uniform
	struct Uniform
	{
		const char* Name;
		UniformType Type;
		std::uint16_t ArraySize;		// 0 = not an array
	};

	// Member of a std140 uniform block
	struct BlockMember
	{
		const char* Name;
		UniformType Type;
		std::uint16_t ArraySize;		// 0 = not an array, SymbolicArraySize = BATCH_SIZE-sized
		std::uint32_t Offset;			// std140 offset from the start of the block
	};

	// std140 uniform block
	struct UniformBlock
	{
		const char* Name;
		std::uint32_t BaseSize;			// std140 size covering everything except symbolic arrays
		std::uint32_t InstanceStride;	// std140 element stride of the BATCH_SIZE-sized array (0 if none);
										// the runtime computes the batch size as maxUniformBlockSize / InstanceStride
		std::size_t MemberCount;
		const BlockMember* Members;
	};

	// Sampler uniform with its assigned texture unit
	struct TextureBinding
	{
		const char* Name;
		std::int32_t Unit;				// -1 = not assigned
	};

	// Vertex attribute
	struct Attribute
	{
		const char* Name;
		UniformType Type;
		std::int32_t Location;			// -1 = unspecified
	};

	// "render_mode" flags carried on Program (bitmask; 0 when no render_mode is declared)
	enum class RenderMode : std::uint32_t
	{
		BlendMix = 0x01,
		BlendAdd = 0x02,
		BlendSub = 0x04,
		BlendMul = 0x08,
		BlendPremulAlpha = 0x10,
		Unshaded = 0x20
	};

	// One compiled variant of a program
	struct ProgramVariant
	{
		const char* Name;				// "" for the base variant, otherwise the variant name
		const char* Defines;			// "" or the name of the baked "#define <NAME> (1)"
		const char* VsSource;
		const char* FsSource;
		std::size_t UniformCount;
		const Uniform* Uniforms;
		std::size_t BlockCount;
		const UniformBlock* Blocks;
		std::size_t TextureCount;
		const TextureBinding* Textures;
		std::size_t AttributeCount;
		const Attribute* Attributes;
		// OpenGL|ES 2.0 (ESSL 100) stage sources: the Essl100Emitter lowering of VsSource/FsSource — no
		// UBOs (std140 blocks become loose uniforms / a uniform struct-array) and no gl_VertexID (the quad
		// corner and the batched instance index become the aQuadCorner / aInstanceIndex vertex attributes).
		// Consumed under RHI_GL_PROFILE_ES2 with "#version 100"; the GL 3.3 / ES 3.0 path ignores these and
		// uses VsSource/FsSource. Null when the ES2 lowering was not available (e.g. runtime-compiled shaders).
		const char* VsSource100;
		const char* FsSource100;
		// Direct3D 11 (HLSL, Shader Model 4/5) stage sources: the HlslEmitter lowering of VsSource/FsSource —
		// VSMain/PSMain entry points, std140 blocks as cbuffers, separate Texture2D + SamplerState objects and
		// mul()-based matrix algebra. Consumed by the D3D11 backend; GL/ES/software ignore these.
		// Null when the HLSL lowering was not available (a construct outside the emitter's subset) — or when
		// the stages were precompiled to DXBC below (the blob replaces the text in the binary).
		const char* HlslVsSource;
		const char* HlslFsSource;
		// Direct3D 11 precompiled DXBC bytecode: the HLSL lowering of both stages compiled offline through
		// d3dcompiler_47 (VSMain/PSMain, vs_4_0/ps_4_0, column-major matrix packing — the same contract the
		// backend's runtime compilation uses), so the D3D11 backend (desktop and UWP/Xbox alike) creates its
		// shader objects straight from these blobs with no runtime D3DCompile and no on-disk cache. Emitted
		// all-or-nothing per variant: when present (both stages), HlslVsSource/HlslFsSource are null; null/0
		// when d3dcompiler_47 was unavailable at generation time, a stage failed to compile or the shader is
		// runtime-compiled — the backend then falls back to runtime-compiling the HLSL sources above.
		const std::uint8_t* HlslVsDxbc;
		std::size_t HlslVsDxbcSize;
		const std::uint8_t* HlslFsDxbc;
		std::size_t HlslFsDxbcSize;
		// Vulkan (SPIR-V) stage modules: the VulkanGlslEmitter lowering of VsSource/FsSource ("#version 450",
		// explicit set/binding + location decorations, gathered "_Globals" UBO, gl_VertexIndex) compiled offline
		// through glslang to SPIR-V words. Consumed by the Vulkan backend, which builds pipelines
		// straight from these and the descriptor-set layout from the same reflection; other backends ignore them.
		// Null/0 when glslang was unavailable at generation time or the shader is runtime-compiled (the Vulkan
		// backend is then not buildable / falls back). Sizes are the number of 32-bit SPIR-V words.
		const std::uint32_t* VkVsSpirv;
		std::size_t VkVsSpirvSize;
		const std::uint32_t* VkFsSpirv;
		std::size_t VkFsSpirvSize;
	};

	// A shader program with all of its variants (Variants[0] is always the base variant, whose Name is "")
	struct Program
	{
		const char* Name;
		std::uint32_t RenderModes;		// Bitmask of RenderMode flags (0 when no render_mode is declared)
		std::size_t VariantCount;
		const ProgramVariant* Variants;
	};
}

#endif
