PDA

View Full Version : glCompileShaderARB crashes



Rainer Deyke
03-27-2005, 08:21 PM
Not sure if this is the right place to post this...

I've got a program that crashes on glCompileShaderARB. The problem seems to be related to the use of gl_TexCoord in a GLSL fragment shader. I've reduced it to the following minimal example:
#include "SDL.h"
#include "GL/glew.h"

char const *shader_source =
"uniform sampler2D texture;\n"
"void main()\n"
"{\n"
" gl_FragColor = texture2D(texture, gl_TexCoord[0].st);\n"
"}\n";

int main(int, char *[])
{
SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(640, 480, 32, SDL_OPENGL);
glewInit();
GLhandleARB shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
glShaderSourceARB(shader, 1, &shader_source, 0);
glCompileShaderARB(shader);
SDL_Quit();
return 0;
}This crashes on my Mac Mini. It does not crash on any other computer I've tried, but I've only tried one other computer. The Mac Mini has OS X 10.3.8 installed, and identifies its video card as ATY,RV280, vendor ATI. This looks like a driver bug to me, although I don't want to rule out other possibilities.

Questions: Can anybody confirm this bug? How widespread is it? Are there any known workarounds?

Java Cool Dude
03-27-2005, 08:47 PM
RV280 (based on the dinosaur that is R200) doesn't support GLSL.
Get yourself at least something based on the R300 or NV30 architecture.

Rainer Deyke
03-27-2005, 09:56 PM
Upgrading my hardware isn't really a solution, since other people will still be running on old hardware. BTW, my Mac Mini might be very low end crap, but it isn't actually more than a couple of months old.

Actually my program runs fine on most OpenGL cards, including very old cards. I use GLEW_ARB_fragment_shader to detect if GLSL fragment shaders are supported, use a fragment shader if available, and use a workaround if not. My Mac Mini reports that GLSL fragment shaders are supported.

If the RV280 erronously claims to support fragment shaders, then I have the following options:

Never use fragment shaders and always use the workaround. Try to somehow detect if the hardware erronously claims to support GLSL fragment shaders. Leave the decision up to the user. Fail to run on hardware that erronously claims to support GLSL shaders.
None of these options seem very attractive to me.

jra101
03-28-2005, 09:48 AM
The current release of Mac OS X doesn't really support GLSL on any card (any your specifically will never run ARB_fragment_shader in hardware) but does advertise most of the GLSL extensions, which the exception of GL_ARB_shading_language_100.

They support the GLSL API, but the actual shader compiler isn't in there.