r300g: Do not abort on fragment program compiler error
authorNicolai Hähnle <nhaehnle@gmail.com>
Sat, 3 Oct 2009 17:20:31 +0000 (19:20 +0200)
committerNicolai Hähnle <nhaehnle@gmail.com>
Sat, 3 Oct 2009 17:29:48 +0000 (19:29 +0200)
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
src/gallium/drivers/r300/r300_fs.c
src/gallium/drivers/r300/r300_fs.h

index a0e848a59ac919ba9e936102dc6d7d73f1ca09de..546ad545a5330754ad560759432a06982282014f 100644 (file)
@@ -126,9 +126,14 @@ void r300_translate_fragment_shader(struct r300_context* r300,
     /* Invoke the compiler */
     r3xx_compile_fragment_program(&compiler);
     if (compiler.Base.Error) {
-        /* Todo: Fail gracefully */
-        fprintf(stderr, "r300 FP: Compiler error\n");
-        abort();
+        /* Todo: Fallback to software rendering gracefully? */
+        fprintf(stderr, "r300 FP: Compiler error: %s\n", compiler.Base.ErrorMsg);
+
+        if (compiler.is_r500) {
+            memcpy(compiler.code, &r5xx_passthrough_fragment_shader, sizeof(r5xx_passthrough_fragment_shader));
+        } else {
+            memcpy(compiler.code, &r3xx_passthrough_fragment_shader, sizeof(r3xx_passthrough_fragment_shader));
+        }
     }
 
     /* And, finally... */
index 9fab7894024061277f5532279d5e7a7b0c062db9..967e9f697e9aac47b1c7fe93750a6f1756ccb8d8 100644 (file)
@@ -48,4 +48,4 @@ struct r300_fragment_shader {
 void r300_translate_fragment_shader(struct r300_context* r300,
                                     struct r300_fragment_shader* fs);
 
-    #endif /* R300_FS_H */
+#endif /* R300_FS_H */