[Piglit] [PATCH] texture-integer-glsl130: Expect 1 for alpha in R, RG, RGB cases.

Kenneth Graunke kenneth at whitecape.org
Mon Nov 19 05:53:53 PST 2012


>From the GL 3.0 specification, page 162:
"Final Expansion to RGBA

 This step is performed only for non-depth component groups.  Each group
 is converted to a group of 4 elements as follows: if a group does not
 contain an A element, then A is added and set to 1 for integer
 components or 1.0 for floating point components.  If any of R, G, or B
 is missing from the group, each missing element is added and assigned a
 value of 0 for integer components or 0.0 for floating point
 components."

In other words, alpha should always be 1 when sampling from textures
whose format has less than 4 components.
---
 tests/spec/ext_texture_integer/texture-integer-glsl130.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

I think this is correct, but I'd really appreciate a sanity check.

This completely breaks the test on i965 (it was previously intermittent), but
I'm fairly certain that's a bug.  Reading the hardware docs (the "Sampler
Output Channel Mapping" section), it should promote R to (R, 0, 0, 1) and RG
to (R, G, 0, 1).  It just doesn't seem to be for some reason. :/

diff --git a/tests/spec/ext_texture_integer/texture-integer-glsl130.c b/tests/spec/ext_texture_integer/texture-integer-glsl130.c
index 17b02bc..4d59c52 100644
--- a/tests/spec/ext_texture_integer/texture-integer-glsl130.c
+++ b/tests/spec/ext_texture_integer/texture-integer-glsl130.c
@@ -373,10 +373,9 @@ test_format(const struct format_info *info)
 		value[0] = temp;
 		break;
 	case GL_RGB_INTEGER_EXT:
-		expected[3] = 0.0;
 		break;
 	case GL_RG_INTEGER:
-		expected[2] = expected[3] = 0.0;
+		expected[2] = 0.0;
 		break;
 	case GL_ALPHA_INTEGER_EXT:
 		expected[0] = expected[1] = expected[2] = 0.0;
@@ -404,7 +403,7 @@ test_format(const struct format_info *info)
 			expected[0] = expected[1] = expected[2] = expected[3] = 0.25;
 			value[1] = value[2] = value[3] = value[0];
 		} else {
-			expected[1] = expected[2] = expected[3] = 0.0;
+			expected[1] = expected[2] = 0.0;
 		}			
 		break;
 	default:
-- 
1.8.0



More information about the Piglit mailing list