• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
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 GrD3DResourceState_DEFINED
9 #define GrD3DResourceState_DEFINED
10 
11 #include "include/core/SkRefCnt.h"
12 #include "include/gpu/d3d/GrD3DTypes.h"
13 
14 class GrD3DResourceState : public SkRefCnt {
15 public:
GrD3DResourceState(D3D12_RESOURCE_STATES state)16     GrD3DResourceState(D3D12_RESOURCE_STATES state) : fState(state) {}
17 
setResourceState(D3D12_RESOURCE_STATES state)18     void setResourceState(D3D12_RESOURCE_STATES state) {
19         // Defaulting to use std::memory_order_seq_cst
20         fState.store(state);
21     }
22 
getResourceState()23     D3D12_RESOURCE_STATES getResourceState() const {
24         // Defaulting to use std::memory_order_seq_cst
25         return fState.load();
26     }
27 
28 private:
29     std::atomic<D3D12_RESOURCE_STATES> fState;
30 };
31 
32 #endif
33