URP打包安卓到花屏问题

https://blog.uwa4d.com/archives/TechSharing_198.html
https://blog.uwa4d.com/archives/UWA_GOLOverview.html // GPU性能测试
用到了renderfeature,发现打包到安卓真机上会出现花屏,网上搜资料说是Don‘ care的问题,有点地方还真的可不能不care,要care的,把care方式设为true就好了

解决方案

// cmd.ClearRenderTarget(true, false, Color.clear);
   cmd.ClearRenderTarget(true, true, Color.clear);

在这里插入图片描述

备注

unity有两种方式设置RenderTarget,一种是

cmd.SetRenderTarget(temporaryRTId);
cmd.ClearRenderTarget(true, true, Color.clear);

还有一种是

buffer.SetRenderTarget(
            colorBuffer, 
            RenderBufferLoadAction.DontCare, RenderBufferStoreAction.DontCare,
            depthStencilBuffer,
            RenderBufferLoadAction.DontCare, RenderBufferStoreAction.DontCare);

这种方式貌似不能设置clear
然后灵活运用 DontCare, Load 和 Store,对性能能有成倍的优化

还可以结合起来使用

buffer.SetRenderTarget(
            colorBuffer, 
            RenderBufferLoadAction.DontCare, RenderBufferStoreAction.DontCare,
            depthStencilBuffer,
            RenderBufferLoadAction.DontCare, RenderBufferStoreAction.DontCare);
cmd.ClearRenderTarget(true, true, Color.clear);

模拟器花屏

模板测试在模拟器上会有问题,尝试用alpha通道替代模板测试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值