Class RendererAPI#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Derived Type#

Class Documentation#

class RendererAPI#

Subclassed by TRAP::Graphics::API::VulkanRenderer

Public Types

enum class WaveOpsSupportFlags : u32#

Enum bit flag for the different wave operations.

Values:

enumerator None#
enumerator Basic#
enumerator Vote#
enumerator Arithmetic#
enumerator Ballot#
enumerator Shuffle#
enumerator ShuffleRelative#
enumerator Clustered#
enumerator Quad#
enumerator PartitionedNV#
enum class QueueType : u32#

Enum describing the different types of queues.

Values:

enumerator Graphics#
enumerator Transfer#
enumerator Compute#
enum class QueueFlag : u32#

Enum describing queue flags.

Values:

enumerator None#
enumerator DisableGPUTimeout#
enum class QueuePriority#

Enum describing the different priorities for a queue (DirectX 12).

Values:

enumerator Normal#
enumerator High#
enumerator GlobalRealtime#
enum class FenceStatus#

Enum describing the status of a fence.

Values:

enumerator Complete#
enumerator Incomplete#
enumerator NotSubmitted#
enum class LoadActionType : u32#

Enum describing the different types of load actions.

Values:

enumerator DontCare#
enumerator Load#
enumerator Clear#
enum class StoreActionType : u32#

Enum describing the different types of store actions.

Values:

enumerator Store#
enumerator DontCare#
enumerator None#
enum class TextureCubeType#

Enum describing the different types of cube textures.

Values:

enumerator Cross#
enum class SampleCount#

Enum describing the different sample counts.

Values:

enumerator One#
enumerator Two#
enumerator Four#
enumerator Eight#
enumerator Sixteen#
enum class AntiAliasing#

Enum describing the different anti aliasing methods.

Values:

enumerator Off#
enumerator MSAA#
enum class GPUVendor : i32#

Enum describing the different GPU vendors.

Values:

enumerator Unknown#
enumerator AMD#
enumerator ImgTec#
enumerator NVIDIA#
enumerator ARM#
enumerator Broadcom#
enumerator Qualcomm#
enumerator Intel#
enumerator Apple#
enumerator Vivante#
enumerator VeriSilicon#
enumerator Kazan#
enumerator Codeplay#
enumerator Mesa#
enum class TextureCreationFlags : u32#

Enum bit flags used by texture creation.

Values:

enumerator None#
enumerator OwnMemory#
enumerator OnTile#
enumerator Force2D#
enumerator Force3D#
enumerator AllowDisplayTarget#
enumerator SRGB#
enumerator NormalMap#
enumerator FastClear#
enumerator FragMask#
enumerator Storage#
enum class ResourceState : u32#

Enum describing the state of a resource.

Values:

enumerator Undefined#
enumerator VertexAndConstantBuffer#
enumerator IndexBuffer#
enumerator RenderTarget#
enumerator UnorderedAccess#
enumerator DepthWrite#
enumerator DepthRead#
enumerator NonPixelShaderResource#
enumerator PixelShaderResource#
enumerator ShaderResource#
enumerator StreamOut#
enumerator IndirectArgument#
enumerator CopyDestination#
enumerator CopySource#
enumerator GenericRead#
enumerator Present#
enumerator Common#
enumerator RayTracingAccelerationStructure#
enumerator ShadingRateSource#
enum class DescriptorType : u32#

Enum describing the type of a descriptor.

Values:

enumerator Undefined#
enumerator Sampler#
enumerator Texture#
enumerator RWTexture#
enumerator Buffer#
enumerator BufferRaw#
enumerator RWBuffer#
enumerator RWBufferRaw#
enumerator UniformBuffer#
enumerator RootConstant#
enumerator VertexBuffer#
enumerator IndexBuffer#
enumerator IndirectBuffer#
enumerator TextureCube#
enumerator RenderTargetMipSlices#
enumerator RenderTargetArraySlices#
enumerator RenderTargetDepthSlices#
enumerator RayTracing#
enumerator InputAttachment#
enumerator TexelBuffer#
enumerator RWTexelBuffer#
enumerator CombinedImageSampler#
enumerator AccelerationStructure#
enumerator AccelerationStructureBuildInput#
enumerator ShaderDeviceAddress#
enumerator ShaderBindingTable#
enum class ResourceMemoryUsage#

Enum describing the different memory usage types for a resource.

Values:

enumerator Unknown#
enumerator GPUOnly#
enumerator CPUOnly#
enumerator CPUToGPU#
enumerator GPUToCPU#
enum class BufferCreationFlags : u32#

Enum describing flags for the buffer creation.

Values:

enumerator None#
enumerator OwnMemory#
enumerator PersistentMap#
enumerator ESRAM#
enumerator NoDescriptorViewCreation#
enumerator HostVisible#
enumerator HostCoherent#
enum class ClearBufferType : u32#

Enum describing the different types of buffers for clearing.

Values:

enumerator Color#
enumerator Depth#
enumerator Stencil#
enumerator Color_Depth#
enumerator Color_Stencil#
enumerator Color_Depth_Stencil#
enumerator Depth_Stencil#
enum class LatencyMode : u32#

Enum describing the different latency modes.

Remark

Headless mode: This function is not available in headless mode.

Values:

enumerator Disabled#
enumerator Enabled#
enumerator EnabledBoost#
enum class IndirectArgumentType#

Enum describing the type of an indirect argument.

Values:

enumerator IndirectDraw#
enumerator IndirectDrawIndex#
enumerator IndirectDispatch#
enumerator IndirectVertexBuffer#
enumerator IndirectIndexBuffer#
enumerator IndirectConstant#
enumerator IndirectDescriptorTable#
enumerator IndirectPipeline#
enum class DescriptorUpdateFrequency : u32#

Enum describing the update frequency of a descriptor.

Note

: The same update frequency order should be used by shaders.

Values:

enumerator Static#
enumerator Dynamic#
enum class FilterType#

Enum describing the different types of filtering used by samplers.

Values:

enumerator Nearest#
enumerator Linear#
enum class MipMapMode#

Enum describing the different modes of mip mapping used by samplers.

Values:

enumerator Nearest#
enumerator Linear#
enum class AddressMode#

Enum describing the different address modes used by samplers.

Values:

enumerator Mirror#
enumerator Repeat#
enumerator ClampToEdge#
enumerator ClampToBorder#
enum class CompareMode : u32#

Enum describing the different compare modes used by depth/stencil testing and samplers.

Values:

enumerator Never#
enumerator Less#
enumerator Equal#
enumerator LessOrEqual#
enumerator Greater#
enumerator NotEqual#
enumerator GreaterOrEqual#
enumerator Always#
enum class ShaderStage : u32#

Enum describing the different shader stages making up a shader.

Values:

enumerator None#
enumerator Vertex#
enumerator TessellationControl#
enumerator TessellationEvaluation#
enumerator Geometry#
enumerator Fragment#
enumerator Compute#
enumerator RayTracing#
enumerator AllGraphics#
enumerator Hull#
enumerator Domain#
enumerator Pixel#
enum class ShaderType#

Enum describing the overall type of a shader.

Values:

enumerator Graphics#
enumerator Compute#
enum class RootSignatureFlags : u32#

Enum describing the different flags for root signature creation.

Values:

enumerator None#
enumerator Local#
enum class PipelineType : u32#

Enum describing the different pipeline types.

Values:

enumerator Compute#
enumerator Graphics#
enumerator RayTracing#
enum class IndexType#

Enum describing the different data types used by index buffers.

Values:

enumerator UInt32#
enumerator UInt16#
enum class BlendConstant : u32#

Enum describing the different blend constants used for blending.

Values:

enumerator Zero#
enumerator One#
enumerator SrcColor#
enumerator OneMinusSrcColor#
enumerator DstColor#
enumerator OneMinusDstColor#
enumerator SrcAlpha#
enumerator OneMinusSrcAlpha#
enumerator DstAlpha#
enumerator OneMinusDstAlpha#
enumerator SrcAlphaSaturate#
enumerator BlendFactor#
enumerator OneMinusBlendFactor#
enum class BlendMode : u32#

Enum describing the different blend modes/functions used for blending.

Values:

enumerator Add#
enumerator Subtract#
enumerator ReverseSubtract#
enumerator Min#
enumerator Max#
enum class BlendStateTargets : u32#

Enum describing which render target to affect with the blend state.

Values:

enumerator BlendStateTarget0#
enumerator BlendStateTarget1#
enumerator BlendStateTarget2#
enumerator BlendStateTarget3#
enumerator BlendStateTarget4#
enumerator BlendStateTarget5#
enumerator BlendStateTarget6#
enumerator BlendStateTarget7#
enumerator BlendStateTargetAll#
enum class StencilOp : u32#

Enum describing the different stencil/depth operations.

Values:

enumerator Keep#
enumerator SetZero#
enumerator Replace#
enumerator Invert#
enumerator Increment#
enumerator Decrement#
enumerator IncrementSaturation#
enumerator DecrementSaturation#
enum class CullMode : u32#

Enum describing the different cull modes.

Values:

enumerator None#
enumerator Back#
enumerator Front#
enumerator Both#
enum class FrontFace : u32#

Enum describing the different front face winding orders.

Values:

enumerator CounterClockwise#
enumerator Clockwise#
enum class FillMode : u32#

Enum describing the different fill modes.

Values:

enumerator Solid#
enumerator Line#
enumerator Point#
enum class PipelineCacheFlags : u32#

Enum describing flags for pipeline cache creation.

Values:

enumerator None#
enumerator ExternallySynchronized#
enum class PrimitiveTopology#

Enum describing the different primitive topologies.

Values:

enumerator PointList#
enumerator LineList#
enumerator LineStrip#
enumerator TriangleList#
enumerator TriangleStrip#
enumerator PatchList#
enum class VertexAttributeRate#

Enum describing the different vertex attribute rates.

Values:

enumerator Vertex#
enumerator Instance#
enum class QueryType#

Enum describing the different types of queries.

Values:

enumerator Timestamp#
enumerator PipelineStatistics#
enumerator Occlusion#
enum class PresentStatus#

Enum describing the different presentation statuses.

Values:

enumerator Success#
enumerator DeviceReset#
enumerator Failed#
enumerator OutOfDate#
enum class SamplerRange#

Enum describing the different sampler ranges used by YUV conversion samplers.

Values:

enumerator Full#
enumerator Narrow#
enum class SamplerModelConversion#

Enum describing the different sampler models used by YUV conversion samplers.

Values:

enumerator RGBIdentity#
enumerator YCBCRIdentity#
enumerator YCBCR709#
enumerator YCBCR601#
enumerator YCBCR2020#
enum class SampleLocation#

Enum describing the different sample locations used by YUV conversion samplers.

Values:

enumerator Cosited#
enumerator Midpoint#
enum class ShadingRate : u32#

Enum describing the shading rates used by fragment/pixel shaders.

Values:

enumerator NotSupported#
enumerator Full#
enumerator Half#
enumerator Quarter#
enumerator Eighth#
enumerator OneXTwo#
enumerator TwoXOne#
enumerator TwoXFour#
enumerator FourXTwo#
enum class ShadingRateCombiner : u32#

Enum describing how to combine different shading rates.

Values:

enumerator Passthrough#
enumerator Override#
enumerator Min#
enumerator Max#
enumerator Sum#
enum class ShadingRateCaps : u32#

Enum describing the shading rate capabilities supported by the GPU.

Values:

enumerator NotSupported#
enumerator PerDraw#
enumerator PerTile#
enumerator PerPrimitive#
enum class CommandPoolCreateFlags : u32#

Enum describing flags that change the behaviour of a command pool.

Values:

enumerator None#
enumerator Transient#
enumerator ResetCommandBuffer#
enum class MappedRangeFlags : u32#

Values:

enumerator None#
enumerator UnMapBuffer#
enumerator TempBuffer#
enum class PerWindowState#

Values:

enumerator PreUpdate#
enumerator PostUpdate#
using ClearValue = std::variant<Color, DepthStencil>#
using DescriptorResource = std::variant<std::vector<const TRAP::Graphics::Texture*>, std::vector<const Sampler*>, std::vector<const Buffer*>, std::vector<Pipeline*>, std::vector<DescriptorSet*>>#
using DescriptorIndexMap = TRAP::Utils::UnorderedStringMap<u32>#

Map resolving a name to its descriptor index in a root signature.

Public Functions

virtual constexpr ~RendererAPI() = default#

Destructor.

consteval RendererAPI(const RendererAPI&) noexcept = delete#

Copy constructor.

consteval RendererAPI &operator=(const RendererAPI&) noexcept = delete#

Copy assignment operator.

consteval RendererAPI(RendererAPI&&) noexcept = delete#

Move constructor.

consteval RendererAPI &operator=(RendererAPI&&) noexcept = delete#

Move assignment operator.

virtual void InitInternal(std::string_view gameName) = 0#

Initialize the internal renderer.

Parameters:

gameName – Name of the game.

virtual void Flush(const Window &window) const = 0#

Flush renderer for the given window.

  1. Stops graphics and compute recording.

  2. Submits the graphics and compute commands.

  3. Presents the rendered image to the screen.

  4. Starts graphics and compute recording for the next frame.

    Remark

    Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to flush.

virtual void Dispatch(std::array<u32, 3> workGroupElements, const Window &window) const = 0#

Dispatch to the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • workGroupElements – Number of elements to dispatch for each dimension. The elements are automatically divided by the number of threads in the work group and rounded up.

  • windowWindow to Dispatch.

virtual void SetVSync(bool vsync, const Window &window) const = 0#

Set the VSync state for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • vsync – Enable or disable VSync.

  • windowWindow to set VSync for.

virtual bool GetVSync(const Window &window) const = 0#

Retrieve whether VSync is enabled or not for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to retrieve VSync for.

Returns:

True if VSync is enabled, false otherwise.

virtual void SetRenderScale(f32 scale, const Window &window) const = 0#

Set the render scale for the given window.

defined(TRAP_HEADLESS_MODE) && defined(NVIDIA_REFLEX_AVAILABLE)

Remark

Headless mode: This function is not available in headless mode.

Note

This functon takes effect on the next frame.

Parameters:
  • scale – Render scale value (valid range: 0.5f-1.0f inclusive).

  • windowWindow to set render scale for.

virtual f32 GetRenderScale(const Window &window) const = 0#

Retrieve the used render scale value of the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to retrieve render scale from.

Returns:

Render scale (between 0.5f and 2.0f inclusive).

virtual void SetClearColor(const Color &color, const Window &window) const = 0#

Set the clear color to be used by the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • color – New clear color.

  • windowWindow to set clear color for.

virtual void SetClearDepth(f32 depth, const Window &window) const = 0#

Set the clear depth value to be used by the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • depth – New clear depth value. Must be between 0.0f and 1.0f

  • windowWindow to set clear depth value for.

virtual void SetClearStencil(u32 stencil, const Window &window) const = 0#

Set the clear stencil value to be used by the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • stencil – New clear stencil value.

  • windowWindow to set clear stencil value for.

virtual void SetDepthTesting(bool enabled, const Window &window) const = 0#

Enable or disable depth testing for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • enabled – Enable or disable depth testing.

  • windowWindow to set depth testing for.

virtual void SetDepthWriting(bool enabled, const Window &window) const = 0#

Enable or disable depth writing for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • enabled – Enable or disable depth writing.

  • windowWindow to set depth writing for.

virtual void SetDepthFunction(CompareMode function, const Window &window) const = 0#

Set the depth function for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • function – Function to use for depth testing.

  • windowWindow to set depth function for.

virtual void SetDepthFail(StencilOp front, StencilOp back, const Window &window) const = 0#

Set the depth action to perform when depth testing fails for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • front – Depth action to perform when depth testing fails.

  • back – Depth action to perform when depth testing fails.

  • windowWindow to set the depth fail action for.

virtual void SetDepthBias(i32 depthBias, const Window &window) const = 0#

Set the depth bias (scalar factor to add to each fragments depth value) for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • depthBias – Depth bias.

  • windowWindow to set the depth bias for.

virtual void SetDepthBiasSlopeFactor(f32 factor, const Window &window) const = 0#

Set the depth bias slope factor (scalar factor applied to fragment’s slope in depth bias calculation) for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • factor – Depth bias slope factor.

  • windowWindow to set the depth bias slope factor for.

virtual void SetStencilTesting(bool enabled, const Window &window) const = 0#

Enable or disable stencil testing for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • enabled – Enable or disable stencil testing.

  • windowWindow to set stencil testing for.

virtual void SetStencilFail(StencilOp front, StencilOp back, const Window &window) const = 0#

Set the stencil action to perform when stencil testing fails for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • front – Stencil action to perform when stencil testing fails.

  • back – Stencil action to perform when stencil testing fails.

  • windowWindow to set the stencil fail action for.

virtual void SetStencilPass(StencilOp front, StencilOp back, const Window &window) const = 0#

Set the stencil action to perform when stencil testing passes for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • front – Stencil action to perform when passed.

  • back – Stencil action to perform when passed.

  • windowWindow to set the stencil pass action for.

virtual void SetStencilFunction(CompareMode front, CompareMode back, const Window &window) const = 0#

Set the stencil functions for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • front – Function to use on the front for stencil testing.

  • back – Function to use on the back for stencil testing.

  • windowWindow to set stencil functions for.

virtual void SetStencilMask(u8 read, u8 write, const Window &window) const = 0#

Set the stencil mask for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • read – Select the bits of the stencil values to test.

  • write – Select the bits of the stencil values updated by the stencil test.

  • windowWindow to set stencil mask for.

virtual void SetCullMode(CullMode mode, const Window &window) const = 0#

Set the cull mode for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • mode – Cull mode to use.

  • windowWindow to set cull mode for.

virtual void SetFillMode(FillMode mode, const Window &window) const = 0#

Set the fill mode for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • mode – Fill mode to use.

  • windowWindow to set fill mode for.

virtual void SetPrimitiveTopology(PrimitiveTopology topology, const Window &window) const = 0#

Set the primitive topology for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • topology – Primitive topology to use.

  • windowWindow to set primitive topology for.

virtual void SetFrontFace(FrontFace face, const Window &window) const = 0#

Set the front face winding order for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • face – Front face winding order to use.

  • windowWindow to set front face winding order for.

virtual void SetBlendMode(BlendMode modeRGB, BlendMode modeAlpha, const Window &window) const = 0#

Set the blend mode for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • modeRGB – Blend mode to use for the RGB channels.

  • modeAlpha – Blend mode to use for the alpha channel.

  • windowWindow to set the blend mode for.

virtual void SetBlendConstant(BlendConstant sourceRGB, BlendConstant sourceAlpha, BlendConstant destinationRGB, BlendConstant destinationAlpha, const Window &window) const = 0#

Set the blend constants/factors for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • sourceRGB – Specifies how the red, green, and blue blending factors are computed.

  • sourceAlpha – Specifies how the alpha source blending factor is computed.

  • destinationRGB – Specifies how the red, green, and blue destination blending factors are computed.

  • destinationAlpha – Specified how the alpha destination blending factor is computed.

  • windowWindow to set the blend constants for.

virtual void SetShadingRate(ShadingRate shadingRate, ShadingRateCombiner postRasterizerRate, ShadingRateCombiner finalRate, const Window &window) const = 0#

Set the pipeline fragment shading rate and combiner operation for the command buffer.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • shadingRate – Shading rate to use.

  • postRasterizerRate – Shading rate combiner to use.

  • finalRate – Shading rate combiner to use.

  • windowWindow to set the shading rate for.

virtual void SetShadingRate(Ref<RenderTarget> texture, const Window &window) const = 0#

Set the pipeline fragment shading rate via texture.

Remark

Headless mode: This function is not available in headless mode.

Note

The texture must be in ResourceState::ShadingRateSource resource state.

Parameters:
  • texture – Shading rate texture to use.

  • windowWindow to set shading rate for.

virtual void Clear(ClearBufferType clearType, const Window &window) const = 0#

Clear the given window’s render target.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • clearType – Type of buffer to clear.

  • windowWindow to clear.

virtual void SetViewport(u32 x, u32 y, u32 width, u32 height, f32 minDepth, f32 maxDepth, const Window &window) const = 0#

Set viewport size for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • x – X coordinate of the top left corner of the viewport.

  • y – Y coordinate of the top left corner of the viewport.

  • width – New viewport width.

  • height – New viewport height.

  • minDepth – New min depth value. Default: 0.0f.

  • maxDepth – New max depth value. Default: 1.0f.

  • windowWindow to set viewport for.

virtual void SetScissor(u32 x, u32 y, u32 width, u32 height, const Window &window) const = 0#

Set scissor size for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • x – Upper left corner.

  • y – Upper left corner.

  • width – New scissor width.

  • height – New scissor height.

  • windowWindow to set scissor size for.

virtual void Draw(u32 vertexCount, u32 firstVertex, const Window &window) const = 0#

Draw non-indexed, non-instanced geometry for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • vertexCount – Number of vertices to draw.

  • firstVertex – Index of the first vertex to draw. Default: 0.

  • windowWindow to draw for.

virtual void DrawIndexed(u32 indexCount, u32 firstIndex, i32 vertexOffset, const Window &window) const = 0#

Draw indexed, non-instanced geometry for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • indexCount – Number of indices to draw.

  • firstIndex – Index of the first indice to draw. Default: 0.

  • vertexOffset – Index of the first vertex to draw. Default: 0.

  • windowWindow to draw for.

virtual void DrawInstanced(u32 vertexCount, u32 instanceCount, u32 firstVertex, u32 firstInstance, const Window &window) const = 0#

Draw non-indexed, instanced geometry for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • vertexCount – Number of vertices to draw.

  • instanceCount – Number of instances to draw.

  • firstVertex – Index of the first vertex to draw. Default: 0.

  • firstInstance – Index of the first instance to draw. Default: 0.

  • windowWindow to draw for.

virtual void DrawIndexedInstanced(u32 indexCount, u32 instanceCount, u32 firstIndex, u32 firstInstance, i32 vertexOffset, const Window &window) const = 0#

Draw indexed, instanced geometry for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • indexCount – Number of indices to draw.

  • instanceCount – Number of instances to draw.

  • firstIndex – Index of the first indice to draw. Default: 0.

  • firstInstance – Index of the first instance to draw. Default: 0.

  • vertexOffset – Index of the first vertex to draw. Default: 0.

  • windowWindow to draw for.

virtual void BindVertexBuffer(const Buffer &vBuffer, const VertexBufferLayout &layout, const Window &window) const = 0#

Bind vertex buffer on the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • vBuffer – Vertex buffer to bind.

  • layout – Layout of the vertex buffer.

  • windowWindow to bind the vertex buffer for.

virtual void BindIndexBuffer(const Buffer &iBuffer, IndexType indexType, const Window &window) const = 0#

Bind an index buffer on the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • iBuffer – Index buffer to bind.

  • indexType – Data type used by the index buffer.

  • windowWindow to bind the vertex buffer for.

virtual void BindDescriptorSet(DescriptorSet &dSet, u32 index, QueueType queueType, const Window &window) const = 0#

Bind a descriptor set on the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • dSet – Descriptor set to bind.

  • index – Index for which descriptor set to bind.

  • queueTypeQueue type on which to perform the bind operation. Default: Graphics.

  • windowWindow to bind the descriptor set for.

virtual void BindPushConstants(std::string_view name, std::span<const u8> constants, QueueType queueType, const Window &window) const = 0#

