浏览代码

Lightweight Shaders compiling on GLES with HLSLcc compiler.

/main
Felipe Lira 7 年前
当前提交
a58b6cbd
共有 12 个文件被更改,包括 44 次插入38 次删除
  1. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightBlit.shader
  2. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCopyDepth.shader
  3. 6
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCore.hlsl
  4. 3
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightLighting.hlsl
  5. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightShadows.hlsl
  6. 13
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandard.shader
  7. 4
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticles.shader
  8. 28
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticlesUnlit.shader
  9. 11
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardSimpleLighting.shader
  10. 8
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardTerrain.shader
  11. 1
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightSurfaceInput.hlsl
  12. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightBlit.shader


Tags { "LightMode" = "LightweightForward"}
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma vertex Vertex
#pragma fragment Fragment

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCopyDepth.shader


ZWrite On
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma vertex vert
#pragma fragment frag

6
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCore.hlsl


#ifndef LIGHTWEIGHT_PIPELINE_CORE_INCLUDED
#define LIGHTWEIGHT_PIPELINE_CORE_INCLUDED
#include "ShaderVariables\LightweightShaderVariables.hlsl"
#include "ShaderVariables\LightweightShaderVariables.hlsl"
#ifdef _NORMALMAP
#define OUTPUT_NORMAL(IN, OUT) OutputTangentToWorld(IN.tangent, IN.normal, OUT.tangent, OUT.binormal, OUT.normal)

{
// Compiler will optimize the scale away
#if defined(UNITY_NO_DXT5nm)
return UnpackNormalRGB(packedNormal, 1.0)
return UnpackNormalRGB(packedNormal, 1.0);
#else
return UnpackNormalmapRGorAG(packedNormal, 1.0);
#endif

{
#if defined(UNITY_NO_DXT5nm)
return UnpackNormalRGB(packedNormal, bumpScale)
return UnpackNormalRGB(packedNormal, bumpScale);
#else
return UnpackNormalmapRGorAG(packedNormal, bumpScale);
#endif

3
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightLighting.hlsl


#ifndef LIGHTWEIGHT_LIGHTING_INCLUDED
#define LIGHTWEIGHT_LIGHTING_INCLUDED
#include "ShaderLibrary\Common.hlsl"
#include "ShaderLibrary\ImageBasedLighting.hlsl"
#include "ShaderLibrary\ImageBasedLighting.hlsl"
#define kDieletricSpec half4(0.04, 0.04, 0.04, 1.0 - 0.04) // standard dielectric reflectivity coef at incident angle (= 4%)

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightShadows.hlsl


#ifndef LIGHTWEIGHT_SHADOWS_INCLUDED
#define LIGHTWEIGHT_SHADOWS_INCLUDED
#include "LightweightInput.hlsl"
#include "LightweightInput.hlsl"
#define MAX_SHADOW_CASCADES 4

13
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandard.shader


ZWrite[_ZWrite]
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 3.0
// -------------------------------------

#pragma multi_compile _MAIN_DIRECTIONAL_LIGHT _MAIN_SPOT_LIGHT
#pragma multi_compile _ _ADDITIONAL_LIGHTS
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ENABLED STEREO_MULTIVIEW_ENABLED
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ _HARD_SHADOWS _SOFT_SHADOWS _HARD_SHADOWS_CASCADES _SOFT_SHADOWS_CASCADES

ZWrite On ZTest LEqual
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 2.0
#pragma vertex ShadowPassVertex
#pragma fragment ShadowPassFragment

ColorMask 0
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag

Cull Off
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma vertex LightweightVertexMeta
#pragma fragment LightweightFragmentMeta

}
}
//FallBack "Hidden/InternalErrorShader"
FallBack "Hidden/InternalErrorShader"
CustomEditor "LightweightStandardGUI"
}

4
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticles.shader


// No support to Distortion
// No support to Shadows
Shader "LightweightPipeline/Particles/Standard"
{
Properties

{
Tags {"LightMode" = "LightweightForward"}
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma vertex ParticlesLitVertex
#pragma fragment ParticlesLitFragment
#pragma multi_compile __ SOFTPARTICLES_ON

28
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticlesUnlit.shader


// No support to Distortion
// No support to Shadows
Shader "LightweightPipeline/Particles/Standard Unlit"
{
Properties

ZWrite[_ZWrite]
Cull[_Cull]
ColorMask RGB
Pass
{
Name "ShadowCaster"
Tags{"LightMode" = "ShadowCaster"}
BlendOp Add
Blend One Zero
ZWrite On
Cull Off
CGPROGRAM
#pragma target 2.5
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON
#pragma shader_feature _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON
#pragma shader_feature _REQUIRE_UV2
#pragma multi_compile_shadowcaster
#pragma vertex vertParticleShadowCaster
#pragma fragment fragParticleShadowCaster
#include "UnityStandardParticleShadow.cginc"
ENDCG
}
Pass
{

11
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardSimpleLighting.shader


ZWrite[_ZWrite]
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 3.0
#pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON
#pragma shader_feature _ _SPECGLOSSMAP _SPECULAR_COLOR

#pragma multi_compile _MAIN_DIRECTIONAL_LIGHT _MAIN_SPOT_LIGHT
#pragma multi_compile _ _ADDITIONAL_LIGHTS
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ENABLED STEREO_MULTIVIEW_ENABLED
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ _HARD_SHADOWS _SOFT_SHADOWS _HARD_SHADOWS_CASCADES _SOFT_SHADOWS_CASCADES

ZWrite On ZTest LEqual
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 2.0
#pragma vertex ShadowPassVertex
#pragma fragment ShadowPassFragment

ColorMask 0
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag

Cull Off
HLSLPROGRAM
#define UNITY_SETUP_BRDF_INPUT SpecularSetup
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma vertex LightweightVertexMeta
#pragma fragment LightweightFragmentMetaSimple

8
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardTerrain.shader


{
Tags { "LightMode" = "LightweightForward" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma multi_compile _ _MAIN_LIGHT_COOKIE
#pragma multi_compile _MAIN_DIRECTIONAL_LIGHT _MAIN_SPOT_LIGHT
#pragma multi_compile _ _ADDITIONAL_LIGHTS

sampler2D _Control;
sampler2D _Splat0, _Splat1, _Splat2, _Splat3;
#ifdef _TERRAIN_NORMAL_MAP
sampler2D _Normal0, _Normal1, _Normal2, _Normal3;
#endif

ColorMask 0
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag

1
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightSurfaceInput.hlsl


#include "LightweightCore.hlsl"
#include "ShaderLibrary/Packing.hlsl"
#include "ShaderLibrary/SampleUVMapping.hlsl"
#ifdef _SPECULAR_SETUP
#define SAMPLE_METALLICSPECULAR(uv) SAMPLE_TEXTURE2D(_SpecGlossMap, sampler_SpecGlossMap, uv)

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader


Pass
{
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ENABLE STEREO_MULTIVIEW_ENABLE

正在加载...
取消
保存