r600: remove mask from output intructions
[mesa.git] / src / mesa / drivers / dri / r600 / r700_fragprog.c
index f9d84b6ed68946ec27bda626f8e7e94fc7a25bfc..217b0e27a4af488ae846feeda63f3747ef9247f9 100644 (file)
@@ -99,7 +99,6 @@ void Map_Fragment_Program(r700_AssemblerBase         *pAsm,
 {
        unsigned int unBit;
     unsigned int i;
-    GLuint       ui;
 
     /* match fp inputs with vp exports. */
     struct r700_vertex_program_cont *vpc =
@@ -245,12 +244,6 @@ void Map_Fragment_Program(r700_AssemblerBase         *pAsm,
         }
     }
 
-    pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports);
-    for(ui=0; ui<pAsm->number_of_exports; ui++)
-    {
-        pAsm->pucOutMask[ui] = 0x0;
-    }
-
     pAsm->flag_reg_index = pAsm->number_used_registers++;
 
     pAsm->uFirstHelpReg = pAsm->number_used_registers;
@@ -362,6 +355,9 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
                                                             struct gl_fragment_program   *mesa_fp,
                                  GLcontext *ctx) 
 {
+    context_t *context = R700_CONTEXT(ctx);      
+    R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
+
        GLuint    number_of_colors_exported;
        GLboolean z_enabled = GL_FALSE;
        GLuint    unBit, shadow_unit;
@@ -373,6 +369,17 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
     //Init_Program
        Init_r700_AssemblerBase( SPT_FP, &(fp->r700AsmCode), &(fp->r700Shader) );
 
+    if(GL_TRUE == r700->bShaderUseMemConstant)
+    {
+        fp->r700AsmCode.bUseMemConstant = GL_TRUE;
+    }
+    else
+    {
+        fp->r700AsmCode.bUseMemConstant = GL_FALSE;
+    }
+
+    fp->r700AsmCode.unAsic = 7;
+
     if(mesa_fp->Base.InputsRead & FRAG_BIT_WPOS)
     {
         insert_wpos_code(ctx, mesa_fp);
@@ -481,6 +488,14 @@ void * r700GetActiveFpShaderBo(GLcontext * ctx)
     return fp->shaderbo;
 }
 
+void * r700GetActiveFpShaderConstBo(GLcontext * ctx)
+{
+    struct r700_fragment_program *fp = (struct r700_fragment_program *)
+                                          (ctx->FragmentProgram._Current);
+
+    return fp->constbo0;
+}
+
 GLboolean r700SetupFragmentProgram(GLcontext * ctx)
 {
     context_t *context = R700_CONTEXT(ctx);
@@ -768,6 +783,17 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx)
                        r700->ps.consts[ui][2].f32All = paramList->ParameterValues[ui][2];
                        r700->ps.consts[ui][3].f32All = paramList->ParameterValues[ui][3];
            }
+
+        /* Load fp constants to gpu */
+        if( (GL_TRUE == r700->bShaderUseMemConstant) && (unNumParamData > 0) )
+        {
+            r600EmitShader(ctx,
+                           &(fp->constbo0),
+                           (GLvoid *)&(paramList->ParameterValues[0][0]),
+                           unNumParamData * 4,
+                           "FS Const");
+        }
+
     } else
            r700->ps.num_consts = 0;