diff --git a/bgfx/chains/default.json b/bgfx/chains/default.json index 115e7072cb3..b25388c3735 100644 --- a/bgfx/chains/default.json +++ b/bgfx/chains/default.json @@ -7,7 +7,7 @@ } ], "passes": [ - { "effect": "default/blit", + { "effect": "misc/blit", "name": "Final Upscale", "input": [ { "sampler": "s_tex", "texture": "screen" } diff --git a/bgfx/chains/hlsl.json b/bgfx/chains/hlsl.json index 2b730966a47..41be4613087 100644 --- a/bgfx/chains/hlsl.json +++ b/bgfx/chains/hlsl.json @@ -14,6 +14,9 @@ // type: string "author": "Ryan Holtz & ImJezze", + // transform (optional): This value determines whether the screen container is transformed the chain's shaders, otherwise the core renderer will handle the transformation (scale, offset). + "transform": true, + // sliders (optional): The list of sliders used by all of the entries in this chain. Can be omitted if no entries use any sliders. "sliders": [ // type (required): The sliders's conceptual type. Is it a list of string selections? Is it a single floating-point value? Does it require RGB values, or XY values? @@ -315,7 +318,7 @@ ], "output": "guest" }, - { "effect": "hlsl/blit", + { "effect": "misc/blit", "name": "NTSC Skip", "disablewhen": [ { "type": "slider", "condition": "notequal", "combine": "and", "name": "adjustments", "value": 0 }, @@ -496,7 +499,7 @@ ], "output": "internal" }, - { "effect": "hlsl/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "internal" } diff --git a/bgfx/chains/hq2x.json b/bgfx/chains/hq2x.json index 20303a64c90..19eb14d6113 100644 --- a/bgfx/chains/hq2x.json +++ b/bgfx/chains/hq2x.json @@ -49,7 +49,7 @@ ], "output": "scaled_out" }, - { "effect": "hq2x/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "scaled_out" } diff --git a/bgfx/chains/hq3x.json b/bgfx/chains/hq3x.json index 1f767b68825..6e1f031d705 100644 --- a/bgfx/chains/hq3x.json +++ b/bgfx/chains/hq3x.json @@ -49,7 +49,7 @@ ], "output": "scaled_out" }, - { "effect": "hq3x/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "scaled_out" } diff --git a/bgfx/chains/hq4x.json b/bgfx/chains/hq4x.json index 9232966ecc4..78548abfca7 100644 --- a/bgfx/chains/hq4x.json +++ b/bgfx/chains/hq4x.json @@ -49,7 +49,7 @@ ], "output": "scaled_out" }, - { "effect": "hq4x/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "scaled_out" } diff --git a/bgfx/chains/pillarbox_left_horizontal.json b/bgfx/chains/pillarbox_left_horizontal.json index 1959fa30943..8a81352d734 100644 --- a/bgfx/chains/pillarbox_left_horizontal.json +++ b/bgfx/chains/pillarbox_left_horizontal.json @@ -31,7 +31,7 @@ ], "passes": [ - { "effect": "pillarbox_left_horizontal/blit", + { "effect": "misc/blit", "name": "Blit to scalable target", "input": [ { "sampler": "s_tex", "target": "screen" } @@ -79,7 +79,7 @@ "output": "internal" }, { - "effect": "pillarbox_left_horizontal/saturation", + "effect": "misc/saturation", "name": "Saturation Pass", "disablewhen": [ { "type": "slider", "condition": "equal", "name": "saturation", "value": 100 } @@ -92,7 +92,7 @@ ], "output": "internal" }, - { "effect": "pillarbox_left_horizontal/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "internal" } diff --git a/bgfx/chains/pillarbox_left_vertical.json b/bgfx/chains/pillarbox_left_vertical.json index 976a84476b8..64c31108f03 100644 --- a/bgfx/chains/pillarbox_left_vertical.json +++ b/bgfx/chains/pillarbox_left_vertical.json @@ -31,7 +31,7 @@ ], "passes": [ - { "effect": "pillarbox_left_vertical/blit", + { "effect": "misc/blit", "name": "Blit to scalable target", "input": [ { "sampler": "s_tex", "target": "screen" } @@ -79,7 +79,7 @@ "output": "internal" }, { - "effect": "pillarbox_left_vertical/saturation", + "effect": "misc/saturation", "name": "Saturation Pass", "disablewhen": [ { "type": "slider", "condition": "equal", "name": "saturation", "value": 100 } @@ -92,7 +92,7 @@ ], "output": "internal" }, - { "effect": "pillarbox_left_vertical/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "internal" } diff --git a/bgfx/chains/pillarbox_right_horizontal.json b/bgfx/chains/pillarbox_right_horizontal.json index a687510049e..0b7c8c5287b 100644 --- a/bgfx/chains/pillarbox_right_horizontal.json +++ b/bgfx/chains/pillarbox_right_horizontal.json @@ -31,7 +31,7 @@ ], "passes": [ - { "effect": "pillarbox_right_horizontal/blit", + { "effect": "misc/blit", "name": "Blit to scalable target", "input": [ { "sampler": "s_tex", "target": "screen" } @@ -79,7 +79,7 @@ "output": "internal" }, { - "effect": "pillarbox_right_horizontal/saturation", + "effect": "misc/saturation", "name": "Saturation Pass", "disablewhen": [ { "type": "slider", "condition": "equal", "name": "saturation", "value": 100 } @@ -92,7 +92,7 @@ ], "output": "internal" }, - { "effect": "pillarbox_right_horizontal/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "internal" } diff --git a/bgfx/chains/pillarbox_right_vertical.json b/bgfx/chains/pillarbox_right_vertical.json index 16dcb8b8c4b..088d21081ab 100644 --- a/bgfx/chains/pillarbox_right_vertical.json +++ b/bgfx/chains/pillarbox_right_vertical.json @@ -31,7 +31,7 @@ ], "passes": [ - { "effect": "pillarbox_right_vertical/blit", + { "effect": "misc/blit", "name": "Blit to scalable target", "input": [ { "sampler": "s_tex", "target": "screen" } @@ -79,7 +79,7 @@ "output": "internal" }, { - "effect": "pillarbox_right_vertical/saturation", + "effect": "misc/saturation", "name": "Saturation Pass", "disablewhen": [ { "type": "slider", "condition": "equal", "name": "saturation", "value": 100 } @@ -92,7 +92,7 @@ ], "output": "internal" }, - { "effect": "pillarbox_right_vertical/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "internal" } diff --git a/bgfx/chains/super-2xbr-3d-2p.json b/bgfx/chains/super-2xbr-3d-2p.json new file mode 100644 index 00000000000..a196141548d --- /dev/null +++ b/bgfx/chains/super-2xbr-3d-2p.json @@ -0,0 +1,69 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super XBR 3D (2 passes)", + "author": "Hyllian", + "targets": [ + { + "name": "guest", + "mode": "guest", + "scale": 1, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-2xbr-3d-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-2xbr-3d-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "guest" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "guest" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-2xbr-3d-3p-smoother.json b/bgfx/chains/super-2xbr-3d-3p-smoother.json new file mode 100644 index 00000000000..d3e3d33d7c4 --- /dev/null +++ b/bgfx/chains/super-2xbr-3d-3p-smoother.json @@ -0,0 +1,78 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super XBR 3D (3 passes, smoother)", + "author": "Hyllian", + "targets": [ + { + "name": "guest", + "mode": "guest", + "scale": 1, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-2xbr-3d-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-2xbr-3d-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "guest" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-2xbr-3d-pass2", + "name": "Pass 2", + "input": [ + { "sampler": "s0", "target": "guest" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "guest" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-4xbr-3d-4p.json b/bgfx/chains/super-4xbr-3d-4p.json new file mode 100644 index 00000000000..046897b62d5 --- /dev/null +++ b/bgfx/chains/super-4xbr-3d-4p.json @@ -0,0 +1,86 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super 4XBR 3D (4 passes)", + "author": "Hyllian", + "targets": [ + { + "name": "guest", + "mode": "guest", + "scale": 1, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-4xbr-3d-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-4xbr-3d-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "guest" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-4xbr-3d-pass2", + "name": "Pass 2", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-4xbr-3d-pass3", + "name": "Pass 3", + "input": [ + { "sampler": "s0", "target": "guest" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "guest" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-4xbr-3d-6p-smoother.json b/bgfx/chains/super-4xbr-3d-6p-smoother.json new file mode 100644 index 00000000000..f3bd617258f --- /dev/null +++ b/bgfx/chains/super-4xbr-3d-6p-smoother.json @@ -0,0 +1,86 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super 4XBR 3D (3 passes, smoother)", + "author": "Hyllian", + "targets": [ + { + "name": "guest", + "mode": "guest", + "scale": 1, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-4xbr-3d-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-4xbr-3d-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "guest" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-4xbr-3d-pass2", + "name": "Pass 2", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/super-4xbr-3d-pass3", + "name": "Pass 3", + "input": [ + { "sampler": "s0", "target": "guest" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "guest" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "guest" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-xbr-2p.json b/bgfx/chains/super-xbr-2p.json new file mode 100644 index 00000000000..cdb8c3f84a5 --- /dev/null +++ b/bgfx/chains/super-xbr-2p.json @@ -0,0 +1,76 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super XBR (2 passes)", + "author": "Hyllian", + "targets": [ + { + "name": "pass0", + "mode": "guest", + "scale": 1, + "bilinear": false, + "doublebuffer": true + }, + { + "name": "pass1", + "mode": "guest", + "scale": 2, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-xbr-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "pass0" + }, + { + "effect": "xbr/super-xbr/super-xbr-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "pass0" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "pass1" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "pass1" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-xbr-3p-smoother.json b/bgfx/chains/super-xbr-3p-smoother.json new file mode 100644 index 00000000000..96bda7904b6 --- /dev/null +++ b/bgfx/chains/super-xbr-3p-smoother.json @@ -0,0 +1,84 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super XBR (3 passes, smoother)", + "author": "Hyllian", + "targets": [ + { + "name": "pass02", + "mode": "guest", + "scale": 1, + "bilinear": false, + "doublebuffer": true + }, + { + "name": "pass1", + "mode": "guest", + "scale": 2, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-xbr-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "pass02" + }, + { + "effect": "xbr/super-xbr/super-xbr-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "pass02" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "pass1" + }, + { + "effect": "xbr/super-xbr/super-xbr-pass2", + "name": "Pass 2", + "input": [ + { "sampler": "s0", "target": "pass1" } + ], + "output": "pass1" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "pass1" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-xbr-6p.json b/bgfx/chains/super-xbr-6p.json new file mode 100644 index 00000000000..4f5c69369d7 --- /dev/null +++ b/bgfx/chains/super-xbr-6p.json @@ -0,0 +1,123 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super XBR (6 passes)", + "author": "Hyllian", + "targets": [ + { + "name": "group0_pass02", + "mode": "guest", + "scale": 1, + "bilinear": false, + "doublebuffer": true + }, + { + "name": "group0_pass1", + "mode": "guest", + "scale": 2, + "bilinear": false, + "doublebuffer": true + }, + { + "name": "group1_pass02", + "mode": "guest", + "scale": 2, + "bilinear": false, + "doublebuffer": true + }, + { + "name": "group1_pass1", + "mode": "guest", + "scale": 4, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-xbr-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "group0_pass02" + }, + { + "effect": "xbr/super-xbr/super-xbr-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "group0_pass02" }, + { "sampler": "ORIG_texture", "texture": "screen" } + ], + "output": "group0_pass1" + }, + { + "effect": "xbr/super-xbr/super-xbr-pass2", + "name": "Pass 2", + "input": [ + { "sampler": "s0", "target": "group0_pass1" } + ], + "output": "group0_pass1" + }, + { + "effect": "xbr/super-xbr/super-xbr-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "target": "group0_pass1" } + ], + "output": "group1_pass02" + }, + { + "effect": "xbr/super-xbr/super-xbr-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "group1_pass02" }, + { "sampler": "ORIG_texture", "target": "group0_pass1" } + ], + "output": "group1_pass1" + }, + { + "effect": "xbr/super-xbr/super-xbr-pass2", + "name": "Pass 2", + "input": [ + { "sampler": "s0", "target": "group1_pass1" } + ], + "output": "group1_pass1" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "group1_pass1" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-xbr-deposterize.json b/bgfx/chains/super-xbr-deposterize.json new file mode 100644 index 00000000000..8eac3770465 --- /dev/null +++ b/bgfx/chains/super-xbr-deposterize.json @@ -0,0 +1,98 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super XBR (deposterize)", + "author": "Hyllian", + "targets": [ + { + "name": "deposterize", + "mode": "guest", + "bilinear": false, + "doublebuffer": true + }, + { + "name": "pass012", + "mode": "guest", + "scale": 2, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "misc/deposterize-pass0", + "name": "Deposterize, Pass 0", + "input": [ + { "sampler": "decal", "texture": "screen" } + ], + "output": "deposterize" + }, + { + "effect": "misc/deposterize-pass1", + "name": "Deposterize, Pass 1", + "input": [ + { "sampler": "decal", "target": "deposterize" } + ], + "output": "deposterize" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "target": "deposterize" } + ], + "output": "pass012" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "pass012" } + ], + "output": "pass012" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass2", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "pass012" } + ], + "output": "pass012" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "pass012" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-xbr-fast-3p.json b/bgfx/chains/super-xbr-fast-3p.json new file mode 100644 index 00000000000..f0d0411acc0 --- /dev/null +++ b/bgfx/chains/super-xbr-fast-3p.json @@ -0,0 +1,76 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super XBR (3 passes, faster)", + "author": "Hyllian", + "targets": [ + { + "name": "all_passes", + "mode": "guest", + "scale": 2, + "bilinear": false, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-xbr-fast-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "all_passes" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "all_passes" } + ], + "output": "all_passes" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass2", + "name": "Pass 5", + "input": [ + { "sampler": "s0", "target": "all_passes" } + ], + "output": "all_passes" + }, + { + "effect": "xbr/super-xbr/custom-jinc2-sharper", + "name": "Jinc2 Upscaler", + "input": [ + { "sampler": "s_p", "target": "all_passes" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/super-xbr-fast-6p.json b/bgfx/chains/super-xbr-fast-6p.json new file mode 100644 index 00000000000..6d19e28f9b2 --- /dev/null +++ b/bgfx/chains/super-xbr-fast-6p.json @@ -0,0 +1,113 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "name": "Super XBR (6 passes, faster)", + "author": "Hyllian", + "targets": [ + { + "name": "group0_pass012", + "mode": "guest", + "scale": 2, + "bilinear": false, + "doublebuffer": true + }, + { + "name": "group1_pass012", + "mode": "guest", + "scale": 2, + "bilinear": false, + "doublebuffer": true + }, + { + "name": "to_blit", + "mode": "guest", + "scale": 4, + "doublebuffer": true + } + ], + "passes": [ + { + "effect": "xbr/super-xbr/super-xbr-fast-pass0", + "name": "Pass 0", + "input": [ + { "sampler": "s0", "texture": "screen" } + ], + "output": "group0_pass012" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass1", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "group0_pass012" } + ], + "output": "group0_pass012" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass2", + "name": "Pass 1", + "input": [ + { "sampler": "s0", "target": "group0_pass012" } + ], + "output": "group0_pass012" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass0", + "name": "Pass 3", + "input": [ + { "sampler": "s0", "target": "group0_pass012" } + ], + "output": "group1_pass012" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass1", + "name": "Pass 4", + "input": [ + { "sampler": "s0", "target": "group1_pass012" } + ], + "output": "group1_pass012" + }, + { + "effect": "xbr/super-xbr/super-xbr-fast-pass2", + "name": "Pass 5", + "input": [ + { "sampler": "s0", "target": "group1_pass012" } + ], + "output": "to_blit" + }, + { + "effect": "misc/blit", + "name": "Upscaling Blit", + "input": [ + { "sampler": "s_tex", "target": "to_blit" } + ], + "output": "output" + } + ] +} \ No newline at end of file diff --git a/bgfx/chains/supereagle.json b/bgfx/chains/supereagle.json index 0f12a85e095..cf3294e8a36 100644 --- a/bgfx/chains/supereagle.json +++ b/bgfx/chains/supereagle.json @@ -33,7 +33,7 @@ ], "output": "scaled_out" }, - { "effect": "hq2x/blit", + { "effect": "misc/blit", "name": "Final Blit", "input": [ { "sampler": "s_tex", "target": "scaled_out" } diff --git a/bgfx/chains/unfiltered.json b/bgfx/chains/unfiltered.json index a644f9af370..e8983f6dd5c 100644 --- a/bgfx/chains/unfiltered.json +++ b/bgfx/chains/unfiltered.json @@ -7,14 +7,14 @@ } ], "passes": [ - { "effect": "unfiltered/blit", + { "effect": "misc/blit", "name": "Copy To Unstretched Texture", "input": [ { "sampler": "s_tex", "texture": "screen" } ], "output": "temp" }, - { "effect": "unfiltered/blit", + { "effect": "misc/blit", "name": "Final Upscale", "input": [ { "sampler": "s_tex", "target": "temp" } diff --git a/bgfx/effects/hlsl/distortion.json b/bgfx/effects/hlsl/distortion.json index 14a7b79891a..c459d70a6c3 100644 --- a/bgfx/effects/hlsl/distortion.json +++ b/bgfx/effects/hlsl/distortion.json @@ -8,34 +8,34 @@ //============================================================ { "blend": { - "equation": "add", - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" + "equation": "add", + "srcColor": "srcalpha", + "dstColor": "1-srcalpha", + "srcAlpha": "srcalpha", + "dstAlpha": "1-srcalpha" }, "depth": { - "function": "always" + "function": "always" }, "cull": { "mode": "none" }, "write": { - "rgb": true, - "alpha": true + "rgb": true, + "alpha": true }, "vertex": "chains/hlsl/vs_distortion", "fragment": "chains/hlsl/fs_distortion", "uniforms": [ - { "name": "s_tex", "type": "int", "values": [ 0.0 ] }, - { "name": "u_swap_xy", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_screen_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, + { "name": "s_tex", "type": "int", "values": [ 0.0 ] }, + { "name": "u_swap_xy", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_screen_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, { "name": "u_target_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, - { "name": "u_quad_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, + { "name": "u_quad_dims", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] }, { "name": "u_distortion", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, { "name": "u_cubic_distortion", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, - { "name": "u_distort_corner", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, - { "name": "u_round_corner", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, - { "name": "u_smooth_border", "type": "vec4", "values": [ 0.05, 0.0, 0.0, 0.0 ] }, - { "name": "u_vignetting", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, - { "name": "u_reflection", "type": "vec4", "values": [ 0.30, 0.0, 0.0, 0.0 ] } + { "name": "u_distort_corner", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, + { "name": "u_round_corner", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, + { "name": "u_smooth_border", "type": "vec4", "values": [ 0.05, 0.0, 0.0, 0.0 ] }, + { "name": "u_vignetting", "type": "vec4", "values": [ 0.20, 0.0, 0.0, 0.0 ] }, + { "name": "u_reflection", "type": "vec4", "values": [ 0.30, 0.0, 0.0, 0.0 ] } ] } \ No newline at end of file diff --git a/bgfx/effects/hlsl/post.json b/bgfx/effects/hlsl/post.json index 16ebbe01c9f..a30e921e4c2 100644 --- a/bgfx/effects/hlsl/post.json +++ b/bgfx/effects/hlsl/post.json @@ -28,7 +28,7 @@ { "name": "s_tex", "type": "int", "values": [ 0.0 ] }, { "name": "s_shadow", "type": "int", "values": [ 1.0 ] }, { "name": "u_swap_xy", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, - { "name": "u_source_dims", "type": "vec4", "values": [ 256.0, 256.0, 0.0, 0.0 ] }, + { "name": "u_source_dims", "type": "vec4", "values": [ 256.0, 256.0, 0.0, 0.0 ] }, { "name": "u_quad_dims", "type": "vec4", "values": [ 256.0, 256.0, 0.0, 0.0 ] }, { "name": "u_humbar_hertz_rate", "type": "vec4", "values": [ 0.001, 0.0, 0.0, 0.0 ] }, { "name": "u_humbar_alpha", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, diff --git a/bgfx/effects/hq3x/blit.json b/bgfx/effects/hq3x/blit.json deleted file mode 100644 index a3c21b9cf67..00000000000 --- a/bgfx/effects/hq3x/blit.json +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// blit.json: A simple texture-to-target copy. -// -//============================================================ -{ - // blend (required): The blend state for this effect. - "blend": { - // equation (optional): What equation to perform on the source and destination blend values. - // values: "add", "sub", "revSub", "min", "max" - // default: "add" - // - // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" - "equation": "add", - - // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. - // values: "0", "1", "srccolor", "1-srccolor", "dstcolor", "1-dstcolor", "srcalpha", "1-srcalpha", "dstalpha", "1-dstalpha" - // defaults (srcColor, srcAlpha): "1" - // defaults (dstColor, dstAlpha): "0" - // - // "zero", "one", "invsrccolor", "invdstcolor", "invsrcalpha", and "invdstalpha" are provided as aliases for "0", "1", "1-srccolor", "1-dstcolor", "1-srcalpha", and "1-dstalpha" - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - - // depth (required): The depth state for this effect. - "depth": { - // function (optional): The depth function to use when drawing. - // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" - // default: "always" - "function": "always", - - // writeenable (optional): Whether to store Z-buffer data. - // values: true, false - // default: false - "writeenable": false - }, - - // cull (required): The cull mode for this effect. - "cull": { - // mode (optional): What winding, if any, to cull. - // values: "none", "cw", "ccw" - // default: "ccw" - // - // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" - "mode": "none" - }, - - // write (required): Write enable for color and alpha channels. - "write": { - // rgb (optional): Whether to store color data when drawing. - // values: true, false - // default: false - "rgb": true, - - // alpha (optional): Whether to store alpha data when drawing. - // values: true, false - // default: false - "alpha": true - }, - - // vertex (required): The vertex shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "vertex": "chains/hq3x/vs_blit", - - // pixel/fragment (required): The pixel or fragment shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "fragment": "chains/hq3x/fs_blit", - - // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. - "uniforms": [ - { - // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. - // value: A string containing the name of the uniform as described above. - // - // NOTE: Some names correspond to special values that will be automatically filled by the BGFX - // code if they are used by the shader. These names are: - // "u_screen_dims" - // The dimensions of the first texture input if present, otherwise the dimensions of the output window. - // Valid values: xy - // "u_inv_screen_dims" - // The reciprocal of u_screen_dims. - // Valid values: xy - // "u_source_dims" - // The size, in pixels, of the screen texture incoming to the chain. - // Valid values: xy - // "u_rotation_type" - // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. - // Valid values: x - // "u_swap_xy" - // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. - // Valid values: x - // "u_quad_dims" - // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. - // Valid values: xy - // "u_tex_sizeN" - // The dimensions, in pixels, of the texture in input pair N. Starts at 0. - // valid values: xy - "name": "s_tex", - - // type (required): The type of the uniform. - // values: "int", "vec4", "mat3", "mat4" - // - // Note: "int" should only be used for samplers. - "type": "int", - - // values (required): The array of numbers with which to initialize the uniform. - // value: A JSON array containin the correct amount of numbers to initialize a uniform of the - // above-specified type. The following size rules should be followed: - // "int": 1 float - // "vec4": 4 floats - // "mat3": 9 floats - // "mat4": 16 floats - "values": [ 1.0 ] - } - ] -} \ No newline at end of file diff --git a/bgfx/effects/hq4x/blit.json b/bgfx/effects/hq4x/blit.json deleted file mode 100644 index ddaab93e2ea..00000000000 --- a/bgfx/effects/hq4x/blit.json +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// blit.json: A simple texture-to-target copy. -// -//============================================================ -{ - // blend (required): The blend state for this effect. - "blend": { - // equation (optional): What equation to perform on the source and destination blend values. - // values: "add", "sub", "revSub", "min", "max" - // default: "add" - // - // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" - "equation": "add", - - // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. - // values: "0", "1", "srccolor", "1-srccolor", "dstcolor", "1-dstcolor", "srcalpha", "1-srcalpha", "dstalpha", "1-dstalpha" - // defaults (srcColor, srcAlpha): "1" - // defaults (dstColor, dstAlpha): "0" - // - // "zero", "one", "invsrccolor", "invdstcolor", "invsrcalpha", and "invdstalpha" are provided as aliases for "0", "1", "1-srccolor", "1-dstcolor", "1-srcalpha", and "1-dstalpha" - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - - // depth (required): The depth state for this effect. - "depth": { - // function (optional): The depth function to use when drawing. - // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" - // default: "always" - "function": "always", - - // writeenable (optional): Whether to store Z-buffer data. - // values: true, false - // default: false - "writeenable": false - }, - - // cull (required): The cull mode for this effect. - "cull": { - // mode (optional): What winding, if any, to cull. - // values: "none", "cw", "ccw" - // default: "ccw" - // - // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" - "mode": "none" - }, - - // write (required): Write enable for color and alpha channels. - "write": { - // rgb (optional): Whether to store color data when drawing. - // values: true, false - // default: false - "rgb": true, - - // alpha (optional): Whether to store alpha data when drawing. - // values: true, false - // default: false - "alpha": true - }, - - // vertex (required): The vertex shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "vertex": "chains/hq4x/vs_blit", - - // pixel/fragment (required): The pixel or fragment shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "fragment": "chains/hq4x/fs_blit", - - // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. - "uniforms": [ - { - // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. - // value: A string containing the name of the uniform as described above. - // - // NOTE: Some names correspond to special values that will be automatically filled by the BGFX - // code if they are used by the shader. These names are: - // "u_screen_dims" - // The dimensions of the first texture input if present, otherwise the dimensions of the output window. - // Valid values: xy - // "u_inv_screen_dims" - // The reciprocal of u_screen_dims. - // Valid values: xy - // "u_source_dims" - // The size, in pixels, of the screen texture incoming to the chain. - // Valid values: xy - // "u_rotation_type" - // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. - // Valid values: x - // "u_swap_xy" - // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. - // Valid values: x - // "u_quad_dims" - // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. - // Valid values: xy - // "u_tex_sizeN" - // The dimensions, in pixels, of the texture in input pair N. Starts at 0. - // valid values: xy - "name": "s_tex", - - // type (required): The type of the uniform. - // values: "int", "vec4", "mat3", "mat4" - // - // Note: "int" should only be used for samplers. - "type": "int", - - // values (required): The array of numbers with which to initialize the uniform. - // value: A JSON array containin the correct amount of numbers to initialize a uniform of the - // above-specified type. The following size rules should be followed: - // "int": 1 float - // "vec4": 4 floats - // "mat3": 9 floats - // "mat4": 16 floats - "values": [ 1.0 ] - } - ] -} \ No newline at end of file diff --git a/bgfx/effects/hq2x/blit.json b/bgfx/effects/misc/blit.json similarity index 98% rename from bgfx/effects/hq2x/blit.json rename to bgfx/effects/misc/blit.json index 9ea3078b35a..3fb849a1eed 100644 --- a/bgfx/effects/hq2x/blit.json +++ b/bgfx/effects/misc/blit.json @@ -65,11 +65,11 @@ // vertex (required): The vertex shader to use when drawing. // value: A string containing the path and name of a shader file to use, minus the extension. - "vertex": "chains/hq2x/vs_blit", + "vertex": "chains/misc/vs_blit", // pixel/fragment (required): The pixel or fragment shader to use when drawing. // value: A string containing the path and name of a shader file to use, minus the extension. - "fragment": "chains/hq2x/fs_blit", + "fragment": "chains/misc/fs_blit", // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. "uniforms": [ diff --git a/bgfx/effects/misc/deposterize-pass0.json b/bgfx/effects/misc/deposterize-pass0.json new file mode 100644 index 00000000000..73fac99de3c --- /dev/null +++ b/bgfx/effects/misc/deposterize-pass0.json @@ -0,0 +1,37 @@ +// license:GPL-2.0+ +// copyright-holders:Hyllian + +/* + Hyllian's Deposterize Shader - Pass0 + + Copyright (C) 2011/2016 Hyllian/Jararaca - sergiogdb@gmail.com +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/misc/vs_deposterize-pass0", + "fragment": "chains/misc/fs_deposterize-pass0", + "uniforms": [ + { "name": "decal", "type": "int", "values": [ 1.0 ] }, + { "name": "EQ_THRESH1", "type": "vec4", "values": [ 0.01, 0.0, 0.0, 0.0 ] }, + { "name": "DIFF_THRESH1", "type": "vec4", "values": [ 0.06, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/misc/deposterize-pass1.json b/bgfx/effects/misc/deposterize-pass1.json new file mode 100644 index 00000000000..6a62aa36753 --- /dev/null +++ b/bgfx/effects/misc/deposterize-pass1.json @@ -0,0 +1,37 @@ +// license:GPL-2.0+ +// copyright-holders:Hyllian + +/* + Hyllian's Deposterize Shader - Pass1 + + Copyright (C) 2011/2016 Hyllian/Jararaca - sergiogdb@gmail.com +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/misc/vs_deposterize-pass1", + "fragment": "chains/misc/fs_deposterize-pass1", + "uniforms": [ + { "name": "decal", "type": "int", "values": [ 1.0 ] }, + { "name": "EQ_THRESH2", "type": "vec4", "values": [ 0.01, 0.0, 0.0, 0.0 ] }, + { "name": "DIFF_THRESH2", "type": "vec4", "values": [ 0.06, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/pillarbox_left_vertical/saturation.json b/bgfx/effects/misc/saturation.json similarity index 85% rename from bgfx/effects/pillarbox_left_vertical/saturation.json rename to bgfx/effects/misc/saturation.json index c84b6d4a3a2..1708dcee6d4 100644 --- a/bgfx/effects/pillarbox_left_vertical/saturation.json +++ b/bgfx/effects/misc/saturation.json @@ -21,8 +21,8 @@ "rgb": true, "alpha": true }, - "vertex": "chains/pillarbox_left_vertical/vs_saturation", - "fragment": "chains/pillarbox_left_vertical/fs_saturation", + "vertex": "chains/misc/vs_saturation", + "fragment": "chains/misc/fs_saturation", "uniforms": [ { "name": "s_tex", "type": "int", "values": [ 1.0 ] }, { "name": "u_saturation", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] } diff --git a/bgfx/effects/pillarbox_left_horizontal/blit.json b/bgfx/effects/pillarbox_left_horizontal/blit.json deleted file mode 100644 index 085dd67ef93..00000000000 --- a/bgfx/effects/pillarbox_left_horizontal/blit.json +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// blit.json: A simple texture-to-target copy. -// -//============================================================ -{ - // blend (required): The blend state for this effect. - "blend": { - // equation (optional): What equation to perform on the source and destination blend values. - // values: "add", "sub", "revSub", "min", "max" - // default: "add" - // - // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" - "equation": "add", - - // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. - // values: "0", "1", "srccolor", "1-srccolor", "dstcolor", "1-dstcolor", "srcalpha", "1-srcalpha", "dstalpha", "1-dstalpha" - // defaults (srcColor, srcAlpha): "1" - // defaults (dstColor, dstAlpha): "0" - // - // "zero", "one", "invsrccolor", "invdstcolor", "invsrcalpha", and "invdstalpha" are provided as aliases for "0", "1", "1-srccolor", "1-dstcolor", "1-srcalpha", and "1-dstalpha" - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - - // depth (required): The depth state for this effect. - "depth": { - // function (optional): The depth function to use when drawing. - // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" - // default: "always" - "function": "always", - - // writeenable (optional): Whether to store Z-buffer data. - // values: true, false - // default: false - "writeenable": false - }, - - // cull (required): The cull mode for this effect. - "cull": { - // mode (optional): What winding, if any, to cull. - // values: "none", "cw", "ccw" - // default: "ccw" - // - // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" - "mode": "none" - }, - - // write (required): Write enable for color and alpha channels. - "write": { - // rgb (optional): Whether to store color data when drawing. - // values: true, false - // default: false - "rgb": true, - - // alpha (optional): Whether to store alpha data when drawing. - // values: true, false - // default: false - "alpha": true - }, - - // vertex (required): The vertex shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "vertex": "chains/pillarbox_left_horizontal/vs_blit", - - // pixel/fragment (required): The pixel or fragment shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "fragment": "chains/pillarbox_left_horizontal/fs_blit", - - // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. - "uniforms": [ - { - // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. - // value: A string containing the name of the uniform as described above. - // - // NOTE: Some names correspond to special values that will be automatically filled by the BGFX - // code if they are used by the shader. These names are: - // "u_screen_dims" - // The dimensions of the first texture input if present, otherwise the dimensions of the output window. - // Valid values: xy - // "u_inv_screen_dims" - // The reciprocal of u_screen_dims. - // Valid values: xy - // "u_source_dims" - // The size, in pixels, of the screen texture incoming to the chain. - // Valid values: xy - // "u_rotation_type" - // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. - // Valid values: x - // "u_swap_xy" - // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. - // Valid values: x - // "u_quad_dims" - // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. - // Valid values: xy - // "u_tex_sizeN" - // The dimensions, in pixels, of the texture in input pair N. Starts at 0. - // valid values: xy - "name": "s_tex", - - // type (required): The type of the uniform. - // values: "int", "vec4", "mat3", "mat4" - // - // Note: "int" should only be used for samplers. - "type": "int", - - // values (required): The array of numbers with which to initialize the uniform. - // value: A JSON array containin the correct amount of numbers to initialize a uniform of the - // above-specified type. The following size rules should be followed: - // "int": 1 float - // "vec4": 4 floats - // "mat3": 9 floats - // "mat4": 16 floats - "values": [ 1.0 ] - } - ] -} \ No newline at end of file diff --git a/bgfx/effects/pillarbox_left_horizontal/saturation.json b/bgfx/effects/pillarbox_left_horizontal/saturation.json deleted file mode 100644 index 8fff15ddb9b..00000000000 --- a/bgfx/effects/pillarbox_left_horizontal/saturation.json +++ /dev/null @@ -1,30 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// saturation.json: Applies saturation to an image. -// -//============================================================ -{ - "blend": { - "equation": "add", - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - "depth": { - "function": "always" - }, - "cull": { "mode": "none" }, - "write": { - "rgb": true, - "alpha": true - }, - "vertex": "chains/pillarbox_left_horizontal/vs_saturation", - "fragment": "chains/pillarbox_left_horizontal/fs_saturation", - "uniforms": [ - { "name": "s_tex", "type": "int", "values": [ 1.0 ] }, - { "name": "u_saturation", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] } - ] -} \ No newline at end of file diff --git a/bgfx/effects/pillarbox_left_vertical/blit.json b/bgfx/effects/pillarbox_left_vertical/blit.json deleted file mode 100644 index 9fb35a9fe19..00000000000 --- a/bgfx/effects/pillarbox_left_vertical/blit.json +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// blit.json: A simple texture-to-target copy. -// -//============================================================ -{ - // blend (required): The blend state for this effect. - "blend": { - // equation (optional): What equation to perform on the source and destination blend values. - // values: "add", "sub", "revSub", "min", "max" - // default: "add" - // - // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" - "equation": "add", - - // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. - // values: "0", "1", "srccolor", "1-srccolor", "dstcolor", "1-dstcolor", "srcalpha", "1-srcalpha", "dstalpha", "1-dstalpha" - // defaults (srcColor, srcAlpha): "1" - // defaults (dstColor, dstAlpha): "0" - // - // "zero", "one", "invsrccolor", "invdstcolor", "invsrcalpha", and "invdstalpha" are provided as aliases for "0", "1", "1-srccolor", "1-dstcolor", "1-srcalpha", and "1-dstalpha" - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - - // depth (required): The depth state for this effect. - "depth": { - // function (optional): The depth function to use when drawing. - // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" - // default: "always" - "function": "always", - - // writeenable (optional): Whether to store Z-buffer data. - // values: true, false - // default: false - "writeenable": false - }, - - // cull (required): The cull mode for this effect. - "cull": { - // mode (optional): What winding, if any, to cull. - // values: "none", "cw", "ccw" - // default: "ccw" - // - // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" - "mode": "none" - }, - - // write (required): Write enable for color and alpha channels. - "write": { - // rgb (optional): Whether to store color data when drawing. - // values: true, false - // default: false - "rgb": true, - - // alpha (optional): Whether to store alpha data when drawing. - // values: true, false - // default: false - "alpha": true - }, - - // vertex (required): The vertex shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "vertex": "chains/pillarbox_left_vertical/vs_blit", - - // pixel/fragment (required): The pixel or fragment shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "fragment": "chains/pillarbox_left_vertical/fs_blit", - - // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. - "uniforms": [ - { - // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. - // value: A string containing the name of the uniform as described above. - // - // NOTE: Some names correspond to special values that will be automatically filled by the BGFX - // code if they are used by the shader. These names are: - // "u_screen_dims" - // The dimensions of the first texture input if present, otherwise the dimensions of the output window. - // Valid values: xy - // "u_inv_screen_dims" - // The reciprocal of u_screen_dims. - // Valid values: xy - // "u_source_dims" - // The size, in pixels, of the screen texture incoming to the chain. - // Valid values: xy - // "u_rotation_type" - // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. - // Valid values: x - // "u_swap_xy" - // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. - // Valid values: x - // "u_quad_dims" - // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. - // Valid values: xy - // "u_tex_sizeN" - // The dimensions, in pixels, of the texture in input pair N. Starts at 0. - // valid values: xy - "name": "s_tex", - - // type (required): The type of the uniform. - // values: "int", "vec4", "mat3", "mat4" - // - // Note: "int" should only be used for samplers. - "type": "int", - - // values (required): The array of numbers with which to initialize the uniform. - // value: A JSON array containin the correct amount of numbers to initialize a uniform of the - // above-specified type. The following size rules should be followed: - // "int": 1 float - // "vec4": 4 floats - // "mat3": 9 floats - // "mat4": 16 floats - "values": [ 1.0 ] - } - ] -} \ No newline at end of file diff --git a/bgfx/effects/pillarbox_right_horizontal/blit.json b/bgfx/effects/pillarbox_right_horizontal/blit.json deleted file mode 100644 index e982da2dbf3..00000000000 --- a/bgfx/effects/pillarbox_right_horizontal/blit.json +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// blit.json: A simple texture-to-target copy. -// -//============================================================ -{ - // blend (required): The blend state for this effect. - "blend": { - // equation (optional): What equation to perform on the source and destination blend values. - // values: "add", "sub", "revSub", "min", "max" - // default: "add" - // - // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" - "equation": "add", - - // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. - // values: "0", "1", "srccolor", "1-srccolor", "dstcolor", "1-dstcolor", "srcalpha", "1-srcalpha", "dstalpha", "1-dstalpha" - // defaults (srcColor, srcAlpha): "1" - // defaults (dstColor, dstAlpha): "0" - // - // "zero", "one", "invsrccolor", "invdstcolor", "invsrcalpha", and "invdstalpha" are provided as aliases for "0", "1", "1-srccolor", "1-dstcolor", "1-srcalpha", and "1-dstalpha" - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - - // depth (required): The depth state for this effect. - "depth": { - // function (optional): The depth function to use when drawing. - // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" - // default: "always" - "function": "always", - - // writeenable (optional): Whether to store Z-buffer data. - // values: true, false - // default: false - "writeenable": false - }, - - // cull (required): The cull mode for this effect. - "cull": { - // mode (optional): What winding, if any, to cull. - // values: "none", "cw", "ccw" - // default: "ccw" - // - // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" - "mode": "none" - }, - - // write (required): Write enable for color and alpha channels. - "write": { - // rgb (optional): Whether to store color data when drawing. - // values: true, false - // default: false - "rgb": true, - - // alpha (optional): Whether to store alpha data when drawing. - // values: true, false - // default: false - "alpha": true - }, - - // vertex (required): The vertex shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "vertex": "chains/pillarbox_right_horizontal/vs_blit", - - // pixel/fragment (required): The pixel or fragment shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "fragment": "chains/pillarbox_right_horizontal/fs_blit", - - // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. - "uniforms": [ - { - // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. - // value: A string containing the name of the uniform as described above. - // - // NOTE: Some names correspond to special values that will be automatically filled by the BGFX - // code if they are used by the shader. These names are: - // "u_screen_dims" - // The dimensions of the first texture input if present, otherwise the dimensions of the output window. - // Valid values: xy - // "u_inv_screen_dims" - // The reciprocal of u_screen_dims. - // Valid values: xy - // "u_source_dims" - // The size, in pixels, of the screen texture incoming to the chain. - // Valid values: xy - // "u_rotation_type" - // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. - // Valid values: x - // "u_swap_xy" - // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. - // Valid values: x - // "u_quad_dims" - // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. - // Valid values: xy - // "u_tex_sizeN" - // The dimensions, in pixels, of the texture in input pair N. Starts at 0. - // valid values: xy - "name": "s_tex", - - // type (required): The type of the uniform. - // values: "int", "vec4", "mat3", "mat4" - // - // Note: "int" should only be used for samplers. - "type": "int", - - // values (required): The array of numbers with which to initialize the uniform. - // value: A JSON array containin the correct amount of numbers to initialize a uniform of the - // above-specified type. The following size rules should be followed: - // "int": 1 float - // "vec4": 4 floats - // "mat3": 9 floats - // "mat4": 16 floats - "values": [ 1.0 ] - } - ] -} \ No newline at end of file diff --git a/bgfx/effects/pillarbox_right_horizontal/saturation.json b/bgfx/effects/pillarbox_right_horizontal/saturation.json deleted file mode 100644 index 18a416ebd8e..00000000000 --- a/bgfx/effects/pillarbox_right_horizontal/saturation.json +++ /dev/null @@ -1,30 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// saturation.json: Applies saturation to an image. -// -//============================================================ -{ - "blend": { - "equation": "add", - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - "depth": { - "function": "always" - }, - "cull": { "mode": "none" }, - "write": { - "rgb": true, - "alpha": true - }, - "vertex": "chains/pillarbox_right_horizontal/vs_saturation", - "fragment": "chains/pillarbox_right_horizontal/fs_saturation", - "uniforms": [ - { "name": "s_tex", "type": "int", "values": [ 1.0 ] }, - { "name": "u_saturation", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] } - ] -} \ No newline at end of file diff --git a/bgfx/effects/pillarbox_right_vertical/blit.json b/bgfx/effects/pillarbox_right_vertical/blit.json deleted file mode 100644 index 4237ba44b66..00000000000 --- a/bgfx/effects/pillarbox_right_vertical/blit.json +++ /dev/null @@ -1,121 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// blit.json: A simple texture-to-target copy. -// -//============================================================ -{ - // blend (required): The blend state for this effect. - "blend": { - // equation (optional): What equation to perform on the source and destination blend values. - // values: "add", "sub", "revSub", "min", "max" - // default: "add" - // - // "subtract" and "revSubtract" are provided as aliases for "sub" and "revSub" - "equation": "add", - - // blend function parameters (optional): What factors to use in the blend function when calculating the final pixel. - // values: "0", "1", "srccolor", "1-srccolor", "dstcolor", "1-dstcolor", "srcalpha", "1-srcalpha", "dstalpha", "1-dstalpha" - // defaults (srcColor, srcAlpha): "1" - // defaults (dstColor, dstAlpha): "0" - // - // "zero", "one", "invsrccolor", "invdstcolor", "invsrcalpha", and "invdstalpha" are provided as aliases for "0", "1", "1-srccolor", "1-dstcolor", "1-srcalpha", and "1-dstalpha" - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - - // depth (required): The depth state for this effect. - "depth": { - // function (optional): The depth function to use when drawing. - // values: "never", "less", "equal", "lequal", "greater", "notequal", "gequal", "always" - // default: "always" - "function": "always", - - // writeenable (optional): Whether to store Z-buffer data. - // values: true, false - // default: false - "writeenable": false - }, - - // cull (required): The cull mode for this effect. - "cull": { - // mode (optional): What winding, if any, to cull. - // values: "none", "cw", "ccw" - // default: "ccw" - // - // "clockwise" and "counterclockwise" are provided as aliases for "cw" and "ccw" - "mode": "none" - }, - - // write (required): Write enable for color and alpha channels. - "write": { - // rgb (optional): Whether to store color data when drawing. - // values: true, false - // default: false - "rgb": true, - - // alpha (optional): Whether to store alpha data when drawing. - // values: true, false - // default: false - "alpha": true - }, - - // vertex (required): The vertex shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "vertex": "chains/pillarbox_right_vertical/vs_blit", - - // pixel/fragment (required): The pixel or fragment shader to use when drawing. - // value: A string containing the path and name of a shader file to use, minus the extension. - "fragment": "chains/pillarbox_right_vertical/fs_blit", - - // uniforms (required): The list of uniforms for this effect. Can be empty, but must exist. - "uniforms": [ - { - // name (required): The name of the uniform, as used in either the vertex or pixel/fragment shader. - // value: A string containing the name of the uniform as described above. - // - // NOTE: Some names correspond to special values that will be automatically filled by the BGFX - // code if they are used by the shader. These names are: - // "u_screen_dims" - // The dimensions of the first texture input if present, otherwise the dimensions of the output window. - // Valid values: xy - // "u_inv_screen_dims" - // The reciprocal of u_screen_dims. - // Valid values: xy - // "u_source_dims" - // The size, in pixels, of the screen texture incoming to the chain. - // Valid values: xy - // "u_rotation_type" - // This screen's rotation type. 0 if ROT0, 1 if ROT90, 2 if ROT180, 3 of ROT270. - // Valid values: x - // "u_swap_xy" - // Whether this screen is swapped on the X and Y axes. 1 if true, 0 if false. - // Valid values: x - // "u_quad_dims" - // The dimensions, in pixels, occupied by this one screen primitive itself in the output window. - // Valid values: xy - // "u_tex_sizeN" - // The dimensions, in pixels, of the texture in input pair N. Starts at 0. - // valid values: xy - "name": "s_tex", - - // type (required): The type of the uniform. - // values: "int", "vec4", "mat3", "mat4" - // - // Note: "int" should only be used for samplers. - "type": "int", - - // values (required): The array of numbers with which to initialize the uniform. - // value: A JSON array containin the correct amount of numbers to initialize a uniform of the - // above-specified type. The following size rules should be followed: - // "int": 1 float - // "vec4": 4 floats - // "mat3": 9 floats - // "mat4": 16 floats - "values": [ 1.0 ] - } - ] -} \ No newline at end of file diff --git a/bgfx/effects/pillarbox_right_vertical/saturation.json b/bgfx/effects/pillarbox_right_vertical/saturation.json deleted file mode 100644 index f51e68f6134..00000000000 --- a/bgfx/effects/pillarbox_right_vertical/saturation.json +++ /dev/null @@ -1,30 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -//============================================================ -// -// saturation.json: Applies saturation to an image. -// -//============================================================ -{ - "blend": { - "equation": "add", - "srcColor": "srcalpha", - "dstColor": "1-srcalpha", - "srcAlpha": "srcalpha", - "dstAlpha": "1-srcalpha" - }, - "depth": { - "function": "always" - }, - "cull": { "mode": "none" }, - "write": { - "rgb": true, - "alpha": true - }, - "vertex": "chains/pillarbox_right_vertical/vs_saturation", - "fragment": "chains/pillarbox_right_vertical/fs_saturation", - "uniforms": [ - { "name": "s_tex", "type": "int", "values": [ 1.0 ] }, - { "name": "u_saturation", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] } - ] -} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/custom-jinc2-sharper.json b/bgfx/effects/xbr/super-xbr/custom-jinc2-sharper.json new file mode 100644 index 00000000000..cb65457ea68 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/custom-jinc2-sharper.json @@ -0,0 +1,38 @@ +// license:GPL-2.0+ +// copyright-holders:Hyllian + +/* + Hyllian's jinc windowed-jinc 2-lobe sharper with anti-ringing Shader + + Copyright (C) 2011-2014 Hyllian/Jararaca - sergiogdb@gmail.com +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_custom-jinc2-sharper", + "fragment": "chains/xbr/super-xbr/fs_custom-jinc2-sharper", + "uniforms": [ + { "name": "s_p", "type": "int", "values": [ 1.0 ] }, + { "name": "JINC2_WINDOW_SINC", "type": "vec4", "values": [ 0.42, 0.0, 0.0, 0.0 ] }, + { "name": "JINC2_SINC", "type": "vec4", "values": [ 0.92, 0.0, 0.0, 0.0 ] }, + { "name": "JINC2_AR_STRENGTH", "type": "vec4", "values": [ 0.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass0.json b/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass0.json new file mode 100644 index 00000000000..a0e77327bb0 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass0.json @@ -0,0 +1,58 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader, pass0 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-2xbr-3d-pass0", + "fragment": "chains/xbr/super-xbr/fs_super-2xbr-3d-pass0", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass1.json b/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass1.json new file mode 100644 index 00000000000..1e9669c91f9 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass1.json @@ -0,0 +1,59 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader, pass1 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-2xbr-3d-pass1", + "fragment": "chains/xbr/super-xbr/fs_super-2xbr-3d-pass1", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "ORIG_texture", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass2.json b/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass2.json new file mode 100644 index 00000000000..86dad8cd5bd --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-2xbr-3d-pass2.json @@ -0,0 +1,59 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader, pass2 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-2xbr-3d-pass2", + "fragment": "chains/xbr/super-xbr/fs_super-2xbr-3d-pass2", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "ORIG_texture", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass0.json b/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass0.json new file mode 100644 index 00000000000..fccbdaf32db --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass0.json @@ -0,0 +1,58 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass0 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-4xbr-3d-pass0", + "fragment": "chains/xbr/super-xbr/fs_super-4xbr-3d-pass0", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass1.json b/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass1.json new file mode 100644 index 00000000000..1f0492ee3c3 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass1.json @@ -0,0 +1,59 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass0 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-4xbr-3d-pass1", + "fragment": "chains/xbr/super-xbr/fs_super-4xbr-3d-pass1", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "ORIG_texture", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass2.json b/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass2.json new file mode 100644 index 00000000000..665f455e662 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass2.json @@ -0,0 +1,58 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass0 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-4xbr-3d-pass2", + "fragment": "chains/xbr/super-xbr/fs_super-4xbr-3d-pass2", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass3.json b/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass3.json new file mode 100644 index 00000000000..e33bc2ebb61 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-4xbr-3d-pass3.json @@ -0,0 +1,59 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass0 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-4xbr-3d-pass3", + "fragment": "chains/xbr/super-xbr/fs_super-4xbr-3d-pass3", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "ORIG_texture", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass0.json b/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass0.json new file mode 100644 index 00000000000..bd3d511cc98 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass0.json @@ -0,0 +1,58 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader, Fast (pass0) ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-xbr-fast-pass0", + "fragment": "chains/xbr/super-xbr/fs_super-xbr-fast-pass0", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass1.json b/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass1.json new file mode 100644 index 00000000000..4b65ac60ba4 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass1.json @@ -0,0 +1,58 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader, Fast (pass1) ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-xbr-fast-pass1", + "fragment": "chains/xbr/super-xbr/fs_super-xbr-fast-pass1", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass2.json b/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass2.json new file mode 100644 index 00000000000..f3ce83b4272 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-xbr-fast-pass2.json @@ -0,0 +1,58 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader, Fast (pass2) ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-xbr-fast-pass2", + "fragment": "chains/xbr/super-xbr/fs_super-xbr-fast-pass2", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.5, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-xbr-pass0.json b/bgfx/effects/xbr/super-xbr/super-xbr-pass0.json new file mode 100644 index 00000000000..c7d1db28110 --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-xbr-pass0.json @@ -0,0 +1,58 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-xbr-pass0", + "fragment": "chains/xbr/super-xbr/fs_super-xbr-pass0", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-xbr-pass1.json b/bgfx/effects/xbr/super-xbr/super-xbr-pass1.json new file mode 100644 index 00000000000..13e8f8dbd9a --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-xbr-pass1.json @@ -0,0 +1,59 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-xbr-pass1", + "fragment": "chains/xbr/super-xbr/fs_super-xbr-pass1", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "ORIG_texture", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/effects/xbr/super-xbr/super-xbr-pass2.json b/bgfx/effects/xbr/super-xbr/super-xbr-pass2.json new file mode 100644 index 00000000000..bea988632cf --- /dev/null +++ b/bgfx/effects/xbr/super-xbr/super-xbr-pass2.json @@ -0,0 +1,58 @@ +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +{ + "blend": { + "equation": "add", + "srcColor": "1", + "dstColor": "0", + "srcAlpha": "1", + "dstAlpha": "0" + }, + "depth": { + "function": "always", + "writeenable": false + }, + "cull": { + "mode": "none" + }, + "write": { + "rgb": true, + "alpha": true + }, + "vertex": "chains/xbr/super-xbr/vs_super-xbr-pass2", + "fragment": "chains/xbr/super-xbr/fs_super-xbr-pass2", + "uniforms": [ + { "name": "s0", "type": "int", "values": [ 1.0 ] }, + { "name": "XBR_EDGE_STR", "type": "vec4", "values": [ 0.6, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_WEIGHT", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "XBR_ANTI_RINGING", "type": "vec4", "values": [ 1.0, 0.0, 0.0, 0.0 ] }, + { "name": "u_tex_size0", "type": "vec4", "values": [ 1.0, 1.0, 0.0, 0.0 ] } + ] +} \ No newline at end of file diff --git a/bgfx/shaders/dx11/chains/hlsl/fs_post.bin b/bgfx/shaders/dx11/chains/hlsl/fs_post.bin index b436f6b57eb..52f2fbaa78f 100644 Binary files a/bgfx/shaders/dx11/chains/hlsl/fs_post.bin and b/bgfx/shaders/dx11/chains/hlsl/fs_post.bin differ diff --git a/bgfx/shaders/dx11/chains/hlsl/fs_blit.bin b/bgfx/shaders/dx11/chains/misc/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/hlsl/fs_blit.bin rename to bgfx/shaders/dx11/chains/misc/fs_blit.bin diff --git a/bgfx/shaders/dx11/chains/misc/fs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/dx11/chains/misc/fs_bob-and-ghost-deinterlace.bin new file mode 100644 index 00000000000..1d599087b33 Binary files /dev/null and b/bgfx/shaders/dx11/chains/misc/fs_bob-and-ghost-deinterlace.bin differ diff --git a/bgfx/shaders/dx11/chains/misc/fs_deposterize-pass0.bin b/bgfx/shaders/dx11/chains/misc/fs_deposterize-pass0.bin new file mode 100644 index 00000000000..264bfbbb9b6 Binary files /dev/null and b/bgfx/shaders/dx11/chains/misc/fs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/misc/fs_deposterize-pass1.bin b/bgfx/shaders/dx11/chains/misc/fs_deposterize-pass1.bin new file mode 100644 index 00000000000..1aa8b286236 Binary files /dev/null and b/bgfx/shaders/dx11/chains/misc/fs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/pillarbox_left_horizontal/fs_saturation.bin b/bgfx/shaders/dx11/chains/misc/fs_saturation.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_left_horizontal/fs_saturation.bin rename to bgfx/shaders/dx11/chains/misc/fs_saturation.bin diff --git a/bgfx/shaders/dx11/chains/hlsl/vs_blit.bin b/bgfx/shaders/dx11/chains/misc/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/hlsl/vs_blit.bin rename to bgfx/shaders/dx11/chains/misc/vs_blit.bin diff --git a/bgfx/shaders/dx11/chains/hq2x/vs_blit.bin b/bgfx/shaders/dx11/chains/misc/vs_bob-and-ghost-deinterlace.bin similarity index 100% rename from bgfx/shaders/dx11/chains/hq2x/vs_blit.bin rename to bgfx/shaders/dx11/chains/misc/vs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/dx11/chains/misc/vs_deposterize-pass0.bin b/bgfx/shaders/dx11/chains/misc/vs_deposterize-pass0.bin new file mode 100644 index 00000000000..857914316fc Binary files /dev/null and b/bgfx/shaders/dx11/chains/misc/vs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/misc/vs_deposterize-pass1.bin b/bgfx/shaders/dx11/chains/misc/vs_deposterize-pass1.bin new file mode 100644 index 00000000000..a35757d8e79 Binary files /dev/null and b/bgfx/shaders/dx11/chains/misc/vs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/pillarbox_left_vertical/vs_saturation.bin b/bgfx/shaders/dx11/chains/misc/vs_saturation.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_left_vertical/vs_saturation.bin rename to bgfx/shaders/dx11/chains/misc/vs_saturation.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_left_vertical/fs_saturation.bin b/bgfx/shaders/dx11/chains/pillarbox_left_vertical/fs_saturation.bin deleted file mode 100644 index eaec59b81d7..00000000000 Binary files a/bgfx/shaders/dx11/chains/pillarbox_left_vertical/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/dx11/chains/pillarbox_right_horizontal/fs_saturation.bin b/bgfx/shaders/dx11/chains/pillarbox_right_horizontal/fs_saturation.bin deleted file mode 100644 index eaec59b81d7..00000000000 Binary files a/bgfx/shaders/dx11/chains/pillarbox_right_horizontal/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/dx11/chains/pillarbox_right_vertical/fs_saturation.bin b/bgfx/shaders/dx11/chains/pillarbox_right_vertical/fs_saturation.bin deleted file mode 100644 index eaec59b81d7..00000000000 Binary files a/bgfx/shaders/dx11/chains/pillarbox_right_vertical/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/dx11/chains/hq2x/fs_blit.bin b/bgfx/shaders/dx11/chains/super-4xbr-3d-4p/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/hq2x/fs_blit.bin rename to bgfx/shaders/dx11/chains/super-4xbr-3d-4p/fs_blit.bin diff --git a/bgfx/shaders/dx11/chains/hq3x/vs_blit.bin b/bgfx/shaders/dx11/chains/super-4xbr-3d-4p/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/hq3x/vs_blit.bin rename to bgfx/shaders/dx11/chains/super-4xbr-3d-4p/vs_blit.bin diff --git a/bgfx/shaders/dx11/chains/hq3x/fs_blit.bin b/bgfx/shaders/dx11/chains/super-4xbr-3d-6p-smoother/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/hq3x/fs_blit.bin rename to bgfx/shaders/dx11/chains/super-4xbr-3d-6p-smoother/fs_blit.bin diff --git a/bgfx/shaders/dx11/chains/hq4x/vs_blit.bin b/bgfx/shaders/dx11/chains/super-4xbr-3d-6p-smoother/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/hq4x/vs_blit.bin rename to bgfx/shaders/dx11/chains/super-4xbr-3d-6p-smoother/vs_blit.bin diff --git a/bgfx/shaders/dx11/chains/hq4x/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-hybrid/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/hq4x/fs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-hybrid/fs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_left_horizontal/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-hybrid/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_left_horizontal/vs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-hybrid/vs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_left_horizontal/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv1-noblend/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_left_horizontal/fs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-lv1-noblend/fs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_left_vertical/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv1-noblend/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_left_vertical/vs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-lv1-noblend/vs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_left_vertical/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-3d/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_left_vertical/fs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-lv2-3d/fs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_right_horizontal/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-3d/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_right_horizontal/vs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-lv2-3d/vs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_right_horizontal/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-accuracy-multipass/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_right_horizontal/fs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-lv2-accuracy-multipass/fs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_right_vertical/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-accuracy-multipass/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_right_vertical/vs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-lv2-accuracy-multipass/vs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_right_vertical/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx11/chains/pillarbox_right_vertical/fs_blit.bin rename to bgfx/shaders/dx11/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin diff --git a/bgfx/shaders/dx11/chains/pillarbox_left_horizontal/vs_saturation.bin b/bgfx/shaders/dx11/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin similarity index 63% rename from bgfx/shaders/dx11/chains/pillarbox_left_horizontal/vs_saturation.bin rename to bgfx/shaders/dx11/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin index 8d21d98385a..b0bebf9da4c 100644 Binary files a/bgfx/shaders/dx11/chains/pillarbox_left_horizontal/vs_saturation.bin and b/bgfx/shaders/dx11/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv2-deposterize/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-deposterize/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv2-deposterize/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/pillarbox_right_horizontal/vs_saturation.bin b/bgfx/shaders/dx11/chains/xbr-lv2-deposterize/vs_blit.bin similarity index 63% rename from bgfx/shaders/dx11/chains/pillarbox_right_horizontal/vs_saturation.bin rename to bgfx/shaders/dx11/chains/xbr-lv2-deposterize/vs_blit.bin index cde2b1546aa..b0bebf9da4c 100644 Binary files a/bgfx/shaders/dx11/chains/pillarbox_right_horizontal/vs_saturation.bin and b/bgfx/shaders/dx11/chains/xbr-lv2-deposterize/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv2-fast/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-fast/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv2-fast/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/pillarbox_right_vertical/vs_saturation.bin b/bgfx/shaders/dx11/chains/xbr-lv2-fast/vs_blit.bin similarity index 63% rename from bgfx/shaders/dx11/chains/pillarbox_right_vertical/vs_saturation.bin rename to bgfx/shaders/dx11/chains/xbr-lv2-fast/vs_blit.bin index ce4ae1dd5c7..b0bebf9da4c 100644 Binary files a/bgfx/shaders/dx11/chains/pillarbox_right_vertical/vs_saturation.bin and b/bgfx/shaders/dx11/chains/xbr-lv2-fast/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv2-multipass/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-multipass/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv2-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv2-multipass/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-multipass/vs_blit.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv2-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv2-noblend/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-noblend/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv2-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv2-noblend/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv2-noblend/vs_blit.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv2-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv3-multipass/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv3-multipass/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv3-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv3-multipass/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv3-multipass/vs_blit.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv3-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv3-noblend/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv3-noblend/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv3-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv3-noblend/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv3-noblend/vs_blit.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv3-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv3/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv3/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv3/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-lv3/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-lv3/vs_blit.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-lv3/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-mlv4-dilation/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-mlv4-dilation/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-mlv4-dilation/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-mlv4-dilation/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-mlv4-dilation/vs_blit.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-mlv4-dilation/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-mlv4-multipass/fs_blit.bin b/bgfx/shaders/dx11/chains/xbr-mlv4-multipass/fs_blit.bin new file mode 100644 index 00000000000..80d85fb1107 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-mlv4-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr-mlv4-multipass/vs_blit.bin b/bgfx/shaders/dx11/chains/xbr-mlv4-multipass/vs_blit.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr-mlv4-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv1-noblend.bin b/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..1bb404e2c90 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2-3d.bin b/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..d8e18eed1ec Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2-fast.bin b/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..c7ba1220aa5 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2.bin b/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2.bin new file mode 100644 index 00000000000..b288f8a7d84 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/fs_xbr-lv2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..2b20345d324 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..e9f036afa78 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..a5c002c6cd2 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..c4602858022 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..e6032b15b53 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..4adf8dd729c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..e2deb08ba10 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..e9f036afa78 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..a5c002c6cd2 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..c4602858022 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..5a92a7f2520 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..15dbf7dc5c1 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..195330767b5 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass0.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass0.bin new file mode 100644 index 00000000000..1db02710c90 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass1.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass1.bin new file mode 100644 index 00000000000..3624fe72f40 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass2.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass2.bin new file mode 100644 index 00000000000..676ff1da0b5 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/fs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..bc112796493 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..bc112796493 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..bc112796493 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass0.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass0.bin new file mode 100644 index 00000000000..5e66024f1eb Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass1.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass1.bin new file mode 100644 index 00000000000..b0bebf9da4c Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass2.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass2.bin new file mode 100644 index 00000000000..bc112796493 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass3.bin b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass3.bin new file mode 100644 index 00000000000..bc112796493 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/super-xbr/vs_super-xbr-pass3.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv1-noblend.bin b/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..482a0ead8fd Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2-3d.bin b/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..324107e89b1 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2-fast.bin b/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..5b037b2bfe8 Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2.bin b/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2.bin new file mode 100644 index 00000000000..f4fe0e66cca Binary files /dev/null and b/bgfx/shaders/dx11/chains/xbr/vs_xbr-lv2.bin differ diff --git a/bgfx/shaders/dx9/chains/hlsl/fs_post.bin b/bgfx/shaders/dx9/chains/hlsl/fs_post.bin index f8f79b90ab6..3f2fbf2bd56 100644 Binary files a/bgfx/shaders/dx9/chains/hlsl/fs_post.bin and b/bgfx/shaders/dx9/chains/hlsl/fs_post.bin differ diff --git a/bgfx/shaders/dx9/chains/hlsl/fs_blit.bin b/bgfx/shaders/dx9/chains/misc/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/hlsl/fs_blit.bin rename to bgfx/shaders/dx9/chains/misc/fs_blit.bin diff --git a/bgfx/shaders/dx9/chains/misc/fs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/dx9/chains/misc/fs_bob-and-ghost-deinterlace.bin new file mode 100644 index 00000000000..8eebd096fef Binary files /dev/null and b/bgfx/shaders/dx9/chains/misc/fs_bob-and-ghost-deinterlace.bin differ diff --git a/bgfx/shaders/dx9/chains/misc/fs_deposterize-pass0.bin b/bgfx/shaders/dx9/chains/misc/fs_deposterize-pass0.bin new file mode 100644 index 00000000000..de4521b235d Binary files /dev/null and b/bgfx/shaders/dx9/chains/misc/fs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/misc/fs_deposterize-pass1.bin b/bgfx/shaders/dx9/chains/misc/fs_deposterize-pass1.bin new file mode 100644 index 00000000000..acd2c9c61d7 Binary files /dev/null and b/bgfx/shaders/dx9/chains/misc/fs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/pillarbox_left_horizontal/fs_saturation.bin b/bgfx/shaders/dx9/chains/misc/fs_saturation.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_left_horizontal/fs_saturation.bin rename to bgfx/shaders/dx9/chains/misc/fs_saturation.bin diff --git a/bgfx/shaders/dx9/chains/hlsl/vs_blit.bin b/bgfx/shaders/dx9/chains/misc/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/hlsl/vs_blit.bin rename to bgfx/shaders/dx9/chains/misc/vs_blit.bin diff --git a/bgfx/shaders/dx9/chains/hq2x/vs_blit.bin b/bgfx/shaders/dx9/chains/misc/vs_bob-and-ghost-deinterlace.bin similarity index 100% rename from bgfx/shaders/dx9/chains/hq2x/vs_blit.bin rename to bgfx/shaders/dx9/chains/misc/vs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/dx9/chains/misc/vs_deposterize-pass0.bin b/bgfx/shaders/dx9/chains/misc/vs_deposterize-pass0.bin new file mode 100644 index 00000000000..c8cf8f27b41 Binary files /dev/null and b/bgfx/shaders/dx9/chains/misc/vs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/misc/vs_deposterize-pass1.bin b/bgfx/shaders/dx9/chains/misc/vs_deposterize-pass1.bin new file mode 100644 index 00000000000..9576d95be24 Binary files /dev/null and b/bgfx/shaders/dx9/chains/misc/vs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/pillarbox_left_vertical/vs_saturation.bin b/bgfx/shaders/dx9/chains/misc/vs_saturation.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_left_vertical/vs_saturation.bin rename to bgfx/shaders/dx9/chains/misc/vs_saturation.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_left_vertical/fs_saturation.bin b/bgfx/shaders/dx9/chains/pillarbox_left_vertical/fs_saturation.bin deleted file mode 100644 index 5fe87a15fb5..00000000000 Binary files a/bgfx/shaders/dx9/chains/pillarbox_left_vertical/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/dx9/chains/pillarbox_right_horizontal/fs_saturation.bin b/bgfx/shaders/dx9/chains/pillarbox_right_horizontal/fs_saturation.bin deleted file mode 100644 index 5fe87a15fb5..00000000000 Binary files a/bgfx/shaders/dx9/chains/pillarbox_right_horizontal/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/dx9/chains/pillarbox_right_vertical/fs_saturation.bin b/bgfx/shaders/dx9/chains/pillarbox_right_vertical/fs_saturation.bin deleted file mode 100644 index 5fe87a15fb5..00000000000 Binary files a/bgfx/shaders/dx9/chains/pillarbox_right_vertical/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/dx9/chains/hq2x/fs_blit.bin b/bgfx/shaders/dx9/chains/super-4xbr-3d-4p/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/hq2x/fs_blit.bin rename to bgfx/shaders/dx9/chains/super-4xbr-3d-4p/fs_blit.bin diff --git a/bgfx/shaders/dx9/chains/hq3x/vs_blit.bin b/bgfx/shaders/dx9/chains/super-4xbr-3d-4p/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/hq3x/vs_blit.bin rename to bgfx/shaders/dx9/chains/super-4xbr-3d-4p/vs_blit.bin diff --git a/bgfx/shaders/dx9/chains/hq3x/fs_blit.bin b/bgfx/shaders/dx9/chains/super-4xbr-3d-6p-smoother/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/hq3x/fs_blit.bin rename to bgfx/shaders/dx9/chains/super-4xbr-3d-6p-smoother/fs_blit.bin diff --git a/bgfx/shaders/dx9/chains/hq4x/vs_blit.bin b/bgfx/shaders/dx9/chains/super-4xbr-3d-6p-smoother/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/hq4x/vs_blit.bin rename to bgfx/shaders/dx9/chains/super-4xbr-3d-6p-smoother/vs_blit.bin diff --git a/bgfx/shaders/dx9/chains/hq4x/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-hybrid/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/hq4x/fs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-hybrid/fs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_left_horizontal/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-hybrid/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_left_horizontal/vs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-hybrid/vs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_left_horizontal/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv1-noblend/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_left_horizontal/fs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-lv1-noblend/fs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_left_vertical/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv1-noblend/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_left_vertical/vs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-lv1-noblend/vs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_left_vertical/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-3d/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_left_vertical/fs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-lv2-3d/fs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_right_horizontal/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-3d/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_right_horizontal/vs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-lv2-3d/vs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_right_horizontal/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-accuracy-multipass/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_right_horizontal/fs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-lv2-accuracy-multipass/fs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_right_vertical/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-accuracy-multipass/vs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_right_vertical/vs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-lv2-accuracy-multipass/vs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_right_vertical/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin similarity index 100% rename from bgfx/shaders/dx9/chains/pillarbox_right_vertical/fs_blit.bin rename to bgfx/shaders/dx9/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin diff --git a/bgfx/shaders/dx9/chains/pillarbox_right_horizontal/vs_saturation.bin b/bgfx/shaders/dx9/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin similarity index 51% rename from bgfx/shaders/dx9/chains/pillarbox_right_horizontal/vs_saturation.bin rename to bgfx/shaders/dx9/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin index e9bfb3062de..ea94c83e62d 100644 Binary files a/bgfx/shaders/dx9/chains/pillarbox_right_horizontal/vs_saturation.bin and b/bgfx/shaders/dx9/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv2-deposterize/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-deposterize/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv2-deposterize/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/pillarbox_right_vertical/vs_saturation.bin b/bgfx/shaders/dx9/chains/xbr-lv2-deposterize/vs_blit.bin similarity index 51% rename from bgfx/shaders/dx9/chains/pillarbox_right_vertical/vs_saturation.bin rename to bgfx/shaders/dx9/chains/xbr-lv2-deposterize/vs_blit.bin index 55774bb38ab..ea94c83e62d 100644 Binary files a/bgfx/shaders/dx9/chains/pillarbox_right_vertical/vs_saturation.bin and b/bgfx/shaders/dx9/chains/xbr-lv2-deposterize/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv2-fast/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-fast/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv2-fast/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/pillarbox_left_horizontal/vs_saturation.bin b/bgfx/shaders/dx9/chains/xbr-lv2-fast/vs_blit.bin similarity index 51% rename from bgfx/shaders/dx9/chains/pillarbox_left_horizontal/vs_saturation.bin rename to bgfx/shaders/dx9/chains/xbr-lv2-fast/vs_blit.bin index b9b18b7ac1a..ea94c83e62d 100644 Binary files a/bgfx/shaders/dx9/chains/pillarbox_left_horizontal/vs_saturation.bin and b/bgfx/shaders/dx9/chains/xbr-lv2-fast/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv2-multipass/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-multipass/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv2-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv2-multipass/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-multipass/vs_blit.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv2-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv2-noblend/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-noblend/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv2-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv2-noblend/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv2-noblend/vs_blit.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv2-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv3-multipass/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv3-multipass/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv3-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv3-multipass/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv3-multipass/vs_blit.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv3-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv3-noblend/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv3-noblend/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv3-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv3-noblend/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv3-noblend/vs_blit.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv3-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv3/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv3/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv3/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-lv3/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-lv3/vs_blit.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-lv3/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-mlv4-dilation/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-mlv4-dilation/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-mlv4-dilation/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-mlv4-dilation/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-mlv4-dilation/vs_blit.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-mlv4-dilation/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-mlv4-multipass/fs_blit.bin b/bgfx/shaders/dx9/chains/xbr-mlv4-multipass/fs_blit.bin new file mode 100644 index 00000000000..ef8fa0730c3 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-mlv4-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr-mlv4-multipass/vs_blit.bin b/bgfx/shaders/dx9/chains/xbr-mlv4-multipass/vs_blit.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr-mlv4-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv1-noblend.bin b/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..835ecae48ad Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2-3d.bin b/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..5d3c63a1179 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2-fast.bin b/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..97e82ad7584 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2.bin b/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2.bin new file mode 100644 index 00000000000..53b70afd89e Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/fs_xbr-lv2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..1bd16aff210 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..663ca437f49 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..28f508a31f6 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..63dd5937863 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..2fc641bc90c Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..501d317cb1e Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..5b5fae14973 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..663ca437f49 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..599c1d3ba3f Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..63dd5937863 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..df939770a6e Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..a63b9bd2aaa Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..9df5faa4beb Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass0.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass0.bin new file mode 100644 index 00000000000..6df91a67542 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass1.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass1.bin new file mode 100644 index 00000000000..2613ba72823 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass2.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass2.bin new file mode 100644 index 00000000000..7fa43cddf5d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/fs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..ac97172504e Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..ac97172504e Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..ac97172504e Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass0.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass0.bin new file mode 100644 index 00000000000..fbf3ac8bbd5 Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass1.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass1.bin new file mode 100644 index 00000000000..ea94c83e62d Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass2.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass2.bin new file mode 100644 index 00000000000..ac97172504e Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass3.bin b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass3.bin new file mode 100644 index 00000000000..ac97172504e Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/super-xbr/vs_super-xbr-pass3.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv1-noblend.bin b/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..30e1aa8bbfe Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2-3d.bin b/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..a35d9978cdb Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2-fast.bin b/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..de5213e137f Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2.bin b/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2.bin new file mode 100644 index 00000000000..73a4c5231fd Binary files /dev/null and b/bgfx/shaders/dx9/chains/xbr/vs_xbr-lv2.bin differ diff --git a/bgfx/shaders/gles/chains/hlsl/fs_post.bin b/bgfx/shaders/gles/chains/hlsl/fs_post.bin index 0d5393b4be6..b044cef536b 100644 Binary files a/bgfx/shaders/gles/chains/hlsl/fs_post.bin and b/bgfx/shaders/gles/chains/hlsl/fs_post.bin differ diff --git a/bgfx/shaders/gles/chains/hlsl/fs_blit.bin b/bgfx/shaders/gles/chains/misc/fs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/hlsl/fs_blit.bin rename to bgfx/shaders/gles/chains/misc/fs_blit.bin diff --git a/bgfx/shaders/gles/chains/misc/fs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/gles/chains/misc/fs_bob-and-ghost-deinterlace.bin new file mode 100644 index 00000000000..b2433cfdb67 Binary files /dev/null and b/bgfx/shaders/gles/chains/misc/fs_bob-and-ghost-deinterlace.bin differ diff --git a/bgfx/shaders/gles/chains/misc/fs_deposterize-pass0.bin b/bgfx/shaders/gles/chains/misc/fs_deposterize-pass0.bin new file mode 100644 index 00000000000..a7ef07b90c7 Binary files /dev/null and b/bgfx/shaders/gles/chains/misc/fs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/misc/fs_deposterize-pass1.bin b/bgfx/shaders/gles/chains/misc/fs_deposterize-pass1.bin new file mode 100644 index 00000000000..08c29573029 Binary files /dev/null and b/bgfx/shaders/gles/chains/misc/fs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/pillarbox_left_horizontal/fs_saturation.bin b/bgfx/shaders/gles/chains/misc/fs_saturation.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_left_horizontal/fs_saturation.bin rename to bgfx/shaders/gles/chains/misc/fs_saturation.bin diff --git a/bgfx/shaders/gles/chains/hlsl/vs_blit.bin b/bgfx/shaders/gles/chains/misc/vs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/hlsl/vs_blit.bin rename to bgfx/shaders/gles/chains/misc/vs_blit.bin diff --git a/bgfx/shaders/gles/chains/hq2x/vs_blit.bin b/bgfx/shaders/gles/chains/misc/vs_bob-and-ghost-deinterlace.bin similarity index 100% rename from bgfx/shaders/gles/chains/hq2x/vs_blit.bin rename to bgfx/shaders/gles/chains/misc/vs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/gles/chains/misc/vs_deposterize-pass0.bin b/bgfx/shaders/gles/chains/misc/vs_deposterize-pass0.bin new file mode 100644 index 00000000000..b39bc67dfb4 Binary files /dev/null and b/bgfx/shaders/gles/chains/misc/vs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/misc/vs_deposterize-pass1.bin b/bgfx/shaders/gles/chains/misc/vs_deposterize-pass1.bin new file mode 100644 index 00000000000..893fee943b1 Binary files /dev/null and b/bgfx/shaders/gles/chains/misc/vs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/pillarbox_left_vertical/vs_saturation.bin b/bgfx/shaders/gles/chains/misc/vs_saturation.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_left_vertical/vs_saturation.bin rename to bgfx/shaders/gles/chains/misc/vs_saturation.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_left_vertical/fs_saturation.bin b/bgfx/shaders/gles/chains/pillarbox_left_vertical/fs_saturation.bin deleted file mode 100644 index 2f6160fe747..00000000000 Binary files a/bgfx/shaders/gles/chains/pillarbox_left_vertical/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/gles/chains/pillarbox_right_horizontal/fs_saturation.bin b/bgfx/shaders/gles/chains/pillarbox_right_horizontal/fs_saturation.bin deleted file mode 100644 index 2f6160fe747..00000000000 Binary files a/bgfx/shaders/gles/chains/pillarbox_right_horizontal/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/gles/chains/pillarbox_right_vertical/fs_saturation.bin b/bgfx/shaders/gles/chains/pillarbox_right_vertical/fs_saturation.bin deleted file mode 100644 index 2f6160fe747..00000000000 Binary files a/bgfx/shaders/gles/chains/pillarbox_right_vertical/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/gles/chains/hq2x/fs_blit.bin b/bgfx/shaders/gles/chains/super-4xbr-3d-4p/fs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/hq2x/fs_blit.bin rename to bgfx/shaders/gles/chains/super-4xbr-3d-4p/fs_blit.bin diff --git a/bgfx/shaders/gles/chains/hq3x/vs_blit.bin b/bgfx/shaders/gles/chains/super-4xbr-3d-4p/vs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/hq3x/vs_blit.bin rename to bgfx/shaders/gles/chains/super-4xbr-3d-4p/vs_blit.bin diff --git a/bgfx/shaders/gles/chains/hq3x/fs_blit.bin b/bgfx/shaders/gles/chains/super-4xbr-3d-6p-smoother/fs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/hq3x/fs_blit.bin rename to bgfx/shaders/gles/chains/super-4xbr-3d-6p-smoother/fs_blit.bin diff --git a/bgfx/shaders/gles/chains/hq4x/vs_blit.bin b/bgfx/shaders/gles/chains/super-4xbr-3d-6p-smoother/vs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/hq4x/vs_blit.bin rename to bgfx/shaders/gles/chains/super-4xbr-3d-6p-smoother/vs_blit.bin diff --git a/bgfx/shaders/gles/chains/hq4x/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-hybrid/fs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/hq4x/fs_blit.bin rename to bgfx/shaders/gles/chains/xbr-hybrid/fs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_left_horizontal/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-hybrid/vs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_left_horizontal/vs_blit.bin rename to bgfx/shaders/gles/chains/xbr-hybrid/vs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_left_horizontal/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv1-noblend/fs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_left_horizontal/fs_blit.bin rename to bgfx/shaders/gles/chains/xbr-lv1-noblend/fs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_left_vertical/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv1-noblend/vs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_left_vertical/vs_blit.bin rename to bgfx/shaders/gles/chains/xbr-lv1-noblend/vs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_left_vertical/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-3d/fs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_left_vertical/fs_blit.bin rename to bgfx/shaders/gles/chains/xbr-lv2-3d/fs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_right_horizontal/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-3d/vs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_right_horizontal/vs_blit.bin rename to bgfx/shaders/gles/chains/xbr-lv2-3d/vs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_right_horizontal/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-accuracy-multipass/fs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_right_horizontal/fs_blit.bin rename to bgfx/shaders/gles/chains/xbr-lv2-accuracy-multipass/fs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_right_vertical/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-accuracy-multipass/vs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_right_vertical/vs_blit.bin rename to bgfx/shaders/gles/chains/xbr-lv2-accuracy-multipass/vs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_right_vertical/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin similarity index 100% rename from bgfx/shaders/gles/chains/pillarbox_right_vertical/fs_blit.bin rename to bgfx/shaders/gles/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin diff --git a/bgfx/shaders/gles/chains/pillarbox_left_horizontal/vs_saturation.bin b/bgfx/shaders/gles/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin similarity index 73% rename from bgfx/shaders/gles/chains/pillarbox_left_horizontal/vs_saturation.bin rename to bgfx/shaders/gles/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin index 42326d4324e..9dd618de8a0 100644 Binary files a/bgfx/shaders/gles/chains/pillarbox_left_horizontal/vs_saturation.bin and b/bgfx/shaders/gles/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv2-deposterize/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-deposterize/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv2-deposterize/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/pillarbox_right_horizontal/vs_saturation.bin b/bgfx/shaders/gles/chains/xbr-lv2-deposterize/vs_blit.bin similarity index 73% rename from bgfx/shaders/gles/chains/pillarbox_right_horizontal/vs_saturation.bin rename to bgfx/shaders/gles/chains/xbr-lv2-deposterize/vs_blit.bin index 1e806909f59..9dd618de8a0 100644 Binary files a/bgfx/shaders/gles/chains/pillarbox_right_horizontal/vs_saturation.bin and b/bgfx/shaders/gles/chains/xbr-lv2-deposterize/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv2-fast/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-fast/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv2-fast/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/pillarbox_right_vertical/vs_saturation.bin b/bgfx/shaders/gles/chains/xbr-lv2-fast/vs_blit.bin similarity index 72% rename from bgfx/shaders/gles/chains/pillarbox_right_vertical/vs_saturation.bin rename to bgfx/shaders/gles/chains/xbr-lv2-fast/vs_blit.bin index c0f4dfa5a88..9dd618de8a0 100644 Binary files a/bgfx/shaders/gles/chains/pillarbox_right_vertical/vs_saturation.bin and b/bgfx/shaders/gles/chains/xbr-lv2-fast/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv2-multipass/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-multipass/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv2-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv2-multipass/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-multipass/vs_blit.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv2-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv2-noblend/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-noblend/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv2-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv2-noblend/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv2-noblend/vs_blit.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv2-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv3-multipass/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv3-multipass/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv3-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv3-multipass/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv3-multipass/vs_blit.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv3-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv3-noblend/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv3-noblend/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv3-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv3-noblend/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv3-noblend/vs_blit.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv3-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv3/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv3/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv3/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-lv3/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-lv3/vs_blit.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-lv3/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-mlv4-dilation/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-mlv4-dilation/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-mlv4-dilation/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-mlv4-dilation/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-mlv4-dilation/vs_blit.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-mlv4-dilation/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-mlv4-multipass/fs_blit.bin b/bgfx/shaders/gles/chains/xbr-mlv4-multipass/fs_blit.bin new file mode 100644 index 00000000000..22e2f0c23d0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-mlv4-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr-mlv4-multipass/vs_blit.bin b/bgfx/shaders/gles/chains/xbr-mlv4-multipass/vs_blit.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr-mlv4-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/fs_xbr-lv1-noblend.bin b/bgfx/shaders/gles/chains/xbr/fs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..2a18147115f Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/fs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2-3d.bin b/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..9643a265714 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2-fast.bin b/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..fb0ee7104e3 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2.bin b/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2.bin new file mode 100644 index 00000000000..c5dcd103244 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/fs_xbr-lv2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..f9c7ad41d1d Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..ce19da70ec3 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..37b5ee12682 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..6585387ce7a Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..02aba5a0cba Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..d645bdf002c Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..1914c61410f Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..ce19da70ec3 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..b5e7f16543d Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..a98de1025c7 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..82036f8a21f Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..b2fec3f1fb6 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..9409cfb2a61 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass0.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass0.bin new file mode 100644 index 00000000000..ac71cdeef2c Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass1.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass1.bin new file mode 100644 index 00000000000..900a4e701a5 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass2.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass2.bin new file mode 100644 index 00000000000..f1995dd122c Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/fs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..d4df7ec9ee3 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..d4df7ec9ee3 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..d4df7ec9ee3 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass0.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass0.bin new file mode 100644 index 00000000000..39c4b239b8a Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass1.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass1.bin new file mode 100644 index 00000000000..9dd618de8a0 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass2.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass2.bin new file mode 100644 index 00000000000..d4df7ec9ee3 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass3.bin b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass3.bin new file mode 100644 index 00000000000..d4df7ec9ee3 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/super-xbr/vs_super-xbr-pass3.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/vs_xbr-lv1-noblend.bin b/bgfx/shaders/gles/chains/xbr/vs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..5769d6ff5d8 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/vs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2-3d.bin b/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..185547625c4 Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2-fast.bin b/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..2d62e84953e Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2.bin b/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2.bin new file mode 100644 index 00000000000..dd851ddde0a Binary files /dev/null and b/bgfx/shaders/gles/chains/xbr/vs_xbr-lv2.bin differ diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_post.bin b/bgfx/shaders/glsl/chains/hlsl/fs_post.bin index 4af086c0e8b..74c98b2d949 100644 Binary files a/bgfx/shaders/glsl/chains/hlsl/fs_post.bin and b/bgfx/shaders/glsl/chains/hlsl/fs_post.bin differ diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_blit.bin b/bgfx/shaders/glsl/chains/misc/fs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/hlsl/fs_blit.bin rename to bgfx/shaders/glsl/chains/misc/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/misc/fs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/glsl/chains/misc/fs_bob-and-ghost-deinterlace.bin new file mode 100644 index 00000000000..d8a1d3f3c6d Binary files /dev/null and b/bgfx/shaders/glsl/chains/misc/fs_bob-and-ghost-deinterlace.bin differ diff --git a/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass0.bin b/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass0.bin new file mode 100644 index 00000000000..c7188eec839 Binary files /dev/null and b/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass1.bin b/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass1.bin new file mode 100644 index 00000000000..68a47c3243f Binary files /dev/null and b/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/fs_saturation.bin b/bgfx/shaders/glsl/chains/misc/fs_saturation.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_left_horizontal/fs_saturation.bin rename to bgfx/shaders/glsl/chains/misc/fs_saturation.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_blit.bin b/bgfx/shaders/glsl/chains/misc/vs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/hlsl/vs_blit.bin rename to bgfx/shaders/glsl/chains/misc/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/hq2x/vs_blit.bin b/bgfx/shaders/glsl/chains/misc/vs_bob-and-ghost-deinterlace.bin similarity index 100% rename from bgfx/shaders/glsl/chains/hq2x/vs_blit.bin rename to bgfx/shaders/glsl/chains/misc/vs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass0.bin b/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass0.bin new file mode 100644 index 00000000000..e6cfefbd74f Binary files /dev/null and b/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass1.bin b/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass1.bin new file mode 100644 index 00000000000..af4ba2d7538 Binary files /dev/null and b/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_saturation.bin b/bgfx/shaders/glsl/chains/misc/vs_saturation.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_saturation.bin rename to bgfx/shaders/glsl/chains/misc/vs_saturation.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_saturation.bin b/bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_saturation.bin deleted file mode 100644 index 4a3f80b56b9..00000000000 Binary files a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_saturation.bin b/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_saturation.bin deleted file mode 100644 index 4a3f80b56b9..00000000000 Binary files a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_saturation.bin b/bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_saturation.bin deleted file mode 100644 index 4a3f80b56b9..00000000000 Binary files a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_saturation.bin and /dev/null differ diff --git a/bgfx/shaders/glsl/chains/hq2x/fs_blit.bin b/bgfx/shaders/glsl/chains/super-4xbr-3d-4p/fs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/hq2x/fs_blit.bin rename to bgfx/shaders/glsl/chains/super-4xbr-3d-4p/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/hq3x/vs_blit.bin b/bgfx/shaders/glsl/chains/super-4xbr-3d-4p/vs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/hq3x/vs_blit.bin rename to bgfx/shaders/glsl/chains/super-4xbr-3d-4p/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/hq3x/fs_blit.bin b/bgfx/shaders/glsl/chains/super-4xbr-3d-6p-smoother/fs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/hq3x/fs_blit.bin rename to bgfx/shaders/glsl/chains/super-4xbr-3d-6p-smoother/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/hq4x/vs_blit.bin b/bgfx/shaders/glsl/chains/super-4xbr-3d-6p-smoother/vs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/hq4x/vs_blit.bin rename to bgfx/shaders/glsl/chains/super-4xbr-3d-6p-smoother/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/hq4x/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-hybrid/fs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/hq4x/fs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-hybrid/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-hybrid/vs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-hybrid/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv1-noblend/fs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_left_horizontal/fs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-lv1-noblend/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv1-noblend/vs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-lv1-noblend/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-3d/fs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-lv2-3d/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-3d/vs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-lv2-3d/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-accuracy-multipass/fs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-lv2-accuracy-multipass/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-accuracy-multipass/vs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-lv2-accuracy-multipass/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin similarity index 100% rename from bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_blit.bin rename to bgfx/shaders/glsl/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_saturation.bin b/bgfx/shaders/glsl/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin similarity index 72% rename from bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_saturation.bin rename to bgfx/shaders/glsl/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin index 061d861b6ed..af6c9349f41 100644 Binary files a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_saturation.bin and b/bgfx/shaders/glsl/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv2-deposterize/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-deposterize/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv2-deposterize/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_saturation.bin b/bgfx/shaders/glsl/chains/xbr-lv2-deposterize/vs_blit.bin similarity index 72% rename from bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_saturation.bin rename to bgfx/shaders/glsl/chains/xbr-lv2-deposterize/vs_blit.bin index c25635af5a8..af6c9349f41 100644 Binary files a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_saturation.bin and b/bgfx/shaders/glsl/chains/xbr-lv2-deposterize/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv2-fast/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-fast/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv2-fast/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_saturation.bin b/bgfx/shaders/glsl/chains/xbr-lv2-fast/vs_blit.bin similarity index 70% rename from bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_saturation.bin rename to bgfx/shaders/glsl/chains/xbr-lv2-fast/vs_blit.bin index 3b5a651f2e7..af6c9349f41 100644 Binary files a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_saturation.bin and b/bgfx/shaders/glsl/chains/xbr-lv2-fast/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv2-multipass/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-multipass/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv2-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv2-multipass/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-multipass/vs_blit.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv2-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv2-noblend/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-noblend/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv2-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv2-noblend/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv2-noblend/vs_blit.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv2-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv3-multipass/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv3-multipass/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv3-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv3-multipass/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv3-multipass/vs_blit.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv3-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv3-noblend/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv3-noblend/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv3-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv3-noblend/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv3-noblend/vs_blit.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv3-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv3/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv3/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv3/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-lv3/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-lv3/vs_blit.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-lv3/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-mlv4-dilation/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-mlv4-dilation/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-mlv4-dilation/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-mlv4-dilation/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-mlv4-dilation/vs_blit.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-mlv4-dilation/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-mlv4-multipass/fs_blit.bin b/bgfx/shaders/glsl/chains/xbr-mlv4-multipass/fs_blit.bin new file mode 100644 index 00000000000..db0fe2b487b Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-mlv4-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr-mlv4-multipass/vs_blit.bin b/bgfx/shaders/glsl/chains/xbr-mlv4-multipass/vs_blit.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr-mlv4-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv1-noblend.bin b/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..e4fa0a459fd Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-3d.bin b/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..5e23d658855 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-fast.bin b/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..a7b48e65fc8 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2.bin b/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2.bin new file mode 100644 index 00000000000..b1e84120d4d Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..26a3506b7cb Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..c7894d1d0e8 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..8f61bc0c5e3 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..c8900a657ea Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..82be16250c1 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..bf6c4a886f6 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..e2254725353 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..c7894d1d0e8 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..1c1d4030496 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..d855fb47c25 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..66054016ff4 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..43fc6074d13 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..2652cdee73e Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass0.bin new file mode 100644 index 00000000000..f2b5b97387a Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin new file mode 100644 index 00000000000..a78563e0ceb Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass2.bin new file mode 100644 index 00000000000..3d66ef7f690 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..289f01ddd34 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..289f01ddd34 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..289f01ddd34 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass0.bin new file mode 100644 index 00000000000..061a6627b32 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin new file mode 100644 index 00000000000..af6c9349f41 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass2.bin new file mode 100644 index 00000000000..289f01ddd34 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass3.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass3.bin new file mode 100644 index 00000000000..289f01ddd34 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass3.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv1-noblend.bin b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..93b681dd926 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-3d.bin b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..d0293824b94 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-fast.bin b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..c034943e250 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2.bin b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2.bin new file mode 100644 index 00000000000..d8d081a91d0 Binary files /dev/null and b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2.bin differ diff --git a/bgfx/shaders/metal/chains/hlsl/fs_post.bin b/bgfx/shaders/metal/chains/hlsl/fs_post.bin index 3b137b24671..4ccc6e11b7b 100644 Binary files a/bgfx/shaders/metal/chains/hlsl/fs_post.bin and b/bgfx/shaders/metal/chains/hlsl/fs_post.bin differ diff --git a/bgfx/shaders/metal/chains/hlsl/fs_blit.bin b/bgfx/shaders/metal/chains/misc/fs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/hlsl/fs_blit.bin rename to bgfx/shaders/metal/chains/misc/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/misc/fs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/metal/chains/misc/fs_bob-and-ghost-deinterlace.bin new file mode 100644 index 00000000000..d8c81a9a23c Binary files /dev/null and b/bgfx/shaders/metal/chains/misc/fs_bob-and-ghost-deinterlace.bin differ diff --git a/bgfx/shaders/metal/chains/misc/fs_deposterize-pass0.bin b/bgfx/shaders/metal/chains/misc/fs_deposterize-pass0.bin new file mode 100644 index 00000000000..e33c9cc3f2d Binary files /dev/null and b/bgfx/shaders/metal/chains/misc/fs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/misc/fs_deposterize-pass1.bin b/bgfx/shaders/metal/chains/misc/fs_deposterize-pass1.bin new file mode 100644 index 00000000000..a724de4ed3e Binary files /dev/null and b/bgfx/shaders/metal/chains/misc/fs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_saturation.bin b/bgfx/shaders/metal/chains/misc/fs_saturation.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_saturation.bin rename to bgfx/shaders/metal/chains/misc/fs_saturation.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_blit.bin b/bgfx/shaders/metal/chains/misc/vs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/hlsl/vs_blit.bin rename to bgfx/shaders/metal/chains/misc/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/hq2x/vs_blit.bin b/bgfx/shaders/metal/chains/misc/vs_bob-and-ghost-deinterlace.bin similarity index 100% rename from bgfx/shaders/metal/chains/hq2x/vs_blit.bin rename to bgfx/shaders/metal/chains/misc/vs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/metal/chains/misc/vs_deposterize-pass0.bin b/bgfx/shaders/metal/chains/misc/vs_deposterize-pass0.bin new file mode 100644 index 00000000000..45cb2ff444d Binary files /dev/null and b/bgfx/shaders/metal/chains/misc/vs_deposterize-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/misc/vs_deposterize-pass1.bin b/bgfx/shaders/metal/chains/misc/vs_deposterize-pass1.bin new file mode 100644 index 00000000000..abf0c3febb1 Binary files /dev/null and b/bgfx/shaders/metal/chains/misc/vs_deposterize-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_saturation.bin b/bgfx/shaders/metal/chains/misc/vs_saturation.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_saturation.bin rename to bgfx/shaders/metal/chains/misc/vs_saturation.bin diff --git a/bgfx/shaders/metal/chains/hq2x/fs_blit.bin b/bgfx/shaders/metal/chains/super-4xbr-3d-4p/fs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/hq2x/fs_blit.bin rename to bgfx/shaders/metal/chains/super-4xbr-3d-4p/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/hq3x/vs_blit.bin b/bgfx/shaders/metal/chains/super-4xbr-3d-4p/vs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/hq3x/vs_blit.bin rename to bgfx/shaders/metal/chains/super-4xbr-3d-4p/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/hq3x/fs_blit.bin b/bgfx/shaders/metal/chains/super-4xbr-3d-6p-smoother/fs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/hq3x/fs_blit.bin rename to bgfx/shaders/metal/chains/super-4xbr-3d-6p-smoother/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/hq4x/vs_blit.bin b/bgfx/shaders/metal/chains/super-4xbr-3d-6p-smoother/vs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/hq4x/vs_blit.bin rename to bgfx/shaders/metal/chains/super-4xbr-3d-6p-smoother/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/hq4x/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-hybrid/fs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/hq4x/fs_blit.bin rename to bgfx/shaders/metal/chains/xbr-hybrid/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-hybrid/vs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_blit.bin rename to bgfx/shaders/metal/chains/xbr-hybrid/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv1-noblend/fs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_blit.bin rename to bgfx/shaders/metal/chains/xbr-lv1-noblend/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv1-noblend/vs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_blit.bin rename to bgfx/shaders/metal/chains/xbr-lv1-noblend/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv2-3d/fs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_blit.bin rename to bgfx/shaders/metal/chains/xbr-lv2-3d/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv2-3d/vs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_blit.bin rename to bgfx/shaders/metal/chains/xbr-lv2-3d/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv2-accuracy-multipass/fs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_blit.bin rename to bgfx/shaders/metal/chains/xbr-lv2-accuracy-multipass/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv2-accuracy-multipass/vs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_blit.bin rename to bgfx/shaders/metal/chains/xbr-lv2-accuracy-multipass/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin similarity index 100% rename from bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_blit.bin rename to bgfx/shaders/metal/chains/xbr-lv2-accuracy-smart-blur/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_saturation.bin b/bgfx/shaders/metal/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin similarity index 84% rename from bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_saturation.bin rename to bgfx/shaders/metal/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin index 79234729f36..122b7dee5c3 100644 Binary files a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_saturation.bin and b/bgfx/shaders/metal/chains/xbr-lv2-accuracy-smart-blur/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_saturation.bin b/bgfx/shaders/metal/chains/xbr-lv2-deposterize/fs_blit.bin similarity index 60% rename from bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_saturation.bin rename to bgfx/shaders/metal/chains/xbr-lv2-deposterize/fs_blit.bin index de6ec5972af..6a3da392480 100644 Binary files a/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_saturation.bin and b/bgfx/shaders/metal/chains/xbr-lv2-deposterize/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_saturation.bin b/bgfx/shaders/metal/chains/xbr-lv2-deposterize/vs_blit.bin similarity index 84% rename from bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_saturation.bin rename to bgfx/shaders/metal/chains/xbr-lv2-deposterize/vs_blit.bin index efd3de32003..122b7dee5c3 100644 Binary files a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_saturation.bin and b/bgfx/shaders/metal/chains/xbr-lv2-deposterize/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_saturation.bin b/bgfx/shaders/metal/chains/xbr-lv2-fast/fs_blit.bin similarity index 60% rename from bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_saturation.bin rename to bgfx/shaders/metal/chains/xbr-lv2-fast/fs_blit.bin index de6ec5972af..6a3da392480 100644 Binary files a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_saturation.bin and b/bgfx/shaders/metal/chains/xbr-lv2-fast/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_saturation.bin b/bgfx/shaders/metal/chains/xbr-lv2-fast/vs_blit.bin similarity index 83% rename from bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_saturation.bin rename to bgfx/shaders/metal/chains/xbr-lv2-fast/vs_blit.bin index 5fdb790c191..122b7dee5c3 100644 Binary files a/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_saturation.bin and b/bgfx/shaders/metal/chains/xbr-lv2-fast/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_saturation.bin b/bgfx/shaders/metal/chains/xbr-lv2-multipass/fs_blit.bin similarity index 60% rename from bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_saturation.bin rename to bgfx/shaders/metal/chains/xbr-lv2-multipass/fs_blit.bin index de6ec5972af..6a3da392480 100644 Binary files a/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_saturation.bin and b/bgfx/shaders/metal/chains/xbr-lv2-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv2-multipass/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv2-multipass/vs_blit.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv2-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv2-noblend/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv2-noblend/fs_blit.bin new file mode 100644 index 00000000000..6a3da392480 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv2-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv2-noblend/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv2-noblend/vs_blit.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv2-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv3-multipass/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv3-multipass/fs_blit.bin new file mode 100644 index 00000000000..6a3da392480 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv3-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv3-multipass/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv3-multipass/vs_blit.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv3-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv3-noblend/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv3-noblend/fs_blit.bin new file mode 100644 index 00000000000..6a3da392480 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv3-noblend/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv3-noblend/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv3-noblend/vs_blit.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv3-noblend/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv3/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv3/fs_blit.bin new file mode 100644 index 00000000000..6a3da392480 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv3/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-lv3/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-lv3/vs_blit.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-lv3/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-mlv4-dilation/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-mlv4-dilation/fs_blit.bin new file mode 100644 index 00000000000..6a3da392480 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-mlv4-dilation/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-mlv4-dilation/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-mlv4-dilation/vs_blit.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-mlv4-dilation/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-mlv4-multipass/fs_blit.bin b/bgfx/shaders/metal/chains/xbr-mlv4-multipass/fs_blit.bin new file mode 100644 index 00000000000..6a3da392480 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-mlv4-multipass/fs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr-mlv4-multipass/vs_blit.bin b/bgfx/shaders/metal/chains/xbr-mlv4-multipass/vs_blit.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr-mlv4-multipass/vs_blit.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv1-noblend.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..e3478fe89b7 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-3d.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..d75cfa36ae6 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-fast.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..c773ee30579 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2.bin new file mode 100644 index 00000000000..17ed3b98257 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..999ab79ad37 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..0d231ef85fa Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..f2e63cf659f Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..5b35b08f29d Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..f0929f4c7c0 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..89776463420 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..f896d5e76a4 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..0d231ef85fa Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..57c6d656e1d Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..8085924f05a Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..bef91b392f0 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..057237ba0b6 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..3699abfcb15 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass0.bin new file mode 100644 index 00000000000..27effe92acf Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass1.bin new file mode 100644 index 00000000000..5a8c8ade818 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass2.bin new file mode 100644 index 00000000000..f0233e0a125 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin new file mode 100644 index 00000000000..733645f988d Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin new file mode 100644 index 00000000000..733645f988d Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin new file mode 100644 index 00000000000..733645f988d Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass0.bin new file mode 100644 index 00000000000..88af9111c90 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass0.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass1.bin new file mode 100644 index 00000000000..122b7dee5c3 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass1.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass2.bin new file mode 100644 index 00000000000..733645f988d Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass2.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass3.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass3.bin new file mode 100644 index 00000000000..733645f988d Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass3.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv1-noblend.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv1-noblend.bin new file mode 100644 index 00000000000..da9289ef365 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv1-noblend.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-3d.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-3d.bin new file mode 100644 index 00000000000..ac61b8453f0 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-3d.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-fast.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-fast.bin new file mode 100644 index 00000000000..4bd75b98140 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-fast.bin differ diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2.bin new file mode 100644 index 00000000000..f39ca902371 Binary files /dev/null and b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2.bin differ diff --git a/hlsl/post.fx b/hlsl/post.fx index 1ef59fcca39..f0babe68bca 100644 --- a/hlsl/post.fx +++ b/hlsl/post.fx @@ -147,7 +147,7 @@ float2 GetAdjustedCoords(float2 coord, float2 centerOffset) coord -= centerOffset; // apply screen scale - coord /= ScreenScale; + coord *= ScreenScale; // un-center coordinates coord += centerOffset; diff --git a/makefile b/makefile index 18a6526375d..04db4cc6942 100644 --- a/makefile +++ b/makefile @@ -1589,7 +1589,7 @@ shaders: bgfx-tools -$(call MKDIR,build/bgfx/shaders/gles) -$(call MKDIR,build/bgfx/shaders/glsl) -$(call MKDIR,build/bgfx/shaders/metal) - $(SILENT) $(MAKE) -C $(SRC)/osd/modules/render/bgfx/shaders rebuild + $(SILENT) $(MAKE) -C $(SRC)/osd/modules/render/bgfx/shaders rebuild CHAIN="$(CHAIN)" #------------------------------------------------- # Translation diff --git a/scripts/genie.lua b/scripts/genie.lua index 8b7f32703c3..f290dfde9e9 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -520,17 +520,6 @@ if (_OPTIONS["SOURCES"] == nil) then dofile (path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua")) end - -if _OPTIONS["IGNORE_GIT"]~="1" then - GIT_VERSION = backtick( "git describe" ) - local p = string.find(GIT_VERSION, '-', 1) - if (p~=nil) then - defines { - "GIT_VERSION=" .. string.sub(GIT_VERSION,p+1) - } - end -end - configuration { "gmake" } flags { "SingleOutputDir", diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 78032cabff0..cd9923ea1fc 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1964,6 +1964,8 @@ if (BUSES["NEOGEO_CTRL"]~=null) then MAME_DIR .. "src/devices/bus/neogeo_ctrl/mahjong.h", MAME_DIR .. "src/devices/bus/neogeo_ctrl/dial.cpp", MAME_DIR .. "src/devices/bus/neogeo_ctrl/dial.h", + MAME_DIR .. "src/devices/bus/neogeo_ctrl/irrmaze.cpp", + MAME_DIR .. "src/devices/bus/neogeo_ctrl/irrmaze.h", MAME_DIR .. "src/devices/bus/neogeo_ctrl/kizuna4p.cpp", MAME_DIR .. "src/devices/bus/neogeo_ctrl/kizuna4p.h", } diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 3a52b985411..3b07a69211c 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -136,7 +136,17 @@ end end configuration { } - + +if _OPTIONS["IGNORE_GIT"]~="1" then + GIT_VERSION = backtick( "git describe --dirty" ) + local p = string.find(GIT_VERSION, '-', 1) + if (p~=nil) then + defines { + "GIT_VERSION=" .. string.sub(GIT_VERSION,p+1) + } + end +end + if _OPTIONS["targetos"]=="android" then includedirs { MAME_DIR .. "3rdparty/SDL2/include", diff --git a/src/devices/bus/neogeo_ctrl/ctrl.cpp b/src/devices/bus/neogeo_ctrl/ctrl.cpp index 74d0c10586f..bdfeb657065 100644 --- a/src/devices/bus/neogeo_ctrl/ctrl.cpp +++ b/src/devices/bus/neogeo_ctrl/ctrl.cpp @@ -3,6 +3,16 @@ /********************************************************************** SNK Neo Geo Controller Port emulation + + This actually covers two separate piece of hardware of Neo Geo system: + - The 15-pin controller ports that are used for controllers in the + AES home system and for mahjong controllers in the MVS arcade PCB + - The controller part of the main edge connector that is used for + joystick inputs in the MVS arcade PCB + + Technically, the latter is not a configurable slot, because it's not + a component that arcade operators could simply change with a different + controller, but this implementation allows for simpler code. **********************************************************************/ @@ -11,6 +21,7 @@ #include "joystick.h" #include "mahjong.h" #include "dial.h" +#include "irrmaze.h" #include "kizuna4p.h" @@ -19,6 +30,7 @@ //************************************************************************** const device_type NEOGEO_CONTROL_PORT = &device_creator; +const device_type NEOGEO_CTRL_EDGE_CONNECTOR = &device_creator; //************************************************************************** @@ -44,6 +56,25 @@ device_neogeo_control_port_interface::~device_neogeo_control_port_interface() { } +//------------------------------------------------- +// device_neogeo_ctrl_edge_interface - constructor +//------------------------------------------------- + +device_neogeo_ctrl_edge_interface::device_neogeo_ctrl_edge_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig,device) +{ + m_port = dynamic_cast(device.owner()); +} + + +//------------------------------------------------- +// ~device_neogeo_ctrl_edge_interface - destructor +//------------------------------------------------- + +device_neogeo_ctrl_edge_interface::~device_neogeo_ctrl_edge_interface() +{ +} + //************************************************************************** // LIVE DEVICE @@ -81,17 +112,17 @@ void neogeo_control_port_device::device_start() UINT8 neogeo_control_port_device::read_ctrl() { - UINT8 data = 0; + UINT8 data = 0xff; if (m_device) - data |= m_device->read_ctrl(); + data &= m_device->read_ctrl(); return data; } UINT8 neogeo_control_port_device::read_start_sel() { - UINT8 data = 0; + UINT8 data = 0xff; if (m_device) - data |= m_device->read_start_sel(); + data &= m_device->read_start_sel(); return data; } @@ -103,6 +134,68 @@ void neogeo_control_port_device::write_ctrlsel(UINT8 data) } +//------------------------------------------------- +// neogeo_ctrl_edge_port_device - constructor +//------------------------------------------------- + +neogeo_ctrl_edge_port_device::neogeo_ctrl_edge_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEOGEO_CTRL_EDGE_CONNECTOR, "SNK Neo Geo Edge Connector (Controller)", tag, owner, clock, "neogeo_ctrl_edge", __FILE__), + device_slot_interface(mconfig, *this), m_device(nullptr) +{ +} + + +//------------------------------------------------- +// ~neogeo_ctrl_edge_port_device - destructor +//------------------------------------------------- + +neogeo_ctrl_edge_port_device::~neogeo_ctrl_edge_port_device() +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void neogeo_ctrl_edge_port_device::device_start() +{ + m_device = dynamic_cast(get_card_device()); +} + + +READ8_MEMBER(neogeo_ctrl_edge_port_device::in0_r) +{ + UINT8 data = 0xff; + if (m_device) + data &= m_device->in0_r(space, offset, mem_mask); + return data; +} + +READ8_MEMBER(neogeo_ctrl_edge_port_device::in1_r) +{ + UINT8 data = 0xff; + if (m_device) + data &= m_device->in1_r(space, offset, mem_mask); + return data; +} + +UINT8 neogeo_ctrl_edge_port_device::read_start_sel() +{ + UINT8 data = 0xff; + if (m_device) + data &= m_device->read_start_sel(); + return data; +} + +void neogeo_ctrl_edge_port_device::write_ctrlsel(UINT8 data) +{ + if (m_device) + m_device->write_ctrlsel(data); +} + + + //------------------------------------------------- // SLOT_INTERFACE( neogeo_control_port_devices ) //------------------------------------------------- @@ -112,12 +205,18 @@ SLOT_INTERFACE_START( neogeo_controls ) SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL) SLOT_INTERFACE_END -SLOT_INTERFACE_START( neogeo_arc_ctrls ) +SLOT_INTERFACE_START( neogeo_arc_edge ) SLOT_INTERFACE("joy", NEOGEO_JOY_AC) - SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL_AC) - SLOT_INTERFACE("dial", NEOGEO_DIAL) SLOT_INTERFACE_END -SLOT_INTERFACE_START( neogeo_kiz4p ) - SLOT_INTERFACE("kiz4p", NEOGEO_KIZ4P) +SLOT_INTERFACE_START( neogeo_arc_edge_fixed ) + SLOT_INTERFACE("joy", NEOGEO_JOY_AC) + SLOT_INTERFACE("dial", NEOGEO_DIAL) + SLOT_INTERFACE("irrmaze", NEOGEO_IRRMAZE) + SLOT_INTERFACE("kiz4p", NEOGEO_KIZ4P) SLOT_INTERFACE_END + +SLOT_INTERFACE_START( neogeo_arc_pin15 ) + SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL) +SLOT_INTERFACE_END + diff --git a/src/devices/bus/neogeo_ctrl/ctrl.h b/src/devices/bus/neogeo_ctrl/ctrl.h index 0505d35d3eb..437dc8addd3 100644 --- a/src/devices/bus/neogeo_ctrl/ctrl.h +++ b/src/devices/bus/neogeo_ctrl/ctrl.h @@ -19,6 +19,7 @@ //************************************************************************** class neogeo_control_port_device; +class neogeo_ctrl_edge_port_device; // ======================> device_neogeo_control_port_interface @@ -60,8 +61,50 @@ protected: }; +// ======================> device_neogeo_ctrl_edge_interface + +class device_neogeo_ctrl_edge_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_neogeo_ctrl_edge_interface(const machine_config &mconfig, device_t &device); + virtual ~device_neogeo_ctrl_edge_interface(); + + virtual UINT8 read_start_sel() { return 0xff; } + virtual DECLARE_READ8_MEMBER( in0_r ) { return 0xff; } + virtual DECLARE_READ8_MEMBER( in1_r ) { return 0xff; } + virtual void write_ctrlsel(UINT8 data) { } + +protected: + neogeo_ctrl_edge_port_device *m_port; +}; + +// ======================> neogeo_ctrl_edge_port_device + +class neogeo_ctrl_edge_port_device : public device_t, + public device_slot_interface +{ +public: + // construction/destruction + neogeo_ctrl_edge_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~neogeo_ctrl_edge_port_device(); + + UINT8 read_start_sel(); + DECLARE_READ8_MEMBER( in0_r ); + DECLARE_READ8_MEMBER( in1_r ); + void write_ctrlsel(UINT8 data); + +protected: + // device-level overrides + virtual void device_start() override; + + device_neogeo_ctrl_edge_interface *m_device; +}; + + // device type definition extern const device_type NEOGEO_CONTROL_PORT; +extern const device_type NEOGEO_CTRL_EDGE_CONNECTOR; //************************************************************************** @@ -72,11 +115,16 @@ extern const device_type NEOGEO_CONTROL_PORT; MCFG_DEVICE_ADD(_tag, NEOGEO_CONTROL_PORT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) +#define MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD(_tag, _slot_intf, _def_slot, _fixed) \ + MCFG_DEVICE_ADD(_tag, NEOGEO_CTRL_EDGE_CONNECTOR, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) + SLOT_INTERFACE_EXTERN( neogeo_controls ); -SLOT_INTERFACE_EXTERN( neogeo_arc_ctrls ); -SLOT_INTERFACE_EXTERN( neogeo_kiz4p ); +SLOT_INTERFACE_EXTERN( neogeo_arc_edge ); +SLOT_INTERFACE_EXTERN( neogeo_arc_edge_fixed ); +SLOT_INTERFACE_EXTERN( neogeo_arc_pin15 ); #endif diff --git a/src/devices/bus/neogeo_ctrl/dial.cpp b/src/devices/bus/neogeo_ctrl/dial.cpp index 8276ecdc8ac..046ff1ccd06 100644 --- a/src/devices/bus/neogeo_ctrl/dial.cpp +++ b/src/devices/bus/neogeo_ctrl/dial.cpp @@ -16,17 +16,29 @@ const device_type NEOGEO_DIAL = &device_creator; static INPUT_PORTS_START( neogeo_dial ) - PORT_START("JOY") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x90, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* note it needs it from 0x80 when using paddle */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_START("JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x90, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* note it needs it from 0x80 when using paddle */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) - PORT_START("DIAL") - PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) + PORT_START("JOY2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x90, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* note it needs it from 0x80 when using paddle */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + + PORT_START("DIAL1") + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_PLAYER(1) + + PORT_START("DIAL2") + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_PLAYER(2) INPUT_PORTS_END @@ -50,9 +62,11 @@ ioport_constructor neogeo_dial_device::device_input_ports() const neogeo_dial_device::neogeo_dial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NEOGEO_DIAL, "SNK Neo Geo Dial Controller", tag, owner, clock, "neogeo_dial", __FILE__), - device_neogeo_control_port_interface(mconfig, *this), - m_joy(*this, "JOY"), - m_dial(*this, "DIAL") + device_neogeo_ctrl_edge_interface(mconfig, *this), + m_joy1(*this, "JOY1"), + m_joy2(*this, "JOY2"), + m_dial1(*this, "DIAL1"), + m_dial2(*this, "DIAL2") { } @@ -78,16 +92,31 @@ void neogeo_dial_device::device_reset() //------------------------------------------------- -// read_ctrl +// in0_r //------------------------------------------------- -UINT8 neogeo_dial_device::read_ctrl() +READ8_MEMBER(neogeo_dial_device::in0_r) { UINT8 res = 0; if (m_ctrl_sel & 0x01) - res = m_joy->read(); + res = m_joy1->read(); else - res = m_dial->read(); + res = m_dial1->read(); + + return res; +} + +//------------------------------------------------- +// in1_r +//------------------------------------------------- + +READ8_MEMBER(neogeo_dial_device::in1_r) +{ + UINT8 res = 0; + if (m_ctrl_sel & 0x01) + res = m_joy2->read(); + else + res = m_dial2->read(); return res; } diff --git a/src/devices/bus/neogeo_ctrl/dial.h b/src/devices/bus/neogeo_ctrl/dial.h index ac968ea1136..0c0e07c474d 100644 --- a/src/devices/bus/neogeo_ctrl/dial.h +++ b/src/devices/bus/neogeo_ctrl/dial.h @@ -22,7 +22,7 @@ // ======================> neogeo_dial_device class neogeo_dial_device : public device_t, - public device_neogeo_control_port_interface + public device_neogeo_ctrl_edge_interface { public: // construction/destruction @@ -37,12 +37,15 @@ protected: virtual void device_reset() override; // device_neogeo_control_port_interface overrides - virtual UINT8 read_ctrl() override; + virtual DECLARE_READ8_MEMBER( in0_r ) override; + virtual DECLARE_READ8_MEMBER( in1_r ) override; virtual void write_ctrlsel(UINT8 data) override; private: - required_ioport m_joy; - required_ioport m_dial; + required_ioport m_joy1; + required_ioport m_joy2; + required_ioport m_dial1; + required_ioport m_dial2; UINT8 m_ctrl_sel; }; diff --git a/src/devices/bus/neogeo_ctrl/irrmaze.cpp b/src/devices/bus/neogeo_ctrl/irrmaze.cpp new file mode 100644 index 00000000000..0172d6f86d4 --- /dev/null +++ b/src/devices/bus/neogeo_ctrl/irrmaze.cpp @@ -0,0 +1,114 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +/********************************************************************** + + SNK Neo Geo Irritation Maze Analog Controller emulation + +**********************************************************************/ + +#include "irrmaze.h" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type NEOGEO_IRRMAZE = &device_creator; + + +static INPUT_PORTS_START( neogeo_irrmaze ) + PORT_START("BUTTONS") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + + PORT_START("TRACK_X") + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(20) PORT_REVERSE + + PORT_START("TRACK_Y") + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(20) PORT_REVERSE +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor neogeo_irrmaze_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( neogeo_irrmaze ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// neogeo_irrmaze_device - constructor +//------------------------------------------------- + +neogeo_irrmaze_device::neogeo_irrmaze_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEOGEO_IRRMAZE, "SNK Neo Geo Irritating Maze Analog Controller", tag, owner, clock, "neogeo_irrmaze", __FILE__), + device_neogeo_ctrl_edge_interface(mconfig, *this), + m_tx(*this, "TRACK_X"), + m_ty(*this, "TRACK_Y"), + m_buttons(*this, "BUTTONS") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void neogeo_irrmaze_device::device_start() +{ + save_item(NAME(m_ctrl_sel)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void neogeo_irrmaze_device::device_reset() +{ + m_ctrl_sel = 0; +} + + +//------------------------------------------------- +// in0_r +//------------------------------------------------- + +READ8_MEMBER(neogeo_irrmaze_device::in0_r) +{ + UINT8 res = 0; + if (m_ctrl_sel & 0x01) + res = m_ty->read(); + else + res = m_tx->read(); + + return res; +} + +//------------------------------------------------- +// in1_r +//------------------------------------------------- + +READ8_MEMBER(neogeo_irrmaze_device::in1_r) +{ + return m_buttons->read(); +} + +//------------------------------------------------- +// write_ctrlsel +//------------------------------------------------- + +void neogeo_irrmaze_device::write_ctrlsel(UINT8 data) +{ + m_ctrl_sel = data; +} + diff --git a/src/devices/bus/neogeo_ctrl/irrmaze.h b/src/devices/bus/neogeo_ctrl/irrmaze.h new file mode 100644 index 00000000000..9ec4da5761b --- /dev/null +++ b/src/devices/bus/neogeo_ctrl/irrmaze.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +/********************************************************************** + + SNK Neo Geo Dial controller emulation + +**********************************************************************/ + +#pragma once + +#ifndef __NEOGEO_IRRMAZE__ +#define __NEOGEO_IRRMAZE__ + + +#include "emu.h" +#include "ctrl.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> neogeo_dial_device + +class neogeo_irrmaze_device : public device_t, + public device_neogeo_ctrl_edge_interface +{ +public: + // construction/destruction + neogeo_irrmaze_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_neogeo_control_port_interface overrides + virtual DECLARE_READ8_MEMBER( in0_r ) override; + virtual DECLARE_READ8_MEMBER( in1_r ) override; + virtual void write_ctrlsel(UINT8 data) override; + +private: + required_ioport m_tx; + required_ioport m_ty; + required_ioport m_buttons; + UINT8 m_ctrl_sel; +}; + + + +// device type definition +extern const device_type NEOGEO_IRRMAZE; + + +#endif diff --git a/src/devices/bus/neogeo_ctrl/joystick.cpp b/src/devices/bus/neogeo_ctrl/joystick.cpp index 2c550d0652d..a2a95c7a7e0 100644 --- a/src/devices/bus/neogeo_ctrl/joystick.cpp +++ b/src/devices/bus/neogeo_ctrl/joystick.cpp @@ -8,15 +8,23 @@ #include "joystick.h" + + +/********************************************************************** + + Implementation through the 15-pin controller port (used by AES) + + **********************************************************************/ + + //************************************************************************** // DEVICE DEFINITIONS //************************************************************************** -const device_type NEOGEO_JOY_AC = &device_creator; const device_type NEOGEO_JOY = &device_creator; -static INPUT_PORTS_START( neogeo_joy_ac ) +static INPUT_PORTS_START( neogeo_joy ) PORT_START("JOY") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) @@ -26,11 +34,6 @@ static INPUT_PORTS_START( neogeo_joy_ac ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) -INPUT_PORTS_END - - -static INPUT_PORTS_START( neogeo_joy ) - PORT_INCLUDE( neogeo_joy_ac ) PORT_START("START_SELECT") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START ) @@ -42,11 +45,6 @@ INPUT_PORTS_END // input_ports - device-specific input ports //------------------------------------------------- -ioport_constructor neogeo_joy_ac_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( neogeo_joy_ac ); -} - ioport_constructor neogeo_joystick_device::device_input_ports() const { return INPUT_PORTS_NAME( neogeo_joy ); @@ -58,30 +56,118 @@ ioport_constructor neogeo_joystick_device::device_input_ports() const //************************************************************************** //------------------------------------------------- -// neogeo_joy_ac_device / neogeo_joystick_device - constructor +// neogeo_joystick_device - constructor //------------------------------------------------- -neogeo_joy_ac_device::neogeo_joy_ac_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source): - device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_neogeo_control_port_interface(mconfig, *this), - m_joy(*this, "JOY") -{ -} - -neogeo_joy_ac_device::neogeo_joy_ac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, NEOGEO_JOY_AC, "SNK Neo Geo Arcade Joystick", tag, owner, clock, "neogeo_joyac", __FILE__), - device_neogeo_control_port_interface(mconfig, *this), - m_joy(*this, "JOY") -{ -} - neogeo_joystick_device::neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - neogeo_joy_ac_device(mconfig, NEOGEO_JOY, "SNK Neo Geo Joystick", tag, owner, clock, "neogeo_joy", __FILE__), + device_t(mconfig, NEOGEO_JOY, "SNK Neo Geo Joystick", tag, owner, clock, "neogeo_joy", __FILE__), + device_neogeo_control_port_interface(mconfig, *this), + m_joy(*this, "JOY"), m_ss(*this, "START_SELECT") { } +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void neogeo_joystick_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void neogeo_joystick_device::device_reset() +{ +} + + +//------------------------------------------------- +// read_ctrl +//------------------------------------------------- + +UINT8 neogeo_joystick_device::read_ctrl() +{ + return m_joy->read(); +} + +//------------------------------------------------- +// read_start_sel +//------------------------------------------------- + +UINT8 neogeo_joystick_device::read_start_sel() +{ + return m_ss->read(); +} + + + +/********************************************************************** + + Implementation through the edge connector (used by MVS) and + connecting two controllers + + **********************************************************************/ + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type NEOGEO_JOY_AC = &device_creator; + + +static INPUT_PORTS_START( neogeo_joy_ac ) + PORT_START("JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) + + PORT_START("JOY2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor neogeo_joy_ac_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( neogeo_joy_ac ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// neogeo_joy_ac_device / neogeo_joystick_device - constructor +//------------------------------------------------- + +neogeo_joy_ac_device::neogeo_joy_ac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEOGEO_JOY_AC, "SNK Neo Geo Arcade Joystick", tag, owner, clock, "neogeo_joyac", __FILE__), + device_neogeo_ctrl_edge_interface(mconfig, *this), + m_joy1(*this, "JOY1"), + m_joy2(*this, "JOY2") +{ +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -101,20 +187,20 @@ void neogeo_joy_ac_device::device_reset() //------------------------------------------------- -// read_ctrl +// in0_r //------------------------------------------------- -UINT8 neogeo_joy_ac_device::read_ctrl() +READ8_MEMBER(neogeo_joy_ac_device::in0_r) { - return m_joy->read(); + return m_joy1->read(); } //------------------------------------------------- -// read_start_sel +// in1_r //------------------------------------------------- -UINT8 neogeo_joystick_device::read_start_sel() +READ8_MEMBER(neogeo_joy_ac_device::in1_r) { - return m_ss->read(); + return m_joy2->read(); } diff --git a/src/devices/bus/neogeo_ctrl/joystick.h b/src/devices/bus/neogeo_ctrl/joystick.h index ff084dd7207..4f8ce2a91da 100644 --- a/src/devices/bus/neogeo_ctrl/joystick.h +++ b/src/devices/bus/neogeo_ctrl/joystick.h @@ -19,14 +19,40 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> neogeo_joy_ac_device +// ======================> neogeo_joystick_device -class neogeo_joy_ac_device : public device_t, - public device_neogeo_control_port_interface +class neogeo_joystick_device : public device_t, + public device_neogeo_control_port_interface +{ +public: + // construction/destruction + neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_neogeo_control_port_interface overrides + virtual UINT8 read_ctrl() override; + virtual UINT8 read_start_sel() override; + +private: + required_ioport m_joy; + required_ioport m_ss; +}; + + +// ======================> neogeo_joy_ac_device + +class neogeo_joy_ac_device : public device_t, + public device_neogeo_ctrl_edge_interface { public: // construction/destruction - neogeo_joy_ac_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); neogeo_joy_ac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // optional information overrides @@ -37,37 +63,19 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // device_neogeo_control_port_interface overrides - virtual UINT8 read_ctrl() override; - -private: - required_ioport m_joy; -}; - -// ======================> neogeo_joystick_device - -class neogeo_joystick_device : public neogeo_joy_ac_device -{ -public: - // construction/destruction - neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual ioport_constructor device_input_ports() const override; - -protected: - // device_neogeo_control_port_interface overrides - virtual UINT8 read_start_sel() override; + // device_neogeo_ctrl_edge_interface overrides + virtual DECLARE_READ8_MEMBER( in0_r ) override; + virtual DECLARE_READ8_MEMBER( in1_r ) override; private: - required_ioport m_ss; + required_ioport m_joy1; + required_ioport m_joy2; }; - // device type definition -extern const device_type NEOGEO_JOY_AC; extern const device_type NEOGEO_JOY; +extern const device_type NEOGEO_JOY_AC; #endif diff --git a/src/devices/bus/neogeo_ctrl/kizuna4p.cpp b/src/devices/bus/neogeo_ctrl/kizuna4p.cpp index 097345c8e2e..9a3ef190154 100644 --- a/src/devices/bus/neogeo_ctrl/kizuna4p.cpp +++ b/src/devices/bus/neogeo_ctrl/kizuna4p.cpp @@ -17,28 +17,52 @@ const device_type NEOGEO_KIZ4P = &device_creator; static INPUT_PORTS_START( neogeo_kiz4p ) PORT_START("JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Joy A - Up") PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Joy A - Down") PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Joy A - Left") PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("Joy A - Right") PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Joy A - Button A") PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Joy A - Button B") PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Joy A - Button C") PORT_PLAYER(1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Joy A - Button D") PORT_PLAYER(1) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_START("JOY2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Joy B - Up") PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Joy B - Down") PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Joy B - Left") PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("Joy B - Right") PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Joy B - Button A") PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Joy B - Button B") PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Joy B - Button C") PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Joy B - Button D") PORT_PLAYER(2) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) - PORT_START("START") + PORT_START("JOY3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) + + PORT_START("JOY4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4) + + PORT_START("START13") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START3 ) + + PORT_START("START24") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START4 ) INPUT_PORTS_END @@ -62,10 +86,13 @@ ioport_constructor neogeo_kizuna4p_device::device_input_ports() const neogeo_kizuna4p_device::neogeo_kizuna4p_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NEOGEO_KIZ4P, "SNK Neo Geo Kizuna 4P Controller", tag, owner, clock, "neogeo_kiz4p", __FILE__), - device_neogeo_control_port_interface(mconfig, *this), + device_neogeo_ctrl_edge_interface(mconfig, *this), m_joy1(*this, "JOY1"), m_joy2(*this, "JOY2"), - m_ss(*this, "START") + m_joy3(*this, "JOY3"), + m_joy4(*this, "JOY4"), + m_ss1(*this, "START13"), + m_ss2(*this, "START24") { } @@ -91,23 +118,38 @@ void neogeo_kizuna4p_device::device_reset() //------------------------------------------------- -// read_ctrl +// in0_r //------------------------------------------------- -UINT8 neogeo_kizuna4p_device::read_ctrl() +READ8_MEMBER(neogeo_kizuna4p_device::in0_r) { UINT8 res = 0; - if (m_ctrl_sel & 0x01) - res = m_joy2->read(); + res = m_joy3->read(); else res = m_joy1->read(); if (m_ctrl_sel & 0x04) res &= ((m_ctrl_sel & 0x01) ? ~0x20 : ~0x10); - + return res; } +//------------------------------------------------- +// in1_r +//------------------------------------------------- + +READ8_MEMBER(neogeo_kizuna4p_device::in1_r) +{ + UINT8 res = 0; + if (m_ctrl_sel & 0x01) + res = m_joy4->read(); + else + res = m_joy2->read(); + + if (m_ctrl_sel & 0x04) res &= ((m_ctrl_sel & 0x01) ? ~0x20 : ~0x10); + + return res; +} //------------------------------------------------- // read_start_sel @@ -115,7 +157,7 @@ UINT8 neogeo_kizuna4p_device::read_ctrl() UINT8 neogeo_kizuna4p_device::read_start_sel() { - return BIT(m_ss->read(), m_ctrl_sel & 0x01); + return (BIT(m_ss1->read(), m_ctrl_sel & 0x01)) | (BIT(m_ss2->read(), m_ctrl_sel & 0x01) << 2); } diff --git a/src/devices/bus/neogeo_ctrl/kizuna4p.h b/src/devices/bus/neogeo_ctrl/kizuna4p.h index 36cdbcf1de9..ef4aa1bad36 100644 --- a/src/devices/bus/neogeo_ctrl/kizuna4p.h +++ b/src/devices/bus/neogeo_ctrl/kizuna4p.h @@ -22,7 +22,7 @@ // ======================> neogeo_kizuna4p_device class neogeo_kizuna4p_device : public device_t, - public device_neogeo_control_port_interface + public device_neogeo_ctrl_edge_interface { public: // construction/destruction @@ -37,14 +37,18 @@ protected: virtual void device_reset() override; // device_neogeo_control_port_interface overrides - virtual UINT8 read_ctrl() override; + virtual DECLARE_READ8_MEMBER( in0_r ) override; + virtual DECLARE_READ8_MEMBER( in1_r ) override; virtual UINT8 read_start_sel() override; virtual void write_ctrlsel(UINT8 data) override; private: required_ioport m_joy1; required_ioport m_joy2; - required_ioport m_ss; + required_ioport m_joy3; + required_ioport m_joy4; + required_ioport m_ss1; + required_ioport m_ss2; UINT8 m_ctrl_sel; }; diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp index 835573f2f41..49097f2c016 100644 --- a/src/emu/clifront.cpp +++ b/src/emu/clifront.cpp @@ -159,7 +159,7 @@ cli_frontend::cli_frontend(emu_options &options, osd_interface &osd) cli_frontend::~cli_frontend() { // nuke any device options since they will leak memory - m_options.remove_device_options(); + mame_options::remove_device_options(m_options); } //------------------------------------------------- @@ -177,9 +177,9 @@ int cli_frontend::execute(int argc, char **argv) { // first parse options to be able to get software from it std::string option_errors; - m_options.parse_command_line(argc, argv, option_errors); + mame_options::parse_command_line(m_options,argc, argv, option_errors); - m_options.parse_standard_inis(option_errors); + mame_options::parse_standard_inis(m_options,option_errors); load_translation(m_options); @@ -226,7 +226,7 @@ int cli_frontend::execute(int argc, char **argv) std::string val = string_format("%s:%s:%s", swlistdev.list_name(), m_options.software_name(), swpart.name()); // call this in order to set slot devices according to mounting - m_options.parse_slot_devices(argc, argv, option_errors, image.instance_name(), val.c_str(), &swpart); + mame_options::parse_slot_devices(m_options, argc, argv, option_errors, image.instance_name(), val.c_str(), &swpart); break; } } @@ -249,7 +249,7 @@ int cli_frontend::execute(int argc, char **argv) } // parse the command line, adding any system-specific options - if (!m_options.parse_command_line(argc, argv, option_errors)) + if (!mame_options::parse_command_line(m_options,argc, argv, option_errors)) { // if we failed, check for no command and a system name first; in that case error on the name if (*(m_options.command()) == 0 && m_options.system() == nullptr && *(m_options.system_name()) != 0) @@ -276,7 +276,7 @@ int cli_frontend::execute(int argc, char **argv) if (m_options.read_config()) { m_options.revert(OPTION_PRIORITY_INI); - m_options.parse_standard_inis(option_errors); + mame_options::parse_standard_inis(m_options,option_errors); } if (!option_errors.empty()) osd_printf_error("Error in command line:\n%s\n", strtrimspace(option_errors).c_str()); @@ -1670,7 +1670,7 @@ void cli_frontend::execute_commands(const char *exename) // other commands need the INIs parsed std::string option_errors; - m_options.parse_standard_inis(option_errors); + mame_options::parse_standard_inis(m_options,option_errors); if (!option_errors.empty()) osd_printf_error("%s\n", option_errors.c_str()); diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index d8c04bea283..6e8f267d117 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -225,309 +225,11 @@ emu_options::emu_options() , m_joystick_contradictory(false) , m_sleep(true) , m_refresh_speed(false) -, m_slot_options(0) -, m_device_options(0) { add_entries(emu_options::s_option_entries); } -//------------------------------------------------- -// add_slot_options - add all of the slot -// options for the configured system -//------------------------------------------------- - -bool emu_options::add_slot_options(const software_part *swpart) -{ - // look up the system configured by name; if no match, do nothing - const game_driver *cursystem = system(); - if (cursystem == nullptr) - return false; - - // create the configuration - machine_config config(*cursystem, *this); - - // iterate through all slot devices - int starting_count = options_count(); - for (const device_slot_interface &slot : slot_interface_iterator(config.root_device())) - { - // skip fixed slots - if (slot.fixed()) - continue; - - // retrieve info about the device instance - const char *name = slot.device().tag() + 1; - if (!exists(name)) - { - // first device? add the header as to be pretty - if (m_slot_options++ == 0) - add_entry(nullptr, "SLOT DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); - - // add the option - add_entry(name, nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, slot.default_option(), true); - } - - // allow software lists to supply their own defaults - if (swpart != nullptr) - { - std::string featurename = std::string(name).append("_default"); - const char *value = swpart->feature(featurename.c_str()); - if (value != nullptr && (*value == '\0' || slot.option(value) != nullptr)) - { - // set priority above INIs but below actual command line - std::string error; - set_value(name, value, OPTION_PRIORITY_SUBCMD, error); - } - } - } - return (options_count() != starting_count); -} - - -//------------------------------------------------- -// update_slot_options - update slot values -// depending of image mounted -//------------------------------------------------- - -void emu_options::update_slot_options(const software_part *swpart) -{ - // look up the system configured by name; if no match, do nothing - const game_driver *cursystem = system(); - if (cursystem == nullptr) - return; - machine_config config(*cursystem, *this); - - // iterate through all slot devices - for (device_slot_interface &slot : slot_interface_iterator(config.root_device())) - { - // retrieve info about the device instance - const char *name = slot.device().tag() + 1; - if (exists(name) && !slot.option_list().empty()) - { - std::string defvalue = slot.get_default_card_software(); - if (defvalue.empty()) - { - // keep any non-default setting - if (priority(name) > OPTION_PRIORITY_DEFAULT) - continue; - - // reinstate the actual default value as configured - if (slot.default_option() != nullptr) - defvalue.assign(slot.default_option()); - } - - // set the value and hide the option if not selectable - set_default_value(name, defvalue.c_str()); - const device_slot_option *option = slot.option(defvalue.c_str()); - set_flag(name, ~OPTION_FLAG_INTERNAL, (option != nullptr && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0); - } - } - while (add_slot_options(swpart)) { } - add_device_options(); -} - - -//------------------------------------------------- -// add_device_options - add all of the device -// options for the configured system -//------------------------------------------------- - -void emu_options::add_device_options() -{ - // look up the system configured by name; if no match, do nothing - const game_driver *cursystem = system(); - if (cursystem == nullptr) - return; - machine_config config(*cursystem, *this); - - // iterate through all image devices - for (const device_image_interface &image : image_interface_iterator(config.root_device())) - { - if (!image.user_loadable()) - continue; - - // retrieve info about the device instance - std::ostringstream option_name; - util::stream_format(option_name, "%s;%s", image.instance_name(), image.brief_instance_name()); - if (strcmp(image.device_typename(image.image_type()), image.instance_name()) == 0) - util::stream_format(option_name, ";%s1;%s1", image.instance_name(), image.brief_instance_name()); - - // add the option - if (!exists(image.instance_name())) - { - // first device? add the header as to be pretty - if (m_device_options++ == 0) - add_entry(nullptr, "IMAGE DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); - - // add the option - add_entry(option_name.str().c_str(), nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, nullptr, true); - } - } -} - - -//------------------------------------------------- -// remove_device_options - remove device options -//------------------------------------------------- - -void emu_options::remove_device_options() -{ - // iterate through options and remove interesting ones - entry *nextentry; - for (entry *curentry = first(); curentry != nullptr; curentry = nextentry) - { - // pre-fetch the next entry in case we delete this one - nextentry = curentry->next(); - - // if this is a device option, nuke it - if ((curentry->flags() & OPTION_FLAG_DEVICE) != 0) - remove_entry(*curentry); - } - - // take also care of ramsize options - set_default_value(OPTION_RAMSIZE, ""); - - // reset counters - m_slot_options = 0; - m_device_options = 0; -} - - -//------------------------------------------------- -// parse_slot_devices - parse the command line -// and update slot and image devices -//------------------------------------------------- - -bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value, const software_part *swpart) -{ - // an initial parse to capture the initial set of values - bool result; - - core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - - // keep adding slot options until we stop seeing new stuff - while (add_slot_options(swpart)) - core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - - // add device options and reparse - add_device_options(); - if (name != nullptr && exists(name)) - set_value(name, value, OPTION_PRIORITY_SUBCMD, error_string); - core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - - int num; - do { - num = options_count(); - update_slot_options(swpart); - result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - } while (num != options_count()); - - update_cached_options(); - - return result; -} - - -//------------------------------------------------- -// parse_command_line - parse the command line -// and update the devices -//------------------------------------------------- - -bool emu_options::parse_command_line(int argc, char *argv[], std::string &error_string) -{ - // parse as normal - core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - bool result = parse_slot_devices(argc, argv, error_string); - update_cached_options(); - return result; -} - - -//------------------------------------------------- -// parse_standard_inis - parse the standard set -// of INI files -//------------------------------------------------- - -void emu_options::parse_standard_inis(std::string &error_string, const game_driver *driver) -{ - // start with an empty string - error_string.clear(); - - // parse the INI file defined by the platform (e.g., "mame.ini") - // we do this twice so that the first file can change the INI path - parse_one_ini(emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI); - parse_one_ini(emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI, &error_string); - - // debug mode: parse "debug.ini" as well - if (debug()) - parse_one_ini("debug", OPTION_PRIORITY_DEBUG_INI, &error_string); - - // if we have a valid system driver, parse system-specific INI files - const game_driver *cursystem = (driver == nullptr) ? system() : driver; - if (cursystem == nullptr) - return; - - // parse "vertical.ini" or "horizont.ini" - if (cursystem->flags & ORIENTATION_SWAP_XY) - parse_one_ini("vertical", OPTION_PRIORITY_ORIENTATION_INI, &error_string); - else - parse_one_ini("horizont", OPTION_PRIORITY_ORIENTATION_INI, &error_string); - - if (cursystem->flags & MACHINE_TYPE_ARCADE) - parse_one_ini("arcade", OPTION_PRIORITY_SYSTYPE_INI, &error_string); - else if (cursystem->flags & MACHINE_TYPE_CONSOLE) - parse_one_ini("console", OPTION_PRIORITY_SYSTYPE_INI, &error_string); - else if (cursystem->flags & MACHINE_TYPE_COMPUTER) - parse_one_ini("computer", OPTION_PRIORITY_SYSTYPE_INI, &error_string); - else if (cursystem->flags & MACHINE_TYPE_OTHER) - parse_one_ini("othersys", OPTION_PRIORITY_SYSTYPE_INI, &error_string); - - machine_config config(*cursystem, *this); - for (const screen_device &device : screen_device_iterator(config.root_device())) - { - // parse "raster.ini" for raster games - if (device.screen_type() == SCREEN_TYPE_RASTER) - { - parse_one_ini("raster", OPTION_PRIORITY_SCREEN_INI, &error_string); - break; - } - // parse "vector.ini" for vector games - if (device.screen_type() == SCREEN_TYPE_VECTOR) - { - parse_one_ini("vector", OPTION_PRIORITY_SCREEN_INI, &error_string); - break; - } - // parse "lcd.ini" for lcd games - if (device.screen_type() == SCREEN_TYPE_LCD) - { - parse_one_ini("lcd", OPTION_PRIORITY_SCREEN_INI, &error_string); - break; - } - } - - // next parse "source/.ini"; if that doesn't exist, try .ini - std::string sourcename = core_filename_extract_base(cursystem->source_file, true).insert(0, "source" PATH_SEPARATOR); - if (!parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string)) - { - sourcename = core_filename_extract_base(cursystem->source_file, true); - parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string); - } - - // then parse the grandparent, parent, and system-specific INIs - int parent = driver_list::clone(*cursystem); - int gparent = (parent != -1) ? driver_list::clone(parent) : -1; - if (gparent != -1) - parse_one_ini(driver_list::driver(gparent).name, OPTION_PRIORITY_GPARENT_INI, &error_string); - if (parent != -1) - parse_one_ini(driver_list::driver(parent).name, OPTION_PRIORITY_PARENT_INI, &error_string); - parse_one_ini(cursystem->name, OPTION_PRIORITY_DRIVER_INI, &error_string); - - // Re-evaluate slot options after loading ini files - update_slot_options(); - - update_cached_options(); -} - //------------------------------------------------- // system - return a pointer to the specified @@ -541,117 +243,6 @@ const game_driver *emu_options::system() const } -//------------------------------------------------- -// set_system_name - set a new system name -//------------------------------------------------- - -void emu_options::set_system_name(const char *name) -{ - // remember the original system name - std::string old_system_name(system_name()); - bool new_system = old_system_name.compare(name)!=0; - - // if the system name changed, fix up the device options - if (new_system) - { - // first set the new name - std::string error; - set_value(OPTION_SYSTEMNAME, name, OPTION_PRIORITY_CMDLINE, error); - assert(error.empty()); - - // remove any existing device options - remove_device_options(); - } - else - { - // revert device options set for the old software - revert(OPTION_PRIORITY_SUBCMD, OPTION_PRIORITY_SUBCMD); - } - - // get the new system - const game_driver *cursystem = system(); - if (cursystem == nullptr) - return; - - if (*software_name() != 0) - { - std::string sw_load(software_name()); - std::string sw_list, sw_name, sw_part, sw_instance, error_string; - int left = sw_load.find_first_of(':'); - int middle = sw_load.find_first_of(':', left + 1); - int right = sw_load.find_last_of(':'); - - sw_list = sw_load.substr(0, left - 1); - sw_name = sw_load.substr(left + 1, middle - left - 1); - sw_part = sw_load.substr(middle + 1, right - middle - 1); - sw_instance = sw_load.substr(right + 1); - sw_load.assign(sw_load.substr(0, right)); - - // look up the software part - machine_config config(*cursystem, *this); - software_list_device *swlist = software_list_device::find_by_name(config, sw_list.c_str()); - software_info *swinfo = swlist != nullptr ? swlist->find(sw_name.c_str()) : nullptr; - software_part *swpart = swinfo != nullptr ? swinfo->find_part(sw_part.c_str()) : nullptr; - - // then add the options - if (new_system) - { - while (add_slot_options(swpart)) { } - add_device_options(); - } - - set_value(OPTION_SOFTWARENAME, sw_name.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - if (exists(sw_instance.c_str())) - set_value(sw_instance.c_str(), sw_load.c_str(), OPTION_PRIORITY_SUBCMD, error_string); - - int num; - do { - num = options_count(); - update_slot_options(swpart); - } while(num != options_count()); - } - else if (new_system) - { - // add the options afresh - while (add_slot_options()) { } - add_device_options(); - int num; - do { - num = options_count(); - update_slot_options(); - } while(num != options_count()); - } -} - -//------------------------------------------------- -// parse_one_ini - parse a single INI file -//------------------------------------------------- - -bool emu_options::parse_one_ini(const char *basename, int priority, std::string *error_string) -{ - // don't parse if it has been disabled - if (!read_config()) - return false; - - // open the file; if we fail, that's ok - emu_file file(ini_path(), OPEN_FLAG_READ); - osd_file::error filerr = file.open(basename, ".ini"); - if (filerr != osd_file::error::NONE) - return false; - - // parse the file - osd_printf_verbose("Parsing %s.ini\n", basename); - std::string error; - bool result = parse_ini_file((util::core_file&)file, priority, OPTION_PRIORITY_DRIVER_INI, error); - - // append errors if requested - if (!error.empty() && error_string) - error_string->append(string_format("While parsing %s:\n%s\n", file.fullpath(), error)); - - return result; -} - - std::string emu_options::main_value(const char *name) const { std::string buffer = value(name); @@ -692,3 +283,416 @@ void emu_options::update_cached_options() m_sleep = bool_value(OPTION_SLEEP); m_refresh_speed = bool_value(OPTION_REFRESHSPEED); } + + + + +int mame_options::m_slot_options = 0; +int mame_options::m_device_options = 0; + +//------------------------------------------------- +// add_slot_options - add all of the slot +// options for the configured system +//------------------------------------------------- + +bool mame_options::add_slot_options(emu_options &options, const software_part *swpart) +{ + // look up the system configured by name; if no match, do nothing + const game_driver *cursystem = options.system(); + if (cursystem == nullptr) + return false; + + // create the configuration + machine_config config(*cursystem, options); + + // iterate through all slot devices + int starting_count = options.options_count(); + for (const device_slot_interface &slot : slot_interface_iterator(config.root_device())) + { + // skip fixed slots + if (slot.fixed()) + continue; + + // retrieve info about the device instance + const char *name = slot.device().tag() + 1; + if (!options.exists(name)) + { + // first device? add the header as to be pretty + if (m_slot_options++ == 0) + options.add_entry(nullptr, "SLOT DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); + + // add the option + options.add_entry(name, nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, slot.default_option(), true); + } + + // allow software lists to supply their own defaults + if (swpart != nullptr) + { + std::string featurename = std::string(name).append("_default"); + const char *value = swpart->feature(featurename.c_str()); + if (value != nullptr && (*value == '\0' || slot.option(value) != nullptr)) + { + // set priority above INIs but below actual command line + std::string error; + options.set_value(name, value, OPTION_PRIORITY_SUBCMD, error); + } + } + } + return (options.options_count() != starting_count); +} + + +//------------------------------------------------- +// update_slot_options - update slot values +// depending of image mounted +//------------------------------------------------- + +void mame_options::update_slot_options(emu_options &options, const software_part *swpart) +{ + // look up the system configured by name; if no match, do nothing + const game_driver *cursystem = options.system(); + if (cursystem == nullptr) + return; + machine_config config(*cursystem, options); + + // iterate through all slot devices + for (device_slot_interface &slot : slot_interface_iterator(config.root_device())) + { + // retrieve info about the device instance + const char *name = slot.device().tag() + 1; + if (options.exists(name) && !slot.option_list().empty()) + { + std::string defvalue = slot.get_default_card_software(); + if (defvalue.empty()) + { + // keep any non-default setting + if (options.priority(name) > OPTION_PRIORITY_DEFAULT) + continue; + + // reinstate the actual default value as configured + if (slot.default_option() != nullptr) + defvalue.assign(slot.default_option()); + } + + // set the value and hide the option if not selectable + options.set_default_value(name, defvalue.c_str()); + const device_slot_option *option = slot.option(defvalue.c_str()); + options.set_flag(name, ~OPTION_FLAG_INTERNAL, (option != nullptr && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0); + } + } + while (add_slot_options(options,swpart)) {} + add_device_options(options); +} + + +//------------------------------------------------- +// add_device_options - add all of the device +// options for the configured system +//------------------------------------------------- + +void mame_options::add_device_options(emu_options &options) +{ + // look up the system configured by name; if no match, do nothing + const game_driver *cursystem = options.system(); + if (cursystem == nullptr) + return; + machine_config config(*cursystem, options); + + // iterate through all image devices + for (const device_image_interface &image : image_interface_iterator(config.root_device())) + { + if (!image.user_loadable()) + continue; + + // retrieve info about the device instance + std::ostringstream option_name; + util::stream_format(option_name, "%s;%s", image.instance_name(), image.brief_instance_name()); + if (strcmp(image.device_typename(image.image_type()), image.instance_name()) == 0) + util::stream_format(option_name, ";%s1;%s1", image.instance_name(), image.brief_instance_name()); + + // add the option + if (!options.exists(image.instance_name())) + { + // first device? add the header as to be pretty + if (m_device_options++ == 0) + options.add_entry(nullptr, "IMAGE DEVICES", OPTION_HEADER | OPTION_FLAG_DEVICE); + + // add the option + options.add_entry(option_name.str().c_str(), nullptr, OPTION_STRING | OPTION_FLAG_DEVICE, nullptr, true); + } + } +} + + +//------------------------------------------------- +// remove_device_options - remove device options +//------------------------------------------------- + +void mame_options::remove_device_options(emu_options &options) +{ + // iterate through options and remove interesting ones + core_options::entry *nextentry; + for (auto *curentry = options.first(); curentry != nullptr; curentry = nextentry) + { + // pre-fetch the next entry in case we delete this one + nextentry = curentry->next(); + + // if this is a device option, nuke it + if ((curentry->flags() & OPTION_FLAG_DEVICE) != 0) + options.remove_entry(*curentry); + } + + // take also care of ramsize options + options.set_default_value(OPTION_RAMSIZE, ""); + + // reset counters + m_slot_options = 0; + m_device_options = 0; +} + + +//------------------------------------------------- +// parse_slot_devices - parse the command line +// and update slot and image devices +//------------------------------------------------- + +bool mame_options::parse_slot_devices(emu_options &options, int argc, char *argv[], std::string &error_string, const char *name, const char *value, const software_part *swpart) +{ + // an initial parse to capture the initial set of values + bool result; + + options.parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); + + // keep adding slot options until we stop seeing new stuff + while (add_slot_options(options,swpart)) + options.parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); + + // add device options and reparse + add_device_options(options); + if (name != nullptr && options.exists(name)) + options.set_value(name, value, OPTION_PRIORITY_SUBCMD, error_string); + options.parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); + + int num; + do { + num = options.options_count(); + update_slot_options(options,swpart); + result = options.parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); + } while (num != options.options_count()); + + options.update_cached_options(); + + return result; +} + + +//------------------------------------------------- +// parse_command_line - parse the command line +// and update the devices +//------------------------------------------------- + +bool mame_options::parse_command_line(emu_options &options, int argc, char *argv[], std::string &error_string) +{ + // parse as normal + options.parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); + bool result = parse_slot_devices(options,argc, argv, error_string); + options.update_cached_options(); + return result; +} + + +//------------------------------------------------- +// parse_standard_inis - parse the standard set +// of INI files +//------------------------------------------------- + +void mame_options::parse_standard_inis(emu_options &options, std::string &error_string, const game_driver *driver) +{ + // start with an empty string + error_string.clear(); + + // parse the INI file defined by the platform (e.g., "mame.ini") + // we do this twice so that the first file can change the INI path + parse_one_ini(options,emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI); + parse_one_ini(options,emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI, &error_string); + + // debug mode: parse "debug.ini" as well + if (options.debug()) + parse_one_ini(options,"debug", OPTION_PRIORITY_DEBUG_INI, &error_string); + + // if we have a valid system driver, parse system-specific INI files + const game_driver *cursystem = (driver == nullptr) ? options.system() : driver; + if (cursystem == nullptr) + return; + + // parse "vertical.ini" or "horizont.ini" + if (cursystem->flags & ORIENTATION_SWAP_XY) + parse_one_ini(options,"vertical", OPTION_PRIORITY_ORIENTATION_INI, &error_string); + else + parse_one_ini(options,"horizont", OPTION_PRIORITY_ORIENTATION_INI, &error_string); + + if (cursystem->flags & MACHINE_TYPE_ARCADE) + parse_one_ini(options,"arcade", OPTION_PRIORITY_SYSTYPE_INI, &error_string); + else if (cursystem->flags & MACHINE_TYPE_CONSOLE) + parse_one_ini(options,"console", OPTION_PRIORITY_SYSTYPE_INI, &error_string); + else if (cursystem->flags & MACHINE_TYPE_COMPUTER) + parse_one_ini(options,"computer", OPTION_PRIORITY_SYSTYPE_INI, &error_string); + else if (cursystem->flags & MACHINE_TYPE_OTHER) + parse_one_ini(options,"othersys", OPTION_PRIORITY_SYSTYPE_INI, &error_string); + + machine_config config(*cursystem, options); + for (const screen_device &device : screen_device_iterator(config.root_device())) + { + // parse "raster.ini" for raster games + if (device.screen_type() == SCREEN_TYPE_RASTER) + { + parse_one_ini(options,"raster", OPTION_PRIORITY_SCREEN_INI, &error_string); + break; + } + // parse "vector.ini" for vector games + if (device.screen_type() == SCREEN_TYPE_VECTOR) + { + parse_one_ini(options,"vector", OPTION_PRIORITY_SCREEN_INI, &error_string); + break; + } + // parse "lcd.ini" for lcd games + if (device.screen_type() == SCREEN_TYPE_LCD) + { + parse_one_ini(options,"lcd", OPTION_PRIORITY_SCREEN_INI, &error_string); + break; + } + } + + // next parse "source/.ini"; if that doesn't exist, try .ini + std::string sourcename = core_filename_extract_base(cursystem->source_file, true).insert(0, "source" PATH_SEPARATOR); + if (!parse_one_ini(options,sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string)) + { + sourcename = core_filename_extract_base(cursystem->source_file, true); + parse_one_ini(options,sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string); + } + + // then parse the grandparent, parent, and system-specific INIs + int parent = driver_list::clone(*cursystem); + int gparent = (parent != -1) ? driver_list::clone(parent) : -1; + if (gparent != -1) + parse_one_ini(options,driver_list::driver(gparent).name, OPTION_PRIORITY_GPARENT_INI, &error_string); + if (parent != -1) + parse_one_ini(options,driver_list::driver(parent).name, OPTION_PRIORITY_PARENT_INI, &error_string); + parse_one_ini(options,cursystem->name, OPTION_PRIORITY_DRIVER_INI, &error_string); + + // Re-evaluate slot options after loading ini files + update_slot_options(options); + + options.update_cached_options(); +} + +//------------------------------------------------- +// set_system_name - set a new system name +//------------------------------------------------- + +void mame_options::set_system_name(emu_options &options, const char *name) +{ + // remember the original system name + std::string old_system_name(options.system_name()); + bool new_system = old_system_name.compare(name) != 0; + + // if the system name changed, fix up the device options + if (new_system) + { + // first set the new name + std::string error; + options.set_value(OPTION_SYSTEMNAME, name, OPTION_PRIORITY_CMDLINE, error); + assert(error.empty()); + + // remove any existing device options + remove_device_options(options); + } + else + { + // revert device options set for the old software + options.revert(OPTION_PRIORITY_SUBCMD, OPTION_PRIORITY_SUBCMD); + } + + // get the new system + const game_driver *cursystem = options.system(); + if (cursystem == nullptr) + return; + + if (*options.software_name() != 0) + { + std::string sw_load(options.software_name()); + std::string sw_list, sw_name, sw_part, sw_instance, error_string; + int left = sw_load.find_first_of(':'); + int middle = sw_load.find_first_of(':', left + 1); + int right = sw_load.find_last_of(':'); + + sw_list = sw_load.substr(0, left - 1); + sw_name = sw_load.substr(left + 1, middle - left - 1); + sw_part = sw_load.substr(middle + 1, right - middle - 1); + sw_instance = sw_load.substr(right + 1); + sw_load.assign(sw_load.substr(0, right)); + + // look up the software part + machine_config config(*cursystem, options); + software_list_device *swlist = software_list_device::find_by_name(config, sw_list.c_str()); + software_info *swinfo = swlist != nullptr ? swlist->find(sw_name.c_str()) : nullptr; + software_part *swpart = swinfo != nullptr ? swinfo->find_part(sw_part.c_str()) : nullptr; + + // then add the options + if (new_system) + { + while (add_slot_options(options,swpart)) {} + add_device_options(options); + } + + options.set_value(OPTION_SOFTWARENAME, sw_name.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (options.exists(sw_instance.c_str())) + options.set_value(sw_instance.c_str(), sw_load.c_str(), OPTION_PRIORITY_SUBCMD, error_string); + + int num; + do { + num = options.options_count(); + update_slot_options(options,swpart); + } while (num != options.options_count()); + } + else if (new_system) + { + // add the options afresh + while (add_slot_options(options)) {} + add_device_options(options); + int num; + do { + num = options.options_count(); + update_slot_options(options); + } while (num != options.options_count()); + } +} + +//------------------------------------------------- +// parse_one_ini - parse a single INI file +//------------------------------------------------- + +bool mame_options::parse_one_ini(emu_options &options, const char *basename, int priority, std::string *error_string) +{ + // don't parse if it has been disabled + if (!options.read_config()) + return false; + + // open the file; if we fail, that's ok + emu_file file(options.ini_path(), OPEN_FLAG_READ); + osd_file::error filerr = file.open(basename, ".ini"); + if (filerr != osd_file::error::NONE) + return false; + + // parse the file + osd_printf_verbose("Parsing %s.ini\n", basename); + std::string error; + bool result = options.parse_ini_file((util::core_file&)file, priority, OPTION_PRIORITY_DRIVER_INI, error); + + // append errors if requested + if (!error.empty() && error_string) + error_string->append(string_format("While parsing %s:\n%s\n", file.fullpath(), error)); + + return result; +} + diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index a0e20153241..ccf1738a8c4 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -218,25 +218,43 @@ enum struct game_driver; class software_part; - -class emu_options : public core_options +class mame_options { static const UINT32 OPTION_FLAG_DEVICE = 0x80000000; +public: + // parsing wrappers + static bool parse_command_line(emu_options &options, int argc, char *argv[], std::string &error_string); + static void parse_standard_inis(emu_options &options, std::string &error_string, const game_driver *driver = nullptr); + static bool parse_slot_devices(emu_options &options, int argc, char *argv[], std::string &error_string, const char *name = nullptr, const char *value = nullptr, const software_part *swpart = nullptr); + // FIXME: Couriersud: This should be in image_device_exit + static void remove_device_options(emu_options &options); + + static void set_system_name(emu_options &options, const char *name); + static bool add_slot_options(emu_options &options, const software_part *swpart = nullptr); +private: + // device-specific option handling + static void add_device_options(emu_options &options); + static void update_slot_options(emu_options &options, const software_part *swpart = nullptr); + + // INI parsing helper + static bool parse_one_ini(emu_options &options, const char *basename, int priority, std::string *error_string = nullptr); + + static int m_slot_options; + static int m_device_options; + +}; + +class emu_options : public core_options +{ public: // construction/destruction emu_options(); - // parsing wrappers - bool parse_command_line(int argc, char *argv[], std::string &error_string); - void parse_standard_inis(std::string &error_string, const game_driver *driver = nullptr); - bool parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name = nullptr, const char *value = nullptr, const software_part *swpart = nullptr); - // core options const char *system_name() const { return value(OPTION_SYSTEMNAME); } const char *software_name() const { return value(OPTION_SOFTWARENAME); } const game_driver *system() const; - void set_system_name(const char *name); // core configuration options bool read_config() const { return bool_value(OPTION_READCONFIG); } @@ -405,26 +423,13 @@ public: const char *no_plugin() const { return value(OPTION_NO_PLUGIN); } const char *language() const { return value(OPTION_LANGUAGE); } - - // FIXME: Couriersud: This should be in image_device_exit - void remove_device_options(); - - std::string main_value(const char *option) const; - std::string sub_value(const char *name, const char *subname) const; - bool add_slot_options(const software_part *swpart = nullptr); - - -private: - // device-specific option handling - void add_device_options(); - void update_slot_options(const software_part *swpart = nullptr); - - // INI parsing helper - bool parse_one_ini(const char *basename, int priority, std::string *error_string = nullptr); - + // cache frequently used options in members void update_cached_options(); + std::string main_value(const char *option) const; + std::string sub_value(const char *name, const char *subname) const; +private: static const options_entry s_option_entries[]; // cached options @@ -432,8 +437,6 @@ private: bool m_joystick_contradictory; bool m_sleep; bool m_refresh_speed; - int m_slot_options; - int m_device_options; }; diff --git a/src/emu/info.cpp b/src/emu/info.cpp index 7f64e85b596..9169796f04d 100644 --- a/src/emu/info.cpp +++ b/src/emu/info.cpp @@ -184,7 +184,7 @@ info_xml_creator::info_xml_creator(driver_enumerator &drivlist) m_drivlist(drivlist), m_lookup_options(m_drivlist.options()) { - m_lookup_options.remove_device_options(); + mame_options::remove_device_options(m_lookup_options); } diff --git a/src/emu/mame.cpp b/src/emu/mame.cpp index 3c4b35df058..3ba16963bb7 100644 --- a/src/emu/mame.cpp +++ b/src/emu/mame.cpp @@ -259,7 +259,7 @@ int machine_manager::execute() { m_options.revert(OPTION_PRIORITY_INI); std::string errors; - m_options.parse_standard_inis(errors); + mame_options::parse_standard_inis(m_options,errors); } // otherwise, perform validity checks before anything else @@ -286,12 +286,12 @@ int machine_manager::execute() if (m_new_driver_pending) { // set up new system name and adjust device options accordingly - m_options.set_system_name(m_new_driver_pending->name); + mame_options::set_system_name(m_options,m_new_driver_pending->name); firstrun = true; } else { - if (machine.exit_pending()) m_options.set_system_name(""); + if (machine.exit_pending()) mame_options::set_system_name(m_options,""); } if (machine.exit_pending() && (!started_empty || (system == &GAME_NAME(___empty)))) diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 129ba82b356..27dab8b7189 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -922,7 +922,7 @@ render_target::render_target(render_manager &manager, const internal_layout *lay m_base_orientation(ROT0), m_maxtexwidth(65536), m_maxtexheight(65536), - m_transform_primitives(true) + m_transform_container(true) { // determine the base layer configuration based on options m_base_layerconfig.set_backdrops_enabled(manager.machine().options().use_backdrops()); @@ -1766,7 +1766,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const float yoffs = (container_xform.orientation & ORIENTATION_SWAP_XY) ? container.xoffset() : container.yoffset(); if (container_xform.orientation & ORIENTATION_FLIP_X) xoffs = -xoffs; if (container_xform.orientation & ORIENTATION_FLIP_Y) yoffs = -yoffs; - if (!m_transform_primitives) + if (!m_transform_container) { xscale = 1.0f; yscale = 1.0f; diff --git a/src/emu/render.h b/src/emu/render.h index 6092a37b45a..ccc0c5f6cd7 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -922,7 +922,7 @@ public: void set_orientation(int orientation) { m_orientation = orientation; } void set_view(int viewindex); void set_max_texture_size(int maxwidth, int maxheight); - void set_transform_primitives(bool transform_primitives) { m_transform_primitives = transform_primitives; } + void set_transform_container(bool transform_container) { m_transform_container = transform_container; } void set_keepaspect(bool keepaspect) { m_keepaspect = keepaspect; } void set_scale_mode(bool scale_mode) { m_scale_mode = scale_mode; } @@ -1029,8 +1029,8 @@ private: simple_list m_debug_containers; // list of debug containers INT32 m_clear_extent_count; // number of clear extents INT32 m_clear_extents[MAX_CLEAR_EXTENTS]; // array of clear extents - bool m_transform_primitives; // determines if the primitives shall be scaled/offset by screen settings, - // otherwise the respective render API will handle it (default is true) + bool m_transform_container; // determines whether the screen container is transformed by the core renderer, + // otherwise the respective render API will handle the transformation (scale, offset) static render_screen_list s_empty_screen_list; }; diff --git a/src/emu/ui/auditmenu.cpp b/src/emu/ui/auditmenu.cpp index 5d6ce8fa8d1..70aa5e2f258 100644 --- a/src/emu/ui/auditmenu.cpp +++ b/src/emu/ui/auditmenu.cpp @@ -13,7 +13,6 @@ #include "ui/menu.h" #include "audit.h" #include "ui/auditmenu.h" -#include extern const char UI_VERSION_TAG[]; diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index f2e86eeeca1..42ef567ce02 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -10,14 +10,12 @@ #include "emu.h" #include "emuopts.h" -#include "ui/custui.h" - +#include "osdepend.h" #include "ui/ui.h" +#include "ui/menu.h" #include "ui/selector.h" #include "ui/utils.h" - -#include - +#include "ui/custui.h" const char *const ui_menu_custom_ui::hide_status[] = { __("Show All"), diff --git a/src/emu/ui/custui.h b/src/emu/ui/custui.h index 0a2e55745c9..0aeffca9c5b 100644 --- a/src/emu/ui/custui.h +++ b/src/emu/ui/custui.h @@ -13,12 +13,6 @@ #ifndef MAME_EMU_UI_UI_CUSTUI_H #define MAME_EMU_UI_UI_CUSTUI_H -#include "ui/menu.h" - -#include -#include - - //------------------------------------------------- // Custom UI menu //------------------------------------------------- diff --git a/src/emu/ui/inifile.cpp b/src/emu/ui/inifile.cpp index f230e5ba0e7..1a2b894a5fb 100644 --- a/src/emu/ui/inifile.cpp +++ b/src/emu/ui/inifile.cpp @@ -13,7 +13,6 @@ #include "ui/inifile.h" #include "softlist.h" #include "drivenum.h" -#include //------------------------------------------------- // GLOBAL VARIABLES diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index 518c834535e..4a000595de4 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -693,7 +693,7 @@ ui_menu_machine_configure::ui_menu_machine_configure(running_machine &machine, r { // parse the INI file std::string error; - m_opts.parse_standard_inis(error, m_drv); + mame_options::parse_standard_inis(m_opts,error, m_drv); setup_bios(); } diff --git a/src/emu/ui/miscmenu.h b/src/emu/ui/miscmenu.h index f2fb394784d..18f22c49d54 100644 --- a/src/emu/ui/miscmenu.h +++ b/src/emu/ui/miscmenu.h @@ -13,10 +13,10 @@ #ifndef __UI_MISCMENU_H__ #define __UI_MISCMENU_H__ -#include "drivenum.h" #include "crsshair.h" #include "emuopts.h" -#include "ui/selsoft.h" + +using s_bios = std::vector>; class ui_menu_keyboard_mode : public ui_menu { public: diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp index 4f41c7fbdac..3c8d37fec12 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/emu/ui/moptions.cpp @@ -9,6 +9,7 @@ ***************************************************************************/ #include "emu.h" +#include "options.h" #include "ui/moptions.h" diff --git a/src/emu/ui/moptions.h b/src/emu/ui/moptions.h index 55d800651f4..9a657d69d0e 100644 --- a/src/emu/ui/moptions.h +++ b/src/emu/ui/moptions.h @@ -13,8 +13,6 @@ #ifndef __UI_OPTS_H__ #define __UI_OPTS_H__ -#include "options.h" - // core directory options #define OPTION_HISTORY_PATH "historypath" #define OPTION_EXTRAINI_PATH "extrainipath" diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 1a7f02eb920..2df9cd35012 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -11,7 +11,6 @@ #include "emu.h" #include "emuopts.h" #include "ui/ui.h" -#include "ui/menu.h" #include "uiinput.h" #include "ui/selgame.h" #include "ui/miscmenu.h" @@ -29,7 +28,6 @@ #include "ui/auditmenu.h" #include "rendutil.h" #include "softlist.h" -#include extern const char UI_VERSION_TAG[]; diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index 06401d3523d..225e9c2cf3a 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -13,7 +13,6 @@ #ifndef __UI_MAIN_H__ #define __UI_MAIN_H__ -#include "drivenum.h" #include "ui/menu.h" class ui_menu_select_game : public ui_menu diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index 0cc5a951df9..16808d2a963 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -22,7 +22,6 @@ #include "rendfont.h" #include "rendutil.h" #include "softlist.h" -#include std::string reselect_last::driver; std::string reselect_last::software; diff --git a/src/emu/ui/slotopt.cpp b/src/emu/ui/slotopt.cpp index b676778b07e..470647ea063 100644 --- a/src/emu/ui/slotopt.cpp +++ b/src/emu/ui/slotopt.cpp @@ -188,7 +188,7 @@ void ui_menu_slot_devices::handle() { if ((FPTR)menu_event->itemref == 1 && menu_event->iptkey == IPT_UI_SELECT) { - machine().options().add_slot_options(); + mame_options::add_slot_options(machine().options()); machine().schedule_hard_reset(); } else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) diff --git a/src/emu/ui/utils.cpp b/src/emu/ui/utils.cpp index 6a59208cd30..d65bbc52ef7 100644 --- a/src/emu/ui/utils.cpp +++ b/src/emu/ui/utils.cpp @@ -10,7 +10,6 @@ #include "emu.h" #include "ui/utils.h" -#include extern const char UI_VERSION_TAG[]; const char UI_VERSION_TAG[] = "# UI INFO "; diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 0e2ff2354b3..d31b3746e77 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -13,9 +13,6 @@ #ifndef __UI_UTILS_H__ #define __UI_UTILS_H__ -#include "osdepend.h" -#include "rendutil.h" - #define MAX_CHAR_INFO 256 #define MAX_CUST_FILTER 8 diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp index 86e0104b3e6..72319a30dfd 100644 --- a/src/mame/drivers/chihiro.cpp +++ b/src/mame/drivers/chihiro.cpp @@ -388,7 +388,7 @@ class ohci_hlean2131qc_device : public device_t, public ohci_function_device { public: ohci_hlean2131qc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - void initialize(running_machine &machine, xbox_base_state *usb_bus_manager) override; + void initialize(running_machine &machine, ohci_usb_controller *usb_bus_manager) override; int handle_nonstandard_request(int endpoint, USBSetupPacket *setup) override; int handle_bulk_pid(int endpoint, int pid, UINT8 *buffer, int size) override; void set_region_base(UINT8 *data); @@ -424,7 +424,7 @@ class ohci_hlean2131sc_device : public device_t, public ohci_function_device { public: ohci_hlean2131sc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - void initialize(running_machine &machine, xbox_base_state *usb_bus_manager) override; + void initialize(running_machine &machine, ohci_usb_controller *usb_bus_manager) override; int handle_nonstandard_request(int endpoint, USBSetupPacket *setup) override; protected: @@ -689,7 +689,7 @@ ohci_hlean2131qc_device::ohci_hlean2131qc_device(const machine_config &mconfig, region = nullptr; } -void ohci_hlean2131qc_device::initialize(running_machine &machine, xbox_base_state *usb_bus_manager) +void ohci_hlean2131qc_device::initialize(running_machine &machine, ohci_usb_controller *usb_bus_manager) { ohci_function_device::initialize(machine, usb_bus_manager); add_device_descriptor(devdesc); @@ -802,7 +802,7 @@ ohci_hlean2131sc_device::ohci_hlean2131sc_device(const machine_config &mconfig, { } -void ohci_hlean2131sc_device::initialize(running_machine &machine, xbox_base_state *usb_bus_manager) +void ohci_hlean2131sc_device::initialize(running_machine &machine, ohci_usb_controller *usb_bus_manager) { ohci_function_device::initialize(machine, usb_bus_manager); add_device_descriptor(devdesc); @@ -1106,10 +1106,10 @@ void chihiro_state::machine_start() } usbhack_counter = 0; usb_device = machine().device("ohci_hlean2131qc"); - usb_device->initialize(machine(), this); + usb_device->initialize(machine(), ohci_usb); usb_device->set_region_base(memregion(":others")->base()); // temporary - //usb_device = new ohci_hlean2131sc_device(machine()); - usb_ohci_plug(1, usb_device); // connect + //usb_device = machine().device("ohci_hlean2131sc"); + ohci_usb->usb_ohci_plug(1, usb_device); // connect // savestates save_item(NAME(usbhack_counter)); } diff --git a/src/mame/drivers/cps1.cpp b/src/mame/drivers/cps1.cpp index 602689100e7..49b04eb1006 100644 --- a/src/mame/drivers/cps1.cpp +++ b/src/mame/drivers/cps1.cpp @@ -3114,82 +3114,78 @@ static INPUT_PORTS_START( pokonyan ) PORT_INCLUDE( cps1_3b ) PORT_START("DSWA") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW(A):1,2") + PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(A):3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(A):4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(A):5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(A):6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW(A):7") // not listed in service mode, but left/right don't seem to work otherwise? maybe tied to some cabinet sensor? PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(A):8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSWB") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(B):1,2") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, "Every 4" ) + PORT_DIPSETTING( 0x02, "Every 2" ) + PORT_DIPSETTING( 0x03, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, "Prize Mode" ) PORT_DIPLOCATION("SW(B):3") + PORT_DIPSETTING( 0x00, "Not Used" ) + PORT_DIPSETTING( 0x04, "Used" ) + PORT_DIPNAME( 0x08, 0x08, "Credit Mode" ) PORT_DIPLOCATION("SW(B):4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x10, 0x10, "Max Stage" ) PORT_DIPLOCATION("SW(B):5") + PORT_DIPSETTING( 0x00, "2" ) + PORT_DIPSETTING( 0x10, "3" ) + PORT_DIPNAME( 0x20, 0x20, "Card Check" ) PORT_DIPLOCATION("SW(B):6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(B):7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW(B):8") + PORT_DIPSETTING( 0x00, "1.0 sec" ) + PORT_DIPSETTING( 0x80, "1.2 sec" ) PORT_START("DSWC") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW(C):1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x02, 0x02, "Body Check") PORT_DIPLOCATION("SW(C):2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW(C):3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x08, 0x08, "Screen Stop" ) PORT_DIPLOCATION("SW(C):4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW(C):6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW(C):7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW(C):8" ) INPUT_PORTS_END /* @@ -11677,7 +11673,7 @@ ROM_START( pokonyan ) ROMX_LOAD( "xmqq-5c.bin", 0x000005, 0x20000, CRC(e2169bb5) SHA1(2ca3d6eeee27606af0b21c69491c3bfbe1f82ed6) , ROM_SKIP(7) ) ROMX_LOAD( "xmqq-8h.bin", 0x000006, 0x20000, CRC(113121f5) SHA1(d5b3c97e70c3f53d4d68ed56d98e84df59f42073) , ROM_SKIP(7) ) ROMX_LOAD( "xmqq-8f.bin", 0x000007, 0x20000, CRC(beb00e07) SHA1(ab0264cb98fe9d77c5acff86800273ed4bdf2e1f) , ROM_SKIP(7) ) - ROMX_LOAD( "xmqq-5b.bin", 0x100000, 0x20000, BAD_DUMP CRC(1849760c) SHA1(81707c50ddab864bb45cf524ffba092b8b212310) , ROM_SKIP(7) ) // issues with one of the address lines + ROMX_LOAD( "xmqq-5b.bin", 0x100000, 0x20000, CRC(05354905) SHA1(6a53c47c9d87f76bf73b8cab540910cdcfcb9133) , ROM_SKIP(7) ) ROMX_LOAD( "xmqq-5a.bin", 0x100001, 0x20000, CRC(bd40215e) SHA1(7350e56ecef8e87cf5a4d4f50231fada6fc5356b) , ROM_SKIP(7) ) ROMX_LOAD( "xmqq-10b.bin", 0x100002, 0x20000, CRC(9fa773ef) SHA1(4f0cf813cfe7fbdf20403cfab81b1c01907eb62f) , ROM_SKIP(7) ) ROMX_LOAD( "xmqq-10a.bin", 0x100003, 0x20000, CRC(638d4bc7) SHA1(fca924ad53ad1d00dc2e70436fd22de81c08115f) , ROM_SKIP(7) ) @@ -12326,7 +12322,7 @@ GAME( 1995, megaman, 0, cps1_12MHz, megaman, cps_state, cps1, GAME( 1995, megamana, megaman, cps1_12MHz, megaman, cps_state, cps1, ROT0, "Capcom", "Mega Man: The Power Battle (CPS1, Asia 951006)", MACHINE_SUPPORTS_SAVE ) GAME( 1995, rockmanj, megaman, cps1_12MHz, rockmanj, cps_state, cps1, ROT0, "Capcom", "Rockman: The Power Battle (CPS1, Japan 950922)", MACHINE_SUPPORTS_SAVE ) GAME( 2000, ganbare, 0, ganbare, ganbare, cps_state, ganbare, ROT0, "Capcom", "Ganbare! Marine Kun (Japan 2K0411)", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, pokonyan, 0, cps1_10MHz, pokonyan, cps_state, cps1, ROT0, "Capcom", "Pokonyan (Japan 940322)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // 2002-10-24 was on the ROM labels, 940322 on the startup screen... take your pick +GAME( 1994, pokonyan, 0, cps1_10MHz, pokonyan, cps_state, cps1, ROT0, "Capcom", "Pokonyan (Japan 940322)", MACHINE_SUPPORTS_SAVE ) // 2002-10-24 was on the ROM labels, 940322 on the startup screen... take your pick /* Games released on CPS-1 hardware by Mitchell */ diff --git a/src/mame/drivers/neogeo.cpp b/src/mame/drivers/neogeo.cpp index 8b420a91ec2..dbf8ab1947e 100644 --- a/src/mame/drivers/neogeo.cpp +++ b/src/mame/drivers/neogeo.cpp @@ -633,18 +633,17 @@ WRITE8_MEMBER(neogeo_state::audio_cpu_enable_nmi_w) READ16_MEMBER(neogeo_state::in0_r) { - return (m_ctrl1->ctrl_r(space, offset) << 8) | m_dsw->read(); + return ((m_edge->in0_r(space, offset) & m_ctrl1->ctrl_r(space, offset)) << 8) | m_dsw->read(); } -READ16_MEMBER(neogeo_state::irrmaze_in0_r) +READ16_MEMBER(neogeo_state::in1_r) { - UINT8 track_ipt = (m_controller_select & 0x01) ? m_tracky->read() : m_trackx->read(); - return (track_ipt << 8) | m_dsw->read(); + return ((m_edge->in1_r(space, offset) & m_ctrl2->ctrl_r(space, offset)) << 8) | 0xff; } CUSTOM_INPUT_MEMBER(neogeo_state::kizuna4p_start_r) { - return (m_ctrl1->read_start_sel()) | (m_ctrl2->read_start_sel() << 2) | ~0x05; + return (m_edge->read_start_sel() & 0x05) | ~0x05; } WRITE8_MEMBER(neogeo_state::io_control_w) @@ -652,9 +651,9 @@ WRITE8_MEMBER(neogeo_state::io_control_w) switch (offset) { case 0x00: - m_controller_select = data; if (m_ctrl1) m_ctrl1->write_ctrlsel(data); if (m_ctrl2) m_ctrl2->write_ctrlsel(data); + if (m_edge) m_edge->write_ctrlsel(data); break; case 0x10: @@ -1025,7 +1024,7 @@ DRIVER_INIT_MEMBER(neogeo_state,neogeo) // install controllers m_maincpu->space(AS_PROGRAM).install_read_handler(0x300000, 0x300001, 0, 0x01ff7e, read16_delegate(FUNC(neogeo_state::in0_r), this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x340000, 0x340001, 0, 0x01fffe, read8_delegate(FUNC(neogeo_control_port_device::ctrl_r),(neogeo_control_port_device*)m_ctrl2), 0xff00); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x340000, 0x340001, 0, 0x01fffe, read16_delegate(FUNC(neogeo_state::in1_r), this)); } @@ -1072,7 +1071,6 @@ void neogeo_state::machine_start() save_item(NAME(m_irq3_pending)); save_item(NAME(m_audio_cpu_nmi_enabled)); save_item(NAME(m_audio_cpu_nmi_pending)); - save_item(NAME(m_controller_select)); save_item(NAME(m_save_ram_unlocked)); save_item(NAME(m_output_data)); save_item(NAME(m_output_latch)); @@ -1423,8 +1421,10 @@ static MACHINE_CONFIG_DERIVED( mvs, neogeo_arcade ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(main_map_slot) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "joy", false) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "joy", false) + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge, "joy", false) + + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_pin15, "", false) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_pin15, "", false) MCFG_NEOGEO_CARTRIDGE_ADD("cartslot1", neogeo_cart, nullptr) MCFG_NEOGEO_CARTRIDGE_ADD("cartslot2", neogeo_cart, nullptr) diff --git a/src/mame/drivers/neogeo_noslot.cpp b/src/mame/drivers/neogeo_noslot.cpp index e80ce2ef086..1fe7d6c8203 100644 --- a/src/mame/drivers/neogeo_noslot.cpp +++ b/src/mame/drivers/neogeo_noslot.cpp @@ -23,8 +23,12 @@ static MACHINE_CONFIG_DERIVED_CLASS( neogeo_noslot, neogeo_arcade, neogeo_noslot MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(main_map_noslot) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "joy", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "joy", true) + //joystick controller + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "joy", true) + + //no mahjong controller + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_pin15, "", true) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_pin15, "", true) MCFG_MSLUGX_PROT_ADD("mslugx_prot") MCFG_SMA_PROT_ADD("sma_prot") @@ -42,8 +46,12 @@ static MACHINE_CONFIG_DERIVED_CLASS( neogeo_kog, neogeo_arcade, neogeo_noslot_ko MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(main_map_noslot) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "joy", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "joy", true) + //joystick controller + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "joy", true) + + //no mahjong controller + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_pin15, "", true) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_pin15, "", true) MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot") MCFG_KOG_PROT_ADD("kog_prot") @@ -52,27 +60,34 @@ MACHINE_CONFIG_END // these basically correspond to the cabinets which were available in arcades: // with mahjong panel, with dial for Pop'n Bounce and with 4 controls for Kizuna... static MACHINE_CONFIG_DERIVED( neogeo_mj, neogeo_noslot ) + + //no joystick panel + MCFG_DEVICE_REMOVE("edge") + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "", true) + + //P1 mahjong controller MCFG_DEVICE_REMOVE("ctrl1") MCFG_DEVICE_REMOVE("ctrl2") - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "mahjong", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "", true) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_pin15, "mahjong", true) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_pin15, "", true) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( neogeo_dial, neogeo_noslot ) - MCFG_DEVICE_REMOVE("ctrl1") - MCFG_DEVICE_REMOVE("ctrl2") - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "dial", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "dial", true) + MCFG_DEVICE_REMOVE("edge") + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "dial", true) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( neogeo_imaze, neogeo_noslot ) + MCFG_DEVICE_REMOVE("edge") + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "irrmaze", true) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( neogeo_kiz4p, neogeo_noslot ) - MCFG_DEVICE_REMOVE("ctrl1") - MCFG_DEVICE_REMOVE("ctrl2") - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_kiz4p, "kiz4p", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_kiz4p, "kiz4p", true) + MCFG_DEVICE_REMOVE("edge") + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "kiz4p", true) MACHINE_CONFIG_END -// this is used by V-Liner and Irritating Maze, which handle differently inputs... +// this is used by V-Liner, which handles differently inputs... static MACHINE_CONFIG_DERIVED( neogeo_noctrl, neogeo_noslot ) MCFG_DEVICE_REMOVE("ctrl1") MCFG_DEVICE_REMOVE("ctrl2") @@ -224,19 +239,6 @@ static INPUT_PORTS_START( irrmaze ) PORT_MODIFY("SYSTEM") PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("BUTTONS") - PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - - PORT_START("TRACK_X") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(20) PORT_REVERSE - - PORT_START("TRACK_Y") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(20) PORT_REVERSE INPUT_PORTS_END static INPUT_PORTS_START( vliner ) @@ -8861,17 +8863,6 @@ DRIVER_INIT_MEMBER(neogeo_noslot_state,jockeygp) // m_maincpu->space(AS_PROGRAM).install_read_port(0x2c0000, 0x2c0001, "IN6"); } - -DRIVER_INIT_MEMBER(neogeo_noslot_state,irrmaze) -{ - if (!m_cartslots[0]) m_banked_cart->install_banks(machine(), m_maincpu, m_region_maincpu->base(), m_region_maincpu->bytes()); - - m_sprgen->m_fixed_layer_bank_type = 0; - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x300000, 0x300001, 0, 0x01ff7e, read16_delegate(FUNC(neogeo_state::irrmaze_in0_r), this)); - m_maincpu->space(AS_PROGRAM).install_read_port(0x340000, 0x340001, 0, 0x01fffe, "BUTTONS"); -} - DRIVER_INIT_MEMBER(neogeo_noslot_state,vliner) { if (!m_cartslots[0]) m_banked_cart->install_banks(machine(), m_maincpu, m_region_maincpu->base(), m_region_maincpu->bytes()); @@ -9676,7 +9667,7 @@ GAME( 1997, kog, kof97, neogeo_kog, neogeo, neogeo_noslot_kog_sta GAME( 1997, lastblad, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Blade / Bakumatsu Roman - Gekka no Kenshi (NGM-2340)", MACHINE_SUPPORTS_SAVE ) GAME( 1997, lastbladh, lastblad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Blade / Bakumatsu Roman - Gekka no Kenshi (NGH-2340)", MACHINE_SUPPORTS_SAVE ) GAME( 1997, lastsold, lastblad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Soldier (Korean release of The Last Blade)", MACHINE_SUPPORTS_SAVE ) -GAME( 1997, irrmaze, neogeo, neogeo_noctrl, irrmaze, neogeo_noslot_state, irrmaze, ROT0, "SNK / Saurus", "The Irritating Maze / Ultra Denryu Iraira Bou", MACHINE_SUPPORTS_SAVE ) +GAME( 1997, irrmaze, neogeo, neogeo_imaze, irrmaze, neogeo_state, neogeo, ROT0, "SNK / Saurus", "The Irritating Maze / Ultra Denryu Iraira Bou", MACHINE_SUPPORTS_SAVE ) GAME( 1998, rbff2, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Real Bout Fatal Fury 2 - The Newcomers / Real Bout Garou Densetsu 2 - the newcomers (NGM-2400)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, rbff2h, rbff2, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Real Bout Fatal Fury 2 - The Newcomers / Real Bout Garou Densetsu 2 - the newcomers (NGH-2400)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, rbff2k, rbff2, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Real Bout Fatal Fury 2 - The Newcomers (Korean release)", MACHINE_SUPPORTS_SAVE ) // no Japanese title / mode diff --git a/src/mame/drivers/ng_aes.cpp b/src/mame/drivers/ng_aes.cpp index 7d9c822a893..dacd14c15fb 100644 --- a/src/mame/drivers/ng_aes.cpp +++ b/src/mame/drivers/ng_aes.cpp @@ -140,7 +140,6 @@ void ng_aes_state::common_machine_start() save_item(NAME(m_irq3_pending)); save_item(NAME(m_audio_cpu_nmi_enabled)); save_item(NAME(m_audio_cpu_nmi_pending)); - save_item(NAME(m_controller_select)); save_item(NAME(m_use_cart_vectors)); save_item(NAME(m_use_cart_audio)); //save_item(NAME(m_main_cpu_bank_address)); diff --git a/src/mame/drivers/xbox.cpp b/src/mame/drivers/xbox.cpp index 04cfb3b9a56..0115488e63e 100644 --- a/src/mame/drivers/xbox.cpp +++ b/src/mame/drivers/xbox.cpp @@ -191,8 +191,8 @@ void xbox_state::machine_reset() } SLOT_INTERFACE_START(xbox_ata_devices) -SLOT_INTERFACE("hdd", IDE_HARDDISK) -SLOT_INTERFACE("cdrom", ATAPI_CDROM) + SLOT_INTERFACE("hdd", IDE_HARDDISK) + SLOT_INTERFACE("cdrom", ATAPI_CDROM) SLOT_INTERFACE_END static MACHINE_CONFIG_DERIVED_CLASS(xbox, xbox_base, xbox_state) diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index a57731436cc..3994a818796 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -52,6 +52,7 @@ public: m_dsw(*this, "DSW"), m_trackx(*this, "TRACK_X"), m_tracky(*this, "TRACK_Y"), + m_edge(*this, "edge"), m_ctrl1(*this, "ctrl1"), m_ctrl2(*this, "ctrl2"), m_sprgen(*this, "spritegen"), @@ -81,7 +82,7 @@ public: DECLARE_WRITE16_MEMBER(neogeo_video_register_w); READ16_MEMBER(banked_vectors_r); DECLARE_READ16_MEMBER(in0_r); - DECLARE_READ16_MEMBER(irrmaze_in0_r); + DECLARE_READ16_MEMBER(in1_r); void set_slot_number(int slot); @@ -161,7 +162,6 @@ protected: enum {NEOGEO_MVS, NEOGEO_AES, NEOGEO_CD} m_type; // internal state - UINT8 m_controller_select; bool m_recurse; bool m_audio_cpu_nmi_enabled; bool m_audio_cpu_nmi_pending; @@ -177,6 +177,7 @@ protected: optional_ioport m_dsw; optional_ioport m_trackx; optional_ioport m_tracky; + optional_device m_edge; optional_device m_ctrl1; optional_device m_ctrl2; diff --git a/src/mame/includes/xbox.h b/src/mame/includes/xbox.h index f93bbed0f53..41cf01835fd 100644 --- a/src/mame/includes/xbox.h +++ b/src/mame/includes/xbox.h @@ -296,12 +296,76 @@ struct usb_device_configuration std::forward_list interfaces; }; -class xbox_base_state; // forward declaration +class ohci_function_device; // forward declaration + +class ohci_usb_controller : public device_t +{ +public: + ohci_usb_controller(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ohci_usb_controller() {} + void usb_ohci_plug(int port, ohci_function_device *function); + void usb_ohci_device_address_changed(int old_address, int new_address); + + template static devcb_base &set_interrupt_handler(device_t &device, _Object object) { return downcast(device).m_interrupt_handler.set_callback(object); } + + DECLARE_READ32_MEMBER(read); + DECLARE_WRITE32_MEMBER(write); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: + void usb_ohci_interrupts(); + void usb_ohci_read_endpoint_descriptor(UINT32 address); + void usb_ohci_writeback_endpoint_descriptor(UINT32 address); + void usb_ohci_read_transfer_descriptor(UINT32 address); + void usb_ohci_writeback_transfer_descriptor(UINT32 address); + void usb_ohci_read_isochronous_transfer_descriptor(UINT32 address); + void usb_ohci_writeback_isochronous_transfer_descriptor(UINT32 address); + cpu_device *m_maincpu; + //required_device pic8259_1; + struct { + UINT32 hc_regs[256]; + struct { + ohci_function_device *function; + int address; + int delay; + } ports[4 + 1]; + struct + { + ohci_function_device *function; + int port; + } address[256]; + emu_timer *timer; + int state; + UINT32 framenumber; + UINT32 nextinterupted; + UINT32 nextbulked; + int interruptbulkratio; + int writebackdonehadcounter; + address_space *space; + UINT8 buffer[1024]; + OHCIEndpointDescriptor endpoint_descriptor; + OHCITransferDescriptor transfer_descriptor; + OHCIIsochronousTransferDescriptor isochronous_transfer_descriptor; + } ohcist; + devcb_write_line m_interrupt_handler; +}; + +extern const device_type OHCI_USB_CONTROLLER; + +#define MCFG_OHCI_USB_CONTROLLER_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, OHCI_USB_CONTROLLER, 0) +#define MCFG_OHCI_USB_CONTROLLER_INTERRUPT_HANDLER(_devcb) \ + devcb = &ohci_usb_controller::set_interrupt_handler(*device, DEVCB_##_devcb); class ohci_function_device { public: ohci_function_device(); - virtual void initialize(running_machine &machine, xbox_base_state *usb_bus_manager); + virtual void initialize(running_machine &machine, ohci_usb_controller *usb_bus_manager); virtual void execute_reset(); virtual void execute_connect() {}; virtual void execute_disconnect() {}; @@ -329,7 +393,7 @@ protected: UINT8 *position_device_descriptor(int &size); UINT8 *position_configuration_descriptor(int index, int &size); UINT8 *position_string_descriptor(int index, int &size); - xbox_base_state *busmanager; + ohci_usb_controller *busmanager; struct { int type; int controldirection; @@ -361,7 +425,7 @@ class ohci_game_controller_device : public device_t, public ohci_function_device { public: ohci_game_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - void initialize(running_machine &machine, xbox_base_state *usb_bus_manager) override; + void initialize(running_machine &machine, ohci_usb_controller *usb_bus_manager) override; int handle_nonstandard_request(int endpoint, USBSetupPacket *setup) override; int handle_interrupt_pid(int endpoint, int pid, UINT8 *buffer, int size) override; @@ -402,8 +466,6 @@ public: DECLARE_READ32_MEMBER(geforce_r); DECLARE_WRITE32_MEMBER(geforce_w); - DECLARE_READ32_MEMBER(usbctrl_r); - DECLARE_WRITE32_MEMBER(usbctrl_w); DECLARE_READ32_MEMBER(smbus_r); DECLARE_WRITE32_MEMBER(smbus_w); DECLARE_READ8_MEMBER(superio_read); @@ -421,15 +483,6 @@ public: int smbus_pic16lc(int command, int rw, int data); int smbus_cx25871(int command, int rw, int data); int smbus_eeprom(int command, int rw, int data); - void usb_ohci_plug(int port, ohci_function_device *function); - void usb_ohci_interrupts(); - void usb_ohci_read_endpoint_descriptor(UINT32 address); - void usb_ohci_writeback_endpoint_descriptor(UINT32 address); - void usb_ohci_read_transfer_descriptor(UINT32 address); - void usb_ohci_writeback_transfer_descriptor(UINT32 address); - void usb_ohci_read_isochronous_transfer_descriptor(UINT32 address); - void usb_ohci_writeback_isochronous_transfer_descriptor(UINT32 address); - void usb_ohci_device_address_changed(int old_address, int new_address); void debug_generate_irq(int irq, bool active); virtual void hack_eeprom() {}; virtual void hack_usb() {}; @@ -442,9 +495,9 @@ public: DECLARE_READ8_MEMBER(get_slave_ack); DECLARE_WRITE_LINE_MEMBER(xbox_pit8254_out0_changed); DECLARE_WRITE_LINE_MEMBER(xbox_pit8254_out2_changed); + DECLARE_WRITE_LINE_MEMBER(xbox_ohci_usb_interrupt_changed); IRQ_CALLBACK_MEMBER(irq_callback); TIMER_CALLBACK_MEMBER(audio_apu_timer); - TIMER_CALLBACK_MEMBER(usb_ohci_timer); struct xbox_devices { pic8259_device *pic8259_1; @@ -486,31 +539,6 @@ public: UINT32 mixer_regs[0x80 / 4]; UINT32 controller_regs[0x38 / 4]; } ac97st; - struct ohci_state { - UINT32 hc_regs[255]; - struct { - ohci_function_device *function; - int address; - int delay; - } ports[4 + 1]; - struct - { - ohci_function_device *function; - int port; - } address[256]; - emu_timer *timer; - int state; - UINT32 framenumber; - UINT32 nextinterupted; - UINT32 nextbulked; - int interruptbulkratio; - int writebackdonehadcounter; - address_space *space; - UINT8 buffer[1024]; - OHCIEndpointDescriptor endpoint_descriptor; - OHCITransferDescriptor transfer_descriptor; - OHCIIsochronousTransferDescriptor isochronous_transfer_descriptor; - } ohcist; struct superio_state { bool configuration_mode; @@ -523,6 +551,7 @@ public: bool debug_irq_active; int debug_irq_number; required_device m_maincpu; + ohci_usb_controller *ohci_usb; }; ADDRESS_MAP_EXTERN(xbox_base_map, 32); diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index d29fac1ccbc..c789c9c8d38 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -522,7 +522,41 @@ static const char *const usbregnames[] = { }; #endif -READ32_MEMBER(xbox_base_state::usbctrl_r) +const device_type OHCI_USB_CONTROLLER = &device_creator; + +ohci_usb_controller::ohci_usb_controller(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, OHCI_USB_CONTROLLER, "OHCI USB CONTROLLER", tag, owner, clock, "ohciusb", __FILE__), + m_interrupt_handler(*this) +{ + memset(&ohcist, 0, sizeof(ohcist)); +} + +void ohci_usb_controller::device_start() +{ + m_maincpu = machine().device("maincpu"); + m_interrupt_handler.resolve_safe(); + ohcist.hc_regs[HcRevision] = 0x10; + ohcist.hc_regs[HcFmInterval] = 0x2edf; + ohcist.hc_regs[HcLSThreshold] = 0x628; + ohcist.hc_regs[HcRhDescriptorA] = 4; + ohcist.hc_regs[HcControl] = UsbReset << 6; + ohcist.state = UsbReset; + ohcist.interruptbulkratio = 1; + ohcist.writebackdonehadcounter = 7; + for (int n = 0; n <= 4; n++) + ohcist.ports[n].address = -1; + for (int n = 0; n < 256; n++) + ohcist.address[n].port = -1; + ohcist.space = &(m_maincpu->space()); + ohcist.timer = timer_alloc(0); + ohcist.timer->enable(false); +} + +void ohci_usb_controller::device_reset() +{ +} + +READ32_MEMBER(ohci_usb_controller::read) { UINT32 ret; @@ -532,7 +566,7 @@ READ32_MEMBER(xbox_base_state::usbctrl_r) else logerror("usb controller 0 register %s read\n", usbregnames[offset]); #endif - ret=ohcist.hc_regs[offset]; + ret = ohcist.hc_regs[offset]; if (offset == 0) { /* hacks needed until usb (and jvs) is implemented */ #ifndef USB_HACK_ENABLED hack_usb(); @@ -541,7 +575,7 @@ READ32_MEMBER(xbox_base_state::usbctrl_r) return ret; } -WRITE32_MEMBER(xbox_base_state::usbctrl_w) +WRITE32_MEMBER(ohci_usb_controller::write) { UINT32 old = ohcist.hc_regs[offset]; @@ -603,7 +637,7 @@ WRITE32_MEMBER(xbox_base_state::usbctrl_w) } if (offset >= HcRhPortStatus1) { int port = offset - HcRhPortStatus1 + 1; // port 0 not used - // bit 0 R:CurrentConnectStatus W:ClearPortEnable: 1 clears PortEnableStatus + // bit 0 R:CurrentConnectStatus W:ClearPortEnable: 1 clears PortEnableStatus if (data & CCS) { ohcist.hc_regs[offset] &= ~PES; ohcist.address[ohcist.ports[port].address].port = -1; @@ -674,7 +708,7 @@ WRITE32_MEMBER(xbox_base_state::usbctrl_w) ohcist.hc_regs[offset] = data; } -TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) +void ohci_usb_controller::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { UINT32 hcca; UINT32 plh; @@ -710,7 +744,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) if (list == 0) { if (ohcist.hc_regs[HcControl] & PLE) { // periodic list - plh=ohcist.space->read_dword(hcca + (ohcist.framenumber & 0x1f) * 4); + plh = ohcist.space->read_dword(hcca + (ohcist.framenumber & 0x1f) * 4); cont = true; while (cont == true) { if (plh != 0) { @@ -752,7 +786,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) pid = OutPid; // out else if (ohcist.endpoint_descriptor.d == 2) pid = InPid; // in - else + else pid = InPid; // in R = (int)ohcist.framenumber - (int)ohcist.isochronous_transfer_descriptor.sf; //if ((R < 0) || (R > (int)ohcist.isochronous_transfer_descriptor.fc)) @@ -766,7 +800,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) else a = ohcist.isochronous_transfer_descriptor.bp0 | (a & 0xfff); } - b=ohcist.isochronous_transfer_descriptor.offset[R]; + b = ohcist.isochronous_transfer_descriptor.offset[R]; if (b & (1 << 12)) b = (ohcist.isochronous_transfer_descriptor.be & 0xfffff000) | (b & 0xfff); else @@ -836,7 +870,8 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) else { usb_ohci_writeback_transfer_descriptor(ohcist.endpoint_descriptor.headp); } - } else + } + else { // status writeback ohcist.isochronous_transfer_descriptor.cc = NoError; @@ -865,7 +900,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) { plh = ohcist.endpoint_descriptor.nexted; } - else + else cont = false; } } @@ -911,9 +946,9 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) usb_ohci_read_transfer_descriptor(ohcist.endpoint_descriptor.headp); // get pid if (ohcist.endpoint_descriptor.d == 1) - pid=OutPid; // out + pid = OutPid; // out else if (ohcist.endpoint_descriptor.d == 2) - pid=InPid; // in + pid = InPid; // in else { pid = ohcist.transfer_descriptor.dp; // 0 setup 1 out 2 in } @@ -951,7 +986,7 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) if (pid == InPid) { // ... store done bytes for (int c = 0; c < done; c++) { - ohcist.space->write_byte(b,ohcist.buffer[c]); + ohcist.space->write_byte(b, ohcist.buffer[c]); b++; if ((b & 0xfff) == 0) b = ohcist.transfer_descriptor.be & 0xfffff000; @@ -986,7 +1021,8 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) } usb_ohci_writeback_transfer_descriptor(a); usb_ohci_writeback_endpoint_descriptor(ohcist.hc_regs[HcControlCurrentED]); - } else { + } + else { usb_ohci_writeback_transfer_descriptor(ohcist.endpoint_descriptor.headp); } } @@ -1161,12 +1197,12 @@ TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) usb_ohci_interrupts(); } -void xbox_base_state::usb_ohci_plug(int port, ohci_function_device *function) +void ohci_usb_controller::usb_ohci_plug(int port, ohci_function_device *function) { if ((port > 0) && (port <= 4)) { ohcist.ports[port].function = function; ohcist.ports[port].address = -1; - ohcist.hc_regs[HcRhPortStatus1+port-1] = CCS | CSC; + ohcist.hc_regs[HcRhPortStatus1 + port - 1] = CCS | CSC; if (ohcist.state != UsbReset) { ohcist.hc_regs[HcInterruptStatus] |= RootHubStatusChange; @@ -1175,11 +1211,146 @@ void xbox_base_state::usb_ohci_plug(int port, ohci_function_device *function) } } +void ohci_usb_controller::usb_ohci_interrupts() +{ + if (((ohcist.hc_regs[HcInterruptStatus] & ohcist.hc_regs[HcInterruptEnable]) != 0) && ((ohcist.hc_regs[HcInterruptEnable] & MasterInterruptEnable) != 0)) + { + //pic8259_1->ir1_w(1); + m_interrupt_handler(1); + } else + { + //pic8259_1->ir1_w(0); + m_interrupt_handler(0); + } +} + +void ohci_usb_controller::usb_ohci_read_endpoint_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.space->read_dword(address); + ohcist.endpoint_descriptor.word0 = w; + ohcist.endpoint_descriptor.fa = w & 0x7f; + ohcist.endpoint_descriptor.en = (w >> 7) & 15; + ohcist.endpoint_descriptor.d = (w >> 11) & 3; + ohcist.endpoint_descriptor.s = (w >> 13) & 1; + ohcist.endpoint_descriptor.k = (w >> 14) & 1; + ohcist.endpoint_descriptor.f = (w >> 15) & 1; + ohcist.endpoint_descriptor.mps = (w >> 16) & 0x7ff; + ohcist.endpoint_descriptor.tailp = ohcist.space->read_dword(address + 4); + w = ohcist.space->read_dword(address + 8); + ohcist.endpoint_descriptor.headp = w & 0xfffffffc; + ohcist.endpoint_descriptor.h = w & 1; + ohcist.endpoint_descriptor.c = (w >> 1) & 1; + ohcist.endpoint_descriptor.nexted = ohcist.space->read_dword(address + 12); +} + +void ohci_usb_controller::usb_ohci_writeback_endpoint_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.endpoint_descriptor.word0 & 0xf8000000; + w = w | (ohcist.endpoint_descriptor.mps << 16) | (ohcist.endpoint_descriptor.f << 15) | (ohcist.endpoint_descriptor.k << 14) | (ohcist.endpoint_descriptor.s << 13) | (ohcist.endpoint_descriptor.d << 11) | (ohcist.endpoint_descriptor.en << 7) | ohcist.endpoint_descriptor.fa; + ohcist.space->write_dword(address, w); + w = ohcist.endpoint_descriptor.headp | (ohcist.endpoint_descriptor.c << 1) | ohcist.endpoint_descriptor.h; + ohcist.space->write_dword(address + 8, w); +} + +void ohci_usb_controller::usb_ohci_read_transfer_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.space->read_dword(address); + ohcist.transfer_descriptor.word0 = w; + ohcist.transfer_descriptor.cc = (w >> 28) & 15; + ohcist.transfer_descriptor.ec = (w >> 26) & 3; + ohcist.transfer_descriptor.t = (w >> 24) & 3; + ohcist.transfer_descriptor.di = (w >> 21) & 7; + ohcist.transfer_descriptor.dp = (w >> 19) & 3; + ohcist.transfer_descriptor.r = (w >> 18) & 1; + ohcist.transfer_descriptor.cbp = ohcist.space->read_dword(address + 4); + ohcist.transfer_descriptor.nexttd = ohcist.space->read_dword(address + 8); + ohcist.transfer_descriptor.be = ohcist.space->read_dword(address + 12); +} + +void ohci_usb_controller::usb_ohci_writeback_transfer_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.transfer_descriptor.word0 & 0x0003ffff; + w = w | (ohcist.transfer_descriptor.cc << 28) | (ohcist.transfer_descriptor.ec << 26) | (ohcist.transfer_descriptor.t << 24) | (ohcist.transfer_descriptor.di << 21) | (ohcist.transfer_descriptor.dp << 19) | (ohcist.transfer_descriptor.r << 18); + ohcist.space->write_dword(address, w); + ohcist.space->write_dword(address + 4, ohcist.transfer_descriptor.cbp); + ohcist.space->write_dword(address + 8, ohcist.transfer_descriptor.nexttd); +} + +void ohci_usb_controller::usb_ohci_read_isochronous_transfer_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.space->read_dword(address); + ohcist.isochronous_transfer_descriptor.word0 = w; + ohcist.isochronous_transfer_descriptor.cc = (w >> 28) & 15; + ohcist.isochronous_transfer_descriptor.fc = (w >> 24) & 7; + ohcist.isochronous_transfer_descriptor.di = (w >> 21) & 7; + ohcist.isochronous_transfer_descriptor.sf = w & 0xffff; + w = ohcist.space->read_dword(address + 4); + ohcist.isochronous_transfer_descriptor.word1 = w; + ohcist.isochronous_transfer_descriptor.bp0 = w & 0xfffff000; + ohcist.isochronous_transfer_descriptor.nexttd = ohcist.space->read_dword(address + 8); + ohcist.isochronous_transfer_descriptor.be = ohcist.space->read_dword(address + 12); + w = ohcist.space->read_dword(address + 16); + ohcist.isochronous_transfer_descriptor.offset[0] = w & 0xffff; + ohcist.isochronous_transfer_descriptor.offset[1] = (w >> 16) & 0xffff; + w = ohcist.space->read_dword(address + 20); + ohcist.isochronous_transfer_descriptor.offset[2] = w & 0xffff; + ohcist.isochronous_transfer_descriptor.offset[3] = (w >> 16) & 0xffff; + w = ohcist.space->read_dword(address + 24); + ohcist.isochronous_transfer_descriptor.offset[4] = w & 0xffff; + ohcist.isochronous_transfer_descriptor.offset[5] = (w >> 16) & 0xffff; + w = ohcist.space->read_dword(address + 28); + ohcist.isochronous_transfer_descriptor.offset[6] = w & 0xffff; + ohcist.isochronous_transfer_descriptor.offset[7] = (w >> 16) & 0xffff; +} + +void ohci_usb_controller::usb_ohci_writeback_isochronous_transfer_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.isochronous_transfer_descriptor.word0 & 0x1f0000; + w = w | (ohcist.isochronous_transfer_descriptor.cc << 28) | (ohcist.isochronous_transfer_descriptor.fc << 24) | (ohcist.isochronous_transfer_descriptor.di << 21) | ohcist.isochronous_transfer_descriptor.sf; + ohcist.space->write_dword(address, w); + w = ohcist.isochronous_transfer_descriptor.word1 & 0xfff; + w = w | ohcist.isochronous_transfer_descriptor.bp0; + ohcist.space->write_dword(address + 4, w); + ohcist.space->write_dword(address + 8, ohcist.isochronous_transfer_descriptor.nexttd); + ohcist.space->write_dword(address + 12, ohcist.isochronous_transfer_descriptor.be); + w = (ohcist.isochronous_transfer_descriptor.offset[1] << 16) | ohcist.isochronous_transfer_descriptor.offset[0]; + ohcist.space->write_dword(address + 16, w); + w = (ohcist.isochronous_transfer_descriptor.offset[3] << 16) | ohcist.isochronous_transfer_descriptor.offset[2]; + ohcist.space->write_dword(address + 20, w); + w = (ohcist.isochronous_transfer_descriptor.offset[5] << 16) | ohcist.isochronous_transfer_descriptor.offset[4]; + ohcist.space->write_dword(address + 24, w); + w = (ohcist.isochronous_transfer_descriptor.offset[7] << 16) | ohcist.isochronous_transfer_descriptor.offset[6]; + ohcist.space->write_dword(address + 28, w); +} + +void ohci_usb_controller::usb_ohci_device_address_changed(int old_address, int new_address) +{ + ohcist.address[new_address].function = ohcist.address[old_address].function; + ohcist.address[new_address].port = ohcist.address[old_address].port; + ohcist.address[old_address].port = -1; +} + +/* +* ohci device base class +*/ + ohci_function_device::ohci_function_device() { } -void ohci_function_device::initialize(running_machine &machine, xbox_base_state *usb_bus_manager) +void ohci_function_device::initialize(running_machine &machine, ohci_usb_controller *usb_bus_manager) { busmanager = usb_bus_manager; state = DefaultState; @@ -1726,7 +1897,7 @@ ohci_game_controller_device::ohci_game_controller_device(const machine_config &m { } -void ohci_game_controller_device::initialize(running_machine &machine, xbox_base_state *usb_bus_manager) +void ohci_game_controller_device::initialize(running_machine &machine, ohci_usb_controller *usb_bus_manager) { ohci_function_device::initialize(machine, usb_bus_manager); add_device_descriptor(devdesc); @@ -1838,130 +2009,9 @@ ioport_constructor ohci_game_controller_device::device_input_ports() const return INPUT_PORTS_NAME(xbox_controller); } -void xbox_base_state::usb_ohci_interrupts() +WRITE_LINE_MEMBER(xbox_base_state::xbox_ohci_usb_interrupt_changed) { - if (((ohcist.hc_regs[HcInterruptStatus] & ohcist.hc_regs[HcInterruptEnable]) != 0) && ((ohcist.hc_regs[HcInterruptEnable] & MasterInterruptEnable) != 0)) - xbox_base_devs.pic8259_1->ir1_w(1); - else - xbox_base_devs.pic8259_1->ir1_w(0); -} - -void xbox_base_state::usb_ohci_read_endpoint_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.space->read_dword(address); - ohcist.endpoint_descriptor.word0 = w; - ohcist.endpoint_descriptor.fa = w & 0x7f; - ohcist.endpoint_descriptor.en = (w >> 7) & 15; - ohcist.endpoint_descriptor.d = (w >> 11) & 3; - ohcist.endpoint_descriptor.s = (w >> 13) & 1; - ohcist.endpoint_descriptor.k = (w >> 14) & 1; - ohcist.endpoint_descriptor.f = (w >> 15) & 1; - ohcist.endpoint_descriptor.mps = (w >> 16) & 0x7ff; - ohcist.endpoint_descriptor.tailp = ohcist.space->read_dword(address + 4); - w = ohcist.space->read_dword(address + 8); - ohcist.endpoint_descriptor.headp = w & 0xfffffffc; - ohcist.endpoint_descriptor.h = w & 1; - ohcist.endpoint_descriptor.c = (w >> 1) & 1; - ohcist.endpoint_descriptor.nexted = ohcist.space->read_dword(address + 12); -} - -void xbox_base_state::usb_ohci_writeback_endpoint_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.endpoint_descriptor.word0 & 0xf8000000; - w = w | (ohcist.endpoint_descriptor.mps << 16) | (ohcist.endpoint_descriptor.f << 15) | (ohcist.endpoint_descriptor.k << 14) | (ohcist.endpoint_descriptor.s << 13) | (ohcist.endpoint_descriptor.d << 11) | (ohcist.endpoint_descriptor.en << 7) | ohcist.endpoint_descriptor.fa; - ohcist.space->write_dword(address, w); - w = ohcist.endpoint_descriptor.headp | (ohcist.endpoint_descriptor.c << 1) | ohcist.endpoint_descriptor.h; - ohcist.space->write_dword(address + 8, w); -} - -void xbox_base_state::usb_ohci_read_transfer_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.space->read_dword(address); - ohcist.transfer_descriptor.word0 = w; - ohcist.transfer_descriptor.cc = (w >> 28) & 15; - ohcist.transfer_descriptor.ec= (w >> 26) & 3; - ohcist.transfer_descriptor.t= (w >> 24) & 3; - ohcist.transfer_descriptor.di= (w >> 21) & 7; - ohcist.transfer_descriptor.dp= (w >> 19) & 3; - ohcist.transfer_descriptor.r = (w >> 18) & 1; - ohcist.transfer_descriptor.cbp = ohcist.space->read_dword(address + 4); - ohcist.transfer_descriptor.nexttd = ohcist.space->read_dword(address + 8); - ohcist.transfer_descriptor.be = ohcist.space->read_dword(address + 12); -} - -void xbox_base_state::usb_ohci_writeback_transfer_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.transfer_descriptor.word0 & 0x0003ffff; - w = w | (ohcist.transfer_descriptor.cc << 28) | (ohcist.transfer_descriptor.ec << 26) | (ohcist.transfer_descriptor.t << 24) | (ohcist.transfer_descriptor.di << 21) | (ohcist.transfer_descriptor.dp << 19) | (ohcist.transfer_descriptor.r << 18); - ohcist.space->write_dword(address, w); - ohcist.space->write_dword(address + 4, ohcist.transfer_descriptor.cbp); - ohcist.space->write_dword(address + 8, ohcist.transfer_descriptor.nexttd); -} - -void xbox_base_state::usb_ohci_read_isochronous_transfer_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.space->read_dword(address); - ohcist.isochronous_transfer_descriptor.word0 = w; - ohcist.isochronous_transfer_descriptor.cc = (w >> 28) & 15; - ohcist.isochronous_transfer_descriptor.fc = (w >> 24) & 7; - ohcist.isochronous_transfer_descriptor.di = (w >> 21) & 7; - ohcist.isochronous_transfer_descriptor.sf = w & 0xffff; - w = ohcist.space->read_dword(address + 4); - ohcist.isochronous_transfer_descriptor.word1 = w; - ohcist.isochronous_transfer_descriptor.bp0 = w & 0xfffff000; - ohcist.isochronous_transfer_descriptor.nexttd = ohcist.space->read_dword(address + 8); - ohcist.isochronous_transfer_descriptor.be = ohcist.space->read_dword(address + 12); - w = ohcist.space->read_dword(address + 16); - ohcist.isochronous_transfer_descriptor.offset[0] = w & 0xffff; - ohcist.isochronous_transfer_descriptor.offset[1] = (w >> 16) & 0xffff; - w = ohcist.space->read_dword(address + 20); - ohcist.isochronous_transfer_descriptor.offset[2] = w & 0xffff; - ohcist.isochronous_transfer_descriptor.offset[3] = (w >> 16) & 0xffff; - w = ohcist.space->read_dword(address + 24); - ohcist.isochronous_transfer_descriptor.offset[4] = w & 0xffff; - ohcist.isochronous_transfer_descriptor.offset[5] = (w >> 16) & 0xffff; - w = ohcist.space->read_dword(address + 28); - ohcist.isochronous_transfer_descriptor.offset[6] = w & 0xffff; - ohcist.isochronous_transfer_descriptor.offset[7] = (w >> 16) & 0xffff; -} - -void xbox_base_state::usb_ohci_writeback_isochronous_transfer_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.isochronous_transfer_descriptor.word0 & 0x1f0000; - w = w | (ohcist.isochronous_transfer_descriptor.cc << 28) | (ohcist.isochronous_transfer_descriptor.fc << 24) | (ohcist.isochronous_transfer_descriptor.di << 21) | ohcist.isochronous_transfer_descriptor.sf; - ohcist.space->write_dword(address, w); - w = ohcist.isochronous_transfer_descriptor.word1 & 0xfff; - w = w | ohcist.isochronous_transfer_descriptor.bp0; - ohcist.space->write_dword(address + 4, w); - ohcist.space->write_dword(address + 8, ohcist.isochronous_transfer_descriptor.nexttd); - ohcist.space->write_dword(address + 12, ohcist.isochronous_transfer_descriptor.be); - w = (ohcist.isochronous_transfer_descriptor.offset[1] << 16) | ohcist.isochronous_transfer_descriptor.offset[0]; - ohcist.space->write_dword(address + 16, w); - w = (ohcist.isochronous_transfer_descriptor.offset[3] << 16) | ohcist.isochronous_transfer_descriptor.offset[2]; - ohcist.space->write_dword(address + 20, w); - w = (ohcist.isochronous_transfer_descriptor.offset[5] << 16) | ohcist.isochronous_transfer_descriptor.offset[4]; - ohcist.space->write_dword(address + 24, w); - w = (ohcist.isochronous_transfer_descriptor.offset[7] << 16) | ohcist.isochronous_transfer_descriptor.offset[6]; - ohcist.space->write_dword(address + 28, w); -} - -void xbox_base_state::usb_ohci_device_address_changed(int old_address, int new_address) -{ - ohcist.address[new_address].function = ohcist.address[old_address].function; - ohcist.address[new_address].port = ohcist.address[old_address].port; - ohcist.address[old_address].port = -1; + xbox_base_devs.pic8259_1->ir1_w(state); } /* @@ -2476,7 +2526,7 @@ ADDRESS_MAP_START(xbox_base_map, AS_PROGRAM, 32, xbox_base_state) AM_RANGE(0x00000000, 0x07ffffff) AM_RAM AM_SHARE("nv2a_share") // 128 megabytes AM_RANGE(0xf0000000, 0xf7ffffff) AM_RAM AM_SHARE("nv2a_share") // 3d accelerator wants this AM_RANGE(0xfd000000, 0xfdffffff) AM_RAM AM_READWRITE(geforce_r, geforce_w) - AM_RANGE(0xfed00000, 0xfed003ff) AM_READWRITE(usbctrl_r, usbctrl_w) + AM_RANGE(0xfed00000, 0xfed003ff) AM_DEVREADWRITE("ohci_usb", ohci_usb_controller, read, write) AM_RANGE(0xfe800000, 0xfe85ffff) AM_READWRITE(audio_apu_r, audio_apu_w) AM_RANGE(0xfec00000, 0xfec001ff) AM_READWRITE(audio_ac93_r, audio_ac93_w) AM_RANGE(0xff000000, 0xff0fffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x00f80000) @@ -2521,31 +2571,16 @@ void xbox_base_state::machine_start() apust.timer->enable(false); if (machine().debug_flags & DEBUG_FLAG_ENABLED) debug_console_register_command(machine(), "xbox", CMDFLAG_NONE, 0, 1, 4, xbox_debug_commands); - memset(&ohcist, 0, sizeof(ohcist)); // PIC challenge handshake data pic16lc_buffer[0x1c] = 0x0c; pic16lc_buffer[0x1d] = 0x0d; pic16lc_buffer[0x1e] = 0x0e; pic16lc_buffer[0x1f] = 0x0f; // usb - ohcist.hc_regs[HcRevision] = 0x10; - ohcist.hc_regs[HcFmInterval] = 0x2edf; - ohcist.hc_regs[HcLSThreshold] = 0x628; - ohcist.hc_regs[HcRhDescriptorA] = 4; - ohcist.hc_regs[HcControl] = UsbReset << 6; - ohcist.state = UsbReset; - ohcist.interruptbulkratio = 1; - ohcist.writebackdonehadcounter = 7; - for (int n = 0; n <= 4; n++) - ohcist.ports[n].address = -1; - for (int n = 0; n < 256; n++) - ohcist.address[n].port = -1; - ohcist.space = &m_maincpu->space(); - ohcist.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xbox_base_state::usb_ohci_timer), this), (void *)"USB OHCI Timer"); - ohcist.timer->enable(false); + ohci_usb = machine().device("ohci_usb"); usb_device = machine().device("ohci_gamepad"); - usb_device->initialize(machine(), this); - usb_ohci_plug(3, usb_device); // connect to root hub port 3, chihiro needs to use 1 and 2 + usb_device->initialize(machine(), ohci_usb); + ohci_usb->usb_ohci_plug(3, usb_device); // connect to root hub port 3, chihiro needs to use 1 and 2 // super-io memset(&superiost, 0, sizeof(superiost)); superiost.configuration_mode = false; @@ -2604,6 +2639,8 @@ MACHINE_CONFIG_START(xbox_base, xbox_base_state) MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE("maincpu", AS_PROGRAM) // next line is temporary + MCFG_OHCI_USB_CONTROLLER_ADD("ohci_usb") + MCFG_OHCI_USB_CONTROLLER_INTERRUPT_HANDLER(WRITELINE(xbox_base_state, xbox_ohci_usb_interrupt_changed)) MCFG_DEVICE_ADD("ohci_gamepad", OHCI_GAME_CONTROLLER, 0) /* video hardware */ diff --git a/src/mame/video/cps1.cpp b/src/mame/video/cps1.cpp index a9d7bc06866..51f37d896f2 100644 --- a/src/mame/video/cps1.cpp +++ b/src/mame/video/cps1.cpp @@ -1383,15 +1383,15 @@ static const struct gfx_range mapper_KNM10B_table[] = { 0 } }; -// unknown part number, this could still be incorrect +// unknown part number, this is just based on where the gfx are in the ROM #define mapper_pokonyan { 0x8000, 0x8000, 0x8000, 0 }, mapper_pokonyan_table static const struct gfx_range mapper_pokonyan_table[] = { /* type start end bank */ - { GFXTYPE_SPRITES, 0x0000, 0x7fff, 0 }, + { GFXTYPE_SPRITES, 0x0000, 0x2fff, 0 }, { GFXTYPE_SCROLL1, 0x7000, 0x7fff, 0 }, - { GFXTYPE_SCROLL3, 0x0000, 0x7fff, 0 }, - { GFXTYPE_SCROLL2, 0x0000, 0x7fff, 0 }, + { GFXTYPE_SCROLL3, 0x3000, 0x3fff, 0 }, + { GFXTYPE_SCROLL2, 0x4000, 0x6fff, 0 }, { 0 } }; diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index a5d29550e02..5a6d2b1e8a0 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -64,10 +64,11 @@ public: int ofs_x; int ofs_y; int width; - int height; // width and height of the view area, passed to ImGui::BeginChild + int height; // initial view size std::string title; - int last_x; - int last_y; + int view_width; + int view_height; + bool has_focus; bool exec_cmd; // console only int src_sel; char console_input[512]; @@ -95,6 +96,7 @@ public: private: void handle_mouse(); + void handle_mouse_views(); void handle_keys(); void handle_console(running_machine* machine); void update(); @@ -114,9 +116,11 @@ private: INT32 m_mouse_x; INT32 m_mouse_y; bool m_mouse_button; + bool m_prev_mouse_button; bool m_running; const char* font_name; float font_size; + ImVec2 m_text_size; // size of character (assumes monospaced font is in use) ImguiFontHandle m_font; UINT8 m_key_char; bool m_hide; @@ -182,9 +186,54 @@ static inline void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg) void debug_imgui::handle_mouse() { + m_prev_mouse_button = m_mouse_button; m_machine->ui_input().find_mouse(&m_mouse_x, &m_mouse_y, &m_mouse_button); } +void debug_imgui::handle_mouse_views() +{ + rectangle rect; + bool clicked = false; + if(m_mouse_button == true && m_prev_mouse_button == false) + clicked = true; + + // check all views, and pass mouse clicks to them + if(!m_mouse_button) + return; + rect.min_x = view_main_disasm->ofs_x; + rect.min_y = view_main_disasm->ofs_y; + rect.max_x = view_main_disasm->ofs_x + view_main_disasm->view_width; + rect.max_y = view_main_disasm->ofs_y + view_main_disasm->view_height; + if(rect.contains(m_mouse_x,m_mouse_y) && clicked && view_main_disasm->has_focus) + { + debug_view_xy topleft = view_main_disasm->view->visible_position(); + debug_view_xy newpos; + newpos.x = topleft.x + (m_mouse_x-view_main_disasm->ofs_x) / m_text_size.x; + newpos.y = topleft.y + (m_mouse_y-view_main_disasm->ofs_y) / m_text_size.y; + view_main_disasm->view->set_cursor_position(newpos); + view_main_disasm->view->set_cursor_visible(true); + } + for(std::vector::iterator it = view_list.begin();it != view_list.end();++it) + { + rect.min_x = (*it)->ofs_x; + rect.min_y = (*it)->ofs_y; + rect.max_x = (*it)->ofs_x + (*it)->view_width; + rect.max_y = (*it)->ofs_y + (*it)->view_height; + if(rect.contains(m_mouse_x,m_mouse_y) && clicked && (*it)->has_focus) + { + if((*it)->view->cursor_supported()) + { + debug_view_xy topleft = (*it)->view->visible_position(); + debug_view_xy newpos; + newpos.x = topleft.x + (m_mouse_x-(*it)->ofs_x) / m_text_size.x; + newpos.y = topleft.y + (m_mouse_y-(*it)->ofs_y) / m_text_size.y; + (*it)->view->set_cursor_position(newpos); + (*it)->view->set_cursor_visible(true); + } + } + } +} + void debug_imgui::handle_keys() { ImGuiIO& io = ImGui::GetIO(); @@ -377,6 +426,10 @@ void debug_imgui::draw_bpoints(debug_area* view_ptr, bool* opened) ImGui::BeginChild("##break_output", ImVec2(ImGui::GetWindowWidth() - 16,ImGui::GetWindowHeight() - ImGui::GetTextLineHeight() - ImGui::GetCursorPosY())); // account for title bar and widgets already drawn ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); + // update view location, while the cursor is at 0,0. + view_ptr->ofs_x = ImGui::GetCursorScreenPos().x; + view_ptr->ofs_y = ImGui::GetCursorScreenPos().y; + view_ptr->has_focus = ImGui::IsWindowFocused(); for(y=0;yofs_x = ImGui::GetCursorScreenPos().x; + view_ptr->ofs_y = ImGui::GetCursorScreenPos().y; + view_ptr->view_width = ImGui::GetContentRegionMax().x; + view_ptr->view_height = ImGui::GetContentRegionMax().y; + view_ptr->has_focus = ImGui::IsWindowFocused(); for(y=0;yofs_x = ImGui::GetCursorScreenPos().x; + view_ptr->ofs_y = ImGui::GetCursorScreenPos().y; + view_ptr->view_width = ImGui::GetContentRegionMax().x; + view_ptr->view_height = ImGui::GetContentRegionMax().y; + view_ptr->has_focus = ImGui::IsWindowFocused(); for(y=0;yofs_x = ImGui::GetCursorScreenPos().x; + view_ptr->ofs_y = ImGui::GetCursorScreenPos().y; + view_ptr->view_width = ImGui::GetContentRegionMax().x; + view_ptr->view_height = ImGui::GetContentRegionMax().y; + view_ptr->has_focus = ImGui::IsWindowFocused(); for(y=0;yofs_x = ImGui::GetCursorScreenPos().x; + view_main_regs->ofs_y = ImGui::GetCursorScreenPos().y; + view_main_regs->view_width = ImGui::GetContentRegionMax().x; + view_main_regs->view_height = ImGui::GetContentRegionMax().y; + view_main_regs->has_focus = ImGui::IsWindowFocused(); for(y=0;yofs_x = ImGui::GetCursorScreenPos().x; + view_main_disasm->ofs_y = ImGui::GetCursorScreenPos().y; + view_main_disasm->view_width = ImGui::GetContentRegionMax().x; + view_main_disasm->view_height = ImGui::GetContentRegionMax().y; + view_main_disasm->has_focus = ImGui::IsWindowFocused(); for(y=0;yofs_x = ImGui::GetCursorScreenPos().x; + view_main_console->ofs_y = ImGui::GetCursorScreenPos().y; + view_main_console->view_width = ImGui::GetContentRegionMax().x; + view_main_console->view_height = ImGui::GetContentRegionMax().y; + view_main_console->has_focus = ImGui::IsWindowFocused(); for(y=0;y(m_machine->options()).video(),"bgfx") != 0) fatalerror("Error: ImGui debugger requires the BGFX renderer.\n"); @@ -1117,6 +1208,7 @@ void debug_imgui::wait_for_debugger(device_t &device, bool firststop) imguiBeginFrame(m_mouse_x,m_mouse_y,m_mouse_button ? IMGUI_MBUT_LEFT : 0, 0, width, height,m_key_char); update(); imguiEndFrame(); + handle_mouse_views(); device.machine().osd().update(false); } diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index c3994efbd2f..a32405c4aa8 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -236,7 +236,7 @@ void debugger_windows::show_all() void debugger_windows::hide_all() { - SetForegroundWindow(win_window_list->platform_window()); + SetForegroundWindow(win_window_list.front()->platform_window()); for (debugwin_info &info : m_window_list) info.hide(); } diff --git a/src/osd/modules/debugger/win/debugwininfo.cpp b/src/osd/modules/debugger/win/debugwininfo.cpp index 8c02ee17e1c..1e75b464b72 100644 --- a/src/osd/modules/debugger/win/debugwininfo.cpp +++ b/src/osd/modules/debugger/win/debugwininfo.cpp @@ -35,7 +35,7 @@ debugwin_info::debugwin_info(debugger_windows_interface &debugger, bool is_main_ register_window_class(); m_wnd = win_create_window_ex_utf8(DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE, - 0, 0, 100, 100, win_window_list->platform_window(), create_standard_menubar(), GetModuleHandleUni(), this); + 0, 0, 100, 100, win_window_list.front()->platform_window(), create_standard_menubar(), GetModuleHandleUni(), this); if (m_wnd == NULL) return; diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp index c5a73b0a541..629bc9046a8 100644 --- a/src/osd/modules/font/font_sdl.cpp +++ b/src/osd/modules/font/font_sdl.cpp @@ -88,7 +88,7 @@ bool osd_font_sdl::open(std::string const &font_path, std::string const &_name, // if no success, try the font path if (!font) { - osd_printf_verbose("Searching font %s in -%s\n", family.c_str(), OPTION_FONTPATH); + osd_printf_verbose("Searching font %s in -%s path/s\n", family.c_str(), font_path.c_str()); //emu_file file(options().font_path(), OPEN_FLAG_READ); emu_file file(font_path.c_str(), OPEN_FLAG_READ); if (file.open(family.c_str()) == osd_file::error::NONE) diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp index ca3bad08026..dfb63482570 100644 --- a/src/osd/modules/input/input_dinput.cpp +++ b/src/osd/modules/input/input_dinput.cpp @@ -564,7 +564,7 @@ public: dinput_joystick_device *devinfo; int result = 0; - if (win_window_list != nullptr && win_window_list->win_has_menu()) + if (!win_window_list.empty() && win_window_list.front()->win_has_menu()) cooperative_level = DISCL_BACKGROUND | DISCL_NONEXCLUSIVE; // allocate and link in a new device diff --git a/src/osd/modules/input/input_dinput.h b/src/osd/modules/input/input_dinput.h index f339bef561e..f06520cb285 100644 --- a/src/osd/modules/input/input_dinput.h +++ b/src/osd/modules/input/input_dinput.h @@ -103,7 +103,7 @@ public: } // set the cooperative level - result = devinfo->dinput.device->SetCooperativeLevel(win_window_list->platform_window(), cooperative_level); + result = devinfo->dinput.device->SetCooperativeLevel(win_window_list.front()->platform_window(), cooperative_level); if (result != DI_OK) goto error; diff --git a/src/osd/modules/input/input_rawinput.cpp b/src/osd/modules/input/input_rawinput.cpp index 20ed82cc4a1..7476fea24a6 100644 --- a/src/osd/modules/input/input_rawinput.cpp +++ b/src/osd/modules/input/input_rawinput.cpp @@ -475,7 +475,7 @@ public: registration.usUsagePage = usagepage(); registration.usUsage = usage(); registration.dwFlags = m_global_inputs_enabled ? 0x00000100 : 0; - registration.hwndTarget = win_window_list->platform_window(); + registration.hwndTarget = win_window_list.front()->platform_window(); // register the device register_rawinput_devices(®istration, 1, sizeof(registration)); diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index 8814cfe3876..996221f57e6 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -115,7 +115,7 @@ public: } protected: - sdl_window_info * focus_window() + std::shared_ptr focus_window() { return sdl_event_manager::instance().focus_window(); } @@ -144,7 +144,7 @@ public: case SDL_KEYDOWN: keyboard.state[OSD_SDL_INDEX_KEYSYM(&sdlevent.key.keysym)] = 0x80; if (sdlevent.key.keysym.sym < 0x20) - machine().ui_input().push_char_event(sdl_window_list->target(), sdlevent.key.keysym.sym); + machine().ui_input().push_char_event(sdl_window_list.front()->target(), sdlevent.key.keysym.sym); break; case SDL_KEYUP: @@ -154,7 +154,7 @@ public: case SDL_TEXTINPUT: if (*sdlevent.text.text) { - sdl_window_info *window = GET_FOCUS_WINDOW(&event.text); + auto window = GET_FOCUS_WINDOW(&event.text); //printf("Focus window is %p - wl %p\n", window, sdl_window_list); unicode_char result; if (window != NULL) @@ -210,7 +210,7 @@ public: { int cx = -1, cy = -1; - sdl_window_info *window = GET_FOCUS_WINDOW(&sdlevent.motion); + auto window = GET_FOCUS_WINDOW(&sdlevent.motion); if (window != NULL && window->xy_to_render_target(sdlevent.motion.x, sdlevent.motion.y, &cx, &cy)) machine().ui_input().push_mouse_move_event(window->target(), cx, cy); @@ -228,7 +228,7 @@ public: static int last_y = 0; int cx, cy; osd_ticks_t click = osd_ticks() * 1000 / osd_ticks_per_second(); - sdl_window_info *window = GET_FOCUS_WINDOW(&sdlevent.button); + auto window = GET_FOCUS_WINDOW(&sdlevent.button); if (window != NULL && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) { machine().ui_input().push_mouse_down_event(window->target(), cx, cy); @@ -252,7 +252,7 @@ public: else if (sdlevent.button.button == 3) { int cx, cy; - sdl_window_info *window = GET_FOCUS_WINDOW(&sdlevent.button); + auto window = GET_FOCUS_WINDOW(&sdlevent.button); if (window != NULL && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) { @@ -268,7 +268,7 @@ public: if (sdlevent.button.button == 1) { int cx, cy; - sdl_window_info *window = GET_FOCUS_WINDOW(&sdlevent.button); + auto window = GET_FOCUS_WINDOW(&sdlevent.button); if (window != NULL && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) { @@ -278,7 +278,7 @@ public: else if (sdlevent.button.button == 3) { int cx, cy; - sdl_window_info *window = GET_FOCUS_WINDOW(&sdlevent.button); + auto window = GET_FOCUS_WINDOW(&sdlevent.button); if (window != NULL && window->xy_to_render_target(sdlevent.button.x, sdlevent.button.y, &cx, &cy)) { @@ -288,7 +288,7 @@ public: break; case SDL_MOUSEWHEEL: - sdl_window_info *window = GET_FOCUS_WINDOW(&sdlevent.wheel); + auto window = GET_FOCUS_WINDOW(&sdlevent.wheel); if (window != NULL) machine().ui_input().push_mouse_wheel_event(window->target(), 0, 0, sdlevent.wheel.y, 3); break; diff --git a/src/osd/modules/input/input_sdlcommon.cpp b/src/osd/modules/input/input_sdlcommon.cpp index 85febac18f6..6f2794e3ac5 100644 --- a/src/osd/modules/input/input_sdlcommon.cpp +++ b/src/osd/modules/input/input_sdlcommon.cpp @@ -35,12 +35,11 @@ #define GET_WINDOW(ev) window_from_id((ev)->windowID) //#define GET_WINDOW(ev) ((ev)->windowID) -static inline sdl_window_info * window_from_id(Uint32 windowID) +static inline std::shared_ptr window_from_id(Uint32 windowID) { - sdl_window_info *w; SDL_Window *window = SDL_GetWindowFromID(windowID); - for (w = sdl_window_list; w != NULL; w = w->m_next) + for (auto w : sdl_window_list) { //printf("w->window_id: %d\n", w->window_id); if (w->platform_window() == window) @@ -72,7 +71,7 @@ void sdl_event_manager::process_events(running_machine &machine) void sdl_event_manager::process_window_event(running_machine &machine, SDL_Event &sdlevent) { - sdl_window_info *window = GET_WINDOW(&sdlevent.window); + std::shared_ptr window = GET_WINDOW(&sdlevent.window); if (window == NULL) return; @@ -273,7 +272,9 @@ void sdl_osd_interface::poll_inputs(running_machine &machine) void sdl_osd_interface::release_keys() { - downcast(m_keyboard_input)->devicelist()->reset_devices(); + auto keybd = dynamic_cast(m_keyboard_input); + if (keybd != nullptr) + keybd->devicelist()->reset_devices(); } bool sdl_osd_interface::should_hide_mouse() diff --git a/src/osd/modules/input/input_sdlcommon.h b/src/osd/modules/input/input_sdlcommon.h index feecf23f975..2e40199c556 100644 --- a/src/osd/modules/input/input_sdlcommon.h +++ b/src/osd/modules/input/input_sdlcommon.h @@ -118,7 +118,7 @@ class sdl_event_manager : public event_manager_t private: bool m_mouse_over_window; bool m_has_focus; - sdl_window_info * m_focus_window; + std::shared_ptr m_focus_window; sdl_event_manager() : m_mouse_over_window(true), @@ -129,8 +129,8 @@ private: public: bool mouse_over_window() const { return m_mouse_over_window; } - bool has_focus() const { return m_focus_window; } - sdl_window_info * focus_window() { return m_focus_window; } + bool has_focus() const { return m_focus_window != nullptr; } + std::shared_ptr focus_window() { return m_focus_window; } static sdl_event_manager& instance() { diff --git a/src/osd/modules/input/input_win32.cpp b/src/osd/modules/input/input_win32.cpp index 5bef565beed..0b44c510fa0 100644 --- a/src/osd/modules/input/input_win32.cpp +++ b/src/osd/modules/input/input_win32.cpp @@ -152,7 +152,7 @@ public: mouse.lY = (cursor_info.ptScreenPos.y - win32_mouse.last_point.y) * INPUT_RELATIVE_PER_PIXEL; RECT window_pos = {0}; - GetWindowRect(win_window_list->platform_window(), &window_pos); + GetWindowRect(win_window_list.front()->platform_window(), &window_pos); // We reset the cursor position to the middle of the window each frame win32_mouse.last_point.x = window_pos.left + (window_pos.right - window_pos.left) / 2; @@ -269,13 +269,13 @@ public: // get the cursor position and transform into final results GetCursorPos(&mousepos); - if (win_window_list != NULL) + if (!win_window_list.empty()) { RECT client_rect; // get the position relative to the window - GetClientRect(win_window_list->platform_window(), &client_rect); - ScreenToClient(win_window_list->platform_window(), &mousepos); + GetClientRect(win_window_list.front()->platform_window(), &client_rect); + ScreenToClient(win_window_list.front()->platform_window(), &mousepos); // convert to absolute coordinates xpos = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right); @@ -335,10 +335,10 @@ private: POINT mousepos; // get the position relative to the window - GetClientRect(win_window_list->platform_window(), &client_rect); + GetClientRect(win_window_list.front()->platform_window(), &client_rect); mousepos.x = args.xpos; mousepos.y = args.ypos; - ScreenToClient(win_window_list->platform_window(), &mousepos); + ScreenToClient(win_window_list.front()->platform_window(), &mousepos); // convert to absolute coordinates mouse.lX = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right); diff --git a/src/osd/modules/input/input_windows.h b/src/osd/modules/input/input_windows.h index 85ad2c63326..d9dd28bac58 100644 --- a/src/osd/modules/input/input_windows.h +++ b/src/osd/modules/input/input_windows.h @@ -52,7 +52,7 @@ public: virtual bool should_hide_mouse() { if (winwindow_has_focus() // has focus - && (!video_config.windowed || !win_window_list->win_has_menu()) // not windowed or doesn't have a menu + && (!video_config.windowed || !win_window_list.front()->win_has_menu()) // not windowed or doesn't have a menu && (input_enabled() && !input_paused()) // input enabled and not paused && (mouse_enabled() || lightgun_enabled())) // either mouse or lightgun enabled in the core { diff --git a/src/osd/modules/input/input_winhybrid.cpp b/src/osd/modules/input/input_winhybrid.cpp index 538abe38da4..c74eb730b71 100644 --- a/src/osd/modules/input/input_winhybrid.cpp +++ b/src/osd/modules/input/input_winhybrid.cpp @@ -164,7 +164,7 @@ public: goto exit; } - if (win_window_list != nullptr && win_window_list->win_has_menu()) + if (!win_window_list.empty() && win_window_list.front()->win_has_menu()) cooperative_level = DISCL_BACKGROUND | DISCL_NONEXCLUSIVE; // allocate and link in a new device diff --git a/src/osd/modules/osdwindow.cpp b/src/osd/modules/osdwindow.cpp index cde83c3fe7f..b9afc8047cd 100644 --- a/src/osd/modules/osdwindow.cpp +++ b/src/osd/modules/osdwindow.cpp @@ -21,33 +21,34 @@ #include "render/drawsdl.h" #endif -osd_renderer* osd_renderer::make_for_type(int mode, osd_window* window, int extra_flags) +osd_window::~osd_window() +{ +} + +std::unique_ptr osd_renderer::make_for_type(int mode, std::shared_ptr window, int extra_flags) { switch(mode) { #ifdef OSD_WINDOWS case VIDEO_MODE_NONE: - return new renderer_none(window); + return std::make_unique(window); #endif case VIDEO_MODE_BGFX: - return new renderer_bgfx(window); + return std::make_unique(window); #if (USE_OPENGL) case VIDEO_MODE_OPENGL: - return new renderer_ogl(window); + return std::make_unique(window); #endif #ifdef OSD_WINDOWS case VIDEO_MODE_GDI: - return new renderer_gdi(window); + return std::make_unique(window); case VIDEO_MODE_D3D: - { - osd_renderer *renderer = new renderer_d3d9(window); - return renderer; - } + return std::make_unique(window); #else case VIDEO_MODE_SDL2ACCEL: - return new renderer_sdl2(window, extra_flags); + return std::make_unique(window, extra_flags); case VIDEO_MODE_SOFT: - return new renderer_sdl1(window, extra_flags); + return std::make_unique(window, extra_flags); #endif default: return nullptr; diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index 428d821413c..4996cce002d 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -106,7 +106,9 @@ public: int refresh; // decoded refresh }; -class osd_window +class osd_renderer; + +class osd_window : public std::enable_shared_from_this { public: osd_window() @@ -116,16 +118,24 @@ public: #endif m_primlist(nullptr), m_index(0), - m_main(nullptr), m_prescale(1), - m_platform_window(nullptr) + m_platform_window(nullptr), + m_renderer(nullptr), + m_main(nullptr) {} - virtual ~osd_window() { } + + virtual ~osd_window(); virtual render_target *target() = 0; virtual int fullscreen() const = 0; virtual running_machine &machine() const = 0; + osd_renderer &renderer() const { return *m_renderer; } + void set_renderer(std::unique_ptr renderer) + { + m_renderer = std::move(renderer); + } + int prescale() const { return m_prescale; }; float pixel_aspect() const { return monitor()->pixel_aspect(); } @@ -152,6 +162,9 @@ public: m_platform_window = window; } + std::shared_ptr main_window() { return m_main; } + void set_main_window(std::shared_ptr main) { m_main = main; } + // Clips the pointer to the bounds of this window virtual void capture_pointer() = 0; @@ -173,12 +186,13 @@ public: render_primitive_list *m_primlist; osd_window_config m_win_config; - int m_index; - osd_window *m_main; + int m_index; protected: int m_prescale; private: - void *m_platform_window; + void *m_platform_window; + std::unique_ptr m_renderer; + std::shared_ptr m_main; }; class osd_renderer @@ -194,12 +208,23 @@ public: static const int FLAG_NEEDS_DOUBLEBUF = 0x0100; static const int FLAG_NEEDS_ASYNCBLIT = 0x0200; - osd_renderer(osd_window *window, const int flags) + osd_renderer(std::shared_ptr window, const int flags) : m_sliders_dirty(false), m_window(window), m_flags(flags) { } virtual ~osd_renderer() { } - osd_window &window() { return *m_window; } + std::shared_ptr assert_window() const + { + auto win = m_window.lock(); + assert_always(win != nullptr, "Window weak_ptr is not available!"); + return win; + } + + std::shared_ptr try_getwindow() const + { + return m_window.lock(); + } + bool has_flags(const int flag) { return ((m_flags & flag)) == flag; } void set_flags(int aflag) { m_flags |= aflag; } void clear_flags(int aflag) { m_flags &= ~aflag; } @@ -220,7 +245,7 @@ public: virtual void toggle_fsfx() { }; virtual bool sliders_dirty() { return m_sliders_dirty; } - static osd_renderer* make_for_type(int mode, osd_window *window, int extra_flags = FLAG_NONE); + static std::unique_ptr make_for_type(int mode, std::shared_ptr window, int extra_flags = FLAG_NONE); protected: virtual void build_slider_list() { } @@ -231,7 +256,7 @@ protected: std::vector m_sliders; private: - osd_window *m_window; + std::weak_ptr m_window; int m_flags; }; diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp index 3cc6e022573..8c517c8dc2f 100644 --- a/src/osd/modules/render/bgfx/chain.cpp +++ b/src/osd/modules/render/bgfx/chain.cpp @@ -17,13 +17,15 @@ #include "targetmanager.h" #include "target.h" #include "vertex.h" +#include "screen.h" #include "modules/osdwindow.h" #include "chain.h" -bgfx_chain::bgfx_chain(std::string name, std::string author, target_manager& targets, std::vector sliders, std::vector params, std::vector entries, std::vector target_list, std::uint32_t screen_index) +bgfx_chain::bgfx_chain(std::string name, std::string author, bool transform, target_manager& targets, std::vector sliders, std::vector params, std::vector entries, std::vector target_list, std::uint32_t screen_index) : m_name(name) , m_author(author) + , m_transform(transform) , m_targets(targets) , m_sliders(sliders) , m_params(params) @@ -60,22 +62,30 @@ bgfx_chain::~bgfx_chain() void bgfx_chain::process(render_primitive* prim, int view, int screen, texture_manager& textures, osd_window& window, uint64_t blend) { + screen_device_iterator screen_iterator(window.machine().root_device()); + screen_device* screen_device = screen_iterator.byindex(screen); + render_container &screen_container = screen_device->container(); + int current_view = view; uint16_t screen_width(floor((prim->bounds.x1 - prim->bounds.x0) + 0.5f)); uint16_t screen_height(floor((prim->bounds.y1 - prim->bounds.y0) + 0.5f)); - uint32_t rotation_type = (window.target()->orientation() & ROT90) == ROT90 ? - 1 : (window.target()->orientation() & ROT180) == ROT180 ? - 2 : (window.target()->orientation() & ROT270) == ROT270 ? - 3 : 0; + uint32_t rotation_type = + (window.target()->orientation() & ROT90) == ROT90 ? 1 : + (window.target()->orientation() & ROT180) == ROT180 ? 2 : + (window.target()->orientation() & ROT270) == ROT270 ? 3 : 0; bool orientation_swap_xy = (window.machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY; - bool rotation_swap_xy = (window.target()->orientation() & ROT90) == ROT90 || (window.target()->orientation() & ROT270) == ROT270; + bool rotation_swap_xy = (window.target()->orientation() & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY; bool swap_xy = orientation_swap_xy ^ rotation_swap_xy; + float screen_scale_x = 1.0f / screen_container.xscale(); + float screen_scale_y = 1.0f / screen_container.yscale(); + float screen_offset_x = -screen_container.xoffset(); + float screen_offset_y = -screen_container.yoffset(); for (bgfx_chain_entry* entry : m_entries) { if (!entry->skip()) { - entry->submit(current_view, prim, textures, screen_width, screen_height, rotation_type, swap_xy, blend, screen); + entry->submit(current_view, prim, textures, screen_width, screen_height, screen_scale_x, screen_scale_y, screen_offset_x, screen_offset_y, rotation_type, swap_xy, blend, screen); current_view++; } } diff --git a/src/osd/modules/render/bgfx/chain.h b/src/osd/modules/render/bgfx/chain.h index bc68d4d5af2..465e44fea85 100644 --- a/src/osd/modules/render/bgfx/chain.h +++ b/src/osd/modules/render/bgfx/chain.h @@ -28,7 +28,7 @@ class osd_window; class bgfx_chain { public: - bgfx_chain(std::string name, std::string author, target_manager& targets, std::vector sliders, std::vector params, std::vector entries, std::vector target_list, uint32_t screen_index); + bgfx_chain(std::string name, std::string author, bool transform, target_manager& targets, std::vector sliders, std::vector params, std::vector entries, std::vector target_list, uint32_t screen_index); ~bgfx_chain(); void process(render_primitive* prim, int view, int screen, texture_manager& textures, osd_window &window, uint64_t blend = 0L); @@ -36,10 +36,12 @@ public: // Getters std::vector& sliders() { return m_sliders; } uint32_t applicable_passes(); + bool transform() { return m_transform; } private: std::string m_name; std::string m_author; + bool m_transform; target_manager& m_targets; std::vector m_sliders; std::vector m_params; diff --git a/src/osd/modules/render/bgfx/chainentry.cpp b/src/osd/modules/render/bgfx/chainentry.cpp index 156bc435f09..fc97e909260 100644 --- a/src/osd/modules/render/bgfx/chainentry.cpp +++ b/src/osd/modules/render/bgfx/chainentry.cpp @@ -50,7 +50,7 @@ bgfx_chain_entry::~bgfx_chain_entry() delete m_clear; } -void bgfx_chain_entry::submit(int view, render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy, uint64_t blend, int32_t screen) +void bgfx_chain_entry::submit(int view, render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, float screen_scale_x, float screen_scale_y, float screen_offset_x, float screen_offset_y, uint32_t rotation_type, bool swap_xy, uint64_t blend, int32_t screen) { bgfx::setViewSeq(view, true); @@ -68,7 +68,7 @@ void bgfx_chain_entry::submit(int view, render_primitive* prim, texture_manager& put_screen_buffer(prim, &buffer); bgfx::setVertexBuffer(&buffer); - setup_auto_uniforms(prim, textures, screen_width, screen_height, rotation_type, swap_xy, screen); + setup_auto_uniforms(prim, textures, screen_width, screen_height, screen_scale_x, screen_scale_y, screen_offset_x, screen_offset_y, rotation_type, swap_xy, screen); for (bgfx_entry_uniform* uniform : m_uniforms) { @@ -112,6 +112,26 @@ void bgfx_chain_entry::setup_screensize_uniforms(texture_manager& textures, uint } } +void bgfx_chain_entry::setup_screenscale_uniforms(float screen_scale_x, float screen_scale_y) +{ + bgfx_uniform* screen_scale = m_effect->uniform("u_screen_scale"); + if (screen_scale != nullptr) + { + float values[2] = { screen_scale_x, screen_scale_y }; + screen_scale->set(values, sizeof(float) * 2); + } +} + +void bgfx_chain_entry::setup_screenoffset_uniforms(float screen_offset_x, float screen_offset_y) +{ + bgfx_uniform* screen_offset = m_effect->uniform("u_screen_offset"); + if (screen_offset != nullptr) + { + float values[2] = { screen_offset_x, screen_offset_y }; + screen_offset->set(values, sizeof(float) * 2); + } +} + void bgfx_chain_entry::setup_sourcesize_uniform(render_primitive* prim) const { bgfx_uniform* source_dims = m_effect->uniform("u_source_dims"); @@ -176,9 +196,11 @@ void bgfx_chain_entry::setup_screenindex_uniform(int32_t screen) const } } -void bgfx_chain_entry::setup_auto_uniforms(render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy, int32_t screen) +void bgfx_chain_entry::setup_auto_uniforms(render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, float screen_scale_x, float screen_scale_y, float screen_offset_x, float screen_offset_y, uint32_t rotation_type, bool swap_xy, int32_t screen) { setup_screensize_uniforms(textures, screen_width, screen_height, screen); + setup_screenscale_uniforms(screen_scale_x, screen_scale_y); + setup_screenoffset_uniforms(screen_offset_x, screen_offset_y); setup_sourcesize_uniform(prim); setup_targetsize_uniform(screen); setup_rotationtype_uniform(rotation_type); diff --git a/src/osd/modules/render/bgfx/chainentry.h b/src/osd/modules/render/bgfx/chainentry.h index e9e5112bf1b..d6452861de2 100644 --- a/src/osd/modules/render/bgfx/chainentry.h +++ b/src/osd/modules/render/bgfx/chainentry.h @@ -37,15 +37,17 @@ public: bgfx_chain_entry(std::string name, bgfx_effect* effect, clear_state* clear, std::vector suppressors, std::vector inputs, std::vector uniforms, target_manager& targets, std::string output); ~bgfx_chain_entry(); - void submit(int view, render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy, uint64_t blend, int32_t screen); + void submit(int view, render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, float screen_scale_x, float screen_scale_y, float screen_offset_x, float screen_offset_y, uint32_t rotation_type, bool swap_xy, uint64_t blend, int32_t screen); // Getters std::string name() const { return m_name; } bool skip(); private: - void setup_auto_uniforms(render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, uint32_t rotation_type, bool swap_xy, int32_t screen); + void setup_auto_uniforms(render_primitive* prim, texture_manager& textures, uint16_t screen_width, uint16_t screen_height, float screen_scale_x, float screen_scale_y, float screen_offset_x, float screen_offset_y, uint32_t rotation_type, bool swap_xy, int32_t screen); void setup_screensize_uniforms(texture_manager& textures, uint16_t screen_width, uint16_t screen_height, int32_t screen); + void setup_screenscale_uniforms(float screen_scale_x, float screen_scale_y); + void setup_screenoffset_uniforms(float screen_offset_x, float screen_offset_y); void setup_sourcesize_uniform(render_primitive* prim) const; void setup_targetsize_uniform(int32_t screen) const; void setup_rotationtype_uniform(uint32_t rotation_type) const; diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index 458a45d449c..80934ed073a 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -48,7 +48,7 @@ chain_manager::chain_manager(running_machine& machine, osd_options& options, tex , m_slider_notifier(slider_notifier) , m_screen_count(0) { - find_available_chains(options.bgfx_path()); + refresh_available_chains(); parse_chain_selections(options.bgfx_screen_chains()); } @@ -57,12 +57,41 @@ chain_manager::~chain_manager() destroy_chains(); } -void chain_manager::find_available_chains(std::string path) +void chain_manager::refresh_available_chains() { m_available_chains.clear(); m_available_chains.push_back("none"); - osd_directory *directory = osd_opendir((path + "/chains").c_str()); + find_available_chains(std::string(m_options.bgfx_path()) + "/chains"); + + destroy_unloaded_chains(); +} + +void chain_manager::destroy_unloaded_chains() +{ + // O(shaders*available_chains), but we don't care because asset reloading happens rarely + for (int i = 0; i < m_chain_names.size(); i++) + { + std::string name = m_chain_names[i]; + if (name.length() > 0) + { + for (std::string available_name : m_available_chains) + { + if (available_name == name) + { + delete m_screen_chains[i]; + m_chain_names[i] = ""; + m_current_chain[i] = CHAIN_NONE; + break; + } + } + } + } +} + +void chain_manager::find_available_chains(std::string path) +{ + osd_directory *directory = osd_opendir(path.c_str()); if (directory != nullptr) { for (const osd_directory_entry *entry = osd_readdir(directory); entry != nullptr; entry = osd_readdir(directory)) @@ -85,6 +114,14 @@ void chain_manager::find_available_chains(std::string path) } } } + else if (entry->type == ENTTYPE_DIR) + { + std::string name = entry->name; + if (!(name == "." || name == "..")) + { + find_available_chains(path + PATH_SEPARATOR + name); + } + } } osd_closedir(directory); @@ -144,6 +181,7 @@ void chain_manager::parse_chain_selections(std::string chain_str) while (m_current_chain.size() != chain_names.size()) { m_screen_chains.push_back(nullptr); + m_chain_names.push_back(""); m_current_chain.push_back(CHAIN_NONE); } @@ -161,10 +199,12 @@ void chain_manager::parse_chain_selections(std::string chain_str) if (chain_index < m_available_chains.size()) { m_current_chain[index] = chain_index; + m_chain_names[index] = m_available_chains[chain_index]; } else { m_current_chain[index] = CHAIN_NONE; + m_chain_names[index] = ""; } } } @@ -201,7 +241,8 @@ void chain_manager::load_chains() { if (m_current_chain[chain] != CHAIN_NONE) { - m_screen_chains[chain] = load_chain(m_available_chains[m_current_chain[chain]], uint32_t(chain)); + m_chain_names[chain] = m_available_chains[m_current_chain[chain]]; + m_screen_chains[chain] = load_chain(m_chain_names[chain], uint32_t(chain)); } } } @@ -245,7 +286,7 @@ void chain_manager::process_screen_quad(uint32_t view, uint32_t screen, render_p tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base); std::string full_name = "screen" + std::to_string(screen); - bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem, BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); + bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); m_textures.add_provider(full_name, texture); m_targets.update_target_sizes(screen, tex_width, tex_height, TARGET_STYLE_GUEST); @@ -293,6 +334,7 @@ void chain_manager::update_screen_count(uint32_t screen_count) while (m_screen_chains.size() < m_screen_count) { m_screen_chains.push_back(nullptr); + m_chain_names.push_back(""); m_current_chain.push_back(CHAIN_NONE); } diff --git a/src/osd/modules/render/bgfx/chainmanager.h b/src/osd/modules/render/bgfx/chainmanager.h index 7d8d0c16eb3..022dbecfa14 100644 --- a/src/osd/modules/render/bgfx/chainmanager.h +++ b/src/osd/modules/render/bgfx/chainmanager.h @@ -15,6 +15,7 @@ #define __DRAWBGFX_CHAIN_MANAGER__ #include +#include #include #include "texturemanager.h" @@ -48,6 +49,8 @@ private: void destroy_chains(); void reload_chains(); + void refresh_available_chains(); + void destroy_unloaded_chains(); void find_available_chains(std::string path); void parse_chain_selections(std::string chain_str); std::vector split_option_string(std::string chain_str) const; @@ -69,6 +72,7 @@ private: uint32_t m_screen_count; std::vector m_available_chains; std::vector m_screen_chains; + std::vector m_chain_names; std::vector m_selection_sliders; std::vector m_current_chain; diff --git a/src/osd/modules/render/bgfx/chainreader.cpp b/src/osd/modules/render/bgfx/chainreader.cpp index 332ba139fd0..9e79eb1f19d 100644 --- a/src/osd/modules/render/bgfx/chainreader.cpp +++ b/src/osd/modules/render/bgfx/chainreader.cpp @@ -53,6 +53,13 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, std::string prefix } } + // Parse whether the screen container is transformed by the chain's shaders + bool transform = false; + if (value.HasMember("transform")) + { + transform = value["transform"].GetBool(); + } + // Map sliders std::map slider_map; for (bgfx_slider* slider : sliders) @@ -116,7 +123,7 @@ bgfx_chain* chain_reader::read_from_value(const Value& value, std::string prefix } } - return new bgfx_chain(name, author, targets, sliders, parameters, entries, target_list, screen_index); + return new bgfx_chain(name, author, transform, targets, sliders, parameters, entries, target_list, screen_index); } bool chain_reader::validate_parameters(const Value& value, std::string prefix) diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc index e4a3a984e6b..68fe25a32cc 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc @@ -12,8 +12,8 @@ $input v_color0, v_texcoord0 uniform vec4 u_swap_xy; uniform vec4 u_source_dims; // size of the guest machine uniform vec4 u_quad_dims; -uniform vec4 u_screen_scale; // TODO: Hook up ScreenScale code-side -uniform vec4 u_screen_offset; // TODO: Hook up ScreenOffset code-side +uniform vec4 u_screen_scale; +uniform vec4 u_screen_offset; // User-supplied uniform vec4 u_scanline_alpha; @@ -50,7 +50,7 @@ vec2 GetAdjustedCoords(vec2 coord, vec2 center_offset) coord -= center_offset; // apply screen scale - //coord /= u_screen_scale.xy; + coord *= u_screen_scale.xy; // un-center coordinates coord += center_offset; @@ -102,7 +102,7 @@ void main() // Color vec4 BaseColor = texture2D(s_tex, BaseCoord); - if (BaseCoord.x < 0.0 || BaseCoord.y < 0.0) + if (BaseCoord.x < 0.0 || BaseCoord.y < 0.0 || BaseCoord.x > 1.0 || BaseCoord.y > 1.0) { BaseColor.rgb = vec3(0.0, 0.0, 0.0); } @@ -111,7 +111,7 @@ void main() if (u_shadow_alpha.x > 0.0) { vec2 ShadowCoord = GetShadowCoord(v_texcoord0.xy, v_texcoord0.xy); - + vec4 ShadowColor = texture2D(s_shadow, ShadowCoord); vec3 ShadowMaskColor = mix(vec3(1.0, 1.0, 1.0), ShadowColor.rgb, u_shadow_alpha.xxx); @@ -122,7 +122,7 @@ void main() // Color Compression // increasing the floor of the signal without affecting the ceiling BaseColor.rgb = u_floor.rgb + (vec3(1.0, 1.0, 1.0) - u_floor.rgb) * BaseColor.rgb; - + // Color Power BaseColor.r = pow(BaseColor.r, u_power.r); BaseColor.g = pow(BaseColor.g, u_power.g); @@ -136,7 +136,7 @@ void main() float ColorBrightness = 0.299 * BaseColor.r + 0.587 * BaseColor.g + 0.114 * BaseColor.b; - float ScanCoord = v_texcoord0.y * u_source_dims.y * u_scanline_scale.x * 3.1415927; + float ScanCoord = BaseCoord.y * u_source_dims.y * u_scanline_scale.x * 3.1415927; float ScanCoordJitter = u_scanline_jitter.x * u_jitter_amount.x * 1.618034; float ScanSine = sin(ScanCoord + ScanCoordJitter); float ScanlineWide = u_scanline_height.x + u_scanline_variation.x * max(1.0, u_scanline_height.x) * (1.0 - ColorBrightness); diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/misc/fs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/misc/fs_bob-and-ghost-deinterlace.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_bob-and-ghost-deinterlace.sc new file mode 100644 index 00000000000..45d38a0e020 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_bob-and-ghost-deinterlace.sc @@ -0,0 +1,55 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +/* + Bob-and-ghost Deinterlacing + Author: hunterk + License: Public domain + + Note: This shader is designed to work with the typical interlaced output from an emulator, which displays both even and odd fields twice. + As such, it is inappropriate for general video use unless the video has already been similarly woven beforehand. +*/ + +#include "common.sh" + +// Samplers +SAMPLER2D(s0, 0); + +uniform vec4 u_tex_size0; + +#define one_pixel vec2(1.0 / u_tex_size0.xy) + +void main() +{ + vec4 exponent = vec4(2.2, 2.2, 2.2, 2.2); + vec4 inv_exponent = 1.0 / exponent; + vec4 res = vec4(pow(texture2D(s0, v_texcoord0), exponent)); + vec4 color; + float y; + + // assume anything with a vertical resolution greater than 400 lines is interlaced + if (u_tex_size0.y > 400.0) + { + y = u_tex_size0.y * v_texcoord0.y;// FIXME + IN.frame_count; + res = pow(vec4(texture2D(s0, v_texcoord0 + vec2(0.0, one_pixel.y))), exponent); + color = pow((vec4(texture2D(s0, v_texcoord0 - vec2(0.0, 0.5 * one_pixel.y))) + vec4(texture2D(s0, v_texcoord0 + vec2(0.0, 0.5 * one_pixel.y)))) / 2.0, exponent); + } + else + { + y = 2.0 * u_tex_size0.y * v_texcoord0.y; + color = res; + } + + if (mod(y, 2.0) > 0.99999) + { + res = res; + } + else + { + res = vec4(pow(texture2D(s0, v_texcoord0), exponent)); + } + + gl_FragColor = vec4(pow((res + color) / 2.0, inv_exponent)); +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/misc/fs_deposterize-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_deposterize-pass0.sc new file mode 100644 index 00000000000..cbff9f450e8 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_deposterize-pass0.sc @@ -0,0 +1,45 @@ +$input v_color0, v_texcoord0, v_texcoord1 + +// license:GPL-2.0+ +// copyright-holders:Hyllian + +/* + Hyllian's Deposterize Shader - Pass0 + + Copyright (C) 2011/2016 Hyllian/Jararaca - sergiogdb@gmail.com + +*/ + +#include "common.sh" + +// Samplers +SAMPLER2D(decal, 0); + +uniform vec4 EQ_THRESH1; +uniform vec4 DIFF_THRESH1; + +vec3 df3(vec3 c1, vec3 c2) +{ + return abs(c1 - c2); +} + +bvec3 le3(vec3 A, vec3 B, vec3 param) +{ + return lessThanEqual(df3(A, B), param); +} + +bvec3 gt3(vec3 A, vec3 B, vec3 param) +{ + return greaterThan(df3(A, B), param); +} + +void main() +{ + vec3 D = texture2D(decal, v_texcoord1.xw).rgb; + vec3 E = texture2D(decal, v_texcoord1.yw).rgb; + vec3 F = texture2D(decal, v_texcoord1.zw).rgb; + + vec3 res = (any(gt3(D, F, EQ_THRESH1.xxx)) && (any(le3(E, F, DIFF_THRESH1.xxx)) && any(le3(D, E, EQ_THRESH1.xxx)) || any(le3(D, E, DIFF_THRESH1.xxx)) && any(le3(E, F, EQ_THRESH1.xxx)))) ? 0.5 * (D + F) : E; + + gl_FragColor = vec4(res, 1.0); +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/misc/fs_deposterize-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_deposterize-pass1.sc new file mode 100644 index 00000000000..c6e0e87b018 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_deposterize-pass1.sc @@ -0,0 +1,45 @@ +$input v_color0, v_texcoord0, v_texcoord1 + +// license:GPL-2.0+ +// copyright-holders:Hyllian + +/* + Hyllian's Deposterize Shader - Pass1 + + Copyright (C) 2011/2016 Hyllian/Jararaca - sergiogdb@gmail.com + +*/ + +#include "common.sh" + +// Samplers +SAMPLER2D(decal, 0); + +uniform vec4 EQ_THRESH2; +uniform vec4 DIFF_THRESH2; + +vec3 df3(vec3 c1, vec3 c2) +{ + return abs(c1 - c2); +} + +bvec3 le3(vec3 A, vec3 B, vec3 param) +{ + return lessThanEqual(df3(A, B), param); +} + +bvec3 gt3(vec3 A, vec3 B, vec3 param) +{ + return greaterThan(df3(A, B), param); +} + +void main() +{ + vec3 B = texture2D(decal, v_texcoord1.xy).rgb; + vec3 E = texture2D(decal, v_texcoord1.xz).rgb; + vec3 H = texture2D(decal, v_texcoord1.xw).rgb; + + vec3 res = (any(gt3(B, H, EQ_THRESH2.xxx)) && (any(le3(E, H, DIFF_THRESH2.xxx)) && any(le3(B, E, EQ_THRESH2.xxx)) || any(le3(B, E, DIFF_THRESH2.xxx)) && any(le3(E, H, EQ_THRESH2.xxx)))) ? 0.5 * (B + H) : E; + + gl_FragColor = vec4(res, 1.0); +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/fs_saturation.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_saturation.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/fs_saturation.sc rename to src/osd/modules/render/bgfx/shaders/chains/misc/fs_saturation.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/misc/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/varying.def.sc new file mode 100644 index 00000000000..8404fc635e1 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/misc/varying.def.sc @@ -0,0 +1,7 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/vs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/hlsl/vs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/misc/vs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/hq2x/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/vs_bob-and-ghost-deinterlace.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/hq2x/vs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/misc/vs_bob-and-ghost-deinterlace.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/misc/vs_deposterize-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/vs_deposterize-pass0.sc new file mode 100644 index 00000000000..1c3b3ee592f --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/misc/vs_deposterize-pass0.sc @@ -0,0 +1,30 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_color0 + +// license:GPL-2.0+ +// copyright-holders:Hyllian + +/* + Hyllian's Deposterize Shader - Pass0 vertex shader + + Copyright (C) 2011/2016 Hyllian/Jararaca - sergiogdb@gmail.com + +*/ + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + + vec2 ps = vec2(1.0 / u_tex_size0.xy); + float dx = ps.x; + float dy = ps.y; + + // This line fixes a bug in ATI cards. + v_texcoord0 = a_texcoord0 + vec2(0.0000001, 0.0000001); + v_texcoord1 = v_texcoord0.xxxy + vec4(-dx, 0, dx, 0); // D E F + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/misc/vs_deposterize-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/vs_deposterize-pass1.sc new file mode 100644 index 00000000000..7af87394655 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/misc/vs_deposterize-pass1.sc @@ -0,0 +1,30 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_color0 + +// license:GPL-2.0+ +// copyright-holders:Hyllian + +/* + Hyllian's Deposterize Shader - Pass1 vertex shader + + Copyright (C) 2011/2016 Hyllian/Jararaca - sergiogdb@gmail.com + +*/ + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + + vec2 ps = vec2(1.0 / u_tex_size0.xy); + float dx = ps.x; + float dy = ps.y; + + // This line fixes a bug in ATI cards. + v_texcoord0 = a_texcoord0 + vec2(0.0000001, 0.0000001); + v_texcoord1 = v_texcoord0.xyyy + vec4(0, -dy, 0, dy); // D E F + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/vs_saturation.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/vs_saturation.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/vs_saturation.sc rename to src/osd/modules/render/bgfx/shaders/chains/misc/vs_saturation.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/fs_saturation.sc b/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/fs_saturation.sc deleted file mode 100644 index c14f61601c8..00000000000 --- a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/fs_saturation.sc +++ /dev/null @@ -1,25 +0,0 @@ -$input v_color0, v_texcoord0 - -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz - -#include "common.sh" - -// User-supplied -uniform vec4 u_saturation; - -// Samplers -SAMPLER2D(s_tex, 0); - -void main() -{ - vec4 base = texture2D(s_tex, v_texcoord0); - vec3 rgb = base.rgb; - - vec3 gray = vec3(0.299, 0.587, 0.114); - float luma = dot(rgb, gray); - vec3 chroma = rgb - luma; - vec3 saturated = luma + chroma * u_saturation.x; - - gl_FragColor = vec4(saturated, base.a); -} diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/fs_saturation.sc b/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/fs_saturation.sc deleted file mode 100644 index c14f61601c8..00000000000 --- a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/fs_saturation.sc +++ /dev/null @@ -1,25 +0,0 @@ -$input v_color0, v_texcoord0 - -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz - -#include "common.sh" - -// User-supplied -uniform vec4 u_saturation; - -// Samplers -SAMPLER2D(s_tex, 0); - -void main() -{ - vec4 base = texture2D(s_tex, v_texcoord0); - vec3 rgb = base.rgb; - - vec3 gray = vec3(0.299, 0.587, 0.114); - float luma = dot(rgb, gray); - vec3 chroma = rgb - luma; - vec3 saturated = luma + chroma * u_saturation.x; - - gl_FragColor = vec4(saturated, base.a); -} diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/fs_saturation.sc b/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/fs_saturation.sc deleted file mode 100644 index c14f61601c8..00000000000 --- a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/fs_saturation.sc +++ /dev/null @@ -1,25 +0,0 @@ -$input v_color0, v_texcoord0 - -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz - -#include "common.sh" - -// User-supplied -uniform vec4 u_saturation; - -// Samplers -SAMPLER2D(s_tex, 0); - -void main() -{ - vec4 base = texture2D(s_tex, v_texcoord0); - vec3 rgb = base.rgb; - - vec3 gray = vec3(0.299, 0.587, 0.114); - float luma = dot(rgb, gray); - vec3 chroma = rgb - luma; - vec3 saturated = luma + chroma * u_saturation.x; - - gl_FragColor = vec4(saturated, base.a); -} diff --git a/src/osd/modules/render/bgfx/shaders/chains/hq2x/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-4p/fs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/hq2x/fs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-4p/fs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-4p/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-4p/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-4p/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/hq3x/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-4p/vs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/hq3x/vs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-4p/vs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/hq3x/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-6p-smoother/fs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/hq3x/fs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-6p-smoother/fs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-6p-smoother/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-6p-smoother/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-6p-smoother/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/hq4x/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-6p-smoother/vs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/hq4x/vs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/super-4xbr-3d-6p-smoother/vs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/hq4x/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-hybrid/fs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/hq4x/fs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-hybrid/fs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-hybrid/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-hybrid/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-hybrid/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-hybrid/vs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/vs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-hybrid/vs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv1-noblend/fs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/fs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv1-noblend/fs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv1-noblend/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv1-noblend/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv1-noblend/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv1-noblend/vs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/vs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv1-noblend/vs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-3d/fs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_vertical/fs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-3d/fs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-3d/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-3d/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-3d/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-3d/vs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/vs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-3d/vs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-multipass/fs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/fs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-multipass/fs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-multipass/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-multipass/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-multipass/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-multipass/vs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/vs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-multipass/vs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-smart-blur/fs_blit.sc similarity index 100% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/fs_blit.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-smart-blur/fs_blit.sc diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-smart-blur/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-smart-blur/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-smart-blur/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/vs_saturation.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-smart-blur/vs_blit.sc similarity index 75% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/vs_saturation.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-smart-blur/vs_blit.sc index 57be1439a8b..405ef8feb3b 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_left_horizontal/vs_saturation.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-accuracy-smart-blur/vs_blit.sc @@ -9,6 +9,6 @@ $output v_texcoord0, v_color0 void main() { gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); - v_texcoord0 = a_texcoord0 * vec2(0.16666666 * 0.9, 1.0 * 0.8) + vec2(0.1, 0.1); + v_texcoord0 = a_texcoord0; v_color0 = a_color0; } diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/vs_saturation.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/vs_blit.sc similarity index 72% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/vs_saturation.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/vs_blit.sc index ef86b6a0a43..405ef8feb3b 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_vertical/vs_saturation.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-deposterize/vs_blit.sc @@ -9,6 +9,6 @@ $output v_texcoord0, v_color0 void main() { gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); - v_texcoord0 = a_texcoord0 * vec2(1.0 * 0.8, 0.685185 * 0.9) + vec2(0.1, 0.9 - 0.685185 * 0.9); + v_texcoord0 = a_texcoord0; v_color0 = a_color0; } diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/vs_saturation.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/vs_blit.sc similarity index 71% rename from src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/vs_saturation.sc rename to src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/vs_blit.sc index c0f9321abc1..405ef8feb3b 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/pillarbox_right_horizontal/vs_saturation.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-fast/vs_blit.sc @@ -9,6 +9,6 @@ $output v_texcoord0, v_color0 void main() { gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); - v_texcoord0 = a_texcoord0 * vec2(0.16666666 * 0.9, 1.0 * 0.8) + vec2(0.9 - 0.16666666 * 0.9, 0.1); + v_texcoord0 = a_texcoord0; v_color0 = a_color0; } diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/vs_blit.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-multipass/vs_blit.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/vs_blit.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv2-noblend/vs_blit.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/vs_blit.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-multipass/vs_blit.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/vs_blit.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3-noblend/vs_blit.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/vs_blit.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-lv3/vs_blit.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/vs_blit.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-dilation/vs_blit.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/fs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/fs_blit.sc new file mode 100644 index 00000000000..9af7bcf0ee6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/fs_blit.sc @@ -0,0 +1,14 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +// Samplers +SAMPLER2D(s_tex, 0); + +void main() +{ + gl_FragColor = texture2D(s_tex, v_texcoord0) * v_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/vs_blit.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/vs_blit.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr-mlv4-multipass/vs_blit.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv1-noblend.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv1-noblend.sc new file mode 100644 index 00000000000..72212fa74a7 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv1-noblend.sc @@ -0,0 +1,132 @@ +$input v_texcoord0, v_texcoord1, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + Hyllian's xBR-lv1-noblend Shader + + Copyright (C) 2011-2014 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +uniform vec4 XBR_Y_WEIGHT; +uniform vec4 XBR_EQ_THRESHOLD; + +uniform vec4 u_tex_size0; + +SAMPLER2D(decal, 0); + +// Uncomment just one of the three params below to choose the corner detection +//#define CORNER_A +//#define CORNER_B +#define CORNER_C + +float RGBtoYUV(vec3 color) +{ + return dot(color, XBR_Y_WEIGHT.xxx * vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < XBR_EQ_THRESHOLD.x); +} + +float weighted_distance(float a, float b, float c, float d, float e, float f, float g, float h) +{ + return (df(a,b) + df(a,c) + df(d,e) + df(d,f) + 4.0*df(g,h)); +} + +/* + xBR LVL1 works over the pixels below: + + |B |C | + |D |E |F |F4| + |G |H |I |I4| + |H5|I5| + + Consider E as the central pixel. xBR LVL1 needs only to look at 12 texture pixels. +*/ + +void main() +{ + vec2 pos = fract(v_texcoord0 * u_tex_size0.xy) - vec2(0.5, 0.5); // pos = pixel position + vec2 dir = sign(pos); // dir = pixel direction + + vec2 g1 = dir * v_texcoord1.xy; + vec2 g2 = dir * v_texcoord1.zw; + + vec3 B = texture2D(decal, v_texcoord0 +g1 ).xyz; + vec3 C = texture2D(decal, v_texcoord0 +g1-g2).xyz; + vec3 D = texture2D(decal, v_texcoord0 +g2).xyz; + vec3 E = texture2D(decal, v_texcoord0 ).xyz; + vec3 F = texture2D(decal, v_texcoord0 -g2).xyz; + vec3 G = texture2D(decal, v_texcoord0 -g1+g2).xyz; + vec3 H = texture2D(decal, v_texcoord0 -g1 ).xyz; + vec3 I = texture2D(decal, v_texcoord0 -g1-g2).xyz; + + vec3 F4 = texture2D(decal,v_texcoord0 -2.0*g2 ).xyz; + vec3 I4 = texture2D(decal,v_texcoord0 -g1-2.0*g2 ).xyz; + vec3 H5 = texture2D(decal,v_texcoord0 -2.0*g1 ).xyz; + vec3 I5 = texture2D(decal,v_texcoord0 -2.0*g1-g2 ).xyz; + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); + float i5 = RGBtoYUV( I5 ); + float h5 = RGBtoYUV( H5 ); + float f4 = RGBtoYUV( F4 ); + + bool fx = (dot(dir,pos) > 0.5); // inequations of straight lines. + +// It uses CORNER_C if none of the others are defined. +#ifdef CORNER_A + bool interp_restriction_lv1 = ((e!=f) && (e!=h)); +#elif CORNER_B + bool interp_restriction_lv1 = ((e!=f) && (e!=h) && ( !eq(f,b) && !eq(h,d) || eq(e,i) && !eq(f,i4) && !eq(h,i5) || eq(e,g) || eq(e,c) ) ); +#else + bool interp_restriction_lv1 = ((e!=f) && (e!=h) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); +#endif + bool edr = (weighted_distance(e, c, g, i, h5, f4, h, f) < weighted_distance(h, d, i5, f, i4, b, e, i)) && interp_restriction_lv1; // edr = edge detection rule + + bool nc = (edr && fx); // new_color + + bool px = (df(e,f) <= df(e,h)); // px = pixel + + vec3 res = nc ? px ? F : H : E; + + // final sum and weight normalization + gl_FragColor = vec4(res, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2-3d.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2-3d.sc new file mode 100644 index 00000000000..1febb8f5ee3 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2-3d.sc @@ -0,0 +1,260 @@ +$input v_texcoord0, v_texcoord1, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + Hyllian's xBR-lv2-3d Shader + + Copyright (C) 2011-2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + Incorporates some of the ideas from SABR shader. Thanks to Joshua Street. +*/ + +#include "common.sh" + +uniform vec4 XBR_SCALE; +uniform vec4 XBR_Y_WEIGHT; +uniform vec4 XBR_EQ_THRESHOLD; +uniform vec4 XBR_LV2_COEFFICIENT; +uniform vec4 XBR_RES; + +uniform vec4 u_tex_size0; + +SAMPLER2D(decal, 0); + +// Uncomment just one of the three params below to choose the corner detection +//#define CORNER_A +//#define CORNER_B +#define CORNER_C +//#define CORNER_D + +#ifndef CORNER_A + #define SMOOTH_TIPS +#endif + +const vec4 Ao = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 Bo = vec4( 1.0, 1.0, -1.0,-1.0 ); +const vec4 Co = vec4( 1.5, 0.5, -0.5, 0.5 ); +const vec4 Ax = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 Bx = vec4( 0.5, 2.0, -0.5,-2.0 ); +const vec4 Cx = vec4( 1.0, 1.0, -0.5, 0.0 ); +const vec4 Ay = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 By = vec4( 2.0, 0.5, -2.0,-0.5 ); +const vec4 Cy = vec4( 2.0, 0.0, -1.0, 0.5 ); +const vec4 Ci = vec4(0.25, 0.25, 0.25, 0.25); + +const vec4 Y = vec4(0.2126, 0.7152, 0.0722, 0.0); + +vec4 df(vec4 A, vec4 B) +{ + return abs(A - B); +} + +float c_df(vec3 c1, vec3 c2) +{ + vec3 df = abs(c1 - c2); + return df.r + df.g + df.b; +} + +vec4 ge(vec4 A, vec4 B) +{ + return vec4(greaterThanEqual(A, B)); +} + +vec4 le(vec4 A, vec4 B) +{ + return vec4(lessThanEqual(A, B)); +} + +vec4 lt(vec4 A, vec4 B) +{ + return vec4(lessThan(A, B)); +} + +vec4 eq(vec4 A, vec4 B) +{ + return vec4(equal(A, B)); +} + +vec4 ne(vec4 A, vec4 B) +{ + return vec4(notEqual(A, B)); +} + +vec4 abslt(vec4 A, vec4 B) +{ + return lt(df(A, B), XBR_EQ_THRESHOLD.xxxx); +} + +vec4 absge(vec4 A, vec4 B) +{ + return ge(df(A, B), XBR_EQ_THRESHOLD.xxxx); +} + +vec4 weighted_distance(vec4 a, vec4 b, vec4 c, vec4 d, vec4 e, vec4 f, vec4 g, vec4 h) +{ + return (df(a,b) + df(a,c) + df(d,e) + df(d,f) + 4.0*df(g,h)); +} + +void main() +{ + vec4 delta = 1.0 / XBR_SCALE.xxxx; + vec4 deltaL = vec4(0.5, 1.0, 0.5, 1.0) / XBR_SCALE.xxxx; + vec4 deltaU = deltaL.yxwz; + + vec2 fp = fract(v_texcoord0 * u_tex_size0.xy / XBR_RES.xx); + + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES.xx) + vec2(0.5, 0.5)) * XBR_RES.xx / u_tex_size0.xy; + + vec2 dx = v_texcoord1.xy; + vec2 dy = v_texcoord1.zw; + + vec4 A = texture2D(decal, v_texcoord0 -dx -dy); + vec4 B = texture2D(decal, v_texcoord0 -dy); + vec4 C = texture2D(decal, v_texcoord0 +dx -dy); + vec4 D = texture2D(decal, v_texcoord0 -dx ); + vec4 E = texture2D(decal, v_texcoord0 ); + vec4 F = texture2D(decal, v_texcoord0 +dx ); + vec4 G = texture2D(decal, v_texcoord0 -dx +dy); + vec4 H = texture2D(decal, v_texcoord0 +dy); + vec4 I = texture2D(decal, v_texcoord0 +dx +dy); + + vec4 A1 = texture2D(decal, v_texcoord0 -dx -2.0*dy); + vec4 B1 = texture2D(decal, v_texcoord0 -2.0*dy); + vec4 C1 = texture2D(decal, v_texcoord0 +dx -2.0*dy); + vec4 G5 = texture2D(decal, v_texcoord0 -dx +2.0*dy); + vec4 H5 = texture2D(decal, v_texcoord0 +2.0*dy); + vec4 I5 = texture2D(decal, v_texcoord0 +dx +2.0*dy); + vec4 A0 = texture2D(decal, v_texcoord0 -2.0*dx -dy); + vec4 D0 = texture2D(decal, v_texcoord0 -2.0*dx ); + vec4 G0 = texture2D(decal, v_texcoord0 -2.0*dx +dy); + vec4 C4 = texture2D(decal, v_texcoord0 +2.0*dx -dy); + vec4 F4 = texture2D(decal, v_texcoord0 +2.0*dx ); + vec4 I4 = texture2D(decal, v_texcoord0 +2.0*dx +dy); + + vec4 F6 = texture2D(decal, tex +dx+0.25*dx+0.25*dy); + vec4 F7 = texture2D(decal, tex +dx+0.25*dx-0.25*dy); + vec4 F8 = texture2D(decal, tex +dx-0.25*dx-0.25*dy); + vec4 F9 = texture2D(decal, tex +dx-0.25*dx+0.25*dy); + + vec4 B6 = texture2D(decal, tex +0.25*dx+0.25*dy-dy); + vec4 B7 = texture2D(decal, tex +0.25*dx-0.25*dy-dy); + vec4 B8 = texture2D(decal, tex -0.25*dx-0.25*dy-dy); + vec4 B9 = texture2D(decal, tex -0.25*dx+0.25*dy-dy); + + vec4 D6 = texture2D(decal, tex -dx+0.25*dx+0.25*dy); + vec4 D7 = texture2D(decal, tex -dx+0.25*dx-0.25*dy); + vec4 D8 = texture2D(decal, tex -dx-0.25*dx-0.25*dy); + vec4 D9 = texture2D(decal, tex -dx-0.25*dx+0.25*dy); + + vec4 H6 = texture2D(decal, tex +0.25*dx+0.25*dy+dy); + vec4 H7 = texture2D(decal, tex +0.25*dx-0.25*dy+dy); + vec4 H8 = texture2D(decal, tex -0.25*dx-0.25*dy+dy); + vec4 H9 = texture2D(decal, tex -0.25*dx+0.25*dy+dy); + + vec4 b = mul(mat4(B, D, H, F), XBR_Y_WEIGHT.xxxx * Y); + vec4 c = mul(mat4(C, A, G, I), XBR_Y_WEIGHT.xxxx * Y); + vec4 e = mul(mat4(E, E, E, E), XBR_Y_WEIGHT.xxxx * Y); + vec4 d = b.yzwx; + vec4 f = b.wxyz; + vec4 g = c.zwxy; + vec4 h = b.zwxy; + vec4 i = c.wxyz; + + vec4 i4 = mul(mat4(I4, C1, A0, G5), XBR_Y_WEIGHT.xxxx * Y); + vec4 i5 = mul(mat4(I5, C4, A1, G0), XBR_Y_WEIGHT.xxxx * Y); + vec4 h5 = mul(mat4(H5, F4, B1, D0), XBR_Y_WEIGHT.xxxx * Y); + vec4 f4 = h5.yzwx; + + vec4 f0 = mul(mat4(F6, B6, D6, H6), XBR_Y_WEIGHT.xxxx * Y); + vec4 f1 = mul(mat4(F7, B7, D7, H7), XBR_Y_WEIGHT.xxxx * Y); + vec4 f2 = mul(mat4(F8, B8, D8, H8), XBR_Y_WEIGHT.xxxx * Y); + vec4 f3 = mul(mat4(F9, B9, D9, H9), XBR_Y_WEIGHT.xxxx * Y); + + vec4 h0 = f0.wxyz; + vec4 h1 = f1.wxyz; + vec4 h2 = f2.wxyz; + vec4 h3 = f3.wxyz; + + // These inequations define the line below which interpolation occurs. + vec4 fx = (Ao*fp.y+Bo*fp.x); + vec4 fx_left = (Ax*fp.y+Bx*fp.x); + vec4 fx_up = (Ay*fp.y+By*fp.x); + + vec4 block_3d = (eq(f0,f1) * eq(f1,f2) * eq(f2,f3) * eq(h0,h1) * eq(h1,h2) * eq(h2,h3)); + vec4 interp_restriction_lv0 = (ne(e,f) * ne(e,h) * block_3d); + vec4 interp_restriction_lv1 = interp_restriction_lv0; + +#ifdef CORNER_B + interp_restriction_lv1 = (interp_restriction_lv0 * (ge(f,b) * ge(h,d) + eq(e,i) * ge(f,i4) * ge(h,i5) + eq(e,g) + eq(e,c))); +#endif +#ifdef CORNER_D + vec4 c1 = i4.yzwx; + vec4 g0 = i5.wxyz; + interp_restriction_lv1 = (interp_restriction_lv0 * (ge(f,b) * ge(h,d) + eq(e,i) * ge(f,i4) * ge(h,i5) + eq(e,g) + eq(e,c) ) * (ne(f,f4) * ne(f,i) + ne(h,h5) * ne(h,i) + ne(h,g) + ne(f,c) + eq(b,c1) * eq(d,g0))); +#endif +#ifdef CORNER_C + interp_restriction_lv1 = (interp_restriction_lv0 * (ge(f,b) * ge(f,c) + ge(h,d) * ge(h,g) + eq(e,i) * (ge(f,f4) * ge(f,i4) + ge(h,h5) * ge(h,i5)) + eq(e,g) + eq(e,c))); +#endif + + vec4 interp_restriction_lv2_left = (ne(e,g) * ne(d,g)); + vec4 interp_restriction_lv2_up = (ne(e,c) * ne(b,c)); + + vec4 fx45i = saturate((fx + delta -Co - Ci) / (2.0 * delta )); + vec4 fx45 = saturate((fx + delta -Co ) / (2.0 * delta )); + vec4 fx30 = saturate((fx_left + deltaL -Cx ) / (2.0 * deltaL)); + vec4 fx60 = saturate((fx_up + deltaU -Cy ) / (2.0 * deltaU)); + + vec4 wd1 = weighted_distance( e, c, g, i, h5, f4, h, f); + vec4 wd2 = weighted_distance( h, d, i5, f, i4, b, e, i); + + vec4 edri = le(wd1,wd2) * interp_restriction_lv0; + vec4 edr = lt(wd1,wd2) * interp_restriction_lv1; + vec4 edr_left = le(XBR_LV2_COEFFICIENT.xxxx * df(f,g), df(h,c)) * interp_restriction_lv2_left * edr; + vec4 edr_up = ge(df(f,g), XBR_LV2_COEFFICIENT.xxxx * df(h,c)) * interp_restriction_lv2_up * edr; + + fx45 = edr * fx45; + fx30 = edr_left * fx30; + fx60 = edr_up * fx60; + fx45i = edri * fx45i; + + vec4 px = le(df(e,f3), df(e,h1)); + +#ifdef SMOOTH_TIPS + vec4 maximos = max(max(fx30, fx60), max(fx45, fx45i)); +#else + vec4 maximos = max(max(fx30, fx60), fx45); +#endif + + vec3 res1 = E.xyz; + res1 = mix(res1, mix(H.xyz, F.xyz, px.x), maximos.x); + res1 = mix(res1, mix(B.xyz, D.xyz, px.z), maximos.z); + + vec3 res2 = E.xyz; + res2 = mix(res2, mix(F.xyz, B.xyz, px.y), maximos.y); + res2 = mix(res2, mix(D.xyz, H.xyz, px.w), maximos.w); + + vec3 E_mix = (c_df(E.xyz, res2) >= c_df(E.xyz, res1)) ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 res = mix(res1, res2, E_mix); + + gl_FragColor = vec4(res, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2-fast.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2-fast.sc new file mode 100644 index 00000000000..0525a1bd297 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2-fast.sc @@ -0,0 +1,201 @@ +$input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + Hyllian's xBR-lv2-lq Shader + + Copyright (C) 2011/2015 Hyllian/Jararaca - sergiogdb@gmail.com + + Copyright (C) 2011-2015 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + Incorporates some of the ideas from SABR shader. Thanks to Joshua Street. +*/ + +#include "common.sh" + +uniform vec4 XBR_SCALE; +uniform vec4 XBR_Y_WEIGHT; +uniform vec4 XBR_EQ_THRESHOLD; +uniform vec4 XBR_LV2_COEFFICIENT; + +uniform vec4 u_tex_size0; + +SAMPLER2D(decal, 0); + +// Uncomment just one of the three params below to choose the corner detection +//#define CORNER_A +#define CORNER_C + +#ifdef CORNER_C + #define SMOOTH_TIPS +#endif + +const vec4 Ao = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 Bo = vec4( 1.0, 1.0, -1.0,-1.0 ); +const vec4 Co = vec4( 1.5, 0.5, -0.5, 0.5 ); +const vec4 Ax = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 Bx = vec4( 0.5, 2.0, -0.5,-2.0 ); +const vec4 Cx = vec4( 1.0, 1.0, -0.5, 0.0 ); +const vec4 Ay = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 By = vec4( 2.0, 0.5, -2.0,-0.5 ); +const vec4 Cy = vec4( 2.0, 0.0, -1.0, 0.5 ); +const vec4 Ci = vec4(0.25, 0.25, 0.25, 0.25); + +const vec4 Y = vec4(0.2126, 0.7152, 0.0722, 0.0); + +vec4 df(vec4 A, vec4 B) +{ + return abs(A - B); +} + +float c_df(vec3 c1, vec3 c2) +{ + vec3 df = abs(c1 - c2); + return df.r + df.g + df.b; +} + +vec4 ge(vec4 A, vec4 B) +{ + return vec4(greaterThanEqual(A, B)); +} + +vec4 le(vec4 A, vec4 B) +{ + return vec4(lessThanEqual(A, B)); +} + +vec4 lt(vec4 A, vec4 B) +{ + return vec4(lessThan(A, B)); +} + +vec4 eq(vec4 A, vec4 B) +{ + return vec4(equal(A, B)); +} + +vec4 ne(vec4 A, vec4 B) +{ + return vec4(notEqual(A, B)); +} + +vec4 abslt(vec4 A, vec4 B) +{ + return lt(df(A, B), XBR_EQ_THRESHOLD.xxxx); +} + +vec4 absge(vec4 A, vec4 B) +{ + return ge(df(A, B), XBR_EQ_THRESHOLD.xxxx); +} + +vec4 weighted_distance(vec4 a, vec4 b, vec4 c, vec4 d, vec4 e, vec4 f, vec4 g, vec4 h) +{ + return (df(c,d) + df(e,f) + 3.0*df(g,h)); +// return (1.0*df(a,b) + 2.0*df(c,d) + 2.0*df(e,f) + 4.0*df(g,h)); +} + +void main() +{ + vec4 delta = 1.0 / XBR_SCALE.xxxx; + vec4 deltaL = vec4(0.5, 1.0, 0.5, 1.0) / XBR_SCALE.xxxx; + vec4 deltaU = deltaL.yxwz; + + vec2 fp = fract(v_texcoord0 * u_tex_size0.xy); + + vec4 A = texture2D(decal, v_texcoord1.xw); + vec4 B = texture2D(decal, v_texcoord1.yw); + vec4 C = texture2D(decal, v_texcoord1.zw); + + vec4 D = texture2D(decal, v_texcoord2.xw); + vec4 E = texture2D(decal, v_texcoord2.yw); + vec4 F = texture2D(decal, v_texcoord2.zw); + + vec4 G = texture2D(decal, v_texcoord3.xw); + vec4 H = texture2D(decal, v_texcoord3.yw); + vec4 I = texture2D(decal, v_texcoord3.zw); + + vec4 b = mul(mat4(B, D, H, F), XBR_Y_WEIGHT.xxxx * Y); + vec4 c = mul(mat4(C, A, G, I), XBR_Y_WEIGHT.xxxx * Y); + vec4 e = mul(mat4(E, E, E, E), XBR_Y_WEIGHT.xxxx * Y); + vec4 a = c.yzwx; + vec4 d = b.yzwx; + vec4 f = b.wxyz; + vec4 g = c.zwxy; + vec4 h = b.zwxy; + vec4 i = c.wxyz; + + // These inequations define the line below which interpolation occurs. + vec4 fx = (Ao*fp.y+Bo*fp.x); + vec4 fx_left = (Ax*fp.y+Bx*fp.x); + vec4 fx_up = (Ay*fp.y+By*fp.x); + + vec4 interp_restriction_lv0 = (ne(e,f) * ne(e,h)); + vec4 interp_restriction_lv1 = interp_restriction_lv0; + +#ifndef CORNER_A + interp_restriction_lv1 = clamp(interp_restriction_lv0 * (ge(f,b) * ge(f,c) + ge(h,d) * ge(h,g) + lt(e,g) + lt(e,c)), 0.0, 1.0); +#endif + + vec4 interp_restriction_lv2_left = (ne(e,g) * ne(d,g)); + vec4 interp_restriction_lv2_up = (ne(e,c) * ne(b,c)); + + vec4 fx45i = saturate((fx + delta -Co - Ci) / (2.0 * delta )); + vec4 fx45 = saturate((fx + delta -Co ) / (2.0 * delta )); + vec4 fx30 = saturate((fx_left + deltaL -Cx ) / (2.0 * deltaL)); + vec4 fx60 = saturate((fx_up + deltaU -Cy ) / (2.0 * deltaU)); + + vec4 wd1 = weighted_distance( d, b, g, e, e, c, h, f); + vec4 wd2 = weighted_distance( a, e, b, f, d, h, e, i); + + vec4 edri = le(wd1, wd2) * interp_restriction_lv0; + vec4 edr = lt(wd1, wd2) * interp_restriction_lv1; + vec4 edr_left = le(XBR_LV2_COEFFICIENT.xxxx * df(f,g), df(h,c)) * interp_restriction_lv2_left * edr; + vec4 edr_up = ge(df(f,g), XBR_LV2_COEFFICIENT.xxxx * df(h,c)) * interp_restriction_lv2_up * edr; + + fx45 = edr * fx45; + fx30 = edr_left * fx30; + fx60 = edr_up * fx60; + fx45i = edri * fx45i; + + vec4 px = le(df(e,f), df(e,h)); + +#ifdef SMOOTH_TIPS + vec4 maximos = max(max(fx30, fx60), max(fx45, fx45i)); +#else + vec4 maximos = max(max(fx30, fx60), fx45); +#endif + + vec3 res1 = E.xyz; + res1 = mix(res1, mix(H.xyz, F.xyz, px.x), maximos.x); + res1 = mix(res1, mix(B.xyz, D.xyz, px.z), maximos.z); + + vec3 res2 = E.xyz; + res2 = mix(res2, mix(F.xyz, B.xyz, px.y), maximos.y); + res2 = mix(res2, mix(D.xyz, H.xyz, px.w), maximos.w); + + vec3 E_mix = (c_df(E.xyz, res2) >= c_df(E.xyz, res1)) ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 res = mix(res1, res2, E_mix); + + gl_FragColor = vec4(res, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2.sc new file mode 100644 index 00000000000..421cf1efb9d --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv2.sc @@ -0,0 +1,229 @@ +$input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_texcoord5, v_texcoord6, v_texcoord7, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + Hyllian's xBR-lv2 Shader + + Copyright (C) 2011-2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + Incorporates some of the ideas from SABR shader. Thanks to Joshua Street. +*/ + +#include "common.sh" + +uniform vec4 XBR_SCALE; +uniform vec4 XBR_Y_WEIGHT; +uniform vec4 XBR_EQ_THRESHOLD; +uniform vec4 XBR_LV2_COEFFICIENT; + +uniform vec4 u_tex_size0; + +SAMPLER2D(decal, 0); + +// Uncomment just one of the three params below to choose the corner detection +#define CORNER_A +//#define CORNER_B +//#define CORNER_C +//#define CORNER_D + +const vec4 Ao = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 Bo = vec4( 1.0, 1.0, -1.0,-1.0 ); +const vec4 Co = vec4( 1.5, 0.5, -0.5, 0.5 ); +const vec4 Ax = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 Bx = vec4( 0.5, 2.0, -0.5,-2.0 ); +const vec4 Cx = vec4( 1.0, 1.0, -0.5, 0.0 ); +const vec4 Ay = vec4( 1.0, -1.0, -1.0, 1.0 ); +const vec4 By = vec4( 2.0, 0.5, -2.0,-0.5 ); +const vec4 Cy = vec4( 2.0, 0.0, -1.0, 0.5 ); +const vec4 Ci = vec4(0.25, 0.25, 0.25, 0.25); + +const vec4 Y = vec4(0.2126, 0.7152, 0.0722, 0.0); + +vec4 df(vec4 A, vec4 B) +{ + return abs(A - B); +} + +float c_df(vec3 c1, vec3 c2) +{ + vec3 df = abs(c1 - c2); + return df.r + df.g + df.b; +} + +vec4 ge(vec4 A, vec4 B) +{ + return vec4(greaterThanEqual(A, B)); +} + +vec4 le(vec4 A, vec4 B) +{ + return vec4(lessThanEqual(A, B)); +} + +vec4 lt(vec4 A, vec4 B) +{ + return vec4(lessThan(A, B)); +} + +vec4 eq(vec4 A, vec4 B) +{ + return vec4(equal(A, B)); +} + +vec4 ne(vec4 A, vec4 B) +{ + return vec4(notEqual(A, B)); +} + +vec4 abslt(vec4 A, vec4 B) +{ + return lt(df(A, B), XBR_EQ_THRESHOLD.xxxx); +} + +vec4 absge(vec4 A, vec4 B) +{ + return ge(df(A, B), XBR_EQ_THRESHOLD.xxxx); +} + +vec4 weighted_distance(vec4 a, vec4 b, vec4 c, vec4 d, vec4 e, vec4 f, vec4 g, vec4 h) +{ + return (df(a,b) + df(a,c) + df(d,e) + df(d,f) + 4.0*df(g,h)); +} + +void main() +{ + vec4 delta = 1.0 / XBR_SCALE.xxxx; + vec4 deltaL = vec4(0.5, 1.0, 0.5, 1.0) / XBR_SCALE.xxxx; + vec4 deltaU = deltaL.yxwz; + + vec2 fp = fract(v_texcoord0 * u_tex_size0.xy); + + vec4 A1 = texture2D(decal, v_texcoord1.xw); + vec4 B1 = texture2D(decal, v_texcoord1.yw); + vec4 C1 = texture2D(decal, v_texcoord1.zw); + + vec4 A = texture2D(decal, v_texcoord2.xw); + vec4 B = texture2D(decal, v_texcoord2.yw); + vec4 C = texture2D(decal, v_texcoord2.zw); + + vec4 D = texture2D(decal, v_texcoord3.xw); + vec4 E = texture2D(decal, v_texcoord3.yw); + vec4 F = texture2D(decal, v_texcoord3.zw); + + vec4 G = texture2D(decal, v_texcoord4.xw); + vec4 H = texture2D(decal, v_texcoord4.yw); + vec4 I = texture2D(decal, v_texcoord4.zw); + + vec4 G5 = texture2D(decal, v_texcoord5.xw); + vec4 H5 = texture2D(decal, v_texcoord5.yw); + vec4 I5 = texture2D(decal, v_texcoord5.zw); + + vec4 A0 = texture2D(decal, v_texcoord6.xy); + vec4 D0 = texture2D(decal, v_texcoord6.xz); + vec4 G0 = texture2D(decal, v_texcoord6.xw); + + vec4 C4 = texture2D(decal, v_texcoord7.xy); + vec4 F4 = texture2D(decal, v_texcoord7.xz); + vec4 I4 = texture2D(decal, v_texcoord7.xw); + + vec4 b = mul(mat4(B, D, H, F), XBR_Y_WEIGHT.xxxx * Y); + vec4 c = mul(mat4(C, A, G, I), XBR_Y_WEIGHT.xxxx * Y); + vec4 e = mul(mat4(E, E, E, E), XBR_Y_WEIGHT.xxxx * Y); + vec4 d = b.yzwx; + vec4 f = b.wxyz; + vec4 g = c.zwxy; + vec4 h = b.zwxy; + vec4 i = c.wxyz; + + vec4 i4 = mul(mat4(I4, C1, A0, G5), XBR_Y_WEIGHT.xxxx * Y); + vec4 i5 = mul(mat4(I5, C4, A1, G0), XBR_Y_WEIGHT.xxxx * Y); + vec4 h5 = mul(mat4(H5, F4, B1, D0), XBR_Y_WEIGHT.xxxx * Y); + vec4 f4 = h5.yzwx; + + // These inequations define the line below which interpolation occurs. + vec4 fx = (Ao*fp.y+Bo*fp.x); + vec4 fx_left = (Ax*fp.y+Bx*fp.x); + vec4 fx_up = (Ay*fp.y+By*fp.x); + + vec4 interp_restriction_lv0 = (ne(e,f) * ne(e,h)); + vec4 interp_restriction_lv1 = interp_restriction_lv0; + +#ifdef CORNER_B + interp_restriction_lv1 = (interp_restriction_lv0 * ( ge(f,b) * ge(h,d) + lt(e,i) * ge(f,i4) * ge(h,i5) + lt(e,g) + lt(e,c) ) ); +#endif +#ifdef CORNER_D + vec4 c1 = i4.yzwx; + vec4 g0 = i5.wxyz; + interp_restriction_lv1 = (interp_restriction_lv0 * ( ge(f,b) * ge(h,d) + lt(e,i) * ge(f,i4) * ge(h,i5) + lt(e,g) + lt(e,c) ) * (ne(f,f4) * ne(f,i) + ne(h,h5) * ne(h,i) + ne(h,g) + ne(f,c) + lt(b,c1) * lt(d,g0))); +#endif +#ifdef CORNER_C + interp_restriction_lv1 = (interp_restriction_lv0 * ( ge(f,b) * ge(f,c) + ge(h,d) * ge(h,g) + lt(e,i) * (ge(f,f4) * ge(f,i4) + ge(h,h5) * ge(h,i5)) + lt(e,g) + lt(e,c)) ); +#endif + + vec4 interp_restriction_lv2_left = (ne(e,g) * ne(d,g)); + vec4 interp_restriction_lv2_up = (ne(e,c) * ne(b,c)); + + vec4 fx45i = saturate((fx + delta -Co - Ci) / (2.0 * delta )); + vec4 fx45 = saturate((fx + delta -Co ) / (2.0 * delta )); + vec4 fx30 = saturate((fx_left + deltaL -Cx ) / (2.0 * deltaL)); + vec4 fx60 = saturate((fx_up + deltaU -Cy ) / (2.0 * deltaU)); + + vec4 wd1 = weighted_distance( e, c, g, i, h5, f4, h, f); + vec4 wd2 = weighted_distance( h, d, i5, f, i4, b, e, i); + + vec4 one = vec4(1.0, 1.0, 1.0, 1.0); + vec4 zero = vec4(0.0, 0.0, 0.0, 0.0); + vec4 edri = le(wd1,wd2) * interp_restriction_lv0; + vec4 edr = lt(wd1,wd2) * interp_restriction_lv1; +#ifdef CORNER_A + edr = clamp(edr * ((one - edri.yzwx) + (one - edri.wxyz)), 0.0, 1.0); + vec4 edr_left = le(XBR_LV2_COEFFICIENT.xxxx * df(f,g), df(h,c)) * interp_restriction_lv2_left * edr * (one - edri.yzwx) * eq(e,c); + vec4 edr_up = ge(df(f,g), XBR_LV2_COEFFICIENT.xxxx * df(h,c)) * interp_restriction_lv2_up * edr * (one - edri.wxyz) * eq(e,g); +#endif +#ifndef CORNER_A + vec4 edr_left = le(XBR_LV2_COEFFICIENT.xxxx * df(f,g), df(h,c)) * interp_restriction_lv2_left * edr; + vec4 edr_up = ge(df(f,g), XBR_LV2_COEFFICIENT.xxxx * df(h,c)) * interp_restriction_lv2_up * edr; +#endif + + fx45 = edr * fx45; + fx30 = edr_left * fx30; + fx60 = edr_up * fx60; + fx45i = edri * fx45i; + + vec4 px = le(df(e,f), df(e,h)); + + vec4 maximos = max(max(fx30, fx60), max(fx45, fx45i)); + + vec3 res1 = E.xyz; + res1 = mix(res1, mix(H.xyz, F.xyz, px.x), maximos.x); + res1 = mix(res1, mix(B.xyz, D.xyz, px.z), maximos.z); + + vec3 res2 = E.xyz; + res2 = mix(res2, mix(F.xyz, B.xyz, px.y), maximos.y); + res2 = mix(res2, mix(D.xyz, H.xyz, px.w), maximos.w); + + vec3 E_mix = (c_df(E.xyz, res2) >= c_df(E.xyz, res1)) ? one.xyz : zero.xyz; + vec3 res = mix(res1, res2, E_mix); + + gl_FragColor = vec4(res, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_custom-jinc2-sharper.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_custom-jinc2-sharper.sc new file mode 100644 index 00000000000..0abd7ff41c9 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_custom-jinc2-sharper.sc @@ -0,0 +1,134 @@ +$input v_texcoord0, v_color0 + +// license:GPL-2.0+ +// copyright-holders:Hyllian + +/* + Hyllian's jinc windowed-jinc 2-lobe sharper with anti-ringing Shader + + Copyright (C) 2011-2014 Hyllian/Jararaca - sergiogdb@gmail.com +*/ + +#include "common.sh" + +uniform vec4 JINC2_WINDOW_SINC; +uniform vec4 JINC2_SINC; +uniform vec4 JINC2_AR_STRENGTH; +uniform vec4 u_tex_size0; + +SAMPLER2D(s_p, 0); + + /* + This is an approximation of Jinc(x)*Jinc(x*r1/r2) for x < 2.5, + where r1 and r2 are the first two zeros of jinc function. + For a jinc 2-lobe best approximation, use A=0.5 and B=0.825. + */ + +// A=0.5, B=0.825 is the best jinc approximation for x<2.5. if B=1.0, it's a lanczos filter. +// Increase A to get more blur. Decrease it to get a sharper picture. +// B = 0.825 to get rid of dithering. Increase B to get a fine sharpness, though dithering returns. + +#define halfpi 1.5707963267948966192313216916398 +#define pi 3.1415926535897932384626433832795 +#define wa (JINC2_WINDOW_SINC.x * pi) +#define wb (JINC2_SINC.x * pi) + +float df(float A, float B) +{ + return abs(A-B); +} + +// Calculates the distance between two points +float d(vec2 pt1, vec2 pt2) +{ + vec2 v = pt2 - pt1; + return sqrt(dot(v,v)); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +vec4 resampler(vec4 x) +{ + float wawb = wa*wb; + vec4 wawb4 = vec4(wawb, wawb, wawb, wawb); + return (x == vec4(0.0, 0.0, 0.0, 0.0)) ? wawb4 : sin(x*wa) * sin(x*wb) / (x*x); +} + +void main() +{ + vec3 color; + mat4 weights; + + vec2 dx = vec2(1.0, 0.0); + vec2 dy = vec2(0.0, 1.0); + + vec2 pc = v_texcoord0 * u_tex_size0.xy; + + vec2 tc = (floor(pc - vec2(0.5,0.5)) + vec2(0.5,0.5)); + + weights[0] = resampler(vec4(d(pc, tc -dx -dy), d(pc, tc -dy), d(pc, tc +dx -dy), d(pc, tc+2.0*dx -dy))); + weights[1] = resampler(vec4(d(pc, tc -dx ), d(pc, tc ), d(pc, tc +dx ), d(pc, tc+2.0*dx ))); + weights[2] = resampler(vec4(d(pc, tc -dx +dy), d(pc, tc +dy), d(pc, tc +dx +dy), d(pc, tc+2.0*dx +dy))); + weights[3] = resampler(vec4(d(pc, tc -dx+2.0*dy), d(pc, tc +2.0*dy), d(pc, tc +dx+2.0*dy), d(pc, tc+2.0*dx+2.0*dy))); + + //weights[0][0] = weights[0][3] = weights[3][0] = weights[3][3] = 0.0; + + dx = dx / u_tex_size0.xy; + dy = dy / u_tex_size0.xy; + tc = tc / u_tex_size0.xy; + + // reading the texels + + vec4 c00 = texture2D(s_p, tc -dx -dy); + vec4 c10 = texture2D(s_p, tc -dy); + vec4 c20 = texture2D(s_p, tc +dx -dy); + vec4 c30 = texture2D(s_p, tc+2.0*dx -dy); + vec4 c01 = texture2D(s_p, tc -dx ); + vec4 c11 = texture2D(s_p, tc ); + vec4 c21 = texture2D(s_p, tc +dx ); + vec4 c31 = texture2D(s_p, tc+2.0*dx ); + vec4 c02 = texture2D(s_p, tc -dx +dy); + vec4 c12 = texture2D(s_p, tc +dy); + vec4 c22 = texture2D(s_p, tc +dx +dy); + vec4 c32 = texture2D(s_p, tc+2.0*dx +dy); + vec4 c03 = texture2D(s_p, tc -dx+2.0*dy); + vec4 c13 = texture2D(s_p, tc +2.0*dy); + vec4 c23 = texture2D(s_p, tc +dx+2.0*dy); + vec4 c33 = texture2D(s_p, tc+2.0*dx+2.0*dy); + + color = mul(weights[0], mat4(c00, c10, c20, c30)).xyz; + color+= mul(weights[1], mat4(c01, c11, c21, c31)).xyz; + color+= mul(weights[2], mat4(c02, c12, c22, c32)).xyz; + color+= mul(weights[3], mat4(c03, c13, c23, c33)).xyz; + color = color / (dot(mul(weights, vec4(1.0, 1.0, 1.0, 1.0)), vec4(1.0, 1.0, 1.0, 1.0))); + + // Anti-ringing + // Get min/max samples + pc = v_texcoord0; + c00 = texture2D(s_p, pc ); + c11 = texture2D(s_p, pc +dx ); + c21 = texture2D(s_p, pc -dx ); + c12 = texture2D(s_p, pc +dy); + c22 = texture2D(s_p, pc -dy); + + vec4 min_sample = min4(c11, c21, c12, c22); + vec4 max_sample = max4(c11, c21, c12, c22); + min_sample = min(min_sample, c00); + max_sample = max(max_sample, c00); + + vec3 aux = color; + + color = clamp(color, min_sample.xyz, max_sample.xyz); + color = mix(aux, color, JINC2_AR_STRENGTH.xxx); + + // final sum and weight normalization + gl_FragColor = vec4(color, 1); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.sc new file mode 100644 index 00000000000..8fa47570af5 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.sc @@ -0,0 +1,227 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader - pass0 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define XBR_RES 2.0 + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 2.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define weight1 (XBR_WEIGHT.x * 1.29633 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.75068 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + //Skip pixels on wrong grid + vec2 fraction = fract(v_texcoord0 * u_tex_size0.xy / XBR_RES); + if (fraction.x < 0.5 || fraction.y < 0.5) + { + gl_FragColor = texture2D(s0, v_texcoord0); + return; + } + + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES) + vec2(0.5, 0.5)) * XBR_RES / u_tex_size0.xy; + + vec2 g1 = vec2(XBR_RES / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, XBR_RES / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord0 -g1 -g2); + vec4 P1 = texture2D(s0, v_texcoord0 +2.0*g1 -g2); + vec4 P2 = texture2D(s0, v_texcoord0 -g1+2.0*g2); + vec4 P3 = texture2D(s0, v_texcoord0 +2.0*g1+2.0*g2); + + vec4 B = texture2D(s0, v_texcoord0 -g2); + vec4 C = texture2D(s0, v_texcoord0 +g1-g2); + vec4 D = texture2D(s0, v_texcoord0 -g1 ); + vec4 E = texture2D(s0, v_texcoord0 ); + vec4 F = texture2D(s0, v_texcoord0 +g1 ); + vec4 G = texture2D(s0, v_texcoord0 -g1+g2); + vec4 H = texture2D(s0, v_texcoord0 +g2); + vec4 I = texture2D(s0, v_texcoord0 +g1+g2); + + vec4 F4 = texture2D(s0, v_texcoord0 +2.0*g1 ); + vec4 I4 = texture2D(s0, v_texcoord0 +g2+2.0*g1 ); + vec4 H5 = texture2D(s0, v_texcoord0 +2.0*g2 ); + vec4 I5 = texture2D(s0, v_texcoord0 +2.0*g2+g1 ); + + vec4 F6 = texture2D(s0, tex + g1 + 0.25 * g1 + 0.25 * g2); + vec4 F7 = texture2D(s0, tex + g1 + 0.25 * g1 - 0.25 * g2); + vec4 F8 = texture2D(s0, tex + g1 - 0.25 * g1 - 0.25 * g2); + vec4 F9 = texture2D(s0, tex + g1 - 0.25 * g1 + 0.25 * g2); + + vec4 H6 = texture2D(s0, tex + 0.25 * g1 + 0.25 * g2 + g2); + vec4 H7 = texture2D(s0, tex + 0.25 * g1 - 0.25 * g2 + g2); + vec4 H8 = texture2D(s0, tex - 0.25 * g1 - 0.25 * g2 + g2); + vec4 H9 = texture2D(s0, tex - 0.25 * g1 + 0.25 * g2 + g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1)).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3)).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4( E, F, H, I ) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4( E, F, H, I ) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : E.xyz; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.sc new file mode 100644 index 00000000000..72009ad3335 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.sc @@ -0,0 +1,211 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader - pass0 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); +SAMPLER2D(ORIG_texture, 1); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define XBR_RES 2.0 + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 4.0 +#define wp5 0.0 +#define wp6 0.0 + +#define weight1 (XBR_WEIGHT.x * 1.75068 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.29633 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + +float RGBtoYUV(vec4 color) +{ + return dot(color, vec4(0.2126, 0.7152, 0.0722, 0.0)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + // Skip pixels on wrong grid + vec2 dir = fract(v_texcoord0 * u_tex_size0.xy / XBR_RES) - vec2(0.5, 0.5); + if ((dir.x * dir.y) > 0.0) + { + gl_FragColor = texture2D(s0, v_texcoord0); + return; + } + + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES) + vec2(0.5, 0.5)) * XBR_RES / u_tex_size0.xy; + + vec2 g1 = vec2((XBR_RES / 2.0) / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, (XBR_RES / 2.0) / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord0 -3.0*g1 ); + vec4 P1 = texture2D(s0, v_texcoord0 -3.0*g2); + vec4 P2 = texture2D(s0, v_texcoord0 +3.0*g2); + vec4 P3 = texture2D(s0, v_texcoord0 +3.0*g1 ); + + vec4 B = texture2D(s0, v_texcoord0 -2.0*g1 -g2); + vec4 C = texture2D(s0, v_texcoord0 -g1 -2.0*g2); + vec4 D = texture2D(s0, v_texcoord0 -2.0*g1 +g2); + vec4 E = texture2D(s0, v_texcoord0 -g1 ); + vec4 F = texture2D(s0, v_texcoord0 -g2); + vec4 G = texture2D(s0, v_texcoord0 -g1 +2.0*g2); + vec4 H = texture2D(s0, v_texcoord0 +g2); + vec4 I = texture2D(s0, v_texcoord0 +g1 ); + + vec4 F4 = texture2D(s0,v_texcoord0 +g1 -2.0*g2); + vec4 I4 = texture2D(s0,v_texcoord0 +2.0*g1 -g2); + vec4 H5 = texture2D(s0,v_texcoord0 +g1 +2.0*g2); + vec4 I5 = texture2D(s0,v_texcoord0 +2.0*g1 +g2); + + vec3 A = texture2D(s0, v_texcoord0).xyz; + + g1 *= 2.0; + g2 *= 2.0; + + vec4 F6 = texture2D(ORIG_texture, tex +g1+0.25*g1+0.25*g2); + vec4 F7 = texture2D(ORIG_texture, tex +g1+0.25*g1-0.25*g2); + vec4 F8 = texture2D(ORIG_texture, tex +g1-0.25*g1-0.25*g2); + vec4 F9 = texture2D(ORIG_texture, tex +g1-0.25*g1+0.25*g2); + + vec4 H6 = texture2D(ORIG_texture, tex +0.25*g1+0.25*g2+g2); + vec4 H7 = texture2D(ORIG_texture, tex +0.25*g1-0.25*g2+g2); + vec4 H8 = texture2D(ORIG_texture, tex -0.25*g1-0.25*g2+g2); + vec4 H9 = texture2D(ORIG_texture, tex -0.25*g1+0.25*g2+g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1)).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3)).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4( E, F, H, I ) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4( E, F, H, I ) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : A; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.sc new file mode 100644 index 00000000000..c2656424ed6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.sc @@ -0,0 +1,213 @@ +$input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader - pass2 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); +SAMPLER2D(ORIG_texture, 1); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define XBR_RES 2.0 + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 0.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define weight1 (XBR_WEIGHT.x * 1.29633 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.75068 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + + +float RGBtoYUV(vec4 color) +{ + return dot(color, vec4(0.2126, 0.7152, 0.0722, 0.0)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES) + vec2(0.5, 0.5)) * XBR_RES / u_tex_size0.xy; + + vec2 g1 = vec2(XBR_RES / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, XBR_RES / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord1.xy); + vec4 P1 = texture2D(s0, v_texcoord1.zy); + vec4 P2 = texture2D(s0, v_texcoord1.xw); + vec4 P3 = texture2D(s0, v_texcoord1.zw); + + vec4 B = texture2D(s0, v_texcoord2.xy); + vec4 C = texture2D(s0, v_texcoord2.zy); + vec4 H5 = texture2D(s0, v_texcoord2.xw); + vec4 I5 = texture2D(s0, v_texcoord2.zw); + + vec4 D = texture2D(s0, v_texcoord3.xy); + vec4 F4 = texture2D(s0, v_texcoord3.zy); + vec4 G = texture2D(s0, v_texcoord3.xw); + vec4 I4 = texture2D(s0, v_texcoord3.zw); + + vec4 E = texture2D(s0, v_texcoord4.xy); + vec4 F = texture2D(s0, v_texcoord4.zy); + vec4 H = texture2D(s0, v_texcoord4.xw); + vec4 I = texture2D(s0, v_texcoord4.zw); + + vec4 A = texture2D(s0, v_texcoord0); + + vec4 F6 = texture2D(ORIG_texture, tex +g1+0.25*g1+0.25*g2); + vec4 F7 = texture2D(ORIG_texture, tex +g1+0.25*g1-0.25*g2); + vec4 F8 = texture2D(ORIG_texture, tex +g1-0.25*g1-0.25*g2); + vec4 F9 = texture2D(ORIG_texture, tex +g1-0.25*g1+0.25*g2); + + vec4 H6 = texture2D(ORIG_texture, tex +0.25*g1+0.25*g2+g2); + vec4 H7 = texture2D(ORIG_texture, tex +0.25*g1-0.25*g2+g2); + vec4 H8 = texture2D(ORIG_texture, tex -0.25*g1-0.25*g2+g2); + vec4 H9 = texture2D(ORIG_texture, tex -0.25*g1+0.25*g2+g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV(B); + float c = RGBtoYUV(C); + float d = RGBtoYUV(D); + float e = RGBtoYUV(E); + float f = RGBtoYUV(F); + float g = RGBtoYUV(G); + float h = RGBtoYUV(H); + float i = RGBtoYUV(I); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1)).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3)).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4( E, F, H, I ) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4( E, F, H, I ) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : A.xyz; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.sc new file mode 100644 index 00000000000..8a56a3899a6 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.sc @@ -0,0 +1,217 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass0 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 2.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define XBR_RES 4.0 + +#define weight1 (XBR_WEIGHT.x * 1.29633 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.75068 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + //Skip pixels on wrong grid + vec2 fraction = fract(v_texcoord0 * u_tex_size0.xy / XBR_RES); + if (fraction.x < 0.5 || fraction.y < 0.5) + { + gl_FragColor = texture2D(s0, v_texcoord0); + return; + } + + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES) + vec2(0.5, 0.5)) * XBR_RES / u_tex_size0.xy; + + vec2 g1 = vec2(XBR_RES / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, XBR_RES / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord0 -g1 -g2); + vec4 P1 = texture2D(s0, v_texcoord0 +2.0*g1 -g2); + vec4 P2 = texture2D(s0, v_texcoord0 -g1+2.0*g2); + vec4 P3 = texture2D(s0, v_texcoord0 +2.0*g1+2.0*g2); + + vec4 B = texture2D(s0, v_texcoord0 -g2); + vec4 C = texture2D(s0, v_texcoord0 +g1-g2); + vec4 D = texture2D(s0, v_texcoord0 -g1 ); + vec4 E = texture2D(s0, v_texcoord0 ); + vec4 F = texture2D(s0, v_texcoord0 +g1 ); + vec4 G = texture2D(s0, v_texcoord0 -g1+g2); + vec4 H = texture2D(s0, v_texcoord0 +g2); + vec4 I = texture2D(s0, v_texcoord0 +g1+g2); + + vec4 F4 = texture2D(s0,v_texcoord0 +2.0*g1 ); + vec4 I4 = texture2D(s0,v_texcoord0 +g2+2.0*g1 ); + vec4 H5 = texture2D(s0,v_texcoord0 +2.0*g2 ); + vec4 I5 = texture2D(s0,v_texcoord0 +2.0*g2+g1 ); + + vec4 F6 = texture2D(s0, tex +g1+0.25*g1+0.25*g2); + vec4 F7 = texture2D(s0, tex +g1+0.25*g1-0.25*g2); + vec4 F8 = texture2D(s0, tex +g1-0.25*g1-0.25*g2); + vec4 F9 = texture2D(s0, tex +g1-0.25*g1+0.25*g2); + + vec4 H6 = texture2D(s0, tex +0.25*g1+0.25*g2+g2); + vec4 H7 = texture2D(s0, tex +0.25*g1-0.25*g2+g2); + vec4 H8 = texture2D(s0, tex -0.25*g1-0.25*g2+g2); + vec4 H9 = texture2D(s0, tex -0.25*g1+0.25*g2+g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : E.xyz; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.sc new file mode 100644 index 00000000000..10288b45f5a --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.sc @@ -0,0 +1,210 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass1 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); +SAMPLER2D(ORIG_texture, 1); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 4.0 +#define wp5 0.0 +#define wp6 0.0 + +#define XBR_RES 4.0 + +#define weight1 (XBR_WEIGHT.x * 1.75068 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.29633 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + //Skip pixels on wrong grid + vec2 dir = fract(v_texcoord0 * u_tex_size0.xy / XBR_RES) - vec2(0.5, 0.5); + if ((dir.x * dir.y) > 0.0) + { + gl_FragColor = texture2D(s0, v_texcoord0); + return; + } + + vec2 tex = (floor(v_texcoord0*u_tex_size0.xy / XBR_RES) + vec2(0.5, 0.5)) * XBR_RES / u_tex_size0.xy; + + vec2 g1 = vec2((XBR_RES/2.0)/u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, (XBR_RES/2.0)/u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord0 -3.0*g1 ); + vec4 P1 = texture2D(s0, v_texcoord0 -3.0*g2); + vec4 P2 = texture2D(s0, v_texcoord0 +3.0*g2); + vec4 P3 = texture2D(s0, v_texcoord0 +3.0*g1 ); + + vec4 B = texture2D(s0, v_texcoord0 -2.0*g1 -g2); + vec4 C = texture2D(s0, v_texcoord0 -g1 -2.0*g2); + vec4 D = texture2D(s0, v_texcoord0 -2.0*g1 +g2); + vec4 E = texture2D(s0, v_texcoord0 -g1 ); + vec4 F = texture2D(s0, v_texcoord0 -g2); + vec4 G = texture2D(s0, v_texcoord0 -g1 +2.0*g2); + vec4 H = texture2D(s0, v_texcoord0 +g2); + vec4 I = texture2D(s0, v_texcoord0 +g1 ); + + vec4 F4 = texture2D(s0,v_texcoord0 +g1 -2.0*g2); + vec4 I4 = texture2D(s0,v_texcoord0 +2.0*g1 -g2); + vec4 H5 = texture2D(s0,v_texcoord0 +g1 +2.0*g2); + vec4 I5 = texture2D(s0,v_texcoord0 +2.0*g1 +g2); + + vec4 A = texture2D(s0, v_texcoord0); + + g1 *= 2.0; + g2 *= 2.0; + + vec4 F6 = texture2D(ORIG_texture, tex +g1+0.25*g1+0.25*g2); + vec4 F7 = texture2D(ORIG_texture, tex +g1+0.25*g1-0.25*g2); + vec4 F8 = texture2D(ORIG_texture, tex +g1-0.25*g1-0.25*g2); + vec4 F9 = texture2D(ORIG_texture, tex +g1-0.25*g1+0.25*g2); + + vec4 H6 = texture2D(ORIG_texture, tex +0.25*g1+0.25*g2+g2); + vec4 H7 = texture2D(ORIG_texture, tex +0.25*g1-0.25*g2+g2); + vec4 H8 = texture2D(ORIG_texture, tex -0.25*g1-0.25*g2+g2); + vec4 H9 = texture2D(ORIG_texture, tex -0.25*g1+0.25*g2+g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : A.xyz; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.sc new file mode 100644 index 00000000000..51f2c6ea887 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.sc @@ -0,0 +1,211 @@ +$input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass1 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); +SAMPLER2D(ORIG_texture, 1); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define XBR_RES 4.0 + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 0.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define weight1 (XBR_WEIGHT.x * 1.29633 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.75068 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES) + vec2(0.5, 0.5)) * XBR_RES / u_tex_size0.xy; + + vec2 g1 = vec2(XBR_RES / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, XBR_RES / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord1.xy); + vec4 P1 = texture2D(s0, v_texcoord1.zy); + vec4 P2 = texture2D(s0, v_texcoord1.xw); + vec4 P3 = texture2D(s0, v_texcoord1.zw); + + vec4 B = texture2D(s0, v_texcoord2.xy); + vec4 C = texture2D(s0, v_texcoord2.zy); + vec4 H5 = texture2D(s0, v_texcoord2.xw); + vec4 I5 = texture2D(s0, v_texcoord2.zw); + + vec4 D = texture2D(s0, v_texcoord3.xy); + vec4 F4 = texture2D(s0, v_texcoord3.zy); + vec4 G = texture2D(s0, v_texcoord3.xw); + vec4 I4 = texture2D(s0, v_texcoord3.zw); + + vec4 E = texture2D(s0, v_texcoord4.xy); + vec4 F = texture2D(s0, v_texcoord4.zy); + vec4 H = texture2D(s0, v_texcoord4.xw); + vec4 I = texture2D(s0, v_texcoord4.zw); + + vec4 A = texture2D(s0, v_texcoord0); + + vec4 F6 = texture2D(ORIG_texture, tex +g1+0.25*g1+0.25*g2); + vec4 F7 = texture2D(ORIG_texture, tex +g1+0.25*g1-0.25*g2); + vec4 F8 = texture2D(ORIG_texture, tex +g1-0.25*g1-0.25*g2); + vec4 F9 = texture2D(ORIG_texture, tex +g1-0.25*g1+0.25*g2); + + vec4 H6 = texture2D(ORIG_texture, tex +0.25*g1+0.25*g2+g2); + vec4 H7 = texture2D(ORIG_texture, tex +0.25*g1-0.25*g2+g2); + vec4 H8 = texture2D(ORIG_texture, tex -0.25*g1-0.25*g2+g2); + vec4 H9 = texture2D(ORIG_texture, tex -0.25*g1+0.25*g2+g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : A.xyz; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.sc new file mode 100644 index 00000000000..f1566381325 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.sc @@ -0,0 +1,226 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass2 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 2.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define XBR_RES2 2.0 + +#define weight1 (XBR_WEIGHT.x * 1.29633 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.75068 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + //Skip pixels on wrong grid + vec2 fraction = fract(v_texcoord0 * u_tex_size0.xy / XBR_RES2); + if (fraction.x < 0.5 || fraction.y < 0.5) + { + gl_FragColor = texture2D(s0, v_texcoord0); + return; + } + + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES2) + vec2(0.5, 0.5)) * XBR_RES2 / u_tex_size0.xy; + + vec2 g1 = vec2(XBR_RES2 / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, XBR_RES2 / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord0 -g1 -g2); + vec4 P1 = texture2D(s0, v_texcoord0 +2.0*g1 -g2); + vec4 P2 = texture2D(s0, v_texcoord0 -g1+2.0*g2); + vec4 P3 = texture2D(s0, v_texcoord0 +2.0*g1+2.0*g2); + + vec4 B = texture2D(s0, v_texcoord0 -g2); + vec4 C = texture2D(s0, v_texcoord0 +g1-g2); + vec4 D = texture2D(s0, v_texcoord0 -g1 ); + vec4 E = texture2D(s0, v_texcoord0 ); + vec4 F = texture2D(s0, v_texcoord0 +g1 ); + vec4 G = texture2D(s0, v_texcoord0 -g1+g2); + vec4 H = texture2D(s0, v_texcoord0 +g2); + vec4 I = texture2D(s0, v_texcoord0 +g1+g2); + + vec4 F4 = texture2D(s0,v_texcoord0 +2.0*g1 ); + vec4 I4 = texture2D(s0,v_texcoord0 +g2+2.0*g1 ); + vec4 H5 = texture2D(s0,v_texcoord0 +2.0*g2 ); + vec4 I5 = texture2D(s0,v_texcoord0 +2.0*g2+g1 ); + + vec4 F6 = texture2D(s0, tex +g1+0.25*g1+0.25*g2); + vec4 F7 = texture2D(s0, tex +g1+0.25*g1-0.25*g2); + vec4 F8 = texture2D(s0, tex +g1-0.25*g1-0.25*g2); + vec4 F9 = texture2D(s0, tex +g1-0.25*g1+0.25*g2); + + vec4 H6 = texture2D(s0, tex +0.25*g1+0.25*g2+g2); + vec4 H7 = texture2D(s0, tex +0.25*g1-0.25*g2+g2); + vec4 H8 = texture2D(s0, tex -0.25*g1-0.25*g2+g2); + vec4 H9 = texture2D(s0, tex -0.25*g1+0.25*g2+g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : E.xyz; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.sc new file mode 100644 index 00000000000..3aa921a0e37 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.sc @@ -0,0 +1,210 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass3 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); +SAMPLER2D(ORIG_texture, 1); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 4.0 +#define wp5 0.0 +#define wp6 0.0 + +#define XBR_RES2 2.0 + +#define weight1 (XBR_WEIGHT.x * 1.75068 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.29633 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + //Skip pixels on wrong grid + vec2 dir = fract(v_texcoord0 * u_tex_size0.xy / XBR_RES2) - vec2(0.5, 0.5); + if ((dir.x * dir.y) > 0.0) + { + gl_FragColor = texture2D(s0, v_texcoord0); + return; + } + + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES2) + vec2(0.5, 0.5)) * XBR_RES2 / u_tex_size0.xy; + + vec2 g1 = vec2((XBR_RES2 / 2.0) / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, (XBR_RES2 / 2.0) / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord0 -3.0*g1 ); + vec4 P1 = texture2D(s0, v_texcoord0 -3.0*g2); + vec4 P2 = texture2D(s0, v_texcoord0 +3.0*g2); + vec4 P3 = texture2D(s0, v_texcoord0 +3.0*g1 ); + + vec4 B = texture2D(s0, v_texcoord0 -2.0*g1 -g2); + vec4 C = texture2D(s0, v_texcoord0 -g1 -2.0*g2); + vec4 D = texture2D(s0, v_texcoord0 -2.0*g1 +g2); + vec4 E = texture2D(s0, v_texcoord0 -g1 ); + vec4 F = texture2D(s0, v_texcoord0 -g2); + vec4 G = texture2D(s0, v_texcoord0 -g1 +2.0*g2); + vec4 H = texture2D(s0, v_texcoord0 +g2); + vec4 I = texture2D(s0, v_texcoord0 +g1 ); + + vec4 F4 = texture2D(s0,v_texcoord0 +g1 -2.0*g2); + vec4 I4 = texture2D(s0,v_texcoord0 +2.0*g1 -g2); + vec4 H5 = texture2D(s0,v_texcoord0 +g1 +2.0*g2); + vec4 I5 = texture2D(s0,v_texcoord0 +2.0*g1 +g2); + + vec4 A = texture2D(s0, v_texcoord0); + + g1 *= 2.0; + g2 *= 2.0; + + vec4 F6 = texture2D(ORIG_texture, tex +g1+0.25*g1+0.25*g2); + vec4 F7 = texture2D(ORIG_texture, tex +g1+0.25*g1-0.25*g2); + vec4 F8 = texture2D(ORIG_texture, tex +g1-0.25*g1-0.25*g2); + vec4 F9 = texture2D(ORIG_texture, tex +g1-0.25*g1+0.25*g2); + + vec4 H6 = texture2D(ORIG_texture, tex +0.25*g1+0.25*g2+g2); + vec4 H7 = texture2D(ORIG_texture, tex +0.25*g1-0.25*g2+g2); + vec4 H8 = texture2D(ORIG_texture, tex -0.25*g1-0.25*g2+g2); + vec4 H9 = texture2D(ORIG_texture, tex -0.25*g1+0.25*g2+g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : A.xyz; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.sc new file mode 100644 index 00000000000..b417613a657 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.sc @@ -0,0 +1,211 @@ +$input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super 4XBR 3D Shader - pass3 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); +SAMPLER2D(ORIG_texture, 1); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define XBR_RES 2.0 + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 0.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define weight1 (XBR_WEIGHT.x * 1.29633 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.75068 / 10.0 / 2.0) + +vec4 reduce4(vec4 A, vec4 B, vec4 C, vec4 D) +{ + return mul(mat4(A, B, C, D), vec4(65536.0, 255.0, 1.0, 0.0)); +} + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +bool eq(float A, float B) +{ + return (df(A, B) < 15.0); +} + + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + vec2 tex = (floor(v_texcoord0 * u_tex_size0.xy / XBR_RES) + vec2(0.5, 0.5)) * XBR_RES / u_tex_size0.xy; + + vec2 g1 = vec2(XBR_RES / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, XBR_RES / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord1.xy); + vec4 P1 = texture2D(s0, v_texcoord1.zy); + vec4 P2 = texture2D(s0, v_texcoord1.xw); + vec4 P3 = texture2D(s0, v_texcoord1.zw); + + vec4 B = texture2D(s0, v_texcoord2.xy); + vec4 C = texture2D(s0, v_texcoord2.zy); + vec4 H5 = texture2D(s0, v_texcoord2.xw); + vec4 I5 = texture2D(s0, v_texcoord2.zw); + + vec4 D = texture2D(s0, v_texcoord3.xy); + vec4 F4 = texture2D(s0, v_texcoord3.zy); + vec4 G = texture2D(s0, v_texcoord3.xw); + vec4 I4 = texture2D(s0, v_texcoord3.zw); + + vec4 E = texture2D(s0, v_texcoord4.xy); + vec4 F = texture2D(s0, v_texcoord4.zy); + vec4 H = texture2D(s0, v_texcoord4.xw); + vec4 I = texture2D(s0, v_texcoord4.zw); + + vec4 A = texture2D(s0, v_texcoord0); + + vec4 F6 = texture2D(ORIG_texture, tex +g1+0.25*g1+0.25*g2); + vec4 F7 = texture2D(ORIG_texture, tex +g1+0.25*g1-0.25*g2); + vec4 F8 = texture2D(ORIG_texture, tex +g1-0.25*g1-0.25*g2); + vec4 F9 = texture2D(ORIG_texture, tex +g1-0.25*g1+0.25*g2); + + vec4 H6 = texture2D(ORIG_texture, tex +0.25*g1+0.25*g2+g2); + vec4 H7 = texture2D(ORIG_texture, tex +0.25*g1-0.25*g2+g2); + vec4 H8 = texture2D(ORIG_texture, tex -0.25*g1-0.25*g2+g2); + vec4 H9 = texture2D(ORIG_texture, tex -0.25*g1+0.25*g2+g2); + + vec4 f0 = reduce4(F6, F7, F8, F9); + vec4 h0 = reduce4(H6, H7, H8, H9); + + bool block_3d = (f0.x == f0.y && f0.y == f0.z && f0.z == f0.w && h0.x == h0.y && h0.y == h0.z && h0.z == h0.w); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + bool ir_lv1 = (((e!=f) && (e!=h)) && ( !eq(f,b) && !eq(f,c) || !eq(h,d) && !eq(h,g) || eq(e,i) && (!eq(f,f4) && !eq(f,i4) || !eq(h,h5) && !eq(h,i5)) || eq(e,g) || eq(e,c)) ); + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); + + color = block_3d ? color : A.xyz; + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.sc new file mode 100644 index 00000000000..84fc371a0a7 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.sc @@ -0,0 +1,169 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass0 ******* + + Copyright (c) 2015 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 2.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define weight (XBR_WEIGHT.x * 1.29633 / 10.0) + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + //Skip pixels on wrong grid + vec2 pix_frac = fract(v_texcoord0 * u_tex_size0.xy); + if (pix_frac.x < 0.5 || pix_frac.y < 0.5) + { + gl_FragColor = texture2D(s0, v_texcoord0); + return; + } + + vec2 g1 = vec2(1.0 / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, 1.0 / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord0 -g1 -g2); + vec4 P1 = texture2D(s0, v_texcoord0 +2.0*g1 -g2); + vec4 P2 = texture2D(s0, v_texcoord0 -g1+2.0*g2); + vec4 P3 = texture2D(s0, v_texcoord0 +2.0*g1+2.0*g2); + + vec4 B = texture2D(s0, v_texcoord0 -g2); + vec4 C = texture2D(s0, v_texcoord0 +g1-g2); + vec4 D = texture2D(s0, v_texcoord0 -g1 ); + vec4 E = texture2D(s0, v_texcoord0 ); + vec4 F = texture2D(s0, v_texcoord0 +g1 ); + vec4 G = texture2D(s0, v_texcoord0 -g1+g2); + vec4 H = texture2D(s0, v_texcoord0 +g2); + vec4 I = texture2D(s0, v_texcoord0 +g1+g2); + + vec4 F4 = texture2D(s0,v_texcoord0 +2.0*g1 ); + vec4 I4 = texture2D(s0,v_texcoord0 +g2+2.0*g1 ); + vec4 H5 = texture2D(s0,v_texcoord0 +2.0*g2 ); + vec4 I5 = texture2D(s0,v_texcoord0 +2.0*g2+g1 ); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(-limits, limits, d_edge); + + /* Filter weights. Two taps only. */ + vec4 w = vec4(-weight, weight+0.5, weight+0.5, -weight); + + /* Filtering and normalization in two directions generating two colors. */ + vec3 c1 = mul(w, mat4(P2, H, F, P1)).xyz; + vec3 c2 = mul(w, mat4(P0, E, I, P3)).xyz; + + /* Smoothly blends the two directions according to edge strength. */ + vec3 color = mix(c1, c2, vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); +// color = mix(aux, color, 1-2.0*abs(edge_strength-0.5)); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.sc new file mode 100644 index 00000000000..d67c215de66 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.sc @@ -0,0 +1,159 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass1 ******* + + Copyright (c) 2015 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); +SAMPLER2D(ORIG_texture, 1); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 4.0 +#define wp5 0.0 +#define wp6 0.0 + +#define weight (XBR_WEIGHT.x * 1.75068 / 10.0) + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + //Skip pixels on wrong grid + vec2 dir = fract(v_texcoord0 * u_tex_size0.xy / 2.0) - vec2(0.5, 0.5); + if ((dir.x * dir.y) > 0.0) + { + gl_FragColor = texture2D(s0, v_texcoord0); + return; + } + + vec2 g1 = vec2(1.0 / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, 1.0 / u_tex_size0.y); + + vec4 P0 = texture2D(s0, v_texcoord0 -3.0*g1 ); + vec4 P1 = texture2D(s0, v_texcoord0 -3.0*g2); + vec4 P2 = texture2D(s0, v_texcoord0 +3.0*g2); + vec4 P3 = texture2D(s0, v_texcoord0 +3.0*g1 ); + + vec4 B = texture2D(s0, v_texcoord0 -2.0*g1 -g2); + vec4 C = texture2D(s0, v_texcoord0 -g1 -2.0*g2); + vec4 D = texture2D(s0, v_texcoord0 -2.0*g1 +g2); + vec4 E = texture2D(s0, v_texcoord0 -g1 ); + vec4 F = texture2D(s0, v_texcoord0 -g2); + vec4 G = texture2D(s0, v_texcoord0 -g1 +2.0*g2); + vec4 H = texture2D(s0, v_texcoord0 +g2); + vec4 I = texture2D(s0, v_texcoord0 +g1 ); + + vec4 F4 = texture2D(s0,v_texcoord0 +g1 -2.0*g2); + vec4 I4 = texture2D(s0,v_texcoord0 +2.0*g1 -g2); + vec4 H5 = texture2D(s0,v_texcoord0 +g1 +2.0*g2); + vec4 I5 = texture2D(s0,v_texcoord0 +2.0*g1 +g2); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(-limits, limits, d_edge); + + /* Filter weights. Two taps only. */ + vec4 w = vec4(-weight, weight+0.5, weight+0.5, -weight); + + /* Filtering and normalization in two directions generating two colors. */ + vec3 c1 = mul(w, mat4(P2, H, F, P1)).xyz; + vec3 c2 = mul(w, mat4(P0, E, I, P3)).xyz; + + /* Smoothly blends the two directions according to edge strength. */ + vec3 color = mix(c1, c2, vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec4 min_sample = min4( E, F, H, I ) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4( E, F, H, I ) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); +// color = mix(aux, color, 1-2.0*abs(edge_strength-0.5)); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.sc new file mode 100644 index 00000000000..89e82d00a31 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.sc @@ -0,0 +1,162 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass1 ******* + + Copyright (c) 2015 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 0.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define weight (XBR_WEIGHT.x * 1.29633 / 10.0) + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + vec2 g1 = vec2(1.0 / u_tex_size0.x, 0.0); + vec2 g2 = vec2(0.0, 1.0 / u_tex_size0.y); + vec2 texcoord = v_texcoord0 - 1.0 / u_tex_size0.xy; + + vec4 P0 = texture2D(s0, texcoord -g1 -g2); + vec4 P1 = texture2D(s0, texcoord +2.0*g1 -g2); + vec4 P2 = texture2D(s0, texcoord -g1+2.0*g2); + vec4 P3 = texture2D(s0, texcoord +2.0*g1+2.0*g2); + + vec4 B = texture2D(s0, texcoord -g2); + vec4 C = texture2D(s0, texcoord +g1-g2); + vec4 D = texture2D(s0, texcoord -g1 ); + vec4 E = texture2D(s0, texcoord ); + vec4 F = texture2D(s0, texcoord +g1 ); + vec4 G = texture2D(s0, texcoord -g1+g2); + vec4 H = texture2D(s0, texcoord +g2); + vec4 I = texture2D(s0, texcoord +g1+g2); + + vec4 F4 = texture2D(s0,texcoord +2.0*g1 ); + vec4 I4 = texture2D(s0,texcoord +g2+2.0*g1 ); + vec4 H5 = texture2D(s0,texcoord +2.0*g2 ); + vec4 I5 = texture2D(s0,texcoord +2.0*g2+g1 ); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(-limits, limits, d_edge); + + /* Filter weights. Two taps only. */ + vec4 w = vec4(-weight, weight+0.5, weight+0.5, -weight); + + /* Filtering and normalization in two directions generating two colors. */ + vec3 c1 = mul(w, mat4(P2, H, F, P1)).xyz; + vec3 c2 = mul(w, mat4(P0, E, I, P3)).xyz; + + /* Smoothly blends the two directions according to edge strength. */ + vec3 color = mix(c1, c2, vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec4 min_sample = min4( E, F, H, I ) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4( E, F, H, I ) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + + color = clamp(color, min_sample.xyz, max_sample.xyz); +// color = mix(aux, color, 1-2.0*abs(edge_strength-0.5)); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass0.sc new file mode 100644 index 00000000000..a1158ebecca --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass0.sc @@ -0,0 +1,160 @@ +$input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass0 ******* + + Copyright (c) 2015 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 2.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define weight1 (XBR_WEIGHT.x * 1.29633 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.75068 / 10.0 / 2.0) + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + vec4 P0 = texture2D(s0, v_texcoord1.xy); + vec4 P1 = texture2D(s0, v_texcoord1.zy); + vec4 P2 = texture2D(s0, v_texcoord1.xw); + vec4 P3 = texture2D(s0, v_texcoord1.zw); + + vec4 B = texture2D(s0, v_texcoord2.xy); + vec4 C = texture2D(s0, v_texcoord2.zy); + vec4 H5 = texture2D(s0, v_texcoord2.xw); + vec4 I5 = texture2D(s0, v_texcoord2.zw); + + vec4 D = texture2D(s0, v_texcoord3.xy); + vec4 F4 = texture2D(s0, v_texcoord3.zy); + vec4 G = texture2D(s0, v_texcoord3.xw); + vec4 I4 = texture2D(s0, v_texcoord3.zw); + + vec4 E = texture2D(s0, v_texcoord4.xy); + vec4 F = texture2D(s0, v_texcoord4.zy); + vec4 H = texture2D(s0, v_texcoord4.xw); + vec4 I = texture2D(s0, v_texcoord4.zw); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + color = clamp(color, min_sample.xyz, max_sample.xyz); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass1.sc new file mode 100644 index 00000000000..421fc78b58c --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass1.sc @@ -0,0 +1,178 @@ +$input v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass1 ******* + + Copyright (c) 2015 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); +SAMPLER2D(ORIG_texture, 1); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 4.0 +#define wp5 0.0 +#define wp6 0.0 + +#define weight1 (XBR_WEIGHT.x * 1.75068 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.29633 / 10.0 / 2.0) + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + //Skip pixels on wrong grid + vec2 fp = fract(v_texcoord0 * u_tex_size0.xy); + vec2 dir = fp - vec2(0.5,0.5); + if ((dir.x * dir.y) > 0.0) + { + if (fp.x > 0.5) + { + gl_FragColor = texture2D(s0, v_texcoord0); + } + else + { + gl_FragColor = texture2D(ORIG_texture, v_texcoord0); + } + return; + } + + vec2 g1 = (fp.x > 0.5) ? vec2(0.5 / u_tex_size0.x, 0.0) : vec2(0.0, 0.5 / u_tex_size0.y); + vec2 g2 = (fp.x > 0.5) ? vec2(0.0, 0.5 / u_tex_size0.y) : vec2(0.5 / u_tex_size0.x, 0.0); + + vec4 P0 = texture2D(ORIG_texture, v_texcoord0 -3.0*g1 ); + vec4 P1 = texture2D( s0, v_texcoord0 -3.0*g2); + vec4 P2 = texture2D( s0, v_texcoord0 +3.0*g2); + vec4 P3 = texture2D(ORIG_texture, v_texcoord0 +3.0*g1 ); + + vec4 B = texture2D( s0, v_texcoord0 -2.0*g1 -g2); + vec4 C = texture2D(ORIG_texture, v_texcoord0 -g1 -2.0*g2); + vec4 D = texture2D( s0, v_texcoord0 -2.0*g1 +g2); + vec4 E = texture2D(ORIG_texture, v_texcoord0 -g1 ); + vec4 F = texture2D( s0, v_texcoord0 -g2); + vec4 G = texture2D(ORIG_texture, v_texcoord0 -g1 +2.0*g2); + vec4 H = texture2D( s0, v_texcoord0 +g2); + vec4 I = texture2D(ORIG_texture, v_texcoord0 +g1 ); + + vec4 F4 = texture2D(ORIG_texture, v_texcoord0 +g1 -2.0*g2); + vec4 I4 = texture2D( s0, v_texcoord0 +2.0*g1 -g2); + vec4 H5 = texture2D(ORIG_texture, v_texcoord0 +g1 +2.0*g2); + vec4 I5 = texture2D( s0, v_texcoord0 +2.0*g1 +g2); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + color = clamp(color, min_sample.xyz, max_sample.xyz); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass2.sc new file mode 100644 index 00000000000..c343dc155a2 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/fs_super-xbr-pass2.sc @@ -0,0 +1,170 @@ +$input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass1 ******* + + Copyright (c) 2015 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +SAMPLER2D(s0, 0); + +uniform vec4 XBR_EDGE_STR; +uniform vec4 XBR_WEIGHT; +uniform vec4 XBR_ANTI_RINGING; +uniform vec4 u_tex_size0; + +#define wp1 1.0 +#define wp2 0.0 +#define wp3 0.0 +#define wp4 0.0 +#define wp5 -1.0 +#define wp6 0.0 + +#define weight1 (XBR_WEIGHT.x * 1.29633 / 10.0) +#define weight2 (XBR_WEIGHT.x * 1.75068 / 10.0 / 2.0) + +float RGBtoYUV(vec4 color) +{ + return dot(color.xyz, vec3(0.2126, 0.7152, 0.0722)); +} + +float df(float A, float B) +{ + return abs(A-B); +} + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + +float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) +{ + return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); +} + +float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) +{ + return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); +} + +vec4 min4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return min(a, min(b, min(c, d))); +} + +vec4 max4(vec4 a, vec4 b, vec4 c, vec4 d) +{ + return max(a, max(b, max(c, d))); +} + +void main() +{ + vec4 P0 = texture2D(s0, v_texcoord1.xy); + vec4 P1 = texture2D(s0, v_texcoord1.zy); + vec4 P2 = texture2D(s0, v_texcoord1.xw); + vec4 P3 = texture2D(s0, v_texcoord1.zw); + + vec4 B = texture2D(s0, v_texcoord2.xy); + vec4 C = texture2D(s0, v_texcoord2.zy); + vec4 H5 = texture2D(s0, v_texcoord2.xw); + vec4 I5 = texture2D(s0, v_texcoord2.zw); + + vec4 D = texture2D(s0, v_texcoord3.xy); + vec4 F4 = texture2D(s0, v_texcoord3.zy); + vec4 G = texture2D(s0, v_texcoord3.xw); + vec4 I4 = texture2D(s0, v_texcoord3.zw); + + vec4 E = texture2D(s0, v_texcoord4.xy); + vec4 F = texture2D(s0, v_texcoord4.zy); + vec4 H = texture2D(s0, v_texcoord4.xw); + vec4 I = texture2D(s0, v_texcoord4.zw); + + float b = RGBtoYUV( B ); + float c = RGBtoYUV( C ); + float d = RGBtoYUV( D ); + float e = RGBtoYUV( E ); + float f = RGBtoYUV( F ); + float g = RGBtoYUV( G ); + float h = RGBtoYUV( H ); + float i = RGBtoYUV( I ); + + float i4 = RGBtoYUV( I4 ); float p0 = RGBtoYUV( P0 ); + float i5 = RGBtoYUV( I5 ); float p1 = RGBtoYUV( P1 ); + float h5 = RGBtoYUV( H5 ); float p2 = RGBtoYUV( P2 ); + float f4 = RGBtoYUV( F4 ); float p3 = RGBtoYUV( P3 ); + +/* + P1 + |P0|B |C |P1| C F4 |a0|b1|c2|d3| + |D |E |F |F4| B F I4 |b0|c1|d2|e3| |e1|i1|i2|e2| + |G |H |I |I4| P0 E A I P3 |c0|d1|e2|f3| |e3|i3|i4|e4| + |P2|H5|I5|P3| D H I5 |d0|e1|f2|g3| + G H5 + P2 +*/ + + + /* Calc edgeness in diagonal directions. */ + float d_edge = (d_wd( d, b, g, e, c, p2, h, f, p1, h5, i, f4, i5, i4 ) - d_wd( c, f4, b, f, i4, p0, e, i, p3, d, h, i5, g, h5 )); + + /* Calc edgeness in horizontal/vertical directions. */ + float hv_edge = (hv_wd(f, i, e, h, c, i5, b, h5) - hv_wd(e, f, h, i, d, f4, g, i4)); + + float limits = XBR_EDGE_STR.x + 0.000001; + float edge_strength = smoothstep(0.0, limits, abs(d_edge)); + + /* Filter weights. Two taps only. */ + vec4 w1 = vec4(-weight1, weight1+0.5, weight1+0.5, -weight1); + vec4 w2 = vec4(-weight2, weight2+0.25, weight2+0.25, -weight2); + + /* Filtering and normalization in four direction generating four colors. */ + vec3 c1 = mul(w1, mat4( P2, H, F, P1 )).xyz; + vec3 c2 = mul(w1, mat4( P0, E, I, P3 )).xyz; + vec3 c3 = mul(w2, mat4(D+G, E+H, F+I, F4+I4)).xyz; + vec3 c4 = mul(w2, mat4(C+B, F+E, I+H, I5+H5)).xyz; + + /* Smoothly blends the two strongest directions (one in diagonal and the other in vert/horiz direction). */ + vec4 d_mix = d_edge >= 0.0 ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0); + vec3 hv_mix = hv_edge >= 0.0 ? vec3(1.0, 1.0, 1.0) : vec3(0.0, 0.0, 0.0); + vec3 color = mix(mix(c1, c2, d_mix.xyz), mix(c3, c4, hv_mix), vec3(1.0, 1.0, 1.0) - vec3(edge_strength, edge_strength, edge_strength)); + + /* Anti-ringing code. */ + float anti_ring = 1.0 - XBR_ANTI_RINGING.x; + vec4 min_sample = min4(E, F, H, I) + anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + vec4 max_sample = max4(E, F, H, I) - anti_ring * mix((P2-H)*(F-P1), (P0-E)*(I-P3), d_mix); + color = clamp(color, min_sample.xyz, max_sample.xyz); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/varying.def.sc new file mode 100644 index 00000000000..c65b5426733 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/varying.def.sc @@ -0,0 +1,10 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_custom-jinc2-sharper.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_custom-jinc2-sharper.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_custom-jinc2-sharper.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.sc new file mode 100644 index 00000000000..ae3b049b57a --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.sc @@ -0,0 +1,50 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR 3D Shader - pass2 ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = v_texcoord0.xyxy + vec4(-2.0*dx, -2.0*dy, dx, dy); + v_texcoord2 = v_texcoord0.xyxy + vec4( -dx, -2.0*dy, 0.0, dy); + v_texcoord3 = v_texcoord0.xyxy + vec4(-2.0*dx, -dy, dx, 0.0); + v_texcoord4 = v_texcoord0.xyxy + vec4( -dx, -dy, 0.0, 0.0); + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.sc new file mode 100644 index 00000000000..c5bd41ee120 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.sc @@ -0,0 +1,24 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = v_texcoord0.xyxy + vec4(-2.0*dx, -2.0*dy, dx, dy); + v_texcoord2 = v_texcoord0.xyxy + vec4( -dx, -2.0*dy, 0.0, dy); + v_texcoord3 = v_texcoord0.xyxy + vec4(-2.0*dx, -dy, dx, 0.0); + v_texcoord4 = v_texcoord0.xyxy + vec4( -dx, -dy, 0.0, 0.0); + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.sc new file mode 100644 index 00000000000..405ef8feb3b --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.sc @@ -0,0 +1,14 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.sc new file mode 100644 index 00000000000..c5bd41ee120 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.sc @@ -0,0 +1,24 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = v_texcoord0.xyxy + vec4(-2.0*dx, -2.0*dy, dx, dy); + v_texcoord2 = v_texcoord0.xyxy + vec4( -dx, -2.0*dy, 0.0, dy); + v_texcoord3 = v_texcoord0.xyxy + vec4(-2.0*dx, -dy, dx, 0.0); + v_texcoord4 = v_texcoord0.xyxy + vec4( -dx, -dy, 0.0, 0.0); + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.sc new file mode 100644 index 00000000000..67e2a4d6250 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.sc @@ -0,0 +1,40 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass0 vertex shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.sc new file mode 100644 index 00000000000..d76ec041199 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.sc @@ -0,0 +1,40 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass1 vertex shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.sc new file mode 100644 index 00000000000..579ee064622 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.sc @@ -0,0 +1,40 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass2 vertex shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass0.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass0.sc new file mode 100644 index 00000000000..f03cc46e2b7 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass0.sc @@ -0,0 +1,50 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass0 vertex shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = v_texcoord0.xyxy + vec4(-dx, -dy, 2.0*dx, 2.0*dy); + v_texcoord2 = v_texcoord0.xyxy + vec4(0.0, -dy, dx, 2.0*dy); + v_texcoord3 = v_texcoord0.xyxy + vec4(-dx, 0.0, 2.0*dx, dy); + v_texcoord4 = v_texcoord0.xyxy + vec4(0.0, 0.0, dx, dy); + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass1.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass1.sc new file mode 100644 index 00000000000..67e2a4d6250 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass1.sc @@ -0,0 +1,40 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass0 vertex shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass2.sc new file mode 100644 index 00000000000..51ffe87fcaa --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass2.sc @@ -0,0 +1,50 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass0 vertex shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = v_texcoord0.xyxy + vec4(-2.0*dx, -2.0*dy, dx, dy); + v_texcoord2 = v_texcoord0.xyxy + vec4( -dx, -2.0*dy, 0.0, dy); + v_texcoord3 = v_texcoord0.xyxy + vec4(-2.0*dx, -dy, dx, 0.0); + v_texcoord4 = v_texcoord0.xyxy + vec4( -dx, -dy, 0.0, 0.0); + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass3.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass3.sc new file mode 100644 index 00000000000..51ffe87fcaa --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/super-xbr/vs_super-xbr-pass3.sc @@ -0,0 +1,50 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_color0 + +// license:MIT +// copyright-holders:Hyllian + +/* + + ******* Super XBR Shader - pass0 vertex shader ******* + + Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = v_texcoord0.xyxy + vec4(-2.0*dx, -2.0*dy, dx, dy); + v_texcoord2 = v_texcoord0.xyxy + vec4( -dx, -2.0*dy, 0.0, dy); + v_texcoord3 = v_texcoord0.xyxy + vec4(-2.0*dx, -dy, dx, 0.0); + v_texcoord4 = v_texcoord0.xyxy + vec4( -dx, -dy, 0.0, 0.0); + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/varying.def.sc new file mode 100644 index 00000000000..92c3034f498 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/varying.def.sc @@ -0,0 +1,13 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec4 v_texcoord1 : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord2 : TEXCOORD2 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord3 : TEXCOORD3 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord4 : TEXCOORD4 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord5 : TEXCOORD5 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord6 : TEXCOORD6 = vec4(0.0, 0.0, 0.0, 0.0); +vec4 v_texcoord7 : TEXCOORD7 = vec4(0.0, 0.0, 0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv1-noblend.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv1-noblend.sc new file mode 100644 index 00000000000..3e97446a880 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv1-noblend.sc @@ -0,0 +1,22 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1.xy = vec2(0.0,-dy); // B + v_texcoord1.zw = vec2(-dx,0.0); // D + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2-3d.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2-3d.sc new file mode 100644 index 00000000000..476e11da6ea --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2-3d.sc @@ -0,0 +1,23 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +uniform vec4 XBR_RES; + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = XBR_RES.xx / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = vec4(dx, 0, 0, dy); // F H + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2-fast.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2-fast.sc new file mode 100644 index 00000000000..38e92865308 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2-fast.sc @@ -0,0 +1,29 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + // A1 B1 C1 + // A0 A B C C4 + // D0 D E F F4 + // G0 G H I I4 + // G5 H5 I5 + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = v_texcoord0.xxxy + vec4( -dx, 0.0, dx, -dy); // A B C + v_texcoord2 = v_texcoord0.xxxy + vec4( -dx, 0.0, dx, 0.0); // D E F + v_texcoord3 = v_texcoord0.xxxy + vec4( -dx, 0.0, dx, dy); // G H I + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2.sc new file mode 100644 index 00000000000..ce6e411b75d --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/vs_xbr-lv2.sc @@ -0,0 +1,27 @@ +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4, v_texcoord5, v_texcoord6, v_texcoord7, v_color0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "common.sh" + +uniform vec4 u_tex_size0; + +void main() +{ + gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; + + vec2 ps = 1.0 / u_tex_size0.xy; + float dx = ps.x; + float dy = ps.y; + v_texcoord1 = v_texcoord0.xxxy + vec4( -dx, 0.0, dx, -2.0*dy); // A1 B1 C1 + v_texcoord2 = v_texcoord0.xxxy + vec4( -dx, 0.0, dx, -dy); // A B C + v_texcoord3 = v_texcoord0.xxxy + vec4( -dx, 0.0, dx, 0.0); // D E F + v_texcoord4 = v_texcoord0.xxxy + vec4( -dx, 0.0, dx, dy); // G H I + v_texcoord5 = v_texcoord0.xxxy + vec4( -dx, 0.0, dx, 2.0*dy); // G5 H5 I5 + v_texcoord6 = v_texcoord0.xyyy + vec4(-2.0*dx, -dy, 0.0, dy); // A0 D0 G0 + v_texcoord7 = v_texcoord0.xyyy + vec4( 2.0*dx, -dy, 0.0, dy); // C4 F4 I4 + v_color0 = a_color0; +} diff --git a/src/osd/modules/render/bgfx/shaders/makefile b/src/osd/modules/render/bgfx/shaders/makefile index e5ee052ab31..b0f955fe03e 100644 --- a/src/osd/modules/render/bgfx/shaders/makefile +++ b/src/osd/modules/render/bgfx/shaders/makefile @@ -4,10 +4,13 @@ BUILD_DIR=../../../../../../build include shader.mk +ifneq ($(CHAIN),) +SUBDIRS := $(patsubst .,,$(patsubst ,,$(shell find chains/$(CHAIN) -type d))) +rebuild: $(SUBDIRS) +else SUBDIRS := $(patsubst .,,$(patsubst ./,,$(shell find . -type d))) - - rebuild: main $(SUBDIRS) +endif $(SUBDIRS): @echo $@ diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 497cde4ffaa..4ce87b3e29c 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -1379,8 +1379,8 @@ int shaders::post_pass(d3d_render_target *rt, int source_index, poly_info *poly, screen_device *screen = screen_iterator.byindex(curr_screen); render_container &screen_container = screen->container(); - float xscale = screen_container.xscale(); - float yscale = screen_container.yscale(); + float xscale = 1.0f / screen_container.xscale(); + float yscale = 1.0f / screen_container.yscale(); float xoffset = -screen_container.xoffset(); float yoffset = -screen_container.yoffset(); @@ -1612,6 +1612,8 @@ void shaders::render_quad(poly_info *poly, int vertnum) curr_texture = poly->get_texture(); curr_poly = poly; + auto win = d3d->assert_window(); + if (PRIMFLAG_GET_SCREENTEX(d3d->get_last_texture_flags()) && curr_texture != nullptr) { curr_screen = curr_screen < num_screens ? curr_screen : 0; @@ -1663,7 +1665,7 @@ void shaders::render_quad(poly_info *poly, int vertnum) { lines_pending = true; - bool swap_xy = d3d->window().swap_xy(); + bool swap_xy = win->swap_xy(); int source_width = swap_xy ? (float)d3d->get_height() : (float)d3d->get_width(); int source_height = swap_xy ? (float)d3d->get_width() : (float)d3d->get_height(); @@ -1690,7 +1692,7 @@ void shaders::render_quad(poly_info *poly, int vertnum) { curr_screen = curr_screen < num_screens ? curr_screen : 0; - bool swap_xy = d3d->window().swap_xy(); + bool swap_xy = win->swap_xy(); int source_width = swap_xy ? (float)d3d->get_height() : (float)d3d->get_width(); int source_height = swap_xy ? (float)d3d->get_width() : (float)d3d->get_height(); @@ -1805,7 +1807,9 @@ d3d_render_target* shaders::get_texture_target(render_primitive *prim, texture_i return nullptr; } - bool swap_xy = d3d->window().swap_xy(); + auto win = d3d->assert_window(); + + bool swap_xy = win->swap_xy(); int target_width = swap_xy ? static_cast(prim->get_quad_height() + 0.5f) : static_cast(prim->get_quad_width() + 0.5f); @@ -1835,7 +1839,9 @@ d3d_render_target* shaders::get_vector_target(render_primitive *prim) return nullptr; } - bool swap_xy = d3d->window().swap_xy(); + auto win = d3d->assert_window(); + + bool swap_xy = win->swap_xy(); int target_width = swap_xy ? static_cast(prim->get_quad_height() + 0.5f) : static_cast(prim->get_quad_width() + 0.5f); @@ -1862,7 +1868,9 @@ d3d_render_target* shaders::get_vector_target(render_primitive *prim) void shaders::create_vector_target(render_primitive *prim) { - bool swap_xy = d3d->window().swap_xy(); + auto win = d3d->assert_window(); + + bool swap_xy = win->swap_xy(); int target_width = swap_xy ? static_cast(prim->get_quad_height() + 0.5f) : static_cast(prim->get_quad_width() + 0.5f); @@ -1974,7 +1982,9 @@ bool shaders::register_texture(render_primitive *prim, texture_info *texture) return false; } - bool swap_xy = d3d->window().swap_xy(); + auto win = d3d->assert_window(); + + bool swap_xy = win->swap_xy(); int target_width = swap_xy ? static_cast(prim->get_quad_height() + 0.5f) : static_cast(prim->get_quad_width() + 0.5f); @@ -2614,6 +2624,8 @@ void uniform::update() hlsl_options *options = shadersys->options; renderer_d3d9 *d3d = shadersys->d3d; + auto win = d3d->assert_window(); + switch (m_id) { case CU_SCREEN_DIMS: @@ -2625,7 +2637,7 @@ void uniform::update() case CU_SOURCE_DIMS: { bool vector_screen = - d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; + win->machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; if (vector_screen) { if (shadersys->curr_render_target) @@ -2673,13 +2685,13 @@ void uniform::update() case CU_SWAP_XY: { - m_shader->set_bool("SwapXY", d3d->window().swap_xy()); + m_shader->set_bool("SwapXY", win->swap_xy()); break; } case CU_VECTOR_SCREEN: { bool vector_screen = - d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; + win->machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; m_shader->set_bool("VectorScreen", vector_screen); break; } diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index b4326ff2bdf..24bf22c3b27 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -60,7 +60,7 @@ static inline bool is_transparent(const float &a) // CONSTRUCTOR & DESTRUCTOR //============================================================ -renderer_sdl2::renderer_sdl2(osd_window *window, int extra_flags) +renderer_sdl2::renderer_sdl2(std::shared_ptr window, int extra_flags) : osd_renderer(window, FLAG_NEEDS_OPENGL | extra_flags) , m_sdl_renderer(nullptr) , m_blittimer(0) @@ -434,10 +434,12 @@ int renderer_sdl2::create() SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); } + auto win = assert_window(); + if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(window().platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); else - m_sdl_renderer = SDL_CreateRenderer(window().platform_window(), -1, SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_ACCELERATED); if (!m_sdl_renderer) { @@ -481,11 +483,15 @@ int renderer_sdl2::xy_to_render_target(int x, int y, int *xt, int *yt) void renderer_sdl2::destroy_all_textures() { - if(window().m_primlist) + auto win = assert_window(); + if (win == nullptr) + return; + + if(win->m_primlist) { - window().m_primlist->acquire_lock(); + win->m_primlist->acquire_lock(); m_texlist.reset(); - window().m_primlist->release_lock(); + win->m_primlist->release_lock(); } else m_texlist.reset(); @@ -506,7 +512,8 @@ int renderer_sdl2::draw(int update) return 0; } - osd_dim wdim = window().get_size(); + auto win = assert_window(); + osd_dim wdim = win->get_size(); if (has_flags(FI_CHANGED) || (wdim.width() != m_width) || (wdim.height() != m_height)) { @@ -553,10 +560,10 @@ int renderer_sdl2::draw(int update) m_last_hofs = hofs; m_last_vofs = vofs; - window().m_primlist->acquire_lock(); + win->m_primlist->acquire_lock(); // now draw - for (render_primitive &prim : *window().m_primlist) + for (render_primitive &prim : *win->m_primlist) { Uint8 sr, sg, sb, sa; @@ -586,7 +593,7 @@ int renderer_sdl2::draw(int update) } } - window().m_primlist->release_lock(); + win->m_primlist->release_lock(); m_last_blit_pixels = blit_pixels; m_last_blit_time = -osd_ticks(); @@ -930,7 +937,8 @@ texture_info * renderer_sdl2::texture_update(const render_primitive &prim) quad_setup_data setup; texture_info *texture; - setup.compute(prim, window().prescale()); + auto win = assert_window(); + setup.compute(prim, win->prescale()); texture = texture_find(prim, setup); @@ -957,12 +965,16 @@ texture_info * renderer_sdl2::texture_update(const render_primitive &prim) render_primitive_list *renderer_sdl2::get_primitives() { - osd_dim nd = window().get_size(); + auto win = assert_window(); + if (win == nullptr) + return nullptr; + + osd_dim nd = win->get_size(); if (nd != m_blit_dim) { m_blit_dim = nd; notify_changed(); } - window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().pixel_aspect()); - return &window().target()->get_primitives(); + win->target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), win->pixel_aspect()); + return &win->target()->get_primitives(); } diff --git a/src/osd/modules/render/draw13.h b/src/osd/modules/render/draw13.h index 634c1debf6f..e242749ba10 100644 --- a/src/osd/modules/render/draw13.h +++ b/src/osd/modules/render/draw13.h @@ -149,7 +149,7 @@ struct copy_info_t class renderer_sdl2 : public osd_renderer { public: - renderer_sdl2(osd_window *window, int extra_flags); + renderer_sdl2(std::shared_ptr window, int extra_flags); virtual ~renderer_sdl2() { diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 479cea4f3b2..84f1ff0bd6f 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -77,7 +77,7 @@ uint32_t renderer_bgfx::s_current_view = 0; // renderer_bgfx - constructor //============================================================ -renderer_bgfx::renderer_bgfx(osd_window *w) +renderer_bgfx::renderer_bgfx(std::shared_ptr w) : osd_renderer(w, FLAG_NONE) , m_options(downcast(w->machine().options())) , m_dimensions(0, 0) @@ -85,7 +85,7 @@ renderer_bgfx::renderer_bgfx(osd_window *w) , m_avi_writer(nullptr) , m_avi_target(nullptr) { - m_options = downcast(window().machine().options()); + m_options = downcast(assert_window()->machine().options()); } //============================================================ @@ -146,10 +146,11 @@ static void* sdlNativeWindowHandle(SDL_Window* _window) int renderer_bgfx::create() { // create renderer - osd_dim wdim = window().get_size(); - m_width[window().m_index] = wdim.width(); - m_height[window().m_index] = wdim.height(); - if (window().m_index == 0) + auto win = assert_window(); + osd_dim wdim = win->get_size(); + m_width[win->m_index] = wdim.width(); + m_height[win->m_index] = wdim.height(); + if (win->m_index == 0) { if (!s_window_set) { @@ -164,9 +165,9 @@ int renderer_bgfx::create() bgfx::setPlatformData(blank_pd); } #ifdef OSD_WINDOWS - bgfx::winSetHwnd(window().platform_window()); + bgfx::winSetHwnd(win->platform_window()); #else - bgfx::sdlSetWindow(window().platform_window()); + bgfx::sdlSetWindow(win->platform_window()); #endif std::string backend(m_options.bgfx_backend()); if (backend == "auto") @@ -198,7 +199,7 @@ int renderer_bgfx::create() printf("Unknown backend type '%s', going with auto-detection\n", backend.c_str()); bgfx::init(); } - bgfx::reset(m_width[window().m_index], m_height[window().m_index], video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + bgfx::reset(m_width[win->m_index], m_height[win->m_index], video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); // Enable debug text. bgfx::setDebug(m_options.bgfx_debug() ? BGFX_DEBUG_STATS : BGFX_DEBUG_TEXT); m_dimensions = osd_dim(m_width[0], m_height[0]); @@ -210,14 +211,14 @@ int renderer_bgfx::create() m_shaders = new shader_manager(m_options); m_effects = new effect_manager(m_options, *m_shaders); - if (window().m_index != 0) + if (win->m_index != 0) { #ifdef OSD_WINDOWS - m_framebuffer = m_targets->create_backbuffer(window().platform_window(), m_width[window().m_index], m_height[window().m_index]); + m_framebuffer = m_targets->create_backbuffer(win->platform_window(), m_width[win->m_index], m_height[win->m_index]); #else - m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(window().platform_window()), m_width[window().m_index], m_height[window().m_index]); + m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(win->platform_window()), m_width[win->m_index], m_height[win->m_index]); #endif - bgfx::touch(window().m_index); + bgfx::touch(win->m_index); } // Create program from shaders. @@ -231,7 +232,7 @@ int renderer_bgfx::create() m_screen_effect[2] = m_effects->effect("screen_multiply"); m_screen_effect[3] = m_effects->effect("screen_add"); - m_chains = new chain_manager(window().machine(), m_options, *m_textures, *m_targets, *m_effects, window().m_index, *this); + m_chains = new chain_manager(win->machine(), m_options, *m_textures, *m_targets, *m_effects, win->m_index, *this); m_sliders_dirty = true; uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; @@ -251,7 +252,8 @@ int renderer_bgfx::create() void renderer_bgfx::record() { - if (m_avi_writer == nullptr || window().m_index > 0) + auto win = assert_window(); + if (m_avi_writer == nullptr || win->m_index > 0) { return; } @@ -648,15 +650,16 @@ uint32_t renderer_bgfx::u32Color(uint32_t r, uint32_t g, uint32_t b, uint32_t a int renderer_bgfx::draw(int update) { - int window_index = window().m_index; + auto win = assert_window(); + int window_index = win->m_index; if (window_index == 0) { s_current_view = 0; if (m_avi_writer == nullptr) { - uint32_t width = window().get_size().width(); - uint32_t height = window().get_size().height(); - m_avi_writer = new avi_write(window().machine(), width, height); + uint32_t width = win->get_size().width(); + uint32_t height = win->get_size().height(); + m_avi_writer = new avi_write(win->machine(), width, height); m_avi_data = new uint8_t[width * height * 4]; m_avi_bitmap.allocate(width, height); } @@ -666,13 +669,13 @@ int renderer_bgfx::draw(int update) m_ui_view = -1; // Set view 0 default viewport. - osd_dim wdim = window().get_size(); + osd_dim wdim = win->get_size(); m_width[window_index] = wdim.width(); m_height[window_index] = wdim.height(); - window().m_primlist->acquire_lock(); - s_current_view += m_chains->handle_screen_chains(s_current_view, window().m_primlist->first(), window()); - window().m_primlist->release_lock(); + win->m_primlist->acquire_lock(); + s_current_view += m_chains->handle_screen_chains(s_current_view, win->m_primlist->first(), *win.get()); + win->m_primlist->release_lock(); bool skip_frame = update_dimensions(); if (skip_frame) @@ -689,12 +692,12 @@ int renderer_bgfx::draw(int update) s_current_view = m_max_view; } - window().m_primlist->acquire_lock(); + win->m_primlist->acquire_lock(); // Mark our texture atlas as dirty if we need to do so bool atlas_valid = update_atlas(); - render_primitive *prim = window().m_primlist->first(); + render_primitive *prim = win->m_primlist->first(); std::vector sources; while (prim != nullptr) { @@ -734,7 +737,7 @@ int renderer_bgfx::draw(int update) } } - window().m_primlist->release_lock(); + win->m_primlist->release_lock(); // This dummy draw call is here to make sure that view 0 is cleared // if no other draw calls are submitted to view 0. @@ -774,7 +777,8 @@ void renderer_bgfx::update_recording() void renderer_bgfx::add_audio_to_recording(const INT16 *buffer, int samples_this_frame) { - if (m_avi_writer != nullptr && m_avi_writer->recording() && window().m_index == 0) + auto win = assert_window(); + if (m_avi_writer != nullptr && m_avi_writer->recording() && win->m_index == 0) { m_avi_writer->audio_frame(buffer, samples_this_frame); } @@ -782,7 +786,9 @@ void renderer_bgfx::add_audio_to_recording(const INT16 *buffer, int samples_this bool renderer_bgfx::update_dimensions() { - const uint32_t window_index = window().m_index; + auto win = assert_window(); + + const uint32_t window_index = win->m_index; const uint32_t width = m_width[window_index]; const uint32_t height = m_height[window_index]; @@ -798,14 +804,14 @@ bool renderer_bgfx::update_dimensions() { if ((m_dimensions != osd_dim(width, height))) { - bgfx::reset(window().m_main->get_size().width(), window().m_main->get_size().height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + bgfx::reset(win->main_window()->get_size().width(), win->main_window()->get_size().height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); m_dimensions = osd_dim(width, height); delete m_framebuffer; #ifdef OSD_WINDOWS - m_framebuffer = m_targets->create_backbuffer(window().platform_window(), width, height); + m_framebuffer = m_targets->create_backbuffer(win->platform_window(), width, height); #else - m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(window().platform_window()), width, height); + m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(win->platform_window()), width, height); #endif bgfx::setViewFrameBuffer(s_current_view, m_framebuffer->target()); @@ -820,7 +826,9 @@ bool renderer_bgfx::update_dimensions() void renderer_bgfx::setup_view(uint32_t view_index, bool screen) { - const uint32_t window_index = window().m_index; + auto win = assert_window(); + + const uint32_t window_index = win->m_index; const uint32_t width = m_width[window_index]; const uint32_t height = m_height[window_index]; @@ -845,7 +853,7 @@ void renderer_bgfx::setup_view(uint32_t view_index, bool screen) { m_seen_views[view_index] = true; #endif - if (m_avi_writer != nullptr && m_avi_writer->recording() && window().m_index == 0) + if (m_avi_writer != nullptr && m_avi_writer->recording() && win->m_index == 0) { bgfx::setViewFrameBuffer(view_index, m_avi_target->target()); } @@ -857,7 +865,8 @@ void renderer_bgfx::setup_view(uint32_t view_index, bool screen) void renderer_bgfx::setup_matrices(uint32_t view_index, bool screen) { - const uint32_t window_index = window().m_index; + auto win = assert_window(); + const uint32_t window_index = win->m_index; const uint32_t width = m_width[window_index]; const uint32_t height = m_height[window_index]; @@ -1064,8 +1073,9 @@ bool renderer_bgfx::check_for_dirty_atlas() { bool atlas_dirty = false; + auto win = assert_window(); std::map acquired_infos; - for (render_primitive &prim : *window().m_primlist) + for (render_primitive &prim : *win->m_primlist) { bool pack = prim.packable(PACKABLE_SIZE); if (prim.type == render_primitive::QUAD && prim.texture.base != nullptr && pack) diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h index a6f66a6eff3..7cc3bab9e47 100644 --- a/src/osd/modules/render/drawbgfx.h +++ b/src/osd/modules/render/drawbgfx.h @@ -12,6 +12,8 @@ #include "binpacker.h" #include "bgfx/vertex.h" +#include "bgfx/chain.h" +#include "bgfx/chainmanager.h" #include "sliderdirtynotifier.h" class texture_manager; @@ -30,7 +32,7 @@ class avi_write; class renderer_bgfx : public osd_renderer, public slider_dirty_notifier { public: - renderer_bgfx(osd_window *w); + renderer_bgfx(std::shared_ptr w); virtual ~renderer_bgfx(); static void init(running_machine &machine) { } @@ -53,9 +55,24 @@ public: virtual render_primitive_list *get_primitives() override { - osd_dim wdim = window().get_size(); - window().target()->set_bounds(wdim.width(), wdim.height(), window().pixel_aspect()); - return &window().target()->get_primitives(); + auto win = try_getwindow(); + if (win == nullptr) + return nullptr; + + // determines whether the screen container is transformed by the chain's shaders + bool chain_transform = false; + + // check the first chain + bgfx_chain* chain = this->m_chains->screen_chain(0); + if (chain != nullptr) + { + chain_transform = chain->transform(); + } + + osd_dim wdim = win->get_size(); + win->target()->set_bounds(wdim.width(), wdim.height(), win->pixel_aspect()); + win->target()->set_transform_container(!chain_transform); + return &win->target()->get_primitives(); } static const char* WINDOW_PREFIX; diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index fa5dc500e2e..6c682a80409 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -199,19 +199,22 @@ void renderer_d3d9::save() render_primitive_list *renderer_d3d9::get_primitives() { RECT client; + auto win = try_getwindow(); + if (win == nullptr) + return nullptr; - GetClientRectExceptMenu(window().platform_window(), &client, window().fullscreen()); + GetClientRectExceptMenu(win->platform_window(), &client, win->fullscreen()); if (rect_width(&client) > 0 && rect_height(&client) > 0) { - window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect()); - window().target()->set_max_update_rate((get_refresh() == 0) ? get_origmode().RefreshRate : get_refresh()); + win->target()->set_bounds(rect_width(&client), rect_height(&client), win->pixel_aspect()); + win->target()->set_max_update_rate((get_refresh() == 0) ? get_origmode().RefreshRate : get_refresh()); } if (m_shaders != nullptr) { // do not transform primitives (scale, offset) if shaders are enabled, the shaders will handle the transformation - window().target()->set_transform_primitives(!m_shaders->enabled()); + win->target()->set_transform_container(!m_shaders->enabled()); } - return &window().target()->get_primitives(); + return &win->target()->get_primitives(); } @@ -410,8 +413,10 @@ d3d_texture_manager::d3d_texture_manager(renderer_d3d9 *d3d) } osd_printf_verbose("Direct3D: YUV format = %s\n", (m_yuv_format == D3DFMT_YUY2) ? "YUY2" : (m_yuv_format == D3DFMT_UYVY) ? "UYVY" : "RGB"); + auto win = d3d->assert_window(); + // set the max texture size - d3d->window().target()->set_max_texture_size(m_texture_max_width, m_texture_max_height); + win->target()->set_max_texture_size(m_texture_max_width, m_texture_max_height); osd_printf_verbose("Direct3D: Max texture size = %dx%d\n", (int)m_texture_max_width, (int)m_texture_max_height); } @@ -421,9 +426,11 @@ d3d_texture_manager::~d3d_texture_manager() void d3d_texture_manager::create_resources() { + auto win = m_renderer->assert_window(); + // experimental: load a PNG to use for vector rendering; it is treated // as a brightness map - emu_file file(m_renderer->window().machine().options().art_path(), OPEN_FLAG_READ); + emu_file file(win->machine().options().art_path(), OPEN_FLAG_READ); render_load_png(m_vector_bitmap, file, nullptr, "vector.png"); if (m_vector_bitmap.valid()) { @@ -447,7 +454,7 @@ void d3d_texture_manager::create_resources() texture.seqid = 0; // now create it - m_default_texture = global_alloc(texture_info(this, &texture, m_renderer->window().prescale(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32))); + m_default_texture = global_alloc(texture_info(this, &texture, win->prescale(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32))); } // experimental: if we have a vector bitmap, create a texture for it @@ -464,7 +471,7 @@ void d3d_texture_manager::create_resources() texture.seqid = 0; // now create it - m_vector_texture = global_alloc(texture_info(this, &texture, m_renderer->window().prescale(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32))); + m_vector_texture = global_alloc(texture_info(this, &texture, win->prescale(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32))); } } @@ -564,7 +571,7 @@ texture_info *d3d_texture_manager::find_texinfo(const render_texinfo *texinfo, U return nullptr; } -renderer_d3d9::renderer_d3d9(osd_window *window) +renderer_d3d9::renderer_d3d9(std::shared_ptr window) : osd_renderer(window, FLAG_NONE), m_adapter(0), m_width(0), m_height(0), m_refresh(0), m_create_error_count(0), m_device(nullptr), m_gamma_supported(0), m_pixformat(), m_vertexbuf(nullptr), m_lockedbuf(nullptr), m_numverts(0), m_vectorbatch(nullptr), m_batchindex(0), m_numpolys(0), m_restarting(false), m_mod2x_supported(0), m_mod4x_supported(0), m_screen_format(), m_last_texture(nullptr), m_last_texture_flags(0), m_last_blendenable(0), m_last_blendop(0), m_last_blendsrc(0), m_last_blenddst(0), m_last_filter(0), @@ -581,7 +588,8 @@ int renderer_d3d9::initialize() } // create the device immediately for the full screen case (defer for window mode) - if (window().fullscreen() && device_create(window().m_main->platform_window())) + auto win = assert_window(); + if (win->fullscreen() && device_create(win->main_window()->platform_window())) { return false; } @@ -591,8 +599,10 @@ int renderer_d3d9::initialize() int renderer_d3d9::pre_window_draw_check() { + auto win = assert_window(); + // if we're in the middle of resizing, leave things alone - if (window().m_resize_state == RESIZE_STATE_RESIZING) + if (win->m_resize_state == RESIZE_STATE_RESIZING) return 0; // if we're restarting the renderer, leave things alone @@ -614,7 +624,7 @@ int renderer_d3d9::pre_window_draw_check() } // in window mode, we need to track the window size - if (!window().fullscreen() || m_device == nullptr) + if (!win->fullscreen() || m_device == nullptr) { // if the size changes, skip this update since the render target will be out of date if (update_window_size()) @@ -630,7 +640,9 @@ int renderer_d3d9::pre_window_draw_check() void d3d_texture_manager::update_textures() { - for (render_primitive &prim : *m_renderer->window().m_primlist) + auto win = m_renderer->assert_window(); + + for (render_primitive &prim : *win->m_primlist) { if (prim.texture.base != nullptr) { @@ -645,7 +657,7 @@ void d3d_texture_manager::update_textures() else { // if there isn't one, create a new texture - texture = global_alloc(texture_info(this, &prim.texture, m_renderer->window().prescale(), prim.flags)); + texture = global_alloc(texture_info(this, &prim.texture, win->prescale(), prim.flags)); } } else @@ -681,12 +693,14 @@ void d3d_texture_manager::update_textures() void renderer_d3d9::begin_frame() { + auto win = assert_window(); + HRESULT result = (*d3dintf->device.clear)(m_device, 0, nullptr, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); m_shaders->begin_frame(); - window().m_primlist->acquire_lock(); + win->m_primlist->acquire_lock(); // first update any textures m_texture_manager->update_textures(); @@ -706,7 +720,7 @@ void renderer_d3d9::begin_frame() // loop over line primitives m_line_count = 0; - for (render_primitive &prim : *window().m_primlist) + for (render_primitive &prim : *win->m_primlist) { if (prim.type == render_primitive::LINE && PRIMFLAG_GET_VECTOR(prim.flags)) { @@ -717,8 +731,10 @@ void renderer_d3d9::begin_frame() void renderer_d3d9::process_primitives() { + auto win = assert_window(); + // Rotating index for vector time offsets - for (render_primitive &prim : *window().m_primlist) + for (render_primitive &prim : *win->m_primlist) { switch (prim.type) { @@ -748,7 +764,9 @@ void renderer_d3d9::process_primitives() void renderer_d3d9::end_frame() { - window().m_primlist->release_lock(); + auto win = assert_window(); + + win->m_primlist->release_lock(); // flush any pending polygons primitive_flush_pending(); @@ -819,6 +837,8 @@ try_again: } } + auto win = assert_window(); + // initialize the D3D presentation parameters memset(&m_presentation, 0, sizeof(m_presentation)); m_presentation.BackBufferWidth = m_width; @@ -827,13 +847,13 @@ try_again: m_presentation.BackBufferCount = video_config.triplebuf ? 2 : 1; m_presentation.MultiSampleType = D3DMULTISAMPLE_NONE; m_presentation.SwapEffect = D3DSWAPEFFECT_DISCARD; - m_presentation.hDeviceWindow = window().platform_window(); - m_presentation.Windowed = !window().fullscreen() || window().win_has_menu(); + m_presentation.hDeviceWindow = win->platform_window(); + m_presentation.Windowed = !win->fullscreen() || win->win_has_menu(); m_presentation.EnableAutoDepthStencil = FALSE; m_presentation.AutoDepthStencilFormat = D3DFMT_D16; m_presentation.Flags = 0; m_presentation.FullScreen_RefreshRateInHz = m_refresh; - m_presentation.PresentationInterval = ((video_config.triplebuf && window().fullscreen()) || + m_presentation.PresentationInterval = ((video_config.triplebuf && win->fullscreen()) || video_config.waitvsync || video_config.syncrefresh) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; @@ -861,10 +881,10 @@ try_again: osd_printf_verbose("Direct3D: Device created at %dx%d\n", m_width, m_height); // set the gamma if we need to - if (window().fullscreen()) + if (win->fullscreen()) { // only set the gamma if it's not 1.0f - windows_options &options = downcast(window().machine().options()); + windows_options &options = downcast(win->machine().options()); float brightness = options.full_screen_brightness(); float contrast = options.full_screen_contrast(); float gamma = options.full_screen_gamma(); @@ -896,7 +916,7 @@ try_again: } m_shaders = (shaders*)global_alloc_clear(); - m_shaders->init(d3dintf, &window().machine(), this); + m_shaders->init(d3dintf, &win->machine(), this); m_sliders.clear(); int failed = m_shaders->create_resources(false, m_sliders); @@ -1194,13 +1214,15 @@ int renderer_d3d9::config_adapter_mode() return 1; } + auto win = assert_window(); + // choose a resolution: window mode case - if (!window().fullscreen() || !video_config.switchres || window().win_has_menu()) + if (!win->fullscreen() || !video_config.switchres || win->win_has_menu()) { RECT client; // bounds are from the window client rect - GetClientRectExceptMenu(window().platform_window(), &client, window().fullscreen()); + GetClientRectExceptMenu(win->platform_window(), &client, win->fullscreen()); m_width = client.right - client.left; m_height = client.bottom - client.top; @@ -1211,7 +1233,7 @@ int renderer_d3d9::config_adapter_mode() // make sure it's a pixel format we can get behind if (m_pixformat != D3DFMT_X1R5G5B5 && m_pixformat != D3DFMT_R5G6B5 && m_pixformat != D3DFMT_X8R8G8B8) { - osd_printf_error("Device %s currently in an unsupported mode\n", window().monitor()->devicename()); + osd_printf_error("Device %s currently in an unsupported mode\n", win->monitor()->devicename()); return 1; } } @@ -1231,10 +1253,10 @@ int renderer_d3d9::config_adapter_mode() } // see if we can handle the device type - result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !window().fullscreen()); + result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !win->fullscreen()); if (result != D3D_OK) { - osd_printf_error("Proposed video mode not supported on device %s\n", window().monitor()->devicename()); + osd_printf_error("Proposed video mode not supported on device %s\n", win->monitor()->devicename()); return 1; } return 0; @@ -1249,6 +1271,8 @@ int renderer_d3d9::get_adapter_for_monitor() { int maxadapter = (*d3dintf->d3d.get_adapter_count)(d3dintf); + auto win = assert_window(); + // iterate over adapters until we error or find a match for (int adapternum = 0; adapternum < maxadapter; adapternum++) { @@ -1256,7 +1280,7 @@ int renderer_d3d9::get_adapter_for_monitor() HMONITOR curmonitor = (*d3dintf->d3d.get_adapter_monitor)(d3dintf, adapternum); // if we match the proposed monitor, this is it - if (curmonitor == *((HMONITOR *)window().monitor()->oshandle())) + if (curmonitor == *((HMONITOR *)win->monitor()->oshandle())) { return adapternum; } @@ -1277,8 +1301,10 @@ void renderer_d3d9::pick_best_mode() INT32 minwidth, minheight; float best_score = 0.0f; + auto win = assert_window(); + // determine the refresh rate of the primary screen - const screen_device *primary_screen = window().machine().config().first_screen(); + const screen_device *primary_screen = win->machine().config().first_screen(); if (primary_screen != nullptr) { target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh_attoseconds()); @@ -1288,7 +1314,7 @@ void renderer_d3d9::pick_best_mode() // note: technically we should not be calling this from an alternate window // thread; however, it is only done during init time, and the init code on // the main thread is waiting for us to finish, so it is safe to do so here - window().target()->compute_minimum_size(minwidth, minheight); + win->target()->compute_minimum_size(minwidth, minheight); // use those as the target for now INT32 target_width = minwidth; @@ -1323,7 +1349,7 @@ void renderer_d3d9::pick_best_mode() size_score *= 0.1f; // if we're looking for a particular mode, that's a winner - if (mode.Width == window().m_win_config.width && mode.Height == window().m_win_config.height) + if (mode.Width == win->m_win_config.width && mode.Height == win->m_win_config.height) size_score = 2.0f; // compute refresh score @@ -1334,7 +1360,7 @@ void renderer_d3d9::pick_best_mode() refresh_score *= 0.1f; // if we're looking for a particular refresh, make sure it matches - if (mode.RefreshRate == window().m_win_config.refresh) + if (mode.RefreshRate == win->m_win_config.refresh) refresh_score = 2.0f; // weight size and refresh equally @@ -1361,31 +1387,33 @@ void renderer_d3d9::pick_best_mode() int renderer_d3d9::update_window_size() { + auto win = assert_window(); + // get the current window bounds RECT client; - GetClientRectExceptMenu(window().platform_window(), &client, window().fullscreen()); + GetClientRectExceptMenu(win->platform_window(), &client, win->fullscreen()); // if we have a device and matching width/height, nothing to do if (m_device != nullptr && rect_width(&client) == m_width && rect_height(&client) == m_height) { // clear out any pending resizing if the area didn't change - if (window().m_resize_state == RESIZE_STATE_PENDING) - window().m_resize_state = RESIZE_STATE_NORMAL; + if (win->m_resize_state == RESIZE_STATE_PENDING) + win->m_resize_state = RESIZE_STATE_NORMAL; return FALSE; } // if we're in the middle of resizing, leave it alone as well - if (window().m_resize_state == RESIZE_STATE_RESIZING) + if (win->m_resize_state == RESIZE_STATE_RESIZING) return FALSE; // set the new bounds and create the device again m_width = rect_width(&client); m_height = rect_height(&client); - if (window().m_main != nullptr && device_create(window().m_main->platform_window())) + if (device_create(win->main_window()->platform_window())) return FALSE; // reset the resize state to normal, and indicate we made a change - window().m_resize_state = RESIZE_STATE_NORMAL; + win->m_resize_state = RESIZE_STATE_NORMAL; return TRUE; } @@ -1396,7 +1424,9 @@ int renderer_d3d9::update_window_size() void renderer_d3d9::batch_vectors() { - windows_options &options = downcast(window().machine().options()); + auto win = assert_window(); + + windows_options &options = downcast(win->machine().options()); float quad_width = 0.0f; float quad_height = 0.0f; @@ -1409,7 +1439,7 @@ void renderer_d3d9::batch_vectors() int line_index = 0; float period = options.screen_vector_time_period(); UINT32 cached_flags = 0; - for (render_primitive &prim : *window().m_primlist) + for (render_primitive &prim : *win->m_primlist) { switch (prim.type) { @@ -1447,15 +1477,15 @@ void renderer_d3d9::batch_vectors() if (m_shaders->enabled()) { bool orientation_swap_xy = - (window().machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY; + (win->machine().system().flags & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY; bool rotation_swap_xy = - (window().target()->orientation() & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY; + (win->target()->orientation() & ORIENTATION_SWAP_XY) == ORIENTATION_SWAP_XY; bool swap_xy = orientation_swap_xy ^ rotation_swap_xy; - bool rotation_0 = window().target()->orientation() == ROT0; - bool rotation_90 = window().target()->orientation() == ROT90; - bool rotation_180 = window().target()->orientation() == ROT180; - bool rotation_270 = window().target()->orientation() == ROT270; + bool rotation_0 = win->target()->orientation() == ROT0; + bool rotation_90 = win->target()->orientation() == ROT90; + bool rotation_180 = win->target()->orientation() == ROT180; + bool rotation_270 = win->target()->orientation() == ROT270; bool flip_x = ((rotation_0 || rotation_270) && orientation_swap_xy) || ((rotation_180 || rotation_270) && !orientation_swap_xy); @@ -2074,7 +2104,9 @@ texture_info::texture_info(d3d_texture_manager *manager, const render_texinfo* t m_yprescale--; } - int prescale = m_renderer->window().prescale(); + auto win = m_renderer->assert_window(); + + int prescale = win->prescale(); if (m_xprescale != prescale || m_yprescale != prescale) { osd_printf_verbose("Direct3D: adjusting prescale from %dx%d to %dx%d\n", prescale, prescale, m_xprescale, m_yprescale); @@ -2941,7 +2973,7 @@ bool d3d_render_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int source_w } bool vector_screen = - d3d->window().machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; + d3d->assert_window()->machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; float scale_factor = 0.75f; int scale_count = vector_screen ? MAX_BLOOM_COUNT : MAX_BLOOM_COUNT / 2; diff --git a/src/osd/modules/render/drawd3d.h b/src/osd/modules/render/drawd3d.h index 672ff6482bb..0777da977b0 100644 --- a/src/osd/modules/render/drawd3d.h +++ b/src/osd/modules/render/drawd3d.h @@ -40,7 +40,7 @@ class poly_info; class renderer_d3d9 : public osd_renderer { public: - renderer_d3d9(osd_window *window); + renderer_d3d9(std::shared_ptr window); virtual ~renderer_d3d9(); static bool init(running_machine &machine); diff --git a/src/osd/modules/render/drawgdi.cpp b/src/osd/modules/render/drawgdi.cpp index bfc949e5296..6d6b98218b6 100644 --- a/src/osd/modules/render/drawgdi.cpp +++ b/src/osd/modules/render/drawgdi.cpp @@ -45,10 +45,14 @@ int renderer_gdi::create() render_primitive_list *renderer_gdi::get_primitives() { + auto win = try_getwindow(); + if (win == nullptr) + return nullptr; + RECT client; - GetClientRect(window().platform_window(), &client); - window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect()); - return &window().target()->get_primitives(); + GetClientRect(win->platform_window(), &client); + win->target()->set_bounds(rect_width(&client), rect_height(&client), win->pixel_aspect()); + return &win->target()->get_primitives(); } //============================================================ @@ -57,13 +61,15 @@ render_primitive_list *renderer_gdi::get_primitives() int renderer_gdi::draw(const int update) { + auto win = assert_window(); + // we don't have any special resize behaviors - if (window().m_resize_state == RESIZE_STATE_PENDING) - window().m_resize_state = RESIZE_STATE_NORMAL; + if (win->m_resize_state == RESIZE_STATE_PENDING) + win->m_resize_state = RESIZE_STATE_NORMAL; // get the target bounds RECT bounds; - GetClientRect(window().platform_window(), &bounds); + GetClientRect(win->platform_window(), &bounds); // compute width/height/pitch of target int width = rect_width(&bounds); @@ -79,16 +85,16 @@ int renderer_gdi::draw(const int update) } // draw the primitives to the bitmap - window().m_primlist->acquire_lock(); - software_renderer::draw_primitives(*window().m_primlist, m_bmdata, width, height, pitch); - window().m_primlist->release_lock(); + win->m_primlist->acquire_lock(); + software_renderer::draw_primitives(*win->m_primlist, m_bmdata, width, height, pitch); + win->m_primlist->release_lock(); // fill in bitmap-specific info m_bminfo.bmiHeader.biWidth = pitch; m_bminfo.bmiHeader.biHeight = -height; // blit to the screen - StretchDIBits(window().m_dc, 0, 0, width, height, + StretchDIBits(win->m_dc, 0, 0, width, height, 0, 0, width, height, m_bmdata, &m_bminfo, DIB_RGB_COLORS, SRCCOPY); return 0; diff --git a/src/osd/modules/render/drawgdi.h b/src/osd/modules/render/drawgdi.h index 7606bf14738..319ef9802e6 100644 --- a/src/osd/modules/render/drawgdi.h +++ b/src/osd/modules/render/drawgdi.h @@ -29,7 +29,7 @@ class renderer_gdi : public osd_renderer { public: - renderer_gdi(osd_window *window) + renderer_gdi(std::shared_ptr window) : osd_renderer(window, FLAG_NONE) , m_bmdata(nullptr) , m_bmsize(0) diff --git a/src/osd/modules/render/drawnone.cpp b/src/osd/modules/render/drawnone.cpp index 5e261daafe2..f6bde9d868f 100644 --- a/src/osd/modules/render/drawnone.cpp +++ b/src/osd/modules/render/drawnone.cpp @@ -21,8 +21,12 @@ render_primitive_list *renderer_none::get_primitives() { + auto win = try_getwindow(); + if (win == nullptr) + return nullptr; + RECT client; - GetClientRect(window().platform_window(), &client); - window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect()); - return &window().target()->get_primitives(); + GetClientRect(win->platform_window(), &client); + win->target()->set_bounds(rect_width(&client), rect_height(&client), win->pixel_aspect()); + return &win->target()->get_primitives(); } diff --git a/src/osd/modules/render/drawnone.h b/src/osd/modules/render/drawnone.h index 08873860e61..1fc4a50b689 100644 --- a/src/osd/modules/render/drawnone.h +++ b/src/osd/modules/render/drawnone.h @@ -17,7 +17,7 @@ class renderer_none : public osd_renderer { public: - renderer_none(osd_window *window) + renderer_none(std::shared_ptr window) : osd_renderer(window, FLAG_NONE) { } virtual ~renderer_none() { } diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index a7ffe24a5df..01d8085efd7 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -559,11 +559,13 @@ void renderer_ogl::initialize_gl() int renderer_ogl::create() { + auto win = assert_window(); + // create renderer #if defined(OSD_WINDOWS) - m_gl_context = global_alloc(win_gl_context(window().platform_window())); + m_gl_context = global_alloc(win_gl_context(win->platform_window())); #else - m_gl_context = global_alloc(sdl_gl_context(window().platform_window())); + m_gl_context = global_alloc(sdl_gl_context(win->platform_window())); #endif if (m_gl_context->LastErrorMsg() != nullptr) { @@ -627,12 +629,19 @@ void renderer_ogl::destroy_all_textures() if ( !m_initialized ) return; + auto win = try_getwindow(); + + // During destroy this can get called + // and the window is no longer available + if (win == nullptr) + return; + m_gl_context->MakeCurrent(); - if(window().m_primlist) + if(win->m_primlist) { lock=TRUE; - window().m_primlist->acquire_lock(); + win->m_primlist->acquire_lock(); } glFinish(); @@ -694,7 +703,7 @@ void renderer_ogl::destroy_all_textures() m_initialized = 0; if (lock) - window().m_primlist->release_lock(); + win->m_primlist->release_lock(); } //============================================================ // loadGLExtensions @@ -914,7 +923,7 @@ void renderer_ogl::loadGLExtensions() if ( m_useglsl ) { - if ( window().prescale() != 1 ) + if (assert_window()->prescale() != 1 ) { m_useglsl = 0; if (_once) @@ -1023,7 +1032,9 @@ int renderer_ogl::draw(const int update) } #endif - osd_dim wdim = window().get_size(); + auto win = assert_window(); + + osd_dim wdim = win->get_size(); if (has_flags(FI_CHANGED) || (wdim.width() != m_width) || (wdim.height() != m_height)) { @@ -1074,7 +1085,7 @@ int renderer_ogl::draw(const int update) // we're doing nothing 3d, so the Z-buffer is currently not interesting glDisable(GL_DEPTH_TEST); - if (window().machine().options().antialias()) + if (win->machine().options().antialias()) { // enable antialiasing for lines glEnable(GL_LINE_SMOOTH); @@ -1154,10 +1165,10 @@ int renderer_ogl::draw(const int update) m_last_hofs = hofs; m_last_vofs = vofs; - window().m_primlist->acquire_lock(); + win->m_primlist->acquire_lock(); // now draw - for (render_primitive &prim : *window().m_primlist) + for (render_primitive &prim : *win->m_primlist) { int i; @@ -1373,7 +1384,7 @@ int renderer_ogl::draw(const int update) pendingPrimitive=GL_NO_PRIMITIVE; } - window().m_primlist->release_lock(); + win->m_primlist->release_lock(); m_init_context = 0; m_gl_context->SwapBuffer(); @@ -1508,8 +1519,10 @@ void renderer_ogl::texture_compute_size_subroutine(ogl_texture_info *texture, UI texture->xprescale--; while (texture->yprescale > 1 && height_create * texture->yprescale > m_texture_max_height) texture->yprescale--; - if (PRIMFLAG_GET_SCREENTEX(flags) && (texture->xprescale != window().prescale() || texture->yprescale != window().prescale())) - osd_printf_warning("SDL: adjusting prescale from %dx%d to %dx%d\n", window().prescale(), window().prescale(), texture->xprescale, texture->yprescale); + + auto win = assert_window(); + if (PRIMFLAG_GET_SCREENTEX(flags) && (texture->xprescale != win->prescale() || texture->yprescale != win->prescale())) + osd_printf_warning("SDL: adjusting prescale from %dx%d to %dx%d\n", win->prescale(), win->prescale(), texture->xprescale, texture->yprescale); width *= texture->xprescale; height *= texture->yprescale; @@ -1871,8 +1884,9 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, texture->texinfo.seqid = -1; // force set data if (PRIMFLAG_GET_SCREENTEX(flags)) { - texture->xprescale = window().prescale(); - texture->yprescale = window().prescale(); + auto win = assert_window(); + texture->xprescale = win->prescale(); + texture->yprescale = win->prescale(); } else { diff --git a/src/osd/modules/render/drawogl.h b/src/osd/modules/render/drawogl.h index 7b89040e925..6b959f1da35 100644 --- a/src/osd/modules/render/drawogl.h +++ b/src/osd/modules/render/drawogl.h @@ -95,7 +95,7 @@ public: class renderer_ogl : public osd_renderer { public: - renderer_ogl(osd_window *window) + renderer_ogl(std::shared_ptr window) : osd_renderer(window, FLAG_NEEDS_OPENGL) , m_blittimer(0) , m_width(0) @@ -141,14 +141,18 @@ public: #endif virtual render_primitive_list *get_primitives() override { - osd_dim nd = window().get_size(); + auto win = try_getwindow(); + if (win == nullptr) + return nullptr; + + osd_dim nd = win->get_size(); if (nd != m_blit_dim) { m_blit_dim = nd; notify_changed(); } - window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().pixel_aspect()); - return &window().target()->get_primitives(); + win->target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), win->pixel_aspect()); + return &win->target()->get_primitives(); } #ifdef OSD_WINDOWS diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index af597516633..72d2f4c4c91 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -105,8 +105,10 @@ void renderer_sdl1::setup_texture(const osd_dim &size) SDL_DisplayMode mode; UINT32 fmt; + auto win = assert_window(); + // Determine preferred pixelformat and set up yuv if necessary - SDL_GetCurrentDisplayMode(*((UINT64 *)window().monitor()->oshandle()), &mode); + SDL_GetCurrentDisplayMode(*((UINT64 *)win->monitor()->oshandle()), &mode); if (m_yuv_bitmap) { @@ -121,11 +123,11 @@ void renderer_sdl1::setup_texture(const osd_dim &size) int m_hw_scale_width = 0; int m_hw_scale_height = 0; - window().target()->compute_minimum_size(m_hw_scale_width, m_hw_scale_height); - if (window().prescale()) + win->target()->compute_minimum_size(m_hw_scale_width, m_hw_scale_height); + if (win->prescale()) { - m_hw_scale_width *= window().prescale(); - m_hw_scale_height *= window().prescale(); + m_hw_scale_width *= win->prescale(); + m_hw_scale_height *= win->prescale(); /* This must be a multiple of 2 */ m_hw_scale_width = (m_hw_scale_width + 1) & ~1; @@ -185,6 +187,7 @@ int renderer_sdl1::create() { const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode]; + auto win = assert_window(); // create renderer /* set hints ... */ @@ -192,16 +195,16 @@ int renderer_sdl1::create() if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(window().platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); else - m_sdl_renderer = SDL_CreateRenderer(window().platform_window(), -1, SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_ACCELERATED); if (!m_sdl_renderer) { if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(window().platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE); + m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE); else - m_sdl_renderer = SDL_CreateRenderer(window().platform_window(), -1, SDL_RENDERER_SOFTWARE); + m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_SOFTWARE); } if (!m_sdl_renderer) @@ -311,7 +314,9 @@ int renderer_sdl1::draw(int update) return 0; } - osd_dim wdim = window().get_size(); + auto win = assert_window(); + + osd_dim wdim = win->get_size(); if (has_flags(FI_CHANGED) || (wdim != m_last_dim)) { destroy_all_textures(); @@ -378,7 +383,7 @@ int renderer_sdl1::draw(int update) m_last_hofs = hofs; m_last_vofs = vofs; - window().m_primlist->acquire_lock(); + win->m_primlist->acquire_lock(); int mamewidth, mameheight; @@ -396,7 +401,7 @@ int renderer_sdl1::draw(int update) // FIXME: this could be a lot easier if we get the primlist here! // Bounds would be set fit for purpose and done! - for (render_primitive &prim : *window().m_primlist) + for (render_primitive &prim : *win->m_primlist) { prim.bounds.x0 = floor(fw * prim.bounds.x0 + 0.5f); prim.bounds.x1 = floor(fw * prim.bounds.x1 + 0.5f); @@ -410,23 +415,23 @@ int renderer_sdl1::draw(int update) switch (rmask) { case 0x0000ff00: - software_renderer::draw_primitives(*window().m_primlist, surfptr, mamewidth, mameheight, pitch / 4); + software_renderer::draw_primitives(*win->m_primlist, surfptr, mamewidth, mameheight, pitch / 4); break; case 0x00ff0000: - software_renderer::draw_primitives(*window().m_primlist, surfptr, mamewidth, mameheight, pitch / 4); + software_renderer::draw_primitives(*win->m_primlist, surfptr, mamewidth, mameheight, pitch / 4); break; case 0x000000ff: - software_renderer::draw_primitives(*window().m_primlist, surfptr, mamewidth, mameheight, pitch / 4); + software_renderer::draw_primitives(*win->m_primlist, surfptr, mamewidth, mameheight, pitch / 4); break; case 0xf800: - software_renderer::draw_primitives(*window().m_primlist, surfptr, mamewidth, mameheight, pitch / 2); + software_renderer::draw_primitives(*win->m_primlist, surfptr, mamewidth, mameheight, pitch / 2); break; case 0x7c00: - software_renderer::draw_primitives(*window().m_primlist, surfptr, mamewidth, mameheight, pitch / 2); + software_renderer::draw_primitives(*win->m_primlist, surfptr, mamewidth, mameheight, pitch / 2); break; default: @@ -438,11 +443,11 @@ int renderer_sdl1::draw(int update) { assert (m_yuv_bitmap != nullptr); assert (surfptr != nullptr); - software_renderer::draw_primitives(*window().m_primlist, m_yuv_bitmap, mamewidth, mameheight, mamewidth); + software_renderer::draw_primitives(*win->m_primlist, m_yuv_bitmap, mamewidth, mameheight, mamewidth); sm->yuv_blit((UINT16 *)m_yuv_bitmap, surfptr, pitch, m_yuv_lookup, mamewidth, mameheight); } - window().m_primlist->release_lock(); + win->m_primlist->release_lock(); // unlock and flip SDL_UnlockTexture(m_texture_id); @@ -671,12 +676,16 @@ static void yuv_RGB_to_YUY2X2(const UINT16 *bitmap, UINT8 *ptr, const int pitch, render_primitive_list *renderer_sdl1::get_primitives() { - osd_dim nd = window().get_size(); + auto win = try_getwindow(); + if (win == nullptr) + return nullptr; + + osd_dim nd = win->get_size(); if (nd != m_blit_dim) { m_blit_dim = nd; notify_changed(); } - window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().pixel_aspect()); - return &window().target()->get_primitives(); + win->target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), win->pixel_aspect()); + return &win->target()->get_primitives(); } diff --git a/src/osd/modules/render/drawsdl.h b/src/osd/modules/render/drawsdl.h index 2958dbf265a..4bdceb69ab7 100644 --- a/src/osd/modules/render/drawsdl.h +++ b/src/osd/modules/render/drawsdl.h @@ -20,7 +20,7 @@ class renderer_sdl1 : public osd_renderer { public: - renderer_sdl1(osd_window *w, int extra_flags) + renderer_sdl1(std::shared_ptr w, int extra_flags) : osd_renderer(w, FLAG_NEEDS_OPENGL | extra_flags) , m_sdl_renderer(nullptr) , m_texture_id(nullptr) diff --git a/src/osd/modules/sound/direct_sound.cpp b/src/osd/modules/sound/direct_sound.cpp index 83b7edd65ca..5b20cfb61fa 100644 --- a/src/osd/modules/sound/direct_sound.cpp +++ b/src/osd/modules/sound/direct_sound.cpp @@ -404,10 +404,10 @@ HRESULT sound_direct_sound::dsound_init() #ifdef SDLMAME_WIN32 SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version); - SDL_GetWindowWMInfo(sdl_window_list->platform_window(), &wminfo); + SDL_GetWindowWMInfo(sdl_window_list.front()->platform_window(), &wminfo); HWND const window = wminfo.info.win.window; #else // SDLMAME_WIN32 - HWND const window = win_window_list->platform_window(); + HWND const window = win_window_list.front()->platform_window(); #endif // SDLMAME_WIN32 result = m_dsound->SetCooperativeLevel(window, DSSCL_PRIORITY); } diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index 099c4bccfc9..3aafee31dcc 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -82,7 +82,7 @@ bool sdl_osd_interface::video_init() get_resolution(options().resolution(), options().resolution(index), &conf, TRUE); // create window ... - sdl_window_info *win = global_alloc(sdl_window_info(machine(), index, osd_monitor_info::pick_monitor(reinterpret_cast(options()), index), &conf)); + std::shared_ptr win = std::make_shared(machine(), index, osd_monitor_info::pick_monitor(reinterpret_cast(options()), index), &conf); if (win->window_init()) return false; @@ -140,7 +140,7 @@ void sdl_osd_interface::update(bool skip_redraw) if (!skip_redraw) { // profiler_mark(PROFILER_BLIT); - for (sdl_window_info *window = sdl_window_list; window != NULL; window = window->m_next) + for (auto window : sdl_window_list) window->update(); // profiler_mark(PROFILER_END); } @@ -270,20 +270,14 @@ finishit: static void check_osd_inputs(running_machine &machine) { - sdl_window_info *window = sdl_window_list; - // check for toggling fullscreen mode if (machine.ui_input().pressed(IPT_OSD_1)) { - sdl_window_info *curwin = sdl_window_list; - - while (curwin != (sdl_window_info *)NULL) - { + for (auto curwin : sdl_window_list) curwin->toggle_full_screen(); - curwin = curwin->m_next; - } } + auto window = sdl_window_list.front(); if (machine.ui_input().pressed(IPT_OSD_2)) { //FIXME: on a per window basis diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index ea3843515f7..0f6b94abaaf 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -23,6 +23,8 @@ #ifndef _MSC_VER #include #endif +#include +#include // MAME headers @@ -80,14 +82,7 @@ // GLOBAL VARIABLES //============================================================ -sdl_window_info *sdl_window_list; - - -//============================================================ -// LOCAL VARIABLES -//============================================================ - -static sdl_window_info **last_window_ptr; +std::list> sdl_window_list; class SDL_DM_Wrapper { @@ -104,31 +99,33 @@ static SDL_threadID window_threadid; // debugger //static int in_background; -struct worker_param { +class worker_param +{ +public: worker_param() : m_window(nullptr), m_list(nullptr), m_resize_new_width(0), m_resize_new_height(0) { } - worker_param(sdl_window_info *awindow, render_primitive_list &alist) + worker_param(std::shared_ptr awindow, render_primitive_list &alist) : m_window(awindow), m_list(&alist), m_resize_new_width(0), m_resize_new_height(0) { } - worker_param(sdl_window_info *awindow, int anew_width, int anew_height) + worker_param(std::shared_ptr awindow, int anew_width, int anew_height) : m_window(awindow), m_list(nullptr), m_resize_new_width(anew_width), m_resize_new_height(anew_height) { } - worker_param(sdl_window_info *awindow) + worker_param(std::shared_ptr awindow) : m_window(awindow), m_list(nullptr), m_resize_new_width(0), m_resize_new_height(0) { } - sdl_window_info *window() const { assert(m_window != nullptr); return m_window; } + std::shared_ptr window() const { assert(m_window != nullptr); return m_window; } render_primitive_list *list() const { return m_list; } int new_width() const { return m_resize_new_width; } int new_height() const { return m_resize_new_height; } // FIXME: only needed for window set-up which returns an error. - void set_window(sdl_window_info *window) { m_window = window; } + void set_window(std::shared_ptr window) { m_window = window; } private: - sdl_window_info *m_window; + std::shared_ptr m_window; render_primitive_list *m_list; int m_resize_new_width; int m_resize_new_height; @@ -145,20 +142,15 @@ static void sdlwindow_sync(void); // execute_async //============================================================ - -static inline void execute_async(osd_work_callback callback, const worker_param &wp) +// The idea of using unique_ptr here is to make sure the caller isn't holding onto a copy +static inline void execute_async(osd_work_callback callback, std::unique_ptr wp) { - worker_param *wp_temp = (worker_param *) osd_malloc(sizeof(worker_param)); - *wp_temp = wp; - callback((void *) wp_temp, 0); + callback(wp.release(), 0); } -static inline void execute_sync(osd_work_callback callback, const worker_param &wp) +static inline void execute_sync(osd_work_callback callback, std::unique_ptr wp) { - worker_param *wp_temp = (worker_param *) osd_malloc(sizeof(worker_param)); - *wp_temp = wp; - - callback((void *) wp_temp, 0); + callback(wp.release(), 0); } @@ -166,9 +158,9 @@ static inline void execute_sync(osd_work_callback callback, const worker_param & // execute_async_wait //============================================================ -static inline void execute_async_wait(osd_work_callback callback, const worker_param &wp) +static inline void execute_async_wait(osd_work_callback callback, std::unique_ptr wp) { - execute_async(callback, wp); + execute_async(callback, std::move(wp)); sdlwindow_sync(); } @@ -254,7 +246,6 @@ bool sdl_osd_interface::window_init() osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i])); // set up the window list - last_window_ptr = &sdl_window_list; osd_printf_verbose("Leave sdlwindow_init\n"); return true; } @@ -272,10 +263,10 @@ static void sdlwindow_sync(void) void sdl_osd_interface::update_slider_list() { - for (sdl_window_info *window = sdl_window_list; window != nullptr; window = window->m_next) + for (auto window : sdl_window_list) { // check if any window has dirty sliders - if (&window->renderer() && window->renderer().sliders_dirty()) + if (window->renderer().sliders_dirty()) { build_slider_list(); return; @@ -287,7 +278,7 @@ void sdl_osd_interface::build_slider_list() { m_sliders.clear(); - for (sdl_window_info *window = sdl_window_list; window != nullptr; window = window->m_next) + for (auto window : sdl_window_list) { std::vector window_sliders = window->renderer().get_slider_list(); m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end()); @@ -309,20 +300,19 @@ static OSDWORK_CALLBACK( sdlwindow_exit_wt ) void sdl_osd_interface::window_exit() { - worker_param wp_dummy; + std::unique_ptr wp_dummy(nullptr); ASSERT_MAIN_THREAD(); osd_printf_verbose("Enter sdlwindow_exit\n"); // free all the windows - while (sdl_window_list != nullptr) + while (!sdl_window_list.empty()) { - sdl_window_info *temp = sdl_window_list; - sdl_window_list = temp->m_next; - temp->destroy(); - // free the window itself - global_free(temp); + auto window = sdl_window_list.front(); + + // Part of destroy removes the window from the list + window->destroy(); } switch(video_config.mode) @@ -345,7 +335,7 @@ void sdl_osd_interface::window_exit() break; } - execute_async_wait(&sdlwindow_exit_wt, wp_dummy); + execute_async_wait(&sdlwindow_exit_wt, std::move(wp_dummy)); osd_printf_verbose("Leave sdlwindow_exit\n"); @@ -384,8 +374,8 @@ void sdl_window_info::show_pointer() OSDWORK_CALLBACK( sdl_window_info::sdlwindow_resize_wt ) { - worker_param * wp = (worker_param *) param; - sdl_window_info * window = wp->window(); + auto wp = std::unique_ptr(static_cast(param)); + auto window = wp->window(); int width = wp->new_width(); int height = wp->new_height(); @@ -394,7 +384,6 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_resize_wt ) SDL_SetWindowSize(window->platform_window(), width, height); window->renderer().notify_changed(); - osd_free(wp); return nullptr; } @@ -405,7 +394,10 @@ void sdl_window_info::resize(INT32 width, INT32 height) osd_dim cd = get_size(); if (width != cd.width() || height != cd.height()) - execute_async_wait(&sdlwindow_resize_wt, worker_param(this, width, height)); + { + auto wp = std::make_unique(std::static_pointer_cast(shared_from_this()), width, height); + execute_async_wait(&sdlwindow_resize_wt, std::move(wp)); + } } @@ -416,26 +408,24 @@ void sdl_window_info::resize(INT32 width, INT32 height) OSDWORK_CALLBACK( sdl_window_info::notify_changed_wt ) { - worker_param *wp = (worker_param *) param; - sdl_window_info *window = wp->window(); + auto wp = std::unique_ptr(static_cast(param)); + auto window = wp->window(); ASSERT_WINDOW_THREAD(); window->renderer().notify_changed(); - osd_free(wp); return nullptr; } void sdl_window_info::notify_changed() { - worker_param wp; - + auto wp = std::make_unique(std::static_pointer_cast(shared_from_this())); if (SDL_ThreadID() == main_threadid) { - execute_async_wait(¬ify_changed_wt, worker_param(this)); + execute_async_wait(¬ify_changed_wt, std::move(wp)); } else - execute_sync(¬ify_changed_wt, worker_param(this)); + execute_sync(¬ify_changed_wt, std::move(wp)); } @@ -446,8 +436,8 @@ void sdl_window_info::notify_changed() OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) { - worker_param *wp = (worker_param *) param; - sdl_window_info *window = wp->window(); + auto wp = std::unique_ptr(static_cast(param)); + auto window = wp->window(); ASSERT_WINDOW_THREAD(); @@ -461,12 +451,6 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) window->m_windowed_dim = window->get_size(); } - if (window->m_renderer != nullptr) - { - delete window->m_renderer; - window->m_renderer = nullptr; - } - bool is_osx = false; #ifdef SDLMAME_MACOSX // FIXME: This is weird behaviour and certainly a bug in SDL @@ -482,7 +466,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) downcast(window->machine().osd()).release_keys(); - window->set_renderer(osd_renderer::make_for_type(video_config.mode, reinterpret_cast(window))); + window->set_renderer(osd_renderer::make_for_type(video_config.mode, window->shared_from_this())); // toggle the window mode window->set_fullscreen(!window->fullscreen()); @@ -495,13 +479,12 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) void sdl_window_info::toggle_full_screen() { ASSERT_MAIN_THREAD(); - - execute_async_wait(&sdlwindow_toggle_full_screen_wt, worker_param(this)); + auto wp = std::make_unique(std::static_pointer_cast(shared_from_this())); + execute_async_wait(&sdlwindow_toggle_full_screen_wt, std::move(wp)); } void sdl_window_info::modify_prescale(int dir) { - worker_param wp = worker_param(this); int new_prescale = prescale(); if (dir > 0 && prescale() < 3) @@ -513,11 +496,13 @@ void sdl_window_info::modify_prescale(int dir) { if (m_fullscreen && video_config.switchres) { - execute_async_wait(&sdlwindow_video_window_destroy_wt, wp); + auto wp = std::make_unique(std::static_pointer_cast(shared_from_this())); + execute_async_wait(&sdlwindow_video_window_destroy_wt, std::move(wp)); m_prescale = new_prescale; - execute_async_wait(&complete_create_wt, wp); + wp = std::make_unique(std::static_pointer_cast(shared_from_this())); + execute_async_wait(&complete_create_wt, std::move(wp)); } else @@ -570,12 +555,11 @@ void sdl_window_info::update_cursor_state() OSDWORK_CALLBACK( sdl_window_info::update_cursor_state_wt ) { - worker_param * wp = (worker_param *) param; - sdl_window_info * window = wp->window(); + auto wp = std::unique_ptr(static_cast(param)); + auto window = wp->window(); window->update_cursor_state(); - osd_free(wp); return nullptr; } @@ -591,7 +575,6 @@ int sdl_window_info::xy_to_render_target(int x, int y, int *xt, int *yt) int sdl_window_info::window_init() { - worker_param *wp = (worker_param *) osd_malloc(sizeof(worker_param)); int result; ASSERT_MAIN_THREAD(); @@ -602,10 +585,9 @@ int sdl_window_info::window_init() m_startmaximized = options.maximize(); // add us to the list - *last_window_ptr = this; - last_window_ptr = &this->m_next; + sdl_window_list.push_back(std::static_pointer_cast(shared_from_this())); - set_renderer(osd_renderer::make_for_type(video_config.mode, reinterpret_cast(this))); + set_renderer(osd_renderer::make_for_type(video_config.mode, static_cast(this)->shared_from_this())); // load the layout m_target = m_machine.render().target_alloc(); @@ -619,9 +601,9 @@ int sdl_window_info::window_init() else sprintf(m_title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), m_machine.system().description, m_machine.system().name, m_index); - wp->set_window(this); + auto wp = std::make_unique(std::static_pointer_cast(shared_from_this())); - result = *((int *) sdl_window_info::complete_create_wt((void *) wp, 0)); + result = *((int *) sdl_window_info::complete_create_wt(wp.release(), 0)); // handle error conditions if (result == 1) @@ -642,15 +624,11 @@ error: OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt ) { - worker_param * wp = (worker_param *) param; - sdl_window_info * window = wp->window(); + auto wp = std::unique_ptr(static_cast(param)); + auto window = wp->window(); ASSERT_WINDOW_THREAD(); - // free the textures etc - global_free(window->m_renderer); - window->m_renderer = nullptr; - if (window->fullscreen() && video_config.switchres) { SDL_SetWindowFullscreen(window->platform_window(), 0); // Try to set mode @@ -661,28 +639,21 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt ) // release all keys ... downcast(window->machine().osd()).release_keys(); - osd_free(wp); return nullptr; } void sdl_window_info::destroy() { - sdl_window_info **prevptr; - ASSERT_MAIN_THREAD(); //osd_event_wait(window->rendered_event, osd_ticks_per_second()*10); // remove us from the list - for (prevptr = &sdl_window_list; *prevptr != nullptr; prevptr = &(*prevptr)->m_next) - if (*prevptr == this) - { - *prevptr = this->m_next; - break; - } + sdl_window_list.remove(std::static_pointer_cast(shared_from_this())); // free the textures etc - execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(this)); + auto wp = std::make_unique(std::static_pointer_cast(shared_from_this())); + execute_async_wait(&sdlwindow_video_window_destroy_wt, std::move(wp)); // free the render target, after the textures! this->machine().render().target_free(m_target); @@ -776,7 +747,8 @@ void sdl_window_info::update() // adjust the cursor state //sdlwindow_update_cursor_state(machine, window); - execute_async(&update_cursor_state_wt, worker_param(this)); + auto wp = std::make_unique(std::static_pointer_cast(shared_from_this())); + execute_async(&update_cursor_state_wt, std::move(wp)); // if we're visible and running and not in the middle of a resize, draw if (m_target != nullptr) @@ -810,11 +782,11 @@ void sdl_window_info::update() { // ensure the target bounds are up-to-date, and then get the primitives - render_primitive_list &primlist = *m_renderer->get_primitives(); + render_primitive_list &primlist = *renderer().get_primitives(); // and redraw now - - execute_async(&draw_video_contents_wt, worker_param(this, primlist)); + auto wp = std::make_unique(std::static_pointer_cast(shared_from_this()), primlist); + execute_async(&draw_video_contents_wt, std::move(wp)); } } } @@ -850,14 +822,13 @@ void sdl_window_info::set_starting_view(int index, const char *defview, const ch OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) { - worker_param * wp = (worker_param *) param; - sdl_window_info * window = wp->window(); + auto wp = std::unique_ptr(static_cast(param)); + auto window = wp->window(); osd_dim temp(0,0); static int result[2] = {0,1}; ASSERT_WINDOW_THREAD(); - osd_free(wp); // clear out original mode. Needed on OSX if (window->fullscreen()) @@ -981,14 +952,19 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) // set main window if (window->m_index > 0) { - for (auto w = sdl_window_list; w != nullptr; w = w->m_next) + for (auto w : sdl_window_list) { if (w->m_index == 0) - { - window->m_main = w; + { + window->set_main_window(std::dynamic_pointer_cast(w)); break; + } + } } - } + else + { + // We must be the main window + window->set_main_window(window); } // update monitor resolution after mode change to ensure proper pixel aspect @@ -1058,8 +1034,8 @@ void sdl_window_info::measure_fps(int update) OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt ) { int update = 1; - worker_param *wp = (worker_param *) param; - sdl_window_info *window = wp->window(); + auto wp = std::unique_ptr(static_cast(param)); + auto window = wp->window(); ASSERT_REDRAW_THREAD(); @@ -1096,7 +1072,6 @@ OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt ) /* all done, ready for next */ window->m_rendered_event.set(); - osd_free(wp); return nullptr; } @@ -1363,6 +1338,5 @@ sdl_window_info::sdl_window_info(running_machine &a_machine, int index, osd_moni sdl_window_info::~sdl_window_info() { - global_free(m_renderer); global_free(m_original_mode); } diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index 14ee6e3c19a..403c12a8e46 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -17,6 +17,8 @@ #include "modules/osdwindow.h" #include +#include +#include //============================================================ @@ -65,7 +67,6 @@ public: render_target *target() override { return m_target; } int prescale() const { return m_prescale; } - osd_renderer &renderer() const { return *m_renderer; } // Pointer to next window sdl_window_info * m_next; @@ -88,11 +89,6 @@ private: int m_extra_flags; - void set_renderer(osd_renderer *renderer) - { - m_renderer = renderer; - } - static OSDWORK_CALLBACK( complete_create_wt ); private: @@ -111,7 +107,6 @@ private: // monitor info osd_monitor_info * m_monitor; int m_fullscreen; - osd_renderer * m_renderer; // static callbacks ... @@ -136,7 +131,7 @@ struct osd_draw_callbacks //============================================================ // window - list -extern sdl_window_info *sdl_window_list; +extern std::list> sdl_window_list; //============================================================ // PROTOTYPES diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index c4ee864389a..d394a3e1821 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -81,7 +81,7 @@ bool windows_osd_interface::video_init() } if (video_config.mode != VIDEO_MODE_NONE) - SetForegroundWindow(win_window_list->platform_window()); + SetForegroundWindow(win_window_list.front()->platform_window()); return true; } @@ -170,7 +170,7 @@ void windows_osd_interface::update(bool skip_redraw) if (!skip_redraw) { // profiler_mark(PROFILER_BLIT); - for (win_window_info *window = win_window_list; window != NULL; window = window->m_next) + for (auto window : win_window_list) window->update(); // profiler_mark(PROFILER_END); } diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 1bae62625f3..f5534a13544 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -17,6 +17,8 @@ #include #include +#include +#include // MAME headers #include "emu.h" @@ -87,8 +89,7 @@ using namespace Windows::UI::Core; // GLOBAL VARIABLES //============================================================ -win_window_info *win_window_list; -static win_window_info **last_window_ptr; +std::list> win_window_list; static DWORD main_threadid; // actual physical resolution @@ -250,15 +251,12 @@ bool windows_osd_interface::window_init() } video_config.mode = current_mode; - // set up the window list - last_window_ptr = &win_window_list; - return true; } void windows_osd_interface::update_slider_list() { - for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) { // check if any window has dirty sliders if (window->m_renderer && window->m_renderer->sliders_dirty()) @@ -271,19 +269,14 @@ void windows_osd_interface::update_slider_list() int windows_osd_interface::window_count() { - int count = 0; - for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next) - { - count++; - } - return count; + return win_window_list.size(); } void windows_osd_interface::build_slider_list() { m_sliders.clear(); - for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) { // take the sliders of the first window std::vector window_sliders = window->m_renderer->get_slider_list(); @@ -293,7 +286,7 @@ void windows_osd_interface::build_slider_list() void windows_osd_interface::add_audio_to_recording(const INT16 *buffer, int samples_this_frame) { - win_window_info *window = win_window_list; // We only record on the first window + auto window = win_window_list.front(); // We only record on the first window if (window != nullptr && window->m_renderer != nullptr) { window->m_renderer->add_audio_to_recording(buffer, samples_this_frame); @@ -310,15 +303,16 @@ void windows_osd_interface::window_exit() assert(GetCurrentThreadId() == main_threadid); // if we hid the cursor during the emulation, show it - win_window_list->show_pointer(); + if (!win_window_list.empty()) + win_window_list.front()->show_pointer(); // free all the windows - while (win_window_list != nullptr) + while (!win_window_list.empty()) { - win_window_info *temp = win_window_list; - win_window_list = temp->m_next; - temp->destroy(); - global_free(temp); + auto window = win_window_list.front(); + + // Destroy removes it from the list also + window->destroy(); } switch(video_config.mode) @@ -353,14 +347,18 @@ void windows_osd_interface::window_exit() CloseHandle(window_thread_ready_event); } -win_window_info::win_window_info(running_machine &machine) - : osd_window(), m_next(nullptr), +win_window_info::win_window_info( + running_machine &machine, + int index, + osd_monitor_info *monitor, + const osd_window_config *config) : osd_window(), + m_next(nullptr), m_init_state(0), m_startmaximized(0), m_isminimized(0), m_ismaximized(0), - m_monitor(nullptr), - m_fullscreen(0), + m_monitor(monitor), + //m_fullscreen(0), m_fullscreen_safe(0), m_aspect(0), m_target(nullptr), @@ -378,14 +376,12 @@ win_window_info::win_window_info(running_machine &machine) m_non_fullscreen_bounds.right = 0; m_non_fullscreen_bounds.bottom = 0; m_prescale = video_config.prescale; + + } win_window_info::~win_window_info() { - if (m_renderer != nullptr) - { - delete m_renderer; - } } POINT win_window_info::s_saved_cursor_pos = { -1, -1 }; @@ -480,7 +476,7 @@ void winwindow_process_events_periodic(running_machine &machine) static BOOL is_mame_window(HWND hwnd) { - for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) if (window->platform_window() == hwnd) return TRUE; @@ -655,12 +651,10 @@ void winwindow_dispatch_message(running_machine &machine, MSG *message) void winwindow_take_snap(void) { - win_window_info *window; - assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) { window->m_renderer->save(); } @@ -675,12 +669,10 @@ void winwindow_take_snap(void) void winwindow_toggle_fsfx(void) { - win_window_info *window; - assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) { window->m_renderer->toggle_fsfx(); } @@ -695,12 +687,10 @@ void winwindow_toggle_fsfx(void) void winwindow_take_video(void) { - win_window_info *window; - assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) { window->m_renderer->record(); } @@ -715,12 +705,10 @@ void winwindow_take_video(void) void winwindow_toggle_full_screen(void) { - win_window_info *window; - assert(GetCurrentThreadId() == main_threadid); // if we are in debug mode, never go full screen - for (window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) if (window->machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) return; @@ -728,9 +716,11 @@ void winwindow_toggle_full_screen(void) video_config.windowed = !video_config.windowed; // iterate over windows and toggle their fullscreen state - for (window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) SendMessage(window->platform_window(), WM_USER_SET_FULLSCREEN, !video_config.windowed, 0); - SetForegroundWindow(win_window_list->platform_window()); + + // Set the first window as foreground + SetForegroundWindow(win_window_list.front()->platform_window()); } @@ -743,10 +733,9 @@ void winwindow_toggle_full_screen(void) BOOL winwindow_has_focus(void) { HWND focuswnd = GetFocus(); - win_window_info *window; // see if one of the video windows has focus - for (window = win_window_list; window != nullptr; window = window->m_next) + for (auto window : win_window_list) if (focuswnd == window->platform_window()) return TRUE; @@ -763,19 +752,21 @@ void winwindow_update_cursor_state(running_machine &machine) { assert(GetCurrentThreadId() == main_threadid); - win_window_info *window = win_window_list; - - // If no window yet, just return - if (window == nullptr) + // If no windows, just return + if (win_window_list.empty()) return; + auto window = win_window_list.front(); + // if we should hide the mouse cursor, then do it // rules are: // 1. we must have focus before hiding the cursor // 2. we also hide the cursor in full screen mode and when tshe window doesn't have a menu // 3. we also hide the cursor in windowed mode if we're not paused and // the input system requests it - if (winwindow_has_focus() && ((!video_config.windowed && !window->win_has_menu()) || (!machine.paused() && downcast(machine.osd()).should_hide_mouse()))) + if (winwindow_has_focus() && ( + (window->fullscreen() && !window->win_has_menu()) + || (!machine.paused() && WINOSD(machine)->should_hide_mouse()))) { // hide cursor window->hide_pointer(); @@ -802,44 +793,37 @@ void winwindow_update_cursor_state(running_machine &machine) void win_window_info::create(running_machine &machine, int index, osd_monitor_info *monitor, const osd_window_config *config) { - win_window_info *win; - assert(GetCurrentThreadId() == main_threadid); // allocate a new window object - win_window_info *window = global_alloc(win_window_info(machine)); - window->m_win_config = *config; - window->m_monitor = monitor; - window->m_fullscreen = !video_config.windowed; - window->m_index = index; + auto window = std::make_shared(machine, index, monitor, config); // set main window - if (index > 0) + if (window->m_index > 0) { - for (auto w = win_window_list; w != nullptr; w = w->m_next) + for (auto w : win_window_list) { if (w->m_index == 0) { - window->m_main = w; + window->set_main_window(std::dynamic_pointer_cast(w)); break; } } } else { - // Give the main window a reference to itself - window->m_main = window; + // We must be the main window + window->set_main_window(window); } // see if we are safe for fullscreen window->m_fullscreen_safe = TRUE; - for (win = win_window_list; win != nullptr; win = win->m_next) + for (auto win : win_window_list) if (win->m_monitor == monitor) window->m_fullscreen_safe = FALSE; // add us to the list - *last_window_ptr = window; - last_window_ptr = &window->m_next; + win_window_list.push_back(window); // load the layout window->m_target = machine.render().target_alloc(); @@ -880,17 +864,10 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in void win_window_info::destroy() { - win_window_info **prevptr; - assert(GetCurrentThreadId() == main_threadid); // remove us from the list - for (prevptr = &win_window_list; *prevptr != nullptr; prevptr = &(*prevptr)->m_next) - if (*prevptr == this) - { - *prevptr = this->m_next; - break; - } + win_window_list.remove(std::static_pointer_cast(shared_from_this())); // destroy the window if (platform_window() != nullptr) @@ -927,7 +904,7 @@ void win_window_info::update() m_targetlayerconfig = targetlayerconfig; // in window mode, reminimize/maximize - if (!m_fullscreen) + if (!fullscreen()) { if (m_isminimized) SendMessage(platform_window(), WM_USER_SET_MINSIZE, 0, 0); @@ -985,7 +962,7 @@ osd_monitor_info *win_window_info::winwindow_video_window_monitor(const osd_rect osd_monitor_info *monitor; // in window mode, find the nearest - if (!m_fullscreen) + if (!fullscreen()) { if (proposed != nullptr) { @@ -1159,7 +1136,7 @@ int winwindow_ui_is_paused(running_machine &machine) int win_window_info::wnd_extra_width() { RECT temprect = { 100, 100, 200, 200 }; - if (m_fullscreen) + if (fullscreen()) return 0; AdjustWindowRectEx(&temprect, WINDOW_STYLE, win_has_menu(), WINDOW_STYLE_EX); return rect_width(&temprect) - 100; @@ -1175,7 +1152,7 @@ int win_window_info::wnd_extra_width() int win_window_info::wnd_extra_height() { RECT temprect = { 100, 100, 200, 200 }; - if (m_fullscreen) + if (fullscreen()) return 0; AdjustWindowRectEx(&temprect, WINDOW_STYLE, win_has_menu(), WINDOW_STYLE_EX); return rect_height(&temprect) - 100; @@ -1304,10 +1281,10 @@ int win_window_info::complete_create() // create the window, but don't show it yet HWND hwnd = win_create_window_ex_utf8( - m_fullscreen ? FULLSCREEN_STYLE_EX : WINDOW_STYLE_EX, + fullscreen() ? FULLSCREEN_STYLE_EX : WINDOW_STYLE_EX, "MAME", m_title, - m_fullscreen ? FULLSCREEN_STYLE : WINDOW_STYLE, + fullscreen() ? FULLSCREEN_STYLE : WINDOW_STYLE, monitorbounds.left() + 20, monitorbounds.top() + 20, monitorbounds.left() + 100, monitorbounds.top() + 100, nullptr,//(win_window_list != nullptr) ? win_window_list->m_hwnd : nullptr, @@ -1343,14 +1320,9 @@ int win_window_info::complete_create() adjust_window_position_after_major_change(); // show the window - if (!m_fullscreen || m_fullscreen_safe) + if (!fullscreen() || m_fullscreen_safe) { - // finish off by trying to initialize DirectX; if we fail, ignore it - if (m_renderer != nullptr) - { - delete m_renderer; - } - m_renderer = osd_renderer::make_for_type(video_config.mode, reinterpret_cast(this)); + m_renderer = osd_renderer::make_for_type(video_config.mode, std::static_pointer_cast(shared_from_this())); if (m_renderer->create()) return 1; @@ -1401,7 +1373,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR // non-client paint: punt if full screen case WM_NCPAINT: - if (!window->m_fullscreen || window->win_has_menu()) + if (!window->fullscreen() || window->win_has_menu()) return DefWindowProc(wnd, message, wparam, lparam); break; @@ -1547,8 +1519,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR // destroy: clean up all attached rendering bits and nullptr out our hwnd case WM_DESTROY: - global_free(window->m_renderer); - window->m_renderer = nullptr; + window->m_renderer.reset(); window->set_platform_window(nullptr); return DefWindowProc(wnd, message, wparam, lparam); @@ -1718,7 +1689,7 @@ osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad propheight = MAX(propheight, minheight); // clamp against the maximum (fit on one screen for full screen mode) - if (m_fullscreen) + if (fullscreen()) { maxwidth = monitor->position_size().width() - extrawidth; maxheight = monitor->position_size().height() - extraheight; @@ -1878,7 +1849,7 @@ void win_window_info::update_minmax_state() { assert(GetCurrentThreadId() == window_threadid); - if (!m_fullscreen) + if (!fullscreen()) { RECT bounds; @@ -1963,7 +1934,7 @@ void win_window_info::adjust_window_position_after_major_change() osd_rect newrect = RECT_to_osd_rect(oldrect); // adjust the window size so the client area is what we want - if (!m_fullscreen) + if (!fullscreen()) { // constrain the existing size to the aspect ratio if (video_config.keepaspect) @@ -1980,12 +1951,12 @@ void win_window_info::adjust_window_position_after_major_change() // adjust the position if different if (oldrect.left != newrect.left() || oldrect.top != newrect.top() || oldrect.right != newrect.right() || oldrect.bottom != newrect.bottom()) - SetWindowPos(platform_window(), m_fullscreen ? HWND_TOPMOST : HWND_TOP, + SetWindowPos(platform_window(), fullscreen() ? HWND_TOPMOST : HWND_TOP, newrect.left(), newrect.top(), newrect.width(), newrect.height(), 0); // take note of physical window size (used for lightgun coordinate calculation) - if (this == win_window_list) + if (m_index == 0) { win_physical_width = newrect.width(); win_physical_height = newrect.height(); @@ -2004,13 +1975,12 @@ void win_window_info::set_fullscreen(int fullscreen) assert(GetCurrentThreadId() == window_threadid); // if we're in the right state, punt - if (m_fullscreen == fullscreen) + if (this->fullscreen() == fullscreen) return; - m_fullscreen = fullscreen; + video_config.windowed = !fullscreen; // kill off the drawers - delete m_renderer; - m_renderer = nullptr; + m_renderer.reset(); // hide ourself ShowWindow(platform_window(), SW_HIDE); @@ -2062,12 +2032,12 @@ void win_window_info::set_fullscreen(int fullscreen) adjust_window_position_after_major_change(); // show ourself - if (!m_fullscreen || m_fullscreen_safe) + if (!this->fullscreen() || m_fullscreen_safe) { if (video_config.mode != VIDEO_MODE_NONE) ShowWindow(platform_window(), SW_SHOW); - m_renderer = reinterpret_cast(osd_renderer::make_for_type(video_config.mode, reinterpret_cast(this))); + m_renderer = osd_renderer::make_for_type(video_config.mode, std::static_pointer_cast(shared_from_this())); if (m_renderer->create()) exit(1); } diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index a8d1fbffdb6..47eae45d034 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -17,6 +17,9 @@ #include #include +#include +#include + #include "video.h" #include "render.h" @@ -44,13 +47,13 @@ class win_window_info : public osd_window { public: - win_window_info(running_machine &machine); + win_window_info(running_machine &machine, int index, osd_monitor_info *monitor, const osd_window_config *config); virtual ~win_window_info(); running_machine &machine() const override { return m_machine; } virtual render_target *target() override { return m_target; } - int fullscreen() const override { return m_fullscreen; } + int fullscreen() const override { return !video_config.windowed; } void update(); @@ -108,7 +111,7 @@ public: // monitor info osd_monitor_info * m_monitor; - int m_fullscreen; + //int m_fullscreen; int m_fullscreen_safe; float m_aspect; @@ -125,7 +128,7 @@ public: int m_lastclicky; // drawing data - osd_renderer * m_renderer; + std::unique_ptr m_renderer; private: void draw_video_contents(HDC dc, int update); @@ -162,7 +165,7 @@ struct osd_draw_callbacks //============================================================ // windows -extern win_window_info *win_window_list; +extern std::list> win_window_list; diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 7edb996fb0a..14243c67fd7 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -69,11 +69,11 @@ public: char buffer[1024]; // if we are in fullscreen mode, go to windowed mode - if ((video_config.windowed == 0) && (win_window_list != nullptr)) + if ((video_config.windowed == 0) && !win_window_list.empty()) winwindow_toggle_full_screen(); vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args); - win_message_box_utf8(win_window_list ? win_window_list->platform_window() : nullptr, buffer, emulator_info::get_appname(), MB_OK); + win_message_box_utf8(!win_window_list.empty() ? win_window_list.front()->platform_window() : nullptr, buffer, emulator_info::get_appname(), MB_OK); } else chain_output(channel, msg, args); @@ -515,7 +515,7 @@ void windows_osd_interface::init(running_machine &machine) osd_common_t::init_subsystems(); // notify listeners of screen configuration - for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next) + for (auto info : win_window_list) { machine.output().set_value(string_format("Orientation(%s)", info->m_monitor->devicename()).c_str(), info->m_targetorient); }