From d7aaaa7397da150afd7ed4b90553fa0e4d34ea13 Mon Sep 17 00:00:00 2001 From: Leslie Leigh Date: Fri, 22 Mar 2019 10:44:47 +0800 Subject: [PATCH] remove webgl-debug (#4083) --- @types/globals.d.ts | 14 -------------- cocos/gfx/webgl/webgl-device.ts | 10 ---------- cocos/gfx/webgl2/webgl2-device.ts | 10 ---------- package.json | 1 - rollup/build-engine.ts | 1 - rollup/config.js | 1 - 6 files changed, 37 deletions(-) diff --git a/@types/globals.d.ts b/@types/globals.d.ts index f20413f610..e757981580 100644 --- a/@types/globals.d.ts +++ b/@types/globals.d.ts @@ -57,20 +57,6 @@ declare interface IWritableArrayLike { [index: number]: T; } -declare module "webgl-debug" { - export function makeDebugContext( - webGLRenderingContext: WebGLRenderingContext, - throwOnGLError: (err: GLenum, funcName: string, ...args: any[]) => void - ): WebGLRenderingContext; - - export function makeDebugContext( - webGL2RenderingContext: WebGL2RenderingContext, - throwOnGLError: (err: GLenum, funcName: string, ...args: any[]) => void - ): WebGL2RenderingContext; - - export function glEnumToString(glEnum: GLenum): string; -} - declare namespace Editor { function log (message?: any, ...optionalParams: any[]): void; function error (message?: any, ...optionalParams: any[]): void; diff --git a/cocos/gfx/webgl/webgl-device.ts b/cocos/gfx/webgl/webgl-device.ts index ef7968db16..136329f720 100644 --- a/cocos/gfx/webgl/webgl-device.ts +++ b/cocos/gfx/webgl/webgl-device.ts @@ -1,4 +1,3 @@ -import * as WebGLDeveloperTools from 'webgl-debug'; import { GFXBindingLayout, IGFXBindingLayoutInfo } from '../binding-layout'; import { GFXBuffer, IGFXBufferInfo } from '../buffer'; import { GFXCommandAllocator, IGFXCommandAllocatorInfo } from '../command-allocator'; @@ -193,11 +192,6 @@ export class WebGLGFXDevice extends GFXDevice { }; this._webGLRC = this._canvas.getContext('webgl', webGLCtxAttribs); - /* - if (this._webGLRC && info.debug) { - this._webGLRC = WebGLDeveloperTools.makeDebugContext(this._webGLRC, this._onWebGLError.bind(this)); - } - */ } catch (err) { console.error(err); return false; @@ -558,8 +552,4 @@ export class WebGLGFXDevice extends GFXDevice { gl.colorMask(true, true, true, true); gl.blendColor(0.0, 0.0, 0.0, 0.0); } - - private _onWebGLError (error: GLenum, functionName: string, ...args: any[]) { - throw new Error(`${WebGLDeveloperTools.glEnumToString(error)} was caused by call to ${functionName}`); - } } diff --git a/cocos/gfx/webgl2/webgl2-device.ts b/cocos/gfx/webgl2/webgl2-device.ts index 9b1a68b871..80a59ca809 100644 --- a/cocos/gfx/webgl2/webgl2-device.ts +++ b/cocos/gfx/webgl2/webgl2-device.ts @@ -1,4 +1,3 @@ -import * as WebGLDeveloperTools from 'webgl-debug'; import { GFXBindingLayout, IGFXBindingLayoutInfo } from '../binding-layout'; import { GFXBuffer, IGFXBufferInfo } from '../buffer'; import { GFXCommandAllocator, IGFXCommandAllocatorInfo } from '../command-allocator'; @@ -119,11 +118,6 @@ export class WebGL2GFXDevice extends GFXDevice { }; this._webGL2RC = this._canvas.getContext('webgl2', webGLCtxAttribs); - /* - if (this._webGL2RC && info.debug) { - this._webGL2RC = WebGLDeveloperTools.makeDebugContext(this._webGL2RC, this._onWebGLError.bind(this)); - } - */ } catch (err) { console.error(err); return false; @@ -479,8 +473,4 @@ export class WebGL2GFXDevice extends GFXDevice { gl.colorMask(true, true, true, true); gl.blendColor(0.0, 0.0, 0.0, 0.0); } - - private _onWebGLError (error: GLenum, functionName: string, ...args: any[]) { - throw new Error(`${WebGLDeveloperTools.glEnumToString(error)} was caused by call to ${functionName}`); - } } diff --git a/package.json b/package.json index 260ff92bea..103f3d28de 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,6 @@ "vinyl-buffer": "1.0.0", "vinyl-source-stream": "1.0.0", "watchify": "^3.7.0", - "webgl-debug": "github:cocos-creator/webgl-debug#f7f7f90", "yargs": "^12.0.5" } } diff --git a/rollup/build-engine.ts b/rollup/build-engine.ts index 7586926293..4a437caf29 100644 --- a/rollup/build-engine.ts +++ b/rollup/build-engine.ts @@ -66,7 +66,6 @@ async function _doBundle (options: IBuildOptions) { commonjs({ namedExports: { cannon: ['CANNON', 'Shape'], - 'webgl-debug': ['makeDebugContext', 'glEnumToString'], }, }), ]; diff --git a/rollup/config.js b/rollup/config.js index 0aa5009faf..e7f9731714 100644 --- a/rollup/config.js +++ b/rollup/config.js @@ -63,7 +63,6 @@ export default { commonjs({ namedExports: { 'cannon': ['CANNON'], - 'webgl-debug': ['makeDebugContext', 'glEnumToString'] } }), ]