Skip to content

Commit

Permalink
fix : nx shader bug
Browse files Browse the repository at this point in the history
  • Loading branch information
YunHsiao committed Mar 29, 2022
1 parent de1c34a commit e395f6a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions cocos/core/pipeline/render-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ export abstract class RenderPipeline extends Asset implements IPipelineEvent {
str += `#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT ${this.device.hasFeature(Feature.INPUT_ATTACHMENT_BENEFIT) ? 1 : 0}\n`;
str += `#define CC_PLATFORM_ANDROID_AND_WEBGL ${systemInfo.os === OS.ANDROID && systemInfo.isBrowser ? 1 : 0}\n`;
str += `#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES ${macro.ENABLE_WEBGL_HIGHP_STRUCT_VALUES ? 1 : 0}\n`;
str += `#define CC_PLATFORM_NX 0\n`;
this._constantMacros = str;
}

Expand Down
4 changes: 3 additions & 1 deletion editor/assets/chunks/cc-skinning.chunk
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.

#pragma extension([GL_EXT_shader_explicit_arithmetic_types_int32, __VERSION__ > 310, require])
#if !CC_PLATFORM_NX
#pragma extension([GL_EXT_shader_explicit_arithmetic_types_int32, __VERSION__ > 310, require])
#endif

#include <common>

Expand Down
11 changes: 8 additions & 3 deletions editor/assets/chunks/decode-base.chunk
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ layout(location = 3) in vec4 a_tangent;

#if CC_USE_SKINNING
#if __VERSION__ > 310
// strictly speaking this should be u16vec4, but due to poor driver support
// somehow it seems we can get better results on many platforms using u32vec4
layout(location = 4) in u32vec4 a_joints;
#if !CC_PLATFORM_NX
// strictly speaking this should be u16vec4, but due to poor driver support
// somehow it seems we can get better results on many platforms using u32vec4
layout(location = 4) in u32vec4 a_joints;
#else
#pragma format(RGBA16UI)
layout(location = 4) in vec4 a_joints;
#endif
#else
#pragma format(RGBA16UI)
layout(location = 4) in vec4 a_joints;
Expand Down

0 comments on commit e395f6a

Please sign in to comment.