| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 } | 437 } |
| 438 | 438 |
| 439 // Swallow all other characters. Unclear whether we may | 439 // Swallow all other characters. Unclear whether we may |
| 440 // want or need to just emit a space per character to try | 440 // want or need to just emit a space per character to try |
| 441 // to preserve column numbers for debugging purposes. | 441 // to preserve column numbers for debugging purposes. |
| 442 break; | 442 break; |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 | 445 |
| 446 static bool shouldFailContextCreationForTesting = false; | 446 static bool shouldFailContextCreationForTesting = false; |
| 447 } // namespace anonymous | 447 } // namespace |
| 448 | 448 |
| 449 class ScopedTexture2DRestorer { | 449 class ScopedTexture2DRestorer { |
| 450 STACK_ALLOCATED(); | 450 STACK_ALLOCATED(); |
| 451 public: | 451 public: |
| 452 explicit ScopedTexture2DRestorer(WebGLRenderingContextBase* context) | 452 explicit ScopedTexture2DRestorer(WebGLRenderingContextBase* context) |
| 453 : m_context(context) | 453 : m_context(context) |
| 454 { | 454 { |
| 455 } | 455 } |
| 456 | 456 |
| 457 ~ScopedTexture2DRestorer() | 457 ~ScopedTexture2DRestorer() |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 case GL_SRGB_EXT: | 932 case GL_SRGB_EXT: |
| 933 case GL_SRGB_ALPHA_EXT: | 933 case GL_SRGB_ALPHA_EXT: |
| 934 case GL_SRGB8: | 934 case GL_SRGB8: |
| 935 case GL_SRGB8_ALPHA8: | 935 case GL_SRGB8_ALPHA8: |
| 936 return true; | 936 return true; |
| 937 default: | 937 default: |
| 938 return false; | 938 return false; |
| 939 } | 939 } |
| 940 } | 940 } |
| 941 | 941 |
| 942 } // namespace anonymous | 942 } // namespace |
| 943 | 943 |
| 944 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, PassOwnPtr<WebGraphicsContext3D> context, const WebGLContextAttributes& re
questedAttributes) | 944 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, PassOwnPtr<WebGraphicsContext3D> context, const WebGLContextAttributes& re
questedAttributes) |
| 945 : CanvasRenderingContext(passedCanvas) | 945 : CanvasRenderingContext(passedCanvas) |
| 946 , m_contextLostMode(NotLostContext) | 946 , m_contextLostMode(NotLostContext) |
| 947 , m_autoRecoveryMethod(Manual) | 947 , m_autoRecoveryMethod(Manual) |
| 948 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) | 948 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) |
| 949 , m_restoreAllowed(false) | 949 , m_restoreAllowed(false) |
| 950 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) | 950 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) |
| 951 , m_preservedDefaultVAOObjectWrapper(false) | 951 , m_preservedDefaultVAOObjectWrapper(false) |
| 952 , m_generatedImageCache(4) | 952 , m_generatedImageCache(4) |
| (...skipping 5794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6747 return "OUT_OF_MEMORY"; | 6747 return "OUT_OF_MEMORY"; |
| 6748 case GL_INVALID_FRAMEBUFFER_OPERATION: | 6748 case GL_INVALID_FRAMEBUFFER_OPERATION: |
| 6749 return "INVALID_FRAMEBUFFER_OPERATION"; | 6749 return "INVALID_FRAMEBUFFER_OPERATION"; |
| 6750 case GC3D_CONTEXT_LOST_WEBGL: | 6750 case GC3D_CONTEXT_LOST_WEBGL: |
| 6751 return "CONTEXT_LOST_WEBGL"; | 6751 return "CONTEXT_LOST_WEBGL"; |
| 6752 default: | 6752 default: |
| 6753 return String::format("WebGL ERROR(0x%04X)", error); | 6753 return String::format("WebGL ERROR(0x%04X)", error); |
| 6754 } | 6754 } |
| 6755 } | 6755 } |
| 6756 | 6756 |
| 6757 } // namespace anonymous | 6757 } // namespace |
| 6758 | 6758 |
| 6759 void WebGLRenderingContextBase::synthesizeGLError(GLenum error, const char* func
tionName, const char* description, ConsoleDisplayPreference display) | 6759 void WebGLRenderingContextBase::synthesizeGLError(GLenum error, const char* func
tionName, const char* description, ConsoleDisplayPreference display) |
| 6760 { | 6760 { |
| 6761 String errorType = GetErrorString(error); | 6761 String errorType = GetErrorString(error); |
| 6762 if (m_synthesizedErrorsToConsole && display == DisplayInConsole) { | 6762 if (m_synthesizedErrorsToConsole && display == DisplayInConsole) { |
| 6763 String message = String("WebGL: ") + errorType + ": " + String(function
Name) + ": " + String(description); | 6763 String message = String("WebGL: ") + errorType + ": " + String(function
Name) + ": " + String(description); |
| 6764 printGLErrorToConsole(message); | 6764 printGLErrorToConsole(message); |
| 6765 } | 6765 } |
| 6766 if (!isContextLost()) { | 6766 if (!isContextLost()) { |
| 6767 webContext()->synthesizeGLError(error); | 6767 webContext()->synthesizeGLError(error); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7000 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 7000 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 7001 } | 7001 } |
| 7002 | 7002 |
| 7003 void WebGLRenderingContextBase::restoreUnpackParameters() | 7003 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 7004 { | 7004 { |
| 7005 if (m_unpackAlignment != 1) | 7005 if (m_unpackAlignment != 1) |
| 7006 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 7006 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 7007 } | 7007 } |
| 7008 | 7008 |
| 7009 } // namespace blink | 7009 } // namespace blink |
| OLD | NEW |