Enable viewer in non-Vulkan builds

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2067023002

Review-Url: https://codereview.chromium.org/2067023002
This commit is contained in:
jvanverth 2016-06-15 13:44:15 -07:00 committed by Commit bot
parent f848c9c456
commit 746b792a9a
9 changed files with 27 additions and 10 deletions

View File

@ -27,7 +27,6 @@
'pathops_skpclip.gyp:*',
'dm.gyp:dm',
'fuzz.gyp:fuzz',
'viewer.gyp:viewer',
],
'conditions': [
[ 'skia_gpu == 0', {
@ -62,8 +61,8 @@
'skiaserve.gyp:skiaserve',
],
}],
[ 'skia_vulkan == 0 or (skia_os != "win" and skia_os != "android")', {
'dependencies!': [
[ 'skia_os in ["win", "linux", "android"]', {
'dependencies': [
'viewer.gyp:viewer',
],
}],

View File

@ -79,6 +79,10 @@
'sources/': [ ['exclude', '_win.(h|cpp)$'],
],
}],
['skia_vulkan == 0', {
'sources/': [ ['exclude', 'Vulkan']
],
}],
],
},
],

View File

@ -66,7 +66,9 @@ DEFINE_bool(vulkan, true, "Run with Vulkan.");
const char *kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = {
" [OpenGL]",
#ifdef SK_VULKAN
" [Vulkan]",
#endif
" [Raster]"
};
@ -86,7 +88,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
: fCurrentMeasurement(0)
, fDisplayStats(false)
, fSplitScreen(false)
, fBackendType(sk_app::Window::kVulkan_BackendType)
, fBackendType(sk_app::Window::kNativeGL_BackendType)
, fZoomCenterX(0.0f)
, fZoomCenterY(0.0f)
, fZoomLevel(0.0f)
@ -102,9 +104,10 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
SkCommandLineFlags::Parse(argc, argv);
#ifdef SK_VULKAN
fBackendType = FLAGS_vulkan ? sk_app::Window::kVulkan_BackendType
: sk_app::Window::kNativeGL_BackendType;
#endif
fWindow = Window::CreateNativeWindow(platformData);
fWindow->attach(fBackendType, DisplayParams());

View File

@ -9,7 +9,7 @@
#include "SkSurface.h"
#include "SkCanvas.h"
#include "VulkanWindowContext.h"
#include "WindowContext.h"
namespace sk_app {

View File

@ -41,7 +41,9 @@ public:
enum BackendType {
kNativeGL_BackendType,
#ifdef SK_VULKAN
kVulkan_BackendType,
#endif
kRaster_BackendType,
kLast_BackendType = kRaster_BackendType

View File

@ -7,7 +7,9 @@
#include "Window_android.h"
#include "../GLWindowContext.h"
#ifdef SK_VULKAN
#include "../VulkanWindowContext.h"
#endif
#include "../RasterWindowContext.h"
namespace sk_app {
@ -62,15 +64,17 @@ void Window_android::initDisplay(ANativeWindow* window) {
platformData.fNativeWindow = window;
switch (fBackendType) {
case kNativeGL_BackendType:
default:
fWindowContext = GLWindowContext::Create((void*)&platformData, fDisplayParams);
break;
case kRaster_BackendType:
fWindowContext = RasterWindowContext::Create((void*)&platformData, fDisplayParams);
break;
#ifdef SK_VULKAN
case kVulkan_BackendType:
default:
fWindowContext = VulkanWindowContext::Create((void*)&platformData, fDisplayParams);
break;
#endif
}
}

View File

@ -90,7 +90,6 @@ void GLWindowContext_unix::onDestroyContext() {
void GLWindowContext_unix::onSwapBuffers() {
if (fDisplay && fGLContext) {
printf("swapping\n");
glXSwapBuffers(fDisplay, fWindow);
}
}

View File

@ -10,7 +10,9 @@
#include "SkUtils.h"
#include "Timer.h"
#include "../GLWindowContext.h"
#ifdef SK_VULKAN
#include "../VulkanWindowContext.h"
#endif
#include "Window_unix.h"
extern "C" {
@ -276,10 +278,11 @@ bool Window_unix::attach(BackendType attachType, const DisplayParams& params) {
platformData.fWindow = fWindow;
platformData.fVisualInfo = fVisualInfo;
switch (attachType) {
#ifdef SK_VULKAN
case kVulkan_BackendType:
fWindowContext = VulkanWindowContext::Create((void*)&platformData, params);
break;
#endif
case kNativeGL_BackendType:
default:
fWindowContext = GLWindowContext::Create((void*)&platformData, params);

View File

@ -13,7 +13,9 @@
#include "SkUtils.h"
#include "../GLWindowContext.h"
#ifdef SK_VULKAN
#include "../VulkanWindowContext.h"
#endif
namespace sk_app {
@ -275,10 +277,11 @@ bool Window_win::attach(BackendType attachType, const DisplayParams& params) {
default:
fWindowContext = GLWindowContext::Create((void*)&platformData, params);
break;
#ifdef SK_VULKAN
case kVulkan_BackendType:
fWindowContext = VulkanWindowContext::Create((void*)&platformData, params);
break;
#endif
}
return (SkToBool(fWindowContext));