Redefinition of iterator in for-loops

  • Daodan
  • Topic Author
More
5 years 2 months ago - 5 years 2 months ago #1 by Daodan Redefinition of iterator in for-loops was created by Daodan
The following shader fails to compile as the iterator in the second for-loop gets recognized as a redefinition of 'i':

#include "ReShade.fxh"

float3 Test_PS(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target {
	float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;

	for(int i = 0; i < 2; i++) {
		color = 1.0 - color;
	}

	for(int i = 0; i < 2; i++) {
		color = 1.0 - color;
	}

	return color;
}

technique Test {
	pass {
		VertexShader = PostProcessVS;
		PixelShader = Test_PS;
		/* RenderTarget = BackBuffer */
	}
}

[Edit] This happens in all three APIs.
Last edit: 5 years 2 months ago by Daodan.

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

  • crosire
More
5 years 2 months ago #2 by crosire Replied by crosire on topic Redefinition of iterator in for-loops
The following user(s) said Thank You: Daodan, seri14

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

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.