xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/vulkan/SurfaceVk.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2016 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 // SurfaceVk.h:
7 //    Defines the class interface for SurfaceVk, implementing SurfaceImpl.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_VULKAN_SURFACEVK_H_
11 #define LIBANGLE_RENDERER_VULKAN_SURFACEVK_H_
12 
13 #include "common/CircularBuffer.h"
14 #include "common/SimpleMutex.h"
15 #include "common/vulkan/vk_headers.h"
16 #include "libANGLE/renderer/SurfaceImpl.h"
17 #include "libANGLE/renderer/vulkan/CommandProcessor.h"
18 #include "libANGLE/renderer/vulkan/RenderTargetVk.h"
19 #include "libANGLE/renderer/vulkan/vk_helpers.h"
20 
21 namespace rx
22 {
23 class SurfaceVk : public SurfaceImpl, public angle::ObserverInterface, public vk::Resource
24 {
25   public:
26     angle::Result getAttachmentRenderTarget(const gl::Context *context,
27                                             GLenum binding,
28                                             const gl::ImageIndex &imageIndex,
29                                             GLsizei samples,
30                                             FramebufferAttachmentRenderTarget **rtOut) override;
31 
32   protected:
33     SurfaceVk(const egl::SurfaceState &surfaceState);
34     ~SurfaceVk() override;
35 
36     void destroy(const egl::Display *display) override;
37     // We monitor the staging buffer for changes. This handles staged data from outside this class.
38     void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override;
39 
40     // width and height can change with client window resizing
41     EGLint getWidth() const override;
42     EGLint getHeight() const override;
43 
44     EGLint mWidth;
45     EGLint mHeight;
46 
47     RenderTargetVk mColorRenderTarget;
48     RenderTargetVk mDepthStencilRenderTarget;
49 };
50 
51 class OffscreenSurfaceVk : public SurfaceVk
52 {
53   public:
54     OffscreenSurfaceVk(const egl::SurfaceState &surfaceState, vk::Renderer *renderer);
55     ~OffscreenSurfaceVk() override;
56 
57     egl::Error initialize(const egl::Display *display) override;
58     void destroy(const egl::Display *display) override;
59 
60     egl::Error unMakeCurrent(const gl::Context *context) override;
getColorImage()61     const vk::ImageHelper *getColorImage() const { return &mColorAttachment.image; }
62 
63     egl::Error swap(const gl::Context *context) override;
64     egl::Error postSubBuffer(const gl::Context *context,
65                              EGLint x,
66                              EGLint y,
67                              EGLint width,
68                              EGLint height) override;
69     egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
70     egl::Error bindTexImage(const gl::Context *context,
71                             gl::Texture *texture,
72                             EGLint buffer) override;
73     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
74     egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
75     egl::Error getMscRate(EGLint *numerator, EGLint *denominator) override;
76     void setSwapInterval(const egl::Display *display, EGLint interval) override;
77 
78     EGLint isPostSubBufferSupported() const override;
79     EGLint getSwapBehavior() const override;
80 
81     angle::Result initializeContents(const gl::Context *context,
82                                      GLenum binding,
83                                      const gl::ImageIndex &imageIndex) override;
84 
85     vk::ImageHelper *getColorAttachmentImage();
86 
87     egl::Error lockSurface(const egl::Display *display,
88                            EGLint usageHint,
89                            bool preservePixels,
90                            uint8_t **bufferPtrOut,
91                            EGLint *bufferPitchOut) override;
92     egl::Error unlockSurface(const egl::Display *display, bool preservePixels) override;
93     EGLint origin() const override;
94 
95     egl::Error attachToFramebuffer(const gl::Context *context,
96                                    gl::Framebuffer *framebuffer) override;
97     egl::Error detachFromFramebuffer(const gl::Context *context,
98                                      gl::Framebuffer *framebuffer) override;
99 
100   protected:
101     struct AttachmentImage final : angle::NonCopyable
102     {
103         AttachmentImage(SurfaceVk *surfaceVk);
104         ~AttachmentImage();
105 
106         angle::Result initialize(DisplayVk *displayVk,
107                                  EGLint width,
108                                  EGLint height,
109                                  const vk::Format &vkFormat,
110                                  GLint samples,
111                                  bool isRobustResourceInitEnabled,
112                                  bool hasProtectedContent);
113 
114         void destroy(const egl::Display *display);
115 
116         vk::ImageHelper image;
117         vk::ImageViewHelper imageViews;
118         angle::ObserverBinding imageObserverBinding;
119     };
120 
121     virtual angle::Result initializeImpl(DisplayVk *displayVk);
122 
123     AttachmentImage mColorAttachment;
124     AttachmentImage mDepthStencilAttachment;
125 
126     // EGL_KHR_lock_surface3
127     vk::BufferHelper mLockBufferHelper;
128 };
129 
130 // Data structures used in WindowSurfaceVk
131 namespace impl
132 {
133 static constexpr size_t kSwapHistorySize = 2;
134 
135 // Old swapchain and associated present fences/semaphores that need to be scheduled for
136 // recycling/destruction when appropriate.
137 struct SwapchainCleanupData : angle::NonCopyable
138 {
139     SwapchainCleanupData();
140     SwapchainCleanupData(SwapchainCleanupData &&other);
141     ~SwapchainCleanupData();
142 
143     // Fences must not be empty (VK_EXT_swapchain_maintenance1 is supported).
144     VkResult getFencesStatus(VkDevice device) const;
145     // Waits fences if any. Use before force destroying the swapchain.
146     void waitFences(VkDevice device, uint64_t timeout) const;
147     void destroy(VkDevice device,
148                  vk::Recycler<vk::Fence> *fenceRecycler,
149                  vk::Recycler<vk::Semaphore> *semaphoreRecycler);
150 
151     // The swapchain to be destroyed.
152     VkSwapchainKHR swapchain = VK_NULL_HANDLE;
153     // Any present fences/semaphores that were pending recycle at the time the swapchain was
154     // recreated will be scheduled for recycling at the same time as the swapchain's destruction.
155     // fences must be in the present operation order.
156     std::vector<vk::Fence> fences;
157     std::vector<vk::Semaphore> semaphores;
158 };
159 
160 // Each present operation is associated with a wait semaphore.  To know when that semaphore can be
161 // recycled, a swapSerial is used.  When that swapSerial is finished, the semaphore used in the
162 // previous present operation involving imageIndex can be recycled.  See doc/PresentSemaphores.md
163 // for details.
164 // When VK_EXT_swapchain_maintenance1 is supported, present fence is used instead of the swapSerial.
165 //
166 // Old swapchains are scheduled to be destroyed at the same time as the last wait semaphore used to
167 // present an image to the old swapchains can be recycled (only relevant when
168 // VK_EXT_swapchain_maintenance1 is not supported).
169 struct ImagePresentOperation : angle::NonCopyable
170 {
171     ImagePresentOperation();
172     ImagePresentOperation(ImagePresentOperation &&other);
173     ImagePresentOperation &operator=(ImagePresentOperation &&other);
174     ~ImagePresentOperation();
175 
176     void destroy(VkDevice device,
177                  vk::Recycler<vk::Fence> *fenceRecycler,
178                  vk::Recycler<vk::Semaphore> *semaphoreRecycler);
179 
180     // fence is only used when VK_EXT_swapchain_maintenance1 is supported.
181     vk::Fence fence;
182     vk::Semaphore semaphore;
183 
184     // Below members only relevant when VK_EXT_swapchain_maintenance1 is not supported.
185     // Used to associate a swapSerial with the previous present operation of the image.
186     uint32_t imageIndex;
187     QueueSerial queueSerial;
188     std::deque<SwapchainCleanupData> oldSwapchains;
189 };
190 
191 // Swapchain images and their associated objects.
192 struct SwapchainImage : angle::NonCopyable
193 {
194     SwapchainImage();
195     SwapchainImage(SwapchainImage &&other);
196     ~SwapchainImage();
197 
198     std::unique_ptr<vk::ImageHelper> image;
199     vk::ImageViewHelper imageViews;
200     vk::Framebuffer framebuffer;
201     vk::Framebuffer fetchFramebuffer;
202 
203     uint64_t frameNumber = 0;
204 };
205 
206 enum class ImageAcquireState
207 {
208     Ready,
209     NeedToAcquire,
210     NeedToProcessResult,
211 };
212 
213 // Associated data for a call to vkAcquireNextImageKHR without necessarily holding the share group
214 // and global locks but ONLY from a thread where Surface is current.
215 struct UnlockedAcquireData : angle::NonCopyable
216 {
217     // Given that the CPU is throttled after a number of swaps, there is an upper bound to the
218     // number of semaphores that are used to acquire swapchain images, and that is
219     // kSwapHistorySize+1:
220     //
221     //             Unrelated submission in     Submission as part of
222     //               the middle of frame          buffer swap
223     //                              |                 |
224     //                              V                 V
225     //     Frame i:     ... ANI ... QS (fence Fa) ... QS (Fence Fb) QP Wait(..)
226     //     Frame i+1:   ... ANI ... QS (fence Fc) ... QS (Fence Fd) QP Wait(..) <--\
227     //     Frame i+2:   ... ANI ... QS (fence Fe) ... QS (Fence Ff) QP Wait(Fb)    |
228     //                                                                  ^          |
229     //                                                                  |          |
230     //                                                           CPU throttling    |
231     //                                                                             |
232     //                               Note: app should throttle itself here (equivalent of Wait(Fb))
233     //
234     // In frame i+2 (2 is kSwapHistorySize), ANGLE waits on fence Fb which means that the semaphore
235     // used for Frame i's ANI can be reused (because Fb-is-signalled implies Fa-is-signalled).
236     // Before this wait, there were three acquire semaphores in use corresponding to frames i, i+1
237     // and i+2.  Frame i+3 can reuse the semaphore of frame i.
238     angle::CircularBuffer<vk::Semaphore, impl::kSwapHistorySize + 1> acquireImageSemaphores;
239 };
240 
241 struct UnlockedAcquireResult : angle::NonCopyable
242 {
243     // The result of the call to vkAcquireNextImageKHR.
244     VkResult result = VK_SUCCESS;
245 
246     // Semaphore to signal.
247     VkSemaphore acquireSemaphore = VK_NULL_HANDLE;
248 
249     // Image index that was acquired
250     uint32_t imageIndex = std::numeric_limits<uint32_t>::max();
251 };
252 
253 struct ImageAcquireOperation : angle::NonCopyable
254 {
255     // Initially image needs to be acquired.
256     ImageAcquireState state = ImageAcquireState::NeedToAcquire;
257 
258     // No synchronization is necessary when making the vkAcquireNextImageKHR call since it is ONLY
259     // possible on a thread where Surface is current.
260     UnlockedAcquireData unlockedAcquireData;
261     UnlockedAcquireResult unlockedAcquireResult;
262 };
263 }  // namespace impl
264 
265 class WindowSurfaceVk : public SurfaceVk
266 {
267   public:
268     WindowSurfaceVk(const egl::SurfaceState &surfaceState, EGLNativeWindowType window);
269     ~WindowSurfaceVk() override;
270 
271     void destroy(const egl::Display *display) override;
272 
273     egl::Error initialize(const egl::Display *display) override;
274 
275     egl::Error unMakeCurrent(const gl::Context *context) override;
276 
277     angle::Result getAttachmentRenderTarget(const gl::Context *context,
278                                             GLenum binding,
279                                             const gl::ImageIndex &imageIndex,
280                                             GLsizei samples,
281                                             FramebufferAttachmentRenderTarget **rtOut) override;
282     egl::Error prepareSwap(const gl::Context *context) override;
283     egl::Error swap(const gl::Context *context) override;
284     egl::Error swapWithDamage(const gl::Context *context,
285                               const EGLint *rects,
286                               EGLint n_rects) override;
287     egl::Error postSubBuffer(const gl::Context *context,
288                              EGLint x,
289                              EGLint y,
290                              EGLint width,
291                              EGLint height) override;
292     egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
293     egl::Error bindTexImage(const gl::Context *context,
294                             gl::Texture *texture,
295                             EGLint buffer) override;
296     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
297     egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
298     egl::Error getMscRate(EGLint *numerator, EGLint *denominator) override;
299     void setSwapInterval(const egl::Display *display, EGLint interval) override;
300 
301     // Note: windows cannot be resized on Android.  The approach requires
302     // calling vkGetPhysicalDeviceSurfaceCapabilitiesKHR.  However, that is
303     // expensive; and there are troublesome timing issues for other parts of
304     // ANGLE (which cause test failures and crashes).  Therefore, a
305     // special-Android-only path is created just for the querying of EGL_WIDTH
306     // and EGL_HEIGHT.
307     // https://issuetracker.google.com/issues/153329980
308     egl::Error getUserWidth(const egl::Display *display, EGLint *value) const override;
309     egl::Error getUserHeight(const egl::Display *display, EGLint *value) const override;
310     angle::Result getUserExtentsImpl(DisplayVk *displayVk,
311                                      VkSurfaceCapabilitiesKHR *surfaceCaps) const;
312 
313     EGLint isPostSubBufferSupported() const override;
314     EGLint getSwapBehavior() const override;
315 
316     angle::Result initializeContents(const gl::Context *context,
317                                      GLenum binding,
318                                      const gl::ImageIndex &imageIndex) override;
319 
320     vk::Framebuffer &chooseFramebuffer();
321 
322     angle::Result getCurrentFramebuffer(ContextVk *context,
323                                         vk::FramebufferFetchMode fetchMode,
324                                         const vk::RenderPass &compatibleRenderPass,
325                                         vk::Framebuffer *framebufferOut);
326 
getPreTransform()327     VkSurfaceTransformFlagBitsKHR getPreTransform() const
328     {
329         if (mEmulatedPreTransform != VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
330         {
331             return mEmulatedPreTransform;
332         }
333         return mPreTransform;
334     }
335 
336     egl::Error setAutoRefreshEnabled(bool enabled) override;
337 
338     egl::Error getBufferAge(const gl::Context *context, EGLint *age) override;
339 
340     egl::Error setRenderBuffer(EGLint renderBuffer) override;
341 
isSharedPresentMode()342     bool isSharedPresentMode() const
343     {
344         return (mSwapchainPresentMode == vk::PresentMode::SharedDemandRefreshKHR ||
345                 mSwapchainPresentMode == vk::PresentMode::SharedContinuousRefreshKHR);
346     }
347 
isSharedPresentModeDesired()348     bool isSharedPresentModeDesired() const
349     {
350         return (mDesiredSwapchainPresentMode == vk::PresentMode::SharedDemandRefreshKHR ||
351                 mDesiredSwapchainPresentMode == vk::PresentMode::SharedContinuousRefreshKHR);
352     }
353 
354     egl::Error lockSurface(const egl::Display *display,
355                            EGLint usageHint,
356                            bool preservePixels,
357                            uint8_t **bufferPtrOut,
358                            EGLint *bufferPitchOut) override;
359     egl::Error unlockSurface(const egl::Display *display, bool preservePixels) override;
360     EGLint origin() const override;
361 
362     egl::Error attachToFramebuffer(const gl::Context *context,
363                                    gl::Framebuffer *framebuffer) override;
364     egl::Error detachFromFramebuffer(const gl::Context *context,
365                                      gl::Framebuffer *framebuffer) override;
366 
367     angle::Result onSharedPresentContextFlush(const gl::Context *context);
368 
369     bool hasStagedUpdates() const;
370 
371     void setTimestampsEnabled(bool enabled) override;
372 
373   protected:
374     angle::Result swapImpl(const gl::Context *context,
375                            const EGLint *rects,
376                            EGLint n_rects,
377                            const void *pNextChain);
378     // Called when a swapchain image whose acquisition was deferred must be acquired.  This method
379     // will recreate the swapchain (if needed due to present returning OUT_OF_DATE, swap interval
380     // changing, surface size changing etc, by calling prepareForAcquireNextSwapchainImage()) and
381     // call the doDeferredAcquireNextImageWithUsableSwapchain() method.
382     angle::Result doDeferredAcquireNextImage(const gl::Context *context,
383                                              bool forceSwapchainRecreate);
384     // Calls acquireNextSwapchainImage() and sets up the acquired image.  On some platforms,
385     // vkAcquireNextImageKHR returns OUT_OF_DATE instead of present, so this function may still
386     // recreate the swapchain.  The main difference with doDeferredAcquireNextImage is that it does
387     // not check for surface property changes for the purposes of swapchain recreation (because
388     // that's already done by prepareForAcquireNextSwapchainImage.
389     angle::Result doDeferredAcquireNextImageWithUsableSwapchain(const gl::Context *context);
390 
391     EGLNativeWindowType mNativeWindowType;
392     VkSurfaceKHR mSurface;
393     VkSurfaceCapabilitiesKHR mSurfaceCaps;
394     VkBool32 mSupportsProtectedSwapchain;
395 
396   private:
397     virtual angle::Result createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)      = 0;
398     virtual angle::Result getCurrentWindowSize(vk::Context *context, gl::Extents *extentsOut) = 0;
399 
400     void setSwapInterval(DisplayVk *displayVk, EGLint interval);
401 
402     angle::Result initializeImpl(DisplayVk *displayVk, bool *anyMatchesOut);
403     angle::Result recreateSwapchain(ContextVk *contextVk, const gl::Extents &extents);
404     angle::Result createSwapChain(vk::Context *context, const gl::Extents &extents);
405     angle::Result collectOldSwapchain(ContextVk *contextVk, VkSwapchainKHR swapchain);
406     angle::Result queryAndAdjustSurfaceCaps(ContextVk *contextVk,
407                                             VkSurfaceCapabilitiesKHR *surfaceCaps);
408     angle::Result checkForOutOfDateSwapchain(ContextVk *contextVk, bool forceRecreate);
409     angle::Result resizeSwapchainImages(vk::Context *context, uint32_t imageCount);
410     void releaseSwapchainImages(ContextVk *contextVk);
411     void destroySwapChainImages(DisplayVk *displayVk);
412     angle::Result prepareForAcquireNextSwapchainImage(const gl::Context *context,
413                                                       bool forceSwapchainRecreate);
414     // This method calls vkAcquireNextImageKHR() to acquire the next swapchain image.  It is called
415     // when the swapchain is initially created and when present() finds the swapchain out of date.
416     // Otherwise, it is scheduled to be called later by deferAcquireNextImage().
417     VkResult acquireNextSwapchainImage(vk::Context *context);
418     // Process the result of vkAcquireNextImageKHR.
419     VkResult postProcessUnlockedAcquire(vk::Context *context);
420     // This method is called when a swapchain image is presented.  It schedules
421     // acquireNextSwapchainImage() to be called later.
422     void deferAcquireNextImage();
423     bool skipAcquireNextSwapchainImageForSharedPresentMode() const;
424 
425     angle::Result computePresentOutOfDate(vk::Context *context,
426                                           VkResult result,
427                                           bool *presentOutOfDate);
428     angle::Result prePresentSubmit(ContextVk *contextVk, const vk::Semaphore &presentSemaphore);
429     angle::Result present(ContextVk *contextVk,
430                           const EGLint *rects,
431                           EGLint n_rects,
432                           const void *pNextChain,
433                           bool *presentOutOfDate);
434 
435     angle::Result cleanUpPresentHistory(vk::Context *context);
436     angle::Result cleanUpOldSwapchains(vk::Context *context);
437 
438     // Throttle the CPU such that application's logic and command buffer recording doesn't get more
439     // than two frame ahead of the frame being rendered (and three frames ahead of the one being
440     // presented).  This is a failsafe, as the application should ensure command buffer recording is
441     // not ahead of the frame being rendered by *one* frame.
442     angle::Result throttleCPU(vk::Context *context, const QueueSerial &currentSubmitSerial);
443 
444     // Finish all GPU operations on the surface
445     angle::Result finish(vk::Context *context);
446 
447     void updateOverlay(ContextVk *contextVk) const;
448     bool overlayHasEnabledWidget(ContextVk *contextVk) const;
449     angle::Result drawOverlay(ContextVk *contextVk, impl::SwapchainImage *image) const;
450 
451     bool isMultiSampled() const;
452 
453     bool supportsPresentMode(vk::PresentMode presentMode) const;
454 
455     bool updateColorSpace(DisplayVk *displayVk);
456 
457     angle::FormatID getIntendedFormatID(vk::Renderer *renderer);
458     angle::FormatID getActualFormatID(vk::Renderer *renderer);
459 
460     std::vector<vk::PresentMode> mPresentModes;
461 
462     VkSwapchainKHR mSwapchain;      // Current swapchain (same as last created or NULL)
463     VkSwapchainKHR mLastSwapchain;  // Last created non retired swapchain (or NULL if retired)
464     vk::SwapchainStatus mSwapchainStatus;
465     // Cached information used to recreate swapchains.
466     vk::PresentMode mSwapchainPresentMode;         // Current swapchain mode
467     vk::PresentMode mDesiredSwapchainPresentMode;  // Desired mode set through setSwapInterval()
468     uint32_t mMinImageCount;
469     VkSurfaceTransformFlagBitsKHR mPreTransform;
470     VkSurfaceTransformFlagBitsKHR mEmulatedPreTransform;
471     VkCompositeAlphaFlagBitsKHR mCompositeAlpha;
472     VkColorSpaceKHR mSurfaceColorSpace;
473 
474     // Present modes that are compatible with the current mode.  If mDesiredSwapchainPresentMode is
475     // in this list, mode switch can happen without the need to recreate the swapchain.
476     // There are currently only 6 possible present modes but vector is bigger for a workaround.
477     static constexpr uint32_t kCompatiblePresentModesSize = 10;
478     angle::FixedVector<VkPresentModeKHR, kCompatiblePresentModesSize> mCompatiblePresentModes;
479 
480     // A circular buffer that stores the serial of the submission fence of the context on every
481     // swap. The CPU is throttled by waiting for the 2nd previous serial to finish.  This should
482     // normally be a no-op, as the application should pace itself to avoid input lag, and is
483     // implemented in ANGLE as a fail safe.  Removing this throttling requires untangling it from
484     // acquire semaphore recycling (see mAcquireImageSemaphores above)
485     angle::CircularBuffer<QueueSerial, impl::kSwapHistorySize> mSwapHistory;
486 
487     // The previous swapchain which needs to be scheduled for destruction when appropriate.  This
488     // will be done when the first image of the current swapchain is presented or when fences are
489     // signaled (when VK_EXT_swapchain_maintenance1 is supported).  If there were older swapchains
490     // pending destruction when the swapchain is recreated, they will accumulate and be destroyed
491     // with the previous swapchain.
492     //
493     // Note that if the user resizes the window such that the swapchain is recreated every frame,
494     // this array can go grow indefinitely.
495     std::deque<impl::SwapchainCleanupData> mOldSwapchains;
496 
497     std::vector<impl::SwapchainImage> mSwapchainImages;
498     std::vector<angle::ObserverBinding> mSwapchainImageBindings;
499     uint32_t mCurrentSwapchainImageIndex;
500 
501     // There is no direct signal from Vulkan regarding when a Present semaphore can be be reused.
502     // During window resizing when swapchains are recreated every frame, the number of in-flight
503     // present semaphores can grow indefinitely.  See doc/PresentSemaphores.md.
504     vk::Recycler<vk::Semaphore> mPresentSemaphoreRecycler;
505     // Fences are associated with present semaphores to know when they can be recycled.
506     vk::Recycler<vk::Fence> mPresentFenceRecycler;
507 
508     // The presentation history, used to recycle semaphores and destroy old swapchains.
509     std::deque<impl::ImagePresentOperation> mPresentHistory;
510 
511     // Depth/stencil image.  Possibly multisampled.
512     vk::ImageHelper mDepthStencilImage;
513     vk::ImageViewHelper mDepthStencilImageViews;
514     angle::ObserverBinding mDepthStencilImageBinding;
515 
516     // Multisample color image, view and framebuffer, if multisampling enabled.
517     vk::ImageHelper mColorImageMS;
518     vk::ImageViewHelper mColorImageMSViews;
519     angle::ObserverBinding mColorImageMSBinding;
520     vk::Framebuffer mFramebufferMS;
521 
522     impl::ImageAcquireOperation mAcquireOperation;
523 
524     // EGL_EXT_buffer_age: Track frame count.
525     uint64_t mFrameCount;
526 
527     // EGL_KHR_lock_surface3
528     vk::BufferHelper mLockBufferHelper;
529 
530     // EGL_KHR_partial_update
531     uint64_t mBufferAgeQueryFrameNumber;
532 
533     // GL_EXT_shader_framebuffer_fetch
534     vk::FramebufferFetchMode mFramebufferFetchMode = vk::FramebufferFetchMode::None;
535 };
536 
537 }  // namespace rx
538 
539 #endif  // LIBANGLE_RENDERER_VULKAN_SURFACEVK_H_
540