Bind push constant buffer data on the given window.

Remark

Headless mode: This function is not available in headless mode.

Note

There is an optimized function which uses the index into the RootSignature instead of the name of the push constant block.

Parameters:
  • name – Name of the push constant block.

  • constants – Constant buffer data.

  • queueTypeQueue type on which to perform the bind operation. Default: Graphics.

  • windowWindow to bind the push constants for.

virtual void BindPushConstantsByIndex(u32 paramIndex, std::span<const u8> constants, QueueType queueType, const Window &window) const = 0#

Bind push constant buffer data on the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • paramIndex – Index of the push constant block in the RootSignatures descriptors array.

  • constants – Constant buffer data.

  • queueTypeQueue type on which to perform the bind operation. Default: Graphics.

  • windowWindow to bind the push constants for.

virtual void BindRenderTarget(const Graphics::RenderTarget *colorTarget, const Graphics::RenderTarget *depthStencil, RendererAPI::LoadActionsDesc *loadActions, std::vector<u32> *colorArraySlices, std::vector<u32> *colorMipSlices, u32 depthArraySlice, u32 depthMipSlice, const Window &window) const = 0#

Bind render target(s) on the given window.

Remark

Headless mode: This function is not available in headless mode.

Note

This functions ends the currently running render pass and starts a new one.

Parameters:
  • colorTargetColor render target to bind.

  • depthStencilOptional depth stencil target to bind. Default: nullptr.

  • loadActionsOptional load actions for each render target. Default: nullptr.

  • colorArraySlicesOptional color array slices for each render target. Default: nullptr.

  • colorMipSlicesOptional color mip slices for each render target. Default: nullptr.

  • depthArraySliceOptional depth array slice for the depth stencil target. Default: -1.

  • depthMipSliceOptional depth mip slice for the depth stencil target. Default: -1.

  • windowWindow to bind the render target(s) for.

virtual void BindRenderTargets(const std::vector<std::reference_wrapper<const Graphics::RenderTarget>> &colorTargets, const Graphics::RenderTarget *depthStencil, RendererAPI::LoadActionsDesc *loadActions, std::vector<u32> *colorArraySlices, std::vector<u32> *colorMipSlices, u32 depthArraySlice, u32 depthMipSlice, const Window &window) const = 0#

Bind render target(s) on the given window.

Remark

Headless mode: This function is not available in headless mode.

Note

This functions ends the currently running render pass and starts a new one.

Parameters:
  • colorTargetsColor render target(s) to bind.

  • depthStencilOptional depth stencil target to bind. Default: nullptr.

  • loadActionsOptional load actions for each render target. Default: nullptr.

  • colorArraySlicesOptional color array slices for each render target. Default: nullptr.

  • colorMipSlicesOptional color mip slices for each render target. Default: nullptr.

  • depthArraySliceOptional depth array slice for the depth stencil target. Default: -1.

  • depthMipSliceOptional depth mip slice for the depth stencil target. Default: -1.

  • windowWindow to bind the render target(s) for.

virtual void ResourceBufferBarrier(const RendererAPI::BufferBarrier &bufferBarrier, QueueType queueType, const Window &window) const = 0#

Add a resource barrier (memory dependency) for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • bufferBarrierBuffer barrier.

  • queueTypeQueue type on which to perform the barrier operation. Default: Graphics.

  • windowWindow to add the barrier for.

virtual void ResourceBufferBarriers(const std::vector<RendererAPI::BufferBarrier> &bufferBarriers, QueueType queueType, const Window &window) const = 0#

Add resource barriers (memory dependencies) for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • bufferBarriersBuffer barriers.

  • queueTypeQueue type on which to perform the barrier operation. Default: Graphics.

  • windowWindow to add the barriers for.

virtual void ResourceTextureBarrier(const RendererAPI::TextureBarrier &textureBarrier, QueueType queueType, const Window &window) const = 0#

Add a resource barrier (memory dependency) for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • textureBarrierTexture barrier.

  • queueTypeQueue type on which to perform the barrier operation. Default: Graphics.

  • windowWindow to add the barrier for.

virtual void ResourceTextureBarriers(const std::vector<RendererAPI::TextureBarrier> &textureBarriers, QueueType queueType, const Window &window) const = 0#

Add resource barriers (memory dependencies) for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • textureBarriersTexture barriers.

  • queueTypeQueue type on which to perform the barrier operation. Default: Graphics.

  • windowWindow to add the barriers for.

virtual void ResourceRenderTargetBarrier(const RendererAPI::RenderTargetBarrier &renderTargetBarrier, const Window &window) const = 0#

Add a resource barrier (memory dependency) for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • renderTargetBarrier – Render target barrier.

  • windowWindow to add the barrier for.

virtual void ResourceRenderTargetBarriers(const std::vector<RendererAPI::RenderTargetBarrier> &renderTargetBarriers, const Window &window) const = 0#

Add resource barriers (memory dependencies) for the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • renderTargetBarriers – Render target barriers.

  • windowWindow to add the barriers for.

virtual void ReflexSleep() const = 0#

NVIDIA-Reflex Sleep/synchronize on the given window.

Remark

Headless mode: This function is not available in headless mode.

virtual void ReflexMarker(u32 frame, u32 marker) const = 0#

NVIDIA-Reflex latency marker.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • frame – Frame to set marker for. Must be unique for each frame!

  • marker – Enum value of the marker to set.

virtual constexpr std::string GetTitle() const noexcept = 0#

Retrieve the renderer title. Example title: “[Vulkan 1.3.0]”.

Returns:

Renderer title.

virtual TRAP::Utils::UUID GetCurrentGPUUUID() const noexcept = 0#

Retrieve the currently used GPUs UUID.

Returns:

GPU’s UUID.

virtual std::string GetCurrentGPUName() const noexcept = 0#

Retrieve the name of the currently used GPU.

Returns:

GPU’s name.

virtual GPUVendor GetCurrentGPUVendor() const noexcept = 0#

Retrieve the vendor of the currently used GPU.

Returns:

GPU vendor.

virtual std::vector<std::pair<std::string, TRAP::Utils::UUID>> GetAllGPUs() const = 0#

Retrieve a list of all supported GPUs. The list contains the GPUs name and UUID.

Returns:

List of all supported GPUs.

virtual TRAP::Scope<TRAP::Image> CaptureScreenshot(const Window &window) const = 0#

Capture a screenshot of the last presented frame.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to capture screenshot on.

Returns:

Captured screenshot as TRAP::Image on success, nullptr otherwise.

virtual void MSAAResolvePass(const RenderTarget &source, const RenderTarget &destination, CommandBuffer *cmd) const = 0#

Resolve a MSAA render target to a non MSAA render target. Needed to transfer MSAA rendered image data to a presentable non-MSAA target.

Note

source and destination must be in ResourceState::RenderTarget resource state.

Parameters:
  • source – Source MSAA render target to resolve.

  • destination – Destination non MSAA render target to resolve into.

  • cmd – CommadBuffer to resolve on.

virtual void RenderScalePass(const RenderTarget &source, const RenderTarget &destination, const Window &window) const = 0#

Scale image from internal resolution to the final output resolution.

Remark

Headless mode: This function is not available in headless mode.

Note

source and destination must be in ResourceState::RenderTarget resource state.

Parameters:
  • source – Source render target to resolve.

  • destination – Destination render target to resolve into.

  • windowWindow to do the scaling pass on.

virtual void SetLatencyMode(LatencyMode mode, const Window &window) = 0#

Set the latency mode. The actual latency mode may differ from the requested one so check the actual used mode with GetLatencyMode().

Remark

Windows: Other LatencyModes are only available on Windows 10 or newer with NVIDIA hardware.

Remark

Headless mode: This function is not available in headless mode.

Note

Only LatencyMode::Disabled is supported everywhere.

Parameters:
  • mode – LatencyMode to set.

  • windowWindow to set latency mode for.

