[SOLVED] I keep getting the error "function return value is missing semantics"

  • sixstringseraph
  • Topic Author
More
5 years 5 months ago - 5 years 5 months ago #1 by sixstringseraph [HELP] I keep getting the error "function return value is missing semantics" was created by sixstringseraph
I am trying to make a shader that renders to two textures, but I keep getting an error saying I'm missing semantics. I've looked and compared to examples but I cannot fix it. Any help would be appreciated.


Code:
texture texDS_1x1 { Width = 6; Height = 2; Format = RGBA16F; }; texture texPrevious { Width = 6; Height = 2; Format = RGBA16F; }; sampler samplerDS_1x1     {         Texture   = texDS_1x1;         MipFilter = POINT;         MinFilter = POINT;         MagFilter = POINT;     };     sampler samplerPrevious     {          Texture   = texPrevious;         MipFilter = POINT;         MinFilter = POINT;         MagFilter = POINT;     }; float4 PS_NightCheck( float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 finalValue : SV_Target0, out float4 prevMin : SV_Target1 )     {         float3 minColor;          float avgBlue=0;         float avgRed=0;         float avgGrn=0;         float3 checkValue;          int2 SampleRes     = 32;                  for( int y = 0; y < SampleRes.y; ++y )         {             for( int x = 0; x < SampleRes.x; ++x )             {                    minColor       = tex2Dfetch( samplerDS_1_Min, int2( x, y )).xyz;                 if (minColor.z>0.05f&&minColor.x<0.05f)                     {++avgBlue;}                 if (minColor.x>0.05f&&minColor.z<0.05f)                      {++avgRed;}                 if (minColor.y>0.05f&&minColor.z<0.05f)                     {++avgGrn;}                             }         }                  if (avgBlue>;(avgRed+avgGrn))         {              checkValue= ( 0.0f, 0.0f, 1.0f );         }         else         {              checkValue= ( 1.0f, 0.0f, 0.0f );         }           prevMin.xyz = tex2D( samplerDS_1x1, texcoord).xyz;         if (abs(prevMin.x-checkValue.x)>0.5)         {             finalValue.xyz = prevMin.xyz ;             prevMin.xyz = checkValue.xyz ;         }         else         {             finalValue.xyz = checkValue.xyz;         }         // Return         finalValue  = float4( finalValue.xyz, 1.0f ) ;         prevMin     = float4( prevMin.xyz, 1.0f ) ;     } // PASS pass NightCheck  //<-- ERROR HERE         {             VertexShader       = PostProcessVS;             PixelShader        = PS_NightCheck;             RenderTarget0      = texDS_1x1;             RenderTarget1      = texPrevious;         }
Last edit: 5 years 5 months ago by sixstringseraph. Reason: show error location

Please Log in or Create an account to join the conversation.

  • crosire
More
5 years 5 months ago - 5 years 5 months ago #2 by crosire Replied by crosire on topic [HELP] I keep getting the error "function return value is missing semantics"
Your "PS_NightCheck" is declared to return a float4 ("float4 PS_NightCheck(...)"), but no semantic is attached to it (would have to be "float4 PS_NightCheck(...) : SEMANTIC").
But you are actually returning data via out parameters now (finalValue and prevMin), so the function doesn't need a return type.
So simply changing your function declaration to this should fix it:
Code:
void PS_NightCheck( float4 pos : SV_Position, float2 texcoord : TEXCOORD, out float4 finalValue : SV_Target0, out float4 prevMin : SV_Target1 ) {     ... }
Last edit: 5 years 5 months ago by crosire.
The following user(s) said Thank You: sixstringseraph

Please Log in or Create an account to join the conversation.

  • sixstringseraph
  • Topic Author
More
5 years 5 months ago #3 by sixstringseraph Replied by sixstringseraph on topic [HELP] I keep getting the error "function return value is missing semantics"
That makes complete sense, and I never would ever have found it. Thanks so much! And thank for Reshade!

Please Log in or Create an account to join the conversation.