Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit df86bd3

Browse files
committed
Updated Built-in Shaders to 2019.1.0f2
1 parent 803692b commit df86bd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1725
-617
lines changed

CGIncludes/HLSLSupport.cginc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@
397397
// this allows surface shaders to use _NOSAMPLER and similar macros, without using up a sampler register.
398398
// Don't do that for mojoshader part, as that one can only parse DX9 style HLSL.
399399

400+
#define UNITY_SEPARATE_TEXTURE_SAMPLER
401+
400402
// 2D textures
401403
#define UNITY_DECLARE_TEX2D(tex) Texture2D tex; SamplerState sampler##tex
402404
#define UNITY_DECLARE_TEX2D_NOSAMPLER(tex) Texture2D tex

CGIncludes/TerrainSplatmapCommon.cginc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ void SplatmapVert(inout appdata_full v, out Input data)
7777
v.tangent.xyz = cross(v.normal, float3(0,0,1));
7878
v.tangent.w = -1;
7979

80-
data.tc.xy = v.texcoord;
80+
data.tc.xy = v.texcoord.xy;
8181
#ifdef TERRAIN_BASE_PASS
8282
#ifdef UNITY_PASS_META
83-
data.tc.xy = v.texcoord * _MainTex_ST.xy + _MainTex_ST.zw;
83+
data.tc.xy = TRANSFORM_TEX(v.texcoord.xy, _MainTex);
8484
#endif
8585
#else
8686
float4 pos = UnityObjectToClipPos(v.vertex);

CGIncludes/UnityCG.cginc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ inline half3 DecodeHDR (half4 data, half4 decodeInstructions)
520520

521521
// Decodes HDR textures
522522
// handles dLDR, RGBM formats
523-
// Called by DecodeLightmap when UNITY_NO_RGBM is not defined.
524523
inline half3 DecodeLightmapRGBM (half4 data, half4 decodeInstructions)
525524
{
526525
// If Linear mode is not supported we can skip exponent part

CGIncludes/UnityInstancing.cginc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@
120120
#define DEFAULT_UNITY_VERTEX_OUTPUT_STEREO uint stereoTargetEyeIndex : SV_RenderTargetArrayIndex;
121121
#define DEFAULT_UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output) output.stereoTargetEyeIndex = unity_StereoEyeIndex
122122
#endif
123+
#define DEFAULT_UNITY_VERTEX_OUTPUT_STEREO_EYE_INDEX uint stereoTargetEyeIndex : BLENDINDICES0;
124+
#define DEFAULT_UNITY_INITIALIZE_OUTPUT_STEREO_EYE_INDEX(output) output.stereoTargetEyeIndex = unity_StereoEyeIndex;
123125
#define DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(input, output) output.stereoTargetEyeIndex = input.stereoTargetEyeIndex;
124126
#define DEFAULT_UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input) unity_StereoEyeIndex = input.stereoTargetEyeIndex;
125127
#elif defined(UNITY_STEREO_MULTIVIEW_ENABLED)
@@ -134,12 +136,19 @@
134136
#endif
135137
#else
136138
#define DEFAULT_UNITY_VERTEX_OUTPUT_STEREO
139+
#define DEFAULT_UNITY_VERTEX_OUTPUT_STEREO_EYE_INDEX
140+
#define DEFAULT_UNITY_INITIALIZE_OUTPUT_STEREO_EYE_INDEX(output)
137141
#define DEFAULT_UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output)
138142
#define DEFAULT_UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(input, output)
139143
#define DEFAULT_UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
140144
#endif
141145

142-
146+
#if !defined(UNITY_VERTEX_OUTPUT_STEREO_EYE_INDEX)
147+
# define UNITY_VERTEX_OUTPUT_STEREO_EYE_INDEX DEFAULT_UNITY_VERTEX_OUTPUT_STEREO_EYE_INDEX
148+
#endif
149+
#if !defined(UNITY_INITIALIZE_OUTPUT_STEREO_EYE_INDEX)
150+
# define UNITY_INITIALIZE_OUTPUT_STEREO_EYE_INDEX(output) DEFAULT_UNITY_INITIALIZE_OUTPUT_STEREO_EYE_INDEX(output)
151+
#endif
143152
#if !defined(UNITY_VERTEX_OUTPUT_STEREO)
144153
# define UNITY_VERTEX_OUTPUT_STEREO DEFAULT_UNITY_VERTEX_OUTPUT_STEREO
145154
#endif
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
2+
3+
#ifndef GLSL_STEREO_EXTENSIONS_INCLUDED
4+
#define GLSL_STEREO_EXTENSIONS_INCLUDED
5+
6+
#ifdef STEREO_MULTIVIEW_ON
7+
#extension GL_OVR_multiview2 : require
8+
#endif
9+
10+
#ifdef STEREO_INSTANCING_ON
11+
#extension GL_NV_viewport_array2 : enable
12+
#extension GL_AMD_vertex_shader_layer : enable
13+
#extension GL_ARB_fragment_layer_viewport : enable
14+
#endif
15+
16+
#endif // GLSL_STEREO_EXTENSIONS_INCLUDED
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
2+
3+
#ifndef GLSL_STEREO_SETUP_INCLUDED
4+
#define GLSL_STEREO_SETUP_INCLUDED
5+
6+
#if defined(STEREO_MULTIVIEW_ON) || defined(STEREO_INSTANCING_ON)
7+
layout(std140) uniform UnityStereoGlobals {
8+
mat4 unity_StereoMatrixP[2];
9+
mat4 unity_StereoMatrixV[2];
10+
mat4 unity_StereoMatrixInvV[2];
11+
mat4 unity_StereoMatrixVP[2];
12+
mat4 unity_StereoCameraProjection[2];
13+
mat4 unity_StereoCameraInvProjection[2];
14+
mat4 unity_StereoWorldToCamera[2];
15+
mat4 unity_StereoCameraToWorld[2];
16+
vec3 unity_StereoWorldSpaceCameraPos[2];
17+
vec4 unity_StereoScaleOffset[2];
18+
};
19+
layout(std140) uniform UnityStereoEyeIndices {
20+
vec4 unity_StereoEyeIndices[2];
21+
};
22+
#endif
23+
24+
#ifdef VERTEX
25+
#ifdef STEREO_MULTIVIEW_ON
26+
layout(num_views = 2) in;
27+
#endif
28+
29+
uniform int unity_StereoEyeIndex;
30+
31+
int SetupStereoEyeIndex()
32+
{
33+
int eyeIndex = unity_StereoEyeIndex;
34+
35+
#if defined(STEREO_MULTIVIEW_ON)
36+
eyeIndex = int(unity_StereoEyeIndices[gl_ViewID_OVR].x);
37+
#elif defined(STEREO_INSTANCING_ON)
38+
eyeIndex = int(gl_InstanceID & 1);
39+
gl_Layer = eyeIndex;
40+
#endif
41+
42+
return eyeIndex;
43+
}
44+
45+
mat4 GetStereoMatrixVP(int eyeIndex)
46+
{
47+
mat4 stereoVP = unity_MatrixVP;
48+
49+
#if defined(STEREO_MULTIVIEW_ON) || defined(STEREO_INSTANCING_ON)
50+
stereoVP = unity_StereoMatrixVP[eyeIndex];
51+
#endif
52+
53+
return stereoVP;
54+
}
55+
#endif
56+
57+
#endif // GLSL_STEREO_SETUP_INCLUDED

0 commit comments

Comments
 (0)