LayaAir icon indicating copy to clipboard operation
LayaAir copied to clipboard

在一些仅支持WebGL 1.0设备上多光源支持会crash

Open yukunxie opened this issue 4 years ago • 1 comments

如是: Meizu MX3 仅支持WebGL 1.0,具有float texture的扩展,使用多光源支持时直接crash

使用shadowmap,显示异常,也和float texture有关。

case TextureFormat.R32G32B32A32:
	if (LayaGL.layaGPUInstance._isWebGL2)
		gl.texImage2D(textureType, miplevel, (<WebGL2RenderingContext>gl).RGBA32F, width, height, 0, glFormat, gl.FLOAT, pixels);
       else
		gl.texImage2D(textureType, miplevel, gl.RGBA, width, height, 0, glFormat, gl.FLOAT, pixels);
break;

上述代码中有问题,在非WebGL 2的设备上,texImage2D的type参数不能为gl.FLOAT,应该是gl.UNSIGNED_BYTE

另外,还需要判断一下float texture的扩展。

yukunxie avatar Jul 23 '20 03:07 yukunxie

我们判断了扩展 如果扩展没过就不会走到这里,这个glFloat,如果换成unDigned_Byte位数不够表达这种纹理,代表纹理是浮点数的纹理,meizuMX3机型有点旧了,具体问题得具体查了,这个组合在其他的机器上是没有问题的,目前已知只在您说的这个机型上出问题

lirongf avatar Aug 20 '20 02:08 lirongf