Vireo  0.0
Vireo 3D Rendering Hardware Interface
Vireo Class Referenceabstract

Detailed Description

Main abstraction class.

Manual page : The Vireo class

Public Member Functions

virtual void waitIdle ()
 
virtual std::shared_ptr< SwapChaincreateSwapChain (ImageFormat format, const std::shared_ptr< const SubmitQueue > &presentQueue, void *windowHandle, PresentMode presentMode=PresentMode::VSYNC, uint32_t framesInFlight=2) const = 0
 
virtual std::shared_ptr< SubmitQueuecreateSubmitQueue (CommandType commandType, const std::wstring &name=L"SubmitQueue") const = 0
 
virtual std::shared_ptr< FencecreateFence (bool createSignaled=false, const std::wstring &name=L"Fence") const = 0
 
virtual std::shared_ptr< SemaphorecreateSemaphore (SemaphoreType type, const std::wstring &name=L"Semaphore") const = 0
 
virtual std::shared_ptr< CommandAllocatorcreateCommandAllocator (CommandType type) const = 0
 
virtual std::shared_ptr< VertexInputLayoutcreateVertexLayout (size_t size, const std::vector< VertexAttributeDesc > &attributesDescriptions) const = 0
 
virtual std::shared_ptr< ShaderModulecreateShaderModule (const std::string &fileName) const = 0
 
virtual std::shared_ptr< ShaderModulecreateShaderModule (const std::vector< char > &data) const = 0
 
virtual std::shared_ptr< PipelineResourcescreatePipelineResources (const std::vector< std::shared_ptr< DescriptorLayout >> &descriptorLayouts={}, const PushConstantsDesc &pushConstant={}, const std::wstring &name=L"PipelineResource") const = 0
 
virtual std::shared_ptr< ComputePipelinecreateComputePipeline (const std::shared_ptr< PipelineResources > &pipelineResources, const std::shared_ptr< const ShaderModule > &shader, const std::wstring &name=L"ComputePipeline") const = 0
 
virtual std::shared_ptr< GraphicPipelinecreateGraphicPipeline (const GraphicPipelineConfiguration &configuration, const std::wstring &name=L"GraphicPipeline") const = 0
 
virtual std::shared_ptr< BuffercreateBuffer (BufferType type, size_t size, size_t count=1, const std::wstring &name=L"Buffer") const = 0
 
virtual std::shared_ptr< ImagecreateImage (ImageFormat format, uint32_t width, uint32_t height, uint32_t mipLevels=1, uint32_t arraySize=1, const std::wstring &name=L"Image") const = 0
 
virtual std::shared_ptr< ImagecreateReadWriteImage (ImageFormat format, uint32_t width, uint32_t height, uint32_t mipLevels=1, uint32_t arraySize=1, const std::wstring &name=L"RWImage") const = 0
 
virtual std::shared_ptr< RenderTargetcreateRenderTarget (ImageFormat format, uint32_t width, uint32_t height, RenderTargetType type=RenderTargetType::COLOR, ClearValue clearValue={}, MSAA msaa=MSAA::NONE, const std::wstring &name=L"RenderTarget") const = 0
 
virtual std::shared_ptr< RenderTargetcreateRenderTarget (const std::shared_ptr< const SwapChain > &swapChain, ClearValue clearValue={}, MSAA msaa=MSAA::NONE, const std::wstring &name=L"RenderTarget") const = 0
 
virtual std::shared_ptr< DescriptorLayoutcreateDescriptorLayout (const std::wstring &name=L"DescriptorLayout") const = 0
 
virtual std::shared_ptr< DescriptorLayoutcreateSamplerDescriptorLayout (const std::wstring &name=L"createSamplerDescriptorLayout") const = 0
 
std::shared_ptr< DescriptorLayoutcreateDynamicUniformDescriptorLayout (const std::wstring &name=L"createDynamicUniformDescriptorLayout") const
 
virtual std::shared_ptr< DescriptorSetcreateDescriptorSet (const std::shared_ptr< const DescriptorLayout > &layout, const std::wstring &name=L"DescriptorSet") const = 0
 
virtual std::shared_ptr< SamplercreateSampler (Filter minFilter, Filter magFilter, AddressMode addressModeU, AddressMode addressModeV, AddressMode addressModeW, float minLod=0.0f, float maxLod=Sampler::LOD_CLAMP_NONE, bool anisotropyEnable=true, MipMapMode mipMapMode=MipMapMode::LINEAR) const = 0
 
virtual std::wstring getShaderFileExtension () const = 0
 
auto getPhysicalDevice () const
 
auto getDevice () const
 
auto getInstance () const
 
virtual ~Vireo () = default
 
 Vireo () = default
 
 Vireo (Vireo &) = delete
 
