This repository was archived by the owner on Apr 29, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
cmdbufferCanvas/rendering Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using Unity . UIWidgets . foundation ;
2+
3+ namespace Unity . UIWidgets . editor {
4+ public class WindowConfig {
5+ public readonly bool disableRasterCache ;
6+
7+ static bool ? _disableComputeBuffer = null ;
8+
9+ public static bool disableComputeBuffer {
10+ //disable compute buffer by default for now
11+ get { return _disableComputeBuffer ?? true ; }
12+ set {
13+ D . assert ( _disableComputeBuffer == null
14+ || _disableComputeBuffer == value
15+ , ( ) => "The global settings of [disableComputeBuffer] cannot be initiated for multiple times!" ) ;
16+
17+ _disableComputeBuffer = value ;
18+ }
19+ }
20+
21+ public WindowConfig ( bool disableRasterCache ) {
22+ this . disableRasterCache = disableRasterCache ;
23+ }
24+
25+ public static readonly WindowConfig defaultConfig = new WindowConfig (
26+ disableRasterCache : false
27+ ) ;
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ using Unity . UIWidgets . editor ;
12using UnityEngine ;
23using UnityEngine . Rendering ;
34
45namespace Unity . UIWidgets . ui {
56 static partial class CanvasShader {
6- const bool enableComputeBuffer = false ;
7-
87 const bool enableDebugLog = false ;
98
109 public static bool supportComputeBuffer ;
@@ -22,7 +21,7 @@ static bool IsShaderSupported() {
2221 }
2322
2423 static void InitShaders ( ) {
25- supportComputeBuffer = enableComputeBuffer && SystemInfo . supportsComputeShaders && IsShaderSupported ( ) ;
24+ supportComputeBuffer = ! WindowConfig . disableComputeBuffer && SystemInfo . supportsComputeShaders && IsShaderSupported ( ) ;
2625
2726 if ( ! supportComputeBuffer ) {
2827 DebugAssert ( false , "init default shaders" ) ;
Original file line number Diff line number Diff line change @@ -210,6 +210,10 @@ static bool _canRasterizePicture(Picture picture) {
210210 return false ;
211211 }
212212
213+ if ( Window . instance . windowConfig . disableRasterCache ) {
214+ return false ;
215+ }
216+
213217 var bounds = picture . paintBounds ;
214218 if ( bounds . isEmpty ) {
215219 return false ;
@@ -223,6 +227,12 @@ static bool _canRasterizePicture(Picture picture) {
223227 return false ;
224228 }
225229
230+ //https://forum.unity.com/threads/rendertexture-create-failed-rendertexture-too-big.58667/
231+ if ( picture . paintBounds . size . width > 4096 ||
232+ picture . paintBounds . size . height > 4096 ) {
233+ return false ;
234+ }
235+
226236 return true ;
227237 }
228238
Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using Unity . UIWidgets . async ;
4+ using Unity . UIWidgets . editor ;
45using Unity . UIWidgets . foundation ;
56using UnityEngine ;
67
@@ -148,11 +149,12 @@ public int antiAliasing {
148149
149150 protected int _antiAliasing = defaultAntiAliasing ;
150151
151-
152152 public Size physicalSize {
153153 get { return this . _physicalSize ; }
154154 }
155155
156+ public WindowConfig windowConfig = WindowConfig . defaultConfig ;
157+
156158 protected Size _physicalSize = Size . zero ;
157159
158160 public WindowPadding viewInsets {
Original file line number Diff line number Diff line change 11using UIWidgetsGallery . gallery ;
22using Unity . UIWidgets . engine ;
3- using Unity . UIWidgets . material ;
43using Unity . UIWidgets . ui ;
54using Unity . UIWidgets . widgets ;
65using UnityEngine ;
You can’t perform that action at this time.
0 commit comments