diff options
author | Chia-I Wu <[email protected]> | 2014-04-14 21:52:34 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-06-18 13:43:05 +0800 |
commit | 88b887faa9209a58d29c819e01f9ad37ebc99a36 (patch) | |
tree | 7dad3c73934fe142c18fb7da5a94f899ad82d39c /src/mesa | |
parent | 6c2d815d64af177321cf6f903c04c4820da5f81a (diff) |
i965/vec4: unit test for copy propagation and writemask
This unit test demonstrates a subtle bug fixed by
4ddf51db6af36736d5d42c1043eeea86e47459ce.
Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp index cb70096e58c..fd517f87c09 100644 --- a/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp @@ -154,3 +154,33 @@ TEST_F(copy_propagation_test, test_swizzle_swizzle) SWIZZLE_X, SWIZZLE_Y)); } + +TEST_F(copy_propagation_test, test_swizzle_writemask) +{ + dst_reg a = dst_reg(v, glsl_type::vec4_type); + dst_reg b = dst_reg(v, glsl_type::vec4_type); + dst_reg c = dst_reg(v, glsl_type::vec4_type); + + v->emit(v->MOV(b, swizzle(src_reg(a), BRW_SWIZZLE4(SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_X, + SWIZZLE_Z)))); + + v->emit(v->MOV(writemask(a, WRITEMASK_XYZ), src_reg(1.0f))); + + vec4_instruction *test_mov = + v->MOV(c, swizzle(src_reg(b), BRW_SWIZZLE4(SWIZZLE_W, + SWIZZLE_W, + SWIZZLE_W, + SWIZZLE_W))); + v->emit(test_mov); + + copy_propagation(v); + + /* should not copy propagate */ + EXPECT_EQ(test_mov->src[0].reg, b.reg); + EXPECT_EQ(test_mov->src[0].swizzle, BRW_SWIZZLE4(SWIZZLE_W, + SWIZZLE_W, + SWIZZLE_W, + SWIZZLE_W)); +} |