This repository was archived by the owner on Apr 29, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +44
-5
lines changed
cmdbufferCanvas/rendering Expand file tree Collapse file tree 5 files changed +44
-5
lines changed 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 ;
1
2
using UnityEngine ;
2
3
using UnityEngine . Rendering ;
3
4
4
5
namespace Unity . UIWidgets . ui {
5
6
static partial class CanvasShader {
6
- const bool enableComputeBuffer = false ;
7
-
8
7
const bool enableDebugLog = false ;
9
8
10
9
public static bool supportComputeBuffer ;
@@ -22,7 +21,7 @@ static bool IsShaderSupported() {
22
21
}
23
22
24
23
static void InitShaders ( ) {
25
- supportComputeBuffer = enableComputeBuffer && SystemInfo . supportsComputeShaders && IsShaderSupported ( ) ;
24
+ supportComputeBuffer = ! WindowConfig . disableComputeBuffer && SystemInfo . supportsComputeShaders && IsShaderSupported ( ) ;
26
25
27
26
if ( ! supportComputeBuffer ) {
28
27
DebugAssert ( false , "init default shaders" ) ;
Original file line number Diff line number Diff line change @@ -210,6 +210,10 @@ static bool _canRasterizePicture(Picture picture) {
210
210
return false ;
211
211
}
212
212
213
+ if ( Window . instance . windowConfig . disableRasterCache ) {
214
+ return false ;
215
+ }
216
+
213
217
var bounds = picture . paintBounds ;
214
218
if ( bounds . isEmpty ) {
215
219
return false ;
@@ -223,6 +227,12 @@ static bool _canRasterizePicture(Picture picture) {
223
227
return false ;
224
228
}
225
229
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
+
226
236
return true ;
227
237
}
228
238
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using Unity . UIWidgets . async ;
4
+ using Unity . UIWidgets . editor ;
4
5
using Unity . UIWidgets . foundation ;
5
6
using UnityEngine ;
6
7
@@ -148,11 +149,12 @@ public int antiAliasing {
148
149
149
150
protected int _antiAliasing = defaultAntiAliasing ;
150
151
151
-
152
152
public Size physicalSize {
153
153
get { return this . _physicalSize ; }
154
154
}
155
155
156
+ public WindowConfig windowConfig = WindowConfig . defaultConfig ;
157
+
156
158
protected Size _physicalSize = Size . zero ;
157
159
158
160
public WindowPadding viewInsets {
Original file line number Diff line number Diff line change 1
1
using UIWidgetsGallery . gallery ;
2
2
using Unity . UIWidgets . engine ;
3
- using Unity . UIWidgets . material ;
4
3
using Unity . UIWidgets . ui ;
5
4
using Unity . UIWidgets . widgets ;
6
5
using UnityEngine ;
You can’t perform that action at this time.
0 commit comments