virtual LatencyMode GetLatencyMode(const Window &window) const = 0#

Retrieve the currently used latency mode.

Remark

Headless mode: This function is not available in headless mode.

Note

The returned value may differ from the requested mode set with SetLatencyMode().

Parameters:

windowWindow to retrieve latency mode for.

Returns:

Used latency mode.

virtual void InitPerViewportData(Window &window, bool VSyncEnabled) const = 0#

Initialize the internal rendering data of the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • windowWindow to initialize the internal rendering data for.

  • VSyncEnabled – Whether to enable or disable VSync.

virtual void RemovePerViewportData(const Window &window) const = 0#

Remove the internal rendering data of the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to remove the internal rendering data from.

virtual void WaitIdle() const = 0#

Wait for the GPU to idle.

Public Static Functions

static void Init(std::string_view gameName, RenderAPI renderAPI)#

Initialize the Renderer.

Parameters:
  • gameName – Name of the game.

  • renderAPI – Render API to use.

static void Shutdown()#

Shutdown the Renderer.

static RendererAPI *GetRenderer()#

Retrieve the Renderer singleton.

Returns:

Renderer.

static API::ResourceLoader *GetResourceLoader() noexcept#

Retrieve the resource loader singleton.

Returns:

Resource loader.

static RenderAPI AutoSelectRenderAPI()#

Auto select a supported render API.

Returns:

Auto selected render API.

static bool IsSupported(RenderAPI api)#

Check whether a render API is supported by the system.

Returns:

True if supported, false otherwise.

static RenderAPI GetRenderAPI() noexcept#

Retrieve the currently used render API.

Returns:

Currently used render API.

static constexpr void SetNewGPU(const TRAP::Utils::UUID &GPUUUID) noexcept#

Set a new GPU to use.

Note

This only takes effect after a restart of the engine.

Parameters:

GPUUUID – UUID of the GPU to use.

static TRAP::Utils::UUID GetNewGPU() noexcept#

Get the UUID of the new GPU to use.

Note

This will return an empty UUID if no new GPU was set.

Returns:

UUID of the new GPU to use.

static void OnPostUpdate()#

On post update function. This function performs several tasks that need to be done after LayerStack::OnUpdate() calls. Currently this only performs scaling of the render targets, dependening on the current render scale.

static TRAP::Ref<TRAP::Graphics::DescriptorPool> GetDescriptorPool() noexcept#

Retrieve the used descriptor pool.

Returns:

Descriptor pool.

static TRAP::Ref<TRAP::Graphics::Queue> GetGraphicsQueue() noexcept#

Retrieve the used graphics queue.

Returns:

Graphics queue.

static TRAP::Ref<TRAP::Graphics::Queue> GetComputeQueue() noexcept#

Retrieve the used compute queue.

Returns:

Compute queue.

static TRAP::Ref<TRAP::Graphics::Queue> GetTransferQueue() noexcept#

Retrieve the used transfer queue.

Returns:

Transfer queue.

static TRAP::Ref<TRAP::Graphics::RootSignature> GetGraphicsRootSignature(const Window &window)#

Retrieve the currently used graphics root signature of the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to retrieve the graphics root signature from.

Returns:

Graphics root signature.

static TRAP::Math::Vec2ui GetInternalRenderResolution(const Window &window)#

Retrieve the currently used internal render resolution of the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to get internal render resolution from.

Returns:

Internal render resolution.

static void StartRenderPass(const Window &window)#

Start a render pass for the given window.

Remark

Headless mode: This function is not available in headless mode.

Note

This will rebind the render target for the current frame.

Parameters:

windowWindow to start render pass for.

static void StopRenderPass(const Window &window)#

Stop running render pass of the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to stop render pass on.

static void Transition(const Ref<TRAP::Graphics::Texture> &texture, TRAP::Graphics::RendererAPI::ResourceState oldLayout, TRAP::Graphics::RendererAPI::ResourceState newLayout, TRAP::Graphics::RendererAPI::QueueType queueType = QueueType::Graphics)#

Transition a texture from old layout to the new layout. The transition happens immediately and is guaranteed to be complete when the function returns.

Parameters:
  • textureTexture to transition layout.

  • oldLayout – Current resource state of the given texture.

  • newLayout – New resource state for the given texture.

  • queueTypeQueue type on which to perform the transition. Default: Graphics.

static void GetAntiAliasing(AntiAliasing &outAntiAliasing, SampleCount &outSampleCount, const Window &window) noexcept#

Retrieve the currently used anti aliasing method and the sample count.

Remark

Headless mode: This function is not available in headless mode.

Parameters:
  • outAntiAliasing – Output: Used anti aliasing method.

  • outSampleCount – Output: Used sample count.

  • windowWindow to get anti aliasing from.

static void SetAntiAliasing(AntiAliasing antiAliasing, SampleCount sampleCount)#

Set the anti aliasing method and the sample count. Use AntiAliasing::Off to disable anti aliasing.

Note

This takes effect on the next frame onwards.

Note

A sample count of 1 is only valid if anti aliasing is disabled.

Parameters:
  • antiAliasing – Anti aliasing method to use.

  • sampleCount – Sample count to use.

static SampleCount GetAnisotropyLevel() noexcept#

Retrieve the currently used anisotropy level.

Returns:

Used anisotropy level.

static void SetAnisotropyLevel(SampleCount anisotropyLevel)#

Set the anisotropy level. A value of SampleCount::One effectively disables anisotropic filtering.

Note

User created samplers need to be recreated in order to use the new anisotropy level.

Parameters:

anisotropyLevel – Anisotropy level to use.

static void ResizeSwapChain(const Window &window)#

Notify the RendererAPI that the SwapChain needs to be resized. This function should be called inside FrameBufferResizeEvent callbacks.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow that needs an updated SwapChain.

static f32 GetGPUGraphicsFrameTime(const Window &window)#

Retrieve the GPU side frame time for the graphics queue.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to get frame time from.

Returns:

GPU Graphics frame time in milliseconds.

static f32 GetGPUComputeFrameTime(const Window &window)#

Retrieve the GPU side frame time for the compute queue.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to get frame time from.

Returns:

GPU Compute frame time in milliseconds.

static PerViewportData &GetViewportData(const Window &window)#

Retrieve internal rendering data.

Remark

Headless mode: This function is not available in headless mode.

Returns:

Windows internal rendering data.

static bool IsVulkanCapable()#

Check if the system is Vulkan API capable.

Note

The first call to this function will run the Vulkan capability tester.

Returns:

True if the system is Vulkan API capable, false otherwise.

static u32 GetCurrentImageIndex(const TRAP::Window &window)#

Retrieve the image index currently used for rendering from the given window.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

windowWindow to retrieve image index from.

Returns:

Image index.

Public Static Attributes

static constexpr u32 MaxDescriptorSets = 4#

The maximum amount of descriptor sets that can be used.

static struct TRAP::Graphics::RendererAPI::GPUSettings GPUSettings#
static constexpr u32 ImageCount = 3#

Protected Functions

constexpr RendererAPI() noexcept = default#

Constructor.

Protected Static Attributes

static TRAP::Scope<RendererAPI> s_Renderer#
static constinit RenderAPI s_RenderAPI = RenderAPI::NONE#
static TRAP::Scope<API::ResourceLoader> s_ResourceLoader#
static TRAP::Ref<DescriptorPool> s_descriptorPool#
static TRAP::Ref<Queue> s_graphicQueue#
static TRAP::Ref<Queue> s_computeQueue#
static TRAP::Ref<Queue> s_transferQueue#
static constinit RendererAPI::SampleCount s_newSampleCount = RendererAPI::SampleCount::Two#
static constinit RendererAPI::AntiAliasing s_newAntiAliasing = RendererAPI::AntiAliasing::Off#
static constinit RendererAPI::SampleCount s_Anisotropy = RendererAPI::SampleCount::Sixteen#
static constinit TRAP::Utils::UUID s_newGPUUUID = {}#
static std::unordered_map<const Window*, TRAP::Scope<PerViewportData>> s_perViewportDataMap#
struct BinaryShaderDesc#

