浏览代码

Replace all sampler macros with SAMPLER

/namespace
Evgenii Golubev 7 年前
当前提交
4cd2d228
共有 21 个文件被更改,包括 69 次插入87 次删除
  1. 2
      ScriptableRenderPipeline/Core/Resources/BlitCubeTextureFace.shader
  2. 11
      ScriptableRenderPipeline/Core/ShaderLibrary/API/D3D11.hlsl
  3. 11
      ScriptableRenderPipeline/Core/ShaderLibrary/API/Metal.hlsl
  4. 11
      ScriptableRenderPipeline/Core/ShaderLibrary/API/PSSL.hlsl
  5. 11
      ScriptableRenderPipeline/Core/ShaderLibrary/API/Vulkan.hlsl
  6. 11
      ScriptableRenderPipeline/Core/ShaderLibrary/API/XBoxOne.hlsl
  7. 3
      ScriptableRenderPipeline/Core/ShaderLibrary/Macros.hlsl
  8. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/Wind.hlsl
  9. 2
      ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplayLatlong.shader
  10. 2
      ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugFullScreen.shader
  11. 6
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoopDef.hlsl
  12. 8
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/ShadowContext.hlsl
  13. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/DecalProperties.hlsl
  14. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/GGXConvolution/BuildProbabilityTables.compute
  15. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/GGXConvolution/GGXConvolve.shader
  16. 46
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitProperties.hlsl
  17. 6
      ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/UnlitProperties.hlsl
  18. 8
      ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl
  19. 2
      ScriptableRenderPipeline/HDRenderPipeline/Sky/BlitCubemap.shader
  20. 2
      ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader
  21. 2
      ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyVariables.hlsl

2
ScriptableRenderPipeline/Core/Resources/BlitCubeTextureFace.shader


#pragma target 3.0
TEXTURECUBE(_InputTex);
SAMPLERCUBE(sampler_InputTex);
SAMPLER(sampler_InputTex);
float _FaceIndex;
float _LoD;

11
ScriptableRenderPipeline/Core/ShaderLibrary/API/D3D11.hlsl


#define TEXTURE3D(textureName) Texture3D textureName
#define RW_TEXTURE2D(type, textureName) RWTexture2D<type> textureName
#define SAMPLER2D(samplerName) SamplerState samplerName
#define SAMPLERCUBE(samplerName) SamplerState samplerName
#define SAMPLER3D(samplerName) SamplerState samplerName
#define SAMPLER2D_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLERCUBE_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLER(samplerName) SamplerState samplerName
#define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName
#define TEXTURE2D_ARGS(textureName, samplerName) Texture2D textureName, SamplerState samplerName
#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) Texture2DArray textureName, SamplerState samplerName

#define TEXTURE2D_FLOAT TEXTURE2D
#define TEXTURE3D_HALF TEXTURE3D
#define TEXTURE3D_FLOAT TEXTURE3D
#define SAMPLER2D_HALF SAMPLER2D
#define SAMPLER2D_FLOAT SAMPLER2D
#define SAMPLER_HALF SAMPLER
#define SAMPLER_FLOAT SAMPLER
#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0))
#define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod))

11
ScriptableRenderPipeline/Core/ShaderLibrary/API/Metal.hlsl


#define TEXTURE3D(textureName) Texture3D textureName
#define RW_TEXTURE2D(type, textureName) RWTexture2D<type> textureName
#define SAMPLER2D(samplerName) SamplerState samplerName
#define SAMPLERCUBE(samplerName) SamplerState samplerName
#define SAMPLER3D(samplerName) SamplerState samplerName
#define SAMPLER2D_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLERCUBE_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLER(samplerName) SamplerState samplerName
#define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName
#define TEXTURE2D_ARGS(textureName, samplerName) Texture2D textureName, SamplerState samplerName
#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) Texture2DArray textureName, SamplerState samplerName

#define TEXTURE2D_FLOAT TEXTURE2D
#define TEXTURE3D_HALF TEXTURE3D
#define TEXTURE3D_FLOAT TEXTURE3D
#define SAMPLER2D_HALF SAMPLER2D
#define SAMPLER2D_FLOAT SAMPLER2D
#define SAMPLER_HALF SAMPLER
#define SAMPLER_FLOAT SAMPLER
#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0))
#define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod))

11
ScriptableRenderPipeline/Core/ShaderLibrary/API/PSSL.hlsl


#define TEXTURE3D(textureName) Texture3D textureName
#define RW_TEXTURE2D(type, textureName) RW_Texture2D<type> textureName
#define SAMPLER2D(samplerName) SamplerState samplerName
#define SAMPLERCUBE(samplerName) SamplerState samplerName
#define SAMPLER3D(samplerName) SamplerState samplerName
#define SAMPLER2D_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLERCUBE_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLER(samplerName) SamplerState samplerName
#define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName
#define TEXTURE2D_ARGS(textureName, samplerName) Texture2D textureName, SamplerState samplerName
#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) Texture2DArray textureName, SamplerState samplerName

