Open
Description
When declaring an input such as
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_PrimitiveID 0 N/A primID PRIMID uint YES
gs_4_0
dcl_input vPrim
vPrim in dcl_input vPrim
is encoded as 0x0, while primID in the input signature is encoded as 0xFFFFFFFF, so GetInputSignatureFromRegister will either return the wrong input signature when there are multiple, or null if SV_PrimitiveID is the only input signature.
I would expect there would need to be a new GetInputSignatureFromX method to resolve it properly, similiar to how GetOutputSignatureFromSystemValue works, but dcl_input vPrim does not have an eSpecialName.
An example of a shader that will trigger this bug:
Shader "Unlit/TestShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma geometry geom
struct appdata {
};
struct v2g {
};
struct g2f
{
float4 pos : SV_POSITION;
float4 color: texcoord1;
float3 normal : TEXCOORD2;
};
v2g vert(appdata v)
{
v2g o = (v2g)0;
return o;
}
[maxvertexcount(3)]
void geom(triangle v2g IN[3], uint prim : SV_PrimitiveID, inout LineStream<g2f> tristream)
{
g2f o;
for (int i = 0; i < 2; i++)
{
o.pos = 0;
o.color = 0;
o.normal = 0;
tristream.Append(o);
}
}
float4 frag(g2f i) : COLOR{
float3 col = i.color;
return fixed4(col, 1);
}
ENDCG
}
}
}
Metadata
Metadata
Assignees
Labels
No labels