graphics

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit f9bcb22704650b9a4098e6f14e8948042b6e34d6
parent fb6c743684ceab7002abe6786101685df0704b52
Author: Brian Swetland <swetland@frotz.net>
Date:   Mon,  4 Feb 2013 20:30:46 -0800

experiment with an abstraction over D3D10

not quite complete, but in theory could start plumbing OGL in under this
as well

Diffstat:
Mcommon/TextPS.h | 169++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mcommon/TextVS.h | 815++++++++++++++++++++++++++++++++-----------------------------------------------
Mcommon/TextVS.hlsl | 4++--
Mcommon/app.h | 99+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
Mcommon/dxapp.cc | 197++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mcommon/textgrid.cc | 71+++++++++++++++++++++++++++--------------------------------------------
Mcommon/textgrid.h | 17++++++-----------
Mhello/SimplePS.hlsl | 9++-------
Mhello/hello.cc | 107+++++++++++++++++--------------------------------------------------------------
9 files changed, 688 insertions(+), 800 deletions(-)

diff --git a/common/TextPS.h b/common/TextPS.h @@ -4,7 +4,8 @@ // // // fxc /nologo /Emain /T ps_4_0 /Fh C:\Work\graphics\Debug\TextPS.h /Fo -// C:\Work\graphics\Debug\TextPS.cso /Vn codeTextPS /Od /Zi TextPS.hlsl +// C:\Work\graphics\Debug\TextPS.cso /Vn codeTextPS /Od /Zi +// ..\common\TextPS.hlsl // // // Resource Bindings: @@ -36,7 +37,7 @@ dcl_resource_texture2d (float,float,float,float) t0 dcl_input_ps linear v1.xy dcl_output o0.xyzw -#line 12 "C:\Work\graphics\hello\TextPS.hlsl" +#line 12 "C:\Work\graphics\common\TextPS.hlsl" sample o0.xyzw, v1.xyxx, t0.xyzw, s0 // main<0:Inf,1:Inf,2:Inf,3:Inf> ret // Approximately 2 instruction slots used @@ -44,11 +45,11 @@ ret const BYTE codeTextPS[] = { - 68, 88, 66, 67, 165, 232, - 12, 180, 38, 190, 186, 16, - 30, 167, 61, 163, 138, 28, - 180, 41, 1, 0, 0, 0, - 33, 11, 0, 0, 6, 0, + 68, 88, 66, 67, 115, 168, + 18, 253, 246, 81, 130, 62, + 206, 239, 145, 164, 250, 204, + 121, 18, 1, 0, 0, 0, + 34, 11, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 224, 0, 0, 0, 56, 1, 0, 0, 108, 1, 0, 0, @@ -144,9 +145,9 @@ const BYTE codeTextPS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 68, 66, 71, - 197, 8, 0, 0, 84, 0, - 0, 0, 64, 1, 0, 0, - 113, 1, 0, 0, 118, 1, + 198, 8, 0, 0, 84, 0, + 0, 0, 65, 1, 0, 0, + 114, 1, 0, 0, 119, 1, 0, 0, 5, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, @@ -159,8 +160,8 @@ const BYTE codeTextPS[] = 6, 0, 0, 0, 192, 5, 0, 0, 200, 6, 0, 0, 244, 6, 0, 0, 0, 0, - 0, 0, 34, 0, 0, 0, - 34, 0, 0, 0, 241, 0, + 0, 0, 35, 0, 0, 0, + 35, 0, 0, 0, 241, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, @@ -360,48 +361,48 @@ const BYTE codeTextPS[] = 255, 255, 0, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 19, 0, 0, 0, - 26, 1, 0, 0, 0, 0, + 27, 1, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 19, 0, - 0, 0, 45, 1, 0, 0, + 0, 0, 46, 1, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 22, 0, 0, 0, - 5, 0, 0, 0, 197, 0, + 5, 0, 0, 0, 198, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 10, 0, 0, 0, 8, 0, 0, 0, - 46, 0, 0, 0, 0, 0, + 47, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 13, 0, 0, 0, 9, 0, - 0, 0, 72, 0, 0, 0, + 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 7, 0, 0, 0, - 4, 0, 0, 0, 182, 0, + 4, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 22, 0, 0, 0, 5, 0, 0, 0, - 197, 0, 0, 0, 0, 0, + 198, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 7, 0, 0, 0, 4, 0, - 0, 0, 182, 0, 0, 0, + 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 10, 0, 0, 0, - 8, 0, 0, 0, 46, 0, + 8, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 13, 0, 0, 0, 9, 0, 0, 0, - 72, 0, 0, 0, 0, 0, + 73, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 93, 0, + 3, 0, 0, 0, 94, 0, 0, 0, 9, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 182, 0, 0, 0, 4, 0, + 183, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 0, 0, - 0, 0, 19, 1, 0, 0, + 0, 0, 20, 1, 0, 0, 7, 0, 0, 0, 3, 0, 0, 0, 12, 0, 0, 0, 3, 0, 0, 0, 0, 0, @@ -458,65 +459,65 @@ const BYTE codeTextPS[] = 0, 0, 67, 58, 92, 87, 111, 114, 107, 92, 103, 114, 97, 112, 104, 105, 99, 115, - 92, 104, 101, 108, 108, 111, - 92, 84, 101, 120, 116, 80, - 83, 46, 104, 108, 115, 108, - 13, 10, 84, 101, 120, 116, - 117, 114, 101, 50, 68, 32, - 84, 101, 120, 116, 117, 114, - 101, 48, 59, 13, 10, 13, - 10, 83, 97, 109, 112, 108, - 101, 114, 83, 116, 97, 116, - 101, 32, 115, 97, 109, 76, - 105, 110, 101, 97, 114, 59, - 13, 10, 13, 10, 115, 116, - 114, 117, 99, 116, 32, 86, - 83, 95, 79, 85, 84, 80, - 85, 84, 32, 123, 13, 10, - 9, 102, 108, 111, 97, 116, - 52, 32, 80, 111, 115, 105, - 116, 105, 111, 110, 32, 58, - 32, 83, 86, 95, 80, 79, - 83, 73, 84, 73, 79, 78, - 59, 13, 10, 9, 102, 108, - 111, 97, 116, 50, 32, 84, - 101, 120, 67, 111, 111, 114, - 100, 32, 58, 32, 84, 69, - 88, 67, 79, 79, 82, 68, - 59, 13, 10, 125, 59, 13, - 10, 13, 10, 102, 108, 111, - 97, 116, 52, 32, 109, 97, - 105, 110, 40, 86, 83, 95, - 79, 85, 84, 80, 85, 84, - 32, 105, 110, 112, 117, 116, - 41, 32, 58, 32, 83, 86, - 95, 84, 97, 114, 103, 101, - 116, 32, 123, 13, 10, 9, - 114, 101, 116, 117, 114, 110, + 92, 99, 111, 109, 109, 111, + 110, 92, 84, 101, 120, 116, + 80, 83, 46, 104, 108, 115, + 108, 13, 10, 84, 101, 120, + 116, 117, 114, 101, 50, 68, 32, 84, 101, 120, 116, 117, - 114, 101, 48, 46, 83, 97, - 109, 112, 108, 101, 40, 115, - 97, 109, 76, 105, 110, 101, - 97, 114, 44, 32, 105, 110, - 112, 117, 116, 46, 84, 101, - 120, 67, 111, 111, 114, 100, - 41, 59, 13, 10, 125, 13, - 10, 71, 108, 111, 98, 97, - 108, 115, 86, 83, 95, 79, - 85, 84, 80, 85, 84, 58, - 58, 80, 111, 115, 105, 116, - 105, 111, 110, 86, 83, 95, + 114, 101, 48, 59, 13, 10, + 13, 10, 83, 97, 109, 112, + 108, 101, 114, 83, 116, 97, + 116, 101, 32, 115, 97, 109, + 76, 105, 110, 101, 97, 114, + 59, 13, 10, 13, 10, 115, + 116, 114, 117, 99, 116, 32, + 86, 83, 95, 79, 85, 84, + 80, 85, 84, 32, 123, 13, + 10, 9, 102, 108, 111, 97, + 116, 52, 32, 80, 111, 115, + 105, 116, 105, 111, 110, 32, + 58, 32, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 59, 13, 10, 9, 102, + 108, 111, 97, 116, 50, 32, + 84, 101, 120, 67, 111, 111, + 114, 100, 32, 58, 32, 84, + 69, 88, 67, 79, 79, 82, + 68, 59, 13, 10, 125, 59, + 13, 10, 13, 10, 102, 108, + 111, 97, 116, 52, 32, 109, + 97, 105, 110, 40, 86, 83, + 95, 79, 85, 84, 80, 85, + 84, 32, 105, 110, 112, 117, + 116, 41, 32, 58, 32, 83, + 86, 95, 84, 97, 114, 103, + 101, 116, 32, 123, 13, 10, + 9, 114, 101, 116, 117, 114, + 110, 32, 84, 101, 120, 116, + 117, 114, 101, 48, 46, 83, + 97, 109, 112, 108, 101, 40, + 115, 97, 109, 76, 105, 110, + 101, 97, 114, 44, 32, 105, + 110, 112, 117, 116, 46, 84, + 101, 120, 67, 111, 111, 114, + 100, 41, 59, 13, 10, 125, + 13, 10, 71, 108, 111, 98, + 97, 108, 115, 86, 83, 95, 79, 85, 84, 80, 85, 84, - 58, 58, 84, 101, 120, 67, - 111, 111, 114, 100, 77, 105, - 99, 114, 111, 115, 111, 102, - 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, - 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 109, - 97, 105, 110, 0, 112, 115, - 95, 52, 95, 48, 0 + 58, 58, 80, 111, 115, 105, + 116, 105, 111, 110, 86, 83, + 95, 79, 85, 84, 80, 85, + 84, 58, 58, 84, 101, 120, + 67, 111, 111, 114, 100, 77, + 105, 99, 114, 111, 115, 111, + 102, 116, 32, 40, 82, 41, + 32, 72, 76, 83, 76, 32, + 83, 104, 97, 100, 101, 114, + 32, 67, 111, 109, 112, 105, + 108, 101, 114, 32, 57, 46, + 50, 57, 46, 57, 53, 50, + 46, 51, 49, 49, 49, 0, + 109, 97, 105, 110, 0, 112, + 115, 95, 52, 95, 48, 0 }; diff --git a/common/TextVS.h b/common/TextVS.h @@ -4,7 +4,8 @@ // // // fxc /nologo /Emain /T vs_4_0 /Fh C:\Work\graphics\Debug\TextVS.h /Fo -// C:\Work\graphics\Debug\TextVS.cso /Vn codeTextVS /Zi TextVS.hlsl +// C:\Work\graphics\Debug\TextVS.cso /Vn codeTextVS /Zi +// ..\common\TextVS.hlsl // // // Buffer Definitions: @@ -54,7 +55,7 @@ dcl_output_siv o0.xyzw, position dcl_output o1.xy dcl_temps 2 -#line 22 "C:\Work\graphics\hello\TextVS.hlsl" +#line 22 "C:\Work\graphics\common\TextVS.hlsl" iadd r0.x, cb0[4].y, l(-1) udiv r0.y, null, v3.x, cb0[4].y iadd r0.x, r0.x, -r0.y @@ -73,39 +74,33 @@ mad r0.xyzw, cb0[3].xyzw, v0.wwww, r0.xyzw // output<0:NaN:Inf,1:NaN:Inf,2:NaN: movc o0.z, v2.x, r0.z, l(-1.100000) // main<2:NaN:Inf> mov o0.xyw, r0.xyxw // main<0:NaN:Inf,1:NaN:Inf,3:NaN:Inf> -#line 26 -ushr r0.x, v2.x, l(4) -iadd r0.x, l(15), -r0.x -utof r0.x, r0.x // ty<0:[0f,4.29497e+009f]> - -#line 35 -mul r0.y, r0.x, l(0.062500) - #line 25 -and r0.z, v2.x, l(15) -utof r0.z, r0.z // tx<0:[0f,15f]> +and r0.x, v2.x, l(15) +utof r0.x, r0.x // tx<0:[0f,15f]> +ushr r0.z, v2.x, l(4) +utof r0.z, r0.z // ty<0:[0f,2.68435e+008f]> #line 35 -mul r0.x, r0.z, l(0.062500) +mul r0.xy, r0.xzxx, l(0.062500, 0.062500, 0.000000, 0.000000) mad r0.xy, v1.xyxx, l(0.062500, 0.062500, 0.000000, 0.000000), r0.xyxx -add o1.xy, r0.xyxx, l(0.003906, -0.003906, 0.000000, 0.000000) // main<4:[-2.12676e+037f,2.12676e+037f],5:[-2.12676e+037f,2.12676e+037f]> +add o1.xy, r0.xyxx, l(0.003906, 0.003906, 0.000000, 0.000000) // main<4:[-2.12676e+037f,2.12676e+037f],5:[-2.12676e+037f,2.12676e+037f]> #line 40 ret -// Approximately 23 instruction slots used +// Approximately 21 instruction slots used #endif const BYTE codeTextVS[] = { - 68, 88, 66, 67, 10, 14, - 84, 123, 102, 6, 139, 73, - 125, 68, 255, 78, 150, 29, - 198, 147, 1, 0, 0, 0, - 54, 58, 0, 0, 6, 0, + 68, 88, 66, 67, 57, 29, + 242, 234, 77, 129, 163, 144, + 43, 154, 91, 62, 44, 78, + 140, 14, 1, 0, 0, 0, + 213, 54, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 60, 1, 0, 0, 216, 1, 0, 0, 48, 2, 0, 0, - 88, 5, 0, 0, 212, 5, + 40, 5, 0, 0, 164, 5, 0, 0, 82, 68, 69, 70, 252, 0, 0, 0, 1, 0, 0, 0, 64, 0, 0, 0, @@ -191,8 +186,8 @@ const BYTE codeTextVS[] = 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 83, 72, 68, 82, - 32, 3, 0, 0, 64, 0, - 1, 0, 200, 0, 0, 0, + 240, 2, 0, 0, 64, 0, + 1, 0, 188, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 5, 0, 0, 0, 95, 0, @@ -279,37 +274,29 @@ const BYTE codeTextVS[] = 0, 5, 178, 32, 16, 0, 0, 0, 0, 0, 70, 12, 16, 0, 0, 0, 0, 0, - 85, 0, 0, 7, 18, 0, + 1, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 2, 0, 0, 0, 1, 64, 0, 0, - 4, 0, 0, 0, 30, 0, - 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 15, 0, 0, 0, - 10, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 86, 0, 0, 5, 18, 0, + 15, 0, 0, 0, 86, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 34, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 61, - 1, 0, 0, 7, 66, 0, + 85, 0, 0, 7, 66, 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 2, 0, 0, 0, 1, 64, 0, 0, - 15, 0, 0, 0, 86, 0, + 4, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 18, 0, + 56, 0, 0, 10, 50, 0, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 61, 50, 0, + 134, 0, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 61, 0, 0, + 128, 61, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, 0, 12, 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, @@ -322,14 +309,14 @@ const BYTE codeTextVS[] = 1, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, - 128, 59, 0, 0, 128, 187, + 128, 59, 0, 0, 128, 59, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 23, 0, 0, 0, + 0, 0, 21, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, - 5, 0, 0, 0, 3, 0, + 4, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -346,24 +333,24 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 68, - 66, 71, 90, 52, 0, 0, - 84, 0, 0, 0, 217, 3, - 0, 0, 10, 4, 0, 0, - 15, 4, 0, 0, 1, 1, + 66, 71, 41, 49, 0, 0, + 84, 0, 0, 0, 212, 3, + 0, 0, 5, 4, 0, 0, + 10, 4, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 23, 0, + 0, 0, 0, 0, 21, 0, 0, 0, 16, 0, 0, 0, - 38, 0, 0, 0, 164, 35, + 38, 0, 0, 0, 140, 32, 0, 0, 26, 0, 0, 0, - 52, 39, 0, 0, 33, 0, - 0, 0, 164, 41, 0, 0, - 9, 0, 0, 0, 56, 44, + 28, 36, 0, 0, 32, 0, + 0, 0, 140, 38, 0, 0, + 9, 0, 0, 0, 12, 41, 0, 0, 13, 0, 0, 0, - 236, 44, 0, 0, 40, 47, - 0, 0, 240, 47, 0, 0, - 0, 0, 0, 0, 34, 0, - 0, 0, 34, 0, 0, 0, - 132, 3, 0, 0, 0, 0, + 192, 41, 0, 0, 252, 43, + 0, 0, 196, 44, 0, 0, + 0, 0, 0, 0, 35, 0, + 0, 0, 35, 0, 0, 0, + 126, 3, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, @@ -1222,84 +1209,18 @@ const BYTE codeTextVS[] = 3, 0, 0, 0, 156, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, - 0, 0, 85, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 15, 0, 0, 0, 0, - 255, 255, 255, 15, 0, 0, - 0, 0, 255, 255, 255, 15, - 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 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, 255, 255, 255, 255, - 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, 255, 255, 255, 255, - 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, 255, 255, 255, 255, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 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, 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, 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, - 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, 28, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 188, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 0, - 0, 0, 30, 0, 0, 0, - 1, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 16, 0, 0, 240, 15, 0, 0, 0, 0, 0, - 128, 255, 0, 0, 128, 127, - 1, 0, 0, 0, 1, 0, + 0, 128, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1351,20 +1272,20 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 188, 0, + 3, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 0, + 0, 0, 0, 0, 14, 0, 0, 0, 86, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 37, 0, 0, 0, + 255, 255, 36, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 128, 255, 255, 255, 127, 0, 0, - 0, 0, 0, 0, 128, 79, + 0, 0, 0, 0, 112, 65, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, @@ -1417,76 +1338,10 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 188, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 16, 0, - 0, 0, 56, 0, 0, 0, - 1, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 255, 255, - 255, 255, 1, 0, 0, 0, - 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, - 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, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 128, - 255, 255, 255, 127, 0, 0, - 0, 0, 0, 0, 128, 77, - 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 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, 255, 255, 255, 255, - 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, 255, 255, 255, 255, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 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, 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, 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, - 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, 29, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 156, 0, + 3, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 17, 0, - 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 85, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, @@ -1505,10 +1360,10 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 15, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 0, 0, - 0, 128, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 15, 0, 0, 0, 0, + 255, 255, 255, 15, 0, 0, + 0, 0, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, @@ -1547,11 +1402,11 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 30, 0, + 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 120, 0, + 3, 0, 0, 0, 188, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 0, + 0, 0, 0, 0, 16, 0, 0, 0, 86, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, @@ -1570,11 +1425,11 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 36, 0, 0, 0, + 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 128, 255, 255, 255, 127, 0, 0, - 0, 0, 0, 0, 112, 65, + 0, 0, 0, 0, 128, 77, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, @@ -1613,16 +1468,16 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 30, 0, + 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 120, 0, + 3, 0, 0, 0, 188, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 19, 0, + 0, 0, 0, 0, 17, 0, 0, 0, 56, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, + 0, 0, 1, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, @@ -1631,10 +1486,10 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 112, 63, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, - 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, 255, 255, + 255, 255, 0, 0, 0, 128, + 255, 255, 255, 127, 0, 0, + 0, 0, 0, 0, 128, 75, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, @@ -1679,11 +1534,11 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, + 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 156, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 20, 0, + 0, 0, 2, 0, 0, 0, + 84, 0, 0, 0, 18, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, @@ -1745,11 +1600,11 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, + 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 156, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 21, 0, + 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, @@ -1811,11 +1666,11 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, + 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 156, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 22, 0, + 0, 0, 0, 0, 20, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, @@ -1877,7 +1732,7 @@ const BYTE codeTextVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 156, 0, 0, 0, 0, 0, 0, 0, @@ -2140,84 +1995,84 @@ const BYTE codeTextVS[] = 255, 255, 255, 255, 0, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 3, 0, - 0, 0, 59, 0, 0, 0, + 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 14, 0, 0, 0, - 2, 0, 0, 0, 79, 0, + 2, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 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48, 0, 0, 0, 4, 0, 0, 0, - 206, 0, 0, 0, 4, 0, - 0, 0, 7, 0, 0, 0, - 92, 0, 0, 0, 0, 0, + 207, 0, 0, 0, 4, 0, + 0, 0, 6, 0, 0, 0, + 56, 0, 0, 0, 1, 0, + 0, 0, 168, 3, 0, 0, + 6, 0, 0, 0, 3, 0, + 0, 0, 80, 0, 0, 0, + 4, 0, 0, 0, 207, 0, + 0, 0, 4, 0, 0, 0, + 7, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, - 255, 255, 255, 255, 0, 0, + 4, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 16, 0, + 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 16, 0, 0, 0, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 16, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 17, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, - 1, 0, 0, 0, 255, 255, + 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 17, 0, 0, 0, 4, 0, + 0, 0, 4, 0, 0, 0, + 255, 255, 255, 255, 5, 0, 0, 0, 0, 0, 0, 0, 1, 0, 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 0, 0, 10, 0, 0, 0, - 10, 0, 0, 0, 11, 0, - 0, 0, 6, 0, 0, 0, - 7, 0, 0, 0, 8, 0, - 0, 0, 9, 0, 0, 0, - 10, 0, 0, 0, 11, 0, - 0, 0, 10, 0, 0, 0, - 11, 0, 0, 0, 12, 0, + 0, 0, 2, 0, 0, 0, + 5, 0, 0, 0, 10, 0, 0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 9, 0, 0, 0, + 10, 0, 0, 0, 10, 0, + 0, 0, 11, 0, 0, 0, + 6, 0, 0, 0, 7, 0, + 0, 0, 8, 0, 0, 0, + 9, 0, 0, 0, 10, 0, + 0, 0, 11, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 0, 0, 0, - 3, 0, 0, 0, 4, 0, - 0, 0, 1, 0, 0, 0, - 2, 0, 0, 0, 9, 0, - 0, 0, 1, 0, 0, 0, - 9, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 7, 0, + 0, 0, 8, 0, 0, 0, + 9, 0, 0, 0, 10, 0, + 0, 0, 11, 0, 0, 0, + 12, 0, 0, 0, 3, 0, + 0, 0, 4, 0, 0, 0, + 1, 0, 0, 0, 2, 0, + 0, 0, 9, 0, 0, 0, + 1, 0, 0, 0, 9, 0, + 0, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 7, 0, + 0, 0, 8, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, - 7, 0, 0, 0, 8, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 6, 0, + 10, 0, 0, 0, 8, 0, 0, 0, 10, 0, 0, 0, - 8, 0, 0, 0, 10, 0, - 0, 0, 5, 0, 0, 0, - 6, 0, 0, 0, 1, 0, - 0, 0, 67, 58, 92, 87, - 111, 114, 107, 92, 103, 114, - 97, 112, 104, 105, 99, 115, - 92, 104, 101, 108, 108, 111, - 92, 84, 101, 120, 116, 86, - 83, 46, 104, 108, 115, 108, - 13, 10, 99, 98, 117, 102, - 102, 101, 114, 32, 99, 98, - 48, 32, 123, 13, 10, 9, - 109, 97, 116, 114, 105, 120, - 32, 77, 86, 80, 59, 13, + 5, 0, 0, 0, 6, 0, + 0, 0, 1, 0, 0, 0, + 67, 58, 92, 87, 111, 114, + 107, 92, 103, 114, 97, 112, + 104, 105, 99, 115, 92, 99, + 111, 109, 109, 111, 110, 92, + 84, 101, 120, 116, 86, 83, + 46, 104, 108, 115, 108, 13, + 10, 99, 98, 117, 102, 102, + 101, 114, 32, 99, 98, 48, + 32, 123, 13, 10, 9, 109, + 97, 116, 114, 105, 120, 32, + 77, 86, 80, 59, 13, 10, + 9, 117, 110, 115, 105, 103, + 110, 101, 100, 32, 105, 110, + 116, 32, 99, 119, 59, 13, 10, 9, 117, 110, 115, 105, 103, 110, 101, 100, 32, 105, - 110, 116, 32, 99, 119, 59, - 13, 10, 9, 117, 110, 115, - 105, 103, 110, 101, 100, 32, - 105, 110, 116, 32, 99, 104, - 59, 13, 10, 125, 59, 13, - 10, 115, 116, 114, 117, 99, - 116, 32, 86, 83, 95, 79, - 85, 84, 80, 85, 84, 32, - 123, 13, 10, 9, 102, 108, - 111, 97, 116, 52, 32, 80, - 111, 115, 105, 116, 105, 111, - 110, 32, 58, 32, 83, 86, - 95, 80, 79, 83, 73, 84, - 73, 79, 78, 59, 13, 10, - 9, 102, 108, 111, 97, 116, - 50, 32, 84, 101, 120, 67, - 111, 111, 114, 100, 32, 58, - 32, 84, 69, 88, 67, 79, - 79, 82, 68, 59, 13, 10, - 125, 59, 13, 10, 13, 10, + 110, 116, 32, 99, 104, 59, + 13, 10, 125, 59, 13, 10, + 115, 116, 114, 117, 99, 116, + 32, 86, 83, 95, 79, 85, + 84, 80, 85, 84, 32, 123, + 13, 10, 9, 102, 108, 111, + 97, 116, 52, 32, 80, 111, + 115, 105, 116, 105, 111, 110, + 32, 58, 32, 83, 86, 95, + 80, 79, 83, 73, 84, 73, + 79, 78, 59, 13, 10, 9, + 102, 108, 111, 97, 116, 50, + 32, 84, 101, 120, 67, 111, + 111, 114, 100, 32, 58, 32, + 84, 69, 88, 67, 79, 79, + 82, 68, 59, 13, 10, 125, + 59, 13, 10, 13, 10, 86, + 83, 95, 79, 85, 84, 80, + 85, 84, 32, 109, 97, 105, + 110, 40, 13, 10, 9, 102, + 108, 111, 97, 116, 52, 32, + 112, 111, 115, 32, 58, 32, + 80, 79, 83, 73, 84, 73, + 79, 78, 44, 13, 10, 9, + 102, 108, 111, 97, 116, 50, + 32, 117, 118, 32, 58, 32, + 84, 69, 88, 67, 79, 79, + 82, 68, 44, 13, 10, 9, + 117, 110, 115, 105, 103, 110, + 101, 100, 32, 105, 110, 116, + 32, 99, 32, 58, 32, 67, + 72, 65, 82, 65, 67, 84, + 69, 82, 44, 13, 10, 9, + 117, 110, 115, 105, 103, 110, + 101, 100, 32, 105, 110, 116, + 32, 105, 100, 32, 58, 32, + 83, 86, 95, 73, 78, 83, + 84, 65, 78, 67, 69, 73, + 68, 13, 10, 9, 41, 32, + 123, 13, 10, 13, 10, 9, 86, 83, 95, 79, 85, 84, - 80, 85, 84, 32, 109, 97, - 105, 110, 40, 13, 10, 9, - 102, 108, 111, 97, 116, 52, - 32, 112, 111, 115, 32, 58, - 32, 80, 79, 83, 73, 84, - 73, 79, 78, 44, 13, 10, - 9, 102, 108, 111, 97, 116, - 50, 32, 117, 118, 32, 58, - 32, 84, 69, 88, 67, 79, - 79, 82, 68, 44, 13, 10, - 9, 117, 110, 115, 105, 103, - 110, 101, 100, 32, 105, 110, - 116, 32, 99, 32, 58, 32, - 67, 72, 65, 82, 65, 67, - 84, 69, 82, 44, 13, 10, - 9, 117, 110, 115, 105, 103, - 110, 101, 100, 32, 105, 110, - 116, 32, 105, 100, 32, 58, - 32, 83, 86, 95, 73, 78, - 83, 84, 65, 78, 67, 69, - 73, 68, 13, 10, 9, 41, - 32, 123, 13, 10, 13, 10, - 9, 86, 83, 95, 79, 85, - 84, 80, 85, 84, 32, 111, - 117, 116, 112, 117, 116, 32, - 61, 32, 40, 86, 83, 95, - 79, 85, 84, 80, 85, 84, - 41, 32, 48, 59, 13, 10, + 80, 85, 84, 32, 111, 117, + 116, 112, 117, 116, 32, 61, + 32, 40, 86, 83, 95, 79, + 85, 84, 80, 85, 84, 41, + 32, 48, 59, 13, 10, 13, + 10, 9, 47, 47, 32, 115, + 104, 105, 102, 116, 32, 117, + 110, 105, 116, 32, 114, 101, + 99, 116, 97, 110, 103, 108, + 101, 32, 116, 111, 32, 99, + 104, 97, 114, 97, 99, 116, + 101, 114, 32, 99, 101, 108, + 108, 32, 114, 101, 99, 116, + 97, 110, 103, 108, 101, 13, + 10, 9, 112, 111, 115, 46, + 120, 121, 32, 43, 61, 32, + 102, 108, 111, 97, 116, 50, + 40, 105, 100, 32, 37, 32, + 99, 119, 44, 32, 40, 99, + 104, 45, 49, 41, 32, 45, + 32, 105, 100, 32, 47, 32, + 99, 104, 41, 59, 13, 10, 13, 10, 9, 47, 47, 32, - 115, 104, 105, 102, 116, 32, - 117, 110, 105, 116, 32, 114, - 101, 99, 116, 97, 110, 103, - 108, 101, 32, 116, 111, 32, - 99, 104, 97, 114, 97, 99, - 116, 101, 114, 32, 99, 101, + 97, 100, 106, 117, 115, 116, + 32, 117, 110, 105, 116, 32, + 116, 101, 120, 116, 117, 114, + 101, 32, 99, 111, 111, 114, + 100, 32, 116, 111, 32, 102, + 111, 110, 116, 32, 99, 101, 108, 108, 32, 114, 101, 99, 116, 97, 110, 103, 108, 101, - 13, 10, 9, 112, 111, 115, - 46, 120, 121, 32, 43, 61, - 32, 102, 108, 111, 97, 116, - 50, 40, 105, 100, 32, 37, - 32, 99, 119, 44, 32, 40, - 99, 104, 45, 49, 41, 32, - 45, 32, 105, 100, 32, 47, - 32, 99, 104, 41, 59, 13, - 10, 13, 10, 9, 47, 47, - 32, 97, 100, 106, 117, 115, - 116, 32, 117, 110, 105, 116, - 32, 116, 101, 120, 116, 117, - 114, 101, 32, 99, 111, 111, - 114, 100, 32, 116, 111, 32, - 102, 111, 110, 116, 32, 99, - 101, 108, 108, 32, 114, 101, - 99, 116, 97, 110, 103, 108, - 101, 13, 10, 9, 102, 108, - 111, 97, 116, 32, 116, 120, - 32, 61, 32, 40, 99, 32, - 37, 32, 49, 54, 41, 59, 13, 10, 9, 102, 108, 111, - 97, 116, 32, 116, 121, 32, - 61, 32, 40, 49, 53, 32, - 45, 32, 99, 32, 47, 32, + 97, 116, 32, 116, 120, 32, + 61, 32, 40, 99, 32, 37, + 32, 49, 54, 41, 59, 13, + 10, 9, 102, 108, 111, 97, + 116, 32, 116, 121, 32, 61, + 32, 40, 99, 32, 47, 32, 49, 54, 41, 59, 13, 10, 13, 10, 9, 111, 117, 116, 112, 117, 116, 46, 80, 111, @@ -2544,41 +2395,41 @@ const BYTE codeTextVS[] = 10, 9, 9, 43, 32, 102, 108, 111, 97, 116, 50, 40, 49, 46, 48, 47, 50, 53, - 54, 46, 48, 44, 45, 49, - 46, 48, 47, 50, 53, 54, - 46, 48, 41, 59, 13, 10, - 13, 10, 9, 47, 47, 32, - 100, 105, 115, 99, 97, 114, - 100, 32, 118, 105, 97, 32, - 99, 108, 105, 112, 112, 105, - 110, 103, 13, 10, 9, 105, - 102, 32, 40, 99, 32, 61, - 61, 32, 48, 41, 32, 111, - 117, 116, 112, 117, 116, 46, - 80, 111, 115, 105, 116, 105, - 111, 110, 46, 122, 32, 61, - 32, 45, 49, 46, 49, 59, - 13, 10, 13, 10, 9, 114, - 101, 116, 117, 114, 110, 32, - 111, 117, 116, 112, 117, 116, - 59, 13, 10, 125, 13, 10, - 71, 108, 111, 98, 97, 108, - 115, 76, 111, 99, 97, 108, - 115, 86, 83, 95, 79, 85, + 54, 46, 48, 44, 49, 46, + 48, 47, 50, 53, 54, 46, + 48, 41, 59, 13, 10, 13, + 10, 9, 47, 47, 32, 100, + 105, 115, 99, 97, 114, 100, + 32, 118, 105, 97, 32, 99, + 108, 105, 112, 112, 105, 110, + 103, 13, 10, 9, 105, 102, + 32, 40, 99, 32, 61, 61, + 32, 48, 41, 32, 111, 117, + 116, 112, 117, 116, 46, 80, + 111, 115, 105, 116, 105, 111, + 110, 46, 122, 32, 61, 32, + 45, 49, 46, 49, 59, 13, + 10, 13, 10, 9, 114, 101, + 116, 117, 114, 110, 32, 111, + 117, 116, 112, 117, 116, 59, + 13, 10, 125, 13, 10, 71, + 108, 111, 98, 97, 108, 115, + 76, 111, 99, 97, 108, 115, + 86, 83, 95, 79, 85, 84, + 80, 85, 84, 58, 58, 80, + 111, 115, 105, 116, 105, 111, + 110, 86, 83, 95, 79, 85, 84, 80, 85, 84, 58, 58, - 80, 111, 115, 105, 116, 105, - 111, 110, 86, 83, 95, 79, - 85, 84, 80, 85, 84, 58, - 58, 84, 101, 120, 67, 111, - 111, 114, 100, 77, 105, 99, - 114, 111, 115, 111, 102, 116, - 32, 40, 82, 41, 32, 72, - 76, 83, 76, 32, 83, 104, - 97, 100, 101, 114, 32, 67, - 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 109, 97, - 105, 110, 0, 118, 115, 95, - 52, 95, 48, 0 + 84, 101, 120, 67, 111, 111, + 114, 100, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 57, 46, 50, 57, 46, + 57, 53, 50, 46, 51, 49, + 49, 49, 0, 109, 97, 105, + 110, 0, 118, 115, 95, 52, + 95, 48, 0 }; diff --git a/common/TextVS.hlsl b/common/TextVS.hlsl @@ -23,7 +23,7 @@ VS_OUTPUT main( // adjust unit texture coord to font cell rectangle float tx = (c % 16); - float ty = (15 - c / 16); + float ty = (c / 16); output.Position = mul(MVP, pos); output.TexCoord = @@ -32,7 +32,7 @@ VS_OUTPUT main( // move to correct character + float2(tx/16.0,ty/16.0) // offset to avoid cruft - + float2(1.0/256.0,-1.0/256.0); + + float2(1.0/256.0,1.0/256.0); // discard via clipping if (c == 0) output.Position.z = -1.1; diff --git a/common/app.h b/common/app.h @@ -32,6 +32,46 @@ #define SHADER_DEBUG_FLAGS 0 #endif +struct PixelShader { + ID3D10PixelShader *ps; + PixelShader() : ps(NULL) {}; + ~PixelShader() { if (ps) ps->Release(); }; +}; + +struct VertexShader { + ID3D10VertexShader *vs; + ID3D10InputLayout *layout; + D3D10_INPUT_ELEMENT_DESC *desc; + unsigned dcount; + VertexShader() : vs(NULL), layout(NULL), desc(NULL), dcount(0) {}; + ~VertexShader() { if (vs) { vs->Release(); layout->Release(); } }; +}; + +struct Texture2D { + ID3D10Texture2D *tex; + ID3D10ShaderResourceView *srv; + Texture2D() : tex(NULL), srv(NULL) {}; + ~Texture2D() { if (tex) { tex->Release(); srv->Release(); } }; +}; + +struct UniformBuffer { + ID3D10Buffer *buf; + UniformBuffer() : buf(NULL) {}; + ~UniformBuffer() { if (buf) buf->Release(); }; +}; + +struct VertexBuffer { + ID3D10Buffer *buf; + VertexBuffer() : buf(NULL) {}; + ~VertexBuffer() { if (buf) buf->Release(); }; +}; + +struct IndexBuffer { + ID3D10Buffer *buf; + IndexBuffer() : buf(NULL) {}; + ~IndexBuffer() { if (buf) buf->Release(); }; +}; + class App { public: App(); @@ -49,25 +89,50 @@ public: void setActive(int a) { active = a; }; void setMouseXY(int x, int y) { mouseWX = x; mouseWY = y; }; - int createTextureRGBA(void *data, int tw, int th, - int genmips, ID3D10ShaderResourceView **srv); - int createBuffer(D3D10_BIND_FLAG flag, - void *data, int sz, ID3D10Buffer **buf); - void updateBuffer(ID3D10Buffer *buf, void *data) { - device->UpdateSubresource(buf, 0, NULL, data, 0, 0); + // TODO: move away from D3D10_INPUT... + int compileShader(VertexShader *vs, const char *fn, + void *data, unsigned len, int raw, + D3D10_INPUT_ELEMENT_DESC *layout, unsigned lcount); + int compileShader(PixelShader *ps, const char *fn, + void *data, unsigned len, int raw); + int loadShader(VertexShader *vs, const char *fn, + D3D10_INPUT_ELEMENT_DESC *layout, unsigned lcount); + int loadShader(PixelShader *ps, const char *fn); + + int loadTextureRGBA(Texture2D *tex, const char *fn, int genmips); + int createTextureRGBA(Texture2D *tex, void *data, unsigned w, unsigned h, int genmips); + + int initBuffer(VertexBuffer *vb, void *data, int sz); + int initBuffer(IndexBuffer *ib, void *data, int sz); + int initBuffer(UniformBuffer *ub, void *data, int sz); + + void updateBuffer(VertexBuffer *vb, void *data) { + device->UpdateSubresource(vb->buf, 0, NULL, data, 0, 0); + } + void updateBuffer(IndexBuffer *ib, void *data) { + device->UpdateSubresource(ib->buf, 0, NULL, data, 0, 0); + } + void updateBuffer(UniformBuffer *ub, void *data) { + device->UpdateSubresource(ub->buf, 0, NULL, data, 0, 0); } - int createVtxBuffer(void *data, int sz, ID3D10Buffer **buf) { - return createBuffer(D3D10_BIND_VERTEX_BUFFER, data, sz, buf); + void useShaders(PixelShader *ps, VertexShader *vs) { + device->PSSetShader(ps->ps); + device->VSSetShader(vs->vs); + device->IASetInputLayout(vs->layout); + } + void useBuffer(VertexBuffer *vb, int slot, UINT stride, UINT offset) { + device->IASetVertexBuffers(slot, 1, &vb->buf, &stride, &offset); + } + void useBuffer(IndexBuffer *ib) { + device->IASetIndexBuffer(ib->buf, DXGI_FORMAT_R16_UINT, 0); } - int createIdxBuffer(void *data, int sz, ID3D10Buffer **buf) { - return createBuffer(D3D10_BIND_INDEX_BUFFER, data, sz, buf); + void useBuffer(UniformBuffer *ub, int slot) { + device->VSSetConstantBuffers(slot, 1, &ub->buf); } - int createConstantBuffer(int sz, ID3D10Buffer **buf) { - return createBuffer(D3D10_BIND_CONSTANT_BUFFER, NULL, sz, buf); + void useTexture(Texture2D *tex, int slot) { + device->PSSetShaderResources(slot, 1, &tex->srv); } - int compileVertexShader(const char *fn, ID3D10VertexShader **vs, ID3D10Blob **data); - int compilePixelShader(const char *fn, ID3D10PixelShader **ps, ID3D10Blob **data); protected: int width; @@ -102,12 +167,6 @@ private: int active; }; -struct Texture2D { - ID3D10Texture2D *tex; - ID3D10ShaderResourceView *srv; - Texture2D() : tex(NULL), srv(NULL) {}; -}; - int compileShader(const char *fn, const char *profile, ID3D10Blob **shader); App *createApp(void); diff --git a/common/dxapp.cc b/common/dxapp.cc @@ -374,9 +374,122 @@ int App::initD3D(void) { // ---- -int App::createTextureRGBA( - void *data, int tw, int th, int genmips, - ID3D10ShaderResourceView **srv) { +static int _compile_shader(const char *fn, void *data, unsigned sz, + const char *profile, ID3D10Blob **shader) { + HRESULT hr; + ID3D10Blob *errors = NULL; + + hr = D3D10CompileShader((char*) data, sz, fn, + NULL, NULL, "main", profile, + D3D10_SHADER_ENABLE_STRICTNESS, + shader, &errors); + + if (errors) { + printx("--- error compiling '%s' ---\n", fn); + OutputDebugString((char*) errors->GetBufferPointer()); + errors->Release(); + return -1; + } + if (FAILED(hr)) + return error("cannot compile shader 0x%08x", hr); + + printx("Compiled '%s' to %d bytes\n", fn, (*shader)->GetBufferSize()); + return 0; +} + +int App::compileShader(VertexShader *_vs, const char *fn, + void *data, unsigned len, int raw, + D3D10_INPUT_ELEMENT_DESC *desc, unsigned dcount) { + ID3D10VertexShader *vs = NULL; + ID3D10InputLayout *layout = NULL; + ID3D10Blob *bin = NULL; + HRESULT hr; + + if (raw) { + hr = device->CreateVertexShader(data, len, &vs); + if (FAILED(hr)) + return error("failed to create shader '%s' 0x%08x", fn, hr); + hr = device->CreateInputLayout(desc, dcount, data, len, &layout); + } else { + if (_compile_shader(fn, data, len, "vs_4_0", &bin)) + return -1; + hr = device->CreateVertexShader(bin->GetBufferPointer(), bin->GetBufferSize(), &vs); + if (FAILED(hr)) { + bin->Release(); + return error("failed to create shader '%s' 0x%08x", fn, hr); + } + hr = device->CreateInputLayout(desc, dcount, + bin->GetBufferPointer(), bin->GetBufferSize(), &layout); + bin->Release(); + } + if (FAILED(hr)) + return error("failed to bind layout for '%s' 0x%08x", fn, hr); + if (_vs->vs) + _vs->vs->Release(); + if (_vs->layout) + _vs->layout->Release(); + _vs->vs = vs; + _vs->layout = layout; + _vs->desc = desc; + _vs->dcount = dcount; + return 0; +} + +int App::compileShader(PixelShader *_ps, const char *fn, + void *data, unsigned len, int raw) { + ID3D10PixelShader *ps; + HRESULT hr; + if (raw) { + hr = device->CreatePixelShader(data, len, &ps); + } else { + ID3D10Blob *bin = NULL; + if (_compile_shader(fn, data, len, "ps_4_0", &bin)) + return -1; + hr = device->CreatePixelShader(bin->GetBufferPointer(), bin->GetBufferSize(), &ps); + bin->Release(); + } + if (FAILED(hr)) + return error("failed to create shader '%s' 0x%08x", fn, hr); + if (_ps->ps) + _ps->ps->Release(); + _ps->ps = ps; + return 0; +} + +// TODO choose raw based on content or extension +int App::loadShader(VertexShader *vs, const char *fn, + D3D10_INPUT_ELEMENT_DESC *layout, unsigned lcount) { + void *data; + unsigned sz; + if (!(data = load_file(fn, &sz))) + return -1; + int r = compileShader(vs, fn, data, sz, 0, layout, lcount); + free(data); + return r; +} + +int App::loadShader(PixelShader *ps, const char *fn) { + void *data; + unsigned sz; + if (!(data = load_file(fn, &sz))) + return -1; + int r = compileShader(ps, fn, data, sz, 0); + free(data); + return r; +} + +int App::loadTextureRGBA(Texture2D *tex, const char *fn, int genmips) { + void *data; + unsigned dw, dh; + int r; + if (!(data = load_png_rgba(fn, &dw, &dh, 0))) + return -1; + r = createTextureRGBA(tex, data, dw, dh, genmips); + free(data); + return r; +} + +int App::createTextureRGBA(Texture2D *tex, void *data, unsigned tw, unsigned th, int genmips) { int stride = tw * 4; int size = stride * th; HRESULT hr; @@ -411,25 +524,26 @@ int App::createTextureRGBA( srvd.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D; srvd.Texture2D.MipLevels = genmips ? -1 : 1; srvd.Texture2D.MostDetailedMip = 0; - hr = device->CreateShaderResourceView(texture, &srvd, srv); + hr = device->CreateShaderResourceView(texture, &srvd, &tex->srv); if (FAILED(hr)) { - texture->Release(); + tex->tex->Release(); + tex->tex = NULL; return error("failed to create shader resource view 0x%08x",hr); } if (genmips) { device->UpdateSubresource(texture, 0, NULL, data, stride, size); - device->GenerateMips(*srv); + device->GenerateMips(tex->srv); } - // TODO: track and release textures return 0; } -int App::createBuffer(D3D10_BIND_FLAG flag, +int _create_buffer(ID3D10Device *device, D3D10_BIND_FLAG flag, void *data, int sz, ID3D10Buffer **buf) { HRESULT hr; - + ID3D10Buffer *old = *buf; + D3D10_BUFFER_DESC bd; bd.Usage = D3D10_USAGE_DEFAULT; bd.ByteWidth = sz; @@ -442,70 +556,21 @@ int App::createBuffer(D3D10_BIND_FLAG flag, hr = device->CreateBuffer(&bd, data ? &idata : NULL, buf); if (FAILED(hr)) return error("create buffer failed 0x%08x", hr); - + if (old != NULL) + old->Release(); return 0; } -int compileShader(const char *fn, const char *profile, ID3D10Blob **shader) { - HRESULT hr; - ID3D10Blob *errors = NULL; - void *data; - unsigned dsz; - - if (!(data = load_file(fn, &dsz))) - return error("cannot load shader"); - - hr = D3D10CompileShader((char*) data, dsz, fn, - NULL, NULL, "main", profile, - D3D10_SHADER_ENABLE_STRICTNESS, - shader, &errors); - - free(data); - - if (errors) { - printx("--- error compiling '%s' ---\n", fn); - OutputDebugString((char*) errors->GetBufferPointer()); - errors->Release(); - return -1; - } - if (FAILED(hr)) - return error("cannot compile shader 0x%08x", hr); - - printx("Compiled '%s' to %d bytes\n", fn, (*shader)->GetBufferSize()); - return 0; +int App::initBuffer(VertexBuffer *vb, void *data, int sz) { + return _create_buffer(device, D3D10_BIND_VERTEX_BUFFER, data, sz, &vb->buf); } - -int App::compileVertexShader(const char *fn, ID3D10VertexShader **vs, ID3D10Blob **_data) { - ID3D10Blob *data = NULL; - HRESULT hr; - if (compileShader(fn, "vs_4_0", &data)) - return -1; - hr = device->CreateVertexShader(data->GetBufferPointer(), data->GetBufferSize(), vs); - if (_data) - *_data = data; - else - data->Release(); - if (FAILED(hr)) - return error("failed to create shader '%s' 0x%08x", fn, hr); - return 0; +int App::initBuffer(IndexBuffer *ib, void *data, int sz) { + return _create_buffer(device, D3D10_BIND_INDEX_BUFFER, data, sz, &ib->buf); } - -int App::compilePixelShader(const char *fn, ID3D10PixelShader **ps, ID3D10Blob **_data) { - ID3D10Blob *data = NULL; - HRESULT hr; - if (compileShader(fn, "ps_4_0", &data)) - return -1; - hr = device->CreatePixelShader(data->GetBufferPointer(), data->GetBufferSize(), ps); - if (_data) - *_data = data; - else - data->Release(); - if (FAILED(hr)) - return error("failed to create shader '%s' 0x%08x", fn, hr); - return 0; +int App::initBuffer(UniformBuffer *ub, void *data, int sz) { + return _create_buffer(device, D3D10_BIND_CONSTANT_BUFFER, data, sz, &ub->buf); } - // ---- void printx(const char *fmt, ...) { diff --git a/common/textgrid.cc b/common/textgrid.cc @@ -31,17 +31,17 @@ static D3D10_INPUT_ELEMENT_DESC text_layout_desc[] = { { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "CHARACTER", 0, DXGI_FORMAT_R8_UINT, 1, 0, D3D10_INPUT_PER_INSTANCE_DATA, 1 }, }; static float unit_box_2d[] = { - 0, 1, 0, 1, - 0, 0, 0, 0, - 1, 0, 1, 0, - 1, 0, 1, 0, - 1, 1, 1, 1, - 0, 1, 0, 1, + 0, 1, 0, 0, + 0, 0, 0, 1, + 1, 0, 1, 1, + 1, 0, 1, 1, + 1, 1, 1, 0, + 0, 1, 0, 0, }; int TextGrid::init(App *a, ID3D10Device *device, int w, int h) { @@ -66,65 +66,48 @@ int TextGrid::init(App *a, ID3D10Device *device, int w, int h) { return -1; clear(); - ID3D10Blob *blob; - if (!(data = load_png_rgba("font-vincent-8x8.png", &dw, &dh, 1))) - return error("cannot load texture"); - if (a->createTextureRGBA(data, dw, dh, 0, &texture)) + if (a->loadTextureRGBA(&texture, "font-vincent-8x8.png", 0)) return -1; - free(data); - - if (a->createVtxBuffer(unit_box_2d, sizeof(unit_box_2d), &vtxbuf)) + if (a->initBuffer(&vtx, unit_box_2d, sizeof(unit_box_2d))) return -1; - if (a->createVtxBuffer(grid, width * height, &charbuf)) + if (a->initBuffer(&cbuf, grid, width * height)) return -1; - if (a->createConstantBuffer(sizeof(cb), &cbuf)) + if (a->initBuffer(&ubuf, NULL, sizeof(cb))) return -1; #if BUILTIN - if (FAILED(device->CreatePixelShader(codeTextPS, sizeof(codeTextPS), &PS))) + if (a->compileShader(&ps, "TextPS.hlsl", + (void*) codeTextPS, sizeof(codeTextPS), 1)) return -1; - if (FAILED(device->CreateVertexShader(codeTextVS, sizeof(codeTextVS), &VS))) + if (a->compileShader(&vs, "TextVS.hlsl", + (void*) codeTextVS, sizeof(codeTextVS), 1, + text_layout_desc, sizeof(text_layout_desc)/sizeof(text_layout_desc[0]))) return -1; - hr = device->CreateInputLayout(text_layout_desc, - sizeof(text_layout_desc) / sizeof(text_layout_desc[0]), - codeTextVS, sizeof(codeTextVS), &layout); #else - if (a->compilePixelShader("TextPS.hlsl", &PS, NULL)) + if (a->loadShader(&ps, "../common/TextPS.hlsl")) return -1; - if (a->compileVertexShader("TextVS.hlsl", &VS, &blob)) + if (a->loadShader(&vs, "../common/TextVS.hlsl", + text_layout_desc, sizeof(text_layout_desc)/sizeof(text_layout_desc[0]))) return -1; - hr = device->CreateInputLayout(text_layout_desc, - sizeof(text_layout_desc) / sizeof(text_layout_desc[0]), - blob->GetBufferPointer(), blob->GetBufferSize(), &layout); - blob->Release(); #endif - if (FAILED(hr)) - return -1; cb.proj.setOrtho(0, w, 0, h, -1, 1); cb.cw = width; cb.ch = height; - a->updateBuffer(cbuf, &cb); - - stride[0] = 16; - stride[1] = 1; - offset[0] = 0; - offset[1] = 0; - buffer[0] = vtxbuf; - buffer[1] = charbuf; + a->updateBuffer(&ubuf, &cb); + return 0; } void TextGrid::render(App *a, ID3D10Device *device) { if (dirty) { dirty = 0; - a->updateBuffer(charbuf, grid); + a->updateBuffer(&cbuf, grid); } - device->VSSetShader(VS); - device->PSSetShader(PS); - device->VSSetConstantBuffers(0, 1, &cbuf); - device->PSSetShaderResources(0, 1, &texture); - device->IASetInputLayout(layout); - device->IASetVertexBuffers(0, 2, buffer, stride, offset); + a->useShaders(&ps, &vs); + a->useBuffer(&ubuf, 0); + a->useTexture(&texture, 0); + a->useBuffer(&vtx, 0, 16, 0); + a->useBuffer(&cbuf, 1, 1, 0); device->DrawInstanced(6, width * height, 0, 0); } diff --git a/common/textgrid.h b/common/textgrid.h @@ -28,19 +28,14 @@ private: int height; int dirty; - ID3D10InputLayout *layout; - ID3D10Buffer *vtxbuf; - ID3D10Buffer *charbuf; - ID3D10PixelShader *PS; - ID3D10VertexShader *VS; - ID3D10ShaderResourceView *texture; - ID3D10Buffer *cbuf; + UniformBuffer ubuf; + VertexBuffer vtx; + VertexBuffer cbuf; + PixelShader ps; + VertexShader vs; + Texture2D texture; unsigned char *grid; - - UINT stride[2]; - UINT offset[2]; - ID3D10Buffer *buffer[2]; }; #endif \ No newline at end of file diff --git a/hello/SimplePS.hlsl b/hello/SimplePS.hlsl @@ -1,11 +1,6 @@ -Texture2D Texture0; - -SamplerState samLinear { - Filter = MIN_MAG_MIP_LINEAR; - AddressU = Wrap; - AddressV = Wrap; -}; +//Texture2D Texture0; +//SamplerState samLinear; struct VS_OUTPUT { float4 Position : SV_POSITION; diff --git a/hello/hello.cc b/hello/hello.cc @@ -56,18 +56,12 @@ private: float t; DWORD timeStart; - ID3D10InputLayout *layout; - ID3D10Buffer *vtxbuf; - ID3D10Buffer *idxbuf; - ID3D10Buffer *ibuf; - ID3D10Buffer *cbuf; - - ID3D10PixelShader *PS; - ID3D10VertexShader *VS; - ID3D10Blob *PSbc; - ID3D10Blob *VSbc; - - ID3D10ShaderResourceView *rvShader0; + PixelShader ps; + VertexShader vs; + IndexBuffer ibuf; + VertexBuffer vbuf; + UniformBuffer ubuf; + VertexBuffer lbuf; TextGrid text; float nx,ny; @@ -77,19 +71,10 @@ private: struct model *m; }; -TestApp::TestApp() : App(), t(0.0f), timeStart(0), zoom(0), rx(0), ry(0), nx(0), ny(0), - layout(NULL), vtxbuf(NULL), idxbuf(NULL), cbuf(NULL), ibuf(NULL), - PS(NULL), VS(NULL), PSbc(NULL), VSbc(NULL), rvShader0(NULL) { +TestApp::TestApp() : App(), t(0.0f), timeStart(0), zoom(0), rx(0), ry(0), nx(0), ny(0) { } void TestApp::release(void) { - if (PS) PS->Release(); - if (VS) VS->Release(); - if (rvShader0) rvShader0->Release(); - if (layout) layout->Release(); - if (vtxbuf) vtxbuf->Release(); - if (idxbuf) idxbuf->Release(); - if (cbuf) cbuf->Release(); } void TestApp::build(void) { @@ -123,47 +108,24 @@ void TestApp::build(void) { lcount = n / 4; printx("Wrote %d locations\n", lcount); - if (ibuf) { - ibuf->Release(); - ibuf = NULL; - } - - createVtxBuffer(location, lcount*4, &ibuf); + initBuffer(&lbuf, location, lcount * 4); } int TestApp::init(void) { - HRESULT hr; - void *data; - unsigned dsz, dw, dh; - - if (compilePixelShader("SimplePS.hlsl", &PS, &PSbc)) + if (loadShader(&ps, "SimplePS.hlsl")) return -1; - if (compileVertexShader("SimpleVS.hlsl", &VS, &VSbc)) + if (loadShader(&vs, "SimpleVS.hlsl", obj_layout, sizeof(obj_layout) / sizeof(obj_layout[0]))) return -1; - hr = device->CreateInputLayout(obj_layout, - sizeof(obj_layout) / sizeof(obj_layout[0]), - VSbc->GetBufferPointer(), VSbc->GetBufferSize(), &layout); - if (FAILED(hr)) - return error("create input layout failed 0x%08x", hr); - if (!(m = load_wavefront_obj("unitcubeoid.obj"))) return error("cannot load model"); printx("Object Loaded. %d vertices, %d indices.\n", m->vcount, m->icount); - if (createVtxBuffer(m->vdata, 32 * m->vcount, &vtxbuf)) + if (initBuffer(&vbuf, m->vdata, 32 * m->vcount)) return -1; - if (createIdxBuffer(m->idx, sizeof(short) * m->icount, &idxbuf)) + if (initBuffer(&ibuf, m->idx, 2 * m->icount)) return -1; - -#if 0 - if (!(data = load_png_rgba("cube-texture.png", &dw, &dh, 0))) - return error("cannot load texture"); - if (createTextureRGBA(data, dw, dh, 1, &rvShader0)) - return -1; - free(data); -#endif - if (createConstantBuffer(32 * 4, &cbuf)) + if (initBuffer(&ubuf, NULL, 32 * 4)) return -1; proj.setPerspective(D2R(90.0), width / (float) height, 0.1f, 250.0f); @@ -206,27 +168,9 @@ void TestApp::render(void) { if (keystate[DIK_S]) { ny += 0.01; update = 1; } if (keystate[DIK_P]) { - ID3D10PixelShader *PS2; - ID3D10VertexShader *VS2; - ID3D10Blob *PSbc2; - ID3D10Blob *VSbc2; - if (compilePixelShader("SimplePS.hlsl", &PS2, &PSbc2)) - goto oops; - if (compileVertexShader("SimpleVS.hlsl", &VS2, &VSbc2)) { - PS2->Release(); - PSbc2->Release(); - goto oops; - } - PS->Release(); - VS->Release(); - PSbc->Release(); - VSbc->Release(); - PS = PS2; - VS = VS2; - PSbc = PSbc2; - VSbc = VSbc2; - device->PSSetShader(PS); - device->VSSetShader(VS); + loadShader(&ps, "HelloPS.hlsl"); + loadShader(&vs, "SimpleVS.hlsl", obj_layout, + sizeof(obj_layout) / sizeof(obj_layout[0])); } oops: if (update) @@ -236,17 +180,12 @@ oops: device->ClearRenderTargetView(targetView, rgba); device->ClearDepthStencilView(depthView, D3D10_CLEAR_DEPTH, 1.0f, 0 ); - device->VSSetShader(VS); - device->PSSetShader(PS); - device->VSSetConstantBuffers(0, 1, &cbuf); - device->PSSetShaderResources(0, 1, &rvShader0); - - stride = 32; offset = 0; - device->IASetInputLayout(layout); - device->IASetVertexBuffers(0, 1, &vtxbuf, &stride, &offset); - stride = 4; offset = 0; - device->IASetVertexBuffers(1, 1, &ibuf, &stride, &offset); - device->IASetIndexBuffer(idxbuf, DXGI_FORMAT_R16_UINT, 0); + useShaders(&ps, &vs); + useBuffer(&ubuf, 0); + useBuffer(&vbuf, 0, 32, 0); + useBuffer(&lbuf, 1, 4, 0); + useBuffer(&ibuf); + device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); struct { mat4 mvp; @@ -260,7 +199,7 @@ oops: world.identity().translate(0.5, 0.5, 0.5); cb0.mvp = world * view * proj; cb0.mv = world * view; - updateBuffer(cbuf, &cb0); + updateBuffer(&ubuf, &cb0); device->DrawIndexedInstanced(m->icount, lcount, 0, 0, 0); text.clear();