浏览代码

Merge pull request #350 from UnityTech/addglobalconfig

Addglobalconfig
/main
GitHub 5 年前
当前提交
e5e5a8a8
共有 6 个文件被更改,包括 58 次插入5 次删除
  1. 5
      Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_shader_initializer.cs
  2. 11
      Runtime/ui/renderer/compositeCanvas/flow/raster_cache.cs
  3. 4
      Runtime/ui/window.cs
  4. 1
      Samples/UIWidgetsGallery/GalleryMain.cs
  5. 31
      Runtime/editor/window_config.cs
  6. 11
      Runtime/editor/window_config.cs.meta

5
Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_shader_initializer.cs


using Unity.UIWidgets.editor;
const bool enableComputeBuffer = false;
const bool enableDebugLog = false;
public static bool supportComputeBuffer;

}
static void InitShaders() {
supportComputeBuffer = enableComputeBuffer && SystemInfo.supportsComputeShaders && IsShaderSupported();
supportComputeBuffer = !WindowConfig.disableComputeBuffer && SystemInfo.supportsComputeShaders && IsShaderSupported();
if (!supportComputeBuffer) {
DebugAssert(false, "init default shaders");

11
Runtime/ui/renderer/compositeCanvas/flow/raster_cache.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;

return false;
}
if (Window.instance.windowConfig.disableRasterCache) {
return false;
}
var bounds = picture.paintBounds;
if (bounds.isEmpty) {
return false;

}
if (picture.isDynamic) {
return false;
}
//https://forum.unity.com/threads/rendertexture-create-failed-rendertexture-too-big.58667/
if (picture.paintBounds.size.width > WindowConfig.MaxRasterImageSize ||
picture.paintBounds.size.height > WindowConfig.MaxRasterImageSize) {
return false;
}

4
Runtime/ui/window.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.async;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;
using UnityEngine;

protected int _antiAliasing = defaultAntiAliasing;
public WindowConfig windowConfig = WindowConfig.defaultConfig;
protected Size _physicalSize = Size.zero;

1
Samples/UIWidgetsGallery/GalleryMain.cs


using UIWidgetsGallery.gallery;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.material;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;

31
Runtime/editor/window_config.cs


using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.editor {
public class WindowConfig {
public readonly bool disableRasterCache;
public static float MaxRasterImageSize = 4096;
static bool? _disableComputeBuffer = null;
public static bool disableComputeBuffer {
//disable compute buffer by default for now
get { return _disableComputeBuffer ?? true; }
set {
D.assert(_disableComputeBuffer == null
|| _disableComputeBuffer == value
, () => "The global settings of [disableComputeBuffer] cannot be initiated for multiple times!");
_disableComputeBuffer = value;
}
}
public WindowConfig(bool disableRasterCache) {
this.disableRasterCache = disableRasterCache;
}
public static readonly WindowConfig defaultConfig = new WindowConfig(
disableRasterCache: false
);
}
}

11
Runtime/editor/window_config.cs.meta


fileFormatVersion: 2
guid: b07028e6b697b43e4a5911da0ab9ca54
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存