/* * Copyright 2010 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrTypes_DEFINED #define GrTypes_DEFINED #include "include/core/SkTypes.h" #include "include/private/base/SkTo.h" // IWYU pragma: keep #include <cstddef> #include <cstdint> class GrBackendSemaphore; namespace skgpu { enum class Protected : bool; enum class Renderable : bool; } /////////////////////////////////////////////////////////////////////////////// /** * Possible 3D APIs that may be used by Ganesh. */ enum class GrBackendApi : unsigned { … }; /** * Previously the above enum was not an enum class but a normal enum. To support the legacy use of * the enum values we define them below so that no clients break. */ GrBackend; static constexpr GrBackendApi kMetal_GrBackend = …; static constexpr GrBackendApi kVulkan_GrBackend = …; static constexpr GrBackendApi kMock_GrBackend = …; /////////////////////////////////////////////////////////////////////////////// /* * Can a GrBackendObject be rendered to? */ GrRenderable; /* * Used to say whether texture is backed by protected memory. */ GrProtected; /////////////////////////////////////////////////////////////////////////////// /** * GPU SkImage and SkSurfaces can be stored such that (0, 0) in texture space may correspond to * either the top-left or bottom-left content pixel. */ enum GrSurfaceOrigin : int { … }; /** * A GrContext's cache of backend context state can be partially invalidated. * These enums are specific to the GL backend and we'd add a new set for an alternative backend. */ enum GrGLBackendState { … }; /** * This value translates to reseting all the context state for any backend. */ static const uint32_t kAll_GrBackendState = …; GrGpuFinishedContext; GrGpuFinishedProc; GrGpuSubmittedContext; GrGpuSubmittedProc; GrDirectContextDestroyedContext; GrDirectContextDestroyedProc; /** * Struct to supply options to flush calls. * * After issuing all commands, fNumSemaphore semaphores will be signaled by the gpu. The client * passes in an array of fNumSemaphores GrBackendSemaphores. In general these GrBackendSemaphore's * can be either initialized or not. If they are initialized, the backend uses the passed in * semaphore. If it is not initialized, a new semaphore is created and the GrBackendSemaphore * object is initialized with that semaphore. The semaphores are not sent to the GPU until the next * GrContext::submit call is made. See the GrContext::submit for more information. * * The client will own and be responsible for deleting the underlying semaphores that are stored * and returned in initialized GrBackendSemaphore objects. The GrBackendSemaphore objects * themselves can be deleted as soon as this function returns. * * If a finishedProc is provided, the finishedProc will be called when all work submitted to the gpu * from this flush call and all previous flush calls has finished on the GPU. If the flush call * fails due to an error and nothing ends up getting sent to the GPU, the finished proc is called * immediately. * * If a submittedProc is provided, the submittedProc will be called when all work from this flush * call is submitted to the GPU. If the flush call fails due to an error and nothing will get sent * to the GPU, the submitted proc is called immediately. It is possibly that when work is finally * submitted, that the submission actual fails. In this case we will not reattempt to do the * submission. Skia notifies the client of these via the success bool passed into the submittedProc. * The submittedProc is useful to the client to know when semaphores that were sent with the flush * have actually been submitted to the GPU so that they can be waited on (or deleted if the submit * fails). * GrBackendSemaphores are not supported for the GL backend and will be ignored if set. */ struct GrFlushInfo { … }; /** * Enum used as return value when flush with semaphores so the client knows whether the valid * semaphores will be submitted on the next GrContext::submit call. */ enum class GrSemaphoresSubmitted : bool { … }; enum class GrPurgeResourceOptions { … }; enum class GrSyncCpu : bool { … }; #endif