/**
* @project: orhi (OpenRHI)
* @author: Adrien Givry
* @licence: MIT
*/

#pragma once

#include <orhi/utils/BitmaskOperators.h>

#include <cstdint>

namespace orhi::types
{
	/**
	* @brief Pipeline stage flags enumeration for synchronization and barriers
	* 
	* Defines pipeline stages for synchronization operations such as pipeline
	* barriers, memory barriers, and events. These stages represent specific
	* points in the graphics/compute pipeline execution flow.
	*/
	enum class EPipelineStageFlags : uint32_t
	{
		NONE = 0,
		TOP_OF_PIPE_BIT = 0x00000001,
		DRAW_INDIRECT_BIT = 0x00000002,
		VERTEX_INPUT_BIT = 0x00000004,
		VERTEX_SHADER_BIT = 0x00000008,
		TESSELLATION_CONTROL_SHADER_BIT = 0x00000010,
		TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020,
		GEOMETRY_SHADER_BIT = 0x00000040,
		FRAGMENT_SHADER_BIT = 0x00000080,
		EARLY_FRAGMENT_TESTS_BIT = 0x00000100,
		LATE_FRAGMENT_TESTS_BIT = 0x00000200,
		COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400,
		COMPUTE_SHADER_BIT = 0x00000800,
		TRANSFER_BIT = 0x00001000,
		BOTTOM_OF_PIPE_BIT = 0x00002000,
		HOST_BIT = 0x00004000,
		ALL_GRAPHICS_BIT = 0x00008000,
		ALL_COMMANDS_BIT = 0x00010000,
		// Extension stage flags
		TRANSFORM_FEEDBACK_BIT_EXT = 0x01000000,
		CONDITIONAL_RENDERING_BIT_EXT = 0x00040000,
		ACCELERATION_STRUCTURE_BUILD_BIT_KHR = 0x02000000,
		RAY_TRACING_SHADER_BIT_KHR = 0x00200000,
		TASK_SHADER_BIT_EXT = 0x00080000,
		MESH_SHADER_BIT_EXT = 0x00100000,
		FRAGMENT_DENSITY_PROCESS_BIT_EXT = 0x00800000,
		FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00400000,
		COMMAND_PREPROCESS_BIT_EXT = 0x00020000,
		// Aliases for backwards compatibility
		SHADING_RATE_IMAGE_BIT_NV = FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR,
		RAY_TRACING_SHADER_BIT_NV = RAY_TRACING_SHADER_BIT_KHR,
		ACCELERATION_STRUCTURE_BUILD_BIT_NV = ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
		TASK_SHADER_BIT_NV = TASK_SHADER_BIT_EXT,
		MESH_SHADER_BIT_NV = MESH_SHADER_BIT_EXT,
		ALL = ~NONE,
	};
}

ENABLE_BITMASK_OPERATORS(orhi::types::EPipelineStageFlags);