#define TEXTURE2D_FLOAT TEXTURE2D
#define TEXTURE3D_HALF TEXTURE3D
#define TEXTURE3D_FLOAT TEXTURE3D
#define SAMPLER2D_HALF SAMPLER2D
#define SAMPLER2D_FLOAT SAMPLER2D
#define SAMPLER_HALF SAMPLER
#define SAMPLER_FLOAT SAMPLER
#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0))
#define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod))

11
ScriptableRenderPipeline/Core/ShaderLibrary/API/Vulkan.hlsl


#define TEXTURE3D(textureName) Texture3D textureName
#define RW_TEXTURE2D(type, textureName) RWTexture2D<type> textureName
#define SAMPLER2D(samplerName) SamplerState samplerName
#define SAMPLERCUBE(samplerName) SamplerState samplerName
#define SAMPLER3D(samplerName) SamplerState samplerName
#define SAMPLER2D_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLERCUBE_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLER(samplerName) SamplerState samplerName
#define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName
#define TEXTURE2D_ARGS(textureName, samplerName) Texture2D textureName, SamplerState samplerName
#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) Texture2DArray textureName, SamplerState samplerName

#define TEXTURE2D_FLOAT TEXTURE2D
#define TEXTURE3D_HALF TEXTURE3D
#define TEXTURE3D_FLOAT TEXTURE3D
#define SAMPLER2D_HALF SAMPLER2D
#define SAMPLER2D_FLOAT SAMPLER2D
#define SAMPLER_HALF SAMPLER
#define SAMPLER_FLOAT SAMPLER
#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0))
#define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod))

11
ScriptableRenderPipeline/Core/ShaderLibrary/API/XBoxOne.hlsl


#define TEXTURE3D(textureName) Texture3D textureName
#define RW_TEXTURE2D(type, textureName) RWTexture2D<type> textureName
#define SAMPLER2D(samplerName) SamplerState samplerName
#define SAMPLERCUBE(samplerName) SamplerState samplerName
#define SAMPLER3D(samplerName) SamplerState samplerName
#define SAMPLER2D_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLERCUBE_SHADOW(samplerName) SamplerComparisonState samplerName
#define SAMPLER(samplerName) SamplerState samplerName
#define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName
#define TEXTURE2D_ARGS(textureName, samplerName) Texture2D textureName, SamplerState samplerName
#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) Texture2DArray textureName, SamplerState samplerName

#define TEXTURE2D_FLOAT TEXTURE2D
#define TEXTURE3D_HALF TEXTURE3D
#define TEXTURE3D_FLOAT TEXTURE3D
#define SAMPLER2D_HALF SAMPLER2D
#define SAMPLER2D_FLOAT SAMPLER2D
#define SAMPLER_HALF SAMPLER
#define SAMPLER_FLOAT SAMPLER
#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0))
#define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod))

3
ScriptableRenderPipeline/Core/ShaderLibrary/Macros.hlsl


// Some platform don't support cubemap array so we fallback on 2D latlong
#ifdef UNITY_NO_CUBEMAP_ARRAY
#define TEXTURECUBE_ARRAY_ABSTRACT TEXTURE2D_ARRAY
#define SAMPLERCUBE_ABSTRACT SAMPLER2D
#define SAMPLERCUBE_ABSTRACT SAMPLERCUBE
#define TEXTURECUBE_ARRAY_ARGS_ABSTRACT TEXTURECUBE_ARRAY_ARGS
#define TEXTURECUBE_ARRAY_PARAM_ABSTRACT TEXTURECUBE_ARRAY_PARAM
#define SAMPLE_TEXTURECUBE_ARRAY_LOD_ABSTRACT(textureName, samplerName, coord3, index, lod) SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod)

#define FLT_EPS 5.960464478e-8 // 2^-24, machine epsilon: 1 + EPS = 1 (half of the ULP for 1)
#define FLT_MIN 1.175494351e-38 // Minimum representable positive floating-point number
#define FLT_MAX 3.402823466e+38 // Maximum representable floating-point number
#define FLT_NAN asfloat(0xFFFFFFFF)
#define HALF_MIN 6.103515625e-5 // 2^-14, the same value for 10, 11 and 16-bit: https://www.khronos.org/opengl/wiki/Small_Float_Formats
#define HALF_MAX 65504.0
#define UINT_MAX 0xFFFFFFFFu

4
ScriptableRenderPipeline/Core/ShaderLibrary/Wind.hlsl


