OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrVkSampler_DEFINED | 8 #ifndef GrVkSampler_DEFINED |
9 #define GrVkSampler_DEFINED | 9 #define GrVkSampler_DEFINED |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 public: | 21 public: |
22 static GrVkSampler* Create(const GrVkGpu* gpu, const GrTextureParams&, uint3
2_t mipLevels); | 22 static GrVkSampler* Create(const GrVkGpu* gpu, const GrTextureParams&, uint3
2_t mipLevels); |
23 | 23 |
24 VkSampler sampler() const { return fSampler; } | 24 VkSampler sampler() const { return fSampler; } |
25 | 25 |
26 // Helpers for hashing GrVkSampler | 26 // Helpers for hashing GrVkSampler |
27 static uint16_t GenerateKey(const GrTextureParams&, uint32_t mipLevels); | 27 static uint16_t GenerateKey(const GrTextureParams&, uint32_t mipLevels); |
28 | 28 |
29 static const uint16_t& GetKey(const GrVkSampler& sampler) { return sampler.f
Key; } | 29 static const uint16_t& GetKey(const GrVkSampler& sampler) { return sampler.f
Key; } |
30 static uint32_t Hash(const uint16_t& key) { return key; } | 30 static uint32_t Hash(const uint16_t& key) { return key; } |
| 31 |
| 32 #ifdef SK_TRACE_VK_RESOURCES |
| 33 void dumpInfo() const override { |
| 34 SkDebugf("GrVkSampler: %d (%d refs)\n", fSampler, this->getRefCnt()); |
| 35 } |
| 36 #endif |
| 37 |
31 private: | 38 private: |
32 GrVkSampler(VkSampler sampler, uint16_t key) : INHERITED(), fSampler(sampler
), fKey(key) {} | 39 GrVkSampler(VkSampler sampler, uint16_t key) : INHERITED(), fSampler(sampler
), fKey(key) {} |
33 | 40 |
34 void freeGPUData(const GrVkGpu* gpu) const override; | 41 void freeGPUData(const GrVkGpu* gpu) const override; |
35 | 42 |
36 VkSampler fSampler; | 43 VkSampler fSampler; |
37 uint16_t fKey; | 44 uint16_t fKey; |
38 | 45 |
39 typedef GrVkResource INHERITED; | 46 typedef GrVkResource INHERITED; |
40 }; | 47 }; |
41 | 48 |
42 #endif | 49 #endif |
OLD | NEW |