Mesa (master): r300g: Do not abort on fragment program compiler error
Nicolai Hähnle
nh at kemper.freedesktop.org
Sat Oct 3 17:30:16 UTC 2009
Module: Mesa
Branch: master
Commit: 81e5188f66248424d54fcf1d85a81510694bd472
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=81e5188f66248424d54fcf1d85a81510694bd472
Author: Nicolai Hähnle <nhaehnle at gmail.com>
Date: Sat Oct 3 19:20:31 2009 +0200
r300g: Do not abort on fragment program compiler error
Signed-off-by: Nicolai Hähnle <nhaehnle at gmail.com>
---
src/gallium/drivers/r300/r300_fs.c | 11 ++++++++---
src/gallium/drivers/r300/r300_fs.h | 2 +-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index a0e848a..546ad54 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -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... */
diff --git a/src/gallium/drivers/r300/r300_fs.h b/src/gallium/drivers/r300/r300_fs.h
index 9fab789..967e9f6 100644
--- a/src/gallium/drivers/r300/r300_fs.h
+++ b/src/gallium/drivers/r300/r300_fs.h
@@ -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 */
More information about the mesa-commit
mailing list