CsPaint  1.0.1
cspaint_surface.h
1 
19 #ifndef INCLUDED_CSPAINT_SURFACE_H
20 #define INCLUDED_CSPAINT_SURFACE_H
21 
22 #include <cspaint_context.h>
23 #include <cspaint_fwd.h>
24 
25 namespace CsPaint
26 {
27 class surface : public std::enable_shared_from_this<surface>
28 {
29  private:
30  struct private_tag {
31  };
32 
33  public:
34  surface(context_handle context_handle, vk::SurfaceKHR surface, private_tag = private_tag{});
35 
36  surface(const surface &) = delete;
37  void operator=(const surface &) = delete;
38 
39  ~surface();
40 
41  using handle = std::shared_ptr<surface>;
42 
43  static handle create(context_handle context_handle, vk::SurfaceKHR vk_surface);
44 
46 
48  std::vector<CsPaint::image_handle> images = std::vector<CsPaint::image_handle>());
49 
50  pipeline_handle createPipeline(renderpass_handle renderpass, const vk::PipelineVertexInputStateCreateInfo &vertexInputInfo,
51  const std::vector<vk::PipelineShaderStageCreateInfo> &shaderStages,
52  const vk::PipelineLayout &pipelineLayout);
53 
54  void recalculateSize();
55 
56  uint32_t width() const
57  {
58  return m_width;
59  }
60 
61  uint32_t height() const
62  {
63  return m_height;
64  }
65 
66  private:
67  context_handle m_context;
68  vk::SurfaceKHR m_surface;
69  device_handle m_graphicsDevice;
70  vk::Format m_format;
71  vk::ColorSpaceKHR m_colorSpace;
72  vk::PresentModeKHR m_mode;
73  uint32_t m_width;
74  uint32_t m_height;
75 };
76 }; // namespace CsPaint
77 
78 #endif
uint32_t height() const
Definition: cspaint_surface.h:61
void recalculateSize()
pipeline_handle createPipeline(renderpass_handle renderpass, const vk::PipelineVertexInputStateCreateInfo &vertexInputInfo, const std::vector< vk::PipelineShaderStageCreateInfo > &shaderStages, const vk::PipelineLayout &pipelineLayout)
Definition: cspaint_renderpass.h:33
std::shared_ptr< swapchain > swapchain_handle
Definition: cspaint_fwd.h:69
uint32_t width() const
Definition: cspaint_surface.h:56
device_handle graphicsDevice() const
std::shared_ptr< device > device_handle
Definition: cspaint_fwd.h:45
std::shared_ptr< pipeline > pipeline_handle
Definition: cspaint_fwd.h:54
static handle create(context_handle context_handle, vk::SurfaceKHR vk_surface)
std::shared_ptr< surface > handle
Definition: cspaint_surface.h:41
swapchain_handle createSwapchain(renderpass_handle renderpass, std::vector< CsPaint::image_handle > images=std::vector< CsPaint::image_handle >())
void operator=(const surface &) = delete
std::shared_ptr< context > context_handle
Definition: cspaint_fwd.h:36
surface(context_handle context_handle, vk::SurfaceKHR surface, private_tag=private_tag{})
Definition: cspaint_surface.h:27
std::shared_ptr< renderpass > renderpass_handle
Definition: cspaint_fwd.h:60
Definition: cspaint_buffer.h:26