浏览代码

Fixed few .SampleLevel call not using the abstractoin API

/feature-ReflectionProbeFit
sebastienlagarde 7 年前
当前提交
9c34dc78
共有 5 个文件被更改,包括 10 次插入12 次删除
  1. 6
      SampleScenes/Common/Shaders/CubemapColorMap.shader
  2. 4
      ScriptableRenderPipeline/Core/Resources/EncodeBC6H.compute
  3. 4
      ScriptableRenderPipeline/Core/Resources/GPUCopy.compute
  4. 4
      ScriptableRenderPipeline/Core/Resources/GPUCopy.compute.meta
  5. 4
      ScriptableRenderPipeline/Core/Resources/GPUCopyAsset.cs

6
SampleScenes/Common/Shaders/CubemapColorMap.shader


Shader "Hidden/CubemapColorMap" {
Shader "Hidden/CubemapColorMap" {
Properties {
_ColorMap("Color", Cube) = "white" {}
_MipIndex("Mip Index", Int) = 0

#include "UnityCG.cginc"
TextureCube _ColorMap;
TEXTURECUBE(_ColorMap);
int _MipIndex;
SamplerState s_bilinear_clamp;

}
float4 Frag(v2f i) : SV_Target {
float3 col = _ColorMap.SampleLevel(s_bilinear_clamp, i.normalWS, _MipIndex).xyz;
float3 col = SAMPLE_TEXTURECUBE_LOD(_ColorMap, s_bilinear_clamp, i.normalWS, _MipIndex).xyz;
return float4(col, 0.5);
}

4
ScriptableRenderPipeline/Core/Resources/EncodeBC6H.compute


RWTexture2DArray<uint4> _Target;
int _MipIndex;
SamplerState s_point_clamp;
SAMPLER(s_point_clamp);
static const uint2 kOffsets[] =
{

{
nvc = CubemapTexelToNVC(topLeftSourceID + kOffsets[i], size);
dir = CubemapTexelToDirection(nvc, faceId);
texels[i] = _Source.SampleLevel(s_point_clamp, dir, _MipIndex).rgb;
texels[i] = SAMPLE_TEXTURECUBE_LOD(_Source, s_point_clamp, dir, _MipIndex).rgb;
}
uint4 block = uint4(0, 0, 0, 0);

4
ScriptableRenderPipeline/Core/Resources/GPUCopy.compute


RWTexture2D<float1> _Result1;
Texture2D<float4> _Source4;
TEXTURE2D(_Source4);
#pragma kernel KSampleCopy4_1_x

_Result1[dispatchThreadId] = _Source4.SampleLevel(sampler_LinearClamp, float2(dispatchThreadId) * _Size.zw, 0.0).x;
_Result1[dispatchThreadId] = SAMPLE_TEXTURE2D_LOD(_Source4, sampler_LinearClamp, float2(dispatchThreadId) * _Size.zw, 0.0).x;
}

4
ScriptableRenderPipeline/Core/Resources/GPUCopy.compute.meta


fileFormatVersion: 2
guid: a68d8aaeb0956234d94e389f196381ee
timeCreated: 1507123133
licenseType: Pro
guid: a4d45eda75e8e474dbe24a31f741f3b4
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4

4
ScriptableRenderPipeline/Core/Resources/GPUCopyAsset.cs


using System;
using System;
using System.Collections.Generic;
using System.Text;

k_KernelSize.ToString(), k_KernelSize.ToString()));
cck.AppendLine(string.Format(@"void {0}(uint2 dispatchThreadId : SV_DispatchThreadID)", kernelName));
cck.AppendLine("{");
cck.AppendLine(string.Format(" _Result{0}[dispatchThreadId] = _Source{1}.SampleLevel(sampler_LinearClamp, float2(dispatchThreadId) * _Size.zw, 0.0).{2};",
cck.AppendLine(string.Format(" _Result{0}[dispatchThreadId] = SAMPLE_TEXTURE2D_LOD(_Source{1}, sampler_LinearClamp, float2(dispatchThreadId) * _Size.zw, 0.0).{2};",
o.targetChannel.ToString(), o.sourceChannel.ToString(), o.subscript));
cck.AppendLine("}");
cck.AppendLine();

正在加载...
取消
保存