Module: Mesa
Branch: master
Commit: a88c9296cb079ff42ef901113d0fe772228e6feb
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a88c9296cb079ff42ef901113d0fe772228e6feb

Author: Andre Maasikas <[email protected]>
Date:   Wed Oct 21 12:23:27 2009 +0300

r600: need to export something from PS

 Also avoids empty shader for "END" - seems to be somewhat valid fp
 Maybe this can be done differently in the future (fake FRAG_RESULT_COLOR
 already in Map_Fragment_Program() or is there a way to program the chip
 to not hang in case of no exports.

---

 src/mesa/drivers/dri/r600/r700_assembler.c |   11 ++++++++++-
 src/mesa/drivers/dri/r600/r700_fragprog.c  |   10 +++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c 
b/src/mesa/drivers/dri/r600/r700_assembler.c
index d0eb994..6ff08e1 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -4187,6 +4187,7 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase 
*pR700AsmCode,
                                    GLbitfield          OutputsWritten)  
 { 
     unsigned int unBit;
+    GLuint export_count = 0;
 
     if(pR700AsmCode->depth_export_register_number >= 0) 
     {
@@ -4208,6 +4209,7 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase 
*pR700AsmCode,
         {
             return GL_FALSE;
         }
+        export_count++;
        }
        unBit = 1 << FRAG_RESULT_DEPTH;
        if(OutputsWritten & unBit)
@@ -4221,8 +4223,15 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase 
*pR700AsmCode,
         {
             return GL_FALSE;
         }
+        export_count++;
        }
-
+    /* Need to export something, otherwise we'll hang
+     * results are undefined anyway */
+    if(export_count == 0)
+    {
+        Process_Export(pR700AsmCode, SQ_EXPORT_PIXEL, 0, 1, 0, GL_FALSE);
+    }
+    
     if(pR700AsmCode->cf_last_export_ptr != NULL) 
     {
         pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst        = 
SQ_CF_INST_EXPORT_DONE;
diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c 
b/src/mesa/drivers/dri/r600/r700_fragprog.c
index 62a1ea1..3736bce 100644
--- a/src/mesa/drivers/dri/r600/r700_fragprog.c
+++ b/src/mesa/drivers/dri/r600/r700_fragprog.c
@@ -251,7 +251,15 @@ GLboolean r700TranslateFragmentShader(struct 
r700_fragment_program *fp,
                number_of_colors_exported--;
        }
 
-       fp->r700Shader.exportMode = number_of_colors_exported << 1 | z_enabled;
+       /* illegal to set this to 0 */
+       if(number_of_colors_exported || z_enabled)
+       {
+           fp->r700Shader.exportMode = number_of_colors_exported << 1 | 
z_enabled;
+       }
+       else
+       {
+           fp->r700Shader.exportMode = (1 << 1);
+       }
 
     fp->translated = GL_TRUE;
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to