mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 19:12:40 +08:00
ban webgl2
This commit is contained in:
+1
-1
@@ -691,7 +691,7 @@ class Game extends EventTarget {
|
||||
}
|
||||
}
|
||||
|
||||
// useWebGL2 = false;
|
||||
useWebGL2 = false;
|
||||
if (useWebGL2) {
|
||||
this._gfxDevice = new cc.WebGL2GFXDevice();
|
||||
} else {
|
||||
|
||||
@@ -556,8 +556,8 @@ class View extends EventTarget {
|
||||
var canvas = cc.game.canvas;
|
||||
var container = cc.game.container;
|
||||
|
||||
canvas.width = width * this._devicePixelRatio;
|
||||
canvas.height = height * this._devicePixelRatio;
|
||||
// canvas.width = width * this._devicePixelRatio;
|
||||
// canvas.height = height * this._devicePixelRatio;
|
||||
|
||||
canvas.style.width = width + 'px';
|
||||
canvas.style.height = height + 'px';
|
||||
|
||||
@@ -117,6 +117,8 @@ export class WebGLGFXCommandBuffer extends GFXCommandBuffer {
|
||||
this._curDepthBounds = null;
|
||||
this._curStencilWriteMask = null;
|
||||
this._curStencilCompareMask = null;
|
||||
this._numDrawCalls = 0;
|
||||
this._numTris = 0;
|
||||
}
|
||||
|
||||
public end () {
|
||||
@@ -341,11 +343,25 @@ export class WebGLGFXCommandBuffer extends GFXCommandBuffer {
|
||||
|
||||
const cmd = ( this._allocator as WebGLGFXCommandAllocator).
|
||||
drawCmdPool.alloc(WebGLCmdDraw);
|
||||
if (cmd) {
|
||||
(inputAssembler as WebGLGFXInputAssembler).extractCmdDraw(cmd);
|
||||
this.cmdPackage.drawCmds.push(cmd);
|
||||
(inputAssembler as WebGLGFXInputAssembler).extractCmdDraw(cmd);
|
||||
this.cmdPackage.drawCmds.push(cmd);
|
||||
|
||||
this.cmdPackage.cmds.push(WebGLCmd.DRAW);
|
||||
this.cmdPackage.cmds.push(WebGLCmd.DRAW);
|
||||
|
||||
++this._numDrawCalls;
|
||||
if (this._curGPUPipelineState) {
|
||||
const glPrimitive = this._curGPUPipelineState.glPrimitive;
|
||||
switch (glPrimitive) {
|
||||
case WebGL2RenderingContext.TRIANGLES: {
|
||||
this._numTris += inputAssembler.indexCount / 3 * inputAssembler.instanceCount;
|
||||
break;
|
||||
}
|
||||
case WebGL2RenderingContext.TRIANGLE_STRIP:
|
||||
case WebGL2RenderingContext.TRIANGLE_FAN: {
|
||||
this._numTris += (inputAssembler.indexCount - 2) * inputAssembler.instanceCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.error('Command \'draw\' must be recorded inside a render pass.');
|
||||
@@ -449,6 +465,9 @@ export class WebGLGFXCommandBuffer extends GFXCommandBuffer {
|
||||
}
|
||||
|
||||
this.cmdPackage.cmds.concat(webGLCmdBuff.cmdPackage.cmds);
|
||||
|
||||
this._numDrawCalls += webGLCmdBuff._numDrawCalls;
|
||||
this._numTris += webGLCmdBuff._numTris;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ export abstract class RenderPipeline {
|
||||
console.info('USE_SMAA: ' + this._useSMAA);
|
||||
console.info('CC_USE_HDR: ' + this._isHDR);
|
||||
console.info('SHADING_SIZE: ' + this._shadingWidth + ' x ' + this._shadingHeight);
|
||||
console.info('SCREEN_SCALE: ' + this._shadingScale.toFixed(2));
|
||||
console.info('SHADING_SCALE: ' + this._shadingScale.toFixed(2));
|
||||
console.info('SHADING_COLOR_FORMAT: ' + GFXFormatInfos[this._colorFmt].name);
|
||||
console.info('SHADING_DEPTH_FORMAT: ' + GFXFormatInfos[this._depthStencilFmt].name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user