SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
GraphicsFactory.h
1#pragma once
2
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"
8
9#include "spark/math/Vector2.h"
10
11#include <memory>
12
13namespace spark::render
14{
15 class SPARK_RENDER_EXPORT IGraphicsFactory
16 {
17 public:
18 virtual ~IGraphicsFactory() = default;
19
29 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(BufferType type, BufferUsage usage, std::size_t element_size, unsigned elements = 1, bool allow_write = false) const
30 {
31 return genericCreateBuffer(type, usage, element_size, elements, allow_write);
32 }
33
44 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const std::string& name,
45 BufferType type,
46 BufferUsage usage,
47 std::size_t element_size,
48 unsigned elements,
49 bool allow_write = false) const
50 {
51 return genericCreateBuffer(name, type, usage, element_size, elements, allow_write);
52 }
53
63 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const IDescriptorSetLayout& descriptor_set,
64 unsigned binding,
65 BufferUsage usage,
66 unsigned elements = 1,
67 bool allow_write = false) const
68 {
69 const auto& descriptor = descriptor_set.descriptor(binding);
70 return createBuffer(descriptor->type(), usage, descriptor->elementSize(), elements, allow_write);
71 }
72
83 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const std::string& name,
84 const IDescriptorSetLayout& descriptor_set,
85 unsigned binding,
86 BufferUsage usage,
87 unsigned elements = 1,
88 bool allow_write = false) const
89 {
90 const auto& descriptor = descriptor_set.descriptor(binding);
91 return createBuffer(name, descriptor->type(), usage, descriptor->elementSize(), elements, allow_write);
92 }
93
104 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const IDescriptorSetLayout& descriptor_set,
105 unsigned binding,
106 BufferUsage usage,
107 std::size_t element_size,
108 unsigned elements,
109 bool allow_write = false) const
110 {
111 return createBuffer(descriptor_set.descriptor(binding)->type(), usage, element_size, elements, allow_write);
112 }
113
125 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const std::string& name,
126 const IDescriptorSetLayout& descriptor_set,
127 unsigned binding,
128 BufferUsage usage,
129 std::size_t element_size,
130 unsigned elements,
131 bool allow_write = false) const
132 {
133 return createBuffer(name, descriptor_set.descriptor(binding)->type(), usage, element_size, elements, allow_write);
134 }
135
146 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const IPipeline& pipeline,
147 unsigned space,
148 unsigned binding,
149 BufferUsage usage,
150 unsigned elements = 1,
151 bool allow_write = false) const
152 {
153 return createBuffer(pipeline.layout()->descriptorSet(space), binding, usage, elements, allow_write);
154 }
155
167 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const std::string& name,
168 const IPipeline& pipeline,
169 unsigned space,
170 unsigned binding,
171 BufferUsage usage,
172 unsigned elements = 1,
173 bool allow_write = false) const
174 {
175 return createBuffer(name, pipeline.layout()->descriptorSet(space), binding, usage, elements, allow_write);
176 }
177
189 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const IPipeline& pipeline,
190 unsigned space,
191 unsigned binding,
192 BufferUsage usage,
193 std::size_t element_size,
194 unsigned elements,
195 bool allow_write = false) const
196 {
197 return createBuffer(pipeline.layout()->descriptorSet(space), binding, usage, element_size, elements, allow_write);
198 }
199
212 [[nodiscard]] std::unique_ptr<IBuffer> createBuffer(const std::string& name,
213 const IPipeline& pipeline,
214 unsigned space,
215 unsigned binding,
216 BufferUsage usage,
217 std::size_t element_size,
218 unsigned elements = 1,
219 bool allow_write = false) const
220 {
221 return createBuffer(name, pipeline.layout()->descriptorSet(space), binding, usage, element_size, elements, allow_write);
222 }
223
234 [[nodiscard]] std::unique_ptr<IVertexBuffer> createVertexBuffer(const IVertexBufferLayout& layout, BufferUsage usage, unsigned elements = 1) const
235 {
236 return genericCreateVertexBuffer(layout, usage, elements);
237 }
238
250 [[nodiscard]] std::unique_ptr<IVertexBuffer> createVertexBuffer(const std::string& name,
251 const IVertexBufferLayout& layout,
252 BufferUsage usage,
253 unsigned elements = 1) const
254 {
255 return genericCreateVertexBuffer(name, layout, usage, elements);
256 }
257
268 [[nodiscard]] std::unique_ptr<IIndexBuffer> createIndexBuffer(const IIndexBufferLayout& layout, BufferUsage usage, unsigned elements) const
269 {
270 return genericCreateIndexBuffer(layout, usage, elements);
271 }
272
284 [[nodiscard]] std::unique_ptr<IIndexBuffer> createIndexBuffer(const std::string& name, const IIndexBufferLayout& layout, BufferUsage usage, unsigned elements) const
285 {
286 return genericCreateIndexBuffer(name, layout, usage, elements);
287 }
288
296 [[nodiscard]] std::unique_ptr<IImage> createAttachment(Format format,
297 const math::Vector2<unsigned>& size,
298 MultiSamplingLevel samples = MultiSamplingLevel::X1) const
299 {
300 return genericCreateAttachment(format, size, samples);
301 }
302
311 [[nodiscard]] std::unique_ptr<IImage> createAttachment(const std::string& name,
312 Format format,
313 const math::Vector2<unsigned>& size,
314 MultiSamplingLevel samples = MultiSamplingLevel::X1) const
315 {
316 return genericCreateAttachment(name, format, size, samples);
317 }
318
333 [[nodiscard]] std::unique_ptr<IImage> createTexture(Format format,
334 const math::Vector3<unsigned>& size,
335 ImageDimensions dimension = ImageDimensions::DIM_2,
336 unsigned levels = 1,
337 unsigned layers = 1,
338 MultiSamplingLevel samples = MultiSamplingLevel::X1,
339 bool allow_write = false) const
340 {
341 return genericCreateTexture(format, size, dimension, levels, layers, samples, allow_write);
342 }
343
359 [[nodiscard]] std::unique_ptr<IImage> createTexture(const std::string& name,
360 Format format,
361 const math::Vector3<unsigned>& size,
362 ImageDimensions dimension = ImageDimensions::DIM_2,
363 unsigned levels = 1,
364 unsigned layers = 1,
365 MultiSamplingLevel samples = MultiSamplingLevel::X1,
366 bool allow_write = false) const
367 {
368 return genericCreateTexture(name, format, size, dimension, levels, layers, samples, allow_write);
369 }
370
383 [[nodiscard]] std::vector<std::unique_ptr<IImage>> createTextures(std::size_t elements,
384 Format format,
385 const math::Vector3<unsigned>& size,
386 ImageDimensions dimension = ImageDimensions::DIM_2,
387 unsigned layers = 1,
388 unsigned levels = 1,
389 MultiSamplingLevel samples = MultiSamplingLevel::X1,
390 bool allow_write = false) const
391 {
392 return genericCreateTextures(elements, format, size, dimension, layers, levels, samples, allow_write);
393 }
394
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(),
417 float min_lod = 0.f,
418 float anisotropy = 0.f) const
419 {
420 return genericCreateSampler(mag_filter, min_filter, border_u, border_v, border_w, mip_map_mode, mip_map_bias, max_lod, min_lod, anisotropy);
421 }
422
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(),
447 float min_lod = 0.f,
448 float anisotropy = 0.f) const
449 {
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);
451 }
452
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(),
477 float min_lod = 0.f,
478 float anisotropy = 0.f) const
479 {
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);
481 }
482
483 private:
484 // @formatter:off
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;
502 // @formatter:on
503 };
504
514 template <typename DescriptorLayoutType, typename RawBufferType, typename VertexBufferType, typename IndexBufferType, typename ImageType, typename SamplerType>
516 {
517 public:
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;
526
527 public:
529 [[nodiscard]] virtual std::unique_ptr<buffer_type> createBuffer(BufferType type,
530 BufferUsage usage,
531 std::size_t element_size,
532 unsigned elements,
533 bool allow_write = false) const = 0;
534
536 [[nodiscard]] virtual std::unique_ptr<buffer_type> createBuffer(const std::string& name,
537 BufferType type,
538 BufferUsage usage,
539 std::size_t element_size,
540 unsigned elements,
541 bool allow_write = false) const = 0;
542
544 [[nodiscard]] virtual std::unique_ptr<vertex_buffer_type> createVertexBuffer(const vertex_buffer_layout_type& layout, BufferUsage usage, unsigned elements = 1) const =
545 0;
546
548 [[nodiscard]] virtual std::unique_ptr<vertex_buffer_type> createVertexBuffer(const std::string& name,
549 const vertex_buffer_layout_type& layout,
550 BufferUsage usage,
551 unsigned elements = 1) const = 0;
552
554 [[nodiscard]] virtual std::unique_ptr<index_buffer_type> createIndexBuffer(const index_buffer_layout_type& layout, BufferUsage usage, unsigned elements) const = 0;
555
557 [[nodiscard]] virtual std::unique_ptr<index_buffer_type> createIndexBuffer(const std::string& name,
558 const index_buffer_layout_type& layout,
559 BufferUsage usage,
560 unsigned elements) const = 0;
561
563 [[nodiscard]] virtual std::unique_ptr<image_type> createAttachment(Format format,
564 const math::Vector2<unsigned>& size,
565 MultiSamplingLevel samples = MultiSamplingLevel::X1) const = 0;
566
568 [[nodiscard]] virtual std::unique_ptr<image_type> createAttachment(const std::string& name,
569 Format format,
570 const math::Vector2<unsigned>& size,
571 MultiSamplingLevel samples = MultiSamplingLevel::X1) const = 0;
572
574 [[nodiscard]] virtual std::unique_ptr<image_type> createTexture(Format format,
575 const math::Vector3<unsigned>& size,
576 ImageDimensions dimension = ImageDimensions::DIM_2,
577 unsigned levels = 1,
578 unsigned layers = 1,
579 MultiSamplingLevel samples = MultiSamplingLevel::X1,
580 bool allow_write = false) const = 0;
581
583 [[nodiscard]] virtual std::unique_ptr<image_type> createTexture(const std::string& name,
584 Format format,
585 const math::Vector3<unsigned>& size,
586 ImageDimensions dimension = ImageDimensions::DIM_2,
587 unsigned levels = 1,
588 unsigned layers = 1,
589 MultiSamplingLevel samples = MultiSamplingLevel::X1,
590 bool allow_write = false) const = 0;
591
593 [[nodiscard]] virtual std::vector<std::unique_ptr<image_type>> createTextures(std::size_t elements,
594 Format format,
595 const math::Vector3<unsigned>& size,
596 ImageDimensions dimension = ImageDimensions::DIM_2,
597 unsigned layers = 1,
598 unsigned levels = 1,
599 MultiSamplingLevel samples = MultiSamplingLevel::X1,
600 bool allow_write = false) const = 0;
601
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(),
611 float min_lod = 0.f,
612 float anisotropy = 0.f) const = 0;
613
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(),
624 float min_lod = 0.f,
625 float anisotropy = 0.f) const = 0;
626
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(),
637 float min_lod = 0.f,
638 float anisotropy = 0.f) const = 0;
639
640 private:
641 // @formatter:off
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
653 {
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)); });
658 return result;
659 }
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
663 {
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)); });
668 return result;
669 }
670 // @formatter:on
671 };
672}
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