Renderer API reference¶
Classes¶
Vortex::Renderer::ClearVortex::Renderer::DrawableVortex::Renderer::EllipseVortex::Renderer::GenericBufferVortex::Renderer::IndirectBufferVortex::Renderer::InstanceVortex::Renderer::IntRectangleVortex::Renderer::RectangleVortex::Renderer::RenderStateVortex::Renderer::RenderTargetVortex::Renderer::RenderTextureVortex::Renderer::RenderWindowVortex::Renderer::SpriteVortex::Renderer::TimerVortex::Renderer::TransformableVortex::Renderer::UniformBufferVortex::Renderer::VertexBufferVortex::Renderer::Work
API Reference¶
-
namespace
Renderer¶ -
Enums
Functions
-
template<template<typename> class
BufferType, typenameT>
voidCopyTo(BufferType<T> &buffer, T &t)¶ Copy the content of a buffer in an object.
-
template<template<typename> class
BufferType, typenameT>
voidCopyTo(BufferType<T> &buffer, std::vector<T> &t)¶ Copy the content of a buffer to a vector. Vector needs to have the correct size already.
-
template<template<typename> class
BufferType, typenameT>
voidCopyFrom(BufferType<T> &buffer, const T &t)¶ Copy the content of an object to the buffer.
-
template<template<typename> class
BufferType, typenameT>
voidCopyFrom(BufferType<T> &buffer, const std::vector<T> &t)¶ Copy the content of a vector to the buffer.
-
bool
operator==(const GraphicsPipelineDescriptor::ShaderDescriptor &left, const GraphicsPipelineDescriptor::ShaderDescriptor &right)¶
-
bool
operator==(const GraphicsPipelineDescriptor::VertexBindingDescriptor &left, const GraphicsPipelineDescriptor::VertexBindingDescriptor &right)¶
-
bool
operator==(const GraphicsPipelineDescriptor::VertexAttributeDescriptor &left, const GraphicsPipelineDescriptor::VertexAttributeDescriptor &right)¶
-
bool
operator==(const GraphicsPipelineDescriptor &left, const GraphicsPipelineDescriptor &right)¶
-
bool
operator==(const SpecConstInfo::Entry &left, const SpecConstInfo::Entry &right)¶
-
bool
operator==(const SpecConstInfo &left, const SpecConstInfo &right)¶
-
template<typename
Type>
SpecConstInfo::Value<Type>SpecConstValue(uint32_t id, Type value)¶ Constructs a specialization constant value.
-
template<typename ...
Args>
SpecConstInfoSpecConst(Args&&... args)¶ Constructs a SpecConstInfo with given values of specialisation constants.
-
bool
operator==(const RenderState &left, const RenderState right)¶
-
VORTEX_API std::uint64_t Vortex::Renderer::GetBytesPerPixel(Format format) Gets the number of bytes per pixel given the format.
- Return
- bytes per pixel
- Parameters
format: of texture
-
bool
HasLayer(const char *extension, const std::vector<vk::LayerProperties> &availableExtensions)¶
-
bool
HasExtension(const char *extension, const std::vector<vk::ExtensionProperties> &availableExtensions)¶
-
VmaMemoryUsage
ConvertMemoryUsage(MemoryUsage memoryUsage)¶
-
vk::ShaderStageFlagBits
ConvertShaderStage(ShaderStage shaderStage)¶
-
vk::PrimitiveTopology
ConvertTopology(PrimitiveTopology topology)¶
-
vk::BufferUsageFlags
ConvertBufferUsage(BufferUsage bufferUsage)¶
-
vk::ImageLayout
ConvertImageLayout(ImageLayout layout)¶
-
vk::PipelineBindPoint
ConvertPipelineBindPoint(PipelineBindPoint bindPoint)¶
-
vk::BlendFactor
ConvertBlendFactor(BlendFactor factor)¶
-
VORTEX_API ComputeSize Vortex::Renderer::MakeStencilComputeSize(const glm::ivec2 & size, int radius) Create a ComputeSize for a stencil type shader.
- Return
- calculate ComputeSize
- Parameters
size: the domain sizeradius: the stencil size
-
VORTEX_API ComputeSize Vortex::Renderer::MakeCheckerboardComputeSize(const glm::ivec2 & size) Create a ComputeSize for a checkerboard type shader.
- Return
- calculate ComputeSize
- Parameters
size: the domain size
-
class
AbstractShape: public Vortex::Renderer::Shape¶ - #include <Shapes.h>
An polygonal shape where the fragment shader can be specified for customisation.
Subclassed by Vortex::Renderer::IntRectangle, Vortex::Renderer::Rectangle
Public Functions
-
VORTEX_API void Vortex::Renderer::AbstractShape::Initialize(const RenderState & renderState) Initialize the drawable for a particular state. This might include creating the correct pipeline. If it was already initialized, it will do nothing.
- Parameters
renderState: the state to initialize with.
-
VORTEX_API void Vortex::Renderer::AbstractShape::Update(const glm::mat4 & projection, const glm::mat4 & view) Update the MVP matrix of the drawable.
- Parameters
projection: the projection matrixview: the view matrix
-
VORTEX_API void Vortex::Renderer::AbstractShape::Draw(CommandEncoder & commandEncoder, const RenderState & renderState) Draw for the given render state. This has to be initialized before.
- Parameters
commandBuffer: the command buffer to record into.renderState: the render state to use.
-
-
class
AbstractSprite: public Vortex::Renderer::Drawable, public Vortex::Renderer::Transformable¶ - #include <Sprite.h>
a Sprite, i.e. a drawable that can render a texture. The fragment shader can be specified for customisation.
Subclassed by Vortex::Fluid::DistanceField, Vortex::Renderer::Sprite
Public Functions
-
VORTEX_API void Vortex::Renderer::AbstractSprite::Initialize(const RenderState & renderState) Initialize the drawable for a particular state. This might include creating the correct pipeline. If it was already initialized, it will do nothing.
- Parameters
renderState: the state to initialize with.
-
VORTEX_API void Vortex::Renderer::AbstractSprite::Update(const glm::mat4 & projection, const glm::mat4 & view) Update the MVP matrix of the drawable.
- Parameters
projection: the projection matrixview: the view matrix
-
VORTEX_API void Vortex::Renderer::AbstractSprite::Draw(CommandEncoder & commandEncoder, const RenderState & renderState) Draw for the given render state. This has to be initialized before.
- Parameters
commandBuffer: the command buffer to record into.renderState: the render state to use.
-
-
struct
BindingInput¶ - #include <BindGroup.h>
The texture/sampler or buffer that can be binded to a shader.
-
template<typename
T>
classBuffer: public Vortex::Renderer::GenericBuffer¶ - #include <Buffer.h>
a storage buffer type of buffer
-
class
Clear: public Vortex::Renderer::Drawable¶ - #include <Shapes.h>
A drawable that simply clears the target.
Public Functions
-
void
Initialize(const RenderState &renderState)¶ Initialize the drawable for a particular state. This might include creating the correct pipeline. If it was already initialized, it will do nothing.
- Parameters
renderState: the state to initialize with.
-
void
Update(const glm::mat4 &projection, const glm::mat4 &view)¶ Update the MVP matrix of the drawable.
- Parameters
projection: the projection matrixview: the view matrix
-
void
Draw(CommandEncoder &commandEncoder, const RenderState &renderState)¶ Draw for the given render state. This has to be initialized before.
- Parameters
commandBuffer: the command buffer to record into.renderState: the render state to use.
-
void
-
struct
ColorBlendState¶ - #include <RenderState.h>
The blend state and blend constant.
-
class
CommandBuffer¶ - #include <CommandBuffer.h>
Can record commands, then submit them (multiple times). A fence can used to wait on the completion of the commands.
Public Functions
-
VORTEX_API
CommandBuffer(Device &device, bool synchronise = true)¶ Creates a command buffer which can be synchronized.
- Parameters
device: vulkan devicesynchronise: flag to determine if the command buffer can be waited on.
-
VORTEX_API CommandBuffer& Vortex::Renderer::CommandBuffer::Record(CommandFn commandFn) Record some commands. The commads are recorded in the lambda which is immediately executed.
- Parameters
commandFn: a functor, or simply a lambda, where commands are recorded.
-
VORTEX_API CommandBuffer& Vortex::Renderer::CommandBuffer::Record(const RenderTarget & renderTarget, Handle::Framebuffer framebuffer, CommandFn commandFn) Record some commands inside a render pass. The commads are recorded in the lambda which is immediately executed.
- Parameters
renderTarget: the render target which contains the render pass to record intoframebuffer: the frame buffer where the render pass will render.commandFn: a functor, or simply a lambda, where commands are recorded.
-
VORTEX_API CommandBuffer& Vortex::Renderer::CommandBuffer::Wait() Wait for the command submit to finish. Does nothing if the synchronise flag was false.
-
VORTEX_API CommandBuffer& Vortex::Renderer::CommandBuffer::Reset() Reset the command buffer so it can be recorded again.
-
VORTEX_API CommandBuffer& Vortex::Renderer::CommandBuffer::Submit(const std::initializer_list< Handle::Semaphore > & waitSemaphores = {}, const std::initializer_list< Handle::Semaphore > & signalSemaphores = {}) submit the command buffer
-
VORTEX_API
operator bool() const¶ explicit conversion operator to bool, indicates if the command was properly recorded and can be sumitted.
-
VORTEX_API
-
struct
ComputeSize¶ - #include <Work.h>
Used for a compute shader, and defines the group size, local size and domain size.
Public Functions
-
VORTEX_API
ComputeSize(const glm::ivec2 &size, const glm::ivec2 &localSize = GetLocalSize2D())¶ Creates a ComputeSize using a 2D domain size and the default 2D local size.
- Parameters
size: the domain sizelocalSize: the local size of the shader
-
VORTEX_API
ComputeSize(int size, int localSize = GetLocalSize1D())¶ Creates a ComputeSize using a 1D domain size and the default 1D local size.
- Parameters
size: the domain sizelocalSize: the local size of the shader
Public Static Functions
-
static VORTEX_API glm::ivec2 Vortex::Renderer::ComputeSize::GetLocalSize2D() The default local size for 2D compute shaders.
- Return
- a 2d vector
-
static VORTEX_API int Vortex::Renderer::ComputeSize::GetLocalSize1D() The default local size for 1D compute shaders.
- Return
- a integer value
-
static VORTEX_API glm::ivec2 Vortex::Renderer::ComputeSize::GetWorkSize(const glm::ivec2 & size, const glm::ivec2 & localSize = GetLocalSize2D ()) Computes the 2D group size given a domain size.
- Return
- the group size
- Parameters
size: the domain size of the shaderlocalSize: the local size of the shader
-
static VORTEX_API glm::ivec2 Vortex::Renderer::ComputeSize::GetWorkSize(int size, int localSize = GetLocalSize1D ()) Computes the 1D group size given a domain size.
- Return
- the group size
- Parameters
size: the domain size of the shaderlocalSize: the local size of the shader
-
static VORTEX_API ComputeSize Vortex::Renderer::ComputeSize::Default2D() A default ComputeSize using the default 2D local size. The domain size is (1,1)
- Return
- a default compute size
-
static VORTEX_API ComputeSize Vortex::Renderer::ComputeSize::Default1D() A default ComputeSize using the default 1D local size. The domain size is (1,1)
- Return
- a default compute size
-
VORTEX_API
-
class
Device¶ - #include <Device.h>
Encapsulation around the vulkan device. Allows to create command buffers, layout, bindings, memory and shaders.
Subclassed by Vortex::Renderer::VulkanDevice
Public Functions
-
virtual VORTEX_API Handle::BindGroupLayout Vortex::Renderer::Device::CreateBindGroupLayout(const SPIRV::ShaderLayouts & layout)= 0 Create, cache and return a descriptor layout given the pipeline layout.
- Return
- cached descriptor set layout
- Parameters
layout: pipeline layout
-
virtual VORTEX_API Handle::PipelineLayout Vortex::Renderer::Device::CreatePipelineLayout(const SPIRV::ShaderLayouts & layout)= 0 create, cache and return a vulkan pipeline layout given the layout
- Return
- vulkan pipeline layout
- Parameters
layout: pipeline layout
-
virtual VORTEX_API Handle::Pipeline Vortex::Renderer::Device::CreateGraphicsPipeline(const GraphicsPipelineDescriptor & builder, const RenderState & renderState)= 0 Create a graphics pipeline.
- Return
- Parameters
builder:renderState:
-
virtual VORTEX_API Handle::Pipeline Vortex::Renderer::Device::CreateComputePipeline(Handle::ShaderModule shader, Handle::PipelineLayout layout, SpecConstInfo specConstInfo = {})= 0 Create a compute pipeline.
- Parameters
shader:layout:specConstInfo:
-
-
struct
DispatchParams¶ - #include <Work.h>
Parameters for indirect compute: group size, local size, etc.
-
struct
Drawable¶ - #include <Drawable.h>
Interface of a drawable object.
Subclassed by Vortex::Fluid::Circle, Vortex::Fluid::Polygon, Vortex::Renderer::AbstractSprite, Vortex::Renderer::Clear, Vortex::Renderer::Shape
Public Functions
-
virtual void
Initialize(const RenderState &renderState) = 0¶ Initialize the drawable for a particular state. This might include creating the correct pipeline. If it was already initialized, it will do nothing.
- Parameters
renderState: the state to initialize with.
-
virtual void
Update(const glm::mat4 &projection, const glm::mat4 &view) = 0¶ Update the MVP matrix of the drawable.
- Parameters
projection: the projection matrixview: the view matrix
-
virtual void
Draw(CommandEncoder &commandEncoder, const RenderState &renderState) = 0¶ Draw for the given render state. This has to be initialized before.
- Parameters
commandBuffer: the command buffer to record into.renderState: the render state to use.
-
virtual void
-
struct
DynamicDispatcher: public DispatchLoaderBase¶ - #include <Device.h>
A vulkan dynamic dispatcher that checks if the function is not null.
-
class
Ellipse: public Vortex::Renderer::Shape¶ - #include <Shapes.h>
A solid colour ellipse. Implements the Drawable interface and Transformable interface.
Public Functions
-
void
Initialize(const RenderState &renderState)¶ Initialize the drawable for a particular state. This might include creating the correct pipeline. If it was already initialized, it will do nothing.
- Parameters
renderState: the state to initialize with.
-
void
Update(const glm::mat4 &projection, const glm::mat4 &view)¶ Update the MVP matrix of the drawable.
- Parameters
projection: the projection matrixview: the view matrix
-
void
Draw(CommandEncoder &commandEncoder, const RenderState &renderState)¶ Draw for the given render state. This has to be initialized before.
- Parameters
commandBuffer: the command buffer to record into.renderState: the render state to use.
-
void
-
class
GenericBuffer¶ - #include <Buffer.h>
A vulkan buffer which can be on the host or the device.
Subclassed by Vortex::Renderer::Buffer< float >, Vortex::Renderer::Buffer< glm::ivec2 >, Vortex::Renderer::Buffer< glm::vec2 >, Vortex::Renderer::Buffer< int >, Vortex::Renderer::Buffer< std::uint32_t >, Vortex::Renderer::Buffer< Vortex::Fluid::Contour::Voxel >, Vortex::Renderer::Buffer< Vortex::Fluid::Particle >, Vortex::Renderer::Buffer< Vortex::Fluid::RigidBody::Velocity >, Vortex::Renderer::Buffer< Vortex::Renderer::DispatchParams >, Vortex::Renderer::Buffer< Vortex::Renderer::DrawIndexedIndirect >, Vortex::Renderer::IndexBuffer< std::uint32_t >, Vortex::Renderer::IndirectBuffer< Vortex::Renderer::DispatchParams >, Vortex::Renderer::UniformBuffer< glm::mat4 >, Vortex::Renderer::UniformBuffer< glm::vec2 >, Vortex::Renderer::UniformBuffer< glm::vec4 >, Vortex::Renderer::UniformBuffer< Size >, Vortex::Renderer::UniformBuffer< Vortex::Fluid::RigidBody::Velocity >, Vortex::Renderer::VertexBuffer< glm::vec2 >, Vortex::Renderer::VertexBuffer< Vortex::Renderer::AbstractSprite::Vertex >, Vortex::Renderer::Buffer< T >, Vortex::Renderer::IndexBuffer< T >, Vortex::Renderer::IndirectBuffer< T >, Vortex::Renderer::UniformBuffer< T >, Vortex::Renderer::VertexBuffer< T >
Public Functions
-
VORTEX_API void Vortex::Renderer::GenericBuffer::CopyFrom(CommandEncoder & command, GenericBuffer & srcBuffer) Copy a buffer to this buffer.
- Parameters
commandBuffer: command buffer to run the copy on.srcBuffer: the source buffer.
-
VORTEX_API void Vortex::Renderer::GenericBuffer::CopyFrom(CommandEncoder & command, Texture & srcTexture) Copy a texture to this buffer.
- Parameters
commandBuffer: command buffer to run the copy on.srcTexture: the source texture
-
VORTEX_API Handle::Buffer Vortex::Renderer::GenericBuffer::Handle() const The vulkan handle.
-
VORTEX_API std::uint64_t Vortex::Renderer::GenericBuffer::Size() const The size in bytes of the buffer.
-
VORTEX_API void Vortex::Renderer::GenericBuffer::Resize(std::uint64_t size) Resize the buffer. Invalidates the buffer handle.
- Parameters
size: buffer size
-
VORTEX_API void Vortex::Renderer::GenericBuffer::Barrier(CommandEncoder & command, Access oldAccess, Access newAccess) Inserts a barrier for this buffer.
- Parameters
commandBuffer: the command buffer to run the barrieroldAccess: old accessnewAccess: new access
-
VORTEX_API void Vortex::Renderer::GenericBuffer::Clear(CommandEncoder & command) Clear the buffer with 0.
- Parameters
commandBuffer: the command buffer to clear on
-
VORTEX_API void Vortex::Renderer::GenericBuffer::CopyFrom(uint32_t offset, const void * data, uint32_t size) copy from data to buffer
- Parameters
offset: in the bufferdata: pointersize: of data
-
VORTEX_API void Vortex::Renderer::GenericBuffer::CopyTo(uint32_t offset, void * data, uint32_t size) copy buffer to data
- Parameters
offset: in the bufferdata: pointersize: of data
-
-
class
GraphicsPipelineDescriptor¶ - #include <Pipeline.h>
graphics pipeline which caches the pipeline per render states.
Public Functions
-
VORTEX_API GraphicsPipelineDescriptor& Vortex::Renderer::GraphicsPipelineDescriptor::Shader(Handle::ShaderModule shader, ShaderStage shaderStage) Set the shader.
- Return
- *this
- Parameters
shader: the loaded shadershaderStage: shader state (vertex, fragment or compute)
-
VORTEX_API GraphicsPipelineDescriptor& Vortex::Renderer::GraphicsPipelineDescriptor::VertexAttribute(uint32_t location, uint32_t binding, Format format, uint32_t offset) Sets the vertex attributes.
- Return
- *this
- Parameters
location: location in the shaderbinding: binding in the shaderformat: vertex formatoffset: offset in the vertex
-
VORTEX_API GraphicsPipelineDescriptor& Vortex::Renderer::GraphicsPipelineDescriptor::VertexBinding(uint32_t binding, uint32_t stride) Sets the vertex binding.
- Return
- *this
- Parameters
binding: binding in the shaderstride: stride in bytes
-
-
struct
Image¶ - #include <BindGroup.h>
The texture or sampler that can be bound to a shader.
-
template<typename
T>
classIndexBuffer: public Vortex::Renderer::GenericBuffer¶ - #include <Buffer.h>
a index buffer type of buffer
-
template<typename
T>
classIndirectBuffer: public Vortex::Renderer::GenericBuffer¶ - #include <Buffer.h>
an indirect buffer type of buffer, used for compute indirect dispatch
-
class
Instance¶ - #include <Instance.h>
Vulkan instance, which extensions enabled.
-
class
IntRectangle: public Vortex::Renderer::AbstractShape¶ - #include <Shapes.h>
A solid colour rectangle as Rectangle, however uses integer colors and is meant to be drawn to a framebuffer wiht integer colours.
-
class
Mesh: public Vortex::Renderer::Shape¶ - #include <Shapes.h>
A solid colour mesh countour. Implements the Drawable interface and Transformable interface.
Public Functions
-
VORTEX_API void Vortex::Renderer::Mesh::Initialize(const RenderState & renderState) Initialize the drawable for a particular state. This might include creating the correct pipeline. If it was already initialized, it will do nothing.
- Parameters
renderState: the state to initialize with.
-
VORTEX_API void Vortex::Renderer::Mesh::Update(const glm::mat4 & projection, const glm::mat4 & view) Update the MVP matrix of the drawable.
- Parameters
projection: the projection matrixview: the view matrix
-
VORTEX_API void Vortex::Renderer::Mesh::Draw(CommandEncoder & commandEncoder, const RenderState & renderState) Draw for the given render state. This has to be initialized before.
- Parameters
commandBuffer: the command buffer to record into.renderState: the render state to use.
-
-
class
Rectangle: public Vortex::Renderer::AbstractShape¶ - #include <Shapes.h>
A solid colour rectangle defined by two triangles. Implements the Drawable interface and Transformable interface.
-
class
RenderCommand¶ - #include <CommandBuffer.h>
A special command buffer that has been recorded by a RenderTarget. It can be used to submit the rendering. The object has to stay alive untill rendering is complete.
Public Functions
-
VORTEX_API RenderCommand& Vortex::Renderer::RenderCommand::Submit(const glm::mat4 & view = glm::mat4(1.0f)) Submit the render command with a transform matrix.
- Return
- *this
- Parameters
view: a transform matrix
-
VORTEX_API void Vortex::Renderer::RenderCommand::Wait() Wait for the render command to complete.
-
VORTEX_API
operator bool() const¶ explicit conversion operator to bool, indicates if the command was properly recorded and can be sumitted.
-
-
class
RenderpassBuilder¶ - #include <RenderPass.h>
Factory for a vulkan render pass.
Public Functions
-
RenderpassBuilder &
Attachement(Format format)¶ Format of the render pass.
- Return
- Parameters
format:
-
RenderpassBuilder &
AttachementLoadOp(vk::AttachmentLoadOp value)¶ operation to perform when loading the framebuffer (clear, load, etc)
- Return
- Parameters
value:
-
RenderpassBuilder &
AttachementStoreOp(vk::AttachmentStoreOp value)¶ operation to perform when storing the framebuffer (clear, save, etc)
- Return
- Parameters
value:
-
RenderpassBuilder &
AttachementInitialLayout(vk::ImageLayout layout)¶ Layout of the image to be before render pass.
- Return
- Parameters
layout:
-
RenderpassBuilder &
AttachementFinalLayout(vk::ImageLayout layout)¶ Layout of the image to be after render pass.
- Return
- Parameters
layout:
-
RenderpassBuilder &
Subpass(vk::PipelineBindPoint bindPoint)¶ Define subpass of the render pass.
- Return
- Parameters
bindPoint:
-
RenderpassBuilder &
SubpassColorAttachment(vk::ImageLayout layout, uint32_t attachment)¶ Set the color attachment with index.
- Return
- Parameters
layout:attachment: index of the attachment
-
RenderpassBuilder &
Dependency(uint32_t srcSubpass, uint32_t dstSubpass)¶ Dependency of the subpasses.
- Return
- Parameters
srcSubpass:dstSubpass:
-
vk::RenderPass
Create(vk::Device device)¶ Create the render pass.
- Return
- Parameters
device:
-
RenderpassBuilder &
-
struct
RenderState¶ - #include <RenderState.h>
the various state to render to a target: size, render pass and blend.
Public Functions
-
RenderState(const RenderTarget &renderTarget)¶ Initialize for a render target with default blend.
- Parameters
renderTarget:
-
RenderState(const RenderTarget &renderTarget, ColorBlendState blendState)¶ Initialize for a render target with a given blend.
- Parameters
renderTarget:blendState:
-
-
struct
RenderTarget¶ - #include <RenderTarget.h>
A target that can be rendered to. This is implemented by the RenderWindow and the RenderTexture.
Subclassed by Vortex::Renderer::RenderTexture, Vortex::Renderer::RenderWindow
-
class
RenderTexture: public Vortex::Renderer::RenderTarget, public Vortex::Renderer::Texture¶ - #include <RenderTexture.h>
A render target that renders into a texture.
Subclassed by Vortex::Fluid::Density, Vortex::Fluid::LevelSet, Vortex::Fluid::ParticleCount, Vortex::Fluid::Velocity
-
class
RenderWindow: public Vortex::Renderer::RenderTarget¶ - #include <RenderWindow.h>
Render to a swapchain, i.e. to the window/surface.
Public Functions
-
VORTEX_API
RenderWindow(Device &device, Handle::Surface surface, uint32_t width, uint32_t height)¶ Initialize with a given surface and size.
- Parameters
device: vulkan devicesurface: vulkan surfacewidth:height:
-
VORTEX_API void Vortex::Renderer::RenderWindow::Display() Submits all the render command and present the surface for display.
-
VORTEX_API
-
class
Shape: public Vortex::Renderer::Drawable, public Vortex::Renderer::Transformable¶ - #include <Shapes.h>
Shape interface which is drawable, transformable and has a color.
Subclassed by Vortex::Renderer::AbstractShape, Vortex::Renderer::Ellipse, Vortex::Renderer::Mesh
-
struct
SpecConstInfo¶ - #include <Pipeline.h>
Defines and holds value of the specification constants for shaders.
-
class
SpirvBinary¶ - #include <Common.h>
A binary SPIRV shader, to be feed to vulkan.
-
class
Sprite: public Vortex::Renderer::AbstractSprite¶ - #include <Sprite.h>
A sprite that renders a texture with a simple pass-through fragment shader.
Subclassed by Vortex::Fluid::Density
-
class
Texture¶ - #include <Texture.h>
A texture, or in vulkan terms, an image.
Subclassed by Vortex::Renderer::RenderTexture
Public Functions
-
VORTEX_API void Vortex::Renderer::Texture::CopyFrom(const void * data) Copies width*heigh*bytesPerPixel amount of data.
- Parameters
data: source data
-
VORTEX_API void Vortex::Renderer::Texture::CopyTo(void * data) Copies width*heigh*bytesPerPixel amount of data.
- Parameters
data: destination data
-
VORTEX_API void Vortex::Renderer::Texture::CopyFrom(CommandEncoder & command, Texture & srcImage) Copies source texture in this texture.
- Parameters
commandBuffer: vulkan command buffersrcImage: source image
-
VORTEX_API void Vortex::Renderer::Texture::Barrier(CommandEncoder & command, ImageLayout oldLayout, Access oldAccess, ImageLayout newLayout, Access newAccess) Inserts a barrier for the given texture, command buffer and access.
- Parameters
image: the vulkan image handlecommandBuffer: the vulkan command bufferoldLayout: old layoutsrcMask: old accessnewLayout: new layoutdstMask: new access
-
-
class
Timer¶ - #include <Timer.h>
Calculates the ellapsed time on the GPU.
Public Functions
-
VORTEX_API void Vortex::Renderer::Timer::Start(CommandEncoder & command) Start the timer after the current last command buffer.
- Parameters
commandBuffer: command buffer to write timestamp
-
VORTEX_API void Vortex::Renderer::Timer::Stop(CommandEncoder & command) Start the timer after the current last command buffer.
- Parameters
commandBuffer: command buffer to write timestamp
-
VORTEX_API void Vortex::Renderer::Timer::Start() Start the timer after the current last command buffer.
-
VORTEX_API void Vortex::Renderer::Timer::Stop() Stop the timer after the current last command buffer.
-
VORTEX_API void Vortex::Renderer::Timer::Wait() Wait for Start and Stop to finish before retrieving the results.
-
VORTEX_API uint64_t Vortex::Renderer::Timer::GetElapsedNs() Get the elapsed time between the Start and Stop calls. Blocking function which will download the timestamps from the GPU.
- Return
- timestamp in nanoseconds.
-
-
struct
Transformable¶ - #include <Transformable.h>
Class to represent the transformation of an object: position, scale, rotation and anchor.
Subclassed by Vortex::Fluid::Circle, Vortex::Fluid::Polygon, Vortex::Fluid::RigidBody, Vortex::Renderer::AbstractSprite, Vortex::Renderer::Shape
-
template<typename
T>
classUniformBuffer: public Vortex::Renderer::GenericBuffer¶ - #include <Buffer.h>
a uniform buffer type of buffer
-
template<typename
T>
classVertexBuffer: public Vortex::Renderer::GenericBuffer¶ - #include <Buffer.h>
a vertex buffer type of buffer
-
class
VulkanDevice: public Vortex::Renderer::Device¶ Public Functions
-
Handle::BindGroupLayout
CreateBindGroupLayout(const SPIRV::ShaderLayouts &layout)¶ Create, cache and return a descriptor layout given the pipeline layout.
- Return
- cached descriptor set layout
- Parameters
layout: pipeline layout
-
Handle::PipelineLayout
CreatePipelineLayout(const SPIRV::ShaderLayouts &layout)¶ create, cache and return a vulkan pipeline layout given the layout
- Return
- vulkan pipeline layout
- Parameters
layout: pipeline layout
-
Handle::Pipeline
CreateGraphicsPipeline(const GraphicsPipelineDescriptor &builder, const RenderState &renderState)¶ Create a graphics pipeline.
- Return
- Parameters
builder:renderState:
-
Handle::Pipeline
CreateComputePipeline(Handle::ShaderModule shader, Handle::PipelineLayout layout, SpecConstInfo specConstInfo = {})¶ Create a compute pipeline.
- Parameters
shader:layout:specConstInfo:
-
Handle::BindGroupLayout
-
class
Work¶ - #include <Work.h>
Represents a compute shader. It simplifies the process of binding, setting push constants and recording.
Public Functions
-
VORTEX_API
Work(Device &device, const ComputeSize &computeSize, const SpirvBinary &spirv, const SpecConstInfo &additionalSpecConstInfo = {})¶ Constructs an object using a SPIRV binary. It is not bound to any buffers or textures.
- Parameters
device: vulkan devicecomputeSize: the compute size. Can be a default one with size (1,1) or one with an actual size.spirv: binary spirvadditionalSpecConstInfo: additional specialization constants
-
VORTEX_API Bound Vortex::Renderer::Work::Bind(const std::vector< BindingInput > & inputs) Bind the buffers and/or textures.
- Return
- a bound object, ready to be recorded in a command buffer.
- Parameters
inputs: a list of buffers and/or textures
-
VORTEX_API Bound Vortex::Renderer::Work::Bind(ComputeSize computeSize, const std::vector< BindingInput > & inputs) Bind the buffers and/or textures. This overrides the provided compute size in Work.
- Return
- a bound object, ready to be recorded in a command buffer.
- Parameters
computeSize: the compute shader compute size.inputs: a list of buffers and/or textures
-
class
Bound¶ - #include <Work.h>
Is a bound version of Work. This means a buffer or texture was bound and this can be recorded in a command buffer.
Public Functions
-
template<typename ...
Args>
voidPushConstant(CommandEncoder &command, Args&&... args)¶ Adds a constant value, i.e. a push constant.
- Parameters
commandBuffer: the command buffer where the compute work will also be recorded.args: the data to push. A total of 128 bytes can be used.
-
VORTEX_API void Vortex::Renderer::Work::Bound::Record(CommandEncoder & command) Record the compute work in this command buffer. This will also set two additional push constants: the 2D domain size.
- Parameters
commandBuffer: the command buffer to record into.
-
VORTEX_API void Vortex::Renderer::Work::Bound::RecordIndirect(CommandEncoder & command, IndirectBuffer < DispatchParams > & dispatchParams) Record the compute work in this command buffer. Use the provided parameters to run the compute shader.
- Parameters
commandBuffer: the command buffer to record into.dispatchParams: the indirect buffer containing the parameters.
-
template<typename ...
-
VORTEX_API
-
namespace
Detail¶ Functions
-
void
InsertSpecConst(SpecConstInfo&)¶
-
template<typename
Arg, typename ...Args>
voidInsertSpecConst(SpecConstInfo &specConstInfo, Arg &&arg, Args&&... args)¶
-
void
-
namespace
Handle¶ Typedefs
-
typedef struct PipelineLayout_T *
PipelineLayout¶
-
typedef struct BindGroupLayout_T *
BindGroupLayout¶
-
typedef struct Pipeline_T *
Pipeline¶
-
typedef struct ShaderModule_T *
ShaderModule¶
-
typedef struct RenderPass_T *
RenderPass¶
-
typedef struct Framebuffer_T *
Framebuffer¶
-
typedef struct CommandBuffer_T *
CommandBuffer¶
-
typedef struct Semaphore_T *
Semaphore¶
-
typedef struct BindGroup_T *
BindGroup¶
-
typedef struct Buffer_T *
Buffer¶
-
typedef struct Sampler_T *
Sampler¶
-
typedef struct Image_T *
Image¶
-
typedef struct ImageView_T *
ImageView¶
-
typedef struct Surface_T *
Surface¶
Functions
-
Framebuffer
ConvertFramebuffer(vk::Framebuffer framebuffer)¶
-
vk::CommandBuffer
ConvertCommandBuffer(CommandBuffer commandBuffer)¶
-
typedef struct PipelineLayout_T *
-
template<template<typename> class