/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
ms9
Code/Engine/RendererFoundation/RendererFoundationDLL.h
432 строки
8 KB
jankrassnigg
Renamed lots of Basics.h and Plugin.h files to "LibNameDLL.h"
07 фев 2019, 15:31
07 фев 2019, 15:31
1cf6490
Код
Авторство
О чём код?
#pragma once #include <Foundation/Basics.h> #include <Foundation/Types/Id.h> #include <Foundation/Types/RefCounted.h> #include <Foundation/Reflection/Reflection.h> // Configure the DLL Import/Export Define #if EZ_ENABLED(EZ_COMPILE_ENGINE_AS_DLL) #ifdef BUILDSYSTEM_BUILDING_RENDERERFOUNDATION_LIB #define EZ_RENDERERFOUNDATION_DLL __declspec(dllexport) #else #define EZ_RENDERERFOUNDATION_DLL __declspec(dllimport) #endif #else #define EZ_RENDERERFOUNDATION_DLL #endif // Necessary array sizes #define EZ_GAL_MAX_CONSTANT_BUFFER_COUNT 16 #define EZ_GAL_MAX_SHADER_RESOURCE_VIEW_COUNT 16 #define EZ_GAL_MAX_VERTEX_BUFFER_COUNT 16 #define EZ_GAL_MAX_RENDERTARGET_COUNT 8 // Forward declarations struct ezGALDeviceCreationDescription; struct ezGALSwapChainCreationDescription; struct ezGALShaderCreationDescription; struct ezGALTextureCreationDescription; struct ezGALBufferCreationDescription; struct ezGALDepthStencilStateCreationDescription; struct ezGALBlendStateCreationDescription; struct ezGALRasterizerStateCreationDescription; struct ezGALVertexDeclarationCreationDescription; struct ezGALQueryCreationDescription; struct ezGALSamplerStateCreationDescription; struct ezGALResourceViewCreationDescription; struct ezGALRenderTargetViewCreationDescription; struct ezGALUnorderedAccessViewCreationDescription; class ezGALSwapChain; class ezGALShader; class ezGALResourceBase; class ezGALTexture; class ezGALBuffer; class ezGALDepthStencilState; class ezGALBlendState; class ezGALRasterizerState; class ezGALRenderTargetSetup; class ezGALVertexDeclaration; class ezGALFence; class ezGALQuery; class ezGALSamplerState; class ezGALResourceView; class ezGALRenderTargetView; class ezGALUnorderedAccessView; class ezGALDevice; class ezGALContext; // Basic enums struct ezGALPrimitiveTopology { enum Enum { // keep this order, it is used to allocate the desired number of indices in ezMeshBufferResourceDescriptor::AllocateStreams Points, // 1 index per primitive Lines, // 2 indices per primitive Triangles, // 3 indices per primitive ENUM_COUNT }; static ezUInt32 VerticesPerPrimitive(ezGALPrimitiveTopology::Enum e) { return (ezUInt32)e + 1; } }; struct EZ_RENDERERFOUNDATION_DLL ezGALIndexType { enum Enum { UShort, UInt, ENUM_COUNT }; /// \brief The size in bytes of a single element of the given index format. static ezUInt8 GetSize(ezGALIndexType::Enum format) { return Size[format]; } private: static const ezUInt8 Size[ezGALIndexType::ENUM_COUNT]; }; struct EZ_RENDERERFOUNDATION_DLL ezGALShaderStage { enum Enum { VertexShader, HullShader, DomainShader, GeometryShader, PixelShader, ComputeShader, ENUM_COUNT }; static const char* Names[ENUM_COUNT]; }; struct EZ_RENDERERFOUNDATION_DLL ezGALMSAASampleCount { typedef ezUInt8 StorageType; enum Enum { None = 1, TwoSamples = 2, FourSamples = 4, EightSamples = 8, ENUM_COUNT = 4, Default = None }; }; EZ_DECLARE_REFLECTABLE_TYPE(EZ_RENDERERFOUNDATION_DLL, ezGALMSAASampleCount); struct ezGALTextureType { enum Enum { Invalid = -1, Texture2D = 0, TextureCube, Texture3D, ENUM_COUNT }; }; struct ezGALBlend { enum Enum { Zero = 0, One, SrcColor, InvSrcColor, SrcAlpha, InvSrcAlpha, DestAlpha, InvDestAlpha, DestColor, InvDestColor, SrcAlphaSaturated, BlendFactor, InvBlendFactor, ENUM_COUNT }; }; struct ezGALBlendOp { enum Enum { Add = 0, Subtract, RevSubtract, Min, Max, ENUM_COUNT }; }; struct ezGALStencilOp { enum Enum { Keep = 0, Zero, Replace, IncrementSaturated, DecrementSaturated, Invert, Increment, Decrement, ENUM_COUNT }; }; struct ezGALCompareFunc { enum Enum { Never = 0, Less, Equal, LessEqual, Greater, NotEqual, GreaterEqual, Always, ENUM_COUNT }; }; /// \brief Defines which sides of a polygon gets culled by the graphics card struct ezGALCullMode { /// \brief Defines which sides of a polygon gets culled by the graphics card enum Enum { None = 0, ///< Triangles do not get culled Front = 1, ///< When the 'front' of a triangle is visible, it gets culled. The rasterizer state defines which side is the 'front'. See ezGALRasterizerStateCreationDescription for details. Back = 2, ///< When the 'back' of a triangle is visible, it gets culled. The rasterizer state defines which side is the 'front'. See ezGALRasterizerStateCreationDescription for details. ENUM_COUNT }; }; struct ezGALTextureFilterMode { typedef ezUInt8 StorageType; enum Enum { Point = 0, Linear, Anisotropic, Default = Linear }; }; struct ezGALUpdateMode { enum Enum { Discard, NoOverwrite, CopyToTempStorage }; }; // Basic structs struct ezGALTextureSubresource { ezUInt32 m_uiMipLevel = 0; ezUInt32 m_uiArraySlice = 0; }; struct ezGALSystemMemoryDescription { void* m_pData = nullptr; ezUInt32 m_uiRowPitch = 0; ezUInt32 m_uiSlicePitch = 0; }; /// \brief Base class for GAL objects, stores a creation description of the object and also allows for reference counting. template<typename CreationDescription> class ezGALObject : public ezRefCounted { public: ezGALObject(const CreationDescription& Description) : m_Description(Description) { } EZ_ALWAYS_INLINE const CreationDescription& GetDescription() const { return m_Description; } protected: const CreationDescription m_Description; }; // Handles namespace ezGAL { typedef ezGenericId<16, 16> ez16_16Id; typedef ezGenericId<18, 14> ez18_14Id; typedef ezGenericId<20, 12> ez20_12Id; } class ezGALSwapChainHandle { EZ_DECLARE_HANDLE_TYPE(ezGALSwapChainHandle, ezGAL::ez16_16Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALShaderHandle { EZ_DECLARE_HANDLE_TYPE(ezGALShaderHandle, ezGAL::ez18_14Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALTextureHandle { EZ_DECLARE_HANDLE_TYPE(ezGALTextureHandle, ezGAL::ez18_14Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALBufferHandle { EZ_DECLARE_HANDLE_TYPE(ezGALBufferHandle, ezGAL::ez18_14Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALResourceViewHandle { EZ_DECLARE_HANDLE_TYPE(ezGALResourceViewHandle, ezGAL::ez18_14Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALUnorderedAccessViewHandle { EZ_DECLARE_HANDLE_TYPE(ezGALUnorderedAccessViewHandle, ezGAL::ez18_14Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALRenderTargetViewHandle { EZ_DECLARE_HANDLE_TYPE(ezGALRenderTargetViewHandle, ezGAL::ez18_14Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALDepthStencilStateHandle { EZ_DECLARE_HANDLE_TYPE(ezGALDepthStencilStateHandle, ezGAL::ez16_16Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALBlendStateHandle { EZ_DECLARE_HANDLE_TYPE(ezGALBlendStateHandle, ezGAL::ez16_16Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALRasterizerStateHandle { EZ_DECLARE_HANDLE_TYPE(ezGALRasterizerStateHandle, ezGAL::ez16_16Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALSamplerStateHandle { EZ_DECLARE_HANDLE_TYPE(ezGALSamplerStateHandle, ezGAL::ez16_16Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALVertexDeclarationHandle { EZ_DECLARE_HANDLE_TYPE(ezGALVertexDeclarationHandle, ezGAL::ez18_14Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALFenceHandle { EZ_DECLARE_HANDLE_TYPE(ezGALFenceHandle, ezGAL::ez20_12Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; class ezGALQueryHandle { EZ_DECLARE_HANDLE_TYPE(ezGALQueryHandle, ezGAL::ez20_12Id); friend class ezGALDevice; friend struct ezGALContextState; friend class ezGALContext; }; struct ezGALTimestampHandle { EZ_DECLARE_POD_TYPE(); ezUInt64 m_uiIndex; ezUInt64 m_uiFrameCounter; };