// Globals
TEXTURE2D(WIND_SETTINGS_TexNoise);
SAMPLER2D(sampler_WIND_SETTINGS_TexNoise);
SAMPLER(sampler_WIND_SETTINGS_TexNoise);
SAMPLER2D(sampler_WIND_SETTINGS_TexGust);
SAMPLER(sampler_WIND_SETTINGS_TexGust);
float4 WIND_SETTINGS_WorldDirectionAndSpeed;
float WIND_SETTINGS_FlexNoiseScale;

2
ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplayLatlong.shader


#include "ShaderLibrary/ImageBasedLighting.hlsl"
TEXTURECUBE(_InputCubemap);
SAMPLERCUBE(sampler_InputCubemap);
SAMPLER(sampler_InputCubemap);
float _Mipmap;
struct Attributes

2
ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugFullScreen.shader


#include "../ShaderVariables.hlsl"
TEXTURE2D(_DebugFullScreenTexture);
SAMPLER2D(sampler_DebugFullScreenTexture);
SAMPLER(sampler_DebugFullScreenTexture);
float _FullScreenDebugMode;
struct Attributes

6
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoopDef.hlsl


// Used by directional and spot lights
TEXTURE2D_ARRAY(_CookieTextures);
SAMPLER2D(sampler_CookieTextures);
SAMPLER(sampler_CookieTextures);
SAMPLERCUBE_ABSTRACT(sampler_CookieCubeTextures);
SAMPLER(sampler_CookieCubeTextures);
SAMPLERCUBE_ABSTRACT(sampler_EnvTextures);
SAMPLER(sampler_EnvTextures);
TEXTURE2D(_DeferredShadowTexture);

8
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/ShadowContext.hlsl


#include "ShaderLibrary/Shadow/Shadow.hlsl"
TEXTURE2D_ARRAY(_ShadowmapExp_VSM_0);
SAMPLER2D(sampler_ShadowmapExp_VSM_0);
SAMPLER(sampler_ShadowmapExp_VSM_0);
SAMPLER2D(sampler_ShadowmapExp_VSM_1);
SAMPLER(sampler_ShadowmapExp_VSM_1);
SAMPLER2D(sampler_ShadowmapExp_VSM_2);
SAMPLER(sampler_ShadowmapExp_VSM_2);
SAMPLER2D_SHADOW(sampler_ShadowmapExp_PCF);
SAMPLER_CMP(sampler_ShadowmapExp_PCF);
StructuredBuffer<ShadowData> _ShadowDatasExp;
StructuredBuffer<int4> _ShadowPayloads;

4
ScriptableRenderPipeline/HDRenderPipeline/Material/Decal/DecalProperties.hlsl


TEXTURE2D(_BaseColorMap);
SAMPLER2D(sampler_BaseColorMap);
SAMPLER(sampler_BaseColorMap);
SAMPLER2D(sampler_NormalMap);
SAMPLER(sampler_NormalMap);
float _DecalBlend;

2
ScriptableRenderPipeline/HDRenderPipeline/Material/GGXConvolution/BuildProbabilityTables.compute


#define TEXTURE_WIDTH 2 * TEXTURE_HEIGHT // Equiareal texture map: phi = TWO_PI * (1.0 - u)
TEXTURECUBE(envMap); // Input cubemap
SAMPLERCUBE(sampler_envMap);
SAMPLER(sampler_envMap);
/* --- Output --- */

2
ScriptableRenderPipeline/HDRenderPipeline/Material/GGXConvolution/GGXConvolve.shader


#include "GGXConvolution.cs.hlsl"
TEXTURECUBE(_MainTex);
SAMPLERCUBE(sampler_MainTex);
SAMPLER(sampler_MainTex);
TEXTURE2D_FLOAT(_GgxIblSamples);

46
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitProperties.hlsl


// ===========================================================================
TEXTURE2D(_DistortionVectorMap);
SAMPLER2D(sampler_DistortionVectorMap);
SAMPLER(sampler_DistortionVectorMap);
SAMPLER2D(sampler_EmissiveColorMap);
SAMPLER(sampler_EmissiveColorMap);
SAMPLER2D(sampler_DiffuseLightingMap);
SAMPLER(sampler_DiffuseLightingMap);
SAMPLER2D(sampler_BaseColorMap);
SAMPLER(sampler_BaseColorMap);
SAMPLER2D(sampler_MaskMap);
SAMPLER(sampler_MaskMap);
SAMPLER2D(sampler_BentNormalMap);
SAMPLER(sampler_BentNormalMap);
SAMPLER2D(sampler_NormalMap);
SAMPLER(sampler_NormalMap);
SAMPLER2D(sampler_NormalMapOS);
SAMPLER(sampler_NormalMapOS);
SAMPLER2D(sampler_DetailMap);
SAMPLER(sampler_DetailMap);
SAMPLER2D(sampler_HeightMap);
SAMPLER(sampler_HeightMap);
SAMPLER2D(sampler_TangentMap);
SAMPLER(sampler_TangentMap);
SAMPLER2D(sampler_TangentMapOS);
SAMPLER(sampler_TangentMapOS);
SAMPLER2D(sampler_AnisotropyMap);
SAMPLER(sampler_AnisotropyMap);
SAMPLER2D(sampler_SubsurfaceRadiusMap);
SAMPLER(sampler_SubsurfaceRadiusMap);
SAMPLER2D(sampler_ThicknessMap);
SAMPLER(sampler_ThicknessMap);
SAMPLER2D(sampler_SpecularColorMap);
SAMPLER(sampler_SpecularColorMap);
SAMPLER2D(sampler_TransmittanceColorMap);
SAMPLER(sampler_TransmittanceColorMap);
#else

