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);
} // 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;

View File

@ -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<bool>(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);

View File

@ -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,

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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