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