OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_QUADS_RENDER_PASS_ID_H_ | 5 #ifndef CC_QUADS_RENDER_PASS_ID_H_ |
6 #define CC_QUADS_RENDER_PASS_ID_H_ | 6 #define CC_QUADS_RENDER_PASS_ID_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> |
9 | 10 |
10 #include <tuple> | 11 #include <tuple> |
11 | 12 |
12 #include "base/hash.h" | 13 #include "base/hash.h" |
13 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 class CC_EXPORT RenderPassId { | 18 class CC_EXPORT RenderPassId { |
18 public: | 19 public: |
19 int layer_id; | 20 int layer_id; |
20 size_t index; | 21 uint32_t index; |
21 | 22 |
22 RenderPassId() : layer_id(-1), index(0) {} | 23 RenderPassId() : layer_id(-1), index(0) {} |
23 RenderPassId(int layer_id, size_t index) : layer_id(layer_id), index(index) {} | 24 RenderPassId(int layer_id, uint32_t index) |
| 25 : layer_id(layer_id), index(index) {} |
24 void* AsTracingId() const; | 26 void* AsTracingId() const; |
25 | 27 |
26 bool IsValid() const { return layer_id >= 0; } | 28 bool IsValid() const { return layer_id >= 0; } |
27 | 29 |
28 bool operator==(const RenderPassId& other) const { | 30 bool operator==(const RenderPassId& other) const { |
29 return layer_id == other.layer_id && index == other.index; | 31 return layer_id == other.layer_id && index == other.index; |
30 } | 32 } |
31 bool operator!=(const RenderPassId& other) const { return !(*this == other); } | 33 bool operator!=(const RenderPassId& other) const { return !(*this == other); } |
32 bool operator<(const RenderPassId& other) const { | 34 bool operator<(const RenderPassId& other) const { |
33 return std::tie(layer_id, index) < std::tie(other.layer_id, other.index); | 35 return std::tie(layer_id, index) < std::tie(other.layer_id, other.index); |
34 } | 36 } |
35 }; | 37 }; |
36 | 38 |
37 struct RenderPassIdHash { | 39 struct RenderPassIdHash { |
38 size_t operator()(RenderPassId key) const { | 40 size_t operator()(RenderPassId key) const { |
39 return base::HashInts(key.layer_id, static_cast<int>(key.index)); | 41 return base::HashInts(key.layer_id, static_cast<int>(key.index)); |
40 } | 42 } |
41 }; | 43 }; |
42 | 44 |
43 } // namespace cc | 45 } // namespace cc |
44 | 46 |
45 #endif // CC_QUADS_RENDER_PASS_ID_H_ | 47 #endif // CC_QUADS_RENDER_PASS_ID_H_ |
OLD | NEW |