Cg ridiculousity

Greetings!

Well, I haven’t been looking closely at the graphics industry for the past two years now, so there are things concerning recent developments I can’t fully cath up with… I’m saying this because I’m not really sure what kind of problem I’m confronted with, maybe I’m overlooking something trivial (which could easily be the case).

I’m basically trying to run a Cg program :slight_smile:

It may be funny, but following the Cg docs, I initialize a cg context, load the program and eventually enable a FP profile. So far so good. Checking Cg errors says everythins’s alright…

At rendering time, I set up the shader state (for the sake of simplicity I’m just binding the loaded FP CG program) and render the world.

A black screen.

At first I thought it’d be maybe a depth testing problem (I didn’t set the DEPTH FP output, so it could have been possible that the default value is on the near clip plane, so all fragments would be discarded) so I disabled depth testing, as well as stencil testing. Then I simplified the FP shader to simply return a red value (expecting a red screen)…

Nothing.

Desperated, I decided to check ALL Cg errors, and Eureka! there was it: after the binding of the FP program the Cg runtime sayed: “profile not supported”. Considering the fact, that I loaded the fp program, enabled the profile etc AND checked all errors in between (and there were none), I was a little bit confused…

Any ideas?

I’m using latest Nvidia drivers and a GForce 6600 Gt…

Thanks for any responses…

Ah yes, it’d be trivial if that’d be the problem… I forgot to say that I tried ALL possible FP profiles…

Cg’s language capability is limited by the underlying profile, i.e. the instruction set you’re allowing Cg to compile for.

It is likely that you are performing an operation that is simply illegal for your target profile, perhaps because you are compiling to a profile that is more limited than it needs to be for your hardware, for example arbvp1.

You may also have done something like attempt to compile a vertex program for a fragment profile or vice versa.

Try a simple shader to start with and make sure you can get it working first.

You appended while I was typing.

Try a simple program, you may be trying something that isn’t supported on your hardware.

Well that’s what I thought too. However, if I’d been compiling the program with a profile too primitive, I’d have gotten a compile error. Anyway here’s the “red” shader I’m using:

float4 main() : COLOR

{

float4 col;

col.x = 1.0;

col.y = 0.0;

col.z = 0.0;

return col;

} // main

The point is the Cg runtime reports “profile not supported” after binding that program (NOT afer loading it or enabling the profile). That’s the interesting part…

Do you have a valid current OpenGL context when you bind it?

P.S. moving to the shader forum, you’ll get better eyes on your problem there.