diff options
author | marha <marha@users.sourceforge.net> | 2011-03-10 12:57:09 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-03-10 12:57:09 +0000 |
commit | ae312a8a8042b4b23ffc652acf3b5cad1b3f07ca (patch) | |
tree | f54be422d872ddfcc3fa96dafe8c40288548ef22 /mesalib/src/mesa/swrast | |
parent | b5f8cc93800ce69d2c984081471b05e650ba9ddd (diff) | |
parent | f81bb3160c5f39d8f7ad329e99865af88f02b96a (diff) | |
download | vcxsrv-ae312a8a8042b4b23ffc652acf3b5cad1b3f07ca.tar.gz vcxsrv-ae312a8a8042b4b23ffc652acf3b5cad1b3f07ca.tar.bz2 vcxsrv-ae312a8a8042b4b23ffc652acf3b5cad1b3f07ca.zip |
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/swrast')
-rw-r--r-- | mesalib/src/mesa/swrast/s_texfilter.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 503f5b732..1d2b635e7 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -2918,51 +2918,51 @@ shadow_compare4(GLenum function, GLfloat coord, switch (function) {
case GL_LEQUAL:
- if (depth00 <= coord) luminance -= d;
- if (depth01 <= coord) luminance -= d;
- if (depth10 <= coord) luminance -= d;
- if (depth11 <= coord) luminance -= d;
+ if (coord > depth00) luminance -= d;
+ if (coord > depth01) luminance -= d;
+ if (coord > depth10) luminance -= d;
+ if (coord > depth11) luminance -= d;
return luminance;
case GL_GEQUAL:
- if (depth00 >= coord) luminance -= d;
- if (depth01 >= coord) luminance -= d;
- if (depth10 >= coord) luminance -= d;
- if (depth11 >= coord) luminance -= d;
+ if (coord < depth00) luminance -= d;
+ if (coord < depth01) luminance -= d;
+ if (coord < depth10) luminance -= d;
+ if (coord < depth11) luminance -= d;
return luminance;
case GL_LESS:
- if (depth00 < coord) luminance -= d;
- if (depth01 < coord) luminance -= d;
- if (depth10 < coord) luminance -= d;
- if (depth11 < coord) luminance -= d;
+ if (coord >= depth00) luminance -= d;
+ if (coord >= depth01) luminance -= d;
+ if (coord >= depth10) luminance -= d;
+ if (coord >= depth11) luminance -= d;
return luminance;
case GL_GREATER:
- if (depth00 > coord) luminance -= d;
- if (depth01 > coord) luminance -= d;
- if (depth10 > coord) luminance -= d;
- if (depth11 > coord) luminance -= d;
+ if (coord <= depth00) luminance -= d;
+ if (coord <= depth01) luminance -= d;
+ if (coord <= depth10) luminance -= d;
+ if (coord <= depth11) luminance -= d;
return luminance;
case GL_EQUAL:
- if (depth00 == coord) luminance -= d;
- if (depth01 == coord) luminance -= d;
- if (depth10 == coord) luminance -= d;
- if (depth11 == coord) luminance -= d;
+ if (coord != depth00) luminance -= d;
+ if (coord != depth01) luminance -= d;
+ if (coord != depth10) luminance -= d;
+ if (coord != depth11) luminance -= d;
return luminance;
case GL_NOTEQUAL:
- if (depth00 != coord) luminance -= d;
- if (depth01 != coord) luminance -= d;
- if (depth10 != coord) luminance -= d;
- if (depth11 != coord) luminance -= d;
+ if (coord == depth00) luminance -= d;
+ if (coord == depth01) luminance -= d;
+ if (coord == depth10) luminance -= d;
+ if (coord == depth11) luminance -= d;
return luminance;
case GL_ALWAYS:
- return 0.0;
+ return 1.0F;
case GL_NEVER:
return ambient;
case GL_NONE:
/* ordinary bilinear filtering */
return lerp_2d(wi, wj, depth00, depth10, depth01, depth11);
default:
- _mesa_problem(NULL, "Bad compare func in sample_depth_texture");
- return 0.0F;
+ _mesa_problem(NULL, "Bad compare func in sample_compare4");
+ return ambient;
}
}
@@ -3030,7 +3030,7 @@ sample_depth_texture( struct gl_context *ctx, if (tObj->MagFilter == GL_NEAREST) {
GLuint i;
for (i = 0; i < n; i++) {
- GLfloat depthSample;
+ GLfloat depthSample, depthRef;
GLint col, row, slice;
nearest_texcoord(tObj, level, texcoords[i], &col, &row, &slice);
@@ -3043,8 +3043,9 @@ sample_depth_texture( struct gl_context *ctx, depthSample = tObj->BorderColor.f[0];
}
- result = shadow_compare(function, texcoords[i][compare_coord],
- depthSample, ambient);
+ depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F);
+
+ result = shadow_compare(function, depthRef, depthSample, ambient);
switch (tObj->DepthMode) {
case GL_LUMINANCE:
@@ -3068,7 +3069,7 @@ sample_depth_texture( struct gl_context *ctx, GLuint i;
ASSERT(tObj->MagFilter == GL_LINEAR);
for (i = 0; i < n; i++) {
- GLfloat depth00, depth01, depth10, depth11;
+ GLfloat depth00, depth01, depth10, depth11, depthRef;
GLint i0, i1, j0, j1;
GLint slice;
GLfloat wi, wj;
@@ -3134,7 +3135,9 @@ sample_depth_texture( struct gl_context *ctx, }
}
- result = shadow_compare4(function, texcoords[i][compare_coord],
+ depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F);
+
+ result = shadow_compare4(function, depthRef,
depth00, depth01, depth10, depth11,
ambient, wi, wj);
|