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
13
14class MythDebugVulkan;
16
17#define MAX_TEXTURE_COUNT (1000)
18
20{
21 Q_OBJECT
22
23 public:
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
QStack< QMatrix4x4 > m_transforms
std::vector< VkDescriptorSet > m_availableTextureDescriptors
QMap< MythImage *, MythTextureVulkan * > m_imageToTextureMap
QVector< MythTextureVulkan * > m_texturesToDelete
std::vector< MythTextureVulkan * > m_queuedTextures
std::vector< MythTextureVulkan * > m_stagedTextures
std::list< MythImage * > m_imageExpire
virtual void PushTransformation(const UIEffects &zoom, QPointF center=QPointF())
Definition: mythpainter.h:86
virtual bool SupportsClipping(void)=0
virtual void DeleteFormatImagePriv(MythImage *im)=0
virtual MythImage * GetFormatImagePriv(void)=0
Creates a reference counted image, call DecrRef() to delete.
virtual void DrawImage(QRect dest, MythImage *im, QRect src, int alpha)=0
virtual QString GetName(void)=0
virtual void Begin(QPaintDevice *)
Definition: mythpainter.h:54
virtual bool SupportsAlpha(void)=0
virtual void PopTransformation(void)
Definition: mythpainter.h:88
virtual void End()
Definition: mythpainter.h:55
virtual void FreeResources(void)
Definition: mythpainter.h:53
virtual bool SupportsAnimation(void)=0
Creates shader objects suitable for use with the Vulkan API.
#define MYTH_NULL_DISPATCH
#define MUI_PUBLIC
Definition: mythuiexp.h:9