From e67bd3fbc9bcd0929033635d546544527784b4c0 Mon Sep 17 00:00:00 2001 From: "tomhudson@google.com" Date: Thu, 16 Jun 2011 14:08:04 +0000 Subject: [PATCH] Rename GrGLBug to GrGLCapability. Default all architectures to kProbe_GrGLCapability. Use new facilities better from GrGpuGL.cpp git-svn-id: http://skia.googlecode.com/svn/trunk@1613 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gpu/include/GrGLInterface.h | 8 ++++---- gpu/src/GrGpuGL.cpp | 10 ++++++---- gpu/src/android/GrGLDefaultInterface_android.cpp | 6 +++--- gpu/src/mac/GrGLDefaultInterface_mac.cpp | 6 +++--- gpu/src/mesa/GrGLDefaultInterface_mesa.cpp | 6 +++--- gpu/src/unix/GrGLDefaultInterface_unix.cpp | 6 +++--- gpu/src/win/GrGLDefaultInterface_win.cpp | 6 +++--- 7 files changed, 25 insertions(+), 23 deletions(-) diff --git a/gpu/include/GrGLInterface.h b/gpu/include/GrGLInterface.h index 5802ec4f3b..e3942cd203 100644 --- a/gpu/include/GrGLInterface.h +++ b/gpu/include/GrGLInterface.h @@ -205,8 +205,8 @@ 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 +enum GrGLCapability { + kProbe_GrGLCapability = -1 }; /* @@ -226,12 +226,12 @@ struct GrGLInterface { GrGLBinding fBindingsExported; /// Does this GL support NPOT textures on FBOs? - /// boolean value, or kProbe_GrGLBug to probe (slowly) at context creation. + /// boolean value, or kProbe_GrGLCapability 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. - /// kProbe_GrGLBug to probe (slowly) at context creation. + /// kProbe_GrGLCapability to probe (slowly) at context creation. int fMinRenderTargetHeight; int fMinRenderTargetWidth; diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp index 973e1e4a53..e40024a837 100644 --- a/gpu/src/GrGpuGL.cpp +++ b/gpu/src/GrGpuGL.cpp @@ -471,11 +471,13 @@ GrGpuGL::GrGpuGL() { // TODO: Make these a preprocess that generate some compile time constants. // TODO: probe once at startup, rather than once per context creation. - if (GrGLGetGLInterface()->fNPOTRenderTargetSupport < 0) { + int expectNPOTTargets = GrGLGetGLInterface()->fNPOTRenderTargetSupport; + if (expectNPOTTargets == kProbe_GrGLCapability) { fNPOTRenderTargetSupport = probe_for_npot_render_target_support(fNPOTTextureSupport); } else { - fNPOTRenderTargetSupport = GrGLGetGLInterface()->fNPOTRenderTargetSupport; + GrAssert(expectNPOTTargets == 0 || expectNPOTTargets == 1); + fNPOTRenderTargetSupport = static_cast(expectNPOTTargets); } if (gPrintStartupSpew) { @@ -503,14 +505,14 @@ GrGpuGL::GrGpuGL() { fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize); fMinRenderTargetHeight = GrGLGetGLInterface()->fMinRenderTargetHeight; - if (fMinRenderTargetHeight < 0) { + if (fMinRenderTargetHeight == kProbe_GrGLCapability) { fMinRenderTargetHeight = probe_for_min_render_target_height(fNPOTRenderTargetSupport, fMaxRenderTargetSize); } fMinRenderTargetWidth = GrGLGetGLInterface()->fMinRenderTargetWidth; - if (fMinRenderTargetWidth < 0) { + if (fMinRenderTargetWidth == kProbe_GrGLCapability) { fMinRenderTargetWidth = probe_for_min_render_target_width(fNPOTRenderTargetSupport, fMaxRenderTargetSize); diff --git a/gpu/src/android/GrGLDefaultInterface_android.cpp b/gpu/src/android/GrGLDefaultInterface_android.cpp index 54bc2f60d3..4c06f17770 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, - kProbe_GrGLBug, // fNPOTRenderTargetSupport - kProbe_GrGLBug, // fMinRenderTargetHeight - kProbe_GrGLBug, // fMinRenderTargetWidth + kProbe_GrGLCapability, // fNPOTRenderTargetSupport + kProbe_GrGLCapability, // fMinRenderTargetHeight + kProbe_GrGLCapability, // fMinRenderTargetWidth glActiveTexture, glAttachShader, glBindAttribLocation, diff --git a/gpu/src/mac/GrGLDefaultInterface_mac.cpp b/gpu/src/mac/GrGLDefaultInterface_mac.cpp index cfa528ab79..d21bdda755 100644 --- a/gpu/src/mac/GrGLDefaultInterface_mac.cpp +++ b/gpu/src/mac/GrGLDefaultInterface_mac.cpp @@ -23,9 +23,9 @@ void GrGLSetDefaultGLInterface() { static GrGLInterface gDefaultInterface; static bool gDefaultInterfaceInit; if (!gDefaultInterfaceInit) { - gDefaultInterface.fNPOTRenderTargetSupport = true; - gDefaultInterface.fMinRenderTargetHeight = 1; - gDefaultInterface.fMinRenderTargetWidth = 1; + gDefaultInterface.fNPOTRenderTargetSupport = kProbe_GrGLCapability; + gDefaultInterface.fMinRenderTargetHeight = kProbe_GrGLCapability; + gDefaultInterface.fMinRenderTargetWidth = kProbe_GrGLCapability; gDefaultInterface.fActiveTexture = glActiveTexture; gDefaultInterface.fAttachShader = glAttachShader; diff --git a/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp b/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp index bc75a2c4c7..1324649896 100644 --- a/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp +++ b/gpu/src/mesa/GrGLDefaultInterface_mesa.cpp @@ -38,9 +38,9 @@ void GrGLSetDefaultGLInterface() { // We must have array and element_array buffer objects. return; } - gDefaultInterface.fNPOTRenderTargetSupport = true; - gDefaultInterface.fMinRenderTargetHeight = 1; - gDefaultInterface.fMinRenderTargetWidth = 1; + gDefaultInterface.fNPOTRenderTargetSupport = kProbe_GrGLCapability; + gDefaultInterface.fMinRenderTargetHeight = kProbe_GrGLCapability; + gDefaultInterface.fMinRenderTargetWidth = kProbe_GrGLCapability; gDefaultInterface.fActiveTexture = glActiveTexture; GR_GL_GET_PROC(AttachShader); diff --git a/gpu/src/unix/GrGLDefaultInterface_unix.cpp b/gpu/src/unix/GrGLDefaultInterface_unix.cpp index 2e233e02b2..724f4381dc 100644 --- a/gpu/src/unix/GrGLDefaultInterface_unix.cpp +++ b/gpu/src/unix/GrGLDefaultInterface_unix.cpp @@ -40,9 +40,9 @@ void GrGLSetDefaultGLInterface() { return; } - gDefaultInterface.fNPOTRenderTargetSupport = true; - gDefaultInterface.fMinRenderTargetHeight = 1; - gDefaultInterface.fMinRenderTargetWidth = 1; + gDefaultInterface.fNPOTRenderTargetSupport = kProbe_GrGLCapability; + gDefaultInterface.fMinRenderTargetHeight = kProbe_GrGLCapability; + gDefaultInterface.fMinRenderTargetWidth = kProbe_GrGLCapability; gDefaultInterface.fActiveTexture = glActiveTexture; GR_GL_GET_PROC(AttachShader); diff --git a/gpu/src/win/GrGLDefaultInterface_win.cpp b/gpu/src/win/GrGLDefaultInterface_win.cpp index 9b40a94edb..3bbd262a64 100644 --- a/gpu/src/win/GrGLDefaultInterface_win.cpp +++ b/gpu/src/win/GrGLDefaultInterface_win.cpp @@ -45,9 +45,9 @@ void GrGLSetDefaultGLInterface() { return; } - gDefaultInterface.fNPOTRenderTargetSupport = true; - gDefaultInterface.fMinRenderTargetHeight = 1; - gDefaultInterface.fMinRenderTargetWidth = 1; + gDefaultInterface.fNPOTRenderTargetSupport = kProbe_GrGLCapability; + gDefaultInterface.fMinRenderTargetHeight = kProbe_GrGLCapability; + gDefaultInterface.fMinRenderTargetWidth = kProbe_GrGLCapability; // Functions that are part of GL 1.1 will return NULL in // wglGetProcAddress