Skip to content

Commit

Permalink
Replacing Legacy COLOR Shader Output with SV_Target & Replacing POSIT…
Browse files Browse the repository at this point in the history
…ION for vertex shader outputs to SV_POSITION

Replaceing the Legacy D3D COLOR Semantic with the new SV_Target.

This has to be done to support properitary Shader Languages which aren't supporting the old COLOR Semantic anymore.

Also I placed in two instances the POSITION Semantic in the Vertex Shader Output with the SV_POSITION Semantic.
  • Loading branch information
akurama committed May 7, 2020
1 parent 8ca097b commit d5d3882
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Expand Up @@ -49,7 +49,7 @@ Shader "SVG Importer/SolidColor/SolidColorTexOverlayAlphaBlended" {
return o;
}

half4 fragmentColor(vertex_output i) : COLOR
half4 fragmentColor(vertex_output i) : SV_Target
{
return i.color * tex2D(_MainTex, i.uv);
}
Expand Down
Expand Up @@ -52,7 +52,7 @@ Shader "SVG Importer/SolidColor/SolidColorTexOverlayAlphaBlendedAntialiased" {
return o;
}

half4 fragmentColor(vertex_output i) : COLOR
half4 fragmentColor(vertex_output i) : SV_Target
{
return i.color * tex2D(_MainTex, i.uv);
}
Expand Down
Expand Up @@ -25,7 +25,7 @@ struct vertex_input_normal

struct vertex_output
{
float4 vertex : POSITION;
float4 vertex : SV_POSITION;
float4 uv0 : TEXCOORD0;
float4 uv1 : TEXCOORD1;
half4 color : COLOR;
Expand Down Expand Up @@ -73,14 +73,14 @@ vertex_output vertexGradientsAntialiased(vertex_input_normal v)
return o;
}

float4 fragmentGradientsOpaque(vertex_output i) : COLOR
float4 fragmentGradientsOpaque(vertex_output i) : SV_Target
{
float gradient = dot(tex2D(_GradientShape, i.uv0), i.uv1) ;
float2 gradientColorUV = float2(i.uv0.z + gradient, i.uv0.w);
return float4(tex2D(_GradientColor, gradientColorUV).rgb * i.color.rgb, 1.0);
}

float4 fragmentGradientsAlphaBlended(vertex_output i) : COLOR
float4 fragmentGradientsAlphaBlended(vertex_output i) : SV_Target
{
float gradient = dot(tex2D(_GradientShape, i.uv0), i.uv1) ;
float2 gradientColorUV = float2(i.uv0.z + gradient, i.uv0.w);
Expand Down
Expand Up @@ -37,7 +37,7 @@ vertex_output vertexColorAntialiased(vertex_input_normal v)
return o;
}

half4 fragmentColor(vertex_output i) : COLOR
half4 fragmentColor(vertex_output i) : SV_Target
{
return i.color;
}
6 changes: 3 additions & 3 deletions Assets/SVG Importer/Plugins/Shaders/SVGImporterUICG.cginc
Expand Up @@ -21,7 +21,7 @@ struct vertex_input

struct vertex_output
{
float4 vertex : POSITION;
float4 vertex : SV_POSITION;
float4 uv0 : TEXCOORD0;
float4 uv1 : TEXCOORD1;
float4 worldPosition : TEXCOORD2;
Expand Down Expand Up @@ -78,14 +78,14 @@ vertex_output vertexGradientsAntialiased(vertex_input v)
return o;
}

half4 fragmentGradientsOpaque(vertex_output i) : COLOR
half4 fragmentGradientsOpaque(vertex_output i) : SV_Target
{
float gradient = dot(tex2D(_GradientShape, i.uv0), i.uv1) ;
float2 gradientColorUV = float2(i.uv0.z + gradient, i.uv0.w);
return float4((tex2D(_GradientColor, gradientColorUV).rgb + _TextureSampleAdd) * i.color.rgb, 1.0);
}

half4 fragmentGradientsAlphaBlended(vertex_output i) : COLOR
half4 fragmentGradientsAlphaBlended(vertex_output i) : SV_Target
{
float gradient = dot(tex2D(_GradientShape, i.uv0), i.uv1) ;
float2 gradientColorUV = float2(i.uv0.z + gradient, i.uv0.w);
Expand Down

0 comments on commit d5d3882

Please sign in to comment.