Description of a binary shader.

Public Members

ShaderStage Stages = {}#
BinaryShaderStageDesc Vertex = {}#
BinaryShaderStageDesc Fragment = {}#
BinaryShaderStageDesc Geometry = {}#
BinaryShaderStageDesc TessellationControl = {}#
BinaryShaderStageDesc TessellationEvaluation = {}#
BinaryShaderStageDesc Compute = {}#
struct BinaryShaderStageDesc#

Description of a binary shader stage.

Public Members

std::vector<u32> ByteCode = {}#
struct BlendStateDesc#

Description of a blend state.

Public Members

std::array<BlendConstant, 8> SrcFactors = {}#
std::array<BlendConstant, 8> DstFactors = {}#
std::array<BlendConstant, 8> SrcAlphaFactors = {}#
std::array<BlendConstant, 8> DstAlphaFactors = {}#
std::array<BlendMode, 8> BlendModes = {}#
std::array<BlendMode, 8> BlendAlphaModes = {}#
std::array<i32, 8> Masks = {}#
BlendStateTargets RenderTargetMask = {}#
bool IndependentBlend = {}#
struct BufferBarrier#

Struct holding a buffer barrier.

Public Members

std::reference_wrapper<const TRAP::Graphics::Buffer> Buffer#
ResourceState CurrentState = {}#
ResourceState NewState = {}#
bool BeginOnly = {}#
bool EndOnly = {}#
bool Acquire = {}#
bool Release = {}#
TRAP::Graphics::RendererAPI::QueueType QueueType = {}#
struct BufferDesc#

Description of a buffer.

Public Members

u64 Size = {}#
u32 Alignment = {}#
ResourceMemoryUsage MemoryUsage = {}#
BufferCreationFlags Flags = {}#
TRAP::Graphics::RendererAPI::QueueType QueueType = {}#
ResourceState StartState = {}#
u64 ElementCount = {}#
u64 StructStride = {}#
IndirectArgumentType ICBDrawType = {}#
u32 ICBMaxVertexBufferBind = {}#
u32 ICBMaxFragmentBufferBind = {}#
TRAP::Graphics::API::ImageFormat Format = {}#
DescriptorType Descriptors = {}#
std::string Name = {}#
struct BufferLoadDesc#

Description for a buffer load.

Public Members

TRAP::Ref<TRAP::Graphics::Buffer> Buffer = nullptr#
const void *Data = nullptr#
BufferDesc Desc = {}#
bool ForceReset = false#
struct BufferUpdateDesc#

Description for a buffer update.

Public Members

TRAP::Ref<TRAP::Graphics::Buffer> Buffer#
u64 DstOffset#
u64 Size#
std::span<u8> MappedData#
MappedMemoryRange MappedRange#
struct TRAP::Graphics::RendererAPI::BufferUpdateDesc::[anonymous] Internal#
struct Color#

Public Members

f64 Red#
f64 Green#
f64 Blue#
f64 Alpha#
struct CommandPoolDesc#

Description of a command pool.

Public Members

TRAP::Ref<TRAP::Graphics::Queue> Queue#
CommandPoolCreateFlags CreateFlags = CommandPoolCreateFlags::None#
std::string Name = {}#
struct CommandSignatureDesc#

Description of a command signature.

Public Members

TRAP::Ref<TRAP::Graphics::RootSignature> RootSignature = {}#
std::vector<IndirectArgumentDescriptor> ArgDescs = {}#
bool Packed = {}#
struct ComputePipelineDesc#

Description of a compute pipeline.

Public Members

Shader *ShaderProgram = {}#
TRAP::Ref<TRAP::Graphics::RootSignature> RootSignature = {}#
struct DepthStateDesc#

Description of a depth state.

Public Members

bool DepthTest = {}#
bool DepthWrite = {}#
CompareMode DepthFunc = {}#
bool StencilTest = {}#
u8 StencilReadMask = {}#
u8 StencilWriteMask = {}#
CompareMode StencilFrontFunc = {}#
StencilOp StencilFrontFail = {}#
StencilOp DepthFrontFail = {}#
StencilOp StencilFrontPass = {}#
CompareMode StencilBackFunc = {}#
StencilOp StencilBackFail = {}#
StencilOp DepthBackFail = {}#
StencilOp StencilBackPass = {}#
struct DepthStencil#

Public Members

f32 Depth#
u32 Stencil#
struct DescriptorData#

Struct holding a data of a descriptor.

Public Members

std::string Name = {}#
std::variant<BufferOffset, DescriptorSetExtraction, TextureSlice, bool> Offset = {false}#
DescriptorResource Resource = {std::vector<const TRAP::Graphics::Texture*>()}#
u32 Count = {}#
u32 Index = std::numeric_limits<u32>::max()#
struct BufferOffset#

Range(s) to bind (buffer, offset, size)

Public Members

std::vector<u64> Offsets = {}#
std::vector<u64> Sizes = {}#
struct DescriptorSetExtraction#

Descriptor set buffer extraction options.

Public Members

u32 DescriptorSetBufferIndex = {}#
Ref<Shader> DescriptorSetShader = {}#
ShaderStage DescriptorSetShaderStage = {}#
struct TextureSlice#

Public Members

u32 UAVMipSlice = {}#
bool BindMipChain = {}#
struct DescriptorInfo#

Struct containing information about a descriptor.

Public Members

std::string Name = {}#
DescriptorType Type = {}#
API::ShaderReflection::TextureDimension Dimension = {}#
bool RootDescriptor = {}#
u32 Set = {}#
u32 Size = {}#
u32 IndexInParent = {}#
u32 HandleIndex = {}#
VkDescriptorType VkType = {}#
u32 Reg = {}#
u32 RootDescriptorIndex = {}#
u32 VkStages = {}#
struct DescriptorSetDesc#

Description of a descriptor set.

Public Members

TRAP::Ref<TRAP::Graphics::RootSignature> RootSignature = {}#
u32 Set#
u32 MaxSets = {}#
struct GPUSettings

Struct holding data about a GPUs features, limits and other properties.

Public Members

u64 UniformBufferAlignment#
u32 MaxUniformBufferRange#
u64 StorageBufferAlignment#
u64 MaxStorageBufferRange#
u32 UploadBufferTextureAlignment#
u32 UploadBufferTextureRowAlignment#
u32 MaxVertexInputBindings#
u32 MaxVertexInputAttributes#
u32 MaxRootSignatureDWORDS#
u32 MaxImageDimension2D#
u32 MaxImageDimensionCube#
u32 MaxPushConstantSize#
u32 MaxSamplerAllocationCount#
u32 MaxTessellationControlPoints#
SampleCount MaxMSAASampleCount#
f32 MaxAnisotropy#
u32 MaxColorRenderTargets#
u32 WaveLaneCount#
TRAP::Graphics::RendererAPI::WaveOpsSupportFlags WaveOpsSupportFlags#
u32 ROVsSupported#
bool MultiDrawIndirectSupported#
bool TessellationSupported#
bool GeometryShaderSupported#
bool FillModeNonSolid#
bool SurfaceSupported#
bool PresentSupported#
bool SampleRateShadingSupported#
TRAP::Graphics::RendererAPI::ShadingRate ShadingRates#
TRAP::Graphics::RendererAPI::ShadingRateCaps ShadingRateCaps#
TRAP::Graphics::RendererAPI::ShadingRateCombiner ShadingRateCombiner#
u32 ShadingRateTexelWidth#
u32 ShadingRateTexelHeight#
bool ReflexSupported#
struct GraphicsPipelineDesc#

Description of a graphics pipeline.

Public Members

