aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-06-13 22:16:08 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-13 22:16:19 +0000
commitfad9e3f54112ea8c8bb6bb72384f47b9759578f5 (patch)
treeb4a713dabc9aaa76149222a5816a35d7f3fa5417
parent4f8c695736c8ae4fed2190a8e1301a4f4a979898 (diff)
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>
-rw-r--r--BUILD.gn14
-rwxr-xr-xgn/find_headers.py6
-rw-r--r--include/gpu/GrBackendSurface.h47
-rw-r--r--include/gpu/vk/GrVkDefines.h4
-rw-r--r--src/gpu/GrBackendSurface.cpp24
-rw-r--r--src/gpu/GrBackendTextureImageGenerator.cpp11
-rw-r--r--src/image/SkImage_Gpu.cpp12
-rw-r--r--tools/gpu/GrTest.cpp11
8 files changed, 58 insertions, 71 deletions
diff --git a/BUILD.gn b/BUILD.gn
index e3f87bce65..bb355c67c2 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -55,14 +55,17 @@ 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"
}
}
@@ -88,10 +91,6 @@ 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
@@ -749,7 +748,8 @@ 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(skia_public_includes) +
+ [ rebase_path("third_party/vulkan") ]
depfile = "$skia_h.deps"
outputs = [
skia_h,
diff --git a/gn/find_headers.py b/gn/find_headers.py
index 1baca2fab4..8cff31d697 100755
--- a/gn/find_headers.py
+++ b/gn/find_headers.py
@@ -24,10 +24,10 @@ blacklist = {
headers = []
for directory in include_dirs:
- for f in os.listdir(directory):
- if os.path.isfile(os.path.join(directory, f)):
+ for d, _, files in os.walk(directory):
+ for f in files:
if f.endswith('.h') and f not in blacklist:
- headers.append(os.path.join(directory,f))
+ headers.append(os.path.join(d,f))
headers.sort()
with open(skia_h, "w") as f:
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h
index 60a9eb5009..232f220282 100644
--- a/include/gpu/GrBackendSurface.h
+++ b/include/gpu/GrBackendSurface.h
@@ -10,38 +10,31 @@
#include "GrTypes.h"
#include "gl/GrGLTypes.h"
-
-#ifdef SK_VULKAN
#include "vk/GrVkTypes.h"
-#endif
class GrBackendTexture {
public:
GrBackendTexture(int width,
int height,
- GrPixelConfig config,
- const GrGLTextureInfo& glInfo);
+ const GrVkImageInfo& vkInfo);
-#ifdef SK_VULKAN
GrBackendTexture(int width,
int height,
- const GrVkImageInfo& vkInfo);
-#endif
+ GrPixelConfig config,
+ const GrGLTextureInfo& glInfo);
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 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
+
+ // If the backend API is GL, this returns a pointer to the GrGLTextureInfo struct. Otherwise
+ // it returns nullptr.
+ const GrGLTextureInfo* getGLTextureInfo() const;
private:
// Temporary constructor which can be used to convert from a GrBackendTextureDesc.
@@ -57,10 +50,8 @@ private:
GrBackend fBackend;
union {
- GrGLTextureInfo fGLInfo;
-#ifdef SK_VULKAN
GrVkImageInfo fVkInfo;
-#endif
+ GrGLTextureInfo fGLInfo;
};
};
@@ -70,16 +61,14 @@ public:
int height,
int sampleCnt,
int stencilBits,
- GrPixelConfig config,
- const GrGLFramebufferInfo& glInfo);
+ const GrVkImageInfo& vkInfo);
-#ifdef SK_VULKAN
GrBackendRenderTarget(int width,
int height,
int sampleCnt,
int stencilBits,
- const GrVkImageInfo& vkInfo);
-#endif
+ GrPixelConfig config,
+ const GrGLFramebufferInfo& glInfo);
int width() const { return fWidth; }
int height() const { return fHeight; }
@@ -88,15 +77,13 @@ public:
GrPixelConfig config() const { return fConfig; }
GrBackend backend() const {return fBackend; }
- // 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
+
+ // If the backend API is GL, this returns a pointer to the GrGLFramebufferInfo struct. Otherwise
+ // it returns nullptr.
+ const GrGLFramebufferInfo* getGLFramebufferInfo() const;
private:
// Temporary constructor which can be used to convert from a GrBackendRenderTargetDesc.
@@ -115,10 +102,8 @@ private:
GrBackend fBackend;
union {
- GrGLFramebufferInfo fGLInfo;
-#ifdef SK_VULKAN
GrVkImageInfo fVkInfo;
-#endif
+ GrGLFramebufferInfo fGLInfo;
};
};
diff --git a/include/gpu/vk/GrVkDefines.h b/include/gpu/vk/GrVkDefines.h
index 0bc6fb0343..7defed2ad5 100644
--- a/include/gpu/vk/GrVkDefines.h
+++ b/include/gpu/vk/GrVkDefines.h
@@ -31,6 +31,8 @@
# endif
#endif
+#endif
+
#include <vulkan/vulkan.h>
#define SKIA_REQUIRED_VULKAN_HEADER_VERSION 17
@@ -39,5 +41,3 @@
#endif
#endif
-
-#endif
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index 6c715228b2..63044759d4 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -12,16 +12,20 @@
#include "vk/GrVkUtil.h"
#endif
-#ifdef SK_VULKAN
GrBackendTexture::GrBackendTexture(int width,
int height,
const GrVkImageInfo& vkInfo)
: fWidth(width)
, fHeight(height)
- , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat))
+ , fConfig(
+#ifdef SK_VULKAN
+ GrVkFormatToPixelConfig(vkInfo.fFormat)
+#else
+ kUnknown_GrPixelConfig
+#endif
+ )
, fBackend(kVulkan_GrBackend)
, fVkInfo(vkInfo) {}
-#endif
GrBackendTexture::GrBackendTexture(int width,
int height,
@@ -53,14 +57,12 @@ 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) {
@@ -71,7 +73,6 @@ const GrGLTextureInfo* GrBackendTexture::getGLTextureInfo() const {
////////////////////////////////////////////////////////////////////////////////////////////////////
-#ifdef SK_VULKAN
GrBackendRenderTarget::GrBackendRenderTarget(int width,
int height,
int sampleCnt,
@@ -81,10 +82,15 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width,
, fHeight(height)
, fSampleCnt(sampleCnt)
, fStencilBits(stencilBits)
- , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat))
+ , fConfig(
+#ifdef SK_VULKAN
+ GrVkFormatToPixelConfig(vkInfo.fFormat)
+#else
+ kUnknown_GrPixelConfig
+#endif
+ )
, fBackend(kVulkan_GrBackend)
, fVkInfo(vkInfo) {}
-#endif
GrBackendRenderTarget::GrBackendRenderTarget(int width,
int height,
@@ -123,14 +129,12 @@ 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 c7e77d65a5..8446489c70 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -33,15 +33,14 @@ static GrBackendTexture make_backend_texture_from_handle(GrBackend backend,
int width, int height,
GrPixelConfig config,
GrBackendObject handle) {
-#if SK_VULKAN
- if (kVulkan_GrBackend == backend) {
+ if (kOpenGL_GrBackend == backend) {
+ GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
+ return GrBackendTexture(width, height, config, *glInfo);
+ } else {
+ SkASSERT(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 57b8b7f592..002e966da5 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 SK_VULKAN
- if (kVulkan_GrBackend == backend) {
+
+ if (kOpenGL_GrBackend == backend) {
+ GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
+ return GrBackendTexture(width, height, config, *glInfo);
+ } else {
+ SkASSERT(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 f486993bbc..5a9fc9690e 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -61,15 +61,14 @@ void SetupAlwaysEvictAtlas(GrContext* context) {
GrBackendTexture CreateBackendTexture(GrBackend backend, int width, int height,
GrPixelConfig config, GrBackendObject handle) {
-#if SK_VULKAN
- if (kVulkan_GrBackend == backend) {
+ if (kOpenGL_GrBackend == backend) {
+ GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
+ return GrBackendTexture(width, height, config, *glInfo);
+ } else {
+ SkASSERT(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);
}
};