还原水插件
This commit is contained in:
@@ -2,15 +2,10 @@
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
using UnityEngine.Rendering;
|
||||
using WaveHarmonic.Crest.Internal;
|
||||
using WaveHarmonic.Crest.Utility;
|
||||
|
||||
#if !UNITY_6000_0_OR_NEWER
|
||||
using GraphicsFormatUsage = UnityEngine.Experimental.Rendering.FormatUsage;
|
||||
#endif
|
||||
|
||||
namespace WaveHarmonic.Crest
|
||||
{
|
||||
/// <summary>
|
||||
@@ -363,17 +358,16 @@ namespace WaveHarmonic.Crest
|
||||
return texture != null &&
|
||||
texture.width != _Resolution ||
|
||||
texture.height != _Resolution ||
|
||||
texture.graphicsFormat != (target ? SystemInfo.GetGraphicsFormat(DefaultFormat.DepthStencil) : FinalFormat);
|
||||
texture.format != (target ? RenderTextureFormat.Depth : FinalFormat);
|
||||
}
|
||||
|
||||
GraphicsFormat FinalFormat => _GenerateSignedDistanceField ? Helpers.GetCompatibleTextureFormat(GraphicsFormat.R32G32_SFloat, true) : GraphicsFormat.R32_SFloat;
|
||||
RenderTextureFormat FinalFormat => _GenerateSignedDistanceField ? RenderTextureFormat.RGFloat : RenderTextureFormat.RFloat;
|
||||
|
||||
void MakeRT(RenderTexture texture, bool target)
|
||||
{
|
||||
var format = target ? SystemInfo.GetGraphicsFormat(DefaultFormat.DepthStencil) : FinalFormat;
|
||||
var format = target ? RenderTextureFormat.Depth : FinalFormat;
|
||||
var descriptor = texture.descriptor;
|
||||
descriptor.graphicsFormat = target ? GraphicsFormat.None : format;
|
||||
descriptor.depthStencilFormat = target ? format : GraphicsFormat.None;
|
||||
descriptor.colorFormat = format;
|
||||
descriptor.width = descriptor.height = _Resolution;
|
||||
descriptor.depthBufferBits = target ? 24 : 0;
|
||||
descriptor.useMipMap = false;
|
||||
@@ -381,11 +375,7 @@ namespace WaveHarmonic.Crest
|
||||
descriptor.enableRandomWrite = !target;
|
||||
texture.descriptor = descriptor;
|
||||
texture.Create();
|
||||
|
||||
if (!target)
|
||||
{
|
||||
Debug.Assert(SystemInfo.IsFormatSupported(format, GraphicsFormatUsage.Sample), "Crest: The graphics device does not support the render texture format " + format.ToString());
|
||||
}
|
||||
Debug.Assert(SystemInfo.SupportsRenderTextureFormat(format), "Crest: The graphics device does not support the render texture format " + format.ToString());
|
||||
}
|
||||
|
||||
bool InitObjects()
|
||||
@@ -714,7 +704,7 @@ namespace WaveHarmonic.Crest
|
||||
var descriptor = new RenderTextureDescriptor(_Resolution, _Resolution)
|
||||
{
|
||||
autoGenerateMips = false,
|
||||
graphicsFormat = Helpers.GetCompatibleTextureFormat(GraphicsFormat.R16G16_SFloat, true),
|
||||
colorFormat = RenderTextureFormat.RGHalf,
|
||||
useMipMap = false,
|
||||
enableRandomWrite = true,
|
||||
depthBufferBits = 0,
|
||||
|
||||
Reference in New Issue
Block a user