[Piglit] [PATCH] tex-miplevel-selection: use GL_CLAMP_TO_EDGE instead of GL_REPEAT

sroland at vmware.com sroland at vmware.com
Wed Aug 6 19:51:28 PDT 2014


From: Roland Scheidegger <sroland at vmware.com>

GL_REPEAT is not legal for the rectangle targets, and because the test uses
sampler objects the default GL_REPEAT value will be used even for rectangle
target because unlike texture objects they can't be initialized to the legal
CLAMP_TO_EDGE value. According to the spec the texture actually should be
treated as incomplete in this case which mesa does not do (and I don't know if
anyone bothers enough to fix this) but some drivers (like llvmpipe) might
not treat unnormalized coords correctly in this case.
---
 tests/texturing/tex-miplevel-selection.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/texturing/tex-miplevel-selection.c b/tests/texturing/tex-miplevel-selection.c
index 11e4292..ef9a066 100644
--- a/tests/texturing/tex-miplevel-selection.c
+++ b/tests/texturing/tex-miplevel-selection.c
@@ -981,6 +981,10 @@ piglit_init(int argc, char **argv)
 
 	set_sampler_parameter(GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 	set_sampler_parameter(GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+	/* need to set this for rect targets, otherwise default GL_REPEAT
+	 * in sampler obj should trigger incomplete tex behavior */
+	set_sampler_parameter(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+	set_sampler_parameter(GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
 	if (IS_SHADOW(target)) {
 		glActiveTexture(GL_TEXTURE1);
-- 
1.9.1


More information about the Piglit mailing list