diff --git a/Assets/Klak/Hap/Resources/Hap1.shader b/Assets/Klak/Hap/Resources/Hap1.shader index 1314a33..a0bebd5 100644 --- a/Assets/Klak/Hap/Resources/Hap1.shader +++ b/Assets/Klak/Hap/Resources/Hap1.shader @@ -9,25 +9,35 @@ Shader "Klak/HAP" #include "UnityCG.cginc" + struct Attributes + { + float4 position : POSITION; + float2 texcoord : TEXCOORD; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 position : SV_Position; + float2 texcoord : TEXCOORD; + }; + sampler2D _MainTex; float4 _MainTex_ST; - float4 Vertex( - float4 position : POSITION, - inout float2 texcoord : TEXCOORD - ) : SV_Position + Varyings Vertex(Attributes input) { - texcoord = TRANSFORM_TEX(texcoord, _MainTex); - texcoord.y = 1 - texcoord.y; - return UnityObjectToClipPos(position); + UNITY_SETUP_INSTANCE_ID(input); + Varyings output; + output.position = UnityObjectToClipPos(input.position); + output.texcoord = TRANSFORM_TEX(input.texcoord, _MainTex); + output.texcoord.y = 1 - output.texcoord.y; + return output; } - fixed4 Fragment( - float4 position : POSITION, - float2 texcoord : TEXCOORD - ) : SV_Target + fixed4 Fragment(Varyings input) : SV_Target { - return tex2D(_MainTex, texcoord); + return tex2D(_MainTex, input.texcoord); } ENDCG @@ -40,6 +50,7 @@ Shader "Klak/HAP" CGPROGRAM #pragma vertex Vertex #pragma fragment Fragment + #pragma multi_compile_instancing ENDCG } } diff --git a/Assets/Klak/Hap/Resources/Hap5.shader b/Assets/Klak/Hap/Resources/Hap5.shader index ae74dbf..18f42cf 100644 --- a/Assets/Klak/Hap/Resources/Hap5.shader +++ b/Assets/Klak/Hap/Resources/Hap5.shader @@ -9,25 +9,35 @@ Shader "Klak/HAP Alpha" #include "UnityCG.cginc" + struct Attributes + { + float4 position : POSITION; + float2 texcoord : TEXCOORD; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 position : SV_Position; + float2 texcoord : TEXCOORD; + }; + sampler2D _MainTex; float4 _MainTex_ST; - float4 Vertex( - float4 position : POSITION, - inout float2 texcoord : TEXCOORD - ) : SV_Position + Varyings Vertex(Attributes input) { - texcoord = TRANSFORM_TEX(texcoord, _MainTex); - texcoord.y = 1 - texcoord.y; - return UnityObjectToClipPos(position); + UNITY_SETUP_INSTANCE_ID(input); + Varyings output; + output.position = UnityObjectToClipPos(input.position); + output.texcoord = TRANSFORM_TEX(input.texcoord, _MainTex); + output.texcoord.y = 1 - output.texcoord.y; + return output; } - fixed4 Fragment( - float4 position : POSITION, - float2 texcoord : TEXCOORD - ) : SV_Target + fixed4 Fragment(Varyings input) : SV_Target { - return tex2D(_MainTex, texcoord); + return tex2D(_MainTex, input.texcoord); } ENDCG @@ -42,6 +52,7 @@ Shader "Klak/HAP Alpha" CGPROGRAM #pragma vertex Vertex #pragma fragment Fragment + #pragma multi_compile_instancing ENDCG } } diff --git a/Assets/Klak/Hap/Resources/HapY.shader b/Assets/Klak/Hap/Resources/HapY.shader index 4007e0c..4cfb311 100644 --- a/Assets/Klak/Hap/Resources/HapY.shader +++ b/Assets/Klak/Hap/Resources/HapY.shader @@ -9,6 +9,19 @@ Shader "Klak/HAP Q" #include "UnityCG.cginc" + struct Attributes + { + float4 position : POSITION; + float2 texcoord : TEXCOORD; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 position : SV_Position; + float2 texcoord : TEXCOORD; + }; + sampler2D _MainTex; float4 _MainTex_ST; @@ -26,22 +39,19 @@ Shader "Klak/HAP Q" return rgb; } - float4 Vertex( - float4 position : POSITION, - inout float2 texcoord : TEXCOORD - ) : SV_Position + Varyings Vertex(Attributes input) { - texcoord = TRANSFORM_TEX(texcoord, _MainTex); - texcoord.y = 1 - texcoord.y; - return UnityObjectToClipPos(position); + UNITY_SETUP_INSTANCE_ID(input); + Varyings output; + output.position = UnityObjectToClipPos(input.position); + output.texcoord = TRANSFORM_TEX(input.texcoord, _MainTex); + output.texcoord.y = 1 - output.texcoord.y; + return output; } - fixed4 Fragment( - float4 position : POSITION, - float2 texcoord : TEXCOORD - ) : SV_Target + fixed4 Fragment(Varyings input) : SV_Target { - return fixed4(CoCgSY2RGB(tex2D(_MainTex, texcoord)), 1); + return fixed4(CoCgSY2RGB(tex2D(_MainTex, input.texcoord)), 1); } ENDCG @@ -55,6 +65,7 @@ Shader "Klak/HAP Q" #pragma multi_compile _ UNITY_COLORSPACE_GAMMA #pragma vertex Vertex #pragma fragment Fragment + #pragma multi_compile_instancing ENDCG } }