"Program 'vert', incorrect number of arguments to numeric-type constructor (compiling for d3d11)" I tried UNITY_INITIALIZE_OUTPUT, #pragma target 5.0, initializing each output variable... nothing works. Anyone found a solution to this annoying warning? Shader works fine in dx9. Thanks.
Can you provide the listing of vert()? Have you been able to find a numeric-type constructor that the compiler might be complaining about?
Here: Code (csharp): struct v2f { float4 position : POSITION; float4 worldPos : TEXCOORD1; float2 texcoord : TEXCOORD0; }; v2f vert (appdata_base v) { v2f o; o.worldPos = mul(_Object2World, v.vertex); o.position = mul(UNITY_MATRIX_MVP, v.vertex); o.texcoord = v.texcoord.xy; return o; }
That's weird: unless I'm missing something, there are no numeric-type constructors in that function. I wish Unity's shader compilation errors were more helpful.
I fixed the warning just changed the float4(0) to float4(0,0,0,0), and warning is gone. or can fix it from fixed3 c = fixed3(Luminance(c)); to fixed3 c = fixed(Luminance(c)).xxx; // or just fixed3 c = Luminance(c); and the d3d11 warning should be gone. I'm using mac and don't know is it doing the same thing in pc.
Yeah, I get a lot of this stuff. DX11 seems very picky when assigning things compared to other platforms.
yes, the posted code from jesta didn't not have that float4(0), but he didn't post a completed code, so it may be in the fragment code somewhere. Anyway, it is just a general idea how i fixed that d3d11 warning issue. hope it helps for others.
Something if you get the problem in fragment or other function codes, then you will get the error message for Program vert from unity editor. The vert code from jesta has no problem at all, so the error is from other code. just don't trust all the error message from unity editor, need to try to test which code get the errors.
Ugh, you're right. I had the pass Code (csharp): Pass { Name "Zprime" Tags {"LightMode" = "Always"} ColorMask 0 CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float4 texcoord : TEXCOORD0; }; struct v2f { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; }; float4 _MainTex_ST; v2f vert (appdata v) { v2f o; o.pos = mul (UNITY_MATRIX_MVP, v.vertex); o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); return o; } sampler2D _MainTex; float _Cutoff; float4 frag(v2f IN) : COLOR { // Textures. fixed alpha = tex2D(_MainTex, IN.uv).a; clip(alpha - _Cutoff); return fixed4(0.0); } ENDCG } Which complained about d3d11 issues with the vert program. So I changed around a ton of stuff to try and sort it to no avail. Turns out it was the last line of the fragment shader. Changing it from return fixed4(0.0); to return fixed4(0.0,0.0,0.0,0.0); resolved the issue.
i have the same problem but with float3 Code (csharp): float3 ContrastSaturationBrightness(float3 color, float brt, float sat, float con) { float3 LumCoeff = float3(0.2125, 0.7154, 0.0721); float3 AvgLumin = float3(0.5, 0.5, 0.5); float3 brtColor = color * brt; float3 intensity = float3(dot(brtColor, LumCoeff)); float3 satColor = lerp(intensity, brtColor, sat); float3 conColor = lerp(AvgLumin, satColor, con); return conColor; }
Yeah that's the offending line: Code (csharp): float3 intensity = float3(dot(brtColor, LumCoeff)); Would have to split it like so: Code (csharp): float tmp = dot(brtColor, LumCoeff); float3 intensity = float3(tmp, tmp, tmp); I recognize this function from the "photoshop-maths shaders" blog page. Like all their shaders -- while it works, it's a little on the bloated side (which is better for clarity and understanding though). Here's my slightly leaner version: Code (csharp): void colorAdjust(inout half3 col) { col = lerp(0.5, col * _ContrastSaturationBrightness.z, _ContrastSaturationBrightness.x); col = lerp(Luminance(col), col, _ContrastSaturationBrightness.y); } The call to Luminance() assumes/requires that UnityCG.cginc is #included though --- which I need for other things in my post shader anyway..