Redefinition of iterator in for-loops

  • Daodan
  • Topic Author
More
6 years 7 months ago - 6 years 7 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: 6 years 7 months ago by Daodan.

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

  • crosire
More
6 years 7 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.