Redefinition of iterator in for-loops

  • Posts: 176
1 year 1 month ago - 1 year 1 month ago #1 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.

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

  • Posts: 3665
1 year 1 month ago #2 by crosire
The following user(s) said Thank You: Daodan, seri14

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