st/mesa: optimize DEPTH_STENCIL copies using fragment shader
[mesa.git] / src / mesa / swrast / s_span.c
index 87b72e81970440daf87a1677bc3b7f40278ab9e4..dcb2db01e6d09c204ce444195eb1b73fd1380125 100644 (file)
@@ -37,7 +37,7 @@
 #include "main/format_pack.h"
 #include "main/format_unpack.h"
 #include "main/macros.h"
-#include "main/imports.h"
+
 #include "main/image.h"
 #include "main/samplerobj.h"
 #include "main/state.h"
@@ -74,7 +74,7 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span)
       if (ctx->DrawBuffer->Visual.depthBits <= 16)
          span->z = FloatToFixed(ctx->Current.RasterPos[2] * depthMax + 0.5F);
       else {
-         GLfloat tmpf = ctx->Current.RasterPos[2] * depthMax; 
+         GLfloat tmpf = ctx->Current.RasterPos[2] * depthMax;
          tmpf = MIN2(tmpf, depthMax);
          span->z = (GLint)tmpf;
       }
@@ -390,7 +390,7 @@ _swrast_span_interpolate_z( const struct gl_context *ctx, SWspan *span )
 
    if (ctx->DrawBuffer->Visual.depthBits <= 16) {
       GLfixed zval = span->z;
-      GLuint *z = span->array->z; 
+      GLuint *z = span->array->z;
       for (i = 0; i < n; i++) {
          z[i] = FixedToInt(zval);
          zval += span->zStep;
@@ -426,7 +426,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
    GLfloat x = sqrtf(dudx * dudx + dvdx * dvdx);
    GLfloat y = sqrtf(dudy * dudy + dvdy * dvdy);
    GLfloat rho = MAX2(x, y);
-   GLfloat lambda = LOG2(rho);
+   GLfloat lambda = log2f(rho);
    return lambda;
 }
 
@@ -453,7 +453,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
    maxU = MAX2(dsdx2, dsdy2) * texW;
    maxV = MAX2(dtdx2, dtdy2) * texH;
    rho = MAX2(maxU, maxV);
-   lambda = LOG2(rho);
+   lambda = logf2(rho);
    return lambda;
 }
 #endif
@@ -769,7 +769,7 @@ clip_span( struct gl_context *ctx, SWspan *span )
           * For arrays of values, shift them left.
           */
          for (i = 0; i < VARYING_SLOT_MAX; i++) {
-            if (span->interpMask & (1 << i)) {
+            if (span->interpMask & (1u << i)) {
                GLuint j;
                for (j = 0; j < 4; j++) {
                   span->attrStart[i][j] += leftClip * span->attrStepX[i][j];
@@ -1041,8 +1041,8 @@ put_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
            GLuint count, const GLint x[], const GLint y[],
            const void *values, const GLubyte *mask)
 {
-   gl_pack_ubyte_rgba_func pack_ubyte = NULL;
-   gl_pack_float_rgba_func pack_float = NULL;
+   mesa_pack_ubyte_rgba_func pack_ubyte = NULL;
+   mesa_pack_float_rgba_func pack_float = NULL;
    GLuint i;
 
    if (datatype == GL_UNSIGNED_BYTE)
@@ -1219,7 +1219,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
       if (!(span->arrayMask & SPAN_Z))
          _swrast_span_interpolate_z(ctx, span);
 
-      if (ctx->Transform.DepthClamp)
+      if (ctx->Transform.DepthClampNear && ctx->Transform.DepthClampFar)
         _swrast_depth_clamp_span(ctx, span);
 
       if (_mesa_stencil_is_enabled(ctx)) {
@@ -1314,7 +1314,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
    {
       const GLuint numBuffers = fb->_NumColorDrawBuffers;
       const struct gl_program *fp = ctx->FragmentProgram._Current;
-      const GLboolean multiFragOutputs = 
+      const GLboolean multiFragOutputs =
          _swrast_use_fragment_program(ctx)
          && fp->info.outputs_written >= (1 << FRAG_RESULT_DATA0);
       /* Save srcColorType because convert_color_type() can change it */