Fix bug where createTexture may bind a texture to GL without ever updating fHWState.fTexture (when texture is not bound to FBO).

Other minor changes:
Add commented out GL logging define to GrUserConfig
Remove dead GrGpuD3D9 file from xcode proj



git-svn-id: http://skia.googlecode.com/svn/trunk@663 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrUserConfig.h b/gpu/include/GrUserConfig.h
index 2e6f391..b0ea58c 100644
--- a/gpu/include/GrUserConfig.h
+++ b/gpu/include/GrUserConfig.h
@@ -42,6 +42,12 @@
  */
 //#define GR_DUMP_TEXTURE_UPLOAD    1
 
+/*
+ * To log all GL calls define this. Can be turned on and off at runtime by
+ * gPrintGL global variable. 
+ */
+//#define GR_GL_LOG_CALLS 1
+ 
 ////////////////////////////////////////////////////////////////////////////////
 // Decide Ganesh types
 
diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp
index ebd0d03..de4010f 100644
--- a/gpu/src/GrGpuGL.cpp
+++ b/gpu/src/GrGpuGL.cpp
@@ -629,6 +629,7 @@
 #if GR_COLLECT_STATS
     ++fStats.fTextureChngCnt;
 #endif
+    fHWDrawState.fTexture = NULL;
 
     GR_GL(PixelStorei(GL_UNPACK_ALIGNMENT, glDesc.fUploadByteCount));
     if (GrTexture::kIndex_8_PixelConfig == desc.fFormat &&
@@ -770,8 +771,7 @@
 #if GR_COLLECT_STATS
         ++fStats.fTextureChngCnt;
 #endif
-
-        fHWDrawState.fTexture = NULL;
+        GrAssert(NULL == fHWDrawState.fTexture);
 
         err = ~GL_NO_ERROR;
         for (int i = 0; i < attempts; ++i) {
@@ -1440,6 +1440,7 @@
                 //GrPrintf("---- bindtexture %d\n", nextTexture->textureID());
                 fHWDrawState.fTexture = nextTexture;
             }
+
             const GrGLTexture::TexParams& oldTexParams = nextTexture->getTexParams();
             GrGLTexture::TexParams newTexParams;
             newTexParams.fFilter = fCurrDrawState.fSamplerState.isFilter() ? 
diff --git a/xcode/gpu/gpu.xcodeproj/project.pbxproj b/xcode/gpu/gpu.xcodeproj/project.pbxproj
index f7f672a..14a5201 100644
--- a/xcode/gpu/gpu.xcodeproj/project.pbxproj
+++ b/xcode/gpu/gpu.xcodeproj/project.pbxproj
@@ -54,7 +54,6 @@
 		00115E8312C116CA008296FE /* GrGLVertexBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 00115E4712C116CA008296FE /* GrGLVertexBuffer.h */; };
 		00115E8412C116CA008296FE /* GrGlyph.h in Headers */ = {isa = PBXBuildFile; fileRef = 00115E4812C116CA008296FE /* GrGlyph.h */; };
 		00115E8512C116CA008296FE /* GrGpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 00115E4912C116CA008296FE /* GrGpu.h */; };
-		00115E8612C116CA008296FE /* GrGpuD3D9.h in Headers */ = {isa = PBXBuildFile; fileRef = 00115E4A12C116CA008296FE /* GrGpuD3D9.h */; };
 		00115E8712C116CA008296FE /* GrGpuVertex.h in Headers */ = {isa = PBXBuildFile; fileRef = 00115E4B12C116CA008296FE /* GrGpuVertex.h */; };
 		00115E8812C116CA008296FE /* GrIndexBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 00115E4C12C116CA008296FE /* GrIndexBuffer.h */; };
 		00115E8912C116CA008296FE /* GrInOrderDrawBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 00115E4D12C116CA008296FE /* GrInOrderDrawBuffer.h */; };
@@ -142,7 +141,6 @@
 		00115E4712C116CA008296FE /* GrGLVertexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrGLVertexBuffer.h; path = ../../gpu/include/GrGLVertexBuffer.h; sourceTree = SOURCE_ROOT; };
 		00115E4812C116CA008296FE /* GrGlyph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrGlyph.h; path = ../../gpu/include/GrGlyph.h; sourceTree = SOURCE_ROOT; };
 		00115E4912C116CA008296FE /* GrGpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrGpu.h; path = ../../gpu/include/GrGpu.h; sourceTree = SOURCE_ROOT; };
-		00115E4A12C116CA008296FE /* GrGpuD3D9.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrGpuD3D9.h; path = ../../gpu/include/GrGpuD3D9.h; sourceTree = SOURCE_ROOT; };
 		00115E4B12C116CA008296FE /* GrGpuVertex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrGpuVertex.h; path = ../../gpu/include/GrGpuVertex.h; sourceTree = SOURCE_ROOT; };
 		00115E4C12C116CA008296FE /* GrIndexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrIndexBuffer.h; path = ../../gpu/include/GrIndexBuffer.h; sourceTree = SOURCE_ROOT; };
 		00115E4D12C116CA008296FE /* GrInOrderDrawBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrInOrderDrawBuffer.h; path = ../../gpu/include/GrInOrderDrawBuffer.h; sourceTree = SOURCE_ROOT; };
@@ -214,7 +212,6 @@
 				00115E4712C116CA008296FE /* GrGLVertexBuffer.h */,
 				00115E4812C116CA008296FE /* GrGlyph.h */,
 				00115E4912C116CA008296FE /* GrGpu.h */,
-				00115E4A12C116CA008296FE /* GrGpuD3D9.h */,
 				00115E4B12C116CA008296FE /* GrGpuVertex.h */,
 				00115E4C12C116CA008296FE /* GrIndexBuffer.h */,
 				00115E4D12C116CA008296FE /* GrInOrderDrawBuffer.h */,
@@ -348,7 +345,6 @@
 				00115E8312C116CA008296FE /* GrGLVertexBuffer.h in Headers */,
 				00115E8412C116CA008296FE /* GrGlyph.h in Headers */,
 				00115E8512C116CA008296FE /* GrGpu.h in Headers */,
-				00115E8612C116CA008296FE /* GrGpuD3D9.h in Headers */,
 				00115E8712C116CA008296FE /* GrGpuVertex.h in Headers */,
 				00115E8812C116CA008296FE /* GrIndexBuffer.h in Headers */,
 				00115E8912C116CA008296FE /* GrInOrderDrawBuffer.h in Headers */,