From 9bbe4365d13a5297747518d0292d1833d86082ab Mon Sep 17 00:00:00 2001 From: Triang3l Date: Tue, 27 Oct 2020 21:01:55 +0300 Subject: [PATCH] [GPU] Fix adaptive quad tessellation inside factors --- .../gpu/d3d12/shaders/adaptive_quad.hs.hlsl | 6 ++- .../d3d12/shaders/dxbc/adaptive_quad_hs.cso | Bin 3896 -> 3924 bytes .../gpu/d3d12/shaders/dxbc/adaptive_quad_hs.h | 42 +++++++++--------- .../d3d12/shaders/dxbc/adaptive_quad_hs.txt | 9 ++-- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl b/src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl index 6e27fe80e..e84d11cb2 100644 --- a/src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl +++ b/src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl @@ -39,11 +39,13 @@ XeHSConstantDataOutput XePatchConstant( xe_tessellation_factor_range.x, xe_tessellation_factor_range.y); } + // On the Xbox 360, according to the presentation, the inside factor is the + // minimum of the factors of the edges along the axis. // Direct3D 12: // [0] - along U. // [1] - along V. - output.inside[0u] = min(output.edges[0u], output.edges[2u]); - output.inside[1u] = min(output.edges[1u], output.edges[3u]); + output.inside[0u] = min(output.edges[1u], output.edges[3u]); + output.inside[1u] = min(output.edges[0u], output.edges[2u]); return output; } diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.cso b/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.cso index fe88e8054b3d66d4a481f5a67030eba44a1dfa52..d70d8e09634defa8cb910957bf84f7678349dcc7 100644 GIT binary patch delta 171 zcmdlXcSTOpCBn%$bDm_XubD5~$CJC4b}>ZGV`N}p2$?7;&A4Nu>3MF>4NMFSfeg$H zYc})pm@_HLF)*+TF$e(FFfed6Fg7>>X+{Si2GYhrA)(2Ud}>N8N(dzkW*{vJ7Z_N8 pN~B=olPB^COY?&?12G720x?Jh&^nOV(|>pCmz7Z}o?-lHyg%jtGBPkQSWJ|ZW}LIp^gK7`6eb3SKn7-p zrJH$q%$Y>Z7#LWD7zBW77#O%37#WO#l+xr>J~cIVA%zPJEFfX1v=o%KV_;wm4si^b g0+i#Me2`C=6=VhDWJiAC$shP+CQe|P%){>i04SRrIRF3v diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.h b/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.h index 84a5d315c..b3e54f890 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.h +++ b/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.h @@ -1,11 +1,11 @@ // generated from `xb buildhlsl` // source: adaptive_quad.hs.hlsl const uint8_t adaptive_quad_hs[] = { - 0x44, 0x58, 0x42, 0x43, 0x09, 0x4F, 0xBB, 0x85, 0xF4, 0xA9, 0x5A, 0x24, - 0x49, 0x56, 0x0F, 0x66, 0x0D, 0xF9, 0x1F, 0xFD, 0x01, 0x00, 0x00, 0x00, - 0x38, 0x0F, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x44, 0x58, 0x42, 0x43, 0x69, 0x9E, 0x19, 0x65, 0x4D, 0x36, 0x4D, 0x06, + 0xF1, 0xC9, 0xBB, 0xA5, 0x8A, 0x00, 0x59, 0x9E, 0x01, 0x00, 0x00, 0x00, + 0x54, 0x0F, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xD4, 0x0A, 0x00, 0x00, 0x08, 0x0B, 0x00, 0x00, 0x3C, 0x0B, 0x00, 0x00, - 0x00, 0x0C, 0x00, 0x00, 0x9C, 0x0E, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, + 0x00, 0x0C, 0x00, 0x00, 0xB8, 0x0E, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x94, 0x0A, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48, 0x00, 0x05, 0x00, 0x00, 0x6A, 0x0A, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, @@ -257,8 +257,8 @@ const uint8_t adaptive_quad_hs[] = { 0x53, 0x56, 0x5F, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56, 0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0xAB, 0xAB, - 0x53, 0x48, 0x45, 0x58, 0x94, 0x02, 0x00, 0x00, 0x51, 0x00, 0x03, 0x00, - 0xA5, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, 0x93, 0x20, 0x00, 0x01, + 0x53, 0x48, 0x45, 0x58, 0xB0, 0x02, 0x00, 0x00, 0x51, 0x00, 0x03, 0x00, + 0xAC, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, 0x93, 0x20, 0x00, 0x01, 0x94, 0x20, 0x00, 0x01, 0x95, 0x18, 0x00, 0x01, 0x96, 0x20, 0x00, 0x01, 0x97, 0x18, 0x00, 0x01, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -305,25 +305,27 @@ const uint8_t adaptive_quad_hs[] = { 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x12, 0xB0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x01, 0x00, 0x33, 0x00, 0x00, 0x0A, - 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0x91, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x01, 0x80, 0x41, 0x00, 0x00, 0x00, + 0x01, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x0A, + 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0x91, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0xD1, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x00, 0x07, 0x12, 0x20, 0xD0, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, - 0x94, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x04, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x80, 0x01, 0x00, 0x36, 0x00, 0x00, 0x07, 0x12, 0x20, 0xD0, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, + 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.txt b/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.txt index 398da84c6..6e2b041b8 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.txt +++ b/src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.txt @@ -127,8 +127,9 @@ dcl_output_siv o5.x, finalQuadVInsideTessFactor dcl_temps 1 dcl_indexrange o4.x 2 dcl_indexrange vpc0.x 4 -mov r0.x, vJoinInstanceID.x -min r0.y, vpc[r0.x + 0].x, vpc[r0.x + 2].x -mov o[r0.x + 4].x, r0.y +iadd r0.x, -vJoinInstanceID.x, l(1) +min r0.x, vpc[r0.x + 0].x, vpc[r0.x + 2].x +mov r0.y, vJoinInstanceID.x +mov o[r0.y + 4].x, r0.x ret -// Approximately 14 instruction slots used +// Approximately 15 instruction slots used