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 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 m_lostContextErrors.remove(0); | 2092 m_lostContextErrors.remove(0); |
2093 return err; | 2093 return err; |
2094 } | 2094 } |
2095 | 2095 |
2096 if (isContextLost()) | 2096 if (isContextLost()) |
2097 return GL_NO_ERROR; | 2097 return GL_NO_ERROR; |
2098 | 2098 |
2099 return m_context->getError(); | 2099 return m_context->getError(); |
2100 } | 2100 } |
2101 | 2101 |
| 2102 const char* const* WebGLRenderingContextBase::ExtensionTracker::prefixes() const |
| 2103 { |
| 2104 static const char* const unprefixed[] = { "", 0, }; |
| 2105 return m_prefixes ? m_prefixes : unprefixed; |
| 2106 } |
| 2107 |
2102 bool WebGLRenderingContextBase::ExtensionTracker::matchesNameWithPrefixes(const
String& name) const | 2108 bool WebGLRenderingContextBase::ExtensionTracker::matchesNameWithPrefixes(const
String& name) const |
2103 { | 2109 { |
2104 static const char* const unprefixed[] = { "", 0, }; | 2110 const char* const* prefixSet = prefixes(); |
2105 | 2111 for (; *prefixSet; ++prefixSet) { |
2106 const char* const* prefixes = m_prefixes ? m_prefixes : unprefixed; | 2112 String prefixedName = String(*prefixSet) + extensionName(); |
2107 for (; *prefixes; ++prefixes) { | |
2108 String prefixedName = String(*prefixes) + extensionName(); | |
2109 if (equalIgnoringCase(prefixedName, name)) { | 2113 if (equalIgnoringCase(prefixedName, name)) { |
2110 return true; | 2114 return true; |
2111 } | 2115 } |
2112 } | 2116 } |
2113 return false; | 2117 return false; |
2114 } | 2118 } |
2115 | 2119 |
| 2120 bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac
ker* tracker) |
| 2121 { |
| 2122 if (tracker->webglDebugRendererInfo() && !allowWebGLDebugRendererInfo()) |
| 2123 return false; |
| 2124 if (tracker->privileged() && !allowPrivilegedExtensions()) |
| 2125 return false; |
| 2126 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled
()) |
| 2127 return false; |
| 2128 if (!tracker->supported(this)) |
| 2129 return false; |
| 2130 return true; |
| 2131 } |
| 2132 |
| 2133 |
2116 PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String&
name) | 2134 PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String&
name) |
2117 { | 2135 { |
2118 if (isContextLost()) | 2136 if (isContextLost()) |
2119 return nullptr; | 2137 return nullptr; |
2120 | 2138 |
2121 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2139 for (size_t i = 0; i < m_extensions.size(); ++i) { |
2122 ExtensionTracker* tracker = m_extensions[i]; | 2140 ExtensionTracker* tracker = m_extensions[i]; |
2123 if (tracker->matchesNameWithPrefixes(name)) { | 2141 if (tracker->matchesNameWithPrefixes(name)) { |
2124 if (tracker->webglDebugRendererInfo() && !allowWebGLDebugRendererInf
o()) | 2142 if (!extensionSupportedAndAllowed(tracker)) |
2125 return nullptr; | |
2126 if (tracker->privileged() && !allowPrivilegedExtensions()) | |
2127 return nullptr; | |
2128 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtension
sEnabled()) | |
2129 return nullptr; | |
2130 if (!tracker->supported(this)) | |
2131 return nullptr; | 2143 return nullptr; |
2132 | 2144 |
2133 RefPtr<WebGLExtension> extension = tracker->getExtension(this); | 2145 RefPtr<WebGLExtension> extension = tracker->getExtension(this); |
2134 if (extension) | 2146 if (extension) |
2135 m_extensionEnabled[extension->name()] = true; | 2147 m_extensionEnabled[extension->name()] = true; |
2136 return extension.release(); | 2148 return extension.release(); |
2137 } | 2149 } |
2138 } | 2150 } |
2139 | 2151 |
2140 return nullptr; | 2152 return nullptr; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2573 } | 2585 } |
2574 | 2586 |
2575 Vector<String> WebGLRenderingContextBase::getSupportedExtensions() | 2587 Vector<String> WebGLRenderingContextBase::getSupportedExtensions() |
2576 { | 2588 { |
2577 Vector<String> result; | 2589 Vector<String> result; |
2578 if (isContextLost()) | 2590 if (isContextLost()) |
2579 return result; | 2591 return result; |
2580 | 2592 |
2581 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2593 for (size_t i = 0; i < m_extensions.size(); ++i) { |
2582 ExtensionTracker* tracker = m_extensions[i]; | 2594 ExtensionTracker* tracker = m_extensions[i]; |
2583 if (tracker->webglDebugRendererInfo() && !allowWebGLDebugRendererInfo()) | 2595 if (extensionSupportedAndAllowed(tracker)) { |
2584 continue; | 2596 const char* const* prefixes = tracker->prefixes(); |
2585 if (tracker->privileged() && !allowPrivilegedExtensions()) | 2597 for (; *prefixes; ++prefixes) { |
2586 continue; | 2598 String prefixedName = String(*prefixes) + tracker->extensionName
(); |
2587 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEna
bled()) | 2599 result.append(prefixedName); |
2588 continue; | 2600 } |
2589 if (tracker->supported(this)) | 2601 } |
2590 result.append(String(tracker->prefixed() ? "WEBKIT_" : "") + tracke
r->extensionName()); | |
2591 } | 2602 } |
2592 | 2603 |
2593 return result; | 2604 return result; |
2594 } | 2605 } |
2595 | 2606 |
2596 WebGLGetInfo WebGLRenderingContextBase::getTexParameter(GLenum target, GLenum pn
ame) | 2607 WebGLGetInfo WebGLRenderingContextBase::getTexParameter(GLenum target, GLenum pn
ame) |
2597 { | 2608 { |
2598 if (isContextLost()) | 2609 if (isContextLost()) |
2599 return WebGLGetInfo(); | 2610 return WebGLGetInfo(); |
2600 WebGLTexture* tex = validateTextureBinding("getTexParameter", target, false)
; | 2611 WebGLTexture* tex = validateTextureBinding("getTexParameter", target, false)
; |
(...skipping 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5581 if (m_textureUnits[i].m_texture2DBinding | 5592 if (m_textureUnits[i].m_texture2DBinding |
5582 || m_textureUnits[i].m_textureCubeMapBinding) { | 5593 || m_textureUnits[i].m_textureCubeMapBinding) { |
5583 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5594 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
5584 return; | 5595 return; |
5585 } | 5596 } |
5586 } | 5597 } |
5587 m_onePlusMaxNonDefaultTextureUnit = 0; | 5598 m_onePlusMaxNonDefaultTextureUnit = 0; |
5588 } | 5599 } |
5589 | 5600 |
5590 } // namespace WebCore | 5601 } // namespace WebCore |
OLD | NEW |