diff options
author | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-06-15 19:41:46 +0000 |
---|---|---|
committer | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-06-15 19:41:46 +0000 |
commit | 30e4bb6667b030543918ff0417e1d948d9de0a3f (patch) | |
tree | 602450ee199aa3e25a48cd914cb880e30b16ef49 | |
parent | 7495ac16c96918164c1d8a2aa93437b5208e29f5 (diff) |
Avoid checking to see if a bool is less than zero.
Create a symbolic name for -1 when it means "don't know, probe at runtime".
git-svn-id: http://skia.googlecode.com/svn/trunk@1606 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | gpu/include/GrGLInterface.h | 8 | ||||
-rw-r--r-- | gpu/src/GrGpuGL.cpp | 5 | ||||
-rw-r--r-- | gpu/src/android/GrGLDefaultInterface_android.cpp | 6 | ||||
-rw-r--r-- | gpu/src/mac/GrGLDefaultInterface_mac.cpp | 2 | ||||
-rw-r--r-- | gpu/src/mesa/GrGLDefaultInterface_mesa.cpp | 2 | ||||
-rw-r--r-- | gpu/src/unix/GrGLDefaultInterface_unix.cpp | 2 | ||||
-rw-r--r-- | gpu/src/win/GrGLDefaultInterface_win.cpp | 2 |
7 files changed, 16 insertions, 11 deletions
diff --git a/gpu/include/GrGLInterface.h b/gpu/include/GrGLInterface.h index 1a3dade254..5802ec4f3b 100644 --- a/gpu/include/GrGLInterface.h +++ b/gpu/include/GrGLInterface.h @@ -205,6 +205,10 @@ extern "C" { typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFragDataLocationIndexedProc)(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar * name); } // extern "C" +enum GrGLBug { + kProbe_GrGLBug = -1 +}; + /* * The following interface exports the OpenGL entry points used by the system. * Use of OpenGL calls is disallowed. All calls should be invoked through @@ -222,12 +226,12 @@ struct GrGLInterface { GrGLBinding fBindingsExported; /// Does this GL support NPOT textures on FBOs? - /// boolean value, or -1 to probe (slowly) at context creation. + /// boolean value, or kProbe_GrGLBug to probe (slowly) at context creation. int fNPOTRenderTargetSupport; /// Some GL implementations (PowerVR SGX devices like the iPhone 4) /// have restrictions on the size of small render targets. - /// -1 to probe (slowly) at context creation. + /// kProbe_GrGLBug to probe (slowly) at context creation. int fMinRenderTargetHeight; int fMinRenderTargetWidth; diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp index 177ddb105c..973e1e4a53 100644 --- a/gpu/src/GrGpuGL.cpp +++ b/gpu/src/GrGpuGL.cpp @@ -471,10 +471,11 @@ GrGpuGL::GrGpuGL() { // TODO: Make these a preprocess that generate some compile time constants. // TODO: probe once at startup, rather than once per context creation. - fNPOTRenderTargetSupport = GrGLGetGLInterface()->fNPOTRenderTargetSupport; - if (fNPOTRenderTargetSupport < 0) { + if (GrGLGetGLInterface()->fNPOTRenderTargetSupport < 0) { fNPOTRenderTargetSupport = probe_for_npot_render_target_support(fNPOTTextureSupport); + } else { + fNPOTRenderTargetSupport = GrGLGetGLInterface()->fNPOTRenderTargetSupport; } if (gPrintStartupSpew) { diff --git a/gpu/src/android/GrGLDefaultInterface_android.cpp b/gpu/src/android/GrGLDefaultInterface_android.cpp index 38e77081fc..54bc2f60d3 100644 --- a/gpu/src/android/GrGLDefaultInterface_android.cpp +++ b/gpu/src/android/GrGLDefaultInterface_android.cpp @@ -19,9 +19,9 @@ void GrGLSetDefaultGLInterface() { static GrGLInterface cmd_buffer_interface = { kES2_GrGLBinding, - -1, // fNPOTRenderTargetSupport - -1, // fMinRenderTargetHeight - -1, // fMinRenderTargetWidth + kProbe_GrGLBug, // fNPOTRenderTargetSupport + kProbe_GrGLBug, // fMinRenderTargetHeight + kProbe_GrGLBug, // fMinRenderTargetWidth glActiveTexture, glAttachShader, glBindAttribLocation, diff --git a/gpu/src/mac/GrGLDefaultInterface_mac.cpp b/gpu/src/mac/GrGLDefaultInterface_mac.cpp index a49f2389fa..cfa528ab79 100644 --- a/gpu/src/mac/GrGLDefaultInterface_mac.cpp +++ b/gpu/src/mac/GrGLDefaultInterface_mac.cpp @@ -23,7 +23,7 @@ void GrGLSetDefaultGLInterface() { static GrGLInterface gDefaultInterface; static bool gDefaultInterfaceInit; if (!gDefaultInterfaceInit) { - gDefaultInterface.fNPOTRenderTargetSupport = 1; + gDefaultInterface.fNPOTRenderTargetSupport = true; gDefaultInterface.fMinRenderTargetHeight = 1; gDefaultInterface.fMinRenderTargetWidth = 1; diff --git a/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp b/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp index 6852eb78c9..bc75a2c4c7 100644 --- a/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp +++ b/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp @@ -38,7 +38,7 @@ void GrGLSetDefaultGLInterface() { // We must have array and element_array buffer objects. return; } - gDefaultInterface.fNPOTRenderTargetSupport = 1; + gDefaultInterface.fNPOTRenderTargetSupport = true; gDefaultInterface.fMinRenderTargetHeight = 1; gDefaultInterface.fMinRenderTargetWidth = 1; diff --git a/gpu/src/unix/GrGLDefaultInterface_unix.cpp b/gpu/src/unix/GrGLDefaultInterface_unix.cpp index f58b21576e..2e233e02b2 100644 --- a/gpu/src/unix/GrGLDefaultInterface_unix.cpp +++ b/gpu/src/unix/GrGLDefaultInterface_unix.cpp @@ -40,7 +40,7 @@ void GrGLSetDefaultGLInterface() { return; } - gDefaultInterface.fNPOTRenderTargetSupport = 1; + gDefaultInterface.fNPOTRenderTargetSupport = true; gDefaultInterface.fMinRenderTargetHeight = 1; gDefaultInterface.fMinRenderTargetWidth = 1; diff --git a/gpu/src/win/GrGLDefaultInterface_win.cpp b/gpu/src/win/GrGLDefaultInterface_win.cpp index 7f680a670f..9b40a94edb 100644 --- a/gpu/src/win/GrGLDefaultInterface_win.cpp +++ b/gpu/src/win/GrGLDefaultInterface_win.cpp @@ -45,7 +45,7 @@ void GrGLSetDefaultGLInterface() { return; } - gDefaultInterface.fNPOTRenderTargetSupport = 1; + gDefaultInterface.fNPOTRenderTargetSupport = true; gDefaultInterface.fMinRenderTargetHeight = 1; gDefaultInterface.fMinRenderTargetWidth = 1; |