summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_fs.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-04-26 04:52:28 +0200
committerMarek Olšák <[email protected]>2010-04-26 07:22:00 +0200
commit537d117ed57734d034560cc64fe1bed65a6375e3 (patch)
tree591097ed55689c374ab8784adddb6fe4f73ed00c /src/gallium/drivers/r300/r300_fs.c
parent52e591383bdce49cb46a1162aff9632c57e06504 (diff)
r300g: use the dummy FS shader for shaders with zero instructions
Diffstat (limited to 'src/gallium/drivers/r300/r300_fs.c')
-rw-r--r--src/gallium/drivers/r300/r300_fs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index 4d61f638530..88303f074cd 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -275,6 +275,14 @@ static void r300_translate_fragment_shader(
/* Invoke the compiler */
r3xx_compile_fragment_program(&compiler);
+ /* Shaders with zero instructions are invalid,
+ * use the dummy shader instead. */
+ if (shader->code.code.r500.inst_end == -1) {
+ rc_destroy(&compiler.Base);
+ r300_dummy_fragment_shader(r300, shader);
+ return;
+ }
+
if (compiler.Base.Error) {
fprintf(stderr, "r300 FP: Compiler Error:\n%sUsing a dummy shader"
" instead.\n", compiler.Base.ErrorMsg);