diff options
author | Robert Phillips <robertphillips@google.com> | 2017-06-14 01:43:29 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-14 01:43:38 +0000 |
commit | fcd5fddb0264d062a461435618ad54a29ff80fc0 (patch) | |
tree | 3fdf24eff4b5aac832b4aec30ffd1754bbcc7263 | |
parent | 9647637f780d61535ac4daa1ff681d2a71b9620d (diff) |
Revert "Revert "Update skia to use ifdefs for Vulkan code instead of dummy header""
This reverts commit fad9e3f54112ea8c8bb6bb72384f47b9759578f5.
Reason for revert: Can't find the error message anymore (?!?) Let's try again shall we
Original change's description:
> Revert "Update skia to use ifdefs for Vulkan code instead of dummy header"
>
> This reverts commit c0f8e426c59eec6c720b8e1329dcb966cf1b6800.
>
> Reason for revert: Experiment to see if this will unblock the Android roll
>
> Original change's description:
> > Update skia to use ifdefs for Vulkan code instead of dummy header
> >
> > Bug: skia:6721
> > Change-Id: I80a4c9f2acc09c174497f625c50ed12a8bb76505
> > Reviewed-on: https://skia-review.googlesource.com/19547
> > Reviewed-by: Mike Klein <mtklein@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,mtklein@google.com,bsalomon@google.com
>
> Change-Id: Ib51c1672570f2071a17b6fbde692a5174b0358ce
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:6721
> Reviewed-on: https://skia-review.googlesource.com/19724
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,mtklein@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Iecef7ddcfe31d82938336120a4193525ac6693be
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6721
Reviewed-on: https://skia-review.googlesource.com/19782
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r-- | BUILD.gn | 14 | ||||
-rwxr-xr-x | gn/find_headers.py | 6 | ||||
-rw-r--r-- | include/gpu/GrBackendSurface.h | 47 | ||||
-rw-r--r-- | include/gpu/vk/GrVkDefines.h | 4 | ||||
-rw-r--r-- | src/gpu/GrBackendSurface.cpp | 24 | ||||
-rw-r--r-- | src/gpu/GrBackendTextureImageGenerator.cpp | 11 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 12 | ||||
-rw-r--r-- | tools/gpu/GrTest.cpp | 11 |
8 files changed, 71 insertions, 58 deletions
@@ -55,17 +55,14 @@ declare_args() { } } declare_args() { + skia_vulkan_headers = "" if (skia_use_vulkan) { + # When buliding on Android we get the header via the NDK so no need for any extra path. if (is_fuchsia) { skia_vulkan_headers = "$fuchsia_vulkan_sdk/include" } else if (is_linux || is_win) { skia_vulkan_headers = "$skia_vulkan_sdk/include" - } else { - # When buliding on Android we get the header via the NDK - skia_vulkan_headers = "" } - } else { - skia_vulkan_headers = "third_party/vulkan" } } @@ -91,6 +88,10 @@ skia_public_includes = [ "include/utils/mac", ] +if (skia_use_vulkan) { + skia_public_includes += [ "include/gpu/vk" ] +} + # Skia public API, generally provided by :skia. config("skia_public") { include_dirs = skia_public_includes @@ -748,8 +749,7 @@ if (skia_enable_tools) { skia_h = "$target_gen_dir/skia.h" script = "gn/find_headers.py" args = [ rebase_path(skia_h, root_build_dir) ] + - rebase_path(skia_public_includes) + - [ rebase_path("third_party/vulkan") ] + rebase_path(skia_public_includes) depfile = "$skia_h.deps" outputs = [ skia_h, diff --git a/gn/find_headers.py b/gn/find_headers.py index 8cff31d697..1baca2fab4 100755 --- a/gn/find_headers.py +++ b/gn/find_headers.py @@ -24,10 +24,10 @@ blacklist = { headers = [] for directory in include_dirs: - for d, _, files in os.walk(directory): - for f in files: + for f in os.listdir(directory): + if os.path.isfile(os.path.join(directory, f)): if f.endswith('.h') and f not in blacklist: - headers.append(os.path.join(d,f)) + headers.append(os.path.join(directory,f)) headers.sort() with open(skia_h, "w") as f: diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index 232f220282..60a9eb5009 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -10,32 +10,39 @@ #include "GrTypes.h" #include "gl/GrGLTypes.h" + +#ifdef SK_VULKAN #include "vk/GrVkTypes.h" +#endif class GrBackendTexture { public: GrBackendTexture(int width, int height, - const GrVkImageInfo& vkInfo); + GrPixelConfig config, + const GrGLTextureInfo& glInfo); +#ifdef SK_VULKAN GrBackendTexture(int width, int height, - GrPixelConfig config, - const GrGLTextureInfo& glInfo); + const GrVkImageInfo& vkInfo); +#endif int width() const { return fWidth; } int height() const { return fHeight; } GrPixelConfig config() const { return fConfig; } GrBackend backend() const {return fBackend; } - // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise - // it returns nullptr. - const GrVkImageInfo* getVkImageInfo() const; - // If the backend API is GL, this returns a pointer to the GrGLTextureInfo struct. Otherwise // it returns nullptr. const GrGLTextureInfo* getGLTextureInfo() const; +#ifdef SK_VULKAN + // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise + // it returns nullptr. + const GrVkImageInfo* getVkImageInfo() const; +#endif + private: // Temporary constructor which can be used to convert from a GrBackendTextureDesc. GrBackendTexture(const GrBackendTextureDesc& desc, GrBackend backend); @@ -50,8 +57,10 @@ private: GrBackend fBackend; union { - GrVkImageInfo fVkInfo; GrGLTextureInfo fGLInfo; +#ifdef SK_VULKAN + GrVkImageInfo fVkInfo; +#endif }; }; @@ -61,14 +70,16 @@ public: int height, int sampleCnt, int stencilBits, - const GrVkImageInfo& vkInfo); + GrPixelConfig config, + const GrGLFramebufferInfo& glInfo); +#ifdef SK_VULKAN GrBackendRenderTarget(int width, int height, int sampleCnt, int stencilBits, - GrPixelConfig config, - const GrGLFramebufferInfo& glInfo); + const GrVkImageInfo& vkInfo); +#endif int width() const { return fWidth; } int height() const { return fHeight; } @@ -77,14 +88,16 @@ public: GrPixelConfig config() const { return fConfig; } GrBackend backend() const {return fBackend; } - // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise - // it returns nullptr - const GrVkImageInfo* getVkImageInfo() const; - // If the backend API is GL, this returns a pointer to the GrGLFramebufferInfo struct. Otherwise // it returns nullptr. const GrGLFramebufferInfo* getGLFramebufferInfo() const; +#ifdef SK_VULKAN + // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise + // it returns nullptr + const GrVkImageInfo* getVkImageInfo() const; +#endif + private: // Temporary constructor which can be used to convert from a GrBackendRenderTargetDesc. GrBackendRenderTarget(const GrBackendRenderTargetDesc& desc, GrBackend backend); @@ -102,8 +115,10 @@ private: GrBackend fBackend; union { - GrVkImageInfo fVkInfo; GrGLFramebufferInfo fGLInfo; +#ifdef SK_VULKAN + GrVkImageInfo fVkInfo; +#endif }; }; diff --git a/include/gpu/vk/GrVkDefines.h b/include/gpu/vk/GrVkDefines.h index 7defed2ad5..0bc6fb0343 100644 --- a/include/gpu/vk/GrVkDefines.h +++ b/include/gpu/vk/GrVkDefines.h @@ -31,8 +31,6 @@ # endif #endif -#endif - #include <vulkan/vulkan.h> #define SKIA_REQUIRED_VULKAN_HEADER_VERSION 17 @@ -41,3 +39,5 @@ #endif #endif + +#endif diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp index 63044759d4..6c715228b2 100644 --- a/src/gpu/GrBackendSurface.cpp +++ b/src/gpu/GrBackendSurface.cpp @@ -12,20 +12,16 @@ #include "vk/GrVkUtil.h" #endif +#ifdef SK_VULKAN GrBackendTexture::GrBackendTexture(int width, int height, const GrVkImageInfo& vkInfo) : fWidth(width) , fHeight(height) - , fConfig( -#ifdef SK_VULKAN - GrVkFormatToPixelConfig(vkInfo.fFormat) -#else - kUnknown_GrPixelConfig -#endif - ) + , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat)) , fBackend(kVulkan_GrBackend) , fVkInfo(vkInfo) {} +#endif GrBackendTexture::GrBackendTexture(int width, int height, @@ -57,12 +53,14 @@ GrBackendTexture::GrBackendTexture(const GrBackendTextureDesc& desc, GrBackend b } } +#ifdef SK_VULKAN const GrVkImageInfo* GrBackendTexture::getVkImageInfo() const { if (kVulkan_GrBackend == fBackend) { return &fVkInfo; } return nullptr; } +#endif const GrGLTextureInfo* GrBackendTexture::getGLTextureInfo() const { if (kOpenGL_GrBackend == fBackend) { @@ -73,6 +71,7 @@ const GrGLTextureInfo* GrBackendTexture::getGLTextureInfo() const { //////////////////////////////////////////////////////////////////////////////////////////////////// +#ifdef SK_VULKAN GrBackendRenderTarget::GrBackendRenderTarget(int width, int height, int sampleCnt, @@ -82,15 +81,10 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , fHeight(height) , fSampleCnt(sampleCnt) , fStencilBits(stencilBits) - , fConfig( -#ifdef SK_VULKAN - GrVkFormatToPixelConfig(vkInfo.fFormat) -#else - kUnknown_GrPixelConfig -#endif - ) + , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat)) , fBackend(kVulkan_GrBackend) , fVkInfo(vkInfo) {} +#endif GrBackendRenderTarget::GrBackendRenderTarget(int width, int height, @@ -129,12 +123,14 @@ GrBackendRenderTarget::GrBackendRenderTarget(const GrBackendRenderTargetDesc& de } } +#ifdef SK_VULKAN const GrVkImageInfo* GrBackendRenderTarget::getVkImageInfo() const { if (kVulkan_GrBackend == fBackend) { return &fVkInfo; } return nullptr; } +#endif const GrGLFramebufferInfo* GrBackendRenderTarget::getGLFramebufferInfo() const { if (kOpenGL_GrBackend == fBackend) { diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp index 8446489c70..c7e77d65a5 100644 --- a/src/gpu/GrBackendTextureImageGenerator.cpp +++ b/src/gpu/GrBackendTextureImageGenerator.cpp @@ -33,14 +33,15 @@ static GrBackendTexture make_backend_texture_from_handle(GrBackend backend, int width, int height, GrPixelConfig config, GrBackendObject handle) { - if (kOpenGL_GrBackend == backend) { - GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle); - return GrBackendTexture(width, height, config, *glInfo); - } else { - SkASSERT(kVulkan_GrBackend == backend); +#if SK_VULKAN + if (kVulkan_GrBackend == backend) { GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle); return GrBackendTexture(width, height, *vkInfo); } +#endif + SkASSERT(kOpenGL_GrBackend == backend); + GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle); + return GrBackendTexture(width, height, config, *glInfo); } std::unique_ptr<SkImageGenerator> diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 002e966da5..57b8b7f592 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -325,15 +325,15 @@ static GrBackendTexture make_backend_texture_from_handle(GrBackend backend, int width, int height, GrPixelConfig config, GrBackendObject handle) { - - if (kOpenGL_GrBackend == backend) { - GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle); - return GrBackendTexture(width, height, config, *glInfo); - } else { - SkASSERT(kVulkan_GrBackend == backend); +#if SK_VULKAN + if (kVulkan_GrBackend == backend) { GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle); return GrBackendTexture(width, height, *vkInfo); } +#endif + SkASSERT(kOpenGL_GrBackend == backend); + GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle); + return GrBackendTexture(width, height, config, *glInfo); } static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpace colorSpace, diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 5a9fc9690e..f486993bbc 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -61,14 +61,15 @@ void SetupAlwaysEvictAtlas(GrContext* context) { GrBackendTexture CreateBackendTexture(GrBackend backend, int width, int height, GrPixelConfig config, GrBackendObject handle) { - if (kOpenGL_GrBackend == backend) { - GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle); - return GrBackendTexture(width, height, config, *glInfo); - } else { - SkASSERT(kVulkan_GrBackend == backend); +#if SK_VULKAN + if (kVulkan_GrBackend == backend) { GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle); return GrBackendTexture(width, height, *vkInfo); } +#endif + SkASSERT(kOpenGL_GrBackend == backend); + GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle); + return GrBackendTexture(width, height, config, *glInfo); } }; |