[Piglit] [PATCH 2/3] depthstencil-render-miplevels: Make the stencil value scale like depth.

Eric Anholt eric at anholt.net
Tue Feb 26 12:39:32 PST 2013


This will let the presentation of stencil work like presentation of
depth.
---
 tests/texturing/depthstencil-render-miplevels.cpp |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/texturing/depthstencil-render-miplevels.cpp b/tests/texturing/depthstencil-render-miplevels.cpp
index 4fcc95a..b41fea8 100644
--- a/tests/texturing/depthstencil-render-miplevels.cpp
+++ b/tests/texturing/depthstencil-render-miplevels.cpp
@@ -227,6 +227,14 @@ set_up_framebuffer_for_miplevel(int level)
 	}
 }
 
+uint8_t
+stencil_for_level(int level)
+{
+	int step = 254 / max_miplevel;
+
+	return 1 + step * level;
+}
+
 /**
  * Using glClear, set the contents of the depth and stencil buffers
  * (if present) to a value that is unique to this miplevel.
@@ -242,7 +250,7 @@ populate_miplevel(int level)
 		clear_mask |= GL_DEPTH_BUFFER_BIT;
 	}
 	if (attach_stencil) {
-		glClearStencil(level + 1);
+		glClearStencil(stencil_for_level(level));
 		clear_mask |= GL_STENCIL_BUFFER_BIT;
 	}
 
@@ -268,7 +276,8 @@ test_miplevel(int level)
 
 	if (attach_stencil) {
 		printf("Probing miplevel %d stencil\n", level);
-		pass = piglit_probe_rect_stencil(0, 0, dim, dim, level + 1)
+		pass = piglit_probe_rect_stencil(0, 0, dim, dim,
+						 stencil_for_level(level))
 			&& pass;
 	}
 
-- 
1.7.10.4



More information about the Piglit mailing list