Skip to main content
GameDev.net gamedev.net
🔒 Locked

what is cg_invalid_program_handle_error

Started by sung Apr 3, 2009 at 11:06 PM 0 replies 700+ views
Original Post
sung
sung
I make a program for color conversion from RGB to HSV on GPU. But it gives "CG_INVALID_PROGRAM_HANDLE_ERROR". To fix this error, what I have to do? In fact, I'm very beginner of Cg. I hope I can get any kinds of comments or suggetions on this problems. Just in case, I also attach my code. float3 RGB_to_HSV( float3 color ) { float r, g, b, delta; float colorMax, colorMin; float h=0, s=0, v=0; float4 hsv=0; r = color[0]; g = color[1]; b = color[2]; colorMax = max(r, g); colorMax = max(colorMax, b); colorMin = min(r, g); colorMin = min(colorMin, b); v = colorMax; //this is value if( colorMax != 0) s = (colorMax - colorMin ) / colorMax; if( s != 0) { delta = colorMax - colorMin; if( x==colorMax ) h = (g-b)/delta; else if( g==colorMax ) h = 2.0 + (b-r)/delta; else h = 4.0 + (r-g)/delta; h *= 60; if( h<0 ) h += 360; hsv[0] = h/360.0; //moving h to be between 0 and 1 hsv[1] = s; hsv[2] = v; } return hsv; } fragout main( float4 TexCoords : TEXCOORD0, float4 WinPos : WPOS, uniform samplerRECT inputTexture : TEXUNIT0 ) : COLOR { fragout OUT; float2 pos = TexCoords.xy; float3 RGB = texRECT(inputTexture, pos); RGB /= 255.0; float3 HSV = RGB_to_HSV( RGB ); HSV *= 255.0; OUT = HSV; return OUT; }

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.