Vireo & operator= (const Vireo &) = delete
 

Static Public Member Functions

static std::shared_ptr< Vireo > create (Backend backend, uint32_t maxDirectX12Descriptors=1000, uint32_t maxDirectX12Samplers=100)
 
static bool isBackendSupported (Backend backend)
 

Protected Attributes

std::shared_ptr< Instanceinstance
 
std::shared_ptr< PhysicalDevicephysicalDevice
 
std::shared_ptr< Devicedevice
 

Constructor & Destructor Documentation

virtual ~Vireo ( )
virtualdefault
Vireo ( )
default
Vireo ( Vireo &  )
delete

Member Function Documentation

static std::shared_ptr<Vireo> create ( Backend  backend,
uint32_t  maxDirectX12Descriptors = 1000,
uint32_t  maxDirectX12Samplers = 100 
)
static

Creates a new Vireo class using the given backend.

virtual std::shared_ptr<Buffer> createBuffer ( BufferType  type,
size_t  size,
size_t  count = 1,
const std::wstring &  name = L"Buffer" 
) const
pure virtual

Creates a data buffer in VRAM. For types UNIFORM & TRANSFER the buffer will be created in host visible memory/upload heap type. For types VERTEX & INDEX the buffer will be created in device local memory/default heap type

Parameters
typeType of buffer to create.
sizeSize of one element in bytes
countNumber of elements
nameObject name for debug
virtual std::shared_ptr<CommandAllocator> createCommandAllocator ( CommandType  type) const
pure virtual

Creates a command allocator (command pool) for a given command type

Parameters
typeType of commands that will be used with command lists created from this allocator
virtual std::shared_ptr<ComputePipeline> createComputePipeline ( const std::shared_ptr< PipelineResources > &  pipelineResources,
const std::shared_ptr< const ShaderModule > &  shader,
const std::wstring &  name = L"ComputePipeline" 
) const
pure virtual

Creates a compute pipeline

Parameters
pipelineResourcesResources for the shader
shaderThe shader
nameObject name for debug
virtual std::shared_ptr<DescriptorLayout> createDescriptorLayout ( const std::wstring &  name = L"DescriptorLayout") const
pure virtual

Creates an empty description layout.

Parameters
nameObject name for debug
virtual std::shared_ptr<DescriptorSet> createDescriptorSet ( const std::shared_ptr< const DescriptorLayout > &  layout,
const std::wstring &  name = L"DescriptorSet" 
) const
pure virtual

Creates an empty descriptor set

Parameters
layoutLayout of the set
nameObject name for debug
std::shared_ptr<DescriptorLayout> createDynamicUniformDescriptorLayout ( const std::wstring &  name = L"createDynamicUniformDescriptorLayout") const

Creates an empty description layout for UNIFORM_DYNAMIX resources types

Parameters
nameObject name for debug
virtual std::shared_ptr<Fence> createFence ( bool  createSignaled = false,
const std::wstring &  name = L"Fence" 
) const
pure virtual

Creates a fence for CPU/GPU synchronization

Parameters
createSignaledCreate the fence in signaled state
nameObject name for debug
virtual std::shared_ptr<GraphicPipeline> createGraphicPipeline ( const GraphicPipelineConfiguration configuration,
const std::wstring &  name = L"GraphicPipeline" 
) const
pure virtual

Creates a graphic pipeline. At least one shader must be used.

Parameters
configurationPipeline configuration
nameObject name for debug
virtual std::shared_ptr<Image> createImage ( ImageFormat  format,
uint32_t  width,
uint32_t  height,
uint32_t  mipLevels = 1,
uint32_t  arraySize = 1,
const std::wstring &  name = L"Image" 
) const
pure virtual

Creates a read-only image in VRAM

Parameters
formatPixel format
widthWith in pixels
heightHeight in pixels
mipLevelsNumber of mips levels
arraySizeNumber of layers/array size
nameObject name for debug
virtual std::shared_ptr<PipelineResources> createPipelineResources ( const std::vector< std::shared_ptr< DescriptorLayout >> &  descriptorLayouts = {},
const PushConstantsDesc pushConstant = {},
const std::wstring &  name = L"PipelineResource" 
) const
pure virtual

Creates a pipeline resources description. Describe resources that can be accessed by the shaders associated with the future pipelines.

Parameters
descriptorLayoutsDescriptions of the resources (can be empty)
pushConstantDescription of an optional push constant
nameObject name for debug
virtual std::shared_ptr<Image> createReadWriteImage ( ImageFormat  format,
uint32_t  width,
uint32_t  height,
uint32_t  mipLevels = 1,
uint32_t  arraySize = 1,
const std::wstring &  name = L"RWImage" 
) const
pure virtual

Creates a read/write image in VRAM

