Skip to content

Commit

Permalink
Shader compatibility enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
keijiro committed Aug 19, 2019
1 parent 0e712ca commit 8242385
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
29 changes: 8 additions & 21 deletions Assets/Anime4K/Resources/Common.hlsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "UnityCG.cginc"

sampler2D _MainTex;
float4 _MainTex_TexelSize;
float _Strength;
Expand All @@ -22,28 +24,13 @@ float MaxA(float4 a, float4 b, float4 c, float4 d)
return max(max(max(a.a, b.a), c.a), d.a);
}

float Luma(float3 rgb)
{
#ifdef UNITY_COLORSPACE_GAMMA
return dot(rgb, float3(0.22, 0.707, 0.071));
#else
return dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955));
#endif
}

void Vertex(
uint vertexID : SV_VertexID,
out float4 position : SV_Position,
out float2 texCoord : TEXCOORD
float4 position : POSITION,
float2 texCoord : TEXCOORD,
out float4 outPosition : SV_Position,
out float2 outTexCoord : TEXCOORD
)
{
float2 uv;

if (vertexID < 2)
uv = float2(vertexID & 1, 0);
else
uv = float2(1 - (vertexID & 1), 1);

position = float4(2 * uv - 1, 1, 1);
texCoord = float2(uv.x, 1 - uv.y);
outPosition = UnityObjectToClipPos(position);
outTexCoord = texCoord;
}
2 changes: 1 addition & 1 deletion Assets/Anime4K/Resources/ComputeLum.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ float4 Fragment(
) : SV_Target
{
float4 c = tex2D(_MainTex, texCoord);
return float4(c.rgb, Luma(c.rgb));
return float4(c.rgb, Luminance(c.rgb));
}
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ PlayerSettings:
m_APIs: 10000000
m_Automatic: 0
- m_BuildTarget: LinuxStandaloneSupport
m_APIs: 15000000
m_APIs: 1500000011000000
m_Automatic: 0
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2019.2.0f1
m_EditorVersionWithRevision: 2019.2.0f1 (20c1667945cf)
m_EditorVersion: 2019.2.1f1
m_EditorVersionWithRevision: 2019.2.1f1 (ca4d5af0be6f)

0 comments on commit 8242385

Please sign in to comment.