3#include "spark/render/Buffer.h"
4#include "spark/render/DescriptorSet.h"
5#include "spark/render/IndexBuffer.h"
6#include "spark/render/Pipeline.h"
7#include "spark/render/VertexBuffer.h"
9#include "spark/math/Vector2.h"
13namespace spark::render
29 [[nodiscard]] std::unique_ptr<IBuffer>
createBuffer(BufferType type, BufferUsage usage, std::size_t element_size,
unsigned elements = 1,
bool allow_write =
false)
const
31 return genericCreateBuffer(type, usage, element_size, elements, allow_write);
44 [[nodiscard]] std::unique_ptr<IBuffer>
createBuffer(
const std::string& name,
47 std::size_t element_size,
49 bool allow_write =
false)
const
51 return genericCreateBuffer(name, type, usage, element_size, elements, allow_write);
66 unsigned elements = 1,
67 bool allow_write =
false)
const
69 const auto& descriptor = descriptor_set.
descriptor(binding);
70 return createBuffer(descriptor->type(), usage, descriptor->elementSize(), elements, allow_write);
83 [[nodiscard]] std::unique_ptr<IBuffer>
createBuffer(
const std::string& name,
87 unsigned elements = 1,
88 bool allow_write =
false)
const
90 const auto& descriptor = descriptor_set.
descriptor(binding);
91 return createBuffer(name, descriptor->type(), usage, descriptor->elementSize(), elements, allow_write);
107 std::size_t element_size,
109 bool allow_write =
false)
const
111 return createBuffer(descriptor_set.
descriptor(binding)->
type(), usage, element_size, elements, allow_write);
125 [[nodiscard]] std::unique_ptr<IBuffer>
createBuffer(
const std::string& name,
129 std::size_t element_size,
131 bool allow_write =
false)
const
133 return createBuffer(name, descriptor_set.
descriptor(binding)->
type(), usage, element_size, elements, allow_write);
150 unsigned elements = 1,
151 bool allow_write =
false)
const
153 return createBuffer(pipeline.
layout()->descriptorSet(space), binding, usage, elements, allow_write);
167 [[nodiscard]] std::unique_ptr<IBuffer>
createBuffer(
const std::string& name,
172 unsigned elements = 1,
173 bool allow_write =
false)
const
175 return createBuffer(name, pipeline.
layout()->descriptorSet(space), binding, usage, elements, allow_write);
193 std::size_t element_size,
195 bool allow_write =
false)
const
197 return createBuffer(pipeline.
layout()->descriptorSet(space), binding, usage, element_size, elements, allow_write);
212 [[nodiscard]] std::unique_ptr<IBuffer>
createBuffer(
const std::string& name,
217 std::size_t element_size,
218 unsigned elements = 1,
219 bool allow_write =
false)
const
221 return createBuffer(name, pipeline.
layout()->descriptorSet(space), binding, usage, element_size, elements, allow_write);
236 return genericCreateVertexBuffer(layout, usage, elements);
253 unsigned elements = 1)
const
255 return genericCreateVertexBuffer(name, layout, usage, elements);
270 return genericCreateIndexBuffer(layout, usage, elements);
286 return genericCreateIndexBuffer(name, layout, usage, elements);
298 MultiSamplingLevel samples = MultiSamplingLevel::X1)
const
300 return genericCreateAttachment(format, size, samples);
314 MultiSamplingLevel samples = MultiSamplingLevel::X1)
const
316 return genericCreateAttachment(name, format, size, samples);
335 ImageDimensions dimension = ImageDimensions::DIM_2,
338 MultiSamplingLevel samples = MultiSamplingLevel::X1,
339 bool allow_write =
false)
const
341 return genericCreateTexture(format, size, dimension, levels, layers, samples, allow_write);
359 [[nodiscard]] std::unique_ptr<IImage>
createTexture(
const std::string& name,
362 ImageDimensions dimension = ImageDimensions::DIM_2,
365 MultiSamplingLevel samples = MultiSamplingLevel::X1,
366 bool allow_write =
false)
const
368 return genericCreateTexture(name, format, size, dimension, levels, layers, samples, allow_write);
383 [[nodiscard]] std::vector<std::unique_ptr<IImage>>
createTextures(std::size_t elements,
386 ImageDimensions dimension = ImageDimensions::DIM_2,
389 MultiSamplingLevel samples = MultiSamplingLevel::X1,
390 bool allow_write =
false)
const
392 return genericCreateTextures(elements, format, size, dimension, layers, levels, samples, allow_write);
409 [[nodiscard]] std::unique_ptr<ISampler>
createSampler(FilterMode mag_filter = FilterMode::Nearest,
410 FilterMode min_filter = FilterMode::Nearest,
411 BorderMode border_u = BorderMode::Repeat,
412 BorderMode border_v = BorderMode::Repeat,
413 BorderMode border_w = BorderMode::Repeat,
414 MipMapMode mip_map_mode = MipMapMode::Nearest,
415 float mip_map_bias = 0.f,
416 float max_lod = std::numeric_limits<float>::max(),
418 float anisotropy = 0.f)
const
420 return genericCreateSampler(mag_filter, min_filter, border_u, border_v, border_w, mip_map_mode, mip_map_bias, max_lod, min_lod, anisotropy);
438 [[nodiscard]] std::unique_ptr<ISampler>
createSampler(
const std::string& name,
439 FilterMode mag_filter = FilterMode::Nearest,
440 FilterMode min_filter = FilterMode::Nearest,
441 BorderMode border_u = BorderMode::Repeat,
442 BorderMode border_v = BorderMode::Repeat,
443 BorderMode border_w = BorderMode::Repeat,
444 MipMapMode mip_map_mode = MipMapMode::Nearest,
445 float mip_map_bias = 0.f,
446 float max_lod = std::numeric_limits<float>::max(),
448 float anisotropy = 0.f)
const
450 return genericCreateSampler(name, mag_filter, min_filter, border_u, border_v, border_w, mip_map_mode, mip_map_bias, max_lod, min_lod, anisotropy);
468 [[nodiscard]] std::vector<std::unique_ptr<ISampler>>
createSamplers(std::size_t elements,
469 FilterMode mag_filter = FilterMode::Nearest,
470 FilterMode min_filter = FilterMode::Nearest,
471 BorderMode border_u = BorderMode::Repeat,
472 BorderMode border_v = BorderMode::Repeat,
473 BorderMode border_w = BorderMode::Repeat,
474 MipMapMode mip_map_mode = MipMapMode::Nearest,
475 float mip_map_bias = 0.f,
476 float max_lod = std::numeric_limits<float>::max(),
478 float anisotropy = 0.f)
const
480 return genericCreateSamplers(elements, mag_filter, min_filter, border_u, border_v, border_w, mip_map_mode, mip_map_bias, max_lod, min_lod, anisotropy);
487 [[nodiscard]]
virtual std::unique_ptr<IBuffer> genericCreateBuffer(BufferType type, BufferUsage usage, std::size_t element_size,
unsigned elements,
bool allow_write)
const = 0;
488 [[nodiscard]]
virtual std::unique_ptr<IBuffer> genericCreateBuffer(
const std::string& name, BufferType type, BufferUsage usage, std::size_t element_size,
unsigned elements,
bool allow_write)
const = 0;
489 [[nodiscard]]
virtual std::unique_ptr<IVertexBuffer> genericCreateVertexBuffer(
const IVertexBufferLayout& layout, BufferUsage usage,
unsigned elements)
const = 0;
490 [[nodiscard]]
virtual std::unique_ptr<IVertexBuffer> genericCreateVertexBuffer(
const std::string& name,
const IVertexBufferLayout& layout, BufferUsage usage,
unsigned elements)
const = 0;
491 [[nodiscard]]
virtual std::unique_ptr<IIndexBuffer> genericCreateIndexBuffer(
const IIndexBufferLayout& layout, BufferUsage usage,
unsigned elements)
const = 0;
492 [[nodiscard]]
virtual std::unique_ptr<IIndexBuffer> genericCreateIndexBuffer(
const std::string& name,
const IIndexBufferLayout& layout, BufferUsage usage,
unsigned elements)
const = 0;
493 [[nodiscard]]
virtual std::unique_ptr<IImage> genericCreateAttachment(Format format,
const math::Vector2<unsigned>& size, MultiSamplingLevel samples)
const = 0;
494 [[nodiscard]]
virtual std::unique_ptr<IImage> genericCreateAttachment(
const std::string& name, Format format,
const math::Vector2<unsigned>& size, MultiSamplingLevel samples)
const = 0;
495 [[nodiscard]]
virtual std::unique_ptr<IImage> genericCreateTexture(Format format,
const math::Vector3<unsigned>& size, ImageDimensions dimension,
unsigned levels,
unsigned layers, MultiSamplingLevel samples,
bool allow_write)
const = 0;
496 [[nodiscard]]
virtual std::unique_ptr<IImage> genericCreateTexture(
const std::string& name, Format format,
const math::Vector3<unsigned>& size, ImageDimensions dimension,
unsigned levels,
unsigned layers, MultiSamplingLevel samples,
bool allow_write)
const = 0;
497 [[nodiscard]]
virtual std::vector<std::unique_ptr<IImage>> genericCreateTextures(std::size_t elements, Format format,
const math::Vector3<unsigned>& size, ImageDimensions dimension,
unsigned layers,
unsigned levels, MultiSamplingLevel samples,
bool allow_write)
const = 0;
498 [[nodiscard]]
virtual std::unique_ptr<ISampler> genericCreateSampler(FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy)
const = 0;
499 [[nodiscard]]
virtual std::unique_ptr<ISampler> genericCreateSampler(
const std::string& name, FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy)
const = 0;
500 [[nodiscard]]
virtual std::vector<std::unique_ptr<ISampler>> genericCreateSamplers(std::size_t elements, FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy)
const = 0;
514 template <
typename DescriptorLayoutType,
typename RawBufferType,
typename VertexBufferType,
typename IndexBufferType,
typename ImageType,
typename SamplerType>
518 using descriptor_layout_type = DescriptorLayoutType;
519 using vertex_buffer_type = VertexBufferType;
520 using vertex_buffer_layout_type =
typename vertex_buffer_type::vertex_buffer_layout_type;
521 using index_buffer_type = IndexBufferType;
522 using index_buffer_layout_type =
typename index_buffer_type::index_buffer_layout_type;
523 using buffer_type = RawBufferType;
524 using image_type = ImageType;
525 using sampler_type = SamplerType;
529 [[nodiscard]]
virtual std::unique_ptr<buffer_type>
createBuffer(BufferType type,
531 std::size_t element_size,
533 bool allow_write =
false)
const = 0;
536 [[nodiscard]]
virtual std::unique_ptr<buffer_type>
createBuffer(
const std::string& name,
539 std::size_t element_size,
541 bool allow_write =
false)
const = 0;
544 [[nodiscard]]
virtual std::unique_ptr<vertex_buffer_type>
createVertexBuffer(
const vertex_buffer_layout_type& layout, BufferUsage usage,
unsigned elements = 1)
const =
548 [[nodiscard]]
virtual std::unique_ptr<vertex_buffer_type>
createVertexBuffer(
const std::string& name,
549 const vertex_buffer_layout_type& layout,
551 unsigned elements = 1)
const = 0;
554 [[nodiscard]]
virtual std::unique_ptr<index_buffer_type>
createIndexBuffer(
const index_buffer_layout_type& layout, BufferUsage usage,
unsigned elements)
const = 0;
557 [[nodiscard]]
virtual std::unique_ptr<index_buffer_type>
createIndexBuffer(
const std::string& name,
558 const index_buffer_layout_type& layout,
560 unsigned elements)
const = 0;
565 MultiSamplingLevel samples = MultiSamplingLevel::X1)
const = 0;
568 [[nodiscard]]
virtual std::unique_ptr<image_type>
createAttachment(
const std::string& name,
571 MultiSamplingLevel samples = MultiSamplingLevel::X1)
const = 0;
574 [[nodiscard]]
virtual std::unique_ptr<image_type>
createTexture(Format format,
576 ImageDimensions dimension = ImageDimensions::DIM_2,
579 MultiSamplingLevel samples = MultiSamplingLevel::X1,
580 bool allow_write =
false)
const = 0;
583 [[nodiscard]]
virtual std::unique_ptr<image_type>
createTexture(
const std::string& name,
586 ImageDimensions dimension = ImageDimensions::DIM_2,
589 MultiSamplingLevel samples = MultiSamplingLevel::X1,
590 bool allow_write =
false)
const = 0;
593 [[nodiscard]]
virtual std::vector<std::unique_ptr<image_type>>
createTextures(std::size_t elements,
596 ImageDimensions dimension = ImageDimensions::DIM_2,
599 MultiSamplingLevel samples = MultiSamplingLevel::X1,
600 bool allow_write =
false)
const = 0;
603 [[nodiscard]]
virtual std::unique_ptr<sampler_type>
createSampler(FilterMode mag_filter = FilterMode::Nearest,
604 FilterMode min_filter = FilterMode::Nearest,
605 BorderMode border_u = BorderMode::Repeat,
606 BorderMode border_v = BorderMode::Repeat,
607 BorderMode border_w = BorderMode::Repeat,
608 MipMapMode mip_map_mode = MipMapMode::Nearest,
609 float mip_map_bias = 0.f,
610 float max_lod = std::numeric_limits<float>::max(),
612 float anisotropy = 0.f)
const = 0;
615 [[nodiscard]]
virtual std::unique_ptr<sampler_type>
createSampler(
const std::string& name,
616 FilterMode mag_filter = FilterMode::Nearest,
617 FilterMode min_filter = FilterMode::Nearest,
618 BorderMode border_u = BorderMode::Repeat,
619 BorderMode border_v = BorderMode::Repeat,
620 BorderMode border_w = BorderMode::Repeat,
621 MipMapMode mip_map_mode = MipMapMode::Nearest,
622 float mip_map_bias = 0.f,
623 float max_lod = std::numeric_limits<float>::max(),
625 float anisotropy = 0.f)
const = 0;
628 [[nodiscard]]
virtual std::vector<std::unique_ptr<sampler_type>>
createSamplers(std::size_t elements,
629 FilterMode mag_filter = FilterMode::Nearest,
630 FilterMode min_filter = FilterMode::Nearest,
631 BorderMode border_u = BorderMode::Repeat,
632 BorderMode border_v = BorderMode::Repeat,
633 BorderMode border_w = BorderMode::Repeat,
634 MipMapMode mip_map_mode = MipMapMode::Nearest,
635 float mip_map_bias = 0.f,
636 float max_lod = std::numeric_limits<float>::max(),
638 float anisotropy = 0.f)
const = 0;
642 [[nodiscard]] std::unique_ptr<IBuffer> genericCreateBuffer(render::BufferType type, BufferUsage usage, std::size_t element_size,
unsigned elements,
bool allow_write)
const final {
return createBuffer(type, usage, element_size, elements, allow_write); }
643 [[nodiscard]] std::unique_ptr<IBuffer> genericCreateBuffer(
const std::string& name, render::BufferType type, BufferUsage usage, std::size_t element_size,
unsigned elements,
bool allow_write)
const final {
return createBuffer(name, type, usage, element_size, elements, allow_write); }
644 [[nodiscard]] std::unique_ptr<IVertexBuffer> genericCreateVertexBuffer(
const IVertexBufferLayout& layout, BufferUsage usage,
unsigned elements)
const final {
return createVertexBuffer(
dynamic_cast<const vertex_buffer_layout_type&
>(layout), usage, elements); }
645 [[nodiscard]] std::unique_ptr<IVertexBuffer> genericCreateVertexBuffer(
const std::string& name,
const IVertexBufferLayout& layout, BufferUsage usage,
unsigned elements)
const final {
return createVertexBuffer(name,
dynamic_cast<const vertex_buffer_layout_type&
>(layout), usage, elements); }
646 [[nodiscard]] std::unique_ptr<IIndexBuffer> genericCreateIndexBuffer(
const IIndexBufferLayout& layout, BufferUsage usage,
unsigned elements)
const final {
return createIndexBuffer(
dynamic_cast<const index_buffer_layout_type&
>(layout), usage, elements); }
647 [[nodiscard]] std::unique_ptr<IIndexBuffer> genericCreateIndexBuffer(
const std::string& name,
const IIndexBufferLayout& layout, BufferUsage usage,
unsigned elements)
const final {
return createIndexBuffer(name,
dynamic_cast<const index_buffer_layout_type&
>(layout), usage, elements); }
648 [[nodiscard]] std::unique_ptr<IImage> genericCreateAttachment(Format format,
const math::Vector2<unsigned>& size, MultiSamplingLevel samples)
const final {
return createAttachment(format, size, samples); }
649 [[nodiscard]] std::unique_ptr<IImage> genericCreateAttachment(
const std::string& name, Format format,
const math::Vector2<unsigned>& size, MultiSamplingLevel samples)
const final {
return createAttachment(name, format, size, samples); }
650 [[nodiscard]] std::unique_ptr<IImage> genericCreateTexture(Format format,
const math::Vector3<unsigned>& size, ImageDimensions dimension,
unsigned levels,
unsigned layers, MultiSamplingLevel samples,
bool allow_write)
const final {
return createTexture(format, size, dimension, levels, layers, samples, allow_write); }
651 [[nodiscard]] std::unique_ptr<IImage> genericCreateTexture(
const std::string& name, Format format,
const math::Vector3<unsigned>& size, ImageDimensions dimension,
unsigned levels,
unsigned layers, MultiSamplingLevel samples,
bool allow_write)
const final {
return createTexture(name, format, size, dimension, levels, layers, samples, allow_write); }
652 [[nodiscard]] std::vector<std::unique_ptr<IImage>> genericCreateTextures(std::size_t elements, Format format,
const math::Vector3<unsigned>& size, ImageDimensions dimension,
unsigned layers,
unsigned levels, MultiSamplingLevel samples,
bool allow_write)
const final
654 auto tmp =
createTextures(elements, format, size, dimension, layers, levels, samples, allow_write);
655 std::vector<std::unique_ptr<IImage>> result;
656 result.reserve(tmp.size());
657 std::ranges::transform(tmp, std::back_inserter(result), [](
auto& ptr) {
return std::unique_ptr<IImage>(std::move(ptr)); });
660 [[nodiscard]] std::unique_ptr<ISampler> genericCreateSampler(FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy)
const final {
return createSampler(mag_filter, min_filter, border_u, border_v, border_w, mip_map_mode, mip_map_bias, max_lod, min_lod, anisotropy); }
661 [[nodiscard]] std::unique_ptr<ISampler> genericCreateSampler(
const std::string& name, FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy)
const final {
return createSampler(name, mag_filter, min_filter, border_u, border_v, border_w, mip_map_mode, mip_map_bias, max_lod, min_lod, anisotropy); }
662 [[nodiscard]] std::vector<std::unique_ptr<ISampler>> genericCreateSamplers(std::size_t elements, FilterMode mag_filter, FilterMode min_filter, BorderMode border_u, BorderMode border_v, BorderMode border_w, MipMapMode mip_map_mode,
float mip_map_bias,
float max_lod,
float min_lod,
float anisotropy)
const final
664 auto tmp =
createSamplers(elements, mag_filter, min_filter, border_u, border_v, border_w, mip_map_mode, mip_map_bias, max_lod, min_lod, anisotropy);
665 std::vector<std::unique_ptr<ISampler>> result;
666 result.reserve(tmp.size());
667 std::ranges::transform(tmp, std::back_inserter(result), [](
auto& ptr) {
return std::unique_ptr<ISampler>(std::move(ptr)); });
A vector with two components.
Definition Vector2.h:13
A vector with three components.
Definition Vector3.h:13
Describes a factory that creates objects for a IGraphicsDevice.
Definition GraphicsFactory.h:516
virtual std::unique_ptr< sampler_type > createSampler(const std::string &name, FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const =0
Creates a texture sampler .
virtual std::unique_ptr< sampler_type > createSampler(FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const =0
Creates a texture sampler .
virtual std::unique_ptr< image_type > createAttachment(const std::string &name, Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples=MultiSamplingLevel::X1) const =0
Creates an Image used as a render target attachment.
virtual std::unique_ptr< image_type > createTexture(Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned levels=1, unsigned layers=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const =0
Creates a texture .
virtual std::unique_ptr< buffer_type > createBuffer(const std::string &name, BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const =0
Creates a IBuffer of type type.
virtual std::vector< std::unique_ptr< sampler_type > > createSamplers(std::size_t elements, FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const =0
Creates an array of texture samplers .
virtual std::unique_ptr< index_buffer_type > createIndexBuffer(const std::string &name, const index_buffer_layout_type &layout, BufferUsage usage, unsigned elements) const =0
Creates a IVertexBuffer based on layout.
virtual std::unique_ptr< image_type > createTexture(const std::string &name, Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned levels=1, unsigned layers=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const =0
Creates a texture .
virtual std::unique_ptr< vertex_buffer_type > createVertexBuffer(const vertex_buffer_layout_type &layout, BufferUsage usage, unsigned elements=1) const =0
Creates a IVertexBuffer based on layout.
virtual std::unique_ptr< vertex_buffer_type > createVertexBuffer(const std::string &name, const vertex_buffer_layout_type &layout, BufferUsage usage, unsigned elements=1) const =0
Creates a IVertexBuffer based on layout.
virtual std::unique_ptr< image_type > createAttachment(Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples=MultiSamplingLevel::X1) const =0
Creates an Image used as a render target attachment.
virtual std::unique_ptr< buffer_type > createBuffer(BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const =0
Creates a IBuffer of type type.
virtual std::vector< std::unique_ptr< image_type > > createTextures(std::size_t elements, Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned layers=1, unsigned levels=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const =0
Creates an array of textures .
virtual std::unique_ptr< index_buffer_type > createIndexBuffer(const index_buffer_layout_type &layout, BufferUsage usage, unsigned elements) const =0
Creates a IVertexBuffer based on layout.
virtual BufferType type() const noexcept=0
Gets the type of the buffer.
Interface for a descriptor set layout.
Definition DescriptorSet.h:262
virtual const IDescriptorLayout * descriptor(unsigned int binding) const =0
Gets the layout of a descriptor in the IDescriptorSet bound to a specific binding point.
Definition GraphicsFactory.h:16
std::unique_ptr< IImage > createAttachment(const std::string &name, Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples=MultiSamplingLevel::X1) const
Creates an Image used as a render target attachment.
Definition GraphicsFactory.h:311
std::unique_ptr< IBuffer > createBuffer(const std::string &name, const IPipeline &pipeline, unsigned space, unsigned binding, BufferUsage usage, std::size_t element_size, unsigned elements=1, bool allow_write=false) const
Creates a IBuffer that can be bound to a descriptor set of the specified pipeline,...
Definition GraphicsFactory.h:212
std::unique_ptr< IBuffer > createBuffer(const std::string &name, const IPipeline &pipeline, unsigned space, unsigned binding, BufferUsage usage, unsigned elements=1, bool allow_write=false) const
Creates a IBuffer that can be bound to the specified descriptor_set and binding.
Definition GraphicsFactory.h:167
std::unique_ptr< IImage > createTexture(const std::string &name, Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned levels=1, unsigned layers=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const
Creates a texture .
Definition GraphicsFactory.h:359
std::unique_ptr< IImage > createAttachment(Format format, const math::Vector2< unsigned > &size, MultiSamplingLevel samples=MultiSamplingLevel::X1) const
Creates an Image used as a render target attachment.
Definition GraphicsFactory.h:296
std::unique_ptr< IVertexBuffer > createVertexBuffer(const IVertexBufferLayout &layout, BufferUsage usage, unsigned elements=1) const
Creates a IVertexBuffer based on layout.
Definition GraphicsFactory.h:234
std::unique_ptr< IBuffer > createBuffer(const IDescriptorSetLayout &descriptor_set, unsigned binding, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const
Creates a IBuffer that can be bound to the specified descriptor_set and binding.
Definition GraphicsFactory.h:104
std::unique_ptr< IBuffer > createBuffer(const IPipeline &pipeline, unsigned space, unsigned binding, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const
Creates a IBuffer that can be bound to a descriptor set of the specified pipeline,...
Definition GraphicsFactory.h:189
std::vector< std::unique_ptr< ISampler > > createSamplers(std::size_t elements, FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const
Creates an array of texture samplers .
Definition GraphicsFactory.h:468
std::unique_ptr< ISampler > createSampler(FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const
Creates a texture sampler .
Definition GraphicsFactory.h:409
std::unique_ptr< IBuffer > createBuffer(const IDescriptorSetLayout &descriptor_set, unsigned binding, BufferUsage usage, unsigned elements=1, bool allow_write=false) const
Creates a IBuffer that can be bound to the specified descriptor_set and binding.
Definition GraphicsFactory.h:63
std::unique_ptr< IImage > createTexture(Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned levels=1, unsigned layers=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const
Creates a texture .
Definition GraphicsFactory.h:333
std::unique_ptr< IBuffer > createBuffer(const std::string &name, const IDescriptorSetLayout &descriptor_set, unsigned binding, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const
Creates a IBuffer that can be bound to a descriptor set of the specified pipeline,...
Definition GraphicsFactory.h:125
std::vector< std::unique_ptr< IImage > > createTextures(std::size_t elements, Format format, const math::Vector3< unsigned > &size, ImageDimensions dimension=ImageDimensions::DIM_2, unsigned layers=1, unsigned levels=1, MultiSamplingLevel samples=MultiSamplingLevel::X1, bool allow_write=false) const
Creates an array of textures .
Definition GraphicsFactory.h:383
std::unique_ptr< IBuffer > createBuffer(const std::string &name, BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements, bool allow_write=false) const
Creates a IBuffer of type type.
Definition GraphicsFactory.h:44
std::unique_ptr< IVertexBuffer > createVertexBuffer(const std::string &name, const IVertexBufferLayout &layout, BufferUsage usage, unsigned elements=1) const
Creates a IVertexBuffer based on layout.
Definition GraphicsFactory.h:250
std::unique_ptr< IIndexBuffer > createIndexBuffer(const std::string &name, const IIndexBufferLayout &layout, BufferUsage usage, unsigned elements) const
Creates a IVertexBuffer based on layout.
Definition GraphicsFactory.h:284
std::unique_ptr< IIndexBuffer > createIndexBuffer(const IIndexBufferLayout &layout, BufferUsage usage, unsigned elements) const
Creates a IVertexBuffer based on layout.
Definition GraphicsFactory.h:268
std::unique_ptr< IBuffer > createBuffer(const std::string &name, const IDescriptorSetLayout &descriptor_set, unsigned binding, BufferUsage usage, unsigned elements=1, bool allow_write=false) const
Creates a IBuffer that can be bound to the specified descriptor_set and binding.
Definition GraphicsFactory.h:83
std::unique_ptr< IBuffer > createBuffer(BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements=1, bool allow_write=false) const
Creates a IBuffer of type type.
Definition GraphicsFactory.h:29
std::unique_ptr< ISampler > createSampler(const std::string &name, FilterMode mag_filter=FilterMode::Nearest, FilterMode min_filter=FilterMode::Nearest, BorderMode border_u=BorderMode::Repeat, BorderMode border_v=BorderMode::Repeat, BorderMode border_w=BorderMode::Repeat, MipMapMode mip_map_mode=MipMapMode::Nearest, float mip_map_bias=0.f, float max_lod=std::numeric_limits< float >::max(), float min_lod=0.f, float anisotropy=0.f) const
Creates a texture sampler .
Definition GraphicsFactory.h:438
std::unique_ptr< IBuffer > createBuffer(const IPipeline &pipeline, unsigned space, unsigned binding, BufferUsage usage, unsigned elements=1, bool allow_write=false) const
Creates a IBuffer that can be bound to a descriptor set of the specified pipeline,...
Definition GraphicsFactory.h:146
Describes the layout of an index buffer.
Definition IndexBuffer.h:24
Interface representing a pipeline.
Definition Pipeline.h:82
std::shared_ptr< IPipelineLayout > layout() const noexcept
Gets the pipeline layout.
Definition Pipeline.h:96
Describes the layout of a vertex buffer.
Definition VertexBuffer.h:14