[Mesa-dev] [PATCH 1/2] r300g: handle unsupported blend factor gracefully

David Heidelberg david at ixit.cz
Thu Feb 5 14:56:28 PST 2015


Rather not assert on known factors, just print warning and use ZERO.

Signed-off-by: David Heidelberg <david at ixit.cz>
---
 src/gallium/drivers/r300/r300_state_inlines.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index 97619db..67cd6e6 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -60,7 +60,6 @@ static INLINE uint32_t r300_translate_blend_function(int blend_func,
     return 0;
 }
 
-/* XXX we can also offer the D3D versions of some of these... */
 static INLINE uint32_t r300_translate_blend_factor(int blend_fact)
 {
     switch (blend_fact) {
@@ -99,17 +98,15 @@ static INLINE uint32_t r300_translate_blend_factor(int blend_fact)
         case PIPE_BLENDFACTOR_SRC1_ALPHA:
         case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
         case PIPE_BLENDFACTOR_INV_SRC1_ALPHA:
-            fprintf(stderr, "r300: Implementation error: "
-                "Bad blend factor %d not supported!\n", blend_fact);
-            assert(0);
-            break;
+            fprintf(stderr, "r300: Unsupported blend factor %d!\n",
+                    blend_fact);
+            return R300_BLEND_GL_ZERO;
 
         default:
             fprintf(stderr, "r300: Unknown blend factor %d\n", blend_fact);
             assert(0);
-            break;
+            return 0;
     }
-    return 0;
 }
 
 /* DSA state. */
-- 
2.2.2



More information about the mesa-dev mailing list