浏览代码

Merge branch 'master' into StackLitWork

/StackLitWork
Stephane Laroche 7 年前
当前提交
41d1587f
共有 7 个文件被更改,包括 71 次插入10 次删除
  1. 1
      ScriptableRenderPipeline/Core/CoreRP/CoreResources/GPUCopy.compute
  2. 1
      ScriptableRenderPipeline/Core/CoreRP/CoreResources/GPUCopyAsset.cs
  3. 4
      ScriptableRenderPipeline/Core/CoreRP/CoreResources/TexturePadding.compute
  4. 10
      ScriptableRenderPipeline/Core/CoreRP/CoreResources/TexturePadding.cs
  5. 60
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  6. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs
  7. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CopyDepthBuffer.shader

1
ScriptableRenderPipeline/Core/CoreRP/CoreResources/GPUCopy.compute


// Autogenerated file. Do not edit by hand
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#include "../ShaderLibrary/Common.hlsl"
CBUFFER_START (UnityCBuffer)

1
ScriptableRenderPipeline/Core/CoreRP/CoreResources/GPUCopyAsset.cs


// Compute Shader
cc.AppendLine(@"// Autogenerated file. Do not edit by hand");
cc.AppendLine();
cc.AppendLine("#pragma only_renderers d3d11 ps4 xboxone vulkan metal");
cc.AppendLine(@"#include ""../ShaderLibrary/Common.hlsl""");
cc.AppendLine(ccp.ToString()); // Properties
cc.AppendLine(cck.ToString()); // Kernels

4
ScriptableRenderPipeline/Core/CoreRP/CoreResources/TexturePadding.compute


// Texture buffers
// ------------------------------------------------
RW_TEXTURE2D(float4, _Source);
RW_TEXTURE2D(float4, _InOutTexture);
// ------------------------------------------------
// Constant buffers

const int2 loadId = targetId - int2(1 + dispatchThreadId.x, 0);
#endif
_Source[targetId] = _Source[loadId];
_InOutTexture[targetId] = _InOutTexture[loadId];
}

10
ScriptableRenderPipeline/Core/CoreRP/CoreResources/TexturePadding.cs


public class TexturePadding
{
static readonly int _RectOffset = Shader.PropertyToID("_RectOffset");
static readonly int _Source = Shader.PropertyToID("_Source");
static readonly int _InOutTexture = Shader.PropertyToID("_InOutTexture");
ComputeShader m_CS;
int m_KMainTopRight;

m_KMainTop = m_CS.FindKernel("KMainTop");
m_KMainRight = m_CS.FindKernel("KMainRight");
}
public void Pad(CommandBuffer cmd, RenderTexture source, RectInt from, RectInt to)
public void Pad(CommandBuffer cmd, RenderTexture inOutTexture, RectInt from, RectInt to)
cmd.SetComputeTextureParam(m_CS, m_KMainRight, _Source, source);
cmd.SetComputeTextureParam(m_CS, m_KMainRight, _InOutTexture, inOutTexture);
cmd.SetComputeTextureParam(m_CS, m_KMainTop, _Source, source);
cmd.SetComputeTextureParam(m_CS, m_KMainTop, _InOutTexture, inOutTexture);
cmd.SetComputeTextureParam(m_CS, m_KMainTopRight, _Source, source);
cmd.SetComputeTextureParam(m_CS, m_KMainTopRight, _InOutTexture, inOutTexture);
cmd.DispatchCompute(m_CS, m_KMainTopRight, to.width - from.width, to.height - from.height, 1);
}
}

60
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


RTHandle m_DebugColorPickerBuffer;
RTHandle m_DebugFullScreenTempBuffer;
bool m_FullScreenDebugPushed;
bool m_NoRendering; // False by default mean we render normally, true mean we don't render anything
public Material GetBlitMaterial() { return m_Blit; }

m_GPUCopy,
new TexturePadding(asset.renderPipelineResources.texturePaddingCS)
);
m_BufferPyramid = new BufferPyramid(bufferPyramidProcessor);
m_BufferPyramid = new BufferPyramid(bufferPyramidProcessor);
EncodeBC6H.DefaultInstance = EncodeBC6H.DefaultInstance ?? new EncodeBC6H(asset.renderPipelineResources.encodeBC6HCS);

Debug.LogError("High Definition Render Pipeline doesn't support Gamma mode, change to Linear mode");
}
#endif
m_NoRendering = false;
if (!IsSupportedPlatform())
{
Debug.LogError("Platform " + SystemInfo.operatingSystem + " with device " + SystemInfo.graphicsDeviceType.ToString() + " is not supported, no rendering will occur");
m_NoRendering = true;
}
}
bool IsSupportedPlatform()
{
if (!SystemInfo.supportsComputeShaders)
return false;
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOneD3D12 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan)
{
return true;
}
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal)
{
string os = SystemInfo.operatingSystem;
// Metal support depends on OS version:
// macOS 10.11.x doesn't have tessellation / earlydepthstencil support, early driver versions were buggy in general
// macOS 10.12.x should usually work with AMD, but issues with Intel/Nvidia GPUs. Regardless of the GPU, there are issues with MTLCompilerService crashing with some shaders
// macOS 10.13.x is expected to work, and if it's a driver/shader compiler issue, there's still hope on getting it fixed to next shipping OS patch release
//
// Has worked experimentally with iOS in the past, but it's not currently supported
//
if (os.StartsWith("Mac"))
{
// TODO: Expose in C# version number, for now assume "Mac OS X 10.10.4" format with version 10 at least
int startIndex = os.LastIndexOf(" ");
var parts = os.Substring(startIndex + 1).Split('.');
int a = Convert.ToInt32(parts[0]);
int b = Convert.ToInt32(parts[1]);
// In case in the future there's a need to disable specific patch releases
// int c = Convert.ToInt32(parts[2]);
if (a >= 10 && b >= 13)
return true;
}
}
return false;
}
void UnsetRenderingFeatures()

ReflectionProbeCullResults m_ReflectionProbeCullResults;
public override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
{
if (m_NoRendering)
return;
base.Render(renderContext, cameras);
RenderPipeline.BeginFrameRendering(cameras);

needFallback = false;
}
}
if (needFallback)
{
// If the override layer is "Everything", we fall-back to "Everything" for the current layer mask to avoid issues by having no current layer

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs


{
// Currently, Unity does not offer a way to access the GCN HTile even on PS4 and Xbox One.
// Therefore, it's computed in a pixel shader, and optimized to only contain the SSS bit.
// Clear the HTile texture. TODO: move this to ClearBuffers(). Clear operations must be batched!
HDUtils.SetRenderTarget(cmd, hdCamera, depthStencilBufferRT); // No need for color buffer here
HDUtils.SetRenderTarget(cmd, hdCamera, depthStencilBufferRT); // No need for color buffer here
CoreUtils.DrawFullScreen(cmd, m_CopyStencilForSplitLighting, null, 2);
cmd.ClearRandomWriteTargets();
}

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CopyDepthBuffer.shader


ZTest Always
ZWrite On
Blend Off
ColorMask 0
HLSLPROGRAM
#pragma target 4.5

正在加载...
取消
保存