Skip to content

Commit

Permalink
fix WebGL Unsupported Format,convert to WebGL format failed for v3.3.0 (
Browse files Browse the repository at this point in the history
cocos#9063)

* fix WebGL not support HalfFloat texture

* use device.gfxAPI to decide texture format

* update
  • Loading branch information
troublemaker52025 authored Jul 26, 2021
1 parent af76745 commit 6004305
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cocos/core/pipeline/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { SubModel } from '../renderer/scene/submodel';
import { Layers } from '../scene-graph/layers';
import { legacyCC } from '../global-exports';
import { BindingMappingInfo, DescriptorType, Type, ShaderStageFlagBit,
DescriptorSetLayoutBinding, Uniform, UniformBlock, UniformSamplerTexture, UniformStorageImage, Device, Feature } from '../gfx';
DescriptorSetLayoutBinding, Uniform, UniformBlock, UniformSamplerTexture, UniformStorageImage, Device, Feature, API } from '../gfx';

export const PIPELINE_FLOW_GBUFFER = 'GbufferFlow';
export const PIPELINE_FLOW_LIGHTING = 'LightingFlow';
Expand Down Expand Up @@ -584,7 +584,9 @@ export const MODEL_ALWAYS_MASK = Layers.Enum.ALL;
* @zh 当前设备是否支持半浮点贴图?(颜色输出和采样)
*/
export function supportsHalfFloatTexture (device: Device) {
return device.hasFeature(Feature.COLOR_HALF_FLOAT) && device.hasFeature(Feature.TEXTURE_HALF_FLOAT);
return device.hasFeature(Feature.COLOR_HALF_FLOAT)
&& device.hasFeature(Feature.TEXTURE_HALF_FLOAT)
&& !(device.gfxAPI === API.WEBGL); // wegl 1 Single-channel float type is not supported under webgl1, so it is excluded
}

/* eslint-enable max-len */

0 comments on commit 6004305

Please sign in to comment.