浏览代码

Merge pull request #1156 from Unity-Technologies/fix/smallfixes

Fix/smallfixes
/main
GitHub 6 年前
当前提交
614d618c
共有 4 个文件被更改,包括 9 次插入7 次删除
  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

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);
}
}
正在加载...
取消
保存