MythTV  master
mythpaintervulkan.cpp
Go to the documentation of this file.
1 // C++
2 #include <algorithm>
3 
4 // Qt
5 #include <QGuiApplication>
6 
7 // MythTV
9 #include "mythimage.h"
15 #include "vulkan/mythdebugvulkan.h"
17 
18 #define LOC QString("VulkanPainter: ")
19 
21  : MythPainterGPU(Parent)
22 {
23  m_transforms.push(QMatrix4x4());
25 }
26 
28 {
30  m_vulkan->Funcs()->vkQueueWaitIdle(m_vulkan->Window()->graphicsQueue());
31 
32  Teardown();
35 }
36 
38 {
39  ClearCache();
42 }
43 
46 {
48  m_vulkan->Funcs()->vkQueueWaitIdle(m_vulkan->Window()->graphicsQueue());
49 
50  LOG(VB_GENERAL, LOG_INFO, LOC + "Releasing Vulkan resources");
51 
52  delete m_projectionUniform;
53  delete m_textureShader;
54 
56  {
57  m_vulkan->Funcs()->vkDestroyPipeline(m_vulkan->Device(), m_texturePipeline, nullptr);
58  m_vulkan->Funcs()->vkDestroyDescriptorPool(m_vulkan->Device(), m_textureDescriptorPool, nullptr);
59  m_vulkan->Funcs()->vkDestroyDescriptorPool(m_vulkan->Device(), m_projectionDescriptorPool, nullptr);
60  m_vulkan->Funcs()->vkDestroySampler(m_vulkan->Device(), m_textureSampler, nullptr);
62  {
63  m_vulkan->Funcs()->vkFreeCommandBuffers(m_vulkan->Device(),
64  m_vulkan->Window()->graphicsCommandPool(), 1, &m_textureUploadCmd);
65  }
66  }
67 
68  m_ready = false;
69  delete m_vulkan;
70  m_vulkan = nullptr;
72  m_projectionDescriptor = MYTH_NULL_DISPATCH; // destroyed with pool
73  m_projectionUniform = nullptr;
74  m_textureShader = nullptr;
75  m_textureUploadCmd = nullptr;
80  m_availableTextureDescriptors.clear(); // destroyed with pool
81  m_frameStarted = false;
82  m_lastSize = { 0, 0 };
83 
84  LOG(VB_GENERAL, LOG_INFO, LOC + "Finished releasing resources");
85 }
86 
88 {
89  return "Vulkan";
90 }
91 
93 {
94  return true;
95 }
96 
98 {
99  return true;
100 }
101 
103 {
104  return false;
105 }
106 
107 void MythPainterVulkan::PushTransformation(const UIEffects &Fx, QPointF Center)
108 {
109  QMatrix4x4 newtop = m_transforms.top();
110  if (Fx.m_hzoom != 1.0F || Fx.m_vzoom != 1.0F || Fx.m_angle != 0.0F)
111  {
112  newtop.translate(static_cast<float>(Center.x()), static_cast<float>(Center.y()));
113  newtop.scale(Fx.m_hzoom, Fx.m_vzoom);
114  newtop.rotate(Fx.m_angle, 0, 0, 1);
115  newtop.translate(static_cast<float>(-Center.x()), static_cast<float>(-Center.y()));
116  }
117  m_transforms.push(newtop);
118 }
119 
121 {
122  m_transforms.pop();
123 }
124 
126 {
127  if (m_ready)
128  return true;
129 
130  if (!m_vulkan)
131  {
132  // device setup can be delayed by a few frames on startup - check status
133  // before continuing
135  if (!window || !window->device())
136  return false;
137 
139  if (!m_vulkan)
140  return false;
141  }
142 
143  if (!m_textureShader)
144  {
145  std::vector<int> stages = { DefaultVertex450, DefaultFragment450 };
147  if (!m_textureShader)
148  return false;
149  }
150 
151  if (!m_texturePipeline)
152  {
153  QRect viewport(QPoint{0, 0}, m_vulkan->Window()->swapChainImageSize());
155  if (!m_texturePipeline)
156  return false;
157  }
158 
160  {
161  const auto & sizes = m_textureShader->GetPoolSizes(0);
162  VkDescriptorPoolCreateInfo pool { VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, nullptr,
163  0, 1, static_cast<uint32_t>(sizes.size()), sizes.data() };
164  if (m_vulkan->Funcs()->vkCreateDescriptorPool(m_vulkan->Device(), &pool, nullptr, &m_projectionDescriptorPool) != VK_SUCCESS)
165  {
166  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create descriptor pool for projection");
167  return false;
168  }
169  }
170 
171  if (!m_projectionUniform)
172  {
174  if (!m_projectionUniform)
175  return false;
176 
177  m_projection.setToIdentity();
178  QRect viewport(QPoint{0, 0}, m_vulkan->Window()->swapChainImageSize());
179  m_projection.ortho(viewport);
180  m_projection = m_vulkan->Window()->clipCorrectionMatrix() * m_projection;
182  }
183 
185  {
186  // projection is set 0
187  VkDescriptorSetLayout layout = m_textureShader->GetDescSetLayout(0);
188  VkDescriptorSetAllocateInfo alloc { };
189  alloc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
190  alloc.descriptorPool = m_projectionDescriptorPool;
191  alloc.descriptorSetCount = 1;
192  alloc.pSetLayouts = &layout;
193 
194  if (m_vulkan->Funcs()->vkAllocateDescriptorSets(m_vulkan->Device(), &alloc, &m_projectionDescriptor) != VK_SUCCESS)
195  {
196  LOG(VB_GENERAL, LOG_INFO, LOC + "Failed to allocate projection descriptor set");
197  return false;
198  }
199 
200  VkDescriptorBufferInfo buffdesc = m_projectionUniform->GetBufferInfo();
201 
202  VkWriteDescriptorSet write { };
203  write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
204  write.dstSet = m_projectionDescriptor;
205  write.dstBinding = 0;
206  write.dstArrayElement = 0;
207  write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
208  write.descriptorCount = 1;
209  write.pBufferInfo = &buffdesc;
210 
211  m_vulkan->Funcs()->vkUpdateDescriptorSets(m_vulkan->Device(), 1, &write, 0, nullptr);
212  }
213 
215  {
216  const auto & sizes = m_textureShader->GetPoolSizes(1);
217  // match total number of individual descriptors with pool size
218  std::vector<VkDescriptorPoolSize> adjsizes;
219  std::transform(sizes.cbegin(), sizes.cend(), std::back_inserter(adjsizes),
220  [](VkDescriptorPoolSize Size){ return VkDescriptorPoolSize { Size.type, MAX_TEXTURE_COUNT }; });
221  VkDescriptorPoolCreateInfo pool { VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, nullptr,
222  0, MAX_TEXTURE_COUNT, static_cast<uint32_t>(adjsizes.size()), adjsizes.data() };
223  if (m_vulkan->Funcs()->vkCreateDescriptorPool(m_vulkan->Device(), &pool, nullptr, &m_textureDescriptorPool) != VK_SUCCESS)
224  {
225  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create descriptor pool");
226  return false;
227  }
228  }
229 
230  if (!m_textureDescriptorsCreated)
231  {
232  // transform and sampler are set 1 (projection is set 0)
233  VkDescriptorSetLayout layout = m_textureShader->GetDescSetLayout(1);
234  m_availableTextureDescriptors.clear();
235  for (int i = 0; i < MAX_TEXTURE_COUNT; ++i)
236  {
237  VkDescriptorSet descset = MYTH_NULL_DISPATCH;
238  VkDescriptorSetAllocateInfo alloc { };
239  alloc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
240  alloc.descriptorPool = m_textureDescriptorPool;
241  alloc.descriptorSetCount = 1;
242  alloc.pSetLayouts = &layout;
243  VkResult res = m_vulkan->Funcs()->vkAllocateDescriptorSets(m_vulkan->Device(), &alloc, &descset);
244  if (res != VK_SUCCESS)
245  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to allocate descriptor set");
246  m_availableTextureDescriptors.push_back(descset);
247  }
248 
249  m_textureDescriptorsCreated = true;
250  }
251 
252  if (!m_textureSampler)
253  {
254  m_textureSampler = m_vulkan->Render()->CreateSampler(VK_FILTER_LINEAR, VK_FILTER_LINEAR);
255  if (!m_textureSampler)
256  return false;
257  }
258 
259  m_ready = true;
260  return true;
261 }
262 
270 void MythPainterVulkan::Begin(QPaintDevice* /*Parent*/)
271 {
272  if (!Ready())
273  return;
274 
275  // check if we need to adjust cache sizes
276  if (m_lastSize != m_vulkan->Window()->size())
277  {
278  // This will scale the cache depending on the resolution in use
279  static const int s_onehd = 1920 * 1080;
280  static const int s_basesize = 64;
281  m_lastSize = m_vulkan->Window()->size();
282  float hdscreens = (static_cast<float>(m_lastSize.width() + 1) * m_lastSize.height()) / s_onehd;
283  int cpu = std::max(static_cast<int>(hdscreens * s_basesize), s_basesize);
284  int gpu = cpu * 3 / 2;
285  SetMaximumCacheSizes(gpu, cpu);
286  }
287 
288  // Sometimes the UI engine will mark images as 'changed' when moving between
289  // screens. These are then often released here whilst still in use for the
290  // previous frame. To avoid validation errors, wait for the last frame to
291  // complete before continuing - though this feels like a hack and surely
292  // the last frame should already be complete at this point?
293  if (!m_texturesToDelete.empty())
294  {
295  m_vulkan->Funcs()->vkQueueWaitIdle(m_vulkan->Window()->graphicsQueue());
296  DeleteTextures();
297  }
298  m_frameStarted = true;
299 }
300 
302 {
303  if (!(Ready() && m_frameStarted))
304  return;
305 
306  // Complete any texture updates first
307  if (m_textureUploadCmd)
308  {
310  m_textureUploadCmd = nullptr;
311 
312  // release staging buffers which are no longer needed
313  for (auto * texture : m_stagedTextures)
314  texture->StagingFinished();
315  m_stagedTextures.clear();
316  }
317 
318  if (m_queuedTextures.empty())
319  return;
320 
321  if (m_viewControl.testFlag(Framebuffer))
322  {
323  // Tell the renderer that we are requesting a frame start
325 
326  // Signal DIRECTLY to the window to start the frame - which ensures
327  // the event is not delayed and we can start to render immediately.
328  QEvent update(QEvent::UpdateRequest);
329  QGuiApplication::sendEvent(m_vulkan->Window(), &update);
330  }
331 
332  // Retrieve the command buffer
333  VkCommandBuffer currentcmdbuf = m_vulkan->Window()->currentCommandBuffer();
334  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
335  m_vulkan->Render()->BeginDebugRegion(currentcmdbuf, "PAINTER_RENDER", MythDebugVulkan::kDebugGreen);
336 
337  // Bind our pipeline and retrieve layout once
338  m_vulkan->Funcs()->vkCmdBindPipeline(currentcmdbuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_texturePipeline);
339  VkPipelineLayout layout = m_textureShader->GetPipelineLayout();
340 
341  // Bind descriptor set 0 - which is the projection, which is 'constant' for all textures
342  m_vulkan->Funcs()->vkCmdBindDescriptorSets(currentcmdbuf, VK_PIPELINE_BIND_POINT_GRAPHICS,
343  layout, 0, 1, &m_projectionDescriptor, 0, nullptr);
344 
345  for (auto * texture : m_queuedTextures)
346  {
347  // Bind descriptor set 1 for this texture - sampler
348  m_vulkan->Funcs()->vkCmdBindDescriptorSets(currentcmdbuf, VK_PIPELINE_BIND_POINT_GRAPHICS,
349  layout, 1, 1, &texture->m_descriptor, 0, nullptr);
350 
351  // Push constants - transform, vertex data and color (alpha)
352  m_vulkan->Funcs()->vkCmdPushConstants(currentcmdbuf, layout, VK_SHADER_STAGE_VERTEX_BIT,
353  0, MYTH_PUSHBUFFER_SIZE, texture->Data());
354  texture->PopData();
355 
356  // Draw
357  m_vulkan->Funcs()->vkCmdDraw(currentcmdbuf, 4, 1, 0, 0);
358  }
359 
360  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
361  m_vulkan->Render()->EndDebugRegion(currentcmdbuf);
362 
363  m_queuedTextures.clear();
364 
365  if (m_viewControl.testFlag(Framebuffer))
366  m_vulkan->Render()->EndFrame();
367 }
368 
369 void MythPainterVulkan::DrawImage(const QRect Dest, MythImage *Image, const QRect Source, int Alpha)
370 {
371  if (!m_frameStarted)
372  return;
373 
374  MythTextureVulkan* texture = GetTextureFromCache(Image);
375  if (texture)
376  {
377  // Update push constant buffer
378  texture->PushData(m_transforms.top(), Source, Dest, Alpha);
379  // Queue
380  m_queuedTextures.emplace_back(texture);
381  }
382 }
383 
385 {
386  return new MythImage(this);
387 }
388 
390 {
391  if (m_imageToTextureMap.contains(Image))
392  {
393  m_texturesToDelete.push_back(m_imageToTextureMap[Image]);
394  m_imageToTextureMap.remove(Image);
395  m_imageExpire.remove(Image);
396  }
397 }
398 
400 {
401  LOG(VB_GENERAL, LOG_INFO, "Clearing Vulkan painter cache.");
402 
403  QMapIterator<MythImage *, MythTextureVulkan*> it(m_imageToTextureMap);
404  while (it.hasNext())
405  {
406  it.next();
407  m_texturesToDelete.push_back(m_imageToTextureMap[it.key()]);
408  m_imageExpire.remove(it.key());
409  }
410  m_imageToTextureMap.clear();
411 }
412 
414 {
415  if (!(Ready() && Image))
416  return nullptr;
417 
418  if (m_imageToTextureMap.contains(Image))
419  {
420  if (!Image->IsChanged())
421  {
422  m_imageExpire.remove(Image);
423  m_imageExpire.push_back(Image);
424  return m_imageToTextureMap[Image];
425  }
426  DeleteFormatImagePriv(Image);
427  }
428 
429  Image->SetChanged(false);
430 
431  int count = 0; // guard against unexpected texture creation failure
432  MythTextureVulkan* texture = nullptr;
433  while (texture == nullptr)
434  {
435  if (!m_textureUploadCmd)
438  if (texture != nullptr)
439  break;
440 
441  // This can happen if the cached textures are too big for GPU memory
442  if ((count++ > 1000) || m_hardwareCacheSize < (8 * 1024 * 1024))
443  {
444  LOG(VB_GENERAL, LOG_ERR, "Failed to create Vulkan texture.");
445  return nullptr;
446  }
447 
448  // Shrink the cache size
450  LOG(VB_GENERAL, LOG_NOTICE, LOC + QString("Shrinking HW cache size to %1KB")
451  .arg(m_maxHardwareCacheSize / 1024));
452 
454  {
455  MythImage *expired = m_imageExpire.front();
456  m_imageExpire.pop_front();
457  DeleteFormatImagePriv(expired);
458  DeleteTextures();
459  }
460  }
461 
463  {
464  LOG(VB_GENERAL, LOG_ERR, LOC + "No descriptor pool?");
465  delete texture;
466  return nullptr;
467  }
468 
469  // With a reasonable hardware cache size and many small thumbnails and
470  // text images, we can easily hit the max texture count before the cache
471  // size. So ensure we always have a descriptor available.
472 
473  if (m_availableTextureDescriptors.empty())
474  {
475  MythImage *expired = m_imageExpire.front();
476  m_imageExpire.pop_front();
477  DeleteFormatImagePriv(expired);
478  DeleteTextures();
479 
480  if (m_availableTextureDescriptors.empty())
481  {
482  LOG(VB_GENERAL, LOG_WARNING, LOC + "No texture descriptor available??");
483  delete texture;
484  return nullptr;
485  }
486  }
487 
488  VkDescriptorSet descset = m_availableTextureDescriptors.back();
490 
491  auto imagedesc = texture->GetDescriptorImage();
492  VkWriteDescriptorSet write { };
493  write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
494  write.dstSet = descset;
495  write.dstBinding = 0;
496  write.dstArrayElement = 0;
497  write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
498  write.descriptorCount = 1;
499  write.pImageInfo = &imagedesc;
500  m_vulkan->Funcs()->vkUpdateDescriptorSets(m_vulkan->Device(), 1, &write, 0, nullptr);
501  texture->AddDescriptor(descset);
502  m_stagedTextures.emplace_back(texture);
503 
504  CheckFormatImage(Image);
505  m_hardwareCacheSize += texture->m_dataSize;
506  m_imageToTextureMap[Image] = texture;
507  m_imageExpire.push_back(Image);
508 
510  {
511  MythImage *expired = m_imageExpire.front();
512  m_imageExpire.pop_front();
513  DeleteFormatImagePriv(expired);
514  DeleteTextures();
515  }
516 
517  //LOG(VB_GENERAL, LOG_INFO, LOC + QString("Images: %1 Sets: %2 Recycled: %3")
518  // .arg(m_imageToTextureMap.size()).arg(m_allocatedTextureDescriptors).arg(m_availableTextureDescriptors.size()));
519  //LOG(VB_GENERAL, LOG_INFO, LOC + QString("Hardware cache: %1 (Max: %2)")
520  // .arg(m_hardwareCacheSize / (1024 * 1024)).arg(m_maxHardwareCacheSize / (1024 * 1024)));
521 
522  return texture;
523 }
524 
526 {
527  if (!Ready() || m_texturesToDelete.empty())
528  return;
529 
530  while (!m_texturesToDelete.empty())
531  {
532  MythTextureVulkan *texture = m_texturesToDelete.front();
533  m_hardwareCacheSize -= texture->m_dataSize;
534  VkDescriptorSet descriptor = texture->TakeDescriptor();
535  if (descriptor)
536  m_availableTextureDescriptors.emplace_back(descriptor);
537  delete texture;
538  m_texturesToDelete.pop_front();
539  }
540 }
MythShaderVulkan::GetDescSetLayout
VkDescriptorSetLayout GetDescSetLayout(size_t Set) const
Definition: mythshadervulkan.cpp:471
MythTextureVulkan::Create
static MythTextureVulkan * Create(MythVulkanObject *Vulkan, QImage *Image, VkSampler Sampler, VkCommandBuffer CommandBuffer=nullptr)
Definition: mythtexturevulkan.cpp:7
MythPainterVulkan::m_imageExpire
std::list< MythImage * > m_imageExpire
Definition: mythpaintervulkan.h:72
UIEffects::m_angle
float m_angle
Definition: mythuianimation.h:42
MythPainter::m_hardwareCacheSize
int m_hardwareCacheSize
Definition: mythpainter.h:136
MythPainterVulkan::DeleteFormatImagePriv
void DeleteFormatImagePriv(MythImage *Image) override
Definition: mythpaintervulkan.cpp:389
MythTextureVulkan::TakeDescriptor
VkDescriptorSet TakeDescriptor(void)
Definition: mythtexturevulkan.cpp:145
MythUniformBufferVulkan::GetBufferInfo
VkDescriptorBufferInfo GetBufferInfo(void) const
Definition: mythuniformbuffervulkan.cpp:41
mythtexturevulkan.h
MythRenderVulkan::DoFreeResources
void DoFreeResources(void)
MythPainterVulkan::m_projection
QMatrix4x4 m_projection
Definition: mythpaintervulkan.h:75
MythShaderVulkan::GetPoolSizes
const std::vector< VkDescriptorPoolSize > & GetPoolSizes(size_t Set) const
Definition: mythshadervulkan.cpp:463
MythPainterVulkan::GetTextureFromCache
MythTextureVulkan * GetTextureFromCache(MythImage *Image)
Definition: mythpaintervulkan.cpp:413
DefaultVertex450
#define DefaultVertex450
Definition: mythshadersvulkan.h:23
MythPainterVulkan::End
void End() override
Definition: mythpaintervulkan.cpp:301
MythPainterVulkan::MythPainterVulkan
MythPainterVulkan(MythRenderVulkan *VulkanRender, MythMainWindow *Parent)
Definition: mythpaintervulkan.cpp:20
MythPainterVulkan::Begin
void Begin(QPaintDevice *) override
Begin painting.
Definition: mythpaintervulkan.cpp:270
MythPainterVulkan::m_vulkan
MythVulkanObject * m_vulkan
Definition: mythpaintervulkan.h:55
MythPainterVulkan::SupportsAnimation
bool SupportsAnimation() override
Definition: mythpaintervulkan.cpp:97
MythPainterVulkan::FreeResources
void FreeResources() override
Definition: mythpaintervulkan.cpp:37
mythdebugvulkan.h
MythPainterVulkan::Ready
bool Ready()
Definition: mythpaintervulkan.cpp:125
MythPainter::SetMaximumCacheSizes
void SetMaximumCacheSizes(int hardware, int software)
Definition: mythpainter.cpp:601
MythPainterVulkan::GetName
QString GetName() override
Definition: mythpaintervulkan.cpp:87
MythPainterVulkan::m_queuedTextures
std::vector< MythTextureVulkan * > m_queuedTextures
Definition: mythpaintervulkan.h:70
MythPainterVulkan::~MythPainterVulkan
~MythPainterVulkan() override
Definition: mythpaintervulkan.cpp:27
MythPainterVulkan::m_projectionDescriptor
VkDescriptorSet m_projectionDescriptor
Definition: mythpaintervulkan.h:58
MYTH_NULL_DISPATCH
#define MYTH_NULL_DISPATCH
Definition: mythrendervulkan.h:26
MythPainterVulkan::SupportsClipping
bool SupportsClipping() override
Definition: mythpaintervulkan.cpp:102
MythRenderVulkan::GetVulkanRender
static MythRenderVulkan * GetVulkanRender(void)
Definition: mythrendervulkan.cpp:88
mythburn.write
def write(text, progress=True)
Definition: mythburn.py:308
VERBOSE_LEVEL_CHECK
static bool VERBOSE_LEVEL_CHECK(uint64_t mask, LogLevel_t level)
Definition: mythlogging.h:29
MythPainterVulkan::m_texturePipeline
VkPipeline m_texturePipeline
Definition: mythpaintervulkan.h:62
MythPainterVulkan::m_projectionUniform
MythUniformBufferVulkan * m_projectionUniform
Definition: mythpaintervulkan.h:59
MythComboBufferVulkan::PushData
void PushData(const QMatrix4x4 &Transform, QRect Source, QRect Destination, int Alpha)
Definition: mythcombobuffervulkan.cpp:20
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythPainterVulkan::GetFormatImagePriv
MythImage * GetFormatImagePriv() override
Creates a reference counted image, call DecrRef() to delete.
Definition: mythpaintervulkan.cpp:384
MythRenderVulkan::CreateSingleUseCommandBuffer
VkCommandBuffer CreateSingleUseCommandBuffer(void)
Definition: mythrendervulkan.cpp:611
MythPainter::m_maxHardwareCacheSize
int m_maxHardwareCacheSize
Definition: mythpainter.h:137
mythpaintervulkan.h
MythVulkanObject::Create
static MythVulkanObject * Create(MythRenderVulkan *Render)
Definition: mythrendervulkan.cpp:16
MythPainterGPU::m_viewControl
ViewControls m_viewControl
Definition: mythpaintergpu.h:34
MythTextureVulkan
Definition: mythtexturevulkan.h:14
MythPainterVulkan::m_textureUploadCmd
VkCommandBuffer m_textureUploadCmd
Definition: mythpaintervulkan.h:66
MythUniformBufferVulkan::Update
void Update(void *Source)
Definition: mythuniformbuffervulkan.cpp:46
MythPainterVulkan::DrawImage
void DrawImage(QRect Dest, MythImage *Image, QRect Source, int Alpha) override
Definition: mythpaintervulkan.cpp:369
MythPainterVulkan::DeleteTextures
void DeleteTextures()
Definition: mythpaintervulkan.cpp:525
MythShaderVulkan::Create
static MythShaderVulkan * Create(MythVulkanObject *Vulkan, const std::vector< int > &Stages, const MythShaderMap *Sources=nullptr, const MythBindingMap *Bindings=nullptr)
Definition: mythshadervulkan.cpp:260
MythTextureVulkan::AddDescriptor
void AddDescriptor(VkDescriptorSet Descriptor)
Definition: mythtexturevulkan.cpp:140
MythRenderVulkan::GetVulkanWindow
MythWindowVulkan * GetVulkanWindow(void)
Definition: mythrendervulkan.cpp:126
mythcombobuffervulkan.h
MythPainterVulkan::m_imageToTextureMap
QMap< MythImage *, MythTextureVulkan * > m_imageToTextureMap
Definition: mythpaintervulkan.h:71
mythuniformbuffervulkan.h
MythRenderVulkan::BeginDebugRegion
void BeginDebugRegion(VkCommandBuffer CommandBuffer, const char *Name, MythVulkan4F Color)
Definition: mythrendervulkan.cpp:526
MythPainterVulkan::m_transforms
QStack< QMatrix4x4 > m_transforms
Definition: mythpaintervulkan.h:76
mythlogging.h
Source
Definition: channelsettings.cpp:93
MythShaderVulkan::GetPipelineLayout
VkPipelineLayout GetPipelineLayout(void) const
Definition: mythshadervulkan.cpp:458
MAX_TEXTURE_COUNT
#define MAX_TEXTURE_COUNT
Definition: mythpaintervulkan.h:17
MythRenderVulkan::SetFrameExpected
void SetFrameExpected(void)
Definition: mythrendervulkan.cpp:298
MythTextureVulkan::m_dataSize
uint64_t m_dataSize
Definition: mythtexturevulkan.h:27
MythPainterVulkan::m_textureSampler
VkSampler m_textureSampler
Definition: mythpaintervulkan.h:60
MythPainterVulkan::SupportsAlpha
bool SupportsAlpha() override
Definition: mythpaintervulkan.cpp:92
mythshadervulkan.h
MythPainterVulkan::m_stagedTextures
std::vector< MythTextureVulkan * > m_stagedTextures
Definition: mythpaintervulkan.h:69
MythImage::SetChanged
virtual void SetChanged(bool change=true)
Definition: mythimage.h:50
MythVulkanObject::Device
VkDevice Device()
Definition: mythrendervulkan.cpp:73
MythPainter::FreeResources
virtual void FreeResources(void)
Definition: mythpainter.h:53
MythPainterVulkan::m_ready
bool m_ready
Definition: mythpaintervulkan.h:54
MythPainterVulkan::m_availableTextureDescriptors
std::vector< VkDescriptorSet > m_availableTextureDescriptors
Definition: mythpaintervulkan.h:65
MythPainterVulkan::m_texturesToDelete
QVector< MythTextureVulkan * > m_texturesToDelete
Definition: mythpaintervulkan.h:73
MythRenderVulkan::EndDebugRegion
void EndDebugRegion(VkCommandBuffer CommandBuffer)
Definition: mythrendervulkan.cpp:533
MYTH_PUSHBUFFER_SIZE
#define MYTH_PUSHBUFFER_SIZE
Definition: mythcombobuffervulkan.h:24
MythPainterVulkan::DoFreeResources
void DoFreeResources()
Free resources before the render device is released.
Definition: mythpaintervulkan.cpp:45
UIEffects::m_vzoom
float m_vzoom
Definition: mythuianimation.h:41
mythimage.h
MythPainterVulkan::PopTransformation
void PopTransformation() override
Definition: mythpaintervulkan.cpp:120
MythPainterVulkan::PushTransformation
void PushTransformation(const UIEffects &Fx, QPointF Center=QPointF()) override
Definition: mythpaintervulkan.cpp:107
MythPainterVulkan::m_textureDescriptorPool
VkDescriptorPool m_textureDescriptorPool
Definition: mythpaintervulkan.h:63
MythPainterGPU::Framebuffer
@ Framebuffer
Definition: mythpaintergpu.h:20
MythRenderVulkan::CreatePipeline
VkPipeline CreatePipeline(MythShaderVulkan *Shader, QRect Viewport, std::vector< VkDynamicState > Dynamic={ })
Definition: mythrendervulkan.cpp:639
MythPainterVulkan::m_frameStarted
bool m_frameStarted
Definition: mythpaintervulkan.h:67
MythImage
Definition: mythimage.h:36
MythPainterVulkan::m_textureShader
MythShaderVulkan * m_textureShader
Definition: mythpaintervulkan.h:61
MythVulkanObject::Window
MythWindowVulkan * Window()
Definition: mythrendervulkan.cpp:83
MythRenderVulkan::EndFrame
void EndFrame(void)
Definition: mythrendervulkan.cpp:355
MythPainterGPU::m_lastSize
QSize m_lastSize
Definition: mythpaintergpu.h:37
MythDebugVulkan::kDebugGreen
static const MythVulkan4F kDebugGreen
Definition: mythdebugvulkan.h:12
MythPainterVulkan::m_projectionDescriptorPool
VkDescriptorPool m_projectionDescriptorPool
Definition: mythpaintervulkan.h:57
UIEffects
Definition: mythuianimation.h:13
DefaultFragment450
#define DefaultFragment450
Definition: mythshadersvulkan.h:24
MythVulkanObject::IsValidVulkan
bool IsValidVulkan() const
Definition: mythrendervulkan.cpp:63
MythRenderVulkan
Definition: mythrendervulkan.h:54
MythImage::IsChanged
bool IsChanged() const
Definition: mythimage.h:51
LOC
#define LOC
Definition: mythpaintervulkan.cpp:18
MythTextureVulkan::GetDescriptorImage
VkDescriptorImageInfo GetDescriptorImage(void) const
Definition: mythtexturevulkan.cpp:135
UIEffects::m_hzoom
float m_hzoom
Definition: mythuianimation.h:40
MythVulkanObject::Funcs
QVulkanDeviceFunctions * Funcs()
Definition: mythrendervulkan.cpp:78
MythPainter::Teardown
virtual void Teardown(void)
Definition: mythpainter.cpp:28
MythPainterVulkan::ClearCache
void ClearCache()
Definition: mythpaintervulkan.cpp:399
mythshadersvulkan.h
MythPainter::CheckFormatImage
void CheckFormatImage(MythImage *im)
Definition: mythpainter.cpp:550
MythRenderVulkan::FinishSingleUseCommandBuffer
void FinishSingleUseCommandBuffer(VkCommandBuffer &Buffer)
Definition: mythrendervulkan.cpp:627
MythVulkanObject::Render
MythRenderVulkan * Render()
Definition: mythrendervulkan.cpp:68
MythUniformBufferVulkan::Create
static MythUniformBufferVulkan * Create(MythVulkanObject *Vulkan, VkDeviceSize Size)
Definition: mythuniformbuffervulkan.cpp:4
MythPainterVulkan::m_textureDescriptorsCreated
bool m_textureDescriptorsCreated
Definition: mythpaintervulkan.h:64
MythMainWindow
Definition: mythmainwindow.h:28
MythPainterGPU
Definition: mythpaintergpu.h:11