Merge branch 'r345-cleanup' of git://people.freedesktop.org/~agd5f/mesa into r500test
[mesa.git] / src / mesa / drivers / dri / r300 / r300_render.c
index eee1e803a00a38b32a512d48b4b4fe60bfe83cbf..fc07105c5604d319dbe90821cd27846e42f14acb 100644 (file)
@@ -334,13 +334,26 @@ static GLboolean r300RunRender(GLcontext * ctx,
 static int r300Fallback(GLcontext * ctx)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
-       struct r300_fragment_program *fp = (struct r300_fragment_program *)
+       /* Do we need to use new-style shaders?
+        * Also is there a better way to do this? */
+       if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
+               struct r500_fragment_program *fp = (struct r500_fragment_program *)
            (char *)ctx->FragmentProgram._Current;
-
-       if (fp) {
-               if (!fp->translated)
-                       r300TranslateFragmentShader(r300, fp);
-               FALLBACK_IF(!fp->translated);
+               if (fp) {
+                       if (!fp->translated) {
+                               r500TranslateFragmentShader(r300, fp);
+                               FALLBACK_IF(!fp->translated);
+                       }
+               }
+       } else {
+               struct r300_fragment_program *fp = (struct r300_fragment_program *)
+           (char *)ctx->FragmentProgram._Current;
+               if (fp) {
+                       if (!fp->translated) {
+                               r300TranslateFragmentShader(r300, fp);
+                               FALLBACK_IF(!fp->translated);
+                       }
+               }
        }
 
        FALLBACK_IF(ctx->RenderMode != GL_RENDER);