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 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 m_lostContextErrors.remove(0); | 2074 m_lostContextErrors.remove(0); |
2075 return err; | 2075 return err; |
2076 } | 2076 } |
2077 | 2077 |
2078 if (isContextLost()) | 2078 if (isContextLost()) |
2079 return GL_NO_ERROR; | 2079 return GL_NO_ERROR; |
2080 | 2080 |
2081 return m_context->getError(); | 2081 return m_context->getError(); |
2082 } | 2082 } |
2083 | 2083 |
| 2084 const char* const* WebGLRenderingContextBase::ExtensionTracker::prefixes() const |
| 2085 { |
| 2086 static const char* const unprefixed[] = { "", 0, }; |
| 2087 return m_prefixes ? m_prefixes : unprefixed; |
| 2088 } |
| 2089 |
2084 bool WebGLRenderingContextBase::ExtensionTracker::matchesNameWithPrefixes(const
String& name) const | 2090 bool WebGLRenderingContextBase::ExtensionTracker::matchesNameWithPrefixes(const
String& name) const |
2085 { | 2091 { |
2086 static const char* const unprefixed[] = { "", 0, }; | 2092 const char* const* prefixSet = prefixes(); |
2087 | 2093 for (; *prefixSet; ++prefixSet) { |
2088 const char* const* prefixes = m_prefixes ? m_prefixes : unprefixed; | 2094 String prefixedName = String(*prefixSet) + extensionName(); |
2089 for (; *prefixes; ++prefixes) { | |
2090 String prefixedName = String(*prefixes) + extensionName(); | |
2091 if (equalIgnoringCase(prefixedName, name)) { | 2095 if (equalIgnoringCase(prefixedName, name)) { |
2092 return true; | 2096 return true; |
2093 } | 2097 } |
2094 } | 2098 } |
2095 return false; | 2099 return false; |
2096 } | 2100 } |
2097 | 2101 |
| 2102 bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac
ker* tracker) |
| 2103 { |
| 2104 if (tracker->webglDebugRendererInfo() && !allowWebGLDebugRendererInfo()) |
| 2105 return false; |
| 2106 if (tracker->privileged() && !allowPrivilegedExtensions()) |
| 2107 return false; |
| 2108 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled
()) |
| 2109 return false; |
| 2110 if (!tracker->supported(this)) |
| 2111 return false; |
| 2112 return true; |
| 2113 } |
| 2114 |
| 2115 |
2098 PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String&
name) | 2116 PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String&
name) |
2099 { | 2117 { |
2100 if (isContextLost()) | 2118 if (isContextLost()) |
2101 return nullptr; | 2119 return nullptr; |
2102 | 2120 |
2103 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2121 for (size_t i = 0; i < m_extensions.size(); ++i) { |
2104 ExtensionTracker* tracker = m_extensions[i]; | 2122 ExtensionTracker* tracker = m_extensions[i]; |
2105 if (tracker->matchesNameWithPrefixes(name)) { | 2123 if (tracker->matchesNameWithPrefixes(name)) { |
2106 if (tracker->webglDebugRendererInfo() && !allowWebGLDebugRendererInf
o()) | 2124 if (!extensionSupportedAndAllowed(tracker)) |
2107 return nullptr; | |
2108 if (tracker->privileged() && !allowPrivilegedExtensions()) | |
2109 return nullptr; | |
2110 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtension
sEnabled()) | |
2111 return nullptr; | |
2112 if (!tracker->supported(this)) | |
2113 return nullptr; | 2125 return nullptr; |
2114 | 2126 |
2115 RefPtr<WebGLExtension> extension = tracker->getExtension(this); | 2127 RefPtr<WebGLExtension> extension = tracker->getExtension(this); |
2116 if (extension) | 2128 if (extension) |
2117 m_extensionEnabled[extension->name()] = true; | 2129 m_extensionEnabled[extension->name()] = true; |
2118 return extension.release(); | 2130 return extension.release(); |
2119 } | 2131 } |
2120 } | 2132 } |
2121 | 2133 |
2122 return nullptr; | 2134 return nullptr; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 } | 2567 } |
2556 | 2568 |
2557 Vector<String> WebGLRenderingContextBase::getSupportedExtensions() | 2569 Vector<String> WebGLRenderingContextBase::getSupportedExtensions() |
2558 { | 2570 { |
2559 Vector<String> result; | 2571 Vector<String> result; |
2560 if (isContextLost()) | 2572 if (isContextLost()) |
2561 return result; | 2573 return result; |
2562 | 2574 |
2563 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2575 for (size_t i = 0; i < m_extensions.size(); ++i) { |
2564 ExtensionTracker* tracker = m_extensions[i]; | 2576 ExtensionTracker* tracker = m_extensions[i]; |
2565 if (tracker->webglDebugRendererInfo() && !allowWebGLDebugRendererInfo()) | 2577 if (extensionSupportedAndAllowed(tracker)) { |
2566 continue; | 2578 const char* const* prefixes = tracker->prefixes(); |
2567 if (tracker->privileged() && !allowPrivilegedExtensions()) | 2579 for (; *prefixes; ++prefixes) { |
2568 continue; | 2580 String prefixedName = String(*prefixes) + tracker->extensionName
(); |
2569 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEna
bled()) | 2581 result.append(prefixedName); |
2570 continue; | 2582 } |
2571 if (tracker->supported(this)) | 2583 } |
2572 result.append(String(tracker->prefixed() ? "WEBKIT_" : "") + tracke
r->extensionName()); | |
2573 } | 2584 } |
2574 | 2585 |
2575 return result; | 2586 return result; |
2576 } | 2587 } |
2577 | 2588 |
2578 WebGLGetInfo WebGLRenderingContextBase::getTexParameter(GLenum target, GLenum pn
ame) | 2589 WebGLGetInfo WebGLRenderingContextBase::getTexParameter(GLenum target, GLenum pn
ame) |
2579 { | 2590 { |
2580 if (isContextLost()) | 2591 if (isContextLost()) |
2581 return WebGLGetInfo(); | 2592 return WebGLGetInfo(); |
2582 WebGLTexture* tex = validateTextureBinding("getTexParameter", target, false)
; | 2593 WebGLTexture* tex = validateTextureBinding("getTexParameter", target, false)
; |
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5559 if (m_textureUnits[i].m_texture2DBinding | 5570 if (m_textureUnits[i].m_texture2DBinding |
5560 || m_textureUnits[i].m_textureCubeMapBinding) { | 5571 || m_textureUnits[i].m_textureCubeMapBinding) { |
5561 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5572 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
5562 return; | 5573 return; |
5563 } | 5574 } |
5564 } | 5575 } |
5565 m_onePlusMaxNonDefaultTextureUnit = 0; | 5576 m_onePlusMaxNonDefaultTextureUnit = 0; |
5566 } | 5577 } |
5567 | 5578 |
5568 } // namespace WebCore | 5579 } // namespace WebCore |
OLD | NEW |