[Piglit] [PATCH 1/4] fbo-3d: fix for non-NPOT

Luca Barbieri luca at luca-barbieri.com
Mon Aug 16 05:46:05 PDT 2010


fbo-3d is incorrectly computing the texture coordinate in the POT case.
---
 tests/fbo/fbo-3d.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/fbo/fbo-3d.c b/tests/fbo/fbo-3d.c
index 4ecff44..fbd4d3a 100644
--- a/tests/fbo/fbo-3d.c
+++ b/tests/fbo/fbo-3d.c
@@ -50,13 +50,15 @@ float depth_color[NUM_DEPTHS][4] = {
 	{0.0, 1.0, 1.0, 0.0},
 };
 
+int pot_depth;
+
 static int
 create_3d_fbo(void)
 {
 	GLuint tex, fb;
 	GLenum status;
 	int depth;
-	int pot_depth = glutExtensionSupported("GL_ARB_texture_non_power_of_two") ?
+	pot_depth = glutExtensionSupported("GL_ARB_texture_non_power_of_two") ?
 		NUM_DEPTHS: POT_DEPTHS;
 
 	glGenTextures(1, &tex);
@@ -110,7 +112,7 @@ done:
 static void
 draw_depth(int x, int y, int depth)
 {
-	float depth_coord = (float)depth / (NUM_DEPTHS - 1);
+	float depth_coord = (float)depth / (pot_depth - 1);
 
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-- 
1.7.0.4



More information about the Piglit mailing list