From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 93594] Flickering Shadows in The Talos Principle Date: Wed, 17 Feb 2016 01:17:50 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1788263290==" Return-path: Received: from culpepper.freedesktop.org (unknown [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id A85A06E298 for ; Wed, 17 Feb 2016 01:17:50 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1788263290== Content-Type: multipart/alternative; boundary="14556718703.6eAB.9677"; charset="UTF-8" --14556718703.6eAB.9677 Date: Wed, 17 Feb 2016 01:17:50 +0000 MIME-Version: 1.0 Content-Type: text/plain https://bugs.freedesktop.org/show_bug.cgi?id=93594 --- Comment #8 from Marek Olšák --- I've captured one of the problematic draw calls, which used this fragment shader: FRAG DCL IN[0], GENERIC[9], PERSPECTIVE DCL OUT[0], COLOR DCL SAMP[0] DCL SVIEW[0], 2D, FLOAT DCL CONST[0..13] DCL CONST[15] DCL TEMP[0..3], LOCAL IMM[0] FLT32 { 1.0000, 0.0000, 0.2500, 4.0000} 0: MOV TEMP[0].xy, IN[0].xyyy 1: TEX TEMP[0].w, TEMP[0], SAMP[0], 2D 2: MUL TEMP[0].x, TEMP[0].wwww, IN[0].wwww 3: MAD TEMP[1].x, TEMP[0].xxxx, CONST[1].xxxx, CONST[1].yyyy 4: MOV_SAT TEMP[1].x, TEMP[1].xxxx 5: MOV TEMP[0].w, TEMP[1].xxxx 6: FSLT TEMP[1].x, TEMP[1].xxxx, CONST[0].xxxx 7: AND TEMP[1].x, TEMP[1].xxxx, IMM[0].xxxx 8: KILL_IF -TEMP[1].xxxx 9: MAD TEMP[0].x, IN[0].zzzz, CONST[0].zzzz, CONST[0].yyyy 10: MOV_SAT TEMP[1].x, TEMP[0].xxxx 11: DDX TEMP[2].x, TEMP[1].xxxx 12: ABS TEMP[2].x, TEMP[2].xxxx 13: MUL TEMP[3], CONST[15].xxxx, TEMP[1].xxxx 14: DDY TEMP[3].x, TEMP[3] 15: ABS TEMP[3].x, TEMP[3].xxxx 16: ADD TEMP[2].x, TEMP[2].xxxx, TEMP[3].xxxx 17: MAD TEMP[0].x, TEMP[2].xxxx, IMM[0].zzzz, TEMP[1].xxxx 18: MUL TEMP[1].x, TEMP[0].xxxx, TEMP[0].xxxx 19: ADD TEMP[1].x, TEMP[0].xxxx, -TEMP[1].xxxx 20: MUL TEMP[1].x, IMM[0].wwww, TEMP[1].xxxx 21: ADD TEMP[1].x, IMM[0].xxxx, -TEMP[1].xxxx 22: MOV TEMP[0].y, TEMP[1].xxxx 23: MOV TEMP[0].z, IMM[0].yyyy 24: MOV OUT[0], TEMP[0] 25: END If KILL_IF masks out some but not all invocations in a 2x2 quad, the subsequent DDX and DDY opcodes can result in undefined values, resulting in garbage on the output. The simple solution is to move KILL_IF to the end of the shader. I've verified that it works, but it's inefficient. The best solution would be to: - save the resulting EXEC mask after KILL_IF - use S_WQM on the exec mask to get a whole-quad mask - execute DDX and DDY - restore the EXEC mask (this must be done after both DDX & DDY but before PS exports) -- You are receiving this mail because: You are the assignee for the bug. --14556718703.6eAB.9677 Date: Wed, 17 Feb 2016 01:17:50 +0000 MIME-Version: 1.0 Content-Type: text/html

Comment # 8 on bug 93594 from
I've captured one of the problematic draw calls, which used this fragment
shader:

FRAG
DCL IN[0], GENERIC[9], PERSPECTIVE
DCL OUT[0], COLOR
DCL SAMP[0]
DCL SVIEW[0], 2D, FLOAT
DCL CONST[0..13]
DCL CONST[15]
DCL TEMP[0..3], LOCAL
IMM[0] FLT32 {    1.0000,     0.0000,     0.2500,     4.0000}
  0: MOV TEMP[0].xy, IN[0].xyyy
  1: TEX TEMP[0].w, TEMP[0], SAMP[0], 2D
  2: MUL TEMP[0].x, TEMP[0].wwww, IN[0].wwww
  3: MAD TEMP[1].x, TEMP[0].xxxx, CONST[1].xxxx, CONST[1].yyyy
  4: MOV_SAT TEMP[1].x, TEMP[1].xxxx
  5: MOV TEMP[0].w, TEMP[1].xxxx
  6: FSLT TEMP[1].x, TEMP[1].xxxx, CONST[0].xxxx
  7: AND TEMP[1].x, TEMP[1].xxxx, IMM[0].xxxx
  8: KILL_IF -TEMP[1].xxxx
  9: MAD TEMP[0].x, IN[0].zzzz, CONST[0].zzzz, CONST[0].yyyy
 10: MOV_SAT TEMP[1].x, TEMP[0].xxxx
 11: DDX TEMP[2].x, TEMP[1].xxxx
 12: ABS TEMP[2].x, TEMP[2].xxxx
 13: MUL TEMP[3], CONST[15].xxxx, TEMP[1].xxxx
 14: DDY TEMP[3].x, TEMP[3]
 15: ABS TEMP[3].x, TEMP[3].xxxx
 16: ADD TEMP[2].x, TEMP[2].xxxx, TEMP[3].xxxx
 17: MAD TEMP[0].x, TEMP[2].xxxx, IMM[0].zzzz, TEMP[1].xxxx
 18: MUL TEMP[1].x, TEMP[0].xxxx, TEMP[0].xxxx
 19: ADD TEMP[1].x, TEMP[0].xxxx, -TEMP[1].xxxx
 20: MUL TEMP[1].x, IMM[0].wwww, TEMP[1].xxxx
 21: ADD TEMP[1].x, IMM[0].xxxx, -TEMP[1].xxxx
 22: MOV TEMP[0].y, TEMP[1].xxxx
 23: MOV TEMP[0].z, IMM[0].yyyy
 24: MOV OUT[0], TEMP[0]
 25: END

If KILL_IF masks out some but not all invocations in a 2x2 quad, the subsequent
DDX and DDY opcodes can result in undefined values, resulting in garbage on the
output.

The simple solution is to move KILL_IF to the end of the shader. I've verified
that it works, but it's inefficient. The best solution would be to:
- save the resulting EXEC mask after KILL_IF
- use S_WQM on the exec mask to get a whole-quad mask
- execute DDX and DDY
- restore the EXEC mask (this must be done after both DDX & DDY but before PS
exports)


You are receiving this mail because:
  • You are the assignee for the bug.
--14556718703.6eAB.9677-- --===============1788263290== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1788263290==--