Parameters
formatPixel format
widthWith in pixels
heightHeight in pixels
mipLevelsNumber of mips levels
arraySizeNumber of layers/array size
nameObject name for debug
virtual std::shared_ptr<RenderTarget> createRenderTarget ( const std::shared_ptr< const SwapChain > &  swapChain,
ClearValue  clearValue = {},
MSAA  msaa = MSAA::NONE,
const std::wstring &  name = L"RenderTarget" 
) const
pure virtual

Creates a read/write image in VRAM for use as a render target with a similar format as a swap chain.

Parameters
swapChainSwap chain to copy format & size from
clearValueA clear value used for optimized clearing. Must be the same as the clear value used when rendering.
msaaNumber of samples for MSAA. A value of 1 disables MSAA.
nameObject name for debug
virtual std::shared_ptr<RenderTarget> createRenderTarget ( ImageFormat  format,
uint32_t  width,
uint32_t  height,
RenderTargetType  type = RenderTargetType::COLOR,
ClearValue  clearValue = {},
MSAA  msaa = MSAA::NONE,
const std::wstring &  name = L"RenderTarget" 
) const
pure virtual

Creates a read/write image in VRAM for use as a render target

Parameters
formatPixel format
widthWith in pixels
heightHeight in pixels
typeType of render target use
clearValueA clear value used for optimized clearing. Must be the same as the clear value used when rendering.
msaaNumber of samples for MSAA. A value of 1 disables MSAA.
nameObject name for debug
virtual std::shared_ptr<Sampler> createSampler ( Filter  minFilter,
Filter  magFilter,
AddressMode  addressModeU,
AddressMode  addressModeV,
AddressMode  addressModeW,
float  minLod = 0.0f,
float  maxLod = Sampler::LOD_CLAMP_NONE,
bool  anisotropyEnable = true,
MipMapMode  mipMapMode = MipMapMode::LINEAR 
) const
pure virtual

Creates a texture sampler.

virtual std::shared_ptr<DescriptorLayout> createSamplerDescriptorLayout ( const std::wstring &  name = L"createSamplerDescriptorLayout") const
pure virtual

Creates an empty description layout for SAMPLER resources types

Parameters
nameObject name for debug
virtual std::shared_ptr<Semaphore> createSemaphore ( SemaphoreType  type,
const std::wstring &  name = L"Semaphore" 
) const
pure virtual

Creates a semaphore for GPU/GPU synchronization

Parameters
typeSemaphore type
nameObject name for debug
virtual std::shared_ptr<ShaderModule> createShaderModule ( const std::string &  fileName) const
pure virtual

Load a compiled shader and creates a shader module

Parameters
fileNameFile name without the extension. The file name extension must be .spvfor Vulkan et .dxil for DirectX
virtual std::shared_ptr<ShaderModule> createShaderModule ( const std::vector< char > &  data) const
pure virtual

Load a compiled shader and creates a shader module from an input stream

Creates a shader module

virtual std::shared_ptr<SubmitQueue> createSubmitQueue ( CommandType  commandType,
const std::wstring &  name = L"SubmitQueue" 
) const
pure virtual

Creates a submission queue

Parameters
commandTypeType of commands that will be used with this queue.
nameObjet name for debug
virtual std::shared_ptr<SwapChain> createSwapChain ( ImageFormat  format,
const std::shared_ptr< const SubmitQueue > &  presentQueue,
void *  windowHandle,
PresentMode  presentMode = PresentMode::VSYNC,
uint32_t  framesInFlight = 2 
) const
pure virtual

Creates a swap chain.

Parameters
formatColor format of the swap chain images
presentQueueQueue used to present the swap chain images in the window surface
presentModePresentation mode
windowHandleOpaque window handle to present the swap chain images
framesInFlightNumber of concurrent swap chain images
virtual std::shared_ptr<VertexInputLayout> createVertexLayout ( size_t  size,
const std::vector< VertexAttributeDesc > &  attributesDescriptions 
) const
pure virtual

Creates an input vertex layout from a description

Parameters
sizeSize in bytes of a vertex
attributesDescriptionsDescription of all the vertex attributes
auto getDevice ( ) const
inline
auto getInstance ( ) const
inline
auto getPhysicalDevice ( ) const
inline

Returns the physical device/adapter object

virtual std::wstring getShaderFileExtension ( ) const
pure virtual
static bool isBackendSupported ( Backend  backend)
static

Returns true if the backend API is supported

Vireo& operator= ( const Vireo &  )
delete
virtual void waitIdle ( )
inlinevirtual

Member Data Documentation

std::shared_ptr<Device> device
protected
std::shared_ptr<Instance> instance
protected
std::shared_ptr<PhysicalDevice> physicalDevice
protected