diff options
| author | Takamichi Horikawa <takamichiho@gmail.com> | 2017-09-08 23:25:51 +0900 | 
|---|---|---|
| committer | Takamichi Horikawa <takamichiho@gmail.com> | 2017-09-08 23:25:51 +0900 | 
| commit | 50c75c12597b230cec4d7a29559cde263025eeb2 (patch) | |
| tree | 9fa8afe8bcf6e1219186e5c567930831a3b5eab5 /pacc/hlsl | |
| parent | 4cfeddd04dcbbf658195bd837d7daff7f08b37bc (diff) | |
pacc: initial
Diffstat (limited to 'pacc/hlsl')
| -rw-r--r-- | pacc/hlsl/Makefile | 15 | ||||
| -rw-r--r-- | pacc/hlsl/blit.vs.hlsl | 17 | ||||
| -rw-r--r-- | pacc/hlsl/blit.vs.inc | 71 | ||||
| -rw-r--r-- | pacc/hlsl/color.ps.hlsl | 23 | ||||
| -rw-r--r-- | pacc/hlsl/color.ps.inc | 106 | ||||
| -rw-r--r-- | pacc/hlsl/color_trans.ps.hlsl | 19 | ||||
| -rw-r--r-- | pacc/hlsl/color_trans.ps.inc | 110 | ||||
| -rw-r--r-- | pacc/hlsl/copy.ps.hlsl | 18 | ||||
| -rw-r--r-- | pacc/hlsl/copy.ps.inc | 93 | ||||
| -rw-r--r-- | pacc/hlsl/fill.ps.hlsl | 15 | ||||
| -rw-r--r-- | pacc/hlsl/fill.ps.inc | 65 | ||||
| -rw-r--r-- | pacc/hlsl/font.ps.hlsl | 24 | ||||
| -rw-r--r-- | pacc/hlsl/font.ps.inc | 126 | ||||
| -rw-r--r-- | pacc/hlsl/key.ps.hlsl | 20 | ||||
| -rw-r--r-- | pacc/hlsl/key.ps.inc | 141 | 
15 files changed, 863 insertions, 0 deletions
| diff --git a/pacc/hlsl/Makefile b/pacc/hlsl/Makefile new file mode 100644 index 0000000..7cd2f51 --- /dev/null +++ b/pacc/hlsl/Makefile @@ -0,0 +1,15 @@ +INCS:=copy.ps.inc color.ps.inc color_trans.ps.inc key.ps.inc fill.ps.inc font.ps.inc blit.vs.inc +FXC:=env WINEDEBUG=-all wine $(HOME)/hlsl/fxc/fxc +all:	$(INCS) + +%.inc:	%.inc.tmp +	dos2unix < $< | sed -e 's/^const BYTE g_/static const BYTE /' -e '$$a\\' > $@ + +%.vs.inc.tmp: %.vs.hlsl +	$(FXC) /nologo /O3 /Tvs_2_0 /E$(basename $(basename $<)) /Fh $@ $< + +%.ps.inc.tmp: %.ps.hlsl +	$(FXC) /nologo /O3 /Tps_2_0 /E$(basename $(basename $<)) /Fh $@ $< + +clean: +	rm -f $(INCS) diff --git a/pacc/hlsl/blit.vs.hlsl b/pacc/hlsl/blit.vs.hlsl new file mode 100644 index 0000000..ea4c18d --- /dev/null +++ b/pacc/hlsl/blit.vs.hlsl @@ -0,0 +1,17 @@ +struct vsinput { +  float4 coord : POSITION; +}; + +struct fsinput { +  float4 coord : POSITION; +  float4 texcoord : TEXCOORD; +}; + +float2 offset: register(c0); + +fsinput blit(vsinput input) { +  fsinput output; +  output.coord = float4(input.coord.xy + offset, 0.0, 1.0); +  output.texcoord = float4(input.coord.zw, 0.0, 1.0); +  return output; +} diff --git a/pacc/hlsl/blit.vs.inc b/pacc/hlsl/blit.vs.inc new file mode 100644 index 0000000..a2c4a64 --- /dev/null +++ b/pacc/hlsl/blit.vs.inc @@ -0,0 +1,71 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +//   fxc /nologo /O3 /Tvs_2_0 /Eblit /Fh blit.vs.inc.tmp blit.vs.hlsl +// +// +// Parameters: +// +//   float2 offset; +// +// +// Registers: +// +//   Name         Reg   Size +//   ------------ ----- ---- +//   offset       c0       1 +// + +    vs_2_0 +    def c1, 0, 1, 0, 0 +    dcl_position v0 +    add oPos.xy, v0, c0 +    mov oPos.zw, c1.xyxy +    mad oT0, v0.zwzz, c1.yyxx, c1.xxxy + +// approximately 3 instruction slots used +#endif + +static const BYTE vs20_blit[] = +{ +      0,   2, 254, 255, 254, 255,  +     33,   0,  67,  84,  65,  66,  +     28,   0,   0,   0,  79,   0,  +      0,   0,   0,   2, 254, 255,  +      1,   0,   0,   0,  28,   0,  +      0,   0,   0, 129,   0,   0,  +     72,   0,   0,   0,  48,   0,  +      0,   0,   2,   0,   0,   0,  +      1,   0,   2,   0,  56,   0,  +      0,   0,   0,   0,   0,   0,  +    111, 102, 102, 115, 101, 116,  +      0, 171,   1,   0,   3,   0,  +      1,   0,   2,   0,   1,   0,  +      0,   0,   0,   0,   0,   0,  +    118, 115,  95,  50,  95,  48,  +      0,  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,  81,   0,   0,   5,  +      1,   0,  15, 160,   0,   0,  +      0,   0,   0,   0, 128,  63,  +      0,   0,   0,   0,   0,   0,  +      0,   0,  31,   0,   0,   2,  +      0,   0,   0, 128,   0,   0,  +     15, 144,   2,   0,   0,   3,  +      0,   0,   3, 192,   0,   0,  +    228, 144,   0,   0, 228, 160,  +      1,   0,   0,   2,   0,   0,  +     12, 192,   1,   0,  68, 160,  +      4,   0,   0,   4,   0,   0,  +     15, 224,   0,   0, 174, 144,  +      1,   0,   5, 160,   1,   0,  +     64, 160, 255, 255,   0,   0 +}; + diff --git a/pacc/hlsl/color.ps.hlsl b/pacc/hlsl/color.ps.hlsl new file mode 100644 index 0000000..5111097 --- /dev/null +++ b/pacc/hlsl/color.ps.hlsl @@ -0,0 +1,23 @@ +struct psinput { +  float4 texcoord: TEXCOORD; +}; + +struct psoutput { +  float4 fragcolor: COLOR; +}; + +sampler palette: register(s0); +sampler tex: register(s1); +float uni_color: register(c0); + +psoutput color(psinput input) { +  psoutput output; +  float index = tex2D(tex, input.texcoord.xy).r; +  if (index > (0.5/255.0)) { +    index = uni_color; +  } else { +    index = 0.5 / 256.0; +  } +  output.fragcolor = tex1D(palette, index); +  return output; +} diff --git a/pacc/hlsl/color.ps.inc b/pacc/hlsl/color.ps.inc new file mode 100644 index 0000000..5cd1a17 --- /dev/null +++ b/pacc/hlsl/color.ps.inc @@ -0,0 +1,106 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +//   fxc /nologo /O3 /Tps_2_0 /Ecolor /Fh color.ps.inc.tmp color.ps.hlsl +// +// +// Parameters: +// +//   sampler2D palette; +//   sampler2D tex; +//   float uni_color; +// +// +// Registers: +// +//   Name         Reg   Size +//   ------------ ----- ---- +//   uni_color    c0       1 +//   palette      s0       1 +//   tex          s1       1 +// + +    ps_2_0 +    def c1, 0.00196078443, 0.001953125, 0, 0 +    dcl t0.xy +    dcl_2d s0 +    dcl_2d s1 +    texld r0, t0, s1 +    add r0.x, -r0.x, c1.x +    mov r0.y, c1.y +    cmp r0.xy, r0.x, r0.y, c0.x +    texld r0, r0, s0 +    mov oC0, r0 + +// approximately 6 instruction slots used (2 texture, 4 arithmetic) +#endif + +static const BYTE ps20_color[] = +{ +      0,   2, 255, 255, 254, 255,  +     55,   0,  67,  84,  65,  66,  +     28,   0,   0,   0, 167,   0,  +      0,   0,   0,   2, 255, 255,  +      3,   0,   0,   0,  28,   0,  +      0,   0,   0, 129,   0,   0,  +    160,   0,   0,   0,  88,   0,  +      0,   0,   3,   0,   0,   0,  +      1,   0,   2,   0,  96,   0,  +      0,   0,   0,   0,   0,   0,  +    112,   0,   0,   0,   3,   0,  +      1,   0,   1,   0,   6,   0,  +    116,   0,   0,   0,   0,   0,  +      0,   0, 132,   0,   0,   0,  +      2,   0,   0,   0,   1,   0,  +      2,   0, 144,   0,   0,   0,  +      0,   0,   0,   0, 112,  97,  +    108, 101, 116, 116, 101,   0,  +      4,   0,  12,   0,   1,   0,  +      1,   0,   1,   0,   0,   0,  +      0,   0,   0,   0, 116, 101,  +    120,   0,   4,   0,  12,   0,  +      1,   0,   1,   0,   1,   0,  +      0,   0,   0,   0,   0,   0,  +    117, 110, 105,  95,  99, 111,  +    108, 111, 114,   0, 171, 171,  +      0,   0,   3,   0,   1,   0,  +      1,   0,   1,   0,   0,   0,  +      0,   0,   0,   0, 112, 115,  +     95,  50,  95,  48,   0,  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,  +     81,   0,   0,   5,   1,   0,  +     15, 160, 129, 128,   0,  59,  +      0,   0,   0,  59,   0,   0,  +      0,   0,   0,   0,   0,   0,  +     31,   0,   0,   2,   0,   0,  +      0, 128,   0,   0,   3, 176,  +     31,   0,   0,   2,   0,   0,  +      0, 144,   0,   8,  15, 160,  +     31,   0,   0,   2,   0,   0,  +      0, 144,   1,   8,  15, 160,  +     66,   0,   0,   3,   0,   0,  +     15, 128,   0,   0, 228, 176,  +      1,   8, 228, 160,   2,   0,  +      0,   3,   0,   0,   1, 128,  +      0,   0,   0, 129,   1,   0,  +      0, 160,   1,   0,   0,   2,  +      0,   0,   2, 128,   1,   0,  +     85, 160,  88,   0,   0,   4,  +      0,   0,   3, 128,   0,   0,  +      0, 128,   0,   0,  85, 128,  +      0,   0,   0, 160,  66,   0,  +      0,   3,   0,   0,  15, 128,  +      0,   0, 228, 128,   0,   8,  +    228, 160,   1,   0,   0,   2,  +      0,   8,  15, 128,   0,   0,  +    228, 128, 255, 255,   0,   0 +}; + diff --git a/pacc/hlsl/color_trans.ps.hlsl b/pacc/hlsl/color_trans.ps.hlsl new file mode 100644 index 0000000..00999fd --- /dev/null +++ b/pacc/hlsl/color_trans.ps.hlsl @@ -0,0 +1,19 @@ +struct psinput { +  float4 texcoord: TEXCOORD; +}; + +struct psoutput { +  float4 fragcolor: COLOR; +}; + +sampler palette: register(s0); +sampler tex: register(s1); +float uni_color: register(c0); + +psoutput color_trans(psinput input) { +  psoutput output; +  float index = tex2D(tex, input.texcoord.xy).r; +  if (index < (0.5/255.0)) discard; +  output.fragcolor = tex1D(palette, uni_color); +  return output; +} diff --git a/pacc/hlsl/color_trans.ps.inc b/pacc/hlsl/color_trans.ps.inc new file mode 100644 index 0000000..6df66f8 --- /dev/null +++ b/pacc/hlsl/color_trans.ps.inc @@ -0,0 +1,110 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +//   fxc /nologo /O3 /Tps_2_0 /Ecolor_trans /Fh color_trans.ps.inc.tmp +//    color_trans.ps.hlsl +// +// +// Parameters: +// +//   sampler2D palette; +//   sampler2D tex; +//   float uni_color; +// +// +// Registers: +// +//   Name         Reg   Size +//   ------------ ----- ---- +//   uni_color    c0       1 +//   palette      s0       1 +//   tex          s1       1 +// + +    ps_2_0 +    def c1, -0.00196078443, -0, -1, 0 +    dcl t0.xy +    dcl_2d s0 +    dcl_2d s1 +    texld r0, t0, s1 +    add r0.x, r0.x, c1.x +    cmp r0, r0.x, c1.y, c1.z +    texkill r0 +    mov r0.xy, c0.x +    texld r0, r0, s0 +    mov oC0, r0 + +// approximately 7 instruction slots used (2 texture, 5 arithmetic) +#endif + +static const BYTE ps20_color_trans[] = +{ +      0,   2, 255, 255, 254, 255,  +     55,   0,  67,  84,  65,  66,  +     28,   0,   0,   0, 167,   0,  +      0,   0,   0,   2, 255, 255,  +      3,   0,   0,   0,  28,   0,  +      0,   0,   0, 129,   0,   0,  +    160,   0,   0,   0,  88,   0,  +      0,   0,   3,   0,   0,   0,  +      1,   0,   2,   0,  96,   0,  +      0,   0,   0,   0,   0,   0,  +    112,   0,   0,   0,   3,   0,  +      1,   0,   1,   0,   6,   0,  +    116,   0,   0,   0,   0,   0,  +      0,   0, 132,   0,   0,   0,  +      2,   0,   0,   0,   1,   0,  +      2,   0, 144,   0,   0,   0,  +      0,   0,   0,   0, 112,  97,  +    108, 101, 116, 116, 101,   0,  +      4,   0,  12,   0,   1,   0,  +      1,   0,   1,   0,   0,   0,  +      0,   0,   0,   0, 116, 101,  +    120,   0,   4,   0,  12,   0,  +      1,   0,   1,   0,   1,   0,  +      0,   0,   0,   0,   0,   0,  +    117, 110, 105,  95,  99, 111,  +    108, 111, 114,   0, 171, 171,  +      0,   0,   3,   0,   1,   0,  +      1,   0,   1,   0,   0,   0,  +      0,   0,   0,   0, 112, 115,  +     95,  50,  95,  48,   0,  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,  +     81,   0,   0,   5,   1,   0,  +     15, 160, 129, 128,   0, 187,  +      0,   0,   0, 128,   0,   0,  +    128, 191,   0,   0,   0,   0,  +     31,   0,   0,   2,   0,   0,  +      0, 128,   0,   0,   3, 176,  +     31,   0,   0,   2,   0,   0,  +      0, 144,   0,   8,  15, 160,  +     31,   0,   0,   2,   0,   0,  +      0, 144,   1,   8,  15, 160,  +     66,   0,   0,   3,   0,   0,  +     15, 128,   0,   0, 228, 176,  +      1,   8, 228, 160,   2,   0,  +      0,   3,   0,   0,   1, 128,  +      0,   0,   0, 128,   1,   0,  +      0, 160,  88,   0,   0,   4,  +      0,   0,  15, 128,   0,   0,  +      0, 128,   1,   0,  85, 160,  +      1,   0, 170, 160,  65,   0,  +      0,   1,   0,   0,  15, 128,  +      1,   0,   0,   2,   0,   0,  +      3, 128,   0,   0,   0, 160,  +     66,   0,   0,   3,   0,   0,  +     15, 128,   0,   0, 228, 128,  +      0,   8, 228, 160,   1,   0,  +      0,   2,   0,   8,  15, 128,  +      0,   0, 228, 128, 255, 255,  +      0,   0 +}; + diff --git a/pacc/hlsl/copy.ps.hlsl b/pacc/hlsl/copy.ps.hlsl new file mode 100644 index 0000000..df9d1eb --- /dev/null +++ b/pacc/hlsl/copy.ps.hlsl @@ -0,0 +1,18 @@ +struct psinput { +  float4 texcoord: TEXCOORD; +}; + +struct psoutput { +  float4 fragcolor: COLOR; +}; + +sampler palette: register(s0); +sampler tex: register(s1); + +psoutput copy(psinput input) { +  psoutput output; +  float index = tex2D(tex, input.texcoord.xy).r; +  float color = (index * 255.0 + 0.5) / 256.0; +  output.fragcolor = tex1D(palette, color); +  return output; +} diff --git a/pacc/hlsl/copy.ps.inc b/pacc/hlsl/copy.ps.inc new file mode 100644 index 0000000..16acf0a --- /dev/null +++ b/pacc/hlsl/copy.ps.inc @@ -0,0 +1,93 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +//   fxc /nologo /O3 /Tps_2_0 /Ecopy /Fh copy.ps.inc.tmp copy.ps.hlsl +// +// +// Parameters: +// +//   sampler2D palette; +//   sampler2D tex; +// +// +// Registers: +// +//   Name         Reg   Size +//   ------------ ----- ---- +//   palette      s0       1 +//   tex          s1       1 +// + +    ps_2_0 +    def c0, 255, 0.5, 0.00390625, 0 +    dcl t0.xy +    dcl_2d s0 +    dcl_2d s1 +    texld r0, t0, s1 +    mad r0.x, r0.x, c0.x, c0.y +    mul r0.xy, r0.x, c0.z +    texld r0, r0, s0 +    mov oC0, r0 + +// approximately 5 instruction slots used (2 texture, 3 arithmetic) +#endif + +static const BYTE ps20_copy[] = +{ +      0,   2, 255, 255, 254, 255,  +     43,   0,  67,  84,  65,  66,  +     28,   0,   0,   0, 119,   0,  +      0,   0,   0,   2, 255, 255,  +      2,   0,   0,   0,  28,   0,  +      0,   0,   0, 129,   0,   0,  +    112,   0,   0,   0,  68,   0,  +      0,   0,   3,   0,   0,   0,  +      1,   0,   2,   0,  76,   0,  +      0,   0,   0,   0,   0,   0,  +     92,   0,   0,   0,   3,   0,  +      1,   0,   1,   0,   6,   0,  +     96,   0,   0,   0,   0,   0,  +      0,   0, 112,  97, 108, 101,  +    116, 116, 101,   0,   4,   0,  +     12,   0,   1,   0,   1,   0,  +      1,   0,   0,   0,   0,   0,  +      0,   0, 116, 101, 120,   0,  +      4,   0,  12,   0,   1,   0,  +      1,   0,   1,   0,   0,   0,  +      0,   0,   0,   0, 112, 115,  +     95,  50,  95,  48,   0,  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,  +     81,   0,   0,   5,   0,   0,  +     15, 160,   0,   0, 127,  67,  +      0,   0,   0,  63,   0,   0,  +    128,  59,   0,   0,   0,   0,  +     31,   0,   0,   2,   0,   0,  +      0, 128,   0,   0,   3, 176,  +     31,   0,   0,   2,   0,   0,  +      0, 144,   0,   8,  15, 160,  +     31,   0,   0,   2,   0,   0,  +      0, 144,   1,   8,  15, 160,  +     66,   0,   0,   3,   0,   0,  +     15, 128,   0,   0, 228, 176,  +      1,   8, 228, 160,   4,   0,  +      0,   4,   0,   0,   1, 128,  +      0,   0,   0, 128,   0,   0,  +      0, 160,   0,   0,  85, 160,  +      5,   0,   0,   3,   0,   0,  +      3, 128,   0,   0,   0, 128,  +      0,   0, 170, 160,  66,   0,  +      0,   3,   0,   0,  15, 128,  +      0,   0, 228, 128,   0,   8,  +    228, 160,   1,   0,   0,   2,  +      0,   8,  15, 128,   0,   0,  +    228, 128, 255, 255,   0,   0 +}; + diff --git a/pacc/hlsl/fill.ps.hlsl b/pacc/hlsl/fill.ps.hlsl new file mode 100644 index 0000000..9939553 --- /dev/null +++ b/pacc/hlsl/fill.ps.hlsl @@ -0,0 +1,15 @@ +struct psinput { +  float4 texcoord: TEXCOORD; +}; + +struct psoutput { +  float4 fragcolor: COLOR; +}; + +sampler palette: register(s0); + +psoutput fill(psinput input) { +  psoutput output; +  output.fragcolor = tex1D(palette, input.texcoord.x); +  return output; +} diff --git a/pacc/hlsl/fill.ps.inc b/pacc/hlsl/fill.ps.inc new file mode 100644 index 0000000..3fcc075 --- /dev/null +++ b/pacc/hlsl/fill.ps.inc @@ -0,0 +1,65 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +//   fxc /nologo /O3 /Tps_2_0 /Efill /Fh fill.ps.inc.tmp fill.ps.hlsl +// +// +// Parameters: +// +//   sampler2D palette; +// +// +// Registers: +// +//   Name         Reg   Size +//   ------------ ----- ---- +//   palette      s0       1 +// + +    ps_2_0 +    dcl t0.xy +    dcl_2d s0 +    texld r0, t0, s0 +    mov oC0, r0 + +// approximately 2 instruction slots used (1 texture, 1 arithmetic) +#endif + +static const BYTE ps20_fill[] = +{ +      0,   2, 255, 255, 254, 255,  +     33,   0,  67,  84,  65,  66,  +     28,   0,   0,   0,  79,   0,  +      0,   0,   0,   2, 255, 255,  +      1,   0,   0,   0,  28,   0,  +      0,   0,   0, 129,   0,   0,  +     72,   0,   0,   0,  48,   0,  +      0,   0,   3,   0,   0,   0,  +      1,   0,   2,   0,  56,   0,  +      0,   0,   0,   0,   0,   0,  +    112,  97, 108, 101, 116, 116,  +    101,   0,   4,   0,  12,   0,  +      1,   0,   1,   0,   1,   0,  +      0,   0,   0,   0,   0,   0,  +    112, 115,  95,  50,  95,  48,  +      0,  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,  31,   0,   0,   2,  +      0,   0,   0, 128,   0,   0,  +      3, 176,  31,   0,   0,   2,  +      0,   0,   0, 144,   0,   8,  +     15, 160,  66,   0,   0,   3,  +      0,   0,  15, 128,   0,   0,  +    228, 176,   0,   8, 228, 160,  +      1,   0,   0,   2,   0,   8,  +     15, 128,   0,   0, 228, 128,  +    255, 255,   0,   0 +}; + diff --git a/pacc/hlsl/font.ps.hlsl b/pacc/hlsl/font.ps.hlsl new file mode 100644 index 0000000..406da2e --- /dev/null +++ b/pacc/hlsl/font.ps.hlsl @@ -0,0 +1,24 @@ +struct psinput { +  float4 texcoord: TEXCOORD; +}; + +struct psoutput { +  float4 fragcolor: COLOR; +}; + +sampler palette: register(s0); +sampler tex: register(s1); +float bg: register(c0); +float color: register(c1); + +psoutput font(psinput input) { +  psoutput output; +  float pixel = tex2D(tex, input.texcoord.xy).r; +  float index = color; +  if (pixel < 0.5) { +    if (bg < 0.5) discard; +    index = 0.5 / 256.0; +  } +  output.fragcolor = tex1D(palette, index); +  return output; +} diff --git a/pacc/hlsl/font.ps.inc b/pacc/hlsl/font.ps.inc new file mode 100644 index 0000000..2167cf7 --- /dev/null +++ b/pacc/hlsl/font.ps.inc @@ -0,0 +1,126 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +//   fxc /nologo /O3 /Tps_2_0 /Efont /Fh font.ps.inc.tmp font.ps.hlsl +// +// +// Parameters: +// +//   float bg; +//   float color; +//   sampler2D palette; +//   sampler2D tex; +// +// +// Registers: +// +//   Name         Reg   Size +//   ------------ ----- ---- +//   bg           c0       1 +//   color        c1       1 +//   palette      s0       1 +//   tex          s1       1 +// + +    ps_2_0 +    def c2, -0.5, -0, -1, 0.001953125 +    dcl t0.xy +    dcl_2d s0 +    dcl_2d s1 +    texld r0, t0, s1 +    add r0.x, r0.x, c2.x +    mov r1.xw, c2 +    add r0.y, r1.x, c0.x +    cmp r0.y, r0.y, c2.y, c2.z +    cmp r2, r0.x, c2.y, r0.y +    texkill r2 +    cmp r0.xy, r0.x, c1.x, r1.w +    texld r0, r0, s0 +    mov oC0, r0 + +// approximately 10 instruction slots used (2 texture, 8 arithmetic) +#endif + +static const BYTE ps20_font[] = +{ +      0,   2, 255, 255, 254, 255,  +     60,   0,  67,  84,  65,  66,  +     28,   0,   0,   0, 187,   0,  +      0,   0,   0,   2, 255, 255,  +      4,   0,   0,   0,  28,   0,  +      0,   0,   0, 129,   0,   0,  +    180,   0,   0,   0, 108,   0,  +      0,   0,   2,   0,   0,   0,  +      1,   0,   2,   0, 112,   0,  +      0,   0,   0,   0,   0,   0,  +    128,   0,   0,   0,   2,   0,  +      1,   0,   1,   0,   6,   0,  +    112,   0,   0,   0,   0,   0,  +      0,   0, 134,   0,   0,   0,  +      3,   0,   0,   0,   1,   0,  +      2,   0, 144,   0,   0,   0,  +      0,   0,   0,   0, 160,   0,  +      0,   0,   3,   0,   1,   0,  +      1,   0,   6,   0, 164,   0,  +      0,   0,   0,   0,   0,   0,  +     98, 103,   0, 171,   0,   0,  +      3,   0,   1,   0,   1,   0,  +      1,   0,   0,   0,   0,   0,  +      0,   0,  99, 111, 108, 111,  +    114,   0, 112,  97, 108, 101,  +    116, 116, 101,   0, 171, 171,  +      4,   0,  12,   0,   1,   0,  +      1,   0,   1,   0,   0,   0,  +      0,   0,   0,   0, 116, 101,  +    120,   0,   4,   0,  12,   0,  +      1,   0,   1,   0,   1,   0,  +      0,   0,   0,   0,   0,   0,  +    112, 115,  95,  50,  95,  48,  +      0,  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,  81,   0,   0,   5,  +      2,   0,  15, 160,   0,   0,  +      0, 191,   0,   0,   0, 128,  +      0,   0, 128, 191,   0,   0,  +      0,  59,  31,   0,   0,   2,  +      0,   0,   0, 128,   0,   0,  +      3, 176,  31,   0,   0,   2,  +      0,   0,   0, 144,   0,   8,  +     15, 160,  31,   0,   0,   2,  +      0,   0,   0, 144,   1,   8,  +     15, 160,  66,   0,   0,   3,  +      0,   0,  15, 128,   0,   0,  +    228, 176,   1,   8, 228, 160,  +      2,   0,   0,   3,   0,   0,  +      1, 128,   0,   0,   0, 128,  +      2,   0,   0, 160,   1,   0,  +      0,   2,   1,   0,   9, 128,  +      2,   0, 228, 160,   2,   0,  +      0,   3,   0,   0,   2, 128,  +      1,   0,   0, 128,   0,   0,  +      0, 160,  88,   0,   0,   4,  +      0,   0,   2, 128,   0,   0,  +     85, 128,   2,   0,  85, 160,  +      2,   0, 170, 160,  88,   0,  +      0,   4,   2,   0,  15, 128,  +      0,   0,   0, 128,   2,   0,  +     85, 160,   0,   0,  85, 128,  +     65,   0,   0,   1,   2,   0,  +     15, 128,  88,   0,   0,   4,  +      0,   0,   3, 128,   0,   0,  +      0, 128,   1,   0,   0, 160,  +      1,   0, 255, 128,  66,   0,  +      0,   3,   0,   0,  15, 128,  +      0,   0, 228, 128,   0,   8,  +    228, 160,   1,   0,   0,   2,  +      0,   8,  15, 128,   0,   0,  +    228, 128, 255, 255,   0,   0 +}; + diff --git a/pacc/hlsl/key.ps.hlsl b/pacc/hlsl/key.ps.hlsl new file mode 100644 index 0000000..0ca9efd --- /dev/null +++ b/pacc/hlsl/key.ps.hlsl @@ -0,0 +1,20 @@ +struct psinput { +  float4 texcoord: TEXCOORD; +}; + +struct psoutput { +  float4 fragcolor: COLOR; +}; + +sampler palette: register(s0); +sampler tex: register(s1); +float uni_key: register(c0); +float color: register(c1); + +psoutput key(psinput input) { +  psoutput output; +  float index = tex2D(tex, input.texcoord.xy).r; +  if (index < (uni_key + (0.5/255.0)) || (uni_key + (1.5/255.0)) < index) discard; +  output.fragcolor = tex1D(palette, color); +  return output; +} diff --git a/pacc/hlsl/key.ps.inc b/pacc/hlsl/key.ps.inc new file mode 100644 index 0000000..63d51d8 --- /dev/null +++ b/pacc/hlsl/key.ps.inc @@ -0,0 +1,141 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +//   fxc /nologo /O3 /Tps_2_0 /Ekey /Fh key.ps.inc.tmp key.ps.hlsl +// +// +// Parameters: +// +//   float color; +//   sampler2D palette; +//   sampler2D tex; +//   float uni_key; +// +// +// Registers: +// +//   Name         Reg   Size +//   ------------ ----- ---- +//   uni_key      c0       1 +//   color        c1       1 +//   palette      s0       1 +//   tex          s1       1 +// + +    ps_2_0 +    def c2, 0.00196078443, 0, 1, 0.00588235306 +    dcl t0.xy +    dcl_2d s0 +    dcl_2d s1 +    texld r0, t0, s1 +    mov r1.xw, c2 +    add r0.y, r1.w, c0.x +    add r0.y, -r0.x, r0.y +    cmp r0.y, r0.y, c2.y, c2.z +    add r0.z, r1.x, c0.x +    add r0.x, -r0.z, r0.x +    cmp r0.x, r0.x, c2.y, c2.z +    add r0.x, r0.y, r0.x +    cmp r0, -r0.x, -c2.y, -c2.z +    texkill r0 +    mov r0.xy, c1.x +    texld r0, r0, s0 +    mov oC0, r0 + +// approximately 14 instruction slots used (2 texture, 12 arithmetic) +#endif + +static const BYTE ps20_key[] = +{ +      0,   2, 255, 255, 254, 255,  +     61,   0,  67,  84,  65,  66,  +     28,   0,   0,   0, 191,   0,  +      0,   0,   0,   2, 255, 255,  +      4,   0,   0,   0,  28,   0,  +      0,   0,   0, 129,   0,   0,  +    184,   0,   0,   0, 108,   0,  +      0,   0,   2,   0,   1,   0,  +      1,   0,   6,   0, 116,   0,  +      0,   0,   0,   0,   0,   0,  +    132,   0,   0,   0,   3,   0,  +      0,   0,   1,   0,   2,   0,  +    140,   0,   0,   0,   0,   0,  +      0,   0, 156,   0,   0,   0,  +      3,   0,   1,   0,   1,   0,  +      6,   0, 160,   0,   0,   0,  +      0,   0,   0,   0, 176,   0,  +      0,   0,   2,   0,   0,   0,  +      1,   0,   2,   0, 116,   0,  +      0,   0,   0,   0,   0,   0,  +     99, 111, 108, 111, 114,   0,  +    171, 171,   0,   0,   3,   0,  +      1,   0,   1,   0,   1,   0,  +      0,   0,   0,   0,   0,   0,  +    112,  97, 108, 101, 116, 116,  +    101,   0,   4,   0,  12,   0,  +      1,   0,   1,   0,   1,   0,  +      0,   0,   0,   0,   0,   0,  +    116, 101, 120,   0,   4,   0,  +     12,   0,   1,   0,   1,   0,  +      1,   0,   0,   0,   0,   0,  +      0,   0, 117, 110, 105,  95,  +    107, 101, 121,   0, 112, 115,  +     95,  50,  95,  48,   0,  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,  +     81,   0,   0,   5,   2,   0,  +     15, 160, 129, 128,   0,  59,  +      0,   0,   0,   0,   0,   0,  +    128,  63, 193, 192, 192,  59,  +     31,   0,   0,   2,   0,   0,  +      0, 128,   0,   0,   3, 176,  +     31,   0,   0,   2,   0,   0,  +      0, 144,   0,   8,  15, 160,  +     31,   0,   0,   2,   0,   0,  +      0, 144,   1,   8,  15, 160,  +     66,   0,   0,   3,   0,   0,  +     15, 128,   0,   0, 228, 176,  +      1,   8, 228, 160,   1,   0,  +      0,   2,   1,   0,   9, 128,  +      2,   0, 228, 160,   2,   0,  +      0,   3,   0,   0,   2, 128,  +      1,   0, 255, 128,   0,   0,  +      0, 160,   2,   0,   0,   3,  +      0,   0,   2, 128,   0,   0,  +      0, 129,   0,   0,  85, 128,  +     88,   0,   0,   4,   0,   0,  +      2, 128,   0,   0,  85, 128,  +      2,   0,  85, 160,   2,   0,  +    170, 160,   2,   0,   0,   3,  +      0,   0,   4, 128,   1,   0,  +      0, 128,   0,   0,   0, 160,  +      2,   0,   0,   3,   0,   0,  +      1, 128,   0,   0, 170, 129,  +      0,   0,   0, 128,  88,   0,  +      0,   4,   0,   0,   1, 128,  +      0,   0,   0, 128,   2,   0,  +     85, 160,   2,   0, 170, 160,  +      2,   0,   0,   3,   0,   0,  +      1, 128,   0,   0,  85, 128,  +      0,   0,   0, 128,  88,   0,  +      0,   4,   0,   0,  15, 128,  +      0,   0,   0, 129,   2,   0,  +     85, 161,   2,   0, 170, 161,  +     65,   0,   0,   1,   0,   0,  +     15, 128,   1,   0,   0,   2,  +      0,   0,   3, 128,   1,   0,  +      0, 160,  66,   0,   0,   3,  +      0,   0,  15, 128,   0,   0,  +    228, 128,   0,   8, 228, 160,  +      1,   0,   0,   2,   0,   8,  +     15, 128,   0,   0, 228, 128,  +    255, 255,   0,   0 +}; + | 
