// Copyright (c) Wojciech Figat. All rights reserved.
#pragma once
#include "PixelFormat.h"
#include "Enums.h"
///
/// Which resources are supported for a given format and given device.
///
API_ENUM(Attributes="Flags") enum class FormatSupport : uint64
{
///
/// No features supported.
///
None = 0x0,
///
/// Buffer resources supported.
///
Buffer = 0x1,
///
/// Vertex buffers supported.
///
VertexBuffer = 0x2,
///
/// Vertex buffers supported.
/// [Deprecated in 1.12]
///
InputAssemblyVertexBuffer = 2,
///
/// Index buffers supported.
///
IndexBuffer = 0x4,
///
/// Index buffers supported.
/// [Deprecated in 1.12]
///
InputAssemblyIndexBuffer = 4,
///
/// Streaming output buffers supported.
///
StreamOutputBuffer = 0x8,
///
/// 1D texture resources supported.
///
Texture1D = 0x10,
///
/// 2D texture resources supported.
///
Texture2D = 0x20,
///
/// 3D texture resources supported.
///
Texture3D = 0x40,
///
/// Cube texture resources supported.
///
TextureCube = 0x80,
///
/// The shader Load function for texture objects is supported.
///
ShaderLoad = 0x100,
///
/// The shader Sample function for texture objects is supported.
///
ShaderSample = 0x200,
///
/// The shader SampleCmp and SampleCmpLevelZero functions for texture objects are supported.
///
ShaderSampleComparison = 0x400,
///
/// Unused.
/// [Deprecated in 1.12]
///
ShaderSampleMonoText = 2048,
///
/// Mipmaps are supported.
///
Mip = 0x1000,
///
/// Automatic generation of mipmaps is supported.
/// [Deprecated in 1.12]
///
MipAutogen = 8192,
///
/// Render targets are supported.
///
RenderTarget = 0x4000,
///
/// Blend operations supported.
///
Blendable = 0x8000,
///
/// Depth stencils supported.
///
DepthStencil = 0x10000,
///
/// CPU locking supported.
///
CpuLockable = 131072,
///
/// Multisample antialiasing (MSAA) resolve operations are supported.
///
MultisampleResolve = 0x40000,
///
/// Format can be displayed on screen.
///
Display = 0x80000,
///
/// Format can't be cast to another format.
///
CastWithinBitLayout = 0x100000,
///
/// Format can be used as a multi-sampled render target.
///
MultisampleRenderTarget = 0x200000,
///
/// Format can be used as a multi-sampled texture and read into a shader with the shader Load function.
///
MultisampleLoad = 0x400000,
///
/// Format can be used with the shader gather function.
///
ShaderGather = 0x800000,
///
/// Format supports casting when the resource is a back buffer.
///
BackBufferCast = 0x1000000,
///
/// Format can be used for an unordered access view.
///
TypedUnorderedAccessView = 0x2000000,
///
/// Format can be used with the shader gather with comparison function.
///
ShaderGatherComparison = 0x4000000,
///
/// Format can be used with the decoder output.
///
DecoderOutput = 0x8000000,
///
/// Format can be used with the video processor output.
///
VideoProcessorOutput = 0x10000000,
///
/// Format can be used with the video processor input.
///
VideoProcessorInput = 0x20000000,
///
/// Format can be used with the video encoder.
///
VideoEncoder = 0x40000000,
///
/// Format can be used as unorder access resource for read-only operations (shader load).
///
UnorderedAccessReadOnly = 0x80000000,
///
/// Format can be used as unorder access resource for write-only operations (shader store).
///
UnorderedAccessWriteOnly = 0x100000000,
///
/// Format can be used as unorder access resource for both read-write operations (shader load and store).
///
UnorderedAccessReadWrite = 0x200000000,
///
/// Format can be used as unorder access resource for read/write operations.
///
UnorderedAccess = UnorderedAccessReadOnly | UnorderedAccessWriteOnly | UnorderedAccessReadWrite,
};
DECLARE_ENUM_OPERATORS(FormatSupport);
///
/// The features exposed for a particular format.
///
API_STRUCT(NoDefault) struct FormatFeatures
{
DECLARE_SCRIPTING_TYPE_MINIMAL(FormatFeatures);
///
/// Gets the maximum MSAA sample count for a particular .
///
API_FIELD() MSAALevel MSAALevelMax;
///
/// Support of a given format on the installed video device.
///
API_FIELD() FormatSupport Support;
FormatFeatures()
{
}
///
/// Initializes a new instance of the struct.
/// [Deprecated in v1.12]
///
/// The format.
/// The MSAA level maximum.
/// The format support.
DEPRECATED("Skip format argument as it's unsued.") FormatFeatures(const PixelFormat format, MSAALevel msaaLevelMax, FormatSupport formatSupport)
: MSAALevelMax(msaaLevelMax)
, Support(formatSupport)
{
}
///
/// Initializes a new instance of the struct.
///
/// The MSAA level maximum.
/// The format support.
FormatFeatures(MSAALevel msaaLevelMax, FormatSupport formatSupport)
: MSAALevelMax(msaaLevelMax)
, Support(formatSupport)
{
}
};
///
/// Graphics Device limits and constraints descriptor.
///
API_STRUCT(NoDefault) struct GPULimits
{
DECLARE_SCRIPTING_TYPE_MINIMAL(GPULimits);
///
/// True if device supports Compute shaders.
///
API_FIELD() bool HasCompute = false;
///
/// True if device supports Tessellation shaders (domain and hull shaders).
///
API_FIELD() bool HasTessellation = false;
///
/// True if device supports Geometry shaders.
///
API_FIELD() bool HasGeometryShaders = false;
///
/// True if device supports hardware geometry instancing.
///
API_FIELD() bool HasInstancing = false;
///
/// True if device supports rendering to volume textures using Geometry shaders.
///
API_FIELD() bool HasVolumeTextureRendering = false;
///
/// True if device supports indirect drawing (including pixel shader write to UAV).
///
API_FIELD() bool HasDrawIndirect = false;
///
/// True if device supports append/consume buffers with counters.
///
API_FIELD() bool HasAppendConsumeBuffers = false;
///
/// True if device supports separate render target blending states.
/// [Deprecated in v1.12]
///
API_FIELD() DEPRECATED() bool HasSeparateRenderTargetBlendState = false;
///
/// True if device supports depth buffer texture as a shader resource view.
///
API_FIELD() bool HasDepthAsSRV = false;
///
/// True if device supports depth buffer clipping (see GPUPipelineState::Description::DepthClipEnable).
///
API_FIELD() bool HasDepthClip = false;
///
/// True if device supports depth buffer bounds testing (see GPUPipelineState::Description::DepthBoundsEnable and GPUContext::SetDepthBounds).
///
API_FIELD() bool HasDepthBounds = false;
///
/// True if device supports depth buffer texture as a readonly depth buffer (can be sampled in the shader while performing depth-test).
///
API_FIELD() bool HasReadOnlyDepth = false;
///
/// True if device supports multisampled depth buffer texture as a shader resource view.
/// [Deprecated in v1.12]
///
API_FIELD() DEPRECATED() bool HasMultisampleDepthAsSRV = false;
///
/// True if device supports reading from typed UAV in shader (common types such as R32G32B32A32, R16G16B16A16, R16, R8). This doesn't apply to single-component 32-bit formats.
///
API_FIELD() bool HasTypedUAVLoad = false;
///
/// The maximum amount of texture mip levels.
///
API_FIELD() int32 MaximumMipLevelsCount = 1;
///
/// The maximum size of the 1D texture.
///
API_FIELD() int32 MaximumTexture1DSize = 0;
///
/// The maximum length of 1D textures array.
///
API_FIELD() int32 MaximumTexture1DArraySize = 0;
///
/// The maximum size of the 2D texture.
///
API_FIELD() int32 MaximumTexture2DSize = 0;
///
/// The maximum length of 2D textures array.
///
API_FIELD() int32 MaximumTexture2DArraySize = 0;
///
/// The maximum size of the 3D texture.
///
API_FIELD() int32 MaximumTexture3DSize = 0;
///
/// The maximum size of the cube texture (both width and height).
///
API_FIELD() int32 MaximumTextureCubeSize = 0;
///
/// The maximum degree of anisotropic filtering used for texture sampling.
///
API_FIELD() float MaximumSamplerAnisotropy = 1.0f;
};