Changeset 224370 in webkit
- Timestamp:
- Nov 2, 2017 6:53:17 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r224369 r224370 1 2017-11-02 Devin Rousso <webkit@devinrousso.com> 2 3 Web Inspector: Canvas Tab: show supported GL extensions for selected canvas 4 https://bugs.webkit.org/show_bug.cgi?id=179070 5 <rdar://problem/35278276> 6 7 Reviewed by Brian Burg. 8 9 * inspector/canvas/extensions-expected.txt: Added. 10 * inspector/canvas/extensions.html: Added. 11 1 12 2017-11-02 Youenn Fablet <youenn@apple.com> 2 13 -
trunk/Source/JavaScriptCore/ChangeLog
r224368 r224370 1 2017-11-02 Devin Rousso <webkit@devinrousso.com> 2 3 Web Inspector: Canvas Tab: show supported GL extensions for selected canvas 4 https://bugs.webkit.org/show_bug.cgi?id=179070 5 <rdar://problem/35278276> 6 7 Reviewed by Brian Burg. 8 9 * inspector/protocol/Canvas.json: 10 Add `extensionEnabled` event that is fired each time `getExtension` is called with a 11 different string on a WebGL context. 12 1 13 2017-11-02 Joseph Pecoraro <pecoraro@apple.com> 2 14 -
trunk/Source/JavaScriptCore/inspector/protocol/Canvas.json
r224142 r224370 172 172 }, 173 173 { 174 "name": "extensionEnabled", 175 "parameters": [ 176 { "name": "canvasId", "$ref": "CanvasId" }, 177 { "name": "extension", "type": "string", "description": "Name of the extension that was enabled." } 178 ] 179 }, 180 { 174 181 "name": "cssCanvasClientNodesChanged", 175 182 "parameters": [ -
trunk/Source/WebCore/ChangeLog
r224369 r224370 1 2017-11-02 Devin Rousso <webkit@devinrousso.com> 2 3 Web Inspector: Canvas Tab: show supported GL extensions for selected canvas 4 https://bugs.webkit.org/show_bug.cgi?id=179070 5 <rdar://problem/35278276> 6 7 Reviewed by Brian Burg. 8 9 Test: inspector/canvas/extensions.html 10 11 * html/canvas/WebGL2RenderingContext.cpp: 12 (WebCore::WebGL2RenderingContext::getExtension): 13 * html/canvas/WebGLRenderingContext.cpp: 14 (WebCore::WebGLRenderingContext::getExtension): 15 Rework common logic into a macro for readability and to simplify adding calls to 16 InspectorInstrumentation functions. 17 18 * html/canvas/WebGLRenderingContextBase.h: 19 * html/canvas/WebGLRenderingContextBase.cpp: 20 (WebCore::WebGLRenderingContextBase::extensionIsEnabled): 21 22 * inspector/InspectorCanvasAgent.h: 23 * inspector/InspectorCanvasAgent.cpp: 24 (WebCore::InspectorCanvasAgent::enable): 25 (WebCore::InspectorCanvasAgent::didEnableExtension): 26 27 * inspector/InspectorInstrumentation.h: 28 (WebCore::InspectorInstrumentation::didEnableExtension): 29 * inspector/InspectorInstrumentation.cpp: 30 (WebCore::InspectorInstrumentation::didEnableExtensionImpl): 31 1 32 2017-11-02 Youenn Fablet <youenn@apple.com> 2 33 -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
r224192 r224370 36 36 #include "HTMLVideoElement.h" 37 37 #include "ImageData.h" 38 #include "InspectorInstrumentation.h" 38 39 #include "OESTextureFloat.h" 39 40 #include "OESTextureFloatLinear.h" … … 1081 1082 return nullptr; 1082 1083 1083 if (equalIgnoringASCIICase(name, "EXT_texture_filter_anisotropic") || equalIgnoringASCIICase(name, "WEBKIT_EXT_texture_filter_anisotropic")) { 1084 if (!m_extTextureFilterAnisotropic) { 1085 m_extTextureFilterAnisotropic = enableSupportedExtension("GL_EXT_texture_filter_anisotropic") 1086 ? std::make_unique<EXTTextureFilterAnisotropic>(*this) : nullptr; 1087 } 1088 return m_extTextureFilterAnisotropic.get(); 1089 } 1090 if (equalIgnoringASCIICase(name, "OES_texture_float")) { 1091 if (!m_oesTextureFloat) { 1092 m_oesTextureFloat = enableSupportedExtension("GL_OES_texture_float") 1093 ? std::make_unique<OESTextureFloat>(*this) : nullptr; 1094 } 1095 return m_oesTextureFloat.get(); 1096 } 1097 if (equalIgnoringASCIICase(name, "OES_texture_float_linear")) { 1098 if (!m_oesTextureFloatLinear) { 1099 m_oesTextureFloatLinear = enableSupportedExtension("GL_OES_texture_float_linear") 1100 ? std::make_unique<OESTextureFloatLinear>(*this) : nullptr; 1101 } 1102 return m_oesTextureFloatLinear.get(); 1103 } 1104 if (equalIgnoringASCIICase(name, "OES_texture_half_float")) { 1105 if (!m_oesTextureHalfFloat) { 1106 m_oesTextureHalfFloat = enableSupportedExtension("GL_OES_texture_half_float") 1107 ? std::make_unique<OESTextureHalfFloat>(*this) : nullptr; 1108 } 1109 return m_oesTextureHalfFloat.get(); 1110 } 1111 if (equalIgnoringASCIICase(name, "OES_texture_half_float_linear")) { 1112 if (!m_oesTextureHalfFloatLinear) { 1113 m_oesTextureHalfFloatLinear = enableSupportedExtension("GL_OES_texture_half_float_linear") 1114 ? std::make_unique<OESTextureHalfFloatLinear>(*this) : nullptr; 1115 } 1116 return m_oesTextureHalfFloatLinear.get(); 1117 } 1118 if (equalIgnoringASCIICase(name, "WEBGL_lose_context")) { 1119 if (!m_webglLoseContext) 1120 m_webglLoseContext = std::make_unique<WebGLLoseContext>(*this); 1121 return m_webglLoseContext.get(); 1122 } 1123 if (equalIgnoringASCIICase(name, "WEBKIT_WEBGL_compressed_texture_atc")) { 1124 if (!m_webglCompressedTextureATC) { 1125 if (WebGLCompressedTextureATC::supported(*this)) 1126 m_webglCompressedTextureATC = std::make_unique<WebGLCompressedTextureATC>(*this); 1127 } 1128 return m_webglCompressedTextureATC.get(); 1129 } 1130 if (equalIgnoringASCIICase(name, "WEBKIT_WEBGL_compressed_texture_pvrtc")) { 1131 if (!m_webglCompressedTexturePVRTC) { 1132 m_webglCompressedTexturePVRTC = WebGLCompressedTexturePVRTC::supported(*this) 1133 ? std::make_unique<WebGLCompressedTexturePVRTC>(*this) : nullptr; 1134 } 1135 return m_webglCompressedTexturePVRTC.get(); 1136 } 1137 if (equalIgnoringASCIICase(name, "WEBGL_compressed_texture_s3tc")) { 1138 if (!m_webglCompressedTextureS3TC) { 1139 m_webglCompressedTextureS3TC = WebGLCompressedTextureS3TC::supported(*this) 1140 ? std::make_unique<WebGLCompressedTextureS3TC>(*this) : nullptr; 1141 } 1142 return m_webglCompressedTextureS3TC.get(); 1143 } 1144 if (equalIgnoringASCIICase(name, "WEBGL_depth_texture")) { 1145 if (!m_webglDepthTexture) { 1146 m_webglDepthTexture = WebGLDepthTexture::supported(*graphicsContext3D()) 1147 ? std::make_unique<WebGLDepthTexture>(*this) : nullptr; 1148 } 1149 return m_webglDepthTexture.get(); 1150 } 1151 if (equalIgnoringASCIICase(name, "WEBGL_debug_renderer_info")) { 1152 if (!m_webglDebugRendererInfo) 1153 m_webglDebugRendererInfo = std::make_unique<WebGLDebugRendererInfo>(*this); 1154 return m_webglDebugRendererInfo.get(); 1155 } 1156 if (equalIgnoringASCIICase(name, "WEBGL_debug_shaders")) { 1157 if (!m_webglDebugShaders) { 1158 m_webglDebugShaders = m_context->getExtensions().supports(ASCIILiteral { "GL_ANGLE_translated_shader_source" }) 1159 ? std::make_unique<WebGLDebugShaders>(*this) : nullptr; 1160 } 1161 return m_webglDebugShaders.get(); 1162 } 1163 1084 #define ENABLE_IF_REQUESTED(type, variable, nameLiteral, canEnable) \ 1085 if (equalIgnoringASCIICase(name, nameLiteral)) { \ 1086 if (!variable) { \ 1087 variable = (canEnable) ? std::make_unique<type>(*this) : nullptr; \ 1088 if (variable != nullptr) \ 1089 InspectorInstrumentation::didEnableExtension(*this, name); \ 1090 } \ 1091 return variable.get(); \ 1092 } 1093 1094 ENABLE_IF_REQUESTED(EXTTextureFilterAnisotropic, m_extTextureFilterAnisotropic, "EXT_texture_filter_anisotropic", enableSupportedExtension("GL_EXT_texture_filter_anisotropic")); 1095 ENABLE_IF_REQUESTED(EXTTextureFilterAnisotropic, m_extTextureFilterAnisotropic, "WEBKIT_EXT_texture_filter_anisotropic", enableSupportedExtension("GL_OES_texture_float")); 1096 ENABLE_IF_REQUESTED(OESTextureFloat, m_oesTextureFloat, "OES_texture_float", enableSupportedExtension("GL_OES_texture_float")); 1097 ENABLE_IF_REQUESTED(OESTextureFloatLinear, m_oesTextureFloatLinear, "OES_texture_float_linear", enableSupportedExtension("GL_OES_texture_float_linear")); 1098 ENABLE_IF_REQUESTED(OESTextureHalfFloat, m_oesTextureHalfFloat, "OES_texture_half_float", enableSupportedExtension("GL_OES_texture_half_float")); 1099 ENABLE_IF_REQUESTED(OESTextureHalfFloatLinear, m_oesTextureHalfFloatLinear, "OES_texture_half_float_linear", enableSupportedExtension("GL_OES_texture_half_float_linear")); 1100 ENABLE_IF_REQUESTED(WebGLLoseContext, m_webglLoseContext, "WEBGL_lose_context", true); 1101 ENABLE_IF_REQUESTED(WebGLCompressedTextureATC, m_webglCompressedTextureATC, "WEBKIT_WEBGL_compressed_texture_atc", WebGLCompressedTextureATC::supported(*this)); 1102 ENABLE_IF_REQUESTED(WebGLCompressedTexturePVRTC, m_webglCompressedTexturePVRTC, "WEBKIT_WEBGL_compressed_texture_pvrtc", WebGLCompressedTexturePVRTC::supported(*this)); 1103 ENABLE_IF_REQUESTED(WebGLCompressedTextureS3TC, m_webglCompressedTextureS3TC, "WEBGL_compressed_texture_s3tc", WebGLCompressedTextureS3TC::supported(*this)); 1104 ENABLE_IF_REQUESTED(WebGLDepthTexture, m_webglDepthTexture, "WEBGL_depth_texture", WebGLDepthTexture::supported(*graphicsContext3D())); 1105 ENABLE_IF_REQUESTED(WebGLDebugRendererInfo, m_webglDebugRendererInfo, "WEBGL_debug_renderer_info", true); 1106 ENABLE_IF_REQUESTED(WebGLDebugShaders, m_webglDebugShaders, "WEBGL_debug_shaders", m_context->getExtensions().supports(ASCIILiteral { "GL_ANGLE_translated_shader_source" })); 1164 1107 return nullptr; 1165 1108 } -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r223644 r224370 41 41 #include "HTMLVideoElement.h" 42 42 #include "ImageData.h" 43 #include "InspectorInstrumentation.h" 43 44 #include "OESElementIndexUint.h" 44 45 #include "OESStandardDerivatives.h" … … 90 91 if (isContextLostOrPending()) 91 92 return nullptr; 92 93 if (equalIgnoringASCIICase(name, "EXT_blend_minmax")) { 94 if (!m_extBlendMinMax) { 95 m_extBlendMinMax = enableSupportedExtension("GL_EXT_blend_minmax") 96 ? std::make_unique<EXTBlendMinMax>(*this) : nullptr; 97 } 98 return m_extBlendMinMax.get(); 99 } 100 if (equalIgnoringASCIICase(name, "EXT_sRGB")) { 101 if (!m_extsRGB) { 102 m_extsRGB = enableSupportedExtension("GL_EXT_sRGB") 103 ? std::make_unique<EXTsRGB>(*this) : nullptr; 104 } 105 return m_extsRGB.get(); 106 } 107 if (equalIgnoringASCIICase(name, "EXT_frag_depth")) { 108 if (!m_extFragDepth) { 109 m_extFragDepth = enableSupportedExtension("GL_EXT_frag_depth") 110 ? std::make_unique<EXTFragDepth>(*this) : nullptr; 111 } 112 return m_extFragDepth.get(); 113 } 93 94 #define ENABLE_IF_REQUESTED(type, variable, nameLiteral, canEnable) \ 95 if (equalIgnoringASCIICase(name, nameLiteral)) { \ 96 if (!variable) { \ 97 variable = (canEnable) ? std::make_unique<type>(*this) : nullptr; \ 98 if (variable != nullptr) \ 99 InspectorInstrumentation::didEnableExtension(*this, name); \ 100 } \ 101 return variable.get(); \ 102 } 103 104 ENABLE_IF_REQUESTED(EXTBlendMinMax, m_extBlendMinMax, "EXT_blend_minmax", enableSupportedExtension("GL_EXT_blend_minmax")); 105 ENABLE_IF_REQUESTED(EXTsRGB, m_extsRGB, "EXT_sRGB", enableSupportedExtension("GL_EXT_sRGB")); 106 ENABLE_IF_REQUESTED(EXTFragDepth, m_extFragDepth, "EXT_frag_depth", enableSupportedExtension("GL_EXT_frag_depth")); 114 107 if (equalIgnoringASCIICase(name, "EXT_shader_texture_lod")) { 115 108 if (!m_extShaderTextureLOD) { … … 119 112 m_context->getExtensions().ensureEnabled(ASCIILiteral { "GL_EXT_shader_texture_lod" }); 120 113 m_extShaderTextureLOD = std::make_unique<EXTShaderTextureLOD>(*this); 114 InspectorInstrumentation::didEnableExtension(*this, name); 121 115 } 122 116 } 123 117 return m_extShaderTextureLOD.get(); 124 118 } 125 if (equalIgnoringASCIICase(name, "EXT_texture_filter_anisotropic") || equalIgnoringASCIICase(name, "WEBKIT_EXT_texture_filter_anisotropic")) { 126 if (!m_extTextureFilterAnisotropic) { 127 m_extTextureFilterAnisotropic = enableSupportedExtension("GL_EXT_texture_filter_anisotropic") 128 ? std::make_unique<EXTTextureFilterAnisotropic>(*this) : nullptr; 129 } 130 return m_extTextureFilterAnisotropic.get(); 131 } 132 if (equalIgnoringASCIICase(name, "OES_standard_derivatives")) { 133 if (!m_oesStandardDerivatives) { 134 m_oesStandardDerivatives = enableSupportedExtension("GL_OES_standard_derivatives") 135 ? std::make_unique<OESStandardDerivatives>(*this) : nullptr; 136 } 137 return m_oesStandardDerivatives.get(); 138 } 139 if (equalIgnoringASCIICase(name, "OES_texture_float")) { 140 if (!m_oesTextureFloat) { 141 m_oesTextureFloat = enableSupportedExtension("GL_OES_texture_float") 142 ? std::make_unique<OESTextureFloat>(*this) : nullptr; 143 } 144 return m_oesTextureFloat.get(); 145 } 146 if (equalIgnoringASCIICase(name, "OES_texture_float_linear")) { 147 if (!m_oesTextureFloatLinear) { 148 m_oesTextureFloatLinear = enableSupportedExtension("GL_OES_texture_float_linear") 149 ? std::make_unique<OESTextureFloatLinear>(*this) : nullptr; 150 } 151 return m_oesTextureFloatLinear.get(); 152 } 153 if (equalIgnoringASCIICase(name, "OES_texture_half_float")) { 154 if (!m_oesTextureHalfFloat) { 155 m_oesTextureHalfFloat = enableSupportedExtension("GL_OES_texture_half_float") 156 ? std::make_unique<OESTextureHalfFloat>(*this) : nullptr; 157 } 158 return m_oesTextureHalfFloat.get(); 159 } 160 if (equalIgnoringASCIICase(name, "OES_texture_half_float_linear")) { 161 if (!m_oesTextureHalfFloatLinear) { 162 m_oesTextureHalfFloatLinear = enableSupportedExtension("GL_OES_texture_half_float_linear") 163 ? std::make_unique<OESTextureHalfFloatLinear>(*this) : nullptr; 164 } 165 return m_oesTextureHalfFloatLinear.get(); 166 } 167 if (equalIgnoringASCIICase(name, "OES_vertex_array_object")) { 168 if (!m_oesVertexArrayObject) { 169 m_oesVertexArrayObject = enableSupportedExtension("GL_OES_vertex_array_object") 170 ? std::make_unique<OESVertexArrayObject>(*this) : nullptr; 171 } 172 return m_oesVertexArrayObject.get(); 173 } 174 if (equalIgnoringASCIICase(name, "OES_element_index_uint")) { 175 if (!m_oesElementIndexUint) { 176 m_oesElementIndexUint = enableSupportedExtension("GL_OES_element_index_uint") 177 ? std::make_unique<OESElementIndexUint>(*this) : nullptr; 178 } 179 return m_oesElementIndexUint.get(); 180 } 181 if (equalIgnoringASCIICase(name, "WEBGL_lose_context")) { 182 if (!m_webglLoseContext) 183 m_webglLoseContext = std::make_unique<WebGLLoseContext>(*this); 184 return m_webglLoseContext.get(); 185 } 186 if (equalIgnoringASCIICase(name, "WEBKIT_WEBGL_compressed_texture_atc")) { 187 if (!m_webglCompressedTextureATC) { 188 m_webglCompressedTextureATC = WebGLCompressedTextureATC::supported(*this) 189 ? std::make_unique<WebGLCompressedTextureATC>(*this) : nullptr; 190 } 191 return m_webglCompressedTextureATC.get(); 192 } 193 if (equalIgnoringASCIICase(name, "WEBKIT_WEBGL_compressed_texture_pvrtc")) { 194 if (!m_webglCompressedTexturePVRTC) { 195 m_webglCompressedTexturePVRTC = WebGLCompressedTexturePVRTC::supported(*this) 196 ? std::make_unique<WebGLCompressedTexturePVRTC>(*this) : nullptr; 197 } 198 return m_webglCompressedTexturePVRTC.get(); 199 } 200 if (equalIgnoringASCIICase(name, "WEBGL_compressed_texture_s3tc")) { 201 if (!m_webglCompressedTextureS3TC) { 202 m_webglCompressedTextureS3TC = WebGLCompressedTextureS3TC::supported(*this) 203 ? std::make_unique<WebGLCompressedTextureS3TC>(*this) : nullptr; 204 } 205 return m_webglCompressedTextureS3TC.get(); 206 } 207 if (equalIgnoringASCIICase(name, "WEBGL_depth_texture")) { 208 if (!m_webglDepthTexture) { 209 m_webglDepthTexture = WebGLDepthTexture::supported(*m_context) 210 ? std::make_unique<WebGLDepthTexture>(*this) : nullptr; 211 } 212 return m_webglDepthTexture.get(); 213 } 119 ENABLE_IF_REQUESTED(EXTTextureFilterAnisotropic, m_extTextureFilterAnisotropic, "EXT_texture_filter_anisotropic", enableSupportedExtension("GL_EXT_texture_filter_anisotropic")); 120 ENABLE_IF_REQUESTED(EXTTextureFilterAnisotropic, m_extTextureFilterAnisotropic, "WEBKIT_EXT_texture_filter_anisotropic", enableSupportedExtension("GL_EXT_texture_filter_anisotropic")); 121 ENABLE_IF_REQUESTED(OESStandardDerivatives, m_oesStandardDerivatives, "OES_standard_derivatives", enableSupportedExtension("GL_OES_standard_derivatives")); 122 ENABLE_IF_REQUESTED(OESTextureFloat, m_oesTextureFloat, "OES_texture_float", enableSupportedExtension("GL_OES_texture_float")); 123 ENABLE_IF_REQUESTED(OESTextureFloatLinear, m_oesTextureFloatLinear, "OES_texture_float_linear", enableSupportedExtension("GL_OES_texture_float_linear")); 124 ENABLE_IF_REQUESTED(OESTextureHalfFloat, m_oesTextureHalfFloat, "OES_texture_half_float", enableSupportedExtension("GL_OES_texture_half_float")); 125 ENABLE_IF_REQUESTED(OESTextureHalfFloatLinear, m_oesTextureHalfFloatLinear, "OES_texture_half_float_linear", enableSupportedExtension("GL_OES_texture_half_float_linear")); 126 ENABLE_IF_REQUESTED(OESVertexArrayObject, m_oesVertexArrayObject, "OES_vertex_array_object", enableSupportedExtension("GL_OES_vertex_array_object")); 127 ENABLE_IF_REQUESTED(OESElementIndexUint, m_oesElementIndexUint, "OES_element_index_uint", enableSupportedExtension("GL_OES_element_index_uint")); 128 ENABLE_IF_REQUESTED(WebGLLoseContext, m_webglLoseContext, "WEBGL_lose_context", true); 129 ENABLE_IF_REQUESTED(WebGLCompressedTextureATC, m_webglCompressedTextureATC, "WEBKIT_WEBGL_compressed_texture_atc", WebGLCompressedTextureATC::supported(*this)); 130 ENABLE_IF_REQUESTED(WebGLCompressedTexturePVRTC, m_webglCompressedTexturePVRTC, "WEBKIT_WEBGL_compressed_texture_pvrtc", WebGLCompressedTexturePVRTC::supported(*this)); 131 ENABLE_IF_REQUESTED(WebGLCompressedTextureS3TC, m_webglCompressedTextureS3TC, "WEBGL_compressed_texture_s3tc", WebGLCompressedTextureS3TC::supported(*this)); 132 ENABLE_IF_REQUESTED(WebGLDepthTexture, m_webglDepthTexture, "WEBGL_depth_texture", WebGLDepthTexture::supported(*m_context)); 214 133 if (equalIgnoringASCIICase(name, "WEBGL_draw_buffers")) { 215 134 if (!m_webglDrawBuffers) { … … 219 138 m_context->getExtensions().ensureEnabled(ASCIILiteral { "GL_EXT_draw_buffers" }); 220 139 m_webglDrawBuffers = std::make_unique<WebGLDrawBuffers>(*this); 140 InspectorInstrumentation::didEnableExtension(*this, name); 221 141 } 222 142 } … … 230 150 m_context->getExtensions().ensureEnabled(ASCIILiteral { "GL_ANGLE_instanced_arrays" }); 231 151 m_angleInstancedArrays = std::make_unique<ANGLEInstancedArrays>(*this); 152 InspectorInstrumentation::didEnableExtension(*this, name); 232 153 } 233 154 } 234 155 return m_angleInstancedArrays.get(); 235 156 } 236 if (equalIgnoringASCIICase(name, "WEBGL_debug_renderer_info")) { 237 if (!m_webglDebugRendererInfo) 238 m_webglDebugRendererInfo = std::make_unique<WebGLDebugRendererInfo>(*this); 239 return m_webglDebugRendererInfo.get(); 240 } 241 if (equalIgnoringASCIICase(name, "WEBGL_debug_shaders")) { 242 if (!m_webglDebugShaders) { 243 m_webglDebugShaders = m_context->getExtensions().supports(ASCIILiteral { "GL_ANGLE_translated_shader_source" }) 244 ? std::make_unique<WebGLDebugShaders>(*this) : nullptr; 245 } 246 return m_webglDebugShaders.get(); 247 } 248 157 ENABLE_IF_REQUESTED(WebGLDebugRendererInfo, m_webglDebugRendererInfo, "WEBGL_debug_renderer_info", true); 158 ENABLE_IF_REQUESTED(WebGLDebugShaders, m_webglDebugShaders, "WEBGL_debug_shaders", m_context->getExtensions().supports(ASCIILiteral { "GL_ANGLE_translated_shader_source" })); 249 159 return nullptr; 250 160 } -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r224236 r224370 2739 2739 return 0; 2740 2740 return m_context->getVertexAttribOffset(index, pname); 2741 } 2742 2743 bool WebGLRenderingContextBase::extensionIsEnabled(const String& name) 2744 { 2745 #define CHECK_EXTENSION(variable, nameLiteral) \ 2746 if (equalIgnoringASCIICase(name, nameLiteral)) \ 2747 return variable != nullptr; 2748 2749 CHECK_EXTENSION(m_extFragDepth, "EXT_frag_depth"); 2750 CHECK_EXTENSION(m_extBlendMinMax, "EXT_blend_minmax"); 2751 CHECK_EXTENSION(m_extsRGB, "EXT_sRGB"); 2752 CHECK_EXTENSION(m_extTextureFilterAnisotropic, "EXT_texture_filter_anisotropic"); 2753 CHECK_EXTENSION(m_extTextureFilterAnisotropic, "WEBKIT_EXT_texture_filter_anisotropic"); 2754 CHECK_EXTENSION(m_extShaderTextureLOD, "EXT_shader_texture_lod"); 2755 CHECK_EXTENSION(m_oesTextureFloat, "OES_texture_float"); 2756 CHECK_EXTENSION(m_oesTextureFloatLinear, "OES_texture_float_linear"); 2757 CHECK_EXTENSION(m_oesTextureHalfFloat, "OES_texture_half_float"); 2758 CHECK_EXTENSION(m_oesTextureHalfFloatLinear, "OES_texture_half_float_linear"); 2759 CHECK_EXTENSION(m_oesStandardDerivatives, "OES_standard_derivatives"); 2760 CHECK_EXTENSION(m_oesVertexArrayObject, "OES_vertex_array_object"); 2761 CHECK_EXTENSION(m_oesElementIndexUint, "OES_element_index_uint"); 2762 CHECK_EXTENSION(m_webglLoseContext, "WEBGL_lose_context"); 2763 CHECK_EXTENSION(m_webglDebugRendererInfo, "WEBGL_debug_renderer_info"); 2764 CHECK_EXTENSION(m_webglDebugShaders, "WEBGL_debug_shaders"); 2765 CHECK_EXTENSION(m_webglCompressedTextureATC, "WEBKIT_WEBGL_compressed_texture_atc"); 2766 CHECK_EXTENSION(m_webglCompressedTexturePVRTC, "WEBKIT_WEBGL_compressed_texture_pvrtc"); 2767 CHECK_EXTENSION(m_webglCompressedTextureS3TC, "WEBGL_compressed_texture_s3tc"); 2768 CHECK_EXTENSION(m_webglDepthTexture, "WEBGL_depth_texture"); 2769 CHECK_EXTENSION(m_webglDrawBuffers, "WEBGL_draw_buffers"); 2770 CHECK_EXTENSION(m_angleInstancedArrays, "ANGLE_instanced_arrays"); 2771 return false; 2741 2772 } 2742 2773 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r221971 r224370 211 211 long long getVertexAttribOffset(GC3Duint index, GC3Denum pname); 212 212 213 bool extensionIsEnabled(const String&); 214 213 215 bool isPreservingDrawingBuffer() const { return m_attributes.preserveDrawingBuffer; } 214 216 void setPreserveDrawingBuffer(bool value) { m_attributes.preserveDrawingBuffer = value; } -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r224002 r224370 1014 1014 1015 1015 #if ENABLE(WEBGL) 1016 void InspectorInstrumentation::didEnableExtensionImpl(InstrumentingAgents& instrumentingAgents, WebGLRenderingContextBase& context, const String& extension) 1017 { 1018 if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent()) 1019 canvasAgent->didEnableExtension(context, extension); 1020 } 1021 1016 1022 void InspectorInstrumentation::didCreateProgramImpl(InstrumentingAgents& instrumentingAgents, WebGLRenderingContextBase& context, WebGLProgram& program) 1017 1023 { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r224002 r224370 251 251 static void recordCanvasAction(CanvasRenderingContext&, const String&, Vector<RecordCanvasActionVariant>&& = { }); 252 252 static void didFinishRecordingCanvasFrame(HTMLCanvasElement&, bool forceDispatch = false); 253 254 253 #if ENABLE(WEBGL) 254 static void didEnableExtension(WebGLRenderingContextBase&, const String&); 255 255 static void didCreateProgram(WebGLRenderingContextBase&, WebGLProgram&); 256 256 static void willDeleteProgram(WebGLRenderingContextBase&, WebGLProgram&); … … 424 424 static void didFinishRecordingCanvasFrameImpl(InstrumentingAgents&, HTMLCanvasElement&, bool forceDispatch = false); 425 425 #if ENABLE(WEBGL) 426 static void didEnableExtensionImpl(InstrumentingAgents&, WebGLRenderingContextBase&, const String&); 426 427 static void didCreateProgramImpl(InstrumentingAgents&, WebGLRenderingContextBase&, WebGLProgram&); 427 428 static void willDeleteProgramImpl(InstrumentingAgents&, WebGLProgram&); … … 1203 1204 1204 1205 #if ENABLE(WEBGL) 1206 inline void InspectorInstrumentation::didEnableExtension(WebGLRenderingContextBase& context, const String& extension) 1207 { 1208 FAST_RETURN_IF_NO_FRONTENDS(void()); 1209 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(context.canvas().document())) 1210 didEnableExtensionImpl(*instrumentingAgents, context, extension); 1211 } 1212 1205 1213 inline void InspectorInstrumentation::didCreateProgram(WebGLRenderingContextBase& context, WebGLProgram& program) 1206 1214 { -
trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
r224345 r224370 96 96 97 97 const bool captureBacktrace = false; 98 for (auto& inspectorCanvas : m_identifierToInspectorCanvas.values()) 98 for (auto& inspectorCanvas : m_identifierToInspectorCanvas.values()) { 99 99 m_frontendDispatcher->canvasAdded(inspectorCanvas->buildObjectForCanvas(m_instrumentingAgents, captureBacktrace)); 100 101 #if ENABLE(WEBGL) 102 CanvasRenderingContext* context = inspectorCanvas->canvas().renderingContext(); 103 if (is<WebGLRenderingContextBase>(context)) { 104 WebGLRenderingContextBase* contextWebGL = downcast<WebGLRenderingContextBase>(context); 105 if (std::optional<Vector<String>> extensions = contextWebGL->getSupportedExtensions()) { 106 for (const String& extension : *extensions) { 107 if (contextWebGL->extensionIsEnabled(extension)) 108 m_frontendDispatcher->extensionEnabled(inspectorCanvas->identifier(), extension); 109 } 110 } 111 } 112 #endif 113 } 100 114 101 115 #if ENABLE(WEBGL) … … 509 523 510 524 #if ENABLE(WEBGL) 525 void InspectorCanvasAgent::didEnableExtension(WebGLRenderingContextBase& context, const String& extension) 526 { 527 auto* inspectorCanvas = findInspectorCanvas(context.canvas()); 528 if (!inspectorCanvas) 529 return; 530 531 m_frontendDispatcher->extensionEnabled(inspectorCanvas->identifier(), extension); 532 } 533 511 534 void InspectorCanvasAgent::didCreateProgram(WebGLRenderingContextBase& context, WebGLProgram& program) 512 535 { -
trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.h
r224345 r224370 89 89 void didFinishRecordingCanvasFrame(HTMLCanvasElement&, bool forceDispatch = false); 90 90 #if ENABLE(WEBGL) 91 void didEnableExtension(WebGLRenderingContextBase&, const String&); 91 92 void didCreateProgram(WebGLRenderingContextBase&, WebGLProgram&); 92 93 void willDeleteProgram(WebGLProgram&); -
trunk/Source/WebInspectorUI/ChangeLog
r224368 r224370 1 2017-11-02 Devin Rousso <webkit@devinrousso.com> 2 3 Web Inspector: Canvas Tab: show supported GL extensions for selected canvas 4 https://bugs.webkit.org/show_bug.cgi?id=179070 5 <rdar://problem/35278276> 6 7 Reviewed by Brian Burg. 8 9 * Localizations/en.lproj/localizedStrings.js: 10 11 * UserInterface/Protocol/CanvasObserver.js: 12 (WI.CanvasObserver.prototype.extensionEnabled): 13 14 * UserInterface/Controllers/CanvasManager.js: 15 (WI.CanvasManager.prototype.extensionEnabled): 16 17 * UserInterface/Models/Canvas.js: 18 (WI.Canvas.prototype.get extensions): 19 (WI.Canvas.prototype.enableExtension): 20 Maintain a Set of enabled extensions, and dispatch an event whenever an extension is enabled. 21 22 * UserInterface/Views/CanvasDetailsSidebarPanel.css: 23 (.sidebar > .panel.details.canvas .details-section.canvas-extensions .content > ul): 24 * UserInterface/Views/CanvasDetailsSidebarPanel.js: 25 (WI.CanvasDetailsSidebarPanel.prototype.set canvas): 26 (WI.CanvasDetailsSidebarPanel.prototype.initialLayout): 27 (WI.CanvasDetailsSidebarPanel.prototype.layout): 28 (WI.CanvasDetailsSidebarPanel.prototype._refreshAttributesSection): 29 (WI.CanvasDetailsSidebarPanel.prototype._refreshExtensionsSection): 30 Drive-by: hide Attributes section when the canvas has no attributes. 31 1 32 2017-11-02 Joseph Pecoraro <pecoraro@apple.com> 2 33 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r224368 r224370 396 396 localizedStrings["Expression"] = "Expression"; 397 397 localizedStrings["Extension Scripts"] = "Extension Scripts"; 398 localizedStrings["Extensions"] = "Extensions"; 398 399 localizedStrings["Extra Scripts"] = "Extra Scripts"; 399 400 localizedStrings["Fade unexecuted code"] = "Fade unexecuted code"; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
r224081 r224370 161 161 } 162 162 163 extensionEnabled(canvasIdentifier, extension) 164 { 165 // Called from WI.CanvasObserver. 166 167 let canvas = this._canvasIdentifierMap.get(canvasIdentifier); 168 console.assert(canvas); 169 if (!canvas) 170 return; 171 172 canvas.enableExtension(extension); 173 } 174 163 175 programCreated(canvasIdentifier, programIdentifier) 164 176 { -
trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js
r224142 r224370 40 40 this._cssCanvasName = cssCanvasName || ""; 41 41 this._contextAttributes = contextAttributes || {}; 42 this._extensions = new Set; 42 43 this._memoryCost = memoryCost || NaN; 43 44 this._backtrace = backtrace || []; … … 112 113 get cssCanvasName() { return this._cssCanvasName; } 113 114 get contextAttributes() { return this._contextAttributes; } 115 get extensions() { return this._extensions; } 114 116 get backtrace() { return this._backtrace; } 115 117 get shaderProgramCollection() { return this._shaderProgramCollection; } … … 266 268 } 267 269 270 enableExtension(extension) 271 { 272 // Called from WI.CanvasManager. 273 274 this._extensions.add(extension); 275 276 this.dispatchEventToListeners(WI.Canvas.Event.ExtensionEnabled, {extension}); 277 } 278 268 279 cssCanvasClientNodesChanged() 269 280 { … … 300 311 WI.Canvas.Event = { 301 312 MemoryChanged: "canvas-memory-changed", 313 ExtensionEnabled: "canvas-extension-enabled", 302 314 CSSCanvasClientNodesChanged: "canvas-css-canvas-client-nodes-changed", 303 315 }; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js
r220233 r224370 53 53 } 54 54 55 extensionEnabled(canvasId, extension) 56 { 57 WI.canvasManager.extensionEnabled(canvasId, extension); 58 } 59 55 60 programCreated(canvasId, programId) 56 61 { -
trunk/Source/WebInspectorUI/UserInterface/Views/CanvasDetailsSidebarPanel.css
r224142 r224370 28 28 } 29 29 30 .sidebar > .panel.details.canvas .details-section.canvas-extensions .content > ul { 31 margin: 4px 0; 32 -webkit-padding-start: 22.5px; 33 } 34 30 35 .sidebar > .panel.details.canvas .details-section.canvas-backtrace .call-frame { 31 36 margin: 3px; -
trunk/Source/WebInspectorUI/UserInterface/Views/CanvasDetailsSidebarPanel.js
r224142 r224370 78 78 if (this._canvas) { 79 79 this._canvas.removeEventListener(WI.Canvas.Event.MemoryChanged, this._canvasMemoryChanged, this); 80 this._canvas.removeEventListener(WI.Canvas.Event.ExtensionEnabled, this._refreshExtensionsSection, this); 80 81 this._canvas.removeEventListener(WI.Canvas.Event.CSSCanvasClientNodesChanged, this._refreshCSSCanvasSection, this); 81 82 } … … 85 86 if (this._canvas) { 86 87 this._canvas.addEventListener(WI.Canvas.Event.MemoryChanged, this._canvasMemoryChanged, this); 88 this._canvas.addEventListener(WI.Canvas.Event.ExtensionEnabled, this._refreshExtensionsSection, this); 87 89 this._canvas.addEventListener(WI.Canvas.Event.CSSCanvasClientNodesChanged, this._refreshCSSCanvasSection, this); 88 90 } … … 118 120 this._attributesDataGridRow = new WI.DetailsSectionDataGridRow(null, WI.UIString("No Attributes")); 119 121 120 let attributesSection = new WI.DetailsSection("canvas-attributes", WI.UIString("Attributes")); 121 attributesSection.groups = [new WI.DetailsSectionGroup([this._attributesDataGridRow])]; 122 this._sections.push(attributesSection); 122 this._attributesSection = new WI.DetailsSection("canvas-attributes", WI.UIString("Attributes")); 123 this._attributesSection.groups = [new WI.DetailsSectionGroup([this._attributesDataGridRow])]; 124 this._attributesSection.element.hidden = true; 125 this._sections.push(this._attributesSection); 126 127 this._extensionsSection = new WI.DetailsSection("canvas-extensions", WI.UIString("Extensions")); 128 this._extensionsSection.element.hidden = true; 129 this._sections.push(this._extensionsSection); 123 130 124 131 this._cssCanvasClientsRow = new WI.DetailsSectionSimpleRow(WI.UIString("Nodes")); … … 157 164 this._refreshSourceSection(); 158 165 this._refreshAttributesSection(); 166 this._refreshExtensionsSection(); 159 167 this._refreshCSSCanvasSection(); 160 168 this._refreshBacktraceSection(); … … 245 253 _refreshAttributesSection() 246 254 { 247 if (isEmptyObject(this._canvas.contextAttributes)) { 248 // Remove the DataGrid to show the placeholder text. 249 this._attributesDataGridRow.dataGrid = null; 250 return; 251 } 255 let hasAttributes = !isEmptyObject(this._canvas.contextAttributes); 256 this._attributesSection.element.hidden = !hasAttributes; 257 if (!hasAttributes) 258 return; 252 259 253 260 let dataGrid = this._attributesDataGridRow.dataGrid; … … 270 277 } 271 278 279 _refreshExtensionsSection() 280 { 281 let hasEnabledExtensions = this._canvas.extensions.size > 0; 282 this._extensionsSection.element.hidden = !hasEnabledExtensions; 283 if (!hasEnabledExtensions) 284 return; 285 286 let element = document.createElement("ul"); 287 for (let extension of this._canvas.extensions) { 288 let listElement = element.appendChild(document.createElement("li")); 289 listElement.textContent = extension; 290 } 291 this._extensionsSection.groups = [{element}]; 292 } 293 272 294 _refreshCSSCanvasSection() 273 295 {
Note: See TracChangeset
for help on using the changeset viewer.