1 //
2 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // OverlayVk.h:
7 //    Defines the OverlayVk class that does the actual rendering of the overlay.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_VULKAN_OVERLAYVK_H_
11 #define LIBANGLE_RENDERER_VULKAN_OVERLAYVK_H_
12 
13 #include "common/angleutils.h"
14 #include "libANGLE/Overlay.h"
15 #include "libANGLE/renderer/OverlayImpl.h"
16 #include "libANGLE/renderer/vulkan/vk_helpers.h"
17 
18 namespace rx
19 {
20 class ContextVk;
21 
22 class OverlayVk : public OverlayImpl
23 {
24   public:
25     OverlayVk(const gl::OverlayState &state);
26     ~OverlayVk() override;
27 
28     angle::Result init(const gl::Context *context, bool *successOut) override;
29     void onDestroy(const gl::Context *context) override;
30 
31     angle::Result onPresent(ContextVk *contextVk,
32                             vk::ImageHelper *imageToPresent,
33                             const vk::ImageView *imageToPresentView,
34                             bool is90DegreeRotation);
35 
getEnabledWidgetCount()36     uint32_t getEnabledWidgetCount() const { return mState.getEnabledWidgetCount(); }
37 
38   private:
39     angle::Result createFont(ContextVk *contextVk);
40     angle::Result cullWidgets(ContextVk *contextVk);
41 
42     bool mSupportsSubgroupBallot;
43     bool mSupportsSubgroupArithmetic;
44     bool mRefreshCulledWidgets;
45 
46     // Cached size of subgroup as accepted by UtilsVk, deduced from hardware subgroup size.
47     uint32_t mSubgroupSize[2];
48 
49     // Cached size of last presented image.  If the size changes, culling is repeated.
50     VkExtent2D mPresentImageExtent;
51 
52     vk::ImageHelper mFontImage;
53     vk::ImageView mFontImageView;
54 
55     vk::ImageHelper mCulledWidgets;
56     vk::ImageView mCulledWidgetsView;
57 };
58 
59 }  // namespace rx
60 
61 #endif  // LIBANGLE_RENDERER_VULKAN_OVERLAYVK_H_
62