Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkRefCnt.h" |
| 12 | #include "include/gpu/vk/GrVkTypes.h" |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 13 | |
| 14 | class GrVkImageLayout : public SkRefCnt { |
| 15 | public: |
| 16 | GrVkImageLayout(VkImageLayout layout) : fLayout(layout) {} |
| 17 | |
| 18 | void setImageLayout(VkImageLayout layout) { |
| 19 | // Defaulting to use std::memory_order_seq_cst |
| 20 | fLayout.store(layout); |
| 21 | } |
| 22 | |
| 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 |