Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在URP中fairyGUI不能开启SRP Batcher的优化 #212

Open
lumieru opened this issue Aug 31, 2023 · 3 comments
Open

在URP中fairyGUI不能开启SRP Batcher的优化 #212

lumieru opened this issue Aug 31, 2023 · 3 comments

Comments

@lumieru
Copy link

lumieru commented Aug 31, 2023

有好几个shader显示不是SRP Batcher compatible的,具体如下:
FairyGUI-TMP: Material property is found in another cbuffer than "UnityPerMaterial" (_FaceUVSpeedX)
FairyGUI-Image: UnityPerMaterial var is not declared in shader property section (_ClipBox)
FairyGUI-Text: UnityPerMaterial var is not declared in shader property section(_ClipBox)

@SunHowe
Copy link

SunHowe commented Mar 12, 2024

可根据提示自行修改。改动原则:

  1. cbuffer包含的字段需要暴露在Properties下
  2. cbuffer包含的字段不允许使用宏定义声明(会破坏数据布局)

例如FariyGUI-Image的改动:

Properties
{
     // ....
     // 省略原本就声明的属性

     _ClipBox ("ClipBox", Vector) = (-2, -2, 0, 0)
     _ClipSoftness ("ClipSoftness", Vector) = (0, 0, 0, 0)
}

SubShader
{
    // 下面将CLIPPED和SOFTCLIPPED的宏定义去除,直接声明这两个字段,vert函数内的宏定义保留
    CBUFFER_START(UnityPerMaterial)
    // #ifdef CLIPPED
    // float4 _ClipBox = float4(-2, -2, 0, 0);
    // #endif
    
    // #ifdef SOFT_CLIPPED
    float4 _ClipBox = float4(-2, -2, 0, 0);
    float4 _ClipSoftness = float4(0, 0, 0, 0);
    // #endif
    CBUFFER_END
}

@xiaoguzhu
Copy link
Member

我们不支持SPR Batcher的,开启了会导致渲染错误。

@SunHowe
Copy link

SunHowe commented Mar 19, 2024

我们不支持SPR Batcher的,开启了会导致渲染错误。

哦哦 好的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants