From 4382330a15e13b9ef54010606eb758c0c66e1868 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 25 Sep 2013 20:57:51 +0000 Subject: [PATCH] Replace GR_*_BUILD by their SK_BUILD_FOR_* equivalents. BUG=None TEST=None, no functional changes. R=bsalomon@google.com, robertphillips@google.com Author: tfarina@chromium.org Review URL: https://chromiumcodereview.appspot.com/24253009 git-svn-id: http://skia.googlecode.com/svn/trunk@11457 2bbb7eff-a529-9590-31e7-b0007b416f81 --- Makefile.old | 2 +- gyp/gpu.gyp | 46 ------------------- include/gpu/GrConfig.h | 92 +------------------------------------- include/gpu/gl/GrGLConfig.h | 2 +- include/gpu/gl/GrGLConfig_chrome.h | 12 +++-- src/gpu/GrContext.cpp | 2 +- src/gpu/gl/GrGpuGL.cpp | 8 ++-- 7 files changed, 18 insertions(+), 146 deletions(-) diff --git a/Makefile.old b/Makefile.old index 47029c4..cd5a9e8 100644 --- a/Makefile.old +++ b/Makefile.old @@ -132,7 +132,7 @@ ifeq ($(SKIA_BUILD_FOR),mac) else LINKER_OPTS += -lpng -lfreetype -lrt - DEFINES += -DSK_BUILD_FOR_UNIX -DSK_ENABLE_LIBPNG -DGR_LINUX_BUILD=1 + DEFINES += -DSK_BUILD_FOR_UNIX -DSK_ENABLE_LIBPNG ifeq ($(SKIA_MESA),true) LINKER_OPTS += -lOSMesa -lGLU DEFINES += -DSK_MESA diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp index 7e74bad..cb39c59 100644 --- a/gyp/gpu.gyp +++ b/gyp/gpu.gyp @@ -25,31 +25,6 @@ 'sources/': [ ['exclude', '_nacl.(h|cpp)$'], ], }], - [ 'skia_os == "android"', { - 'defines': [ - 'GR_ANDROID_BUILD=1', - ], - }], - [ 'skia_os == "mac"', { - 'defines': [ - 'GR_MAC_BUILD=1', - ], - }], - [ 'skia_os == "linux" or skia_os == "chromeos"', { - 'defines': [ - 'GR_LINUX_BUILD=1', - ], - }], - [ 'skia_os == "ios"', { - 'defines': [ - 'GR_IOS_BUILD=1', - ], - }], - [ 'skia_os == "win"', { - 'defines': [ - 'GR_WIN32_BUILD=1', - ], - }], # nullify the targets in this gyp file if skia_gpu is 0 [ 'skia_gpu == 0', { 'sources/': [ @@ -83,29 +58,8 @@ ], 'direct_dependent_settings': { 'conditions': [ - [ 'skia_os == "android"', { - 'defines': [ - 'GR_ANDROID_BUILD=1', - ], - }], - [ 'skia_os == "mac"', { - 'defines': [ - 'GR_MAC_BUILD=1', - ], - }], - [ 'skia_os == "linux"', { - 'defines': [ - 'GR_LINUX_BUILD=1', - ], - }], - [ 'skia_os == "ios"', { - 'defines': [ - 'GR_IOS_BUILD=1', - ], - }], [ 'skia_os == "win"', { 'defines': [ - 'GR_WIN32_BUILD=1', 'GR_GL_FUNCTION_TYPE=__stdcall', ], }], diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h index e3fa1a4..29c483f 100644 --- a/include/gpu/GrConfig.h +++ b/include/gpu/GrConfig.h @@ -32,63 +32,14 @@ * Gr defines are set to 0 or 1, rather than being undefined or defined */ -#if !defined(GR_ANDROID_BUILD) - #define GR_ANDROID_BUILD 0 -#endif -#if !defined(GR_IOS_BUILD) - #define GR_IOS_BUILD 0 -#endif -#if !defined(GR_LINUX_BUILD) - #define GR_LINUX_BUILD 0 -#endif -#if !defined(GR_MAC_BUILD) - #define GR_MAC_BUILD 0 -#endif -#if !defined(GR_WIN32_BUILD) - #define GR_WIN32_BUILD 0 -#endif -#if !defined(GR_QNX_BUILD) - #define GR_QNX_BUILD 0 -#endif #if !defined(GR_CACHE_STATS) #define GR_CACHE_STATS 0 #endif -/** - * If no build target has been defined, attempt to infer. - */ -#if !GR_ANDROID_BUILD && !GR_IOS_BUILD && !GR_LINUX_BUILD && !GR_MAC_BUILD && !GR_WIN32_BUILD && !GR_QNX_BUILD - #if defined(_WIN32) - #undef GR_WIN32_BUILD - #define GR_WIN32_BUILD 1 -// #error "WIN" - #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR - #undef GR_IOS_BUILD - #define GR_IOS_BUILD 1 -// #error "IOS" - #elif defined(SK_BUILD_FOR_ANDROID) - #undef GR_ANDROID_BUILD - #define GR_ANDROID_BUILD 1 -// #error "ANDROID" - #elif TARGET_OS_MAC - #undef GR_MAC_BUILD - #define GR_MAC_BUILD 1 -// #error "MAC" - #elif TARGET_OS_QNX || defined(__QNXNTO__) - #undef GR_QNX_BUILD - #define GR_QNX_BUILD 1 -// #error "QNX" - #else - #undef GR_LINUX_BUILD - #define GR_LINUX_BUILD 1 -// #error "LINUX" - #endif -#endif - /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -#if GR_WIN32_BUILD +#if defined(SK_BUILD_FOR_WIN32) // VC8 doesn't support stdint.h, so we define those types here. typedef signed char int8_t; typedef unsigned char uint8_t; @@ -176,7 +127,7 @@ typedef unsigned __int64 uint64_t; * GR_ALWAYSBREAK is an unconditional break in all builds. */ #if !defined(GR_ALWAYSBREAK) - #if GR_WIN32_BUILD + #if defined(SK_BUILD_FOR_WIN32) #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); __debugbreak() #else // TODO: do other platforms really not have continuable breakpoints? @@ -281,43 +232,4 @@ inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); } #define GR_STROKE_PATH_RENDERING 0 #endif -/////////////////////////////////////////////////////////////////////////////// -// tail section: -// -// Now we just assert if we are missing some required define, or if we detect -// and inconsistent combination of defines -// - - -/** - * Only one build target macro should be 1 and the rest should be 0. - */ -#define GR_BUILD_SUM (GR_WIN32_BUILD + GR_MAC_BUILD + GR_IOS_BUILD + GR_ANDROID_BUILD + GR_LINUX_BUILD + GR_QNX_BUILD) -#if 0 == GR_BUILD_SUM - #error "Missing a GR_BUILD define" -#elif 1 != GR_BUILD_SUM - #error "More than one GR_BUILD defined" -#endif - -#if 0 -#if GR_WIN32_BUILD -// #pragma message GR_WARN("GR_WIN32_BUILD") -#endif -#if GR_MAC_BUILD -// #pragma message GR_WARN("GR_MAC_BUILD") -#endif -#if GR_IOS_BUILD -// #pragma message GR_WARN("GR_IOS_BUILD") -#endif -#if GR_ANDROID_BUILD -// #pragma message GR_WARN("GR_ANDROID_BUILD") -#endif -#if GR_LINUX_BUILD -// #pragma message GR_WARN("GR_LINUX_BUILD") -#endif -#if GR_QNX_BUILD -// #pragma message GR_WARN("GR_QNX_BUILD") -#endif -#endif - #endif diff --git a/include/gpu/gl/GrGLConfig.h b/include/gpu/gl/GrGLConfig.h index 0da2c0b..490ad0a 100644 --- a/include/gpu/gl/GrGLConfig.h +++ b/include/gpu/gl/GrGLConfig.h @@ -205,7 +205,7 @@ * OS/driver level fix. */ #define GR_GL_MAC_BUFFER_OBJECT_PERFOMANCE_WORKAROUND \ - (GR_MAC_BUILD && \ + (defined(SK_BUILD_FOR_MAC) && \ !GR_GL_USE_BUFFER_DATA_NULL_HINT) #endif diff --git a/include/gpu/gl/GrGLConfig_chrome.h b/include/gpu/gl/GrGLConfig_chrome.h index fe35783..acad904 100644 --- a/include/gpu/gl/GrGLConfig_chrome.h +++ b/include/gpu/gl/GrGLConfig_chrome.h @@ -11,14 +11,20 @@ // glGetError() forces a sync with gpu process on chrome #define GR_GL_CHECK_ERROR_START 0 +#if defined(SK_BUILD_FOR_WIN32) // ANGLE creates a temp VB for vertex attributes not specified per-vertex. -#define GR_GL_NO_CONSTANT_ATTRIBUTES GR_WIN32_BUILD +#define GR_GL_NO_CONSTANT_ATTRIBUTES 1 // For RGBA teximage/readpixels ANGLE will sw-convert to/from BGRA. -#define GR_GL_RGBA_8888_PIXEL_OPS_SLOW GR_WIN32_BUILD +#define GR_GL_RGBA_8888_PIXEL_OPS_SLOW 1 // ANGLE can go faster if the entire fbo is read rather than a subrect -#define GR_GL_FULL_READPIXELS_FASTER_THAN_PARTIAL GR_WIN32_BUILD +#define GR_GL_FULL_READPIXELS_FASTER_THAN_PARTIAL 1 +#else +#define GR_GL_NO_CONSTANT_ATTRIBUTES 0 +#define GR_GL_RGBA_8888_PIXEL_OPS_SLOW 0 +#define GR_GL_FULL_READPIXELS_FASTER_THAN_PARTIAL 0 +#endif // cmd buffer allocates memory and memsets it to zero when it sees glBufferData // with NULL. diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index e62aa5d..9dfe761 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -1487,7 +1487,7 @@ bool GrContext::writeRenderTargetPixels(GrRenderTarget* target, // We expect to be at least as fast or faster since it doesn't use an intermediate texture as // we do below. -#if !GR_MAC_BUILD +#if !defined(SK_BUILD_FOR_MAC) // At least some drivers on the Mac get confused when glTexImage2D is called on a texture // attached to an FBO. The FBO still sees the old image. TODO: determine what OS versions and/or // HW is affected. diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 6f9a8ab..d1a7167 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -1604,9 +1604,9 @@ GrGLenum gPrimitiveType2GLMode[] = { #define SWAP_PER_DRAW 0 #if SWAP_PER_DRAW - #if GR_MAC_BUILD + #if defined(SK_BUILD_FOR_MAC) #include - #elif GR_WIN32_BUILD + #elif defined(SK_BUILD_FOR_WIN32) #include void SwapBuf() { DWORD procID = GetCurrentProcessId(); @@ -1645,11 +1645,11 @@ void GrGpuGL::onGpuDraw(const DrawInfo& info) { } #if SWAP_PER_DRAW glFlush(); - #if GR_MAC_BUILD + #if defined(SK_BUILD_FOR_MAC) aglSwapBuffers(aglGetCurrentContext()); int set_a_break_pt_here = 9; aglSwapBuffers(aglGetCurrentContext()); - #elif GR_WIN32_BUILD + #elif defined(SK_BUILD_FOR_WIN32) SwapBuf(); int set_a_break_pt_here = 9; SwapBuf(); -- 2.7.4