Couple of questions. I’m using multi-texturing and a cg fragment shader to perform a tri-linear interpolation between two textures. The program works at home but not at work. I have an nVidia 3400 @ home and a nVidia Quadro 4 980 @ work.
This is the code I use to determine which profile, but it returns FP20 for the Quadro 4 980.
if(cgGLIsProfileSupported(CG_PROFILE_ARBFP1) )
_CGprofile_pixel = CG_PROFILE_ARBFP1;
else if(cgGLIsProfileSupported(CG_PROFILE_FP30) )
_CGprofile_pixel = CG_PROFILE_FP30;
else if(cgGLIsProfileSupported(CG_PROFILE_FP20) )
_CGprofile_pixel = CG_PROFILE_FP20;
else
{
return false;
}
OK, when I use cgc to compile this program using the FP20 profile it dies:
trilinear.cg
trilinear.cg(8) : error C6028: Texture unit 0 already bound to sampler ‘texUV’
trilinear.cg(9) : error C6028: Texture unit 0 already bound to sampler ‘texUV’
trilinear.cg(8) : error C6028: Texture unit 0 already bound to sampler ‘texUV’
trilinear.cg(9) : error C6028: Texture unit 0 already bound to sampler ‘texUV’
15 lines, 4 errors.
Questions:
- How do I perform this task when I’m stuck on a fp20 profile.
- Is the code above matching the card to the correct profile?
Thanks
float4 main(half3 texUV : TEXCOORD0,
uniform sampler2D texture0,
uniform sampler2D texture1) : COLOR
{
//two blinear fetches
float4 tex0 = tex2D(texture0, texUV.xy);
float4 tex1 = tex2D(texture1, texUV.xy);
//liner interpolation
float4 result = lerp(tex0, tex1, texUV.z);
return result;
}