I see, I think I know what you mean by you might not be able to use it eheh, I've tried use it and I can't return the binary code, the reason I think is because the use of the Cg, I tried some examples here using GLSL directily and it works, the problem is that I think the Shader code generator for OpenGL on dolphin generate Cg code instead of GLSL, I'm right?
If there is some way to generate GLSL I think it will be pretty easy to get the binary from it..
Here is some code of what I'm trying to do to grab the binary length needed for glGetProgramBinary, the -10 is just to see if the glGetProgramiv changed it, but it always remain -10, maybe I'm just doing it wrong?
About the ARB output, I've tried some naive benchmarks here with the emulator and it indeed helps the perfomance caching it, if there is no possibility to grab the binary code, I will try caching the ARB instead.
If there is some way to generate GLSL I think it will be pretty easy to get the binary from it..
Here is some code of what I'm trying to do to grab the binary length needed for glGetProgramBinary, the -10 is just to see if the glGetProgramiv changed it, but it always remain -10, maybe I'm just doing it wrong?
Code:
CGprogram program = cgCreateProgram(context, CG_SOURCE, source, ...);
const char* programARB = static_cast<char*>(cgGetProgramString(program,
CG_COMPILED_PROGRAM));
GLuint id;
glGenProgramsARB(1, id);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, id);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
static_cast<GLsizei>(strlen(programARB)), programARB);
GLint length = -10;
glGetProgramiv(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_BINARY_LENGTH, &lenght);
printf("LENGTH: %d\n", length);