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
This commit is contained in:
tomhudson@google.com 2011-06-16 14:08:04 +00:00
parent 716a0387ca
commit e67bd3fbc9
7 changed files with 25 additions and 23 deletions

View File

@ -205,8 +205,8 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFragDataLocationIndexedProc)(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar * name); typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFragDataLocationIndexedProc)(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar * name);
} // extern "C" } // extern "C"
enum GrGLBug { enum GrGLCapability {
kProbe_GrGLBug = -1 kProbe_GrGLCapability = -1
}; };
/* /*
@ -226,12 +226,12 @@ struct GrGLInterface {
GrGLBinding fBindingsExported; GrGLBinding fBindingsExported;
/// Does this GL support NPOT textures on FBOs? /// 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; int fNPOTRenderTargetSupport;
/// Some GL implementations (PowerVR SGX devices like the iPhone 4) /// Some GL implementations (PowerVR SGX devices like the iPhone 4)
/// have restrictions on the size of small render targets. /// 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 fMinRenderTargetHeight;
int fMinRenderTargetWidth; int fMinRenderTargetWidth;

View File

@ -471,11 +471,13 @@ GrGpuGL::GrGpuGL() {
// TODO: Make these a preprocess that generate some compile time constants. // TODO: Make these a preprocess that generate some compile time constants.
// TODO: probe once at startup, rather than once per context creation. // TODO: probe once at startup, rather than once per context creation.
if (GrGLGetGLInterface()->fNPOTRenderTargetSupport < 0) { int expectNPOTTargets = GrGLGetGLInterface()->fNPOTRenderTargetSupport;
if (expectNPOTTargets == kProbe_GrGLCapability) {
fNPOTRenderTargetSupport = fNPOTRenderTargetSupport =
probe_for_npot_render_target_support(fNPOTTextureSupport); probe_for_npot_render_target_support(fNPOTTextureSupport);
} else { } else {
fNPOTRenderTargetSupport = GrGLGetGLInterface()->fNPOTRenderTargetSupport; GrAssert(expectNPOTTargets == 0 || expectNPOTTargets == 1);
fNPOTRenderTargetSupport = static_cast<bool>(expectNPOTTargets);
} }
if (gPrintStartupSpew) { if (gPrintStartupSpew) {
@ -503,14 +505,14 @@ GrGpuGL::GrGpuGL() {
fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize); fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize);
fMinRenderTargetHeight = GrGLGetGLInterface()->fMinRenderTargetHeight; fMinRenderTargetHeight = GrGLGetGLInterface()->fMinRenderTargetHeight;
if (fMinRenderTargetHeight < 0) { if (fMinRenderTargetHeight == kProbe_GrGLCapability) {
fMinRenderTargetHeight = fMinRenderTargetHeight =
probe_for_min_render_target_height(fNPOTRenderTargetSupport, probe_for_min_render_target_height(fNPOTRenderTargetSupport,
fMaxRenderTargetSize); fMaxRenderTargetSize);
} }
fMinRenderTargetWidth = GrGLGetGLInterface()->fMinRenderTargetWidth; fMinRenderTargetWidth = GrGLGetGLInterface()->fMinRenderTargetWidth;
if (fMinRenderTargetWidth < 0) { if (fMinRenderTargetWidth == kProbe_GrGLCapability) {
fMinRenderTargetWidth = fMinRenderTargetWidth =
probe_for_min_render_target_width(fNPOTRenderTargetSupport, probe_for_min_render_target_width(fNPOTRenderTargetSupport,
fMaxRenderTargetSize); fMaxRenderTargetSize);

View File

@ -19,9 +19,9 @@
void GrGLSetDefaultGLInterface() { void GrGLSetDefaultGLInterface() {
static GrGLInterface cmd_buffer_interface = { static GrGLInterface cmd_buffer_interface = {
kES2_GrGLBinding, kES2_GrGLBinding,
kProbe_GrGLBug, // fNPOTRenderTargetSupport kProbe_GrGLCapability, // fNPOTRenderTargetSupport
kProbe_GrGLBug, // fMinRenderTargetHeight kProbe_GrGLCapability, // fMinRenderTargetHeight
kProbe_GrGLBug, // fMinRenderTargetWidth kProbe_GrGLCapability, // fMinRenderTargetWidth
glActiveTexture, glActiveTexture,
glAttachShader, glAttachShader,
glBindAttribLocation, glBindAttribLocation,

View File

@ -23,9 +23,9 @@ void GrGLSetDefaultGLInterface() {
static GrGLInterface gDefaultInterface; static GrGLInterface gDefaultInterface;
static bool gDefaultInterfaceInit; static bool gDefaultInterfaceInit;
if (!gDefaultInterfaceInit) { if (!gDefaultInterfaceInit) {
gDefaultInterface.fNPOTRenderTargetSupport = true; gDefaultInterface.fNPOTRenderTargetSupport = kProbe_GrGLCapability;
gDefaultInterface.fMinRenderTargetHeight = 1; gDefaultInterface.fMinRenderTargetHeight = kProbe_GrGLCapability;
gDefaultInterface.fMinRenderTargetWidth = 1; gDefaultInterface.fMinRenderTargetWidth = kProbe_GrGLCapability;
gDefaultInterface.fActiveTexture = glActiveTexture; gDefaultInterface.fActiveTexture = glActiveTexture;
gDefaultInterface.fAttachShader = glAttachShader; gDefaultInterface.fAttachShader = glAttachShader;

View File

@ -38,9 +38,9 @@ void GrGLSetDefaultGLInterface() {
// We must have array and element_array buffer objects. // We must have array and element_array buffer objects.
return; return;
} }
gDefaultInterface.fNPOTRenderTargetSupport = true; gDefaultInterface.fNPOTRenderTargetSupport = kProbe_GrGLCapability;
gDefaultInterface.fMinRenderTargetHeight = 1; gDefaultInterface.fMinRenderTargetHeight = kProbe_GrGLCapability;
gDefaultInterface.fMinRenderTargetWidth = 1; gDefaultInterface.fMinRenderTargetWidth = kProbe_GrGLCapability;
gDefaultInterface.fActiveTexture = glActiveTexture; gDefaultInterface.fActiveTexture = glActiveTexture;
GR_GL_GET_PROC(AttachShader); GR_GL_GET_PROC(AttachShader);

View File

@ -40,9 +40,9 @@ void GrGLSetDefaultGLInterface() {
return; return;
} }
gDefaultInterface.fNPOTRenderTargetSupport = true; gDefaultInterface.fNPOTRenderTargetSupport = kProbe_GrGLCapability;
gDefaultInterface.fMinRenderTargetHeight = 1; gDefaultInterface.fMinRenderTargetHeight = kProbe_GrGLCapability;
gDefaultInterface.fMinRenderTargetWidth = 1; gDefaultInterface.fMinRenderTargetWidth = kProbe_GrGLCapability;
gDefaultInterface.fActiveTexture = glActiveTexture; gDefaultInterface.fActiveTexture = glActiveTexture;
GR_GL_GET_PROC(AttachShader); GR_GL_GET_PROC(AttachShader);

View File

@ -45,9 +45,9 @@ void GrGLSetDefaultGLInterface() {
return; return;
} }
gDefaultInterface.fNPOTRenderTargetSupport = true; gDefaultInterface.fNPOTRenderTargetSupport = kProbe_GrGLCapability;
gDefaultInterface.fMinRenderTargetHeight = 1; gDefaultInterface.fMinRenderTargetHeight = kProbe_GrGLCapability;
gDefaultInterface.fMinRenderTargetWidth = 1; gDefaultInterface.fMinRenderTargetWidth = kProbe_GrGLCapability;
// Functions that are part of GL 1.1 will return NULL in // Functions that are part of GL 1.1 will return NULL in
// wglGetProcAddress // wglGetProcAddress