Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actuallwm

Posted 30 September 2013 - 10:29 AM

But what if your pixel shader looks like this:

float4 PS(PixelInputType input) : SV_TARGET
{
	if(input.color.r == 0)
	{
		discard;
	}
	return input.color;
}

Unless you know this is never going to happen, you should probably at least count the number of curly brackets. Add one when it's an opening bracket, subtract one when it's a closing bracket. You've reached the end of the function when the counter reaches zero again.


#1lwm

Posted 30 September 2013 - 10:27 AM

But what if your pixel shader looks like this:

float4 PS(PixelInputType input) : SV_TARGET
{
	if(input.color.r == 0)
	{
		discard;
	}
	return input.color;
}

Unless you know this is never going to happen, you should probably at least count the number of curly braces. Add one when it's an opening brace, subtract one when it's a closing brace. You've reached the end of the function when the counter reaches zero again.


PARTNERS