| /* |
| * Copyright 2021 Google LLC |
| * |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| */ |
| |
| #ifndef skgpu_graphite_ResourceTypes_DEFINED |
| #define skgpu_graphite_ResourceTypes_DEFINED |
| |
| #include "include/gpu/graphite/GraphiteTypes.h" |
| #include "src/core/SkEnumBitMask.h" |
| |
| namespace skgpu::graphite { |
| |
| /** |
| * Is the Texture renderable or not |
| */ |
| enum class Renderable : bool { |
| kNo = false, |
| kYes = true, |
| }; |
| |
| enum class DepthStencilFlags : int { |
| kNone = 0b000, |
| kDepth = 0b001, |
| kStencil = 0b010, |
| kDepthStencil = kDepth | kStencil, |
| }; |
| SK_MAKE_BITMASK_OPS(DepthStencilFlags); |
| |
| /** |
| * What a GPU buffer will be used for |
| */ |
| enum class BufferType { |
| kVertex, |
| kIndex, |
| kXferCpuToGpu, |
| kXferGpuToCpu, |
| kUniform, |
| }; |
| static const int kBufferTypeCount = static_cast<int>(BufferType::kUniform) + 1; |
| |
| /** |
| * When creating the memory for a resource should we use a memory type that prioritizes the |
| * effeciency of GPU reads even if it involves extra work to write CPU data to it. For example, we |
| * would want this for buffers that we cache to read the same data many times on the GPU. |
| */ |
| enum class PrioritizeGpuReads : bool { |
| kNo = false, |
| kYes = true, |
| }; |
| |
| enum class Ownership { |
| kOwned, |
| kWrapped, |
| }; |
| |
| /** Uniquely identifies the type of resource that is cached with a GraphiteResourceKey. */ |
| using ResourceType = uint32_t; |
| |
| /** |
| * Can the resource be held by multiple users at the same time? |
| * For example, stencil buffers, pipelines, etc. |
| */ |
| enum class Shareable : bool { |
| kNo = false, |
| kYes = true, |
| }; |
| |
| /** |
| * This enum is used to notify the ResourceCache which type of ref just dropped to zero on a |
| * Resource. |
| */ |
| enum class LastRemovedRef { |
| kUsage, |
| kCommandBuffer, |
| kCache, |
| }; |
| |
| }; // namespace skgpu::graphite |
| |
| #endif // skgpu_graphite_ResourceTypes_DEFINED |