Hi,
I am experiencing an issue in the development of a custom effect, where a certain parameter (float3) will not set properly in an OpenGL project, however will work fine in a DirectX project. Here is my shader code:
#if OPENGL
#define SV_POSITION POSITION
#define VS_SHADERMODEL vs_3_0
#define PS_SHADERMODEL ps_3_0
#else
#define VS_SHADERMODEL vs_4_0_level_9_1
#define PS_SHADERMODEL ps_4_0_level_9_1
#endif
matrix WorldViewProjection;
float3 swizzle;
sampler2D TextureSampler : register(s0)
{
Texture = (Texture);
};
float4 MainPS(float4 position : SV_Position, float4 color : COLOR0, float2
TextureCoordinates : TEXCOORD0) : COLOR0
{
float4 col = tex2D(TextureSampler, TextureCoordinates) * color;
return float4(col[swizzle[0]], col[swizzle[1]], col[swizzle[2]], col[3]);
}
technique Swizzle
{
pass P0
{
PixelShader = compile PS_SHADERMODEL MainPS();
}
};
The parameter in question is swizzle
which appears to be set to a default value of 1, 1, 1
instead of what is set in my C# code. Interestingly, however, attempting to retrieve the value though C# reveals the value which I set it too, however hardcoding this value causes a different visual result.
Thank you in advance!