Shader *ShaderProgram = {}#
TRAP::Ref<TRAP::Graphics::RootSignature> RootSignature = {}#
TRAP::Ref<TRAP::Graphics::RendererAPI::VertexLayout> VertexLayout = {}#
TRAP::Ref<BlendStateDesc> BlendState = {}#
TRAP::Ref<DepthStateDesc> DepthState = {}#
TRAP::Ref<RasterizerStateDesc> RasterizerState = {}#
std::vector<TRAP::Graphics::API::ImageFormat> ColorFormats = {}#
u32 RenderTargetCount = {}#
TRAP::Graphics::RendererAPI::SampleCount SampleCount = RendererAPI::SampleCount::One#
u32 SampleQuality = {}#
TRAP::Graphics::API::ImageFormat DepthStencilFormat = {}#
TRAP::Graphics::RendererAPI::PrimitiveTopology PrimitiveTopology = {}#
TRAP::Graphics::RendererAPI::ShadingRate ShadingRate = {}#
std::array<TRAP::Graphics::RendererAPI::ShadingRateCombiner, 2> ShadingRateCombiners = {}#
TRAP::Ref<TRAP::Graphics::RenderTarget> ShadingRateTexture = {}#
struct IndirectArgumentDescriptor#

Struct holding indirect descriptor argument.

Public Members

IndirectArgumentType Type = {}#
std::string Name = {}#
u32 Index = {}#
struct IndirectDispatchArguments#

Struct holding indirect dispatch arguments.

Public Members

u32 GroupCountX = {}#
u32 GroupCountY = {}#
u32 GroupCountZ = {}#
struct IndirectDrawArguments#

Struct holding indirect draw arguments.

Public Members

u32 VertexCount = {}#
u32 InstanceCount = {}#
u32 StartVertex = {}#
u32 StartInstance = {}#
struct IndirectDrawIndexArguments#

Struct holding indirect indexed draw arguments.

Public Members

u32 IndexCount = {}#
u32 InstanceCount = {}#
u32 StartIndex = {}#
u32 VertexOffset = {}#
u32 StartInstance = {}#
struct LoadActionsDesc#

Description of actions to perform on load.

Public Members

std::vector<LoadActionType> LoadActionsColor = {}#
LoadActionType LoadActionDepth = {}#
LoadActionType LoadActionStencil = {}#
std::vector<RendererAPI::Color> ClearColorValues = {}#
RendererAPI::DepthStencil ClearDepthStencil = {}#
std::vector<StoreActionType> StoreActionsColor = {}#
StoreActionType StoreActionDepth = {}#
StoreActionType StoreActionStencil = {}#
struct MappedMemoryRange#

Struct holding data about a mapped memory range.

Public Members

std::span<u8> Data = {}#
TRAP::Ref<TRAP::Graphics::Buffer> Buffer = nullptr#
u64 Offset = 0#
u64 Size = 0#
MappedRangeFlags Flags = MappedRangeFlags::None#
struct PerViewportData#

Per window data used for rendering.

Public Functions

PerViewportData() = default#

Constructor.

~PerViewportData()#

Destructor.

consteval PerViewportData(const PerViewportData&) noexcept = delete#

Copy constructor.

PerViewportData(PerViewportData&&) noexcept = default#

Move constructor.

consteval PerViewportData &operator=(const PerViewportData&) noexcept = delete#

Copy assignment operator.

PerViewportData &operator=(PerViewportData&&) noexcept = default#

Move assignment operator.

Public Members

TRAP::Window *Window = {}#
PerWindowState State = {}#
u32 ImageIndex = 0#
std::array<TRAP::Ref<CommandPool>, ImageCount> GraphicCommandPools#
std::array<CommandBuffer*, ImageCount> GraphicCommandBuffers = {}#
std::array<TRAP::Ref<Fence>, ImageCount> RenderCompleteFences#
std::array<TRAP::Ref<Semaphore>, ImageCount> ImageAcquiredSemaphores#
std::array<TRAP::Ref<Semaphore>, ImageCount> RenderCompleteSemaphores#
std::array<TRAP::Ref<Semaphore>, ImageCount> GraphicsCompleteSemaphores#
std::array<TRAP::Ref<QueryPool>, ImageCount> GraphicsTimestampQueryPools#
std::array<TRAP::Ref<Buffer>, ImageCount> GraphicsTimestampReadbackBuffers#
PipelineDesc GraphicsPipelineDesc#
TRAP::Ref<Pipeline> CurrentGraphicsPipeline#
f32 GraphicsFrameTime = {}#
bool Recording = {}#
TRAP::Ref<RenderTarget> NewShadingRateTexture#
std::array<TRAP::Ref<TRAP::Graphics::RenderTarget>, 3> CachedShadingRateTextures = {}#
TRAP::Ref<RenderTarget> DepthStencilTarget = nullptr#
f32 NewRenderScale = 1.0f#
f32 RenderScale = 1.0f#
TRAP::Ref<TRAP::Graphics::SwapChain> SwapChain#
bool ResizeSwapChain = false#
std::array<TRAP::Ref<RenderTarget>, ImageCount> TemporaryResolveRenderTargets#
std::vector<TRAP::Ref<RenderTarget>> InternalRenderTargets = {}#
u32 CurrentSwapChainImageIndex = {}#
RendererAPI::AntiAliasing CurrentAntiAliasing = RendererAPI::AntiAliasing::Off#
RendererAPI::SampleCount CurrentSampleCount = RendererAPI::SampleCount::One#
RendererAPI::Color ClearColor = {0.1, 0.1, 0.1, 1.0}#
RendererAPI::DepthStencil ClearDepthStencil = {0.0f, 0}#
bool CurrentVSync = {}#
bool NewVSync = {}#
std::array<TRAP::Ref<CommandPool>, ImageCount> ComputeCommandPools#
std::array<CommandBuffer*, ImageCount> ComputeCommandBuffers = {}#
std::array<TRAP::Ref<Fence>, ImageCount> ComputeCompleteFences#
std::array<TRAP::Ref<Semaphore>, ImageCount> ComputeCompleteSemaphores#
std::array<TRAP::Ref<QueryPool>, ImageCount> ComputeTimestampQueryPools#
std::array<TRAP::Ref<Buffer>, ImageCount> ComputeTimestampReadbackBuffers#
TRAP::Math::Vec3ui CurrentComputeWorkGroupSize = {}#
PipelineDesc ComputePipelineDesc#
TRAP::Ref<Pipeline> CurrentComputePipeline#
f32 ComputeFrameTime = {}#
bool RecordingCompute = {}#
struct PipelineCacheDesc#

Description of a pipeline cache.

Public Members

std::vector<u8> Data = {}#
PipelineCacheFlags Flags = {}#
std::string Name = {}#
struct PipelineCacheLoadDesc#

Description of a pipeline cache to load.

Public Members

std::filesystem::path Path = {}#
PipelineCacheFlags Flags = {}#
std::string Name = {}#
struct PipelineDesc#

Description of a pipeline.

Public Members

PipelineType Type = {}#
std::variant<ComputePipelineDesc, GraphicsPipelineDesc, RayTracingPipelineDesc> Pipeline = {GraphicsPipelineDesc()}#
TRAP::Ref<PipelineCache> Cache = {}#
void *PipelineExtensions = {}#
u32 PipelineExtensionCount = {}#
std::string Name = {}#
struct QueryDesc#

Description of a query.

Public Members

u32 Index = {}#
struct QueryPoolDesc#

Description of a query pool.

Public Members

QueryType Type = {}#
u32 QueryCount = {}#
std::string Name = {}#
struct QueueDesc#

Description of a queue.

Public Members

QueueType Type = {}#
QueueFlag Flag = {}#
QueuePriority Priority = {}#
std::string Name = {}#
struct QueuePresentDesc#

Description of a queue presentation.

Public Members

TRAP::Ref<TRAP::Graphics::SwapChain> SwapChain = {}#
std::vector<TRAP::Ref<Semaphore>> WaitSemaphores = {}#
u32 Index = {}#
struct QueueSubmitDesc#

Description for a queue submission.