// mean we must declare all sampler
#define PROP_DECL_TEX2D(name)\
TEXTURE2D(MERGE_NAME(name, 0)); \
SAMPLER2D(MERGE_NAME(MERGE_NAME(sampler, name), 0)); \
SAMPLER(MERGE_NAME(MERGE_NAME(sampler, name), 0)); \
SAMPLER2D(MERGE_NAME(MERGE_NAME(sampler, name), 1)); \
SAMPLER(MERGE_NAME(MERGE_NAME(sampler, name), 1)); \
SAMPLER2D(MERGE_NAME(MERGE_NAME(sampler, name), 2)); \
SAMPLER(MERGE_NAME(MERGE_NAME(sampler, name), 2)); \
SAMPLER2D(MERGE_NAME(MERGE_NAME(sampler, name), 3))
SAMPLER(MERGE_NAME(MERGE_NAME(sampler, name), 3))
PROP_DECL_TEX2D(_BaseColorMap);

PROP_DECL_TEX2D(_ThicknessMap);
TEXTURE2D(_LayerMaskMap);
SAMPLER2D(sampler_LayerMaskMap);
SAMPLER(sampler_LayerMaskMap);
SAMPLER2D(sampler_LayerInfluenceMaskMap);
SAMPLER(sampler_LayerInfluenceMaskMap);
#endif

6
ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/UnlitProperties.hlsl


float4 _UnlitColor;
TEXTURE2D(_UnlitColorMap);
SAMPLER2D(sampler_UnlitColorMap);
SAMPLER(sampler_UnlitColorMap);
SAMPLER2D(sampler_DistortionVectorMap);
SAMPLER(sampler_DistortionVectorMap);
SAMPLER2D(sampler_EmissiveColorMap);
SAMPLER(sampler_EmissiveColorMap);
float4 _EmissiveColorMap_ST;
float _EmissiveIntensity;

8
ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl


// ----------------------------------------------------------------------------
TEXTURE2D_FLOAT(_MainDepthTexture);
SAMPLER2D(sampler_MainDepthTexture);
SAMPLER(sampler_MainDepthTexture);
SAMPLER2D(samplerunity_Lightmap);
SAMPLER(samplerunity_Lightmap);
SAMPLER2D(samplerunity_DynamicLightmap);
SAMPLER(samplerunity_DynamicLightmap);
TEXTURE2D(unity_DynamicDirectionality);

// TODO: Change code here so probe volume use only one transform instead of all this parameters!
TEXTURE3D_FLOAT(unity_ProbeVolumeSH);
SAMPLER3D(samplerunity_ProbeVolumeSH);
SAMPLER(samplerunity_ProbeVolumeSH);
CBUFFER_START(UnityVelocityPass)
float4x4 unity_MatrixNonJitteredVP;

2
ScriptableRenderPipeline/HDRenderPipeline/Sky/BlitCubemap.shader


#include "ShaderLibrary/Common.hlsl"
TEXTURECUBE(_MainTex);
SAMPLERCUBE(sampler_MainTex);
SAMPLER(sampler_MainTex);
float _faceIndex;
struct appdata_t {

2
ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader


#include "ShaderLibrary/CommonLighting.hlsl"
TEXTURECUBE(_Cubemap);
SAMPLERCUBE(sampler_Cubemap);
SAMPLER(sampler_Cubemap);
float4 _SkyParam; // x exposure, y multiplier, z rotation
float4x4 _PixelCoordToViewDirWS; // Actually just 3x3, but Unity can only set 4x4

2
ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyVariables.hlsl


#define UNITY_SKY_VARIABLES_INCLUDED
TEXTURECUBE(_SkyTexture);
SAMPLERCUBE(sampler_SkyTexture); // NOTE: Sampler could be share here with _EnvTextures. Don't know if the shader compiler will complain...
SAMPLER(sampler_SkyTexture); // NOTE: Sampler could be share here with _EnvTextures. Don't know if the shader compiler will complain...
CBUFFER_START(SkyParameters)
float _SkyTextureMipCount;

正在加载...
取消
保存