Corbin Simpson wrote: > Just got a bug report. A compiz plugin asked for five texture > indirections, but r300 can only do four. This kind of shader error > can't be worked around without a full fallback, but most APIs permit > shaders to fail to compile. Is it okay to fail shaders? Maybe return > NULL on creation if the shader can't be compiled?
For ARB vp/fp, glProgramString() can generate GL_INVALID_OPERATION if the program exceeds any driver/GPU limits. The app should call glGetError() to check. For GLSL shaders, glLinkProgram() can fail if the program exceeds limits. The app should call glGetProgramiv(GL_LINK_STATUS) to check. Unfortunately, we don't really have the infrastructure in place for the drivers to easily report this back to Mesa. One thing we could do is have ctx->Driver.ProgramStringNotify() return a boolean or error code to report success/failure by the driver. We call that function from glProgramString() and glLinkProgram() already. The problem is, most drivers delay Mesa -> GPU code translation until state validation, rather than doing it in ctx->Driver.ProgramStringNotify(). However, we don't necessarily need to do full Mesa->GPU translation in ProgramStringNotify() - we could just check the gl_program::NumTemporaries, NumTexIndirections, etc. fields and/or scan the instructions for specific information. Also note that we sometimes have modify GPU programs depending on other GL state (we do a lot of that in gallium) so it's possible (but probably pretty rare) that a shader will look OK at ProgramStringNotify() time but exceed some limits later. I'm not sure about what to do there. Anyway, a good first step would be to change ctx->Driver.ProgramStringNotify() to return a boolean pass/fail value that can be propogated up to the GL API. I could do that fairly quickly if that sounds OK. We haven't nailed this down for Gallium either, but returning NULL from pipe_context::create_vs/fs_state() might be a simple solution. -Brian ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev