mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.
[mesa.git] / src / mesa / tnl / t_pipeline.c
index 357ef1e24b5bf4914fe2b3e3b4e31d86eb314ae3..8bc87ea8a4fc1274857672255212ec91e96f6e0d 100644 (file)
@@ -17,7 +17,7 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
@@ -28,7 +28,6 @@
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/imports.h"
-#include "main/state.h"
 #include "main/mtypes.h"
 
 #include "t_context.h"
@@ -36,7 +35,7 @@
 #include "t_vp_build.h"
 #include "t_vertex.h"
 
-void _tnl_install_pipeline( GLcontext *ctx,
+void _tnl_install_pipeline( struct gl_context *ctx,
                            const struct tnl_pipeline_stage **stages )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -48,7 +47,7 @@ void _tnl_install_pipeline( GLcontext *ctx,
     */
    for (i = 0 ; i < MAX_PIPELINE_STAGES && stages[i] ; i++) {
       struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i];
-      MEMCPY(s, stages[i], sizeof(*s));
+      memcpy(s, stages[i], sizeof(*s));
       if (s->create)
         s->create(ctx, s);
    }
@@ -56,7 +55,7 @@ void _tnl_install_pipeline( GLcontext *ctx,
    tnl->pipeline.nr_stages = i;
 }
 
-void _tnl_destroy_pipeline( GLcontext *ctx )
+void _tnl_destroy_pipeline( struct gl_context *ctx )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    GLuint i;
@@ -72,7 +71,7 @@ void _tnl_destroy_pipeline( GLcontext *ctx )
 
 
 
-static GLuint check_input_changes( GLcontext *ctx )
+static GLuint check_input_changes( struct gl_context *ctx )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    GLuint i;
@@ -86,20 +85,16 @@ static GLuint check_input_changes( GLcontext *ctx )
       }
    }
 
-   if (tnl->pipeline.input_changes &&
-      tnl->Driver.NotifyInputChanges) 
-      tnl->Driver.NotifyInputChanges( ctx, tnl->pipeline.input_changes );
-
    return tnl->pipeline.input_changes;
 }
 
 
-static GLuint check_output_changes( GLcontext *ctx )
+static GLuint check_output_changes( struct gl_context *ctx )
 {
 #if 0
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    
-   for (i = 0; i < VERT_RESULT_MAX; i++) {
+   for (i = 0; i < VARYING_SLOT_MAX; i++) {
       if (tnl->vb.ResultPtr[i]->size != tnl->last_result_size[i] ||
          tnl->vb.ResultPtr[i]->stride != tnl->last_result_stride[i]) {
         tnl->last_result_size[i] = tnl->vb.ResultPtr[i]->size;
@@ -118,7 +113,7 @@ static GLuint check_output_changes( GLcontext *ctx )
 }
 
 
-void _tnl_run_pipeline( GLcontext *ctx )
+void _tnl_run_pipeline( struct gl_context *ctx )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    unsigned short __tmp;
@@ -151,7 +146,17 @@ void _tnl_run_pipeline( GLcontext *ctx )
         _tnl_notify_pipeline_output_change( ctx );
    }
 
+#ifndef _OPENMP
+   /* Don't adjust FPU precision mode in case multiple threads are to be used.
+    * This would require that the additional threads also changed the FPU mode
+    * which is quite a mess as this had to be done in all parallelized sections;
+    * otherwise the master thread and all other threads are running in different
+    * modes, producing inconsistent results.
+    * Note that all x64 implementations don't define/use START_FAST_MATH, so
+    * this is "hack" is only used in i386 mode
+    */
    START_FAST_MATH(__tmp);
+#endif
 
    for (i = 0; i < tnl->pipeline.nr_stages ; i++) {
       struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i];
@@ -159,7 +164,9 @@ void _tnl_run_pipeline( GLcontext *ctx )
         break;
    }
 
+#ifndef _OPENMP
    END_FAST_MATH(__tmp);
+#endif
 }