MythTV  master
mythpaintervulkan.h
Go to the documentation of this file.
1 #ifndef MYTHPAINTERVULKAN_H
2 #define MYTHPAINTERVULKAN_H
3 
4 // Qt
5 #include <QStack>
6 
7 // MythTV
8 #include "mythuiexp.h"
9 #include "mythpaintergpu.h"
10 #include "mythuianimation.h"
13 
14 class MythDebugVulkan;
16 
17 #define MAX_TEXTURE_COUNT (1000)
18 
20 {
21  Q_OBJECT
22 
23  public:
24  MythPainterVulkan(MythRenderVulkan* VulkanRender, MythMainWindow* Parent);
25  ~MythPainterVulkan() override;
26 
27  QString GetName () override;
28  bool SupportsAnimation () override;
29  bool SupportsAlpha () override;
30  bool SupportsClipping () override;
31  void FreeResources () override;
32  void Begin (QPaintDevice* /*Parent*/) override;
33  void End () override;
34  void DrawImage (QRect Dest, MythImage *Image, QRect Source, int Alpha) override;
35  void PushTransformation(const UIEffects &Fx, QPointF Center = QPointF()) override;
36  void PopTransformation () override;
37 
38  void DeleteTextures ();
39 
40  public slots:
41  void DoFreeResources ();
42 
43  protected:
44  MythImage* GetFormatImagePriv () override;
45  void DeleteFormatImagePriv (MythImage *Image) override;
46 
47  private:
48  Q_DISABLE_COPY(MythPainterVulkan)
49 
50  bool Ready ();
51  void ClearCache();
52  MythTextureVulkan* GetTextureFromCache(MythImage *Image);
53 
54  bool m_ready { false };
55  MythVulkanObject* m_vulkan { nullptr };
56 
57  VkDescriptorPool m_projectionDescriptorPool { MYTH_NULL_DISPATCH };
58  VkDescriptorSet m_projectionDescriptor { MYTH_NULL_DISPATCH };
59  MythUniformBufferVulkan* m_projectionUniform { nullptr };
60  VkSampler m_textureSampler { MYTH_NULL_DISPATCH };
61  MythShaderVulkan* m_textureShader { nullptr };
62  VkPipeline m_texturePipeline { MYTH_NULL_DISPATCH };
63  VkDescriptorPool m_textureDescriptorPool { MYTH_NULL_DISPATCH };
64  bool m_textureDescriptorsCreated { false };
65  std::vector<VkDescriptorSet> m_availableTextureDescriptors;
66  VkCommandBuffer m_textureUploadCmd { nullptr };
67  bool m_frameStarted { false };
68 
69  std::vector<MythTextureVulkan*> m_stagedTextures;
70  std::vector<MythTextureVulkan*> m_queuedTextures;
71  QMap<MythImage*, MythTextureVulkan*> m_imageToTextureMap;
72  std::list<MythImage*> m_imageExpire;
73  QVector<MythTextureVulkan*> m_texturesToDelete;
74 
75  QMatrix4x4 m_projection;
76  QStack<QMatrix4x4> m_transforms;
77 };
78 
79 #endif
MythPainter::SupportsAlpha
virtual bool SupportsAlpha(void)=0
MythPainterVulkan::m_imageExpire
std::list< MythImage * > m_imageExpire
Definition: mythpaintervulkan.h:72
mythwindowvulkan.h
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythPainter::SupportsAnimation
virtual bool SupportsAnimation(void)=0
MythPainterVulkan::m_projection
QMatrix4x4 m_projection
Definition: mythpaintervulkan.h:75
MythPainter::SupportsClipping
virtual bool SupportsClipping(void)=0
mythpaintergpu.h
MythDebugVulkan
Definition: mythdebugvulkan.h:9
MythPainterVulkan::m_queuedTextures
std::vector< MythTextureVulkan * > m_queuedTextures
Definition: mythpaintervulkan.h:70
MythVulkanObject
Definition: mythrendervulkan.h:29
MYTH_NULL_DISPATCH
#define MYTH_NULL_DISPATCH
Definition: mythrendervulkan.h:25
Image
Definition: image.h:31
MythTextureVulkan
Definition: mythtexturevulkan.h:15
MythPainter::PushTransformation
virtual void PushTransformation(const UIEffects &zoom, QPointF center=QPointF())
Definition: mythpainter.cpp:191
MythPainter::DeleteFormatImagePriv
virtual void DeleteFormatImagePriv(MythImage *im)=0
MythPainterVulkan::m_imageToTextureMap
QMap< MythImage *, MythTextureVulkan * > m_imageToTextureMap
Definition: mythpaintervulkan.h:71
MythPainterVulkan::m_transforms
QStack< QMatrix4x4 > m_transforms
Definition: mythpaintervulkan.h:76
MythPainterVulkan
Definition: mythpaintervulkan.h:20
MythPainter::GetFormatImagePriv
virtual MythImage * GetFormatImagePriv(void)=0
Creates a reference counted image, call DecrRef() to delete.
Source
Definition: channelsettings.cpp:69
MythPainterVulkan::m_stagedTextures
std::vector< MythTextureVulkan * > m_stagedTextures
Definition: mythpaintervulkan.h:69
MythPainter::DrawImage
virtual void DrawImage(QRect dest, MythImage *im, QRect src, int alpha)=0
MythPainter::FreeResources
virtual void FreeResources(void)
Definition: mythpainter.h:51
MythPainterVulkan::m_availableTextureDescriptors
std::vector< VkDescriptorSet > m_availableTextureDescriptors
Definition: mythpaintervulkan.h:65
MythPainterVulkan::m_texturesToDelete
QVector< MythTextureVulkan * > m_texturesToDelete
Definition: mythpaintervulkan.h:73
MythPainter::End
virtual void End()
Definition: mythpainter.h:53
MythPainter::GetName
virtual QString GetName(void)=0
MythUniformBufferVulkan
Definition: mythuniformbuffervulkan.h:8
MythImage
Definition: mythimage.h:37
UIEffects
Definition: mythuianimation.h:10
MythPainter::PopTransformation
virtual void PopTransformation(void)
Definition: mythpainter.h:81
MythRenderVulkan
Definition: mythrendervulkan.h:54
mythrendervulkan.h
mythuianimation.h
MythShaderVulkan
Creates shader objects suitable for use with the Vulkan API.
Definition: mythshadervulkan.h:21
MythPainter::Begin
virtual void Begin(QPaintDevice *)
Definition: mythpainter.h:52
mythuiexp.h
MythMainWindow
Definition: mythmainwindow.h:35
MythPainterGPU
Definition: mythpaintergpu.h:12