Revert "Revert "Update skia to use ifdefs for Vulkan code instead of dummy header""
This reverts commitfad9e3f541
. 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 commitc0f8e426c5
. > > 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>
This commit is contained in:
parent
9647637f78
commit
fcd5fddb02
14
BUILD.gn
14
BUILD.gn
@ -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,
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
||||
GrBackendTexture(int width,
|
||||
int height,
|
||||
GrPixelConfig config,
|
||||
const GrGLTextureInfo& glInfo);
|
||||
|
||||
#ifdef SK_VULKAN
|
||||
GrBackendTexture(int width,
|
||||
int height,
|
||||
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
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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>
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user