mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Manually pass dx/dy instead of using ddx/ddy, should improve interpolation somewhat
This commit is contained in:
@@ -1,83 +1,91 @@
|
|||||||
static unsigned char gs_shaderData[] = {
|
static unsigned char gs_shaderData[] = {
|
||||||
68, 88, 66, 67, 25, 9, 182, 224, 194, 109, 11, 128, 6, 99, 38,
|
68, 88, 66, 67, 232, 177, 184, 42, 191, 44, 237, 186, 185, 1, 42,
|
||||||
219, 209, 198, 219, 152, 1, 0, 0, 0, 252, 4, 0, 0, 5, 0,
|
67, 157, 207, 200, 70, 1, 0, 0, 0, 116, 5, 0, 0, 5, 0,
|
||||||
0, 0, 52, 0, 0, 0, 176, 0, 0, 0, 8, 1, 0, 0, 60,
|
0, 0, 52, 0, 0, 0, 52, 1, 0, 0, 140, 1, 0, 0, 192,
|
||||||
1, 0, 0, 128, 4, 0, 0, 82, 68, 69, 70, 116, 0, 0, 0,
|
1, 0, 0, 248, 4, 0, 0, 82, 68, 69, 70, 248, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0,
|
1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
|
||||||
0, 0, 4, 255, 255, 0, 137, 0, 0, 75, 0, 0, 0, 60, 0,
|
0, 0, 4, 255, 255, 0, 137, 0, 0, 208, 0, 0, 0, 92, 0,
|
||||||
0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255,
|
0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255,
|
||||||
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 0,
|
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 0,
|
||||||
115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114, 101, 0,
|
107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
|
||||||
76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112,
|
0, 0, 115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114,
|
||||||
105, 108, 101, 114, 32, 49, 48, 46, 49, 0, 171, 73, 83, 71, 78,
|
101, 0, 83, 83, 99, 97, 108, 101, 81, 117, 97, 100, 80, 105, 120,
|
||||||
80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0,
|
101, 108, 67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 107, 0, 0,
|
||||||
0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0,
|
0, 1, 0, 0, 0, 156, 0, 0, 0, 16, 0, 0, 0, 0, 0,
|
||||||
0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, 0, 16,
|
||||||
0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0,
|
0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0,
|
||||||
83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88,
|
100, 120, 100, 121, 95, 85, 110, 117, 115, 101, 100, 0, 1, 0, 3,
|
||||||
67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0,
|
0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105,
|
||||||
0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0,
|
99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83,
|
||||||
0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
|
76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108,
|
||||||
15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171,
|
101, 114, 32, 49, 48, 46, 49, 0, 73, 83, 71, 78, 80, 0, 0,
|
||||||
171, 83, 72, 68, 82, 60, 3, 0, 0, 64, 0, 0, 0, 207, 0,
|
0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0,
|
||||||
0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85,
|
0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15,
|
||||||
85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0,
|
0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
|
3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
|
||||||
2, 5, 0, 0, 0, 11, 0, 0, 5, 18, 0, 16, 0, 0, 0,
|
80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79,
|
||||||
0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 12, 0, 0, 5, 34,
|
82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1,
|
||||||
0, 16, 0, 0, 0, 0, 0, 26, 16, 16, 0, 1, 0, 0, 0,
|
0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
|
||||||
50, 0, 0, 13, 194, 0, 16, 0, 0, 0, 0, 0, 6, 4, 16,
|
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
|
||||||
128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0,
|
0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 6,
|
68, 82, 48, 3, 0, 0, 64, 0, 0, 0, 204, 0, 0, 0, 89,
|
||||||
20, 16, 0, 1, 0, 0, 0, 52, 0, 0, 10, 194, 0, 16, 0,
|
0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0,
|
||||||
0, 0, 0, 0, 166, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0,
|
88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
|
||||||
0, 0, 51, 0, 0, 10, 50, 0, 16, 0, 1, 0, 0, 0, 70,
|
0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 5,
|
||||||
0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 128, 63,
|
0, 0, 0, 51, 0, 0, 11, 50, 0, 16, 0, 0, 0, 0, 0,
|
||||||
0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
70, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0,
|
||||||
7, 50, 0, 16, 0, 1, 0, 0, 0, 230, 10, 16, 0, 0, 0,
|
0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 70, 0, 16, 0, 1, 0, 0, 0, 65, 0, 0, 5, 194,
|
0, 0, 50, 0, 0, 14, 194, 0, 16, 0, 0, 0, 0, 0, 6,
|
||||||
0, 16, 0, 0, 0, 0, 0, 166, 14, 16, 0, 0, 0, 0, 0,
|
132, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
27, 0, 0, 5, 50, 0, 16, 0, 2, 0, 0, 0, 230, 10, 16,
|
2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 65, 0, 0, 5, 194, 0, 16, 0, 0, 0,
|
63, 0, 0, 0, 63, 6, 20, 16, 0, 1, 0, 0, 0, 52, 0,
|
||||||
0, 0, 6, 4, 16, 0, 1, 0, 0, 0, 0, 0, 0, 8, 50,
|
0, 10, 194, 0, 16, 0, 0, 0, 0, 0, 166, 14, 16, 0, 0,
|
||||||
0, 16, 0, 1, 0, 0, 0, 230, 10, 16, 128, 65, 0, 0, 0,
|
0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 70, 0, 16, 0, 1, 0, 0, 0, 27, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 50, 0, 16,
|
||||||
5, 50, 0, 16, 0, 3, 0, 0, 0, 230, 10, 16, 0, 0, 0,
|
0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 230, 10,
|
||||||
0, 0, 14, 32, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70,
|
16, 0, 0, 0, 0, 0, 65, 0, 0, 5, 194, 0, 16, 0, 0,
|
||||||
0, 16, 0, 1, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0,
|
0, 0, 0, 166, 14, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5,
|
||||||
54, 0, 0, 5, 66, 0, 16, 0, 2, 0, 0, 0, 1, 64, 0,
|
50, 0, 16, 0, 1, 0, 0, 0, 230, 10, 16, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 54, 0, 0, 5, 194, 0, 16, 0, 3, 0,
|
0, 65, 0, 0, 5, 194, 0, 16, 0, 0, 0, 0, 0, 6, 4,
|
||||||
0, 0, 86, 9, 16, 0, 2, 0, 0, 0, 45, 0, 0, 7, 242,
|
16, 0, 0, 0, 0, 0, 0, 0, 0, 8, 50, 0, 16, 0, 0,
|
||||||
0, 16, 0, 1, 0, 0, 0, 70, 15, 16, 0, 3, 0, 0, 0,
|
0, 0, 0, 230, 10, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
70, 0, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16,
|
||||||
|
0, 2, 0, 0, 0, 230, 10, 16, 0, 0, 0, 0, 0, 14, 32,
|
||||||
|
0, 8, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
|
||||||
|
0, 0, 0, 70, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
54, 0, 0, 5, 66, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0,
|
||||||
|
0, 0, 0, 0, 0, 54, 0, 0, 5, 194, 0, 16, 0, 2, 0,
|
||||||
|
0, 0, 86, 9, 16, 0, 1, 0, 0, 0, 45, 0, 0, 7, 242,
|
||||||
|
0, 16, 0, 3, 0, 0, 0, 70, 15, 16, 0, 2, 0, 0, 0,
|
||||||
70, 126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0, 16,
|
70, 126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0, 16,
|
||||||
0, 4, 0, 0, 0, 134, 15, 16, 0, 3, 0, 0, 0, 70, 126,
|
0, 4, 0, 0, 0, 134, 15, 16, 0, 2, 0, 0, 0, 70, 126,
|
||||||
16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 2,
|
16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1,
|
||||||
0, 0, 0, 26, 0, 16, 0, 3, 0, 0, 0, 45, 0, 0, 7,
|
0, 0, 0, 26, 0, 16, 0, 2, 0, 0, 0, 45, 0, 0, 7,
|
||||||
242, 0, 16, 0, 3, 0, 0, 0, 198, 10, 16, 0, 2, 0, 0,
|
242, 0, 16, 0, 2, 0, 0, 0, 198, 10, 16, 0, 1, 0, 0,
|
||||||
0, 70, 126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0,
|
0, 70, 126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0,
|
||||||
16, 0, 2, 0, 0, 0, 70, 10, 16, 0, 2, 0, 0, 0, 70,
|
16, 0, 1, 0, 0, 0, 70, 10, 16, 0, 1, 0, 0, 0, 70,
|
||||||
126, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
|
126, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
|
||||||
4, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
|
4, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
|
||||||
0, 4, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 1, 0,
|
0, 4, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 3, 0,
|
||||||
0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 1,
|
0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 3,
|
||||||
0, 0, 0, 0, 0, 0, 11, 82, 0, 16, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 11, 82, 0, 16, 0, 0, 0, 0, 0,
|
||||||
6, 1, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0,
|
6, 1, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0,
|
||||||
0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0,
|
0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0,
|
||||||
0, 0, 50, 0, 0, 9, 114, 0, 16, 0, 1, 0, 0, 0, 6,
|
0, 0, 50, 0, 0, 9, 114, 0, 16, 0, 2, 0, 0, 0, 6,
|
||||||
0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0,
|
0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0,
|
||||||
70, 2, 16, 0, 1, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16,
|
70, 2, 16, 0, 3, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16,
|
||||||
0, 1, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 70, 2,
|
0, 2, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||||
16, 0, 1, 0, 0, 0, 50, 0, 0, 9, 178, 0, 16, 0, 0,
|
16, 0, 2, 0, 0, 0, 50, 0, 0, 9, 178, 0, 16, 0, 0,
|
||||||
0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 8, 16, 0,
|
0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 8, 16, 0,
|
||||||
2, 0, 0, 0, 70, 8, 16, 0, 4, 0, 0, 0, 50, 0, 0,
|
1, 0, 0, 0, 70, 8, 16, 0, 4, 0, 0, 0, 50, 0, 0,
|
||||||
9, 114, 32, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 0, 0,
|
9, 114, 32, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 0, 0,
|
||||||
0, 0, 70, 3, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 1,
|
0, 0, 70, 3, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2,
|
||||||
0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
|
0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
|
||||||
1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65,
|
1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65,
|
||||||
84, 116, 0, 0, 0, 28, 0, 0, 0, 5, 0, 0, 0, 0, 0,
|
84, 116, 0, 0, 0, 26, 0, 0, 0, 5, 0, 0, 0, 0, 0,
|
||||||
0, 0, 2, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@@ -333,6 +333,19 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
D3D11_BUFFER_DESC bufferDesc;
|
||||||
|
bufferDesc.ByteWidth = sizeof(ScaleQuadPixelConstants);
|
||||||
|
bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||||
|
bufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||||
|
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||||
|
bufferDesc.MiscFlags = 0;
|
||||||
|
bufferDesc.StructureByteStride = 0;
|
||||||
|
|
||||||
|
if (m_device->CreateBuffer(&bufferDesc, nullptr, m_scaleQuadPixelConstantBuffer.GetMutablePtr()) != S_OK)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const GpShaderCodeBlob drawQuadVBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadV_D3D11);
|
const GpShaderCodeBlob drawQuadVBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadV_D3D11);
|
||||||
const GpShaderCodeBlob drawQuadPalettePBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadPaletteP_D3D11);
|
const GpShaderCodeBlob drawQuadPalettePBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadPaletteP_D3D11);
|
||||||
const GpShaderCodeBlob drawQuadRGBPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadRGBP_D3D11);
|
const GpShaderCodeBlob drawQuadRGBPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadRGBP_D3D11);
|
||||||
@@ -618,21 +631,32 @@ void GpDisplayDriverD3D11::ScaleVirtualScreen()
|
|||||||
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidthPhysical);
|
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidthPhysical);
|
||||||
const float negativeTwoDivHeight = -2.0f / static_cast<float>(m_windowHeightPhysical);
|
const float negativeTwoDivHeight = -2.0f / static_cast<float>(m_windowHeightPhysical);
|
||||||
|
|
||||||
DrawQuadVertexConstants constantsData;
|
DrawQuadVertexConstants vConstantsData;
|
||||||
constantsData.m_ndcOriginX = -1.0f;
|
vConstantsData.m_ndcOriginX = -1.0f;
|
||||||
constantsData.m_ndcOriginY = 1.0f;
|
vConstantsData.m_ndcOriginY = 1.0f;
|
||||||
constantsData.m_ndcWidth = static_cast<float>(m_windowWidthPhysical) * twoDivWidth;
|
vConstantsData.m_ndcWidth = 2.0f;
|
||||||
constantsData.m_ndcHeight = static_cast<float>(m_windowHeightPhysical) * negativeTwoDivHeight;
|
vConstantsData.m_ndcHeight = -2.0f;
|
||||||
|
|
||||||
constantsData.m_surfaceDimensionX = static_cast<float>(m_windowWidthVirtual);
|
vConstantsData.m_surfaceDimensionX = static_cast<float>(m_windowWidthVirtual);
|
||||||
constantsData.m_surfaceDimensionY = static_cast<float>(m_windowHeightVirtual);
|
vConstantsData.m_surfaceDimensionY = static_cast<float>(m_windowHeightVirtual);
|
||||||
|
|
||||||
D3D11_MAPPED_SUBRESOURCE mappedConstants;
|
D3D11_MAPPED_SUBRESOURCE mappedVConstants;
|
||||||
if (m_deviceContext->Map(m_drawQuadVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedConstants) == S_OK)
|
if (m_deviceContext->Map(m_drawQuadVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedVConstants) == S_OK)
|
||||||
{
|
{
|
||||||
memcpy(mappedConstants.pData, &constantsData, sizeof(constantsData));
|
memcpy(mappedVConstants.pData, &vConstantsData, sizeof(vConstantsData));
|
||||||
m_deviceContext->Unmap(m_drawQuadVertexConstantBuffer, 0);
|
m_deviceContext->Unmap(m_drawQuadVertexConstantBuffer, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScaleQuadPixelConstants pConstantsData;
|
||||||
|
pConstantsData.m_dx = static_cast<float>(static_cast<double>(m_windowWidthVirtual) / static_cast<double>(m_windowWidthPhysical));
|
||||||
|
pConstantsData.m_dy = static_cast<float>(static_cast<double>(m_windowHeightVirtual) / static_cast<double>(m_windowHeightPhysical));
|
||||||
|
|
||||||
|
D3D11_MAPPED_SUBRESOURCE mappedPConstants;
|
||||||
|
if (m_deviceContext->Map(m_scaleQuadPixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedPConstants) == S_OK)
|
||||||
|
{
|
||||||
|
memcpy(mappedPConstants.pData, &pConstantsData, sizeof(pConstantsData));
|
||||||
|
m_deviceContext->Unmap(m_scaleQuadPixelConstantBuffer, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceContext->IASetVertexBuffers(0, 1, &vbPtr, &vbStride, &zero);
|
m_deviceContext->IASetVertexBuffers(0, 1, &vbPtr, &vbStride, &zero);
|
||||||
@@ -656,8 +680,11 @@ void GpDisplayDriverD3D11::ScaleVirtualScreen()
|
|||||||
m_virtualScreenTextureSRV,
|
m_virtualScreenTextureSRV,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ID3D11Buffer *psConstants = m_scaleQuadPixelConstantBuffer;
|
||||||
|
|
||||||
m_deviceContext->PSSetShader(m_scaleQuadPixelShader, nullptr, 0);
|
m_deviceContext->PSSetShader(m_scaleQuadPixelShader, nullptr, 0);
|
||||||
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
|
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
|
||||||
|
m_deviceContext->PSSetConstantBuffers(0, 1, &psConstants);
|
||||||
|
|
||||||
m_deviceContext->DrawIndexed(6, 0, 0);
|
m_deviceContext->DrawIndexed(6, 0, 0);
|
||||||
|
|
||||||
@@ -666,6 +693,9 @@ void GpDisplayDriverD3D11::ScaleVirtualScreen()
|
|||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
m_deviceContext->PSSetShaderResources(0, sizeof(unbindPSResourceViews) / sizeof(unbindPSResourceViews[0]), unbindPSResourceViews);
|
m_deviceContext->PSSetShaderResources(0, sizeof(unbindPSResourceViews) / sizeof(unbindPSResourceViews[0]), unbindPSResourceViews);
|
||||||
|
|
||||||
|
ID3D11Buffer *clearBuffer = nullptr;
|
||||||
|
m_deviceContext->PSSetConstantBuffers(0, 1, &clearBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpDisplayDriverD3D11::SynchronizeCursors()
|
void GpDisplayDriverD3D11::SynchronizeCursors()
|
||||||
|
@@ -65,6 +65,13 @@ private:
|
|||||||
float m_unused[2];
|
float m_unused[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ScaleQuadPixelConstants
|
||||||
|
{
|
||||||
|
float m_dx;
|
||||||
|
float m_dy;
|
||||||
|
float m_unused[2];
|
||||||
|
};
|
||||||
|
|
||||||
struct CompactedPresentHistoryItem
|
struct CompactedPresentHistoryItem
|
||||||
{
|
{
|
||||||
LARGE_INTEGER m_timestamp;
|
LARGE_INTEGER m_timestamp;
|
||||||
@@ -99,6 +106,7 @@ private:
|
|||||||
GpComPtr<ID3D11PixelShader> m_drawQuadRGBPixelShader;
|
GpComPtr<ID3D11PixelShader> m_drawQuadRGBPixelShader;
|
||||||
GpComPtr<ID3D11PixelShader> m_scaleQuadPixelShader;
|
GpComPtr<ID3D11PixelShader> m_scaleQuadPixelShader;
|
||||||
GpComPtr<ID3D11Buffer> m_drawQuadVertexConstantBuffer;
|
GpComPtr<ID3D11Buffer> m_drawQuadVertexConstantBuffer;
|
||||||
|
GpComPtr<ID3D11Buffer> m_scaleQuadPixelConstantBuffer;
|
||||||
GpComPtr<ID3D11DepthStencilState> m_drawQuadDepthStencilState;
|
GpComPtr<ID3D11DepthStencilState> m_drawQuadDepthStencilState;
|
||||||
GpComPtr<ID3D11SamplerState> m_nearestNeighborSamplerState;
|
GpComPtr<ID3D11SamplerState> m_nearestNeighborSamplerState;
|
||||||
GpComPtr<ID3D11Texture1D> m_paletteTexture;
|
GpComPtr<ID3D11Texture1D> m_paletteTexture;
|
||||||
|
@@ -3,6 +3,11 @@
|
|||||||
SamplerState surfaceSampler : register(s0);
|
SamplerState surfaceSampler : register(s0);
|
||||||
Texture2D<float3> surfaceTexture : register(t0);
|
Texture2D<float3> surfaceTexture : register(t0);
|
||||||
|
|
||||||
|
cbuffer SScaleQuadPixelConstants : register(b0)
|
||||||
|
{
|
||||||
|
float4 dxdy_Unused;
|
||||||
|
};
|
||||||
|
|
||||||
struct SDrawQuadPixelOutput
|
struct SDrawQuadPixelOutput
|
||||||
{
|
{
|
||||||
float4 color : SV_TARGET;
|
float4 color : SV_TARGET;
|
||||||
@@ -15,8 +20,8 @@ float3 SamplePixel(int2 coord)
|
|||||||
|
|
||||||
SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
|
SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
|
||||||
{
|
{
|
||||||
float dx = ddx(input.texCoord.x);
|
float dx = dxdy_Unused.x;
|
||||||
float dy = ddy(input.texCoord.y);
|
float dy = dxdy_Unused.y;
|
||||||
|
|
||||||
float2 pixelTopLeftCoord = max(0.0, input.texCoord.xy - float2(dx, dy) * 0.5);
|
float2 pixelTopLeftCoord = max(0.0, input.texCoord.xy - float2(dx, dy) * 0.5);
|
||||||
float2 pixelBottomRightCoord = pixelTopLeftCoord + min(float2(1.0, 1.0), float2(dx, dy));
|
float2 pixelBottomRightCoord = pixelTopLeftCoord + min(float2(1.0, 1.0), float2(dx, dy));
|
||||||
@@ -37,5 +42,6 @@ SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
|
|||||||
|
|
||||||
SDrawQuadPixelOutput result;
|
SDrawQuadPixelOutput result;
|
||||||
result.color = float4(interpolatedColor, 1.0);
|
result.color = float4(interpolatedColor, 1.0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user