Public Members

std::vector<std::reference_wrapper<CommandBuffer>> Cmds = {}#
TRAP::Ref<Fence> SignalFence = {}#
std::vector<TRAP::Ref<Semaphore>> WaitSemaphores = {}#
std::vector<TRAP::Ref<Semaphore>> SignalSemaphores = {}#
struct RasterizerStateDesc#

Description of a rasterizer state.

Public Members

TRAP::Graphics::RendererAPI::CullMode CullMode = {}#
i32 DepthBias = {}#
f32 SlopeScaledDepthBias = {}#
TRAP::Graphics::RendererAPI::FillMode FillMode = {}#
TRAP::Graphics::RendererAPI::FrontFace FrontFace = {}#
bool DepthClampEnable = {}#
struct RayTracingPipelineDesc#

Description of a RayTracing pipeline.

struct ReadRange#

Read range used for buffer mapping.

Public Members

u64 Offset = {}#
u64 Range = {}#
struct RenderTargetBarrier#

Struct holding a render target barrier.

Public Members

std::reference_wrapper<const TRAP::Graphics::RenderTarget> RenderTarget#
ResourceState CurrentState = {}#
ResourceState NewState = {}#
bool BeginOnly = {}#
bool EndOnly = {}#
bool Acquire = {}#
bool Release = {}#
TRAP::Graphics::RendererAPI::QueueType QueueType = {}#
bool SubresourceBarrier = {}#
u8 MipLevel = {}#
u16 ArrayLayer = {}#
struct RenderTargetDesc#

Description of a render target.

Public Members

TextureCreationFlags Flags = {}#
u32 Width = {}#
u32 Height = {}#
u32 Depth = {}#
u32 ArraySize = {}#
u32 MipLevels = {}#
TRAP::Graphics::RendererAPI::SampleCount SampleCount = RendererAPI::SampleCount::One#
TRAP::Graphics::API::ImageFormat Format = {}#
ResourceState StartState = {}#
RendererAPI::ClearValue ClearValue = {}#
u32 SampleQuality = {}#
DescriptorType Descriptors = {}#
std::string Name = {}#
void *NativeHandle = {}#
struct ResourceLoaderDesc#

Description for the resource loader.

Public Members

u64 BufferSize#
u32 BufferCount#
struct RootSignatureDesc#

Description of a root signature.

Public Members

std::vector<Shader*> Shaders = {}#
u32 MaxBindlessTextures = {}#
std::vector<const char*> StaticSamplerNames = {}#
std::vector<TRAP::Ref<Sampler>> StaticSamplers = {}#
RootSignatureFlags Flags = {}#
struct SamplerDesc#

Description of a sampler.

Public Functions

constexpr bool operator==(const SamplerDesc &other) const noexcept = default#
constexpr bool operator!=(const SamplerDesc &other) const noexcept = default#

Public Members

FilterType MinFilter = {}#
FilterType MagFilter = {}#
TRAP::Graphics::RendererAPI::MipMapMode MipMapMode = {}#
AddressMode AddressU = {}#
AddressMode AddressV = {}#
AddressMode AddressW = {}#
f32 MipLodBias = {}#
bool SetLodRange = {}#
f32 MinLod = {}#
f32 MaxLod = {}#
bool EnableAnisotropy = true#
f32 OverrideAnisotropyLevel = {}#
CompareMode CompareFunc = {}#
std::string Name = {}#
struct TRAP::Graphics::RendererAPI::SamplerDesc::SamplerConversionDesc SamplerConversionDesc#
struct SamplerConversionDesc

Description of YCbCr(YUV) conversion sampler.

Public Functions

constexpr bool operator==(const SamplerConversionDesc &other) const noexcept = default#
constexpr bool operator!=(const SamplerConversionDesc &other) const noexcept = default#

Public Members

TRAP::Graphics::API::ImageFormat Format#
SamplerModelConversion Model#
SamplerRange Range#
SampleLocation ChromaOffsetX#
SampleLocation ChromaOffsetY#
FilterType ChromaFilter#
bool ForceExplicitReconstruction#
struct SubresourceDataDesc#

Description of a subresource. Used to update a existing resource.

Public Members

u64 SrcOffset#
u32 MipLevel#
u32 ArrayLayer#
u32 RowPitch#
u32 SlicePitch#
struct SwapChainDesc#

Description of a swapchain.

Public Members

TRAP::Window *Window = {}#
std::vector<TRAP::Ref<Queue>> PresentQueues = {}#
u32 ImageCount = {}#
u32 Width = {}#
u32 Height = {}#
TRAP::Graphics::API::ImageFormat ColorFormat = {}#
RendererAPI::ClearValue ClearValue = {}#
bool EnableVSync = {}#
RendererAPI::SampleCount SampleCount = SampleCount::One#
SwapChain *OldSwapChain = nullptr#
struct TextureBarrier#

Struct holding a texture barrier.

Public Members

std::reference_wrapper<const TRAP::Graphics::Texture> Texture#
ResourceState CurrentState = {}#
ResourceState NewState = {}#
bool BeginOnly = {}#
bool EndOnly = {}#
bool Acquire = {}#
bool Release = {}#
TRAP::Graphics::RendererAPI::QueueType QueueType = {}#
bool SubresourceBarrier = {}#
u8 MipLevel = {}#
u16 ArrayLayer = {}#
struct TextureCopyDesc#

Public Members

TRAP::Ref<TRAP::Graphics::Texture> Texture#
TRAP::Ref<TRAP::Graphics::Buffer> Buffer#
TRAP::Ref<Semaphore> WaitSemaphore#
u32 MipLevel#
u32 ArrayLayer#
ResourceState TextureState#
RendererAPI::QueueType QueueType#
u64 BufferOffset#
struct TextureDesc#

Description of a texture.

Public Members

TextureCreationFlags Flags = {}#
u32 Width = 1#
u32 Height = 1#
u32 Depth = 1#
u32 ArraySize = 1#
u32 MipLevels = 1#
TRAP::Graphics::RendererAPI::SampleCount SampleCount = RendererAPI::SampleCount::One#
u32 SampleQuality = {}#
TRAP::Graphics::API::ImageFormat Format = {}#
RendererAPI::ClearValue ClearValue = {}#
ResourceState StartState = {}#
DescriptorType Descriptors = {}#
void *NativeHandle = {}#
std::string Name = {}#
::VkSamplerYcbcrConversionInfo *VkSamplerYcbcrConversionInfo = {}#
struct TextureLoadDesc#

Description for a texture load.

Public Members

TRAP::Graphics::Texture *Texture = {}#
TextureDesc *Desc = {}#
std::vector<std::filesystem::path> Filepaths#
std::vector<const Image*> Images = {}#
TextureCreationFlags CreationFlag = TextureCreationFlags::None#
bool IsCubemap = {}#
TRAP::Optional<TextureCubeType> Type = TRAP::NullOpt#
struct TextureUpdateDesc#

Description for a texture update.

Note

Only use for procedural textures which are created on CPU (noise textures, font texture, …)

Public Members

TRAP::Graphics::Texture *Texture = nullptr#
u32 MipLevel = 0#
u32 ArrayLayer = 0#
std::span<u8> MappedData = {}#
u32 DstRowStride = {}#
u32 RowCount = {}#
u32 SrcRowStride = {}#
u32 DstSliceStride = {}#
u32 SrcSliceStride = {}#
MappedMemoryRange MappedRange#
struct TRAP::Graphics::RendererAPI::TextureUpdateDesc::[anonymous] Internal#
struct VertexAttribute#

Description of a single vertex attribute.

Public Members

TRAP::Graphics::API::ImageFormat Format = {}#
u32 Binding = {}#
u32 Location = {}#
u32 Offset = {}#
VertexAttributeRate Rate = {}#
struct VertexLayout#

Description of a vertex layout.

Public Members

u32 AttributeCount = {}#
std::array<VertexAttribute, 15> Attributes = {}#