Add #ifdefs to GrBackendSemaphore to guard includes and methods
Change-Id: Ia969cda749fe15df645300248e0f17d3e4b77215 Bug: skia:12584 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466438 Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
f8b3e0c50e
commit
7b426f5f14
@ -2,6 +2,18 @@ Skia Graphics Release Notes
|
||||
|
||||
This file includes a list of high level updates for each milestone release.
|
||||
|
||||
Milestone 98
|
||||
------------
|
||||
* The following functions and methods are not defined in SkSurface when SK_SUPPORT_GPU is 0:
|
||||
MakeFromBackendTexture, MakeFromBackendRenderTarget, MakeRenderTarget,
|
||||
getBackendTexture, getBackendRenderTarget, replaceBackendTexture. flush() with parameters
|
||||
was removed as well. These were all no-ops anyway when just the CPU backend was compiled in
|
||||
(noting that flush() and flushAndSubmit() are still no-ops on the CPU backend).
|
||||
* GrBackendSemaphore only includes methods that match the GPU backend that Skia was compiled for.
|
||||
For example, initVulkan and vkSemaphore are not defined unless the Vulkan backend is compiled
|
||||
into Skia.
|
||||
|
||||
|
||||
Milestone 97
|
||||
------------
|
||||
* Added basic support for vulkan DRM modifiers. All of these are treated as read only textures
|
||||
@ -14,11 +26,8 @@ Milestone 97
|
||||
MakeFromYUVAPixmaps, MakePromiseTexture, MakePromiseYUVATexture, MakeBackendTextureFromSkImage,
|
||||
flush, flushAndSubmit, getBackendTexture, makeTextureImage.
|
||||
These were all no-ops anyway when just the CPU backend was compiled in.
|
||||
* The following functions and methods are not defined in SkSurface when SK_SUPPORT_GPU is 0:
|
||||
MakeFromBackendTexture, MakeFromBackendRenderTarget, MakeRenderTarget,
|
||||
getBackendTexture, getBackendRenderTarget, replaceBackendTexture. flush() with parameters
|
||||
was removed as well. These were all no-ops anyway when just the CPU backend was compiled in
|
||||
(noting that flush() and flushAndSubmit() are still no-ops on the CPU backend).
|
||||
|
||||
* * *
|
||||
|
||||
Milestone 96
|
||||
------------
|
||||
|
@ -11,8 +11,15 @@
|
||||
#include "include/gpu/GrTypes.h"
|
||||
|
||||
#include "include/gpu/gl/GrGLTypes.h"
|
||||
|
||||
#ifdef SK_METAL
|
||||
#include "include/gpu/mtl/GrMtlTypes.h"
|
||||
#endif
|
||||
|
||||
#ifdef SK_VULKAN
|
||||
#include "include/gpu/vk/GrVkTypes.h"
|
||||
#endif
|
||||
|
||||
#ifdef SK_DIRECT3D
|
||||
#include "include/private/GrD3DTypesMinimal.h"
|
||||
#endif
|
||||
@ -23,7 +30,7 @@
|
||||
class GrBackendSemaphore {
|
||||
public:
|
||||
// For convenience we just set the backend here to OpenGL. The GrBackendSemaphore cannot be used
|
||||
// until either initGL or initVulkan are called which will set the appropriate GrBackend.
|
||||
// until either init* is called, which will set the appropriate GrBackend.
|
||||
GrBackendSemaphore()
|
||||
: fBackend(GrBackendApi::kOpenGL), fGLSync(nullptr), fIsInitialized(false) {}
|
||||
|
||||
@ -41,29 +48,49 @@ public:
|
||||
fIsInitialized = true;
|
||||
}
|
||||
|
||||
#ifdef SK_VULKAN
|
||||
void initVulkan(VkSemaphore semaphore) {
|
||||
fBackend = GrBackendApi::kVulkan;
|
||||
fVkSemaphore = semaphore;
|
||||
#ifdef SK_VULKAN
|
||||
|
||||
fIsInitialized = true;
|
||||
#else
|
||||
fIsInitialized = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
VkSemaphore vkSemaphore() const {
|
||||
if (!fIsInitialized || GrBackendApi::kVulkan != fBackend) {
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
return fVkSemaphore;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_METAL
|
||||
// It is the creator's responsibility to ref the MTLEvent passed in here, via __bridge_retained.
|
||||
// The other end will wrap this BackendSemaphore and take the ref, via __bridge_transfer.
|
||||
void initMetal(GrMTLHandle event, uint64_t value) {
|
||||
fBackend = GrBackendApi::kMetal;
|
||||
fMtlEvent = event;
|
||||
fMtlValue = value;
|
||||
#ifdef SK_METAL
|
||||
|
||||
fIsInitialized = true;
|
||||
#else
|
||||
fIsInitialized = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
GrMTLHandle mtlSemaphore() const {
|
||||
if (!fIsInitialized || GrBackendApi::kMetal != fBackend) {
|
||||
return nullptr;
|
||||
}
|
||||
return fMtlEvent;
|
||||
}
|
||||
|
||||
uint64_t mtlValue() const {
|
||||
if (!fIsInitialized || GrBackendApi::kMetal != fBackend) {
|
||||
return 0;
|
||||
}
|
||||
return fMtlValue;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SK_DIRECT3D
|
||||
void initDirect3D(const GrD3DFenceInfo& info) {
|
||||
fBackend = GrBackendApi::kDirect3D;
|
||||
@ -81,26 +108,6 @@ public:
|
||||
return fGLSync;
|
||||
}
|
||||
|
||||
VkSemaphore vkSemaphore() const {
|
||||
if (!fIsInitialized || GrBackendApi::kVulkan != fBackend) {
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
return fVkSemaphore;
|
||||
}
|
||||
|
||||
GrMTLHandle mtlSemaphore() const {
|
||||
if (!fIsInitialized || GrBackendApi::kMetal != fBackend) {
|
||||
return nullptr;
|
||||
}
|
||||
return fMtlEvent;
|
||||
}
|
||||
|
||||
uint64_t mtlValue() const {
|
||||
if (!fIsInitialized || GrBackendApi::kMetal != fBackend) {
|
||||
return 0;
|
||||
}
|
||||
return fMtlValue;
|
||||
}
|
||||
|
||||
#ifdef SK_DIRECT3D
|
||||
bool getD3DFenceInfo(GrD3DFenceInfo* outInfo) const;
|
||||
@ -114,13 +121,19 @@ private:
|
||||
GrBackendApi fBackend;
|
||||
union {
|
||||
GrGLsync fGLSync;
|
||||
#ifdef SK_VULKAN
|
||||
VkSemaphore fVkSemaphore;
|
||||
#endif
|
||||
#ifdef SK_METAL
|
||||
GrMTLHandle fMtlEvent; // Expected to be an id<MTLEvent>
|
||||
#endif
|
||||
#ifdef SK_DIRECT3D
|
||||
GrD3DFenceInfo* fD3DFenceInfo;
|
||||
#endif
|
||||
};
|
||||
#ifdef SK_METAL
|
||||
uint64_t fMtlValue;
|
||||
#endif
|
||||
bool fIsInitialized;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user