1 /*
2  * Copyright 2018 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef GrVkImageLayout_DEFINED
9 #define GrVkImageLayout_DEFINED
10 
11 #include "include/core/SkRefCnt.h"
12 #include "include/gpu/vk/GrVkTypes.h"
13 
14 class GrVkImageLayout : public SkRefCnt {
15 public:
GrVkImageLayout(VkImageLayout layout)16     GrVkImageLayout(VkImageLayout layout) : fLayout(layout) {}
17 
setImageLayout(VkImageLayout layout)18     void setImageLayout(VkImageLayout layout) {
19         // Defaulting to use std::memory_order_seq_cst
20         fLayout.store(layout);
21     }
22 
getImageLayout()23     VkImageLayout getImageLayout() const {
24         // Defaulting to use std::memory_order_seq_cst
25         return fLayout.load();
26     }
27 
28 private:
29     std::atomic<VkImageLayout> fLayout;
30 };
31 
32 #endif
33