Welcome, Guest.
Username: Password: Remember me

TOPIC: Redefinition of iterator in for-loops

Redefinition of iterator in for-loops 2 months 1 week ago #1

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: 2 months 1 week ago by Daodan.
The administrator has disabled public write access.

Redefinition of iterator in for-loops 2 months 1 week ago #2

Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: